models

package
v0.0.0-...-9a5201c Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RawTransactionSalt = sha3.Sum256([]byte("APTOS::RawTransaction"))

"0xb5e97db07fa0bd0e5598aa3643a9bc6f6693bddc1a9fec9e674a461eaa00b193"

View Source
var RawTransactionWithDataSalt = sha3.Sum256([]byte("APTOS::RawTransactionWithData"))

"0x5efa3c4f02f83a0f4b2d69fc95c607cc02825cc4e7be536ef0992df050d9e67c"

View Source
var TransactionSalt = sha3.Sum256([]byte("APTOS::Transaction"))

Functions

This section is empty.

Types

type AccountAddress

type AccountAddress [32]byte

func HexToAccountAddress

func HexToAccountAddress(addr string) (AccountAddress, error)

func (AccountAddress) PrefixZeroTrimmedHex

func (addr AccountAddress) PrefixZeroTrimmedHex() string

func (AccountAddress) ToHex

func (addr AccountAddress) ToHex() string

type AccountAuthenticator

type AccountAuthenticator interface{}

type AccountAuthenticatorEd25519

type AccountAuthenticatorEd25519 struct {
	PublicKey
	Signature
}

type AccountAuthenticatorMultiEd25519

type AccountAuthenticatorMultiEd25519 struct {
	PublicKeyBytes []byte      // for BCS serialization; p1_bytes | ... | pn_bytes | threshold
	SignatureBytes []byte      // for BCS serialization; s1_bytes | ... | sn_bytes | bitmap
	PublicKeys     []PublicKey `lcs:"-"`
	Threshold      uint8       `lcs:"-"`
	Signatures     []Signature `lcs:"-"`
	Bitmap         [4]byte     `lcs:"-"`
}

func (AccountAuthenticatorMultiEd25519) SetBytes

type Change

type Change struct {
	Type         string `json:"type"`
	StateKeyHash string `json:"state_key_hash"`
	Address      string `json:"address"`
	Module       string `json:"module"`
	Resource     string `json:"resource"`
	Data         struct {
		Handle   string                 `json:"handle"`
		Key      string                 `json:"key"`
		Value    string                 `json:"value"`
		Bytecode string                 `json:"bytecode"`
		ABI      interface{}            `json:"abi"`
		Type     string                 `json:"type"`
		Data     map[string]interface{} `json:"data"`
	} `json:"data"`
}

type Code

type Code struct {
	Bytecode string      `json:"bytecode"`
	ABI      interface{} `json:"abi,omitempty"`
}

type CollectionData

type CollectionData struct {
	Name         string                     `json:"name"`
	Description  string                     `json:"description"`
	URI          string                     `json:"uri"`
	Maximum      Uint64                     `json:"maximum"`
	Supply       Uint64                     `json:"supply"`
	MutateConfig CollectionMutabilityConfig `json:"mutability_config"`
}

type CollectionMutabilityConfig

type CollectionMutabilityConfig struct {
	Description bool `json:"description"`
	URI         bool `json:"uri"`
	Maximum     bool `jons:"maximum"`
}

type ED25519Signature

type ED25519Signature struct {
	PublicKey string `json:"public_key"`
	Signature string `json:"signature"`
}

type EntryFunctionPayload

type EntryFunctionPayload struct {
	Module
	Function      string
	TypeArguments []TypeTag
	ArgumentsBCS  [][]byte
	Arguments     []interface{} `lcs:"-"`
}

type Event

type Event struct {
	Version Uint64 `json:"version"`
	GUID    struct {
		CreationNumber Uint64 `json:"creation_number"`
		AccountAddress string `json:"account_address"`
	} `json:"guid"`
	SequenceNumber Uint64                 `json:"sequence_number"`
	Type           string                 `json:"type"`
	Data           map[string]interface{} `json:"data"`
}

type JSONPayload

