gmsui

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2024 License: GPL-2.0, GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SuiGasCoinType string = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"

	SuiZeroAddress   string = "0x0000000000000000000000000000000000000000000000000000000000000000"
	SuiClockObjectId string = "0x0000000000000000000000000000000000000000000000000000000000000006"
)

Functions

func B64PublicKeyToSuiAddress

func B64PublicKeyToSuiAddress(b64 string) (string, error)

func B64ToSuiPrivateKey

func B64ToSuiPrivateKey(b64 string) (string, error)

Utils

func Ed25519PublicKeyToB64PublicKey

func Ed25519PublicKeyToB64PublicKey(ed25519PubKey ed25519.PublicKey) string

func GetDynamicFieldObjectAndUnmarshal added in v0.0.8

func GetDynamicFieldObjectAndUnmarshal[T any, NameType any](client *SuiClient, parentId string, name sui_types.DynamicFieldName) (raw *types.SuiObjectResponse, value *T, err error)

func GetObjectAndUnmarshal added in v0.0.8

func GetObjectAndUnmarshal[T any](client *SuiClient, id string) (raw *types.SuiObjectResponse, value *T, err error)

func GetObjectsAndUnmarshal added in v0.0.8

func GetObjectsAndUnmarshal[T any](client *SuiClient, ids []string) (raw []types.SuiObjectResponse, values []*T, err error)

func NewSuiProvider

func NewSuiProvider(rpc string) (*sdk_client.Client, error)

func NewSuiProviderFromNetwork

func NewSuiProviderFromNetwork(network SuiNetwork) (*sdk_client.Client, error)

Create New Provider

func ParseDevInspectReturnValue added in v0.0.6

func ParseDevInspectReturnValue(v interface{}) []byte

func ParseEvent added in v0.0.2

func ParseEvent[T any](event types.SuiEvent) (*T, error)

Parsing custom event json Reference: https://docs.sui.io/guides/developer/sui-101/using-events#move-event-structure

func ParseFunctionTypeArguments

func ParseFunctionTypeArguments(typeArgs []string) (typeArguments []move_types.TypeTag, err error)

func SuiPrivateKeyToB64

func SuiPrivateKeyToB64(pk string) (string, error)

Types

type MoveEventModuleConfig added in v0.0.2

type MoveEventModuleConfig struct {
	Package string `toml:"Package,omitempty"`
	Module  string `toml:"Module,omitempty"`
}

Define the type as MoveModule/MoveEventModule. Events emitted, defined on the specified Move module. Reference: https://docs.sui.io/guides/developer/sui-101/using-events#filtering-event-queries

func (*MoveEventModuleConfig) Join added in v0.0.2

func (ec *MoveEventModuleConfig) Join() string

func (*MoveEventModuleConfig) JoinEventName added in v0.0.2

func (ec *MoveEventModuleConfig) JoinEventName(name string) string

func (*MoveEventModuleConfig) PackageToAddress added in v0.0.2

func (ec *MoveEventModuleConfig) PackageToAddress() *move_types.AccountAddress

type ProgrammableTransactionBlock

type ProgrammableTransactionBlock struct {
	// contains filtered or unexported fields
}

func (*ProgrammableTransactionBlock) Builder

func (*ProgrammableTransactionBlock) Client

func (ptb *ProgrammableTransactionBlock) Client() *SuiClient

func (*ProgrammableTransactionBlock) Context

func (*ProgrammableTransactionBlock) Finish

func (ptb *ProgrammableTransactionBlock) Finish(sender string, gasObject *string, gasBudget uint64, gasPrice *uint64) ([]byte, error)

func (*ProgrammableTransactionBlock) FinishFromMultisig

func (ptb *ProgrammableTransactionBlock) FinishFromMultisig() ([]byte, error)

func (*ProgrammableTransactionBlock) FinishFromSigner

func (ptb *ProgrammableTransactionBlock) FinishFromSigner() ([]byte, error)

func (*ProgrammableTransactionBlock) NewMoveCall

func (ptb *ProgrammableTransactionBlock) NewMoveCall(target string, args []interface{}, typeArgs []string) (*sui_types.Argument, error)

func (*ProgrammableTransactionBlock) ParseFunctionArguments

func (ptb *ProgrammableTransactionBlock) ParseFunctionArguments(target string, args []interface{}) (arguments []sui_types.Argument, err error)

txContext should be nil

type SuiClient

type SuiClient struct {
	Provider  *sdk_client.Client
	Keypair   cryptography.Keypair
	MultiSig  *multisig.MultiSigPublicKey
	GasBudget *big.Int
	// contains filtered or unexported fields
}

