types

package
v0.0.0-...-10f9118 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionStatusSuccess = "success"
	TransactionStatusFailure = "failure"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address = HexData

func NewAddressFromHex

func NewAddressFromHex(addr string) (*Address, error)

*

  • Creates Address from a hex string.
  • @param addr Hex string can be with a prefix or without a prefix,
  • e.g. '0x1aa' or '1aa'. Hex string will be left padded with 0s if too short.

func (Address) ShortString

func (a Address) ShortString() string

Returns the address with leading zeros trimmed, e.g. 0x2

type Base64Data

type Base64Data struct {
	// contains filtered or unexported fields
}

func NewBase64Data

func NewBase64Data(str string) (*Base64Data, error)

func (Base64Data) Data

func (h Base64Data) Data() []byte

func (Base64Data) Length

func (h Base64Data) Length() int

func (Base64Data) MarshalJSON

func (h Base64Data) MarshalJSON() ([]byte, error)

func (Base64Data) String

func (h Base64Data) String() string

func (*Base64Data) UnmarshalJSON

func (h *Base64Data) UnmarshalJSON(data []byte) error

type Bytes

type Bytes []byte

func (Bytes) GetBase64Data

func (b Bytes) GetBase64Data() Base64Data

func (Bytes) GetHexData

func (b Bytes) GetHexData() HexData

type BytesData

type BytesData interface {
	Data() []byte
	Length() int
	String() string
}

type CertifiedTransaction

type CertifiedTransaction = TransactionEnvelope

type ChangeEpoch

type ChangeEpoch struct {
	Epoch             interface{} `json:"epoch"`
	StorageCharge     uint64      `json:"storage_charge"`
	ComputationCharge uint64      `json:"computation_charge"`
}

type Coin

type Coin struct {
	Balance             uint64       `json:"balance"`
	Type                string       `json:"type"`
	Owner               *ObjectOwner `json:"owner"`
	PreviousTransaction *Digest      `json:"previousTransaction"`
	Reference           *ObjectRef   `json:"reference"`
}

type Coins

type Coins []Coin

func (Coins) TotalBalance

func (cs Coins) TotalBalance() *big.Int

type Digest

type Digest = Base64Data

type Event

type Event interface{}

type GasCostSummary

type GasCostSummary struct {
	ComputationCost uint64 `json:"computationCost"`
	StorageCost     uint64 `json:"storageCost"`
	StorageRebate   uint64 `json:"storageRebate"`
}

type HexData

type HexData struct {
	// contains filtered or unexported fields
}

func NewHexData

func NewHexData(str string) (*HexData, error)

func (HexData) Data

func (h HexData) Data() []byte

func (HexData) Length

func (h HexData) Length() int

func (HexData) MarshalJSON

func (h HexData) MarshalJSON() ([]byte, error)

func (HexData) String

func (h HexData) String() string

func (*HexData) UnmarshalJSON

func (h *HexData) UnmarshalJSON(data []byte) error

type InputObjectKind

type InputObjectKind map[string]interface{}

type ModulePublish

type ModulePublish struct {
	Modules [][]byte `json:"modules"`
}

type MoveCall

type MoveCall struct {
	Package  ObjectRef     `json:"package"`
	Module   string        `json:"module"`
	Function string        `json:"function"`
	TypeArgs []interface{} `json:"type_arguments"`
	Args     []interface{} `json:"arguments"`
}

type ObjectId

type ObjectId = HexData

type ObjectInfo

type ObjectInfo struct {
	ObjectId *ObjectId    `json:"objectId"`
	Version  int          `json:"version"`
	Digest   *Digest      `json:"digest"`
	Type     string       `json:"type"`
	Owner    *ObjectOwner `json:"owner"`

	PreviousTransaction *Digest `json:"previousTransaction"`
}

type ObjectOwner

type ObjectOwner struct {
	AddressOwner *Address `json:"AddressOwner,omitempty"`
	ObjectOwner  *Address `json:"ObjectOwner,omitempty"`
	SingleOwner  *Address `json:"SingleOwner,omitempty"`
}

type ObjectRead

type ObjectRead struct {
	Details *ObjectReadDetail `json:"details"`
	Status  ObjectStatus      `json:"status"`
}

type ObjectReadDetail

type ObjectReadDetail struct {
	Data  map[string]interface{} `json:"data"`
	Owner *ObjectOwner           `json:"owner"`

	PreviousTransaction *Digest    `json:"previousTransaction"`
	StorageRebate       int        `json:"storageRebate"`
	Reference           *ObjectRef `json:"reference"`
}

type ObjectRef

type ObjectRef struct {
	Digest   Digest   `json:"digest"`
	ObjectId ObjectId `json:"objectId"`
	Version  int      `json:"version"`
}

type ObjectStatus