type JSONPayload struct {
	Type          string        `json:"type"`
	TypeArguments []string      `json:"type_arguments"`
	Arguments     []interface{} `json:"arguments"`

	// ScriptPayload
	Code Code `json:"code,omitempty"`
	// ModuleBundlePayload
	Modules []Code `json:"modules,omitempty"`
	// EntryFunctionPayload
	Function string `json:"function,omitempty"`
}

type JSONSignature

type JSONSignature struct {
	Type string `json:"type"`
	ED25519Signature
	MultiED25519Signature
	MultiAgentSignature
}

type JSONSigner

type JSONSigner struct {
	Type string `json:"type"`
	ED25519Signature
	MultiED25519Signature
}

type Module

type Module struct {
	Address AccountAddress
	Name    string
}

type ModuleBundlePayload

type ModuleBundlePayload struct {
	Modules []struct {
		Code []byte
	}
}

type MultiAgent

type MultiAgent struct {
	RawTransaction
	SecondarySigners []AccountAddress
}

type MultiAgentSignature

type MultiAgentSignature struct {
	Sender                   JSONSigner   `json:"sender"`
	SecondarySignerAddresses []string     `json:"secondary_signer_addresses"`
	SecondarySigners         []JSONSigner `json:"secondary_signers"`
}

type MultiED25519Signature

type MultiED25519Signature struct {
	PublicKeys []string `json:"public_keys"`
	Signatures []string `json:"signatures"`
	Threshold  uint8    `json:"threshold"`
	Bitmap     string   `json:"bitmap"`
}

type PrivateKey

type PrivateKey = ed25519.PrivateKey

type PropertyMap

type PropertyMap struct {
	Map SimpleMap `json:"map"`
}

type PropertyValue

type PropertyValue struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type PublicKey

type PublicKey = ed25519.PublicKey

type RawTransaction

type RawTransaction struct {
	Sender                  AccountAddress
	SequenceNumber          uint64
	Payload                 TransactionPayload
	MaxGasAmount            uint64
	GasUnitPrice            uint64
	ExpirationTimestampSecs uint64
	ChainID                 uint8
}

type RawTransactionWithData

type RawTransactionWithData interface{}

type ScriptPayload

type ScriptPayload struct {
	Code          []byte
	TypeArguments []TypeTag
	Arguments     []TransactionArgument
}

type Signature

type Signature []byte

type Signer

type Signer interface {
	Sign(tx *Transaction) *Transaction
}

type SimpleMap

type SimpleMap struct {
	Data []struct {
		Key   string        `json:"key"`
		Value PropertyValue `json:"value"`
	} `json:"data"`
}

type SingleSigner

type SingleSigner struct {
	PrivateKey
	PublicKey
	AccountAddress
}

func NewSingleSigner

func NewSingleSigner(priv PrivateKey) SingleSigner

func (*SingleSigner) Sign

func (s *SingleSigner) Sign(tx *Transaction) *Transaction

type Token

type Token struct {
	ID              TokenID           `json:"id"`
	Amount          Uint64            `json:"amount"`
	TokenProperties PropertyMap       `json:"token_properties"`
	JSONProperties  map[string]string `json:"-"`
}

type TokenData

type TokenData struct {
	Collection   string                `json:"collection"`
	Description  string                `json:"description"`
	Name         string                `json:"name"`
	Maximum      Uint64                `json:"maximum"`
	Supply       Uint64                `json:"supply"`
	URI          string                `json:"uri"`
	MutateConfig TokenMutabilityConfig `json:"mutability_config"`
}

type TokenDataID

type TokenDataID struct {
	Hash       string `json:"hash"`
	Creator    string `json:"creator"`
	Collection string `json:"collection"`
	Name       string `json:"name"`
}

type TokenDepositEvent

type TokenDepositEvent struct {
	ID     TokenID `json:"id"`
	Amount string  `json:"amount"`
}

type TokenID

