chains

package
v0.0.1-gowrapper-test Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildAmount

func BuildAmount(amount uint64) *sui.Amount

BuildAmount creates an Amount

func BuildObjectRef

func BuildObjectRef(objectID string, version uint64, objectDigest string) *sui.ObjectRef

BuildObjectRef creates an ObjectRef

func BuildPaySuiTransaction

func BuildPaySuiTransaction(
	inputCoins []*sui.ObjectRef,
	recipients []string,
	amounts []uint64,
) *sui.PaySui

BuildPaySuiTransaction creates a PaySui transaction

Types

type PaySuiRequest

type PaySuiRequest struct {
	// Input coins to spend (object IDs)
	InputCoins []string `json:"input_coins"`
	// Recipient addresses
	Recipients []string `json:"recipients"`
	// Amounts to send to each recipient (in MIST - 1 SUI = 1,000,000,000 MIST)
	Amounts []uint64 `json:"amounts"`
	// Gas budget for the transaction
	GasBudget uint64 `json:"gas_budget"`
	// Reference gas price
	ReferenceGasPrice uint64 `json:"reference_gas_price"`
	// Optional signer address (required for external signing)
	Signer string `json:"signer,omitempty"`
	// Optional private key (for direct signing)
	PrivateKey []byte `json:"private_key,omitempty"`
}

PaySuiRequest represents a user-friendly request for PaySui transactions

func NewPaySuiRequest

func NewPaySuiRequest() *PaySuiRequest

NewPaySuiRequest creates a new PaySuiRequest with default values

func NewPaySuiRequestWithDefaults

func NewPaySuiRequestWithDefaults(gasBudget, gasPrice uint64) *PaySuiRequest

NewPaySuiRequestWithDefaults creates a new PaySuiRequest with configurable default gas values

func (*PaySuiRequest) SetAmounts

func (req *PaySuiRequest) SetAmounts(amounts []uint64) *PaySuiRequest

SetAmounts sets the amounts

func (*PaySuiRequest) SetGasBudget

func (req *PaySuiRequest) SetGasBudget(gasBudget uint64) *PaySuiRequest

SetGasBudget sets the gas budget

func (*PaySuiRequest) SetInputCoins

func (req *PaySuiRequest) SetInputCoins(inputCoins []string) *PaySuiRequest

SetInputCoins sets the input coins

func (*PaySuiRequest) SetPrivateKey

func (req *PaySuiRequest) SetPrivateKey(privateKey []byte) *PaySuiRequest

SetPrivateKey sets the private key

func (*PaySuiRequest) SetRecipients

func (req *PaySuiRequest) SetRecipients(recipients []string) *PaySuiRequest

SetRecipients sets the recipients

func (*PaySuiRequest) SetReferenceGasPrice

func (req *PaySuiRequest) SetReferenceGasPrice(referenceGasPrice uint64) *PaySuiRequest

SetReferenceGasPrice sets the reference gas price

func (*PaySuiRequest) SetSigner

func (req *PaySuiRequest) SetSigner(signer string) *PaySuiRequest

SetSigner sets the signer address

func (*PaySuiRequest) Validate

func (req *PaySuiRequest) Validate() error

Validate validates the PaySuiRequest

type SuiChain

type SuiChain struct {
	*chain_abstraction.BaseChain
}

SuiChain implements the Chain interface for SUI blockchain

func NewSuiChain

func NewSuiChain() *SuiChain

NewSuiChain creates a new SUI chain instance

func (*SuiChain) BuildSigningInput

func (c *SuiChain) BuildSigningInput(
	privateKey []byte,
	gasBudget uint64,
	referenceGasPrice uint64,
	signer string,
) *sui.SigningInput

BuildSigningInput creates a Sui signing input for PaySui

func (*SuiChain) BuildSigningInputFromRequest

func (c *SuiChain) BuildSigningInputFromRequest(request *PaySuiRequest) (*sui.SigningInput, error)

BuildSigningInputFromRequest builds a SigningInput from PaySuiRequest

func (*SuiChain) CompileTransaction

func (c *SuiChain) CompileTransaction(txInput *chain_abstraction.TransactionInput, signatures [][]byte, publicKeys [][]byte) ([]byte, error)

CompileTransaction compiles a PaySui transaction with signatures

func (*SuiChain) CreateAndSignTransaction

func (c *SuiChain) CreateAndSignTransaction(input interface{}, privateKey []byte) ([]byte, error)

CreateAndSignTransaction creates and signs a PaySui transaction

func (*SuiChain) GetPreimageHash

func (c *SuiChain) GetPreimageHash(txInput *chain_abstraction.TransactionInput) ([]byte, []byte, error)

GetPreimageHash gets the preimage hash for PaySui transaction

func (*SuiChain) GetTransactionHash

func (c *SuiChain) GetTransactionHash(encodedTx []byte) (string, error)

GetTransactionHash gets the transaction hash

func (*SuiChain) PrepareTransaction

func (c *SuiChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)

PrepareTransaction prepares a PaySui transaction for external signing

func (*SuiChain) Sign

func (c *SuiChain) Sign(data []byte, privateKey []byte) ([]byte, error)

Sign signs data with a private key

func (*SuiChain) ValidateTransactionInput

func (c *SuiChain) ValidateTransactionInput(input interface{}) error

ValidateTransactionInput validates only PaySui transaction input

Jump to

Keyboard shortcuts

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