type ObjectStatus string
const (
	ObjectStatusExists    ObjectStatus = "Exists"
	ObjectStatusNotExists ObjectStatus = "NotExists"
	ObjectStatusDeleted   ObjectStatus = "Deleted"
)

type OwnedObjectRef

type OwnedObjectRef struct {
	Owner     *ObjectOwner `json:"owner"`
	Reference *ObjectRef   `json:"reference"`
}

type ParsedTransactionResponse

type ParsedTransactionResponse interface{}

type ResourceType

type ResourceType struct {
	Address    *Address
	ModuleName string
	FuncName   string

	SubType *ResourceType
}

func NewResourceType

func NewResourceType(str string) (*ResourceType, error)

func (*ResourceType) ShortString

func (t *ResourceType) ShortString() string

func (*ResourceType) String

func (t *ResourceType) String() string

type SenderSignedData

type SenderSignedData struct {
	Transactions []SingleTransactionKind `json:"transactions,omitempty"`

	Sender     *Address   `json:"sender"`
	GasPayment *ObjectRef `json:"gasPayment"`
	GasBudget  uint64     `json:"gasBudget"`
}

type SignatureScheme

type SignatureScheme string
const (
	SignatureSchemeEd25519   SignatureScheme = "ED25519"
	SignatureSchemeSecp256k1 SignatureScheme = "Secp256k1"
)

type SignedTransaction

type SignedTransaction struct {
	// transaction data bytes
	TxBytes *Base64Data `json:"tx_bytes"`

	// Flag of the signature scheme that is used.
	SigScheme SignatureScheme `json:"sig_scheme"`

	// transaction signature
	Signature *Base64Data `json:"signature"`

	// signer's public key
	PublicKey *Base64Data `json:"pub_key"`
	Mode      string      `json:"mode"`
}

type SingleTransactionKind

type SingleTransactionKind struct {
	TransferObject *TransferObject `json:"TransferObject,omitempty"`
	Publish        *ModulePublish  `json:"Publish,omitempty"`
	Call           *MoveCall       `json:"Call,omitempty"`
	TransferSui    *TransferSui    `json:"TransferSui,omitempty"`
	ChangeEpoch    *ChangeEpoch    `json:"ChangeEpoch,omitempty"`
}

type TransactionBytes

type TransactionBytes struct {
	// the gas object to be used
	Gas ObjectRef `json:"gas"`

	// objects to be used in this transaction
	InputObjects []InputObjectKind `json:"inputObjects"`

	// transaction data bytes
	TxBytes Base64Data `json:"txBytes"`
}

func (*TransactionBytes) SignWith

func (txn *TransactionBytes) SignWith(privateKey ed25519.PrivateKey) *SignedTransaction

type TransactionEffects

type TransactionEffects struct {
	Status TransactionStatus `json:"status"`

	TransactionDigest *Base64Data     `json:"transactionDigest"`
	GasUsed           *GasCostSummary `json:"gasUsed"`
	GasObject         *OwnedObjectRef `json:"gasObject"`
	Events            []Event         `json:"events,omitempty"`
	Dependencies      []Digest        `json:"dependencies,omitempty"`

	// SharedObjects []ObjectRef      `json:"sharedObjects"`
	Created   []OwnedObjectRef `json:"created,omitempty"`
	Mutated   []OwnedObjectRef `json:"mutated,omitempty"`
	Unwrapped []OwnedObjectRef `json:"unwrapped,omitempty"`
	Deleted   []ObjectRef      `json:"deleted,omitempty"`
	Wrapped   []ObjectRef      `json:"wrapped,omitempty"`
}

func (*TransactionEffects) GasFee

func (te *TransactionEffects) GasFee() uint64

type TransactionEnvelope

type TransactionEnvelope struct {
	TransactionDigest *Digest `json:"transactionDigest"`

	Data *SenderSignedData `json:"data"`

	TxSignature *Base64Data `json:"txSignature"`

	AuthSignInfo interface{} `json:"authSignInfo"`
}

type TransactionResponse

type TransactionResponse struct {
	Certificate *CertifiedTransaction     `json:"certificate"`
	Effects     *TransactionEffects       `json:"effects"`
	ParsedData  ParsedTransactionResponse `json:"parsed_data,omitempty"`
	TimestampMs uint64                    `json:"timestamp_ms,omitempty"`
}

type TransactionResponseV2

type TransactionResponseV2 struct {
	EffectsCert TransactionResponse `json:"effectsCert"`
}

type TransactionStatus

type TransactionStatus struct {
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

type TransferObject

type TransferObject struct {
	Recipient Address   `json:"recipient"`
	ObjectRef ObjectRef `json:"object_ref"`
}

type TransferSui

type TransferSui struct {
	Recipient Address `json:"recipient"`
	Amount    uint64  `json:"amount"`
}

Jump to

Keyboard shortcuts

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