Documentation ¶
Index ¶
- Constants
- Variables
- type Address
- type AuthSignInfo
- type Base64Data
- type Bytes
- type BytesData
- type CertifiedTransaction
- type ChangeEpoch
- type Coin
- type CoinObject
- type CoinPage
- type Coins
- type DevInspectResult
- type DevInspectResults
- type Digest
- type Event
- type ExecuteTransactionEffects
- type ExecuteTransactionRequestType
- type ExecuteTransactionResponse
- type GasCostSummary
- type HexData
- type InputObjectKind
- type ModulePublish
- type MoveCall
- type ObjectId
- type ObjectInfo
- type ObjectOwner
- type ObjectOwnerInternal
- type ObjectRead
- type ObjectReadDetail
- type ObjectRef
- type ObjectStatus
- type OwnedObjectRef
- type ParsedTransactionResponse
- type Pay
- type PayAllSui
- type PaySui
- type ResourceType
- type SenderSignedData
- type SignatureScheme
- type SignatureSchemeSerialized
- type SignedTransaction
- type SignedTransactionSerializedSig
- type SingleTransactionKind
- type SuiCoinBalance
- type SuiCoinMetadata
- type Supply
- type TransactionBytes
- type TransactionEffects
- type TransactionResponse
- type TransactionStatus
- type TransferObject
- type TransferSui
Constants ¶
const ( PickSmaller = iota // pick smaller coins to match amount PickBigger // pick bigger coins to match amount PickByOrder // pick coins by coins order to match amount )
const ( TransactionStatusSuccess = "success" TransactionStatusFailure = "failure" )
const (
SuiCoinType = "0x2::sui::SUI"
)
Variables ¶
var ErrCoinsNotMatchRequest error
var IntentBytes = []byte{0, 0, 0}
IntentBytes See: sui/crates/sui-types/src/intent.rs This is currently hardcoded with [IntentScope::TransactionData = 0, Version::V0 = 0, AppId::Sui = 0]
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address = HexData
func NewAddressFromHex ¶
NewAddressFromHex *
- Creates Address from a hex string.
- @param addr Hex string can be with a prefix or without a prefix,
- e.g. '0x1aa' or '1aa'. Hex string will be left padded with 0s if too short.
func (Address) ShortString ¶
ShortString Returns the address with leading zeros trimmed, e.g. 0x2
type AuthSignInfo ¶
type AuthSignInfo interface{}
type Base64Data ¶
type Base64Data struct {
// contains filtered or unexported fields
}
func NewBase64Data ¶
func NewBase64Data(str string) (*Base64Data, error)
func (Base64Data) Data ¶
func (h Base64Data) Data() []byte
func (Base64Data) Length ¶
func (h Base64Data) Length() int
func (Base64Data) MarshalJSON ¶
func (h Base64Data) MarshalJSON() ([]byte, error)
func (Base64Data) String ¶
func (h Base64Data) String() string
func (*Base64Data) UnmarshalJSON ¶
func (h *Base64Data) UnmarshalJSON(data []byte) error
type Bytes ¶
type Bytes []byte
func (Bytes) GetBase64Data ¶
func (b Bytes) GetBase64Data() Base64Data
func (Bytes) GetHexData ¶
type CertifiedTransaction ¶
type CertifiedTransaction struct { TransactionDigest string `json:"transactionDigest"` TxSignature string `json:"txSignature"` AuthSignInfo *AuthSignInfo `json:"authSignInfo"` Data *SenderSignedData `json:"data"` }
type ChangeEpoch ¶
type CoinObject ¶
type CoinPage ¶
type CoinPage struct { Data []CoinObject `json:"data"` NextCursor *ObjectId `json:"nextCursor"` }
type Coins ¶
type Coins []Coin
func (Coins) PickCoins ¶
PickCoins pick coins, which sum >= amount, pickMethod, see PickSmaller|PickBigger|PickByOrder // if not satisfated amount, an ErrCoinsNotMatchRequest error will return
func (Coins) PickSUICoinsWithGas ¶
func (cs Coins) PickSUICoinsWithGas(amount *big.Int, gasAmount uint64, pickMethod int) (Coins, *Coin, error)
PickSUICoinsWithGas pick coins, which sum >= amount, and pick a gas coin >= gasAmount which not in coins if not satisfated amount/gasAmount, an ErrCoinsNotMatchRequest error will return if gasAmount == 0, a nil gasCoin will return pickMethod, see PickSmaller|PickBigger|PickByOrder
func (Coins) TotalBalance ¶
type DevInspectResult ¶
type DevInspectResults ¶
type DevInspectResults struct { Effects TransactionEffects `json:"effects"` Results DevInspectResult `json:"results"` }
type Digest ¶
type Digest = Base64Data
type ExecuteTransactionEffects ¶
type ExecuteTransactionEffects struct { TransactionEffectsDigest string `json:"transactionEffectsDigest"` Effects TransactionEffects `json:"effects"` AuthSignInfo *AuthSignInfo `json:"authSignInfo"` }
type ExecuteTransactionRequestType ¶
type ExecuteTransactionRequestType string
const ( TxnRequestTypeWaitForEffectsCert ExecuteTransactionRequestType = "WaitForEffectsCert" TxnRequestTypeWaitForLocalExecution ExecuteTransactionRequestType = "WaitForLocalExecution" )
type ExecuteTransactionResponse ¶
type ExecuteTransactionResponse struct { ImmediateReturn *struct { TransactionDigest string `json:"tx_digest"` } `json:"ImmediateReturn,omitempty"` TxCert *struct { Certificate CertifiedTransaction `json:"certificate"` } `json:"TxCert,omitempty"` EffectsCert *struct { Certificate CertifiedTransaction `json:"certificate"` Effects ExecuteTransactionEffects `json:"effects"` ConfirmedLocalExecution bool `json:"confirmed_local_execution"` } `json:"EffectsCert,omitempty"` }
func (*ExecuteTransactionResponse) TransactionDigest ¶
func (r *ExecuteTransactionResponse) TransactionDigest() string
type GasCostSummary ¶
type HexData ¶
type HexData struct {
// contains filtered or unexported fields
}
func NewHexData ¶
func (HexData) MarshalJSON ¶
func (*HexData) UnmarshalJSON ¶
type InputObjectKind ¶
type InputObjectKind map[string]interface{}
type ModulePublish ¶
type ModulePublish struct {
Modules [][]byte `json:"modules"`
}
type ObjectInfo ¶
type ObjectOwner ¶
type ObjectOwner struct { *ObjectOwnerInternal // contains filtered or unexported fields }
func (ObjectOwner) MarshalJSON ¶
func (o ObjectOwner) MarshalJSON() ([]byte, error)
func (*ObjectOwner) UnmarshalJSON ¶
func (o *ObjectOwner) UnmarshalJSON(data []byte) error
type ObjectOwnerInternal ¶
type ObjectRead ¶
type ObjectRead struct { Details *ObjectReadDetail `json:"details"` Status ObjectStatus `json:"status"` }
type ObjectReadDetail ¶
type ObjectReadDetail struct { Data map[string]interface{} `json:"data"` Owner *ObjectOwner `json:"owner"` PreviousTransaction string `json:"previousTransaction"` StorageRebate int `json:"storageRebate"` Reference *ObjectRef `json:"reference"` }
type ObjectStatus ¶
type ObjectStatus string
const ( ObjectStatusExists ObjectStatus = "Exists" ObjectStatusNotExists ObjectStatus = "NotExists" ObjectStatusDeleted ObjectStatus = "Deleted" )
type OwnedObjectRef ¶
type OwnedObjectRef struct { Owner *ObjectOwner `json:"owner"` Reference *ObjectRef `json:"reference"` }
type ParsedTransactionResponse ¶
type ParsedTransactionResponse interface{}
type ResourceType ¶
type ResourceType struct { Address *Address ModuleName string FuncName string SubType *ResourceType }
func NewResourceType ¶
func NewResourceType(str string) (*ResourceType, error)
func (*ResourceType) ShortString ¶
func (t *ResourceType) ShortString() string
func (*ResourceType) String ¶
func (t *ResourceType) String() string
type SenderSignedData ¶
type SenderSignedData struct { Transactions []SingleTransactionKind `json:"transactions,omitempty"` Sender *Address `json:"sender"` GasPayment *ObjectRef `json:"gasPayment"` GasBudget uint64 `json:"gasBudget"` GasPrice uint64 `json:"gasPrice"` }
type SignatureScheme ¶
type SignatureScheme string
const ( SignatureSchemeEd25519 SignatureScheme = "ED25519" SignatureSchemeSecp256k1 SignatureScheme = "Secp256k1" )
type SignatureSchemeSerialized ¶
type SignatureSchemeSerialized byte
const ( SignatureSchemeSerializedEd25519 SignatureSchemeSerialized = 0 SignatureSchemeSerializedSecp256k1 SignatureSchemeSerialized = 1 )
type SignedTransaction ¶
type SignedTransaction struct { // transaction data bytes TxBytes *Base64Data `json:"tx_bytes"` // Flag of the signature scheme that is used. SigScheme SignatureScheme `json:"sig_scheme"` // transaction signature Signature *Base64Data `json:"signature"` // signer's public key PublicKey *Base64Data `json:"pub_key"` }
type SignedTransactionSerializedSig ¶
type SignedTransactionSerializedSig struct { // transaction data bytes TxBytes *Base64Data `json:"tx_bytes"` // transaction signature Signature *Base64Data `json:"signature"` }
type SingleTransactionKind ¶
type SingleTransactionKind struct { TransferObject *TransferObject `json:"TransferObject,omitempty"` Publish *ModulePublish `json:"Publish,omitempty"` Call *MoveCall `json:"Call,omitempty"` TransferSui *TransferSui `json:"TransferSui,omitempty"` ChangeEpoch *ChangeEpoch `json:"ChangeEpoch,omitempty"` PaySui *PaySui `json:"PaySui,omitempty"` Pay *Pay `json:"Pay,omitempty"` PayAllSui *PayAllSui `json:"PayAllSui,omitempty"` }
type SuiCoinBalance ¶
type SuiCoinMetadata ¶
type TransactionBytes ¶
type TransactionBytes struct { // the gas object to be used Gas ObjectRef `json:"gas"` // objects to be used in this transaction InputObjects []InputObjectKind `json:"inputObjects"` // transaction data bytes TxBytes Base64Data `json:"txBytes"` }
func (*TransactionBytes) SignSerializedSigWith ¶
func (txn *TransactionBytes) SignSerializedSigWith(privateKey ed25519.PrivateKey) *SignedTransactionSerializedSig
func (*TransactionBytes) SignWith ¶
func (txn *TransactionBytes) SignWith(privateKey ed25519.PrivateKey) *SignedTransaction
type TransactionEffects ¶
type TransactionEffects struct { Status TransactionStatus `json:"status"` TransactionDigest string `json:"transactionDigest"` GasUsed *GasCostSummary `json:"gasUsed"` GasObject *OwnedObjectRef `json:"gasObject"` Events []Event `json:"events,omitempty"` Dependencies []string `json:"dependencies,omitempty"` Created []OwnedObjectRef `json:"created,omitempty"` Mutated []OwnedObjectRef `json:"mutated,omitempty"` Unwrapped []OwnedObjectRef `json:"unwrapped,omitempty"` Deleted []ObjectRef `json:"deleted,omitempty"` Wrapped []ObjectRef `json:"wrapped,omitempty"` }
func (*TransactionEffects) GasFee ¶
func (te *TransactionEffects) GasFee() uint64
type TransactionResponse ¶
type TransactionResponse struct { Certificate *CertifiedTransaction `json:"certificate"` Effects *TransactionEffects `json:"effects"` ParsedData ParsedTransactionResponse `json:"parsed_data,omitempty"` TimestampMs uint64 `json:"timestamp_ms,omitempty"` }