func InitClient

func InitClient(ctx context.Context, suiApi *sdk_client.Client) *SuiClient

Create New Sui Client

func (*SuiClient) Context

func (client *SuiClient) Context() context.Context

func (*SuiClient) DevInspect

func (client *SuiClient) DevInspect(target string, args []interface{}, typeArgs []string) (*types.DevInspectResults, error)

func (*SuiClient) ExecuteTransaction

func (client *SuiClient) ExecuteTransaction(b64TxBytes string, signatures []any) (*types.SuiTransactionBlockResponse, error)

func (*SuiClient) GetAllCoins

func (client *SuiClient) GetAllCoins(owner string, coinType string) (data []types.Coin, err error)

Instance Get All Sui Coins

func (*SuiClient) GetCoins

func (client *SuiClient) GetCoins(owner, coinType string, nextCursor *move_types.AccountAddress) (ret *types.Page[types.Coin, move_types.AccountAddress], err error)

func (*SuiClient) GetFunctionArgumentTypes

func (client *SuiClient) GetFunctionArgumentTypes(target string) ([]interface{}, error)

func (*SuiClient) GetMaxCoinObject

func (cli *SuiClient) GetMaxCoinObject(address, coinType string) (*types.Coin, error)

func (*SuiClient) ImplementationOfDevInspect

func (client *SuiClient) ImplementationOfDevInspect(txBytes string) (*types.DevInspectResults, error)

func (*SuiClient) MoveCallFromSigner

func (client *SuiClient) MoveCallFromSigner(target string, args []interface{}, typeArgs []string) (result *types.SuiTransactionBlockResponse, err error)

func (*SuiClient) NewMoveCall

func (client *SuiClient) NewMoveCall(signer string, gas *string, target string, args []interface{}, typeArgs []string) (*types.TransactionBytes, error)

Instance: Move Call

func (*SuiClient) NewMoveCallFromMultiSig

func (client *SuiClient) NewMoveCallFromMultiSig(target string, args []interface{}, typeArgs []string) (*types.TransactionBytes, error)

func (*SuiClient) NewMoveCallFromSigner

func (client *SuiClient) NewMoveCallFromSigner(target string, args []interface{}, typeArgs []string) (*types.TransactionBytes, error)

func (*SuiClient) NewProgrammableTransactionBlock

func (client *SuiClient) NewProgrammableTransactionBlock(ctx context.Context) *ProgrammableTransactionBlock

func (*SuiClient) SetDefaultGasBudget

func (client *SuiClient) SetDefaultGasBudget(budget *big.Int)

func (*SuiClient) SetKeypair added in v0.0.14

func (client *SuiClient) SetKeypair(keypair cryptography.Keypair)

func (*SuiClient) SetMultiSig added in v0.0.15

func (client *SuiClient) SetMultiSig(multisig *multisig.MultiSigPublicKey)

type SuiGasObject

type SuiGasObject struct {
	Live    string
	Pending []string
}

type SuiMoveDynamicField added in v0.0.7

type SuiMoveDynamicField[TypeFields any, TypeName any] struct {
	Id    SuiMoveId                            `json:"id"`
	Name  TypeName                             `json:"name"`
	Value SuiMoveDynamicFieldValue[TypeFields] `json:"value"`
}

type SuiMoveDynamicFieldValue added in v0.0.7

type SuiMoveDynamicFieldValue[TypeFields any] struct {
	Fields TypeFields `json:"fields"`
	Type   string     `json:"type"`
}

type SuiMoveId added in v0.0.7

type SuiMoveId struct {
	Id string `json:"id"`
}

type SuiMoveString added in v0.0.7

type SuiMoveString struct {
	Type   string              `json:"type"`
	Fields SuiMoveStringFields `json:"fields"`
}

type SuiMoveStringFields added in v0.0.7

type SuiMoveStringFields struct {
	Name string `json:"name"`
}

type SuiMoveTable added in v0.0.7

type SuiMoveTable struct {
	Fields SuiMoveTableFields `json:"fields"`
	Type   string             `json:"type"`
}

type SuiMoveTableFields added in v0.0.7

type SuiMoveTableFields struct {
	Id   SuiMoveId `json:"id"`
	Size string    `json:"size"`
}

type SuiNetwork

type SuiNetwork = string
var (
	MainnetFullNode SuiNetwork = "https://fullnode.mainnet.sui.io:443/"
	TestnetFullNode SuiNetwork = "https://fullnode.testnet.sui.io:443/"
	DevnetFullNode  SuiNetwork = "https://fullnode.devnet.sui.io:443/"
)

Directories

Path Synopsis
keypairs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL