Documentation
¶
Index ¶
- Constants
- Variables
- func BCS()
- func ExampleExecuteEx1()
- func ExampleGetTransactionBlock()
- func Exec()
- func GetInitialSharedVersion(apiAddr string, sharedObjectAddress string) (uint64, error)
- func ParseAddress(addrStr string) txdata.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 ArgAddress
- type ArgBool
- type ArgImmObject
- type ArgSharedObject
- type ArgU8
- type ArgU16
- type ArgU32
- type ArgU64
- type ArgU128
- type ArgU256
- type ArgVecAddress
- type ArgVecBool
- type ArgVecObject
- type ArgVecU8
- type ArgVecU16
- type ArgVecU32
- type ArgVecU64
- type ArgVecU128
- type ArgVecU256
- type Balance
- type Client
- func (c *Client) Account() *Account
- func (c *Client) DryExecPTB(builder *TransactionBuilder, gasPrice uint64) (*DryRunTransactionBlockResponse, error)
- func (c *Client) DryRunTransactionBlock(txBytes string) (*DryRunTransactionBlockResponse, error)
- func (c *Client) ExecMoveCall(params MoveCallParameters, gasPrice uint64) (*TransactionExecutionResult, error)
- func (c *Client) ExecPTB(builder *TransactionBuilder, gasPrice uint64) (*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) GetDynamicFieldObject(parentObjectId string, fieldType string, value interface{}) (objData SuiObjectResponse, err error)
- func (c *Client) GetGasCoinObj(amount uint64) (*GasDataInfo, error)
- func (c *Client) GetInitialSharedVersion(sharedObjectAddress string) (uint64, error)
- func (c *Client) GetObject(objectId string, options GetObjectShowOptions) (objData SuiObjectResponse, err error)
- 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) InitAccountFromFile(filePath string) error
- func (c *Client) UnsafeMoveCall(gasObj string, gasBudget string, packageId string, moduleName string, ...) (*TransactionBlockBytes, error)
- type CoinObject
- type DisplayFieldsResponse
- type DryRunTransactionBlockResponse
- type DynamicFieldName
- type GasData
- type GasDataInfo
- type GetAllCoinsReponse
- type GetObjectShowOptions
- type IntentScope
- type Item
- type Key
- type KeyPair
- type MoveCallParameters
- type ObjectData
- type ObjectInfo
- type ObjectInfoData
- type ObjectRequestFilter
- type ObjectResponseError
- type ObjectResponseQuery
- type ObjectsPage
- type Owner
- type Payment
- type RPCError
- type RPCRequest
- type RPCResponse
- type RawData
- type SigFlag
- type SignedMessageSerializedSig
- type SignedTransactionSerializedSig
- type SuiCoinMetadata
- type SuiObjectResponse
- 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" TESTNET_GRAPHQL_URL = "https://sui-testnet.mystenlabs.com/graphql" MAINNET_GRAPHQL_URL = "https://sui-mainnet.mystenlabs.com/graphql" COIN_SUI = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI" COIN_DEEP = "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP" COIN_CETUS = "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS" COIN_NS = "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS" CLOCK_OBJECT_ID = "0x0000000000000000000000000000000000000000000000000000000000000006" TEST_PACKAGE_ID = "0xef1846d0644254415d1165fe973cceaf0f0a0a3da012dedc8b2fe6c4475e4889" TEST_FUND_ID = "0x328e39beb44c849a79a0030f90afdd1f6d91457057cda077c942e6693ea22fc3" DEFAULT_GAS_PRICE = uint64(1000) )
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 GetInitialSharedVersion ¶ added in v0.0.6
func ParseAddress ¶
func ParseAddress(addrStr string) txdata.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 ArgAddress ¶
type ArgAddress string
type ArgImmObject ¶ added in v0.0.6
type ArgImmObject string
type ArgSharedObject ¶ added in v0.0.6
type ArgSharedObject string
type ArgVecAddress ¶
type ArgVecAddress []string
type ArgVecBool ¶
type ArgVecBool []bool
type ArgVecObject ¶
type ArgVecObject []string
type ArgVecU128 ¶
type ArgVecU256 ¶
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) DryExecPTB ¶
func (c *Client) DryExecPTB(builder *TransactionBuilder, gasPrice uint64) (*DryRunTransactionBlockResponse, error)
func (*Client) DryRunTransactionBlock ¶
func (c *Client) DryRunTransactionBlock(txBytes string) (*DryRunTransactionBlockResponse, error)
func (*Client) ExecMoveCall ¶
func (c *Client) ExecMoveCall(params MoveCallParameters, gasPrice uint64) (*TransactionExecutionResult, error)
func (*Client) ExecPTB ¶
func (c *Client) ExecPTB(builder *TransactionBuilder, gasPrice uint64) (*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) GetDynamicFieldObject ¶
func (c *Client) GetDynamicFieldObject(parentObjectId string, fieldType string, value interface{}) (objData SuiObjectResponse, err error)
func (*Client) GetGasCoinObj ¶
func (c *Client) GetGasCoinObj(amount uint64) (*GasDataInfo, error)
func (*Client) GetInitialSharedVersion ¶ added in v0.0.6
func (*Client) GetObject ¶
func (c *Client) GetObject(objectId string, options GetObjectShowOptions) (objData SuiObjectResponse, err error)
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) InitAccountFromFile ¶
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 DisplayFieldsResponse ¶
type DisplayFieldsResponse interface{}
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 DynamicFieldName ¶
type DynamicFieldName struct {
Type string `json:"type"`
Value interface{} `json:"value"`
}
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 ObjectData ¶
type ObjectData struct {
Bcs RawData `json:"bcs"`
Content interface{} `json:"content"`
Digest string `json:"digest"`
Display DisplayFieldsResponse `json:"display"`
ObjectId string `json:"objectId"`
Owner Owner `json:"owner"`
PreviousTransaction string `json:"previousTransaction"`
StorageRebate string `json:"storageRebate"`
Type string `json:"type"`
Version string `json:"version"`
}
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 ObjectResponseError ¶
type ObjectResponseError struct {
Code int `json:"code"`
}
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 SuiObjectResponse ¶
type SuiObjectResponse struct {
Data ObjectData `json:"data"`
Error ObjectResponseError `json:"error"`
}
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)
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
- client.go
- constants.go
- dry_exec_ptb.go
- dry_run_transaction_block.go
- examples.go
- exec_move_call.go
- exec_ptb.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_dynamic_field_object.go
- get_object.go
- get_owned_objects.go
- get_total_supply.go
- get_transaction_block.go
- graphql.go
- transaction_builder.go
- transaction_builder_movecall.go
- unsafe_movecall.go
- utils.go
Click to show internal directories.
Click to hide internal directories.