gmsui

package
v0.100.18 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxSignerInMultisig = 10
)
View Source
const (
	SuiGasCoinType = "0x2::sui::SUI"
)

Variables

This section is empty.

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 NewSuiMessageWithIntent

func NewSuiMessageWithIntent(message []byte, scope IntentScope) []byte

func NewSuiProvider

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

func NewSuiProviderFromNetwork

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

Create New Provider

func ParseSignatureScheme

func ParseSignatureScheme(scheme byte) string

func SuiPrivateKeyToB64

func SuiPrivateKeyToB64(pk string) (string, error)

func ToSerializedSignature

func ToSerializedSignature(signature, pubKey []byte) string

func UnmarshalSuiBCS added in v0.100.11

func UnmarshalSuiBCS(data []byte, v any) error

func VerifyMessage

func VerifyMessage(message, signature string, scope IntentScope) (signer string, pass bool, err error)

func VerifyPersonalMessage

func VerifyPersonalMessage(message string, signature string) (signer string, pass bool, err error)

func VerifyTransactionMessage

func VerifyTransactionMessage(b64Message string, signature string) (signer string, pass bool, err error)

Types

type CompressedSignature

type CompressedSignature struct {
	Signature [65]byte `json:"signature"`
}

type Decoder added in v0.100.10

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

func NewSuiBCSDecoder added in v0.100.11

func NewSuiBCSDecoder(reader io.Reader) *Decoder

func (*Decoder) Decode added in v0.100.10

func (decoder *Decoder) Decode(v any) error

func (*Decoder) ReadByte added in v0.100.11

func (decoder *Decoder) ReadByte() (byte, error)

func (*Decoder) ReadBytes added in v0.100.11

func (decoder *Decoder) ReadBytes(len int) ([]byte, error)

type IntentScope

type IntentScope = uint8
const (
	TransactionDataIntentScope IntentScope = 0
	PersonalMessageIntentScope IntentScope = 3
)

type MultiSigPublicKeyStruct

type MultiSigPublicKeyStruct struct {
	PKMap     []PubkeyEnumWeightPair `json:"pk_map"`
	Threshold uint16                 `json:"threshold"`
}

type MultiSigStruct

type MultiSigStruct struct {
	Sigs       []CompressedSignature   `json:"sigs"`
	Bitmap     uint16                  `json:"bitmap"`
	MultisigPK MultiSigPublicKeyStruct `json:"multisig_pk"`
}

type PubkeyEnumWeightPair

type PubkeyEnumWeightPair struct {
	PubKey [33]byte `json:"pub_key"`
	Weight uint8    `json:"weight"`
}

type SignaturePubkeyPair

type SignaturePubkeyPair struct {
	SignatureScheme string
	Signature       []byte
	PubKey          []byte
}

func FromSerializedSignature

func FromSerializedSignature(serializedSignature string) (*SignaturePubkeyPair, error)

type SuiAddress

type SuiAddress = string

type SuiClient

type SuiClient struct {
	Provider  *client.Client
	SuiSigner *SuiSigner
	MultiSig  *SuiMultiSig
	GasBudget *big.Int
}

func InitSuiClient

func InitSuiClient(suiApi *client.Client) (client *SuiClient)

Create New Sui Client

func (*SuiClient) AutoUpdateGas

func (cli *SuiClient) AutoUpdateGas(owner string, gas *SuiGasObject)

func (*SuiClient) DevInspect

func (cli *SuiClient) DevInspect(ctx context.Context, target string, args []interface{}, argsType []move_types.TypeTag) (*types.DevInspectResults, error)

func (*SuiClient) EnableAutoUpdateGasObjectFromMultiSig

func (cli *SuiClient) EnableAutoUpdateGasObjectFromMultiSig()

func (*SuiClient) EnableAutoUpdateGasObjectFromSigner

func (cli *SuiClient) EnableAutoUpdateGasObjectFromSigner()

func (*SuiClient) ExecuteTransaction

func (cli *SuiClient) ExecuteTransaction(ctx context.Context, b64TxBytes string, signatures []any) (*types.SuiTransactionBlockResponse, error)

func (*SuiClient) GetAllCoins

func (cli *SuiClient) GetAllCoins(ctx context.Context, owner string, coinType string) (data []types.Coin, err error)

Instance Get All Sui Coins

func (*SuiClient) GetCoins

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

func (*SuiClient) GetFunctionArgTypes

func (cli *SuiClient) GetFunctionArgTypes(ctx context.Context, target string) (*[]interface{}, error)

func (*SuiClient) GetMaxCoinObject

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

func (*SuiClient) GetMoveFunctionArgTypes

func (cli *SuiClient) GetMoveFunctionArgTypes(ctx context.Context, packageId, module, function string) (*[]interface{}, error)

func (*SuiClient) GetObject

func (cli *SuiClient) GetObject(ctx context.Context, objectId string) (*types.SuiObjectResponse, error)

func (*SuiClient) ImplementationOfDevInspect

func (cli *SuiClient) ImplementationOfDevInspect(ctx context.Context, txBytes string) (*types.DevInspectResults, error)

func (*SuiClient) MoveCallFromSigner

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

func (*SuiClient) NewMoveCall

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

Instance: Move Call

func (*SuiClient) NewMoveCallFromMultiSig

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

func (*SuiClient) NewMoveCallFromSigner

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

func (*SuiClient) NewProgrammableTransactionMoveCall

func (cli *SuiClient) NewProgrammableTransactionMoveCall(ctx context.Context, builder *sui_types.ProgrammableTransactionBuilder, target string, args []interface{}) (*sui_types.Argument, error)

func (*SuiClient) NewSuiMultiSig

