Documentation ¶
Index ¶
- Constants
- Variables
- func BuildMergeTx(from string, coin []*SuiObjectRef, objects []*SuiObjectRef, ...) ([]byte, error)
- func BuildMulTx(from string, coin []*SuiObjectRef, amounts map[string]uint64, ...) ([]byte, error)
- func BuildSplitTx(from, to string, coins []*SuiObjectRef, amounts []uint64, ...) ([]byte, error)
- func BuildStakeTx(from, validator string, coins []*SuiObjectRef, amount uint64, ...) ([]byte, error)
- func BuildTokenTx(from, to string, coins []*SuiObjectRef, tokens []*SuiObjectRef, amount uint64, ...) ([]byte, error)
- func BuildTx(from, to string, coins []*SuiObjectRef, amount uint64, ...) ([]byte, error)
- func BuildWithdrawStakeTx(from string, coins []*SuiObjectRef, stake *SuiObjectRef, ...) ([]byte, error)
- func DecodeHexString(s string) ([]byte, error)
- func Execute(r *Request, from, to string, gasBudget uint64, gasPrice uint64, seedHex string) (string, error)
- func GenerateKey() (crypto_ed25519.PrivateKey, error)
- func GetAddressByPubKey(publicKeyHex string) (string, error)
- func GetRawTx(txBytes string) (string, error)
- func GetTxHash(r *Request, to string, gasBudget uint64, gasPrice uint64, addr string) (string, error)
- func Hash(txBytes string) (string, error)
- func NewAddress(seedHex string) string
- func NormalizeSuiAddress(value string) string
- func PrepareTx(r *Request, to string, gasBudget uint64, gasPrice uint64, addr string) (string, error)
- func SignMessage(input string, seedHex string) (string, error)
- func UlebEncode(num uint64) []byte
- func ValidateAddress(address string) bool
- func WriteAddress(buf *bytes.Buffer, address string) error
- func WriteBigInt(buf *bytes.Buffer, value *big.Int, bits int) error
- func WriteBool(buf *bytes.Buffer, value bool) error
- func WriteHash(buf *bytes.Buffer, hash string) error
- func WriteLen(buf *bytes.Buffer, l int) error
- func WriteString(buf *bytes.Buffer, value string) error
- func WriteUint16(buf *bytes.Buffer, value uint16) error
- func WriteUint32(buf *bytes.Buffer, value uint32) error
- func WriteUint64(buf *bytes.Buffer, value uint64) error
- func WriteUint8(buf *bytes.Buffer, value uint8) error
- type Address
- type Amount
- type Coin
- type Command
- type Expiration
- type GasConfig
- type Input
- type MergeSuiRequest
- type Object
- type Pay
- type PaySuiRequest
- type Request
- type Shared
- type SharedOrOwned
- type SignedTransaction
- type SplitSuiRequest
- type StakeSuiRequest
- type SuiObject
- type SuiObjectRef
- type Type
- type WithdrawStakSuiRequest
Constants ¶
View Source
const ( SignatureScheme = "ED25519" PUBLIC_KEY_SIZE = 32 SUI_ADDRESS_LENGTH = 32 )
View Source
const ( Empty = Type("") Transfer = Type("transfer") //transfer sui objects Split = Type("split") // split sui objects Merge = Type("merge") // merge sui objects Stake = Type("stake") //stake sui WithdrawStake = Type("withdrawStake") //withdraw stake of sui Raw = Type("raw") //sign the txbytes )
Variables ¶
View Source
var ( ErrInvalidSuiRequest = errors.New("invalid sui request") ErrInvalidSuiSeedHex = errors.New("invalid sui seed hex") ErrInvalidSuiParam = errors.New("invalid sui param") ErrUnknownSuiRequest = errors.New("unknown sui request") )
View Source
var ( ErrInvalidStruct = errors.New("invalid struct tag") ErrEmptyCoins = errors.New("empty coins") ErrEmptyTokens = errors.New("empty tokens") ErrInvalidUint64 = errors.New("invalid uint64") ErrInvalidString = errors.New("invalid string") ErrInvalidPure = errors.New("invalid pure") ErrInvalidBytes = errors.New("invalid bytes") ErrInvalidMoveCall = errors.New("invalid move call target") ErrInvalidParams = errors.New("invalid params") )
Functions ¶
func BuildMergeTx ¶
func BuildMergeTx(from string, coin []*SuiObjectRef, objects []*SuiObjectRef, epoch, gasBudget, gasPrice uint64) ([]byte, error)
func BuildMulTx ¶
func BuildSplitTx ¶
func BuildStakeTx ¶
func BuildTokenTx ¶
func BuildTokenTx(from, to string, coins []*SuiObjectRef, tokens []*SuiObjectRef, amount uint64, epoch, gasBudget, gasPrice uint64) ([]byte, error)
func BuildWithdrawStakeTx ¶
func BuildWithdrawStakeTx(from string, coins []*SuiObjectRef, stake *SuiObjectRef, epoch, gasBudget, gasPrice uint64) ([]byte, error)
func DecodeHexString ¶
func GenerateKey ¶
func GenerateKey() (crypto_ed25519.PrivateKey, error)
func GetAddressByPubKey ¶
func NewAddress ¶
func NormalizeSuiAddress ¶
func UlebEncode ¶
func ValidateAddress ¶
Types ¶
type Address ¶
type Amount ¶
type Coin ¶
type Command ¶
type Command struct { Kind string `json:"kind"` Target string `json:"target,omitempty"` Coin *Coin `json:"coin,omitempty"` Destination *Coin `json:"destination,omitempty"` Sources []*Coin `json:"sources,omitempty"` Amounts []*Amount `json:"amounts,omitempty"` Objects []*Object `json:"objects,omitempty"` Address *Address `json:"address,omitempty"` Arguments []*Coin `json:"arguments,omitempty"` TypeArguments []interface{} `json:"typeArguments,omitempty"` }
type Expiration ¶
type Expiration struct {
Epoch uint64 `json:"Epoch"`
}
type GasConfig ¶
type GasConfig struct { Price string `json:"price"` Budget string `json:"budget"` Payment []*SuiObjectRef `json:"payment"` }
type Input ¶
type MergeSuiRequest ¶
type MergeSuiRequest struct { Coins []*SuiObjectRef `json:"coins"` Objects []*SuiObjectRef `json:"objects"` Epoch uint64 `json:"epoch"` }
type Object ¶
type Pay ¶
type Pay struct { Sender string `json:"sender"` Expiration *Expiration `json:"expiration,omitempty"` GasConfig GasConfig `json:"gasConfig"` Inputs []*Input `json:"inputs"` Commands []*Command `json:"transactions"` }
type PaySuiRequest ¶
type PaySuiRequest struct { Coins []*SuiObjectRef `json:"coins"` Amount uint64 `json:"amount"` Epoch uint64 `json:"epoch"` }
type SharedOrOwned ¶
type SharedOrOwned struct {}
type SignedTransaction ¶
type SignedTransaction struct { TxBytes string `json:"tx_bytes,omitempty"` Signature string `json:"signature,omitempty"` }
func SignTransaction ¶
func SignTransaction(txBytes string, seedHex string) (*SignedTransaction, error)
type SplitSuiRequest ¶
type SplitSuiRequest struct { Coins []*SuiObjectRef `json:"coins"` Amounts []uint64 `json:"amounts"` Epoch uint64 `json:"epoch"` }
type StakeSuiRequest ¶
type StakeSuiRequest struct { Coins []*SuiObjectRef `json:"coins"` Amount uint64 `json:"amount"` Epoch uint64 `json:"epoch"` }
type SuiObject ¶
type SuiObject struct {
Object *SharedOrOwned `json:"Object"`
}
func NewImmOrOwnedObject ¶
func NewImmOrOwnedObject(ref *SuiObjectRef) *SuiObject
type SuiObjectRef ¶
type SuiObjectRef struct { Digest string `json:"digest"` ObjectId string `json:"objectId"` Version uint64 `json:"version"` }
func (*SuiObjectRef) Check ¶
func (s *SuiObjectRef) Check() bool
type WithdrawStakSuiRequest ¶
type WithdrawStakSuiRequest struct { Coins []*SuiObjectRef `json:"coins"` StakeCoin *SuiObjectRef `json:"stake_coin"` Epoch uint64 `json:"epoch"` }
Click to show internal directories.
Click to hide internal directories.