Documentation
¶
Index ¶
- Constants
- Variables
- 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 types.Address, filter func(types.ObjectInfo) bool) ([]types.ObjectRead, error)
- func (c *Client) BatchGetObject(objects []types.ObjectId) (map[string]*types.ObjectRead, error)
- func (c *Client) BatchGetObjectsOwnedByAddress(ctx context.Context, address types.Address, filterType string) ([]types.ObjectRead, error)
- func (c *Client) BatchGetTransaction(digests []string) (map[string]*types.TransactionResponse, error)
- func (c *Client) BatchTransaction(ctx context.Context, signer types.Address, txnParams []map[string]interface{}, ...) (*types.TransactionBytes, error)
- func (c *Client) Call(result interface{}, method string, args ...interface{}) error
- func (c *Client) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (c *Client) DevInspectMoveCall(ctx context.Context, signer types.Address, packageId types.ObjectId, ...) (*types.DevInspectResults, error)
- func (c *Client) DevInspectTransaction(ctx context.Context, txByte types.Base64Data) (*types.DevInspectResults, error)
- func (c *Client) DryRunTransaction(ctx context.Context, tx *types.TransactionBytes) (*types.TransactionEffects, error)
- func (c *Client) ExecuteTransaction(ctx context.Context, txn types.SignedTransaction, ...) (*types.ExecuteTransactionResponse, error)
- func (c *Client) ExecuteTransactionSerializedSig(ctx context.Context, txn types.SignedTransactionSerializedSig, ...) (*types.ExecuteTransactionResponse, error)
- func (c *Client) GetAllBalances(ctx context.Context, address types.Address) ([]types.SuiCoinBalance, error)
- func (c *Client) GetAllCoins(ctx context.Context, address types.Address, cursor *types.ObjectId, limit uint) (*types.CoinPage, error)
- func (c *Client) GetBalance(ctx context.Context, address types.Address, coinType *string) (*types.SuiCoinBalance, error)
- func (c *Client) GetCoinMetadata(ctx context.Context, coinType string) (*types.SuiCoinMetadata, error)
- func (c *Client) GetCoins(ctx context.Context, address types.Address, coinType *string, ...) (*types.CoinPage, error)
- func (c *Client) GetCoinsOwnedByAddress(ctx context.Context, address types.Address, coinType string) (coins types.Coins, err error)
- func (c *Client) GetNFTsOwnedByAddress(ctx context.Context, address types.Address) ([]types.ObjectRead, error)
- func (c *Client) GetObject(ctx context.Context, objID types.ObjectId) (*types.ObjectRead, error)
- func (c *Client) GetObjectsOwnedByAddress(ctx context.Context, address types.Address) ([]types.ObjectInfo, error)
- func (c *Client) GetObjectsOwnedByObject(ctx context.Context, objID types.ObjectId) ([]types.ObjectInfo, error)
- func (c *Client) GetRawObject(ctx context.Context, objID types.ObjectId) (*types.ObjectRead, error)
- func (c *Client) GetSuiCoinsOwnedByAddress(ctx context.Context, address types.Address) (types.Coins, error)
- func (c *Client) GetTotalSupply(ctx context.Context, coinType string) (*types.Supply, error)
- func (c *Client) GetTotalTransactionNumber(ctx context.Context) (uint64, error)
- func (c *Client) GetTransaction(ctx context.Context, digest string) (*types.TransactionResponse, error)
- func (c *Client) GetTransactionsInRange(ctx context.Context, start, end uint64) ([]string, error)
- func (c *Client) MergeCoins(ctx context.Context, signer types.Address, ...) (*types.TransactionBytes, error)
- func (c *Client) MintNFT(ctx context.Context, signer types.Address, ...) (*types.TransactionBytes, error)
- func (c *Client) MoveCall(ctx context.Context, signer types.Address, packageId types.ObjectId, ...) (*types.TransactionBytes, error)
- func (c *Client) Pay(ctx context.Context, signer types.Address, inputCoins []types.ObjectId, ...) (*types.TransactionBytes, error)
- func (c *Client) PayAllSui(ctx context.Context, signer, recipient types.Address, ...) (*types.TransactionBytes, error)
- func (c *Client) PaySui(ctx context.Context, signer types.Address, inputCoins []types.ObjectId, ...) (*types.TransactionBytes, error)
- func (c *Client) Publish(ctx context.Context, address types.Address, ...) (*types.TransactionBytes, error)
- func (c *Client) SplitCoin(ctx context.Context, signer types.Address, Coin types.ObjectId, ...) (*types.TransactionBytes, error)
- func (c *Client) SplitCoinEqual(ctx context.Context, signer types.Address, Coin types.ObjectId, ...) (*types.TransactionBytes, error)
- func (c *Client) TransferObject(ctx context.Context, signer, recipient types.Address, objID types.ObjectId, ...) (*types.TransactionBytes, error)
- func (c *Client) TransferSui(ctx context.Context, signer, recipient types.Address, suiObjID types.ObjectId, ...) (*types.TransactionBytes, error)
- type HTTPError
Constants ¶
const (
DevNetFaucetUrl = "https://faucet.devnet.sui.io/gas"
)
Variables ¶
var (
ErrNoResult = errors.New("no result in JSON-RPC response")
)
Functions ¶
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 (*Client) BatchGetObject ¶
func (*Client) BatchGetObjectsOwnedByAddress ¶
func (c *Client) BatchGetObjectsOwnedByAddress(ctx context.Context, address types.Address, filterType string) ([]types.ObjectRead, error)
BatchGetObjectsOwnedByAddress @param filterType You can specify filtering out the specified resources, this will fetch all resources if it is not empty ""
func (*Client) BatchGetTransaction ¶
func (*Client) BatchTransaction ¶
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 string, 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) DevInspectMoveCall ¶
func (*Client) DevInspectTransaction ¶
func (c *Client) DevInspectTransaction(ctx context.Context, txByte types.Base64Data) (*types.DevInspectResults, error)
func (*Client) DryRunTransaction ¶
func (c *Client) DryRunTransaction(ctx context.Context, tx *types.TransactionBytes) (*types.TransactionEffects, error)
func (*Client) ExecuteTransaction ¶
func (c *Client) ExecuteTransaction(ctx context.Context, txn types.SignedTransaction, requestType types.ExecuteTransactionRequestType) (*types.ExecuteTransactionResponse, error)
func (*Client) ExecuteTransactionSerializedSig ¶
func (c *Client) ExecuteTransactionSerializedSig(ctx context.Context, txn types.SignedTransactionSerializedSig, requestType types.ExecuteTransactionRequestType) (*types.ExecuteTransactionResponse, error)
func (*Client) GetAllBalances ¶
func (*Client) GetAllCoins ¶
func (c *Client) GetAllCoins(ctx context.Context, address types.Address, cursor *types.ObjectId, 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, address types.Address, coinType *string) (*types.SuiCoinBalance, error)
GetBalance to use default sui coin(0x2::sui::SUI) when coinType is nil
func (*Client) GetCoinMetadata ¶
func (*Client) GetCoins ¶
func (c *Client) GetCoins(ctx context.Context, address types.Address, coinType *string, cursor *types.ObjectId, 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) GetCoinsOwnedByAddress ¶
func (*Client) GetNFTsOwnedByAddress ¶
func (*Client) GetObjectsOwnedByAddress ¶
func (*Client) GetObjectsOwnedByObject ¶
func (*Client) GetRawObject ¶
func (*Client) GetSuiCoinsOwnedByAddress ¶
func (*Client) GetTotalSupply ¶
func (*Client) GetTotalTransactionNumber ¶
func (*Client) GetTransaction ¶
func (*Client) GetTransactionsInRange ¶
func (*Client) MergeCoins ¶
func (c *Client) MergeCoins(ctx context.Context, signer types.Address, primaryCoin, coinToMerge types.ObjectId, gas *types.ObjectId, gasBudget 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 types.Address, nftName, nftDescription, nftUri string, gas *types.ObjectId, 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 types.Address, packageId types.ObjectId, module, function string, typeArgs []string, arguments []any, gas *types.ObjectId, gasBudget 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
func (*Client) PayAllSui ¶
func (c *Client) PayAllSui(ctx context.Context, signer, recipient types.Address, inputCoins []types.ObjectId, gasBudget uint64) (*types.TransactionBytes, error)
PayAllSui Create an unsigned transaction to send all SUI coins to one recipient.
func (*Client) SplitCoin ¶
func (c *Client) SplitCoin(ctx context.Context, signer types.Address, Coin types.ObjectId, splitAmounts []uint64, gas *types.ObjectId, gasBudget 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 types.Address, Coin types.ObjectId, splitCount uint64, gas *types.ObjectId, gasBudget 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 types.Address, objID types.ObjectId, gas *types.ObjectId, gasBudget 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 types.Address, suiObjID types.ObjectId, amount, gasBudget 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.