Documentation
¶
Index ¶
- Constants
- Variables
- func UseDefaultHash(signable Signable) []byte
- type AppId
- type Argument
- type BcsSignable
- type BcsSignableKind
- type BfcAddress
- type BfcKeyPair
- 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 Ed25519BfcSignature
- 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 PayAllBfc
- type PayBfc
- 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 []BfcAddress, amounts []uint64) error
- func (p *ProgrammableTransactionBuilder) PayAllBFC(recipient BfcAddress) error
- func (p *ProgrammableTransactionBuilder) PayBFC(recipients []BfcAddress, amounts []uint64) error
- func (p *ProgrammableTransactionBuilder) PayMulInternal(recipients []BfcAddress, amounts []uint64, coin Argument) error
- func (p *ProgrammableTransactionBuilder) Pure(value any) (Argument, error)
- func (p *ProgrammableTransactionBuilder) PureCallArg(value any) (CallArg, error)
- func (p *ProgrammableTransactionBuilder) SharedObjCallArg(address string, version uint64) (CallArg, error)
- func (p *ProgrammableTransactionBuilder) TransferBFC(recipient BfcAddress, amount *uint64) error
- func (p *ProgrammableTransactionBuilder) TransferObject(recipient BfcAddress, objectRefs []*ObjectRef) error
- type Secp256k1BfcSignature
- type Secp256r1BfcSignature
- type SequenceNumber
- type SharedObject
- type Signable
- type Signature
- type SignatureScheme
- type SingleTransactionKind
- type TransactionData
- type TransactionDataV1
- type TransactionDigest
- type TransactionEffectsDigest
- type TransactionEventsDigest
- type TransactionExpiration
- type TransactionKind
- type TransferBfc
- type TransferObject
- type TypeOrigin
- type UpgradeInfo
Constants ¶
View Source
const ( StakingPoolModuleName = move_types.Identifier("staking_pool") StakedBfcStructName = move_types.Identifier("StakedBfc") 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: &SharedObject{ Id: *SuiSystemStateObjectId, InitialSharedVersion: SuiSystemStateObjectSharedVersion, Mutable: true, }, } BenfenSystemMut = CallArg{ Object: &BenfenSystemMutObj, } BenfenSystemMutObj = ObjectArg{ SharedObject: &SharedObject{ Id: *BenfenSystemStateObjectId, InitialSharedVersion: BenfenSystemStateObjectSharedVersion, Mutable: true, }, } )
View Source
var (
SuiSystemAddress, _ = NewAddressFromHex("0x3")
SuiSystemPackageId = SuiSystemAddress
SuiSystemStateObjectId, _ = NewObjectIdFromHex("0x5")
BenfenSystemStateObjectId, _ = NewObjectIdFromHex("0xc9")
)
Functions ¶
func UseDefaultHash ¶
Types ¶
type Argument ¶
type BcsSignable ¶
type BcsSignable[K BcsSignableKind] struct { Data K }
func (BcsSignable[K]) Write ¶
func (s BcsSignable[K]) Write(digest hash.Hash)
type BcsSignableKind ¶
type BcsSignableKind interface {
TransactionData | Object
}
type BfcAddress ¶
type BfcAddress = move_types.AccountAddress
func NewAddressFromHex ¶
func NewAddressFromHex(str string) (*BfcAddress, error)
type BfcKeyPair ¶
type BfcKeyPair struct {
Ed25519 *crypto.Ed25519KeyPair
//Secp256k1 *Secp256k1KeyPair
//Secp256r1 *Secp256r1KeyPair
SignatureScheme
}
func NewBfcKeyPair ¶
func NewBfcKeyPair(scheme SignatureScheme, seed []byte) BfcKeyPair
func (*BfcKeyPair) PrivateKey ¶
func (s *BfcKeyPair) PrivateKey() []byte
func (*BfcKeyPair) PublicKey ¶
func (s *BfcKeyPair) PublicKey() []byte
func (*BfcKeyPair) Sign ¶
func (s *BfcKeyPair) Sign(msg []byte) Signature
type BuilderArg ¶
func (BuilderArg) String ¶
func (b BuilderArg) String() string
type CertificateDigest ¶
type CertificateDigest = Digest
type ChangeEpoch ¶
type ChangeEpoch struct {
Epoch EpochId
ProtocolVersion bfc_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 ¶
func NewDefaultHash ¶
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 Ed25519BfcSignature ¶
type Ed25519BfcSignature struct {
Signature [ed25519.PublicKeySize + ed25519.SignatureSize + 1]byte
}
func NewEd25519BfcSignature ¶
func NewEd25519BfcSignature(keyPair crypto.KeyPair, message []byte) *Ed25519BfcSignature
type GasData ¶
type GasData struct {
Payment []*ObjectRef
Owner BfcAddress
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
MarshalBCS() ([]byte, error)
}
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 ¶
type Object struct {
Data Data
Owner Owner
PreviousTransaction TransactionDigest
StorageRebate uint64
}
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 *BfcAddress `json:"AddressOwner"`
ObjectOwner *BfcAddress `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 []*BfcAddress
Amounts []*uint64
}
type PayAllBfc ¶
type PayAllBfc struct {
Coins []*ObjectRef
Recipient BfcAddress
}
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 []BfcAddress, amounts []uint64, ) error
func (*ProgrammableTransactionBuilder) PayAllBFC ¶
func (p *ProgrammableTransactionBuilder) PayAllBFC(recipient BfcAddress) error
func (*ProgrammableTransactionBuilder) PayBFC ¶
func (p *ProgrammableTransactionBuilder) PayBFC( recipients []BfcAddress, amounts []uint64, ) error
func (*ProgrammableTransactionBuilder) PayMulInternal ¶
func (p *ProgrammableTransactionBuilder) PayMulInternal( recipients []BfcAddress, amounts []uint64, coin Argument, ) error
func (*ProgrammableTransactionBuilder) Pure ¶
func (p *ProgrammableTransactionBuilder) Pure(value any) (Argument, error)
func (*ProgrammableTransactionBuilder) PureCallArg ¶
func (p *ProgrammableTransactionBuilder) PureCallArg(value any) (CallArg, error)
func (*ProgrammableTransactionBuilder) SharedObjCallArg ¶
func (p *ProgrammableTransactionBuilder) SharedObjCallArg(address string, version uint64) (CallArg, error)
func (*ProgrammableTransactionBuilder) TransferBFC ¶
func (p *ProgrammableTransactionBuilder) TransferBFC(recipient BfcAddress, amount *uint64) error
func (*ProgrammableTransactionBuilder) TransferObject ¶
func (p *ProgrammableTransactionBuilder) TransferObject( recipient BfcAddress, objectRefs []*ObjectRef, ) error
type Secp256k1BfcSignature ¶
type Secp256k1BfcSignature struct {
Signature []byte //secp256k1.pubKey + Secp256k1Signature + 1
}
type Secp256r1BfcSignature ¶
type Secp256r1BfcSignature struct {
Signature []byte //secp256k1.pubKey + Secp256k1Signature + 1
}
type SequenceNumber ¶
type SequenceNumber = uint64
type SharedObject ¶
type SharedObject struct {
}
type Signature ¶
type Signature struct {
*Ed25519BfcSignature
*Secp256k1BfcSignature
*Secp256r1BfcSignature
}
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
TransferBfc *TransferBfc
Pay *Pay
PayBfc *PayBfc
PayAllBfc *PayAllBfc
ChangeEpoch *ChangeEpoch
Genesis *GenesisTransaction
}
func (SingleTransactionKind) IsBcsEnum ¶
func (s SingleTransactionKind) IsBcsEnum()
type TransactionData ¶
type TransactionData struct {
V1 *TransactionDataV1
}
func NewProgrammable ¶
func NewProgrammable( sender BfcAddress, gasPayment []*ObjectRef, pt ProgrammableTransaction, gasBudget uint64, gasPrice uint64, ) TransactionData
func NewProgrammableAllowSponsor ¶
func NewProgrammableAllowSponsor( sender BfcAddress, gasPayment []*ObjectRef, pt ProgrammableTransaction, gasBudge, gasPrice uint64, sponsor BfcAddress, ) TransactionData
func (TransactionData) IsBcsEnum ¶
func (t TransactionData) IsBcsEnum()
type TransactionDataV1 ¶
type TransactionDataV1 struct {
Kind TransactionKind
Sender BfcAddress
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 TransferBfc ¶
type TransferBfc struct {
Recipient BfcAddress
Amount *uint64 `bcs:"optional"`
}
type TransferObject ¶
type TransferObject struct {
Recipient BfcAddress
ObjectRef ObjectRef
}
type TypeOrigin ¶
type UpgradeInfo ¶
type UpgradeInfo struct {
UpgradedId ObjectID
UpgradedVersion SequenceNumber
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.