type TokenID struct {
	TokenDataID     `json:"token_data_id"`
	PropertyVersion Uint64 `json:"property_version"`
}

type TokenMutabilityConfig

type TokenMutabilityConfig struct {
	Maximum     bool `json:"maximum"`
	URI         bool `json:"uri"`
	Description bool `json:"description"`
	Royalty     bool `json:"royalty"`
	Properties  bool `json:"properties"`
}

type TokenV2

type TokenV2 struct {
	ID                string  `json:"id"`
	Name              string  `json:"name"`
	Description       string  `json:"description"`
	URI               string  `json:"uri"`
	Standard          string  `json:"standard"`
	OwnerAddress      string  `json:"owner_address"`
	Amount            Uint64  `json:"amount"`
	CollectionName    string  `json:"collection_name"`
	CreatorAddress    string  `json:"creator_address"`
	Maximum           *Uint64 `json:"maximum"`
	Supply            Uint64  `json:"supply"`
	PropertyVersionV1 Uint64  `json:"property_version_v1"`
	IsSoulboundV2     bool    `json:"is_soulbound_v2"`
}

type Transaction

type Transaction struct {
	UserTransaction
	// contains filtered or unexported fields
}

func (*Transaction) DecodeFromFullRawTxHex

func (t *Transaction) DecodeFromFullRawTxHex(s string) error

func (*Transaction) DecodeFromSigningMessageHex

func (t *Transaction) DecodeFromSigningMessageHex(s string) error

func (Transaction) Error

func (t Transaction) Error() error

func (*Transaction) GetFullRawTx

func (t *Transaction) GetFullRawTx() ([]byte, error)

func (*Transaction) GetHash

func (t *Transaction) GetHash() (string, error)

func (*Transaction) GetSigningMessage

func (t *Transaction) GetSigningMessage() ([]byte, error)

func (*Transaction) SetAuthenticator

func (t *Transaction) SetAuthenticator(txAuth TransactionAuthenticator) *Transaction

func (*Transaction) SetAuthenticatorForSimulate

func (t *Transaction) SetAuthenticatorForSimulate(txAuth TransactionAuthenticator) *Transaction

func (*Transaction) SetChainID

func (t *Transaction) SetChainID(chainID uint8) *Transaction

func (*Transaction) SetExpirationTimestampSecs

func (t *Transaction) SetExpirationTimestampSecs(expirationTimestampSecs interface{}) *Transaction

func (*Transaction) SetGasUnitPrice

func (t *Transaction) SetGasUnitPrice(gasUnitPrice interface{}) *Transaction

func (*Transaction) SetMaxGasAmount

func (t *Transaction) SetMaxGasAmount(maxGasAmount interface{}) *Transaction

func (*Transaction) SetPayload

func (t *Transaction) SetPayload(payload TransactionPayload) *Transaction

func (*Transaction) SetSecondarySigners

func (t *Transaction) SetSecondarySigners(secondarySigners []AccountAddress) *Transaction

func (*Transaction) SetSender

func (t *Transaction) SetSender(sender string) *Transaction

func (*Transaction) SetSequenceNumber

func (t *Transaction) SetSequenceNumber(seq interface{}) *Transaction

type TransactionArgument

type TransactionArgument interface {
	ToString() string
}

type TransactionAuthenticator

type TransactionAuthenticator interface{}

type TransactionAuthenticatorEd25519

type TransactionAuthenticatorEd25519 struct {
	PublicKey
	Signature
}

type TransactionAuthenticatorMultiAgent

type TransactionAuthenticatorMultiAgent struct {
	Sender                   AccountAuthenticator
	SecondarySignerAddresses []AccountAddress
	SecondarySigners         []AccountAuthenticator
}

type TransactionAuthenticatorMultiEd25519

