Documentation ¶
Index ¶
- Constants
- Variables
- func BCS_RequestAddStake(signer suiAddress, coins []*sui_types.ObjectRef, ...) ([]byte, error)
- func BCS_RequestWithdrawStake(signer suiAddress, stakedSuiRef sui_types.ObjectRef, ...) ([]byte, error)
- func FaucetFundAccount(address string, faucetUrl string) (string, error)
- type BatchElem
- type Client
- func (c *Client) BatchCall(b []BatchElem) error
- func (c *Client) BatchCallContext(ctx context.Context, b []BatchElem) error
- func (c *Client) BatchGetFilteredObjectsOwnedByAddress(ctx context.Context, address suiAddress, options types.SuiObjectDataOptions, ...) ([]types.SuiObjectResponse, error)
- func (c *Client) BatchGetObjectsOwnedByAddress(ctx context.Context, address suiAddress, options types.SuiObjectDataOptions, ...) ([]types.SuiObjectResponse, error)
- func (c *Client) BatchTransaction(ctx context.Context, signer suiAddress, txnParams []map[string]interface{}, ...) (*types.TransactionBytes, error)
- func (c *Client) Call(result interface{}, method Method, args ...interface{}) error
- func (c *Client) CallContext(ctx context.Context, result interface{}, method Method, args ...interface{}) error
- func (c *Client) DevInspectTransactionBlock(ctx context.Context, senderAddress suiAddress, txByte suiBase64Data, ...) (*types.DevInspectResults, error)
- func (c *Client) DryRunTransaction(ctx context.Context, txBytes suiBase64Data) (*types.DryRunTransactionBlockResponse, error)
- func (c *Client) ExecuteTransactionBlock(ctx context.Context, txBytes suiBase64Data, signatures []any, ...) (*types.SuiTransactionBlockResponse, error)
- func (c *Client) GetAllBalances(ctx context.Context, owner suiAddress) ([]types.Balance, error)
- func (c *Client) GetAllCoins(ctx context.Context, owner suiAddress, cursor *suiObjectID, limit uint) (*types.CoinPage, error)
- func (c *Client) GetBalance(ctx context.Context, owner suiAddress, coinType string) (*types.Balance, error)
- func (c *Client) GetCoinMetadata(ctx context.Context, coinType string) (*types.SuiCoinMetadata, error)
- func (c *Client) GetCoins(ctx context.Context, owner suiAddress, coinType *string, cursor *suiObjectID, ...) (*types.CoinPage, error)
- func (c *Client) GetDynamicFieldObject(ctx context.Context, parentObjectId suiObjectID, ...) (*types.SuiObjectResponse, error)
- func (c *Client) GetDynamicFields(ctx context.Context, parentObjectId suiObjectID, cursor *suiObjectID, ...) (*types.DynamicFieldPage, error)
- func (c *Client) GetEvents(ctx context.Context, digest suiDigest) ([]types.SuiEvent, error)
- func (c *Client) GetLatestCheckpointSequenceNumber(ctx context.Context) (string, error)
- func (c *Client) GetLatestSuiSystemState(ctx context.Context) (*types.SuiSystemStateSummary, error)
- func (c *Client) GetNFTsOwnedByAddress(ctx context.Context, address suiAddress) ([]types.SuiObjectResponse, error)
- func (c *Client) GetObject(ctx context.Context, objID suiObjectID, options *types.SuiObjectDataOptions) (*types.SuiObjectResponse, error)
- func (c *Client) GetOwnedObjects(ctx context.Context, address suiAddress, query *types.SuiObjectResponseQuery, ...) (*types.ObjectsPage, error)
- func (c *Client) GetReferenceGasPrice(ctx context.Context) (*types.SafeSuiBigInt[uint64], error)
- func (c *Client) GetStakes(ctx context.Context, owner suiAddress) ([]types.DelegatedStake, error)
- func (c *Client) GetStakesByIds(ctx context.Context, stakedSuiIds []suiObjectID) ([]types.DelegatedStake, error)
- func (c *Client) GetSuiCoinsOwnedByAddress(ctx context.Context, address suiAddress) (types.Coins, error)
- func (c *Client) GetTotalSupply(ctx context.Context, coinType string) (*types.Supply, error)
- func (c *Client) GetTotalTransactionBlocks(ctx context.Context) (string, error)
- func (c *Client) GetTransactionBlock(ctx context.Context, digest suiDigest, ...) (*types.SuiTransactionBlockResponse, error)
- func (c *Client) GetValidatorsApy(ctx context.Context) (*types.ValidatorsApy, error)
- func (c *Client) MergeCoins(ctx context.Context, signer suiAddress, primaryCoin, coinToMerge suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) MintNFT(ctx context.Context, signer suiAddress, nftName, nftDescription, nftUri string, ...) (*types.TransactionBytes, error)
- func (c *Client) MoveCall(ctx context.Context, signer suiAddress, packageId suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) MultiGetObjects(ctx context.Context, objIDs []suiObjectID, options *types.SuiObjectDataOptions) ([]types.SuiObjectResponse, error)
- func (c *Client) Pay(ctx context.Context, signer suiAddress, inputCoins []suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) PayAllSui(ctx context.Context, signer, recipient suiAddress, inputCoins []suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) PaySui(ctx context.Context, signer suiAddress, inputCoins []suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) Publish(ctx context.Context, sender suiAddress, compiledModules []*suiBase64Data, ...) (*types.TransactionBytes, error)
- func (c *Client) QueryEvents(ctx context.Context, query types.EventFilter, cursor *types.EventId, ...) (*types.EventPage, error)
- func (c *Client) QueryTransactionBlocks(ctx context.Context, query types.SuiTransactionBlockResponseQuery, ...) (*types.TransactionBlocksPage, error)
- func (c *Client) RequestAddStake(ctx context.Context, signer suiAddress, coins []suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) RequestWithdrawStake(ctx context.Context, signer suiAddress, stakedSuiId suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) ResolveNameServiceAddress(ctx context.Context, suiName string) (*suiAddress, error)
- func (c *Client) ResolveNameServiceNames(ctx context.Context, owner suiAddress, cursor *suiObjectID, limit *uint) (*types.SuiNamePage, error)
- func (c *Client) SplitCoin(ctx context.Context, signer suiAddress, Coin suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) SplitCoinEqual(ctx context.Context, signer suiAddress, Coin suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) TransferObject(ctx context.Context, signer, recipient suiAddress, objID suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) TransferSui(ctx context.Context, signer, recipient suiAddress, suiObjID suiObjectID, ...) (*types.TransactionBytes, error)
- func (c *Client) TryGetPastObject(ctx context.Context, objectId suiObjectID, version uint64, ...) (*types.SuiPastObjectResponse, error)
- type HTTPError
- type Method
- type SuiMethod
- type SuiXMethod
- type UnsafeMethod
Constants ¶
const ( DevNetFaucetUrl = "https://faucet.devnet.sui.io/gas" TestNetFaucetUrl = "https://faucet.testnet.sui.io/gas" )
const ( SuiXPrefix = "suix_" SuiPrefix = "sui_" UnsafePrefix = "unsafe_" )
const QUERY_MAX_RESULT_LIMIT = 1000
NOTE: This copys the query limit from our Rust JSON RPC backend, this needs to be kept in sync!
Variables ¶
var (
ErrNoResult = errors.New("no result in JSON-RPC response")
)
Functions ¶
func BCS_RequestAddStake ¶
func BCS_RequestWithdrawStake ¶ added in v2.0.1
Types ¶
type BatchElem ¶
type BatchElem struct { Method string Args []interface{} // The result is unmarshaled into this field. Result must be set to a // non-nil pointer value of the desired type, otherwise the response will be // discarded. Result interface{} // Error is set if the server returns an error for this request, or if // unmarshaling into Result fails. It is not set for I/O errors. Error error }
BatchElem is an element in a batch request.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func DialWithClient ¶
func (*Client) BatchCall ¶
BatchCall sends all given requests as a single batch and waits for the server to return a response for all of them.
func (*Client) BatchCallContext ¶
BatchCallContext sends all given requests as a single batch and waits for the server to return a response for all of them. The wait duration is bounded by the context's deadline.
func (*Client) BatchGetFilteredObjectsOwnedByAddress ¶
func (c *Client) BatchGetFilteredObjectsOwnedByAddress( ctx context.Context, address suiAddress, options types.SuiObjectDataOptions, filter func(*types.SuiObjectData) bool, ) ([]types.SuiObjectResponse, error)
func (*Client) BatchGetObjectsOwnedByAddress ¶
func (c *Client) BatchGetObjectsOwnedByAddress( ctx context.Context, address suiAddress, options types.SuiObjectDataOptions, filterType string, ) ([]types.SuiObjectResponse, error)
BatchGetObjectsOwnedByAddress @param filterType You can specify filtering out the specified resources, this will fetch all resources if it is not empty ""
func (*Client) BatchTransaction ¶
func (c *Client) BatchTransaction( ctx context.Context, signer suiAddress, txnParams []map[string]interface{}, gas *suiObjectID, gasBudget uint64, ) (*types.TransactionBytes, error)
TODO: execution_mode : <SuiTransactionBlockBuilderMode>
func (*Client) Call ¶
Call performs a JSON-RPC call with the given arguments and unmarshals into the result if no error occurred.
The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.
func (*Client) CallContext ¶
func (c *Client) CallContext(ctx context.Context, result interface{}, method Method, args ...interface{}) error
CallContext performs a JSON-RPC call with the given arguments. If the context is canceled before the call has successfully returned, CallContext returns immediately.
The result must be a pointer so that package json can unmarshal into it. You can also pass nil, in which case the result is ignored.
func (*Client) DevInspectTransactionBlock ¶
func (c *Client) DevInspectTransactionBlock( ctx context.Context, senderAddress suiAddress, txByte suiBase64Data, gasPrice *types.SafeSuiBigInt[uint64], epoch *uint64, ) (*types.DevInspectResults, error)
func (*Client) DryRunTransaction ¶
func (*Client) ExecuteTransactionBlock ¶
func (c *Client) ExecuteTransactionBlock( ctx context.Context, txBytes suiBase64Data, signatures []any, options *types.SuiTransactionBlockResponseOptions, requestType types.ExecuteTransactionRequestType, ) (*types.SuiTransactionBlockResponse, error)
func (*Client) GetAllBalances ¶
func (*Client) GetAllCoins ¶
func (c *Client) GetAllCoins( ctx context.Context, owner suiAddress, cursor *suiObjectID, limit uint, ) (*types.CoinPage, error)
GetAllCoins start with the first object when cursor is nil
func (*Client) GetBalance ¶
func (c *Client) GetBalance(ctx context.Context, owner suiAddress, coinType string) (*types.Balance, error)
GetBalance to use default sui coin(0x2::sui::SUI) when coinType is empty
func (*Client) GetCoinMetadata ¶
func (*Client) GetCoins ¶
func (c *Client) GetCoins( ctx context.Context, owner suiAddress, coinType *string, cursor *suiObjectID, limit uint, ) (*types.CoinPage, error)
GetCoins to use default sui coin(0x2::sui::SUI) when coinType is nil start with the first object when cursor is nil
func (*Client) GetDynamicFieldObject ¶
func (c *Client) GetDynamicFieldObject( ctx context.Context, parentObjectId suiObjectID, name sui_types.DynamicFieldName, ) (*types.SuiObjectResponse, error)
func (*Client) GetDynamicFields ¶
func (*Client) GetLatestCheckpointSequenceNumber ¶
func (*Client) GetLatestSuiSystemState ¶
func (*Client) GetNFTsOwnedByAddress ¶
func (*Client) GetObject ¶
func (c *Client) GetObject( ctx context.Context, objID suiObjectID, options *types.SuiObjectDataOptions, ) (*types.SuiObjectResponse, error)
func (*Client) GetOwnedObjects ¶
func (c *Client) GetOwnedObjects( ctx context.Context, address suiAddress, query *types.SuiObjectResponseQuery, cursor *types.CheckpointedObjectId, limit *uint, ) (*types.ObjectsPage, error)
address : <SuiAddress> - the owner's Sui address query : <ObjectResponseQuery> - the objects query criteria. cursor : <CheckpointedObjectID> - An optional paging cursor. If provided, the query will start from the next item after the specified cursor. Default to start from the first item if not specified. limit : <uint> - Max number of items returned per page, default to [QUERY_MAX_RESULT_LIMIT_OBJECTS] if is 0
func (*Client) GetReferenceGasPrice ¶
func (*Client) GetStakesByIds ¶
func (*Client) GetSuiCoinsOwnedByAddress ¶
func (c *Client) GetSuiCoinsOwnedByAddress(ctx context.Context, address suiAddress) (types.Coins, error)
GetSuiCoinsOwnedByAddress This function will retrieve a maximum of 200 coins.
func (*Client) GetTotalSupply ¶
func (*Client) GetTotalTransactionBlocks ¶
func (*Client) GetTransactionBlock ¶
func (c *Client) GetTransactionBlock( ctx context.Context, digest suiDigest, options types.SuiTransactionBlockResponseOptions, ) (*types.SuiTransactionBlockResponse, error)
func (*Client) GetValidatorsApy ¶
func (*Client) MergeCoins ¶
func (c *Client) MergeCoins( ctx context.Context, signer suiAddress, primaryCoin, coinToMerge suiObjectID, gas *suiObjectID, gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
MergeCoins Create an unsigned transaction to merge multiple coins into one coin.
func (*Client) MintNFT ¶
func (c *Client) MintNFT( ctx context.Context, signer suiAddress, nftName, nftDescription, nftUri string, gas *suiObjectID, gasBudget uint64, ) (*types.TransactionBytes, error)
MintNFT Create an unsigned transaction to mint a nft at devnet
func (*Client) MoveCall ¶
func (c *Client) MoveCall( ctx context.Context, signer suiAddress, packageId suiObjectID, module, function string, typeArgs []string, arguments []any, gas *suiObjectID, gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
MoveCall Create an unsigned transaction to execute a Move call on the network, by calling the specified function in the module of a given package. TODO: not support param `typeArguments` yet. So now only methods with `typeArguments` are supported TODO: execution_mode : <SuiTransactionBlockBuilderMode>
func (*Client) MultiGetObjects ¶
func (c *Client) MultiGetObjects( ctx context.Context, objIDs []suiObjectID, options *types.SuiObjectDataOptions, ) ([]types.SuiObjectResponse, error)
func (*Client) Pay ¶
func (c *Client) Pay( ctx context.Context, signer suiAddress, inputCoins []suiObjectID, recipients []suiAddress, amount []types.SafeSuiBigInt[uint64], gas *suiObjectID, gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
func (*Client) PayAllSui ¶
func (c *Client) PayAllSui( ctx context.Context, signer, recipient suiAddress, inputCoins []suiObjectID, gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
PayAllSui Create an unsigned transaction to send all SUI coins to one recipient.
func (*Client) PaySui ¶
func (c *Client) PaySui( ctx context.Context, signer suiAddress, inputCoins []suiObjectID, recipients []suiAddress, amount []types.SafeSuiBigInt[uint64], gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
func (*Client) QueryEvents ¶
func (*Client) QueryTransactionBlocks ¶
func (c *Client) QueryTransactionBlocks( ctx context.Context, query types.SuiTransactionBlockResponseQuery, cursor *suiDigest, limit *uint, descendingOrder bool, ) (*types.TransactionBlocksPage, error)
func (*Client) RequestAddStake ¶
func (*Client) RequestWithdrawStake ¶
func (*Client) ResolveNameServiceAddress ¶ added in v2.0.1
func (*Client) ResolveNameServiceNames ¶ added in v2.0.1
func (*Client) SplitCoin ¶
func (c *Client) SplitCoin( ctx context.Context, signer suiAddress, Coin suiObjectID, splitAmounts []types.SafeSuiBigInt[uint64], gas *suiObjectID, gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
SplitCoin Create an unsigned transaction to split a coin object into multiple coins.
func (*Client) SplitCoinEqual ¶
func (c *Client) SplitCoinEqual( ctx context.Context, signer suiAddress, Coin suiObjectID, splitCount types.SafeSuiBigInt[uint64], gas *suiObjectID, gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
SplitCoinEqual Create an unsigned transaction to split a coin object into multiple equal-size coins.
func (*Client) TransferObject ¶
func (c *Client) TransferObject( ctx context.Context, signer, recipient suiAddress, objID suiObjectID, gas *suiObjectID, gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
TransferObject Create an unsigned transaction to transfer an object from one address to another. The object's type must allow public transfers
func (*Client) TransferSui ¶
func (c *Client) TransferSui( ctx context.Context, signer, recipient suiAddress, suiObjID suiObjectID, amount, gasBudget types.SafeSuiBigInt[uint64], ) (*types.TransactionBytes, error)
TransferSui Create an unsigned transaction to send SUI coin object to a Sui address. The SUI object is also used as the gas object.
func (*Client) TryGetPastObject ¶
func (c *Client) TryGetPastObject( ctx context.Context, objectId suiObjectID, version uint64, options *types.SuiObjectDataOptions, ) (*types.SuiPastObjectResponse, error)
type SuiXMethod ¶
type SuiXMethod string
func (SuiXMethod) String ¶
func (s SuiXMethod) String() string
type UnsafeMethod ¶
type UnsafeMethod string
func (UnsafeMethod) String ¶
func (u UnsafeMethod) String() string