ContractMatching
type ContractBuilder
type ContractBuilder struct {
AccountId AccountId
SubAccountId SubAccountId
SlotId SlotId
Nonce Nonce
PairId PairId
Size BigUint
Price BigUint
Direction bool
TakerFeeRate uint8
MakerFeeRate uint8
HasSubsidy bool
}Builder used to build Contract
type Contract
The Contract struct of taker and maker in perpetual contract, it's a opaque data type.
func NewContract
func NewContract(builder ContractBuilder) *ContractCreate a new Contract.
func (*Contract) IsLong
func (*Contract) IsLong() boolReturn true if the contract opens a long position.
func (*Contract) IsShort
func (*Contract) IsShort() boolReturn true if the contract opens a short position.
func (*Contract) GetSignature
func (_self *Contract) GetSignature() ZkLinkSignatureGet the L3 signature of the contract.
func (*Contract) IsSignatureValid
func (*Contract) IsSignatureValid() boolCheck if the signature is valid or not.
func (*Contract) GetBytes
func (*Contract) GetBytes() []uint8 Get the encoded bytes that used to create the L3 signature.
func (*Contract) CreateSignedContract
func (*Contract) CreateSignedContract(zklinkSigner *ZkLinkSigner) (*Contract, error)Create a new contract with L3 signature.
input:
zklinkSigner: zklinkSigner
type ContractMatchingBuilder
type ContractMatchingBuilder struct {
AccountId AccountId
SubAccountId SubAccountId
Taker *Contract
Maker []*Contract
Fee BigUint
FeeToken TokenId
}type ContractMatching
The ContractMatching transaction in perpetual contract, it's a opaque data type.
NewContractMatching(builder ContractMatchingBuilder)
func NewContractMatching(builder ContractMatchingBuilder) *ContractMatchingCreate a new ContractMatching transaction.
func (*ContractMatching) GetBytes
func (_self *ContractMatching) GetBytes() []uint8Get the encoded bytes that used to create the L3 signature. See more in Private Key and Signature.
func (*ContractMatching) TxHash
func (*ContractMatching) TxHash() []uint8Get the transaction hash of the transaction.
func (*ContractMatching) JsonStr
func (*ContractMatching) JsonStr() stringGet the json string of the the transaction.
func (*ContractMatching) IsValid
func (*ContractMatching) IsValid() boolCheck if the transaction is valid or not.
func (*ContractMatching) CreateSignedTx
func (*ContractMatching) CreateSignedTx(signer *ZkLinkSigner) (*ContractMatching, error)Create a new transaction with L3 signature.
input:
signer: ZkLinkSigner
func (*ContractMatching) GetSignature
func (*ContractMatching) GetSignature() ZkLinkSignatureGet the L3 signature of the transaction.
func (*ContractMatching) IsSignatureValid
func (*ContractMatching) IsSignatureValid() boolCheck if the inside L3 signature is valid or not.
func (*ContractMatching) ToZklinkTx
func (*ContractMatching) ToZklinkTx() ZkLinkTxChange the transaction to the ZkLinkTx
Last updated
Was this helpful?