type TransactionAuthenticatorMultiEd25519 struct {
	PublicKeyBytes []byte      // for BCS serialization; p1_bytes | ... | pn_bytes | threshold
	SignatureBytes []byte      // for BCS serialization; s1_bytes | ... | sn_bytes | bitmap
	PublicKeys     []PublicKey `lcs:"-"`
	Threshold      uint8       `lcs:"-"`
	Signatures     []Signature `lcs:"-"`
	Bitmap         [4]byte     `lcs:"-"`
}

func (TransactionAuthenticatorMultiEd25519) SetBytes

type TransactionEnum

type TransactionEnum interface{}

type TransactionPayload

type TransactionPayload interface{}

type TxArgAddress

type TxArgAddress struct {
	Addr AccountAddress
}

func (TxArgAddress) ToString

func (t TxArgAddress) ToString() string

type TxArgBool

type TxArgBool struct {
	Bool bool
}

func (TxArgBool) ToString

func (t TxArgBool) ToString() string

type TxArgU128

type TxArgU128 struct {
	// BCS layout for "uint128": 16 bytes.
	// Binary format in little-endian representation.
	// For example,
	// 18446744073709551615 = max uint64 	 = [ff, ff, ff, ff, ff, ff, ff, ff, 00, 00, 00, 00, 00, 00, 00, 00]
	// 18446744073709551618 = max uint64 + 3 = [02, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00]
	Lower, Higher uint64
}

func (TxArgU128) ToString

func (t TxArgU128) ToString() string

type TxArgU64

type TxArgU64 struct {
	U64 uint64
}

func (TxArgU64) ToString

func (t TxArgU64) ToString() string

type TxArgU8

type TxArgU8 struct {
	U8 uint8
}

func (TxArgU8) ToString

func (t TxArgU8) ToString() string

type TxArgU8Vector

type TxArgU8Vector struct {
	Bytes []byte
}

func TxArgString

func TxArgString(s string) TxArgU8Vector

func (TxArgU8Vector) ToString

func (t TxArgU8Vector) ToString() string

type TypeTag

type TypeTag interface {
	ToString() string
}

type TypeTagAddress

type TypeTagAddress struct{}

func (TypeTagAddress) ToString

func (t TypeTagAddress) ToString() string

type TypeTagBool

type TypeTagBool struct{}

func (TypeTagBool) ToString

func (t TypeTagBool) ToString() string

type TypeTagSigner

type TypeTagSigner struct{}

func (TypeTagSigner) ToString

func (t TypeTagSigner) ToString() string

type TypeTagStruct

type TypeTagStruct struct {
	Address    AccountAddress
	Module     string
	Name       string
	TypeParams []TypeTag
}

func (TypeTagStruct) ToString

func (t TypeTagStruct) ToString() string

type TypeTagU128

type TypeTagU128 struct{}

func (TypeTagU128) ToString

func (t TypeTagU128) ToString() string

type TypeTagU64

type TypeTagU64 struct{}

func (TypeTagU64) ToString

func (t TypeTagU64) ToString() string

type TypeTagU8

type TypeTagU8 struct{}

func (TypeTagU8) ToString

func (t TypeTagU8) ToString() string

type TypeTagVector

type TypeTagVector struct {
	TypeTag
}

func (TypeTagVector) ToString

func (t TypeTagVector) ToString() string

type Uint64

type Uint64 uint64

Uint64 represents a uint64 value for JSON string format.

func (Uint64) MarshalJSON

func (u Uint64) MarshalJSON() ([]byte, error)

func (*Uint64) UnmarshalJSON

func (u *Uint64) UnmarshalJSON(b []byte) error

type UserTransaction

type UserTransaction struct {
	RawTransaction
	Authenticator    TransactionAuthenticator
	SecondarySigners []AccountAddress `lcs:"-"`
}

func (UserTransaction) ForSimulate

func (tx UserTransaction) ForSimulate() UserTransaction

func (UserTransaction) GetRawTransactionWithData

func (tx UserTransaction) GetRawTransactionWithData() RawTransactionWithData

Jump to

Keyboard shortcuts

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