Documentation ¶
Index ¶
- Constants
- Variables
- func UseDefaultHash(signable Signable) []byte
- type AppId
- type Argument
- type BcsSignable
- type BcsSignableKind
- type BuilderArg
- type CallArg
- type CertificateDigest
- type ChangeEpoch
- type CheckpointContentsDigest
- type CheckpointDigest
- type CheckpointSequenceNumber
- type CheckpointTimestamp
- type Command
- type ConsensusCommitPrologue
- type Data
- type DefaultHash
- type Digest
- type DynamicFieldName
- type DynamicFieldType
- type Ed25519SuiSignature
- type EpochId
- type GasData
- type GenesisObject
- type GenesisTransaction
- type Intent
- type IntentMessage
- type IntentScope
- type IntentValue
- type IntentVersion
- type MoveCall
- type MoveModulePublish
- type MoveObject
- type MoveObjectType
- type MoveObjectType_
- type MovePackage
- type Object
- type ObjectArg
- type ObjectDigest
- type ObjectID
- type ObjectRef
- type Owner
- type Pay
- type PayAllSui
- type PaySui
- type ProgrammableMoveCall
- type ProgrammableTransaction
- type ProgrammableTransactionBuilder
- func (p *ProgrammableTransactionBuilder) Command(command Command) Argument
- func (p *ProgrammableTransactionBuilder) Finish() ProgrammableTransaction
- func (p *ProgrammableTransactionBuilder) ForceSeparatePure(value any) (Argument, error)
- func (p *ProgrammableTransactionBuilder) Input(callArg CallArg) (Argument, error)
- func (p *ProgrammableTransactionBuilder) MakeObjList(objs []ObjectArg) (Argument, error)
- func (p *ProgrammableTransactionBuilder) MoveCall(packageID ObjectID, module move_types.Identifier, ...) error
- func (p *ProgrammableTransactionBuilder) Obj(objArg ObjectArg) (Argument, error)
- func (p *ProgrammableTransactionBuilder) Pay(coins []*ObjectRef, recipients []SuiAddress, amounts []uint64) error
- func (p *ProgrammableTransactionBuilder) PayAllSui(recipient SuiAddress) error
- func (p *ProgrammableTransactionBuilder) PayMulInternal(recipients []SuiAddress, amounts []uint64, coin Argument) error
- func (p *ProgrammableTransactionBuilder) PaySui(recipients []SuiAddress, amounts []uint64) error
- func (p *ProgrammableTransactionBuilder) Pure(value any) (Argument, error)
- func (p *ProgrammableTransactionBuilder) TransferObject(recipient SuiAddress, objectRefs []*ObjectRef) error
- func (p *ProgrammableTransactionBuilder) TransferSui(recipient SuiAddress, amount *uint64) error
- type Secp256k1SuiSignature
- type Secp256r1SuiSignature
- type SequenceNumber
- type Signable
- type Signature
- type SignatureScheme
- type SingleTransactionKind
- type SuiAddress
- type SuiKeyPair
- type TransactionData
- type TransactionDataV1
- type TransactionDigest
- type TransactionEffectsDigest
- type TransactionEventsDigest
- type TransactionExpiration
- type TransactionKind
- type TransferObject
- type TransferSui
- type TypeOrigin
- type UpgradeInfo
Constants ¶
View Source
const ( StakingPoolModuleName = move_types.Identifier("staking_pool") StakedSuiStructName = move_types.Identifier("StakedSui") AddStakeMulCoinFunName = move_types.Identifier("request_add_stake_mul_coin") AddStakeFunName = move_types.Identifier("request_add_stake") WithdrawStakeFunName = move_types.Identifier("request_withdraw_stake") )
View Source
const (
ObjectStartVersion = SequenceNumber(1)
)
Variables ¶
View Source
var ( SuiSystemMut = CallArg{ Object: &SuiSystemMutObj, } SuiSystemMutObj = ObjectArg{ SharedObject: &struct { Id ObjectID InitialSharedVersion SequenceNumber Mutable bool }{Id: *SuiSystemStateObjectId, InitialSharedVersion: SuiSystemStateObjectSharedVersion, Mutable: true}, } )
View Source
var (
SuiSystemAddress, _ = NewAddressFromHex("0x3")
SuiSystemPackageId = SuiSystemAddress
SuiSystemStateObjectId, _ = NewObjectIdFromHex("0x5")
)
Functions ¶
func UseDefaultHash ¶ added in v2.0.1
Types ¶
type Argument ¶
type BcsSignable ¶ added in v2.0.1
type BcsSignable[K BcsSignableKind] struct { Data K }
func (BcsSignable[K]) Write ¶ added in v2.0.1
func (s BcsSignable[K]) Write(digest hash.Hash)
type BcsSignableKind ¶ added in v2.0.1
type BcsSignableKind interface { TransactionData | Object }
type BuilderArg ¶
func (BuilderArg) String ¶
func (b BuilderArg) String() string
type CertificateDigest ¶
type CertificateDigest = Digest
type ChangeEpoch ¶
type ChangeEpoch struct { Epoch EpochId ProtocolVersion sui_protocol.ProtocolVersion StorageCharge uint64 ComputationCharge uint64 StorageRebate uint64 NonRefundableStorageFee uint64 EpochStartTimestampMs uint64 SystemPackages []*struct { SequenceNumber SequenceNumber Bytes [][]uint8 Objects []*ObjectID } }
type CheckpointContentsDigest ¶
type CheckpointContentsDigest = Digest
type CheckpointDigest ¶
type CheckpointDigest = Digest
type CheckpointSequenceNumber ¶
type CheckpointSequenceNumber = uint64
type CheckpointTimestamp ¶
type CheckpointTimestamp = uint64
type Command ¶
type Command struct { MoveCall *ProgrammableMoveCall TransferObjects *struct { Arguments []Argument Argument Argument } SplitCoins *struct { Argument Argument Arguments []Argument } MergeCoins *struct { Argument Argument Arguments []Argument } Publish *struct { Bytes [][]uint8 Objects []ObjectID } MakeMoveVec *struct { TypeTag *move_types.TypeTag `bcs:"optional"` Arguments []Argument } Upgrade *struct { Bytes [][]uint8 Objects []ObjectID ObjectID ObjectID Argument Argument } }
type ConsensusCommitPrologue ¶
type ConsensusCommitPrologue struct { Epoch uint64 Round uint64 CommitTimestampMs CheckpointTimestamp }
type Data ¶
type Data struct { Move *MoveObject Package *MovePackage }
type DefaultHash ¶ added in v2.0.1
func NewDefaultHash ¶ added in v2.0.1
func NewDefaultHash() DefaultHash
type DynamicFieldName ¶
type DynamicFieldType ¶
type DynamicFieldType struct { DynamicField *lib.EmptyEnum `json:"DynamicField"` DynamicObject *lib.EmptyEnum `json:"DynamicObject"` }
func (DynamicFieldType) Content ¶
func (d DynamicFieldType) Content() string
func (DynamicFieldType) Tag ¶
func (d DynamicFieldType) Tag() string
type Ed25519SuiSignature ¶
type Ed25519SuiSignature struct {
Signature [ed25519.PublicKeySize + ed25519.SignatureSize + 1]byte
}
func NewEd25519SuiSignature ¶
func NewEd25519SuiSignature(keyPair crypto.KeyPair, message []byte) *Ed25519SuiSignature
type GasData ¶
type GasData struct { Payment []*ObjectRef Owner SuiAddress Price uint64 Budget uint64 }
type GenesisObject ¶
type GenesisTransaction ¶
type GenesisTransaction struct {
Objects []GenesisObject
}
type Intent ¶
type Intent struct { Scope IntentScope Version IntentVersion AppId AppId }
func DefaultIntent ¶
func DefaultIntent() Intent
type IntentMessage ¶
type IntentMessage[T IntentValue] struct { Intent Intent Value T }
func NewIntentMessage ¶
func NewIntentMessage[T IntentValue](intent Intent, value T) IntentMessage[T]
type IntentScope ¶
type IntentScope struct { TransactionData *lib.EmptyEnum // Used for a user signature on a transaction data. TransactionEffects *lib.EmptyEnum // Used for an authority signature on transaction effects. CheckpointSummary *lib.EmptyEnum // Used for an authority signature on a checkpoint summary. PersonalMessage *lib.EmptyEnum // Used for a user signature on a personal message. SenderSignedTransaction *lib.EmptyEnum // Used for an authority signature on a user signed transaction. ProofOfPossession *lib.EmptyEnum // Used as a signature representing an authority's proof of possesion of its authority protocol key. HeaderDigest *lib.EmptyEnum // Used for narwhal authority signature on header digest. }
func (IntentScope) IsBcsEnum ¶
func (i IntentScope) IsBcsEnum()
type IntentValue ¶
type IntentValue interface { TransactionData | ~[]byte }
type IntentVersion ¶
func (IntentVersion) IsBcsEnum ¶
func (i IntentVersion) IsBcsEnum()
type MoveModulePublish ¶
type MoveModulePublish struct {
Modules [][]byte
}
type MoveObject ¶
type MoveObject struct { Type MoveObjectType HasPublicTransfer bool Version SequenceNumber Contents []uint8 }
type MoveObjectType ¶
type MoveObjectType = MoveObjectType_
type MoveObjectType_ ¶
type MoveObjectType_ struct { Other *move_types.StructTag GasCoin *lib.EmptyEnum StakedSui *lib.EmptyEnum Coin *move_types.TypeTag }
func (MoveObjectType_) IsBcsEnum ¶
func (o MoveObjectType_) IsBcsEnum()
type MovePackage ¶
type MovePackage struct { Id ObjectID Version SequenceNumber ModuleMap map[string][]uint8 TypeOriginTable []TypeOrigin LinkageTable map[ObjectID]UpgradeInfo }
type Object ¶ added in v2.0.1
type Object struct { Data Data Owner Owner PreviousTransaction TransactionDigest StorageRebate uint64 }
type ObjectArg ¶
type ObjectArg struct { ImmOrOwnedObject *ObjectRef Id ObjectID InitialSharedVersion SequenceNumber Mutable bool } }
type ObjectDigest ¶
type ObjectDigest = Digest
type ObjectRef ¶
type ObjectRef struct { ObjectId ObjectID `json:"objectId"` Version SequenceNumber `json:"version"` Digest ObjectDigest `json:"digest"` }
ObjectRef for BCS, need to keep this order
type Owner ¶
type Owner struct { AddressOwner *SuiAddress `json:"AddressOwner"` ObjectOwner *SuiAddress `json:"ObjectOwner"` InitialSharedVersion SequenceNumber `json:"initial_shared_version"` } `json:"Shared,omitempty"` Immutable *lib.EmptyEnum `json:"Immutable,omitempty"` }
type Pay ¶
type Pay struct { Coins []*ObjectRef Recipients []*SuiAddress Amounts []*uint64 }
type PayAllSui ¶
type PayAllSui struct { Coins []*ObjectRef Recipient SuiAddress }
type ProgrammableMoveCall ¶
type ProgrammableMoveCall struct { Package ObjectID Module move_types.Identifier Function move_types.Identifier TypeArguments []move_types.TypeTag Arguments []Argument }
type ProgrammableTransaction ¶
type ProgrammableTransactionBuilder ¶
type ProgrammableTransactionBuilder struct { Inputs map[string]CallArg //maybe has hash clash InputsKeyOrder []BuilderArg Commands []Command }
func NewProgrammableTransactionBuilder ¶
func NewProgrammableTransactionBuilder() *ProgrammableTransactionBuilder
func (*ProgrammableTransactionBuilder) Command ¶
func (p *ProgrammableTransactionBuilder) Command(command Command) Argument
func (*ProgrammableTransactionBuilder) Finish ¶
func (p *ProgrammableTransactionBuilder) Finish() ProgrammableTransaction
func (*ProgrammableTransactionBuilder) ForceSeparatePure ¶
func (p *ProgrammableTransactionBuilder) ForceSeparatePure(value any) (Argument, error)
func (*ProgrammableTransactionBuilder) Input ¶
func (p *ProgrammableTransactionBuilder) Input(callArg CallArg) (Argument, error)
func (*ProgrammableTransactionBuilder) MakeObjList ¶
func (p *ProgrammableTransactionBuilder) MakeObjList(objs []ObjectArg) (Argument, error)
func (*ProgrammableTransactionBuilder) MoveCall ¶
func (p *ProgrammableTransactionBuilder) MoveCall( packageID ObjectID, module move_types.Identifier, function move_types.Identifier, typeArguments []move_types.TypeTag, callArgs []CallArg, ) error
func (*ProgrammableTransactionBuilder) Obj ¶
func (p *ProgrammableTransactionBuilder) Obj(objArg ObjectArg) (Argument, error)
func (*ProgrammableTransactionBuilder) Pay ¶
func (p *ProgrammableTransactionBuilder) Pay( coins []*ObjectRef, recipients []SuiAddress, amounts []uint64, ) error
func (*ProgrammableTransactionBuilder) PayAllSui ¶
func (p *ProgrammableTransactionBuilder) PayAllSui(recipient SuiAddress) error
func (*ProgrammableTransactionBuilder) PayMulInternal ¶
func (p *ProgrammableTransactionBuilder) PayMulInternal( recipients []SuiAddress, amounts []uint64, coin Argument, ) error
func (*ProgrammableTransactionBuilder) PaySui ¶
func (p *ProgrammableTransactionBuilder) PaySui( recipients []SuiAddress, amounts []uint64, ) error
func (*ProgrammableTransactionBuilder) Pure ¶
func (p *ProgrammableTransactionBuilder) Pure(value any) (Argument, error)
func (*ProgrammableTransactionBuilder) TransferObject ¶
func (p *ProgrammableTransactionBuilder) TransferObject( recipient SuiAddress, objectRefs []*ObjectRef, ) error
func (*ProgrammableTransactionBuilder) TransferSui ¶
func (p *ProgrammableTransactionBuilder) TransferSui(recipient SuiAddress, amount *uint64) error
type Secp256k1SuiSignature ¶
type Secp256k1SuiSignature struct {
Signature []byte //secp256k1.pubKey + Secp256k1Signature + 1
}
type Secp256r1SuiSignature ¶
type Secp256r1SuiSignature struct {
Signature []byte //secp256k1.pubKey + Secp256k1Signature + 1
}
type SequenceNumber ¶
type SequenceNumber = uint64
type Signature ¶
type Signature struct { *Ed25519SuiSignature *Secp256k1SuiSignature *Secp256r1SuiSignature }
func NewSignatureSecure ¶
func NewSignatureSecure[T IntentValue](value IntentMessage[T], secret crypto.Signer[Signature]) (Signature, error)
func (Signature) MarshalJSON ¶
func (*Signature) UnmarshalJSON ¶
type SignatureScheme ¶
type SignatureScheme struct { ED25519 *lib.EmptyEnum Secp256k1 *lib.EmptyEnum Secp256r1 *lib.EmptyEnum MultiSig *lib.EmptyEnum BLS12381 *lib.EmptyEnum }
func NewSignatureScheme ¶
func NewSignatureScheme(flag byte) (SignatureScheme, error)
func (*SignatureScheme) Flag ¶
func (s *SignatureScheme) Flag() byte
type SingleTransactionKind ¶
type SingleTransactionKind struct { TransferObject *TransferObject Publish *MoveModulePublish Call *MoveCall TransferSui *TransferSui Pay *Pay PaySui *PaySui PayAllSui *PayAllSui ChangeEpoch *ChangeEpoch Genesis *GenesisTransaction }
func (SingleTransactionKind) IsBcsEnum ¶
func (s SingleTransactionKind) IsBcsEnum()
type SuiAddress ¶
type SuiAddress = move_types.AccountAddress
func NewAddressFromHex ¶
func NewAddressFromHex(str string) (*SuiAddress, error)
type SuiKeyPair ¶
type SuiKeyPair struct { Ed25519 *crypto.Ed25519KeyPair //Secp256k1 *Secp256k1KeyPair //Secp256r1 *Secp256r1KeyPair SignatureScheme }
func NewSuiKeyPair ¶
func NewSuiKeyPair(scheme SignatureScheme, seed []byte) SuiKeyPair
func (*SuiKeyPair) PrivateKey ¶
func (s *SuiKeyPair) PrivateKey() []byte
func (*SuiKeyPair) PublicKey ¶
func (s *SuiKeyPair) PublicKey() []byte
func (*SuiKeyPair) Sign ¶
func (s *SuiKeyPair) Sign(msg []byte) Signature
type TransactionData ¶
type TransactionData struct {
V1 *TransactionDataV1
}
func NewProgrammable ¶
func NewProgrammable( sender SuiAddress, gasPayment []*ObjectRef, pt ProgrammableTransaction, gasBudget uint64, gasPrice uint64, ) TransactionData
func NewProgrammableAllowSponsor ¶
func NewProgrammableAllowSponsor( sender SuiAddress, gasPayment []*ObjectRef, pt ProgrammableTransaction, gasBudge, gasPrice uint64, sponsor SuiAddress, ) TransactionData
func (TransactionData) IsBcsEnum ¶
func (t TransactionData) IsBcsEnum()
type TransactionDataV1 ¶
type TransactionDataV1 struct { Kind TransactionKind Sender SuiAddress GasData GasData Expiration TransactionExpiration }
type TransactionDigest ¶
type TransactionDigest = Digest
type TransactionEffectsDigest ¶
type TransactionEffectsDigest = Digest
type TransactionEventsDigest ¶
type TransactionEventsDigest = Digest
type TransactionExpiration ¶
func (TransactionExpiration) IsBcsEnum ¶
func (t TransactionExpiration) IsBcsEnum()
type TransactionKind ¶
type TransactionKind struct { ProgrammableTransaction *ProgrammableTransaction ChangeEpoch *ChangeEpoch Genesis *GenesisTransaction ConsensusCommitPrologue *ConsensusCommitPrologue }
func (TransactionKind) IsBcsEnum ¶
func (t TransactionKind) IsBcsEnum()
type TransferObject ¶
type TransferObject struct { Recipient SuiAddress ObjectRef ObjectRef }
type TransferSui ¶
type TransferSui struct { Recipient SuiAddress Amount *uint64 `bcs:"optional"` }
type TypeOrigin ¶
type UpgradeInfo ¶
type UpgradeInfo struct { UpgradedId ObjectID UpgradedVersion SequenceNumber }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.