OrderMatching
ContractPrice
PairId: The contract pair id defined by zkLink.
MarketPrice: The market price of the contract pair
SpotPrice
TokenId: The token id defined by zkLink.
price: The spot price of the token.
type Order
The spot order type of taker and maker. it's a opaque data type.
func NewOrder
Create a new Order.
input:
accountId: the user account id
subAccountId: the user sub account id
slotId: the slot id of order
nonce: the nonce of user account
baseTokenId: the token id of the base token of trade pair, for example, "BTC" token id of "BTCUSDT" pair
quoteTokenId: the token id of the quote token of trade pari, for example, "USDT" token id of "BTCUSDT" pair
amount: the amount of base token
price: the price of base token
isSell: sell token or not
hasSubsidy: subsidy only works for maker and makerFeeRate
makeFeeRate: the fee maker rate, 100 means 1%, max is 2.56%
takerFeeRate: the fee taker rate, 100 means 1%, max is 2.56%
signature: optional, the L3 signature of the Order
func (*Order) GetSignature
Get the L3 signature of the Order
func (*Order) GetSignature
Get the Order signature.
func (*Order) GetBytes
Get the encoded bytes to create the L3 signature.
func *Order) JsonStr
Get the json string of the Order.
func (*Order) IsValid
Check if the Order is valid or not.
func (*Order) IsSignatureValid
Check if the L3 signature is valid or not.
func (*Order) CreateSignedOrder
Returns a new order with L3 signature.
input:
OrderMatchingBuilder
type OrderMatching
func NewOrderMatching
func (*OrderMatching) GetBytes
Get the encoded bytes used to create the L3 signature.
func (*OrderMatching) TxHash() []uint8
func (*OrderMatching) JsonStr
func (*OrderMatching) IsValid() bool
Check if all the fields in OrderMatching are valid. For example, if the ChainId
is exceeded the maximum ChainId, it will return false.
func (*OrderMatching) CreateSignedTx
input:
func (*OrderMatching) GetSignature
Get the L3 signature of OrderMatching transaction.
func (*OrderMatching) IsSignatureValid
Check if the L3 signature in the transaction is valid or not.
func (*OrderMatching) ToZklinkTx
Last updated
Was this helpful?