Documentation ¶
Index ¶
- Constants
- Variables
- func BCS()
- func ExampleExecuteEx1()
- func ExampleGetTransactionBlock()
- func Exec()
- func ParseAddress(addrStr string) transactiondata.SuiAddress
- type Account
- func (c *Account) NewMessageWithIntent(message []byte, scope IntentScope) []byte
- func (c *Account) SignMessage(data string, scope IntentScope) (*SignedMessageSerializedSig, error)
- func (c *Account) Signature(txBytesStr string) (*SignedTransactionSerializedSig, error)
- func (c *Account) ToSerializedSignature(signature, pubKey []byte) string
- type ArgObject
- type ArgU64
- type Balance
- type Client
- func (c *Client) DryRunTransactionBlock(txBytes string) (*DryRunTransactionBlockResponse, error)
- func (c *Client) ExecMoveCall(params MoveCallParameters) (*TransactionExecutionResult, error)
- func (c *Client) ExecuteTransactionBlock(txBytes string, signature string) (*TransactionExecutionResult, error)
- func (c *Client) GetAllBalances(address string) (balances []Balance, err error)
- func (c *Client) GetAllCoins(address string, cursor string, limit uint) (response GetAllCoinsReponse, err error)
- func (c *Client) GetBalance(address string, coinType string) (balance Balance, err error)
- func (c *Client) GetCoinMetadata(coinType string) (coinMetadata SuiCoinMetadata, err error)
- func (c *Client) GetCoins(address string, cursor string, limit uint) (response GetAllCoinsReponse, err error)
- func (c *Client) GetGasCoinObj(amount uint64) (*GasDataInfo, error)
- func (c *Client) GetGasCoinObjId(amount uint64) string
- func (c *Client) GetOwnedObjects(address string, cursor string, limit uint, query ObjectResponseQuery) (response ObjectsPage, err error)
- func (c *Client) GetTotalSupply(coinType string) (totalSupply string, err error)
- func (c *Client) GetTransactionBlock(digest string, showParams TransactionBlockResponseOptions) (response TransactionBlockResponse, err error)
- func (c *Client) UnsafeMoveCall(gasObj string, gasBudget string, packageId string, moduleName string, ...) (*TransactionBlockBytes, error)
- type CoinObject
- type DryRunTransactionBlockResponse
- type GasData
- type GasDataInfo
- type GetAllCoinsReponse
- type GetObjectShowOptions
- type IntentScope
- type Item
- type Key
- type KeyPair
- type MoveCallParameters
- type ObjectInfo
- type ObjectInfoData
- type ObjectRequestFilter
- type ObjectResponseQuery
- type ObjectsPage
- type Owner
- type Payment
- type RPCError
- type RPCRequest
- type RPCResponse
- type SigFlag
- type SignedMessageSerializedSig
- type SignedTransactionSerializedSig
- type SuiCoinMetadata
- type TransactionBlock
- type TransactionBlockBytes
- type TransactionBlockData
- type TransactionBlockKind
- type TransactionBlockResponse
- type TransactionBlockResponseOptions
- type TransactionBuilder
- type TransactionBuilderMoveCall
- type TransactionExecutionResult
Constants ¶
View Source
const ( SigntureFlagEd25519 = 0x0 SigntureFlagSecp256k1 = 0x1 AddressLength = 64 DerivationPathEd25519 = `m/44'/784'/0'/0'/0'` DerivationPathSecp256k1 = `m/54'/784'/0'/0/0` )
View Source
const ( Ed25519Flag KeyPair = 0 Secp256k1Flag KeyPair = 1 ErrorFlag byte = math.MaxUint8 )
View Source
const ( DEVNET_URL = "https://fullnode.devnet.sui.io:443" TESTNET_URL = "https://fullnode.testnet.sui.io:443" MAINNET_URL = "https://fullnode.mainnet.sui.io:443" COIN_SUI = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI" COIN_DEEP = "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP" COIN_CETUS = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS" COIN_NS = "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS" )
View Source
const (
FirstHardenedIndex = uint32(0x80000000)
)
Variables ¶
View Source
var ( ErrInvalidPath = errors.New("invalid derivation path") ErrNoPublicDerivation = errors.New("no public derivation for ed25519") )
View Source
var IntentBytes = []byte{0, 0, 0}
Functions ¶
func ExampleExecuteEx1 ¶
func ExampleExecuteEx1()
func ExampleGetTransactionBlock ¶
func ExampleGetTransactionBlock()
func ParseAddress ¶
func ParseAddress(addrStr string) transactiondata.SuiAddress
Types ¶
type Account ¶
type Account struct { PriKey ed25519.PrivateKey PubKey ed25519.PublicKey Address string }
func NewAccountFromAdress ¶
func NewAccountFromMnemonic ¶
func (*Account) NewMessageWithIntent ¶
func (c *Account) NewMessageWithIntent(message []byte, scope IntentScope) []byte
func (*Account) SignMessage ¶
func (c *Account) SignMessage(data string, scope IntentScope) (*SignedMessageSerializedSig, error)
func (*Account) Signature ¶
func (c *Account) Signature(txBytesStr string) (*SignedTransactionSerializedSig, error)
func (*Account) ToSerializedSignature ¶
type Balance ¶
type Balance struct { CoinType string `json:"coinType"` CoinObjectCount int `json:"coinObjectCount"` TotalBalance string `json:"totalBalance"` }
TODO: locked balance
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DryRunTransactionBlock ¶
func (c *Client) DryRunTransactionBlock(txBytes string) (*DryRunTransactionBlockResponse, error)
func (*Client) ExecMoveCall ¶
func (c *Client) ExecMoveCall(params MoveCallParameters) (*TransactionExecutionResult, error)
func (*Client) ExecuteTransactionBlock ¶
func (c *Client) ExecuteTransactionBlock(txBytes string, signature string) (*TransactionExecutionResult, error)
func (*Client) GetAllBalances ¶
func (*Client) GetAllCoins ¶
func (*Client) GetBalance ¶
func (*Client) GetCoinMetadata ¶
func (c *Client) GetCoinMetadata(coinType string) (coinMetadata SuiCoinMetadata, err error)
func (*Client) GetGasCoinObj ¶
func (c *Client) GetGasCoinObj(amount uint64) (*GasDataInfo, error)
func (*Client) GetGasCoinObjId ¶
func (*Client) GetOwnedObjects ¶
func (c *Client) GetOwnedObjects(address string, cursor string, limit uint, query ObjectResponseQuery) (response ObjectsPage, err error)
func (*Client) GetTotalSupply ¶
func (*Client) GetTransactionBlock ¶
func (c *Client) GetTransactionBlock(digest string, showParams TransactionBlockResponseOptions) (response TransactionBlockResponse, err error)
func (*Client) UnsafeMoveCall ¶
type CoinObject ¶
type CoinObject struct { DataType string `json:"dataType"` Fields struct { Balance string `json:"balance"` ID struct { ID string `json:"id"` } `json:"id"` } `json:"fields"` HasPublicTransfer bool `json:"hasPublicTransfer"` Type string `json:"type"` }
func (*CoinObject) GetBalanceUint64 ¶
func (c *CoinObject) GetBalanceUint64() uint64
type DryRunTransactionBlockResponse ¶
type DryRunTransactionBlockResponse struct { Effects struct { MessageVersion string `json:"messageVersion"` Status struct { Status string `json:"status"` } `json:"status"` ExecutedEpoch string `json:"executedEpoch"` GasUsed struct { ComputationCost string `json:"computationCost"` StorageCost string `json:"storageCost"` StorageRebate string `json:"storageRebate"` NonRefundableStorageFee string `json:"nonRefundableStorageFee"` } `json:"gasUsed"` ModifiedAtVersions []struct { ObjectId string `json:"objectId"` SequenceNumber string `json:"sequenceNumber"` } `json:"modifiedAtVersions"` TransactionDigest string `json:"transactionDigest"` Mutated []struct { Owner struct { AddressOwner string `json:"AddressOwner"` } `json:"owner"` Reference struct { ObjectId string `json:"objectId"` Version int `json:"version"` Digest string `json:"digest"` } `json:"reference"` } `json:"mutated"` GasObject struct { Owner struct { AddressOwner string `json:"AddressOwner"` } `json:"owner"` Reference struct { ObjectId string `json:"objectId"` Version int `json:"version"` Digest string `json:"digest"` } `json:"reference"` } `json:"gasObject"` Dependencies []string `json:"dependencies"` } `json:"effects"` Events []interface{} `json:"events"` ObjectChanges []struct { Type string `json:"type"` Sender string `json:"sender"` Owner struct { AddressOwner string `json:"AddressOwner"` } `json:"owner"` ObjectType string `json:"objectType"` ObjectId string `json:"objectId"` Version string `json:"version"` PreviousVersion string `json:"previousVersion"` Digest string `json:"digest"` } `json:"objectChanges"` BalanceChanges []struct { Owner struct { AddressOwner string `json:"AddressOwner"` } `json:"owner"` CoinType string `json:"coinType"` Amount string `json:"amount"` } `json:"balanceChanges"` Input struct { MessageVersion string `json:"messageVersion"` Transaction struct { Kind string `json:"kind"` Inputs []interface{} `json:"inputs"` Transactions []struct { MoveCall struct { Package string `json:"package"` Module string `json:"module"` Function string `json:"function"` } `json:"MoveCall"` } `json:"transactions"` } `json:"transaction"` Sender string `json:"sender"` GasData struct { Payment []struct { ObjectId string `json:"objectId"` Version int `json:"version"` Digest string `json:"digest"` } `json:"payment"` Owner string `json:"owner"` Price string `json:"price"` Budget string `json:"budget"` } `json:"gasData"` } `json:"input"` }
type GasDataInfo ¶
type GetAllCoinsReponse ¶
type GetObjectShowOptions ¶
type GetObjectShowOptions struct { ShowType bool `json:"showType"` ShowOwner bool `json:"showOwner"` ShowPreviousTransaction bool `json:"showPreviousTransaction"` ShowDisplay bool `json:"showDisplay"` ShowContent bool `json:"showContent"` ShowBcs bool `json:"showBcs"` ShowStorageRebate bool `json:"showStorageRebate"` }
type IntentScope ¶
type IntentScope = uint8
const ( TransactionDataIntentScope IntentScope = 0 TransactionEffectsIntentScope IntentScope = 1 CheckpointSummaryIntentScope IntentScope = 2 PersonalMessageIntentScope IntentScope = 3 )
type Key ¶
func NewMasterKey ¶
NewMasterKey generates a new master key from seed.
type MoveCallParameters ¶
type ObjectInfo ¶
type ObjectInfo struct {
Data ObjectInfoData `json:"data"`
}
type ObjectInfoData ¶
type ObjectInfoData struct { ObjectId string `json:"objectId"` Version string `json:"version"` Digest string `json:"digest"` Type string `json:"type"` Owner Owner `json:"owner"` PreviousTransaction string `json:"previousTransaction"` StorageRebate string `json:"storageRebate"` Content interface{} `json:"content"` }
type ObjectRequestFilter ¶
type ObjectResponseQuery ¶
type ObjectResponseQuery struct { Options GetObjectShowOptions `json:"options"` Filter *ObjectRequestFilter `json:"filter,omitempty"` }
func (*ObjectResponseQuery) AddMatchStructType ¶
func (c *ObjectResponseQuery) AddMatchStructType(structType string)
type ObjectsPage ¶
type ObjectsPage struct { Data []ObjectInfo `json:"data"` HasNextPage bool `json:"hasNextPage"` NextCursor string `json:"nextCursor"` }
type RPCRequest ¶
type RPCResponse ¶
type RPCResponse struct { JSONRPC string `json:"jsonrpc"` ID int `json:"id"` Result json.RawMessage `json:"result,omitempty"` Error *RPCError `json:"error,omitempty"` }
type SuiCoinMetadata ¶
type TransactionBlock ¶
type TransactionBlock struct { Data TransactionBlockData `json:"data"` TxSignatures []string `json:"txSignatures"` }
type TransactionBlockBytes ¶
type TransactionBlockData ¶
type TransactionBlockData struct { GasData GasData `json:"gasData"` MessageVersion string `json:"messageVersion"` Sender string `json:"sender"` Transaction TransactionBlockKind `json:"transaction"` }
type TransactionBlockKind ¶
type TransactionBlockKind struct { Computation_charge string `json:"computation_charge"` Epoch string `json:"epoch"` Epoch_start_timestamp_ms string `json:"epoch_start_timestamp_ms"` Kind string `json:"kind"` Storage_charge string `json:"storage_charge"` Storage_rebate string `json:"storage_rebate"` }
type TransactionBlockResponse ¶
type TransactionBlockResponse struct { Digest string `json:"digest"` TimestampMs string `json:"timestampMs"` CheckPoint string `json:"checkpoint"` Transaction TransactionBlock `json:"transaction"` RawTransaction string `json:"rawTransaction"` }
type TransactionBlockResponseOptions ¶
type TransactionBlockResponseOptions struct { ShowInput bool `json:"showInput"` ShowRawInput bool `json:"showRawInput"` ShowEffects bool `json:"showEffects"` ShowEvents bool `json:"showEvents"` ShowObjectChanges bool `json:"showObjectChanges"` ShowBalanceChanges bool `json:"showBalanceChanges"` ShowRawEffects bool `json:"showRawEffects"` }
type TransactionBuilder ¶
type TransactionBuilder struct {
// contains filtered or unexported fields
}
func NewTransactionBuilder ¶
func NewTransactionBuilder(client *Client) *TransactionBuilder
func (*TransactionBuilder) AddCommand ¶
func (c *TransactionBuilder) AddCommand(cmd *TransactionBuilderMoveCall)
func (*TransactionBuilder) Build ¶
func (c *TransactionBuilder) Build() (string, error)
type TransactionBuilderMoveCall ¶
type TransactionBuilderMoveCall struct { PackageId string ModuleName string FunctionName string Arguments []interface{} }
func NewTransactionBuilderMoveCall ¶
func NewTransactionBuilderMoveCall() *TransactionBuilderMoveCall
func (*TransactionBuilderMoveCall) Build ¶
func (c *TransactionBuilderMoveCall) Build(builder *TransactionBuilder) error
type TransactionExecutionResult ¶
type TransactionExecutionResult struct { Digest string `json:"digest"` Transaction struct { Data struct { MessageVersion string `json:"messageVersion"` Transaction struct { Kind string `json:"kind"` Inputs []interface{} `json:"inputs"` Transactions []struct { MoveCall struct { Package string `json:"package"` Module string `json:"module"` Function string `json:"function"` } `json:"MoveCall"` } `json:"transactions"` } `json:"transaction"` Sender string `json:"sender"` GasData struct { Payment []struct { ObjectId string `json:"objectId"` Version int `json:"version"` Digest string `json:"digest"` } `json:"payment"` Owner string `json:"owner"` Price string `json:"price"` Budget string `json:"budget"` } `json:"gasData"` } `json:"data"` TxSignatures []string `json:"txSignatures"` } `json:"transaction"` RawTransaction string `json:"rawTransaction"` Effects struct { MessageVersion string `json:"messageVersion"` Status struct { Status string `json:"status"` } `json:"status"` ExecutedEpoch string `json:"executedEpoch"` GasUsed struct { ComputationCost string `json:"computationCost"` StorageCost string `json:"storageCost"` StorageRebate string `json:"storageRebate"` NonRefundableStorageFee string `json:"nonRefundableStorageFee"` } `json:"gasUsed"` ModifiedAtVersions []struct { ObjectId string `json:"objectId"` SequenceNumber string `json:"sequenceNumber"` } `json:"modifiedAtVersions"` TransactionDigest string `json:"transactionDigest"` Mutated []struct { Owner struct { AddressOwner string `json:"AddressOwner"` } `json:"owner"` Reference struct { ObjectId string `json:"objectId"` Version int `json:"version"` Digest string `json:"digest"` } `json:"reference"` } `json:"mutated"` GasObject struct { Owner struct { AddressOwner string `json:"AddressOwner"` } `json:"owner"` Reference struct { ObjectId string `json:"objectId"` Version int `json:"version"` Digest string `json:"digest"` } `json:"reference"` } `json:"gasObject"` Dependencies []string `json:"dependencies"` } `json:"effects"` Events []interface{} `json:"events"` ObjectChanges []struct { Type string `json:"type"` Sender string `json:"sender"` Owner struct { AddressOwner string `json:"AddressOwner"` } `json:"owner"` ObjectType string `json:"objectType"` ObjectId string `json:"objectId"` Version string `json:"version"` PreviousVersion string `json:"previousVersion"` Digest string `json:"digest"` } `json:"objectChanges"` BalanceChanges []struct { Owner struct { AddressOwner string `json:"AddressOwner"` } `json:"owner"` CoinType string `json:"coinType"` Amount string `json:"amount"` } `json:"balanceChanges"` ConfirmedLocalExecution bool `json:"confirmedLocalExecution"` RawEffects []byte `json:"rawEffects"` }
Source Files ¶
- account.go
- bcs.go
- client.go
- constants.go
- dry_run_transaction_block.go
- examples.go
- exec_move_call.go
- exec_transaction.go
- execute_transaction_block.go
- get_all_balances.go
- get_all_coins.go
- get_balance.go
- get_coin_metadata.go
- get_coins.go
- get_owned_objects.go
- get_total_supply.go
- get_transaction_block.go
- transaction_builder.go
- transaction_builder_movecall.go
- unsafe_movecall.go
- utils.go
Click to show internal directories.
Click to hide internal directories.