func (cli *SuiClient) NewSuiMultiSig(multisig *SuiMultiSig)

func (*SuiClient) NewSuiSigner

func (cli *SuiClient) NewSuiSigner(signer *SuiSigner)

func (*SuiClient) ParseFunctionArgs

func (cli *SuiClient) ParseFunctionArgs(ctx context.Context, target string, args []interface{}) (ret []sui_types.CallArg, err error)

func (*SuiClient) ProgrammableTransactionFinishFromMultisig

func (cli *SuiClient) ProgrammableTransactionFinishFromMultisig(ctx context.Context, builder *sui_types.ProgrammableTransactionBuilder) ([]byte, error)

func (*SuiClient) ProgrammableTransactionFinishFromSigner

func (cli *SuiClient) ProgrammableTransactionFinishFromSigner(ctx context.Context, builder *sui_types.ProgrammableTransactionBuilder) ([]byte, error)

func (*SuiClient) SetDefaultGasBudget

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

func (*SuiClient) SetMultiSigDefaultGasObject

func (cli *SuiClient) SetMultiSigDefaultGasObject(obj string)

func (*SuiClient) SetSignerDefaultGasObject

func (cli *SuiClient) SetSignerDefaultGasObject(obj string)

Tools

func (*SuiClient) TryDevInspect

func (cli *SuiClient) TryDevInspect(ctx context.Context, target string, args []sui_types.CallArg, typeArgs []move_types.TypeTag) (*types.DevInspectResults, error)

type SuiGasObject

type SuiGasObject struct {
	Live    string
	Pending []string
}

type SuiMultiSig

type SuiMultiSig struct {
	Threshold    uint16
	Address      string
	PublicKeyMap []SuiPubkeyWeightPair
	Gas          *SuiGasObject
}

func NewSuiMultiSig

func NewSuiMultiSig(pubKeys []string, weights []uint8, threshold uint16) (*SuiMultiSig, error)

func (*SuiMultiSig) CombineSignatures

func (m *SuiMultiSig) CombineSignatures(signatures []string) (string, error)

func (*SuiMultiSig) Info

func (m *SuiMultiSig) Info() *SuiMultiSigInfo

func (*SuiMultiSig) ToMultiSigAddress

func (m *SuiMultiSig) ToMultiSigAddress() (string, error)

type SuiMultiSigInfo

type SuiMultiSigInfo struct {
	Address   string
	Threshold uint16
	Signers   []SuiMultiSigInfoSigner
}

type SuiMultiSigInfoSigner

type SuiMultiSigInfoSigner struct {
	Address      string
	B64PublicKey string
	HexPublicKey string
	Weight       uint8
}

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/"
)

type SuiPubkeyWeightPair

type SuiPubkeyWeightPair struct {
	PublicKey string
	Weight    uint8
}

type SuiSignedDataRet

type SuiSignedDataRet struct {
	TxBytes   string `json:"tx_bytes"`
	Signature string `json:"signature"`
}

type SuiSignedMessageRet

type SuiSignedMessageRet = SuiSignedDataRet

type SuiSignedTransactionRet

type SuiSignedTransactionRet = SuiSignedDataRet

type SuiSigner

type SuiSigner struct {
	Signer *account.Account
	Gas    *SuiGasObject
}

func NewSuiSignerFromBase64PrivateKey

func NewSuiSignerFromBase64PrivateKey(b64PriKey string) (*SuiSigner, error)

Create New Signer

func NewSuiSignerFromMnemonic

func NewSuiSignerFromMnemonic(mnemonic string, derivePath string) (*SuiSigner, error)

func NewSuiSignerFromPrivateKey

func NewSuiSignerFromPrivateKey(priKey string) (*SuiSigner, error)

func NewSuiSignerFromSeed

func NewSuiSignerFromSeed(seed []byte) *SuiSigner

func (*SuiSigner) GetAddress

func (s *SuiSigner) GetAddress() string

func (*SuiSigner) GetPulbicKey

func (s *SuiSigner) GetPulbicKey() string

Instance Function

func (*SuiSigner) SignMessage

func (s *SuiSigner) SignMessage(data string, scope IntentScope) (*SuiSignedDataRet, error)

func (*SuiSigner) SignMessageBytes

func (s *SuiSigner) SignMessageBytes(data []byte) (*SuiSignedDataRet, error)

func (*SuiSigner) SignPersonalMessage

func (s *SuiSigner) SignPersonalMessage(message string) (*SuiSignedMessageRet, error)

func (*SuiSigner) SignTransaction

func (s *SuiSigner) SignTransaction(b64TxBytes string) (*SuiSignedTransactionRet, error)

type VectorAddress

type VectorAddress struct {
	Data []SuiAddress
}

func (*VectorAddress) Marshal

func (v *VectorAddress) Marshal() (buf []byte, err error)

type VectorBigInt

type VectorBigInt struct {
	Data []*big.Int
}

func (*VectorBigInt) Marshal

func (v *VectorBigInt) Marshal() (buf []byte, err error)

type VectorU16

type VectorU16 struct {
	Data []uint16
}

func (*VectorU16) Marshal

func (v *VectorU16) Marshal() (buf []byte, err error)

type VectorU32

type VectorU32 struct {
	Data []uint32
}

func (*VectorU32) Marshal

func (v *VectorU32) Marshal() (buf []byte, err error)

type VectorU64

type VectorU64 struct {
	Data []uint64
}

func (*VectorU64) Marshal

func (v *VectorU64) Marshal() (buf []byte, err error)

type VectorU8

type VectorU8 struct {
	Data []uint8
}

func (*VectorU8) Marshal

func (v *VectorU8) Marshal() (buf []byte, err error)

Jump to

Keyboard shortcuts

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