model

package
v0.4.37 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package model defines generic datatypes for Flow blockchain data.

Index

Constants

This section is empty.

Variables

View Source
var (
	Network_name = map[int32]string{
		0: "UNSPECIFIED_NETWORK",
		1: "MAINNET",
		2: "TESTNET",
		3: "PREVIEWNET",
	}
	Network_value = map[string]int32{
		"UNSPECIFIED_NETWORK": 0,
		"MAINNET":             1,
		"TESTNET":             2,
		"PREVIEWNET":          3,
	}
)

Enum value maps for Network.

View Source
var (
	OperationType_name = map[int32]string{
		0: "OPERATION_TYPE_UNSPECIFIED",
		1: "CREATE_ACCOUNT",
		2: "FEE",
		3: "PROXY_TRANSFER",
		4: "TRANSFER",
	}
	OperationType_value = map[string]int32{
		"OPERATION_TYPE_UNSPECIFIED": 0,
		"CREATE_ACCOUNT":             1,
		"FEE":                        2,
		"PROXY_TRANSFER":             3,
		"TRANSFER":                   4,
	}
)

Enum value maps for OperationType.

View Source
var (
	TransferType_name = map[int32]string{
		0: "TRANSFER_TYPE_UNSPECIFIED",
		1: "DEPOSIT",
		3: "FEE_DEPOSIT",
		4: "PROXY_DEPOSIT",
		5: "PROXY_WITHDRAWAL",
		2: "WITHDRAWAL",
	}
	TransferType_value = map[string]int32{
		"TRANSFER_TYPE_UNSPECIFIED": 0,
		"DEPOSIT":                   1,
		"FEE_DEPOSIT":               3,
		"PROXY_DEPOSIT":             4,
		"PROXY_WITHDRAWAL":          5,
		"WITHDRAWAL":                2,
	}
)

Enum value maps for TransferType.

View Source
var File_model_proto protoreflect.FileDescriptor

Functions

func TransactionEnvelopeHash

func TransactionEnvelopeHash(txn *entities.Transaction) ([]byte, error)

TransactionEnvelopeHash computes the transaction's hash for use in transaction construction.

func TransactionHash

func TransactionHash(txn *entities.Transaction) ([]byte, error)

TransactionHash computes the transaction's hash for use in computing a block's payload hash.

Types

type BlockMeta

type BlockMeta struct {
	Hash      []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	Height    uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	Parent    []byte `protobuf:"bytes,3,opt,name=parent,proto3" json:"parent,omitempty"`
	Timestamp uint64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

BlockMeta represents the key block metadata for use in /network/status within the Rosetta API.

func (*BlockMeta) Clone

func (b *BlockMeta) Clone() *BlockMeta

Clone creates a copy of the block metadata.

func (*BlockMeta) Descriptor deprecated

func (*BlockMeta) Descriptor() ([]byte, []int)

Deprecated: Use BlockMeta.ProtoReflect.Descriptor instead.

func (*BlockMeta) Equal

func (b *BlockMeta) Equal(other *BlockMeta) bool

Equal returns whether the given BlockMeta has the same hash, height, and timestamp.

func (*BlockMeta) GetHash

func (x *BlockMeta) GetHash() []byte

func (*BlockMeta) GetHeight

func (x *BlockMeta) GetHeight() uint64

func (*BlockMeta) GetParent

func (x *BlockMeta) GetParent() []byte

func (*BlockMeta) GetTimestamp

func (x *BlockMeta) GetTimestamp() uint64

func (*BlockMeta) ProtoMessage

func (*BlockMeta) ProtoMessage()

func (*BlockMeta) ProtoReflect

func (x *BlockMeta) ProtoReflect() protoreflect.Message

func (*BlockMeta) Reset

func (x *BlockMeta) Reset()

func (*BlockMeta) String

func (x *BlockMeta) String() string

type ConstructOpts

type ConstructOpts struct {
	BlockHash             []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
	BlockHashFromRemote   bool   `protobuf:"varint,6,opt,name=block_hash_from_remote,json=blockHashFromRemote,proto3" json:"block_hash_from_remote,omitempty"`
	BlockHashRemoteServer string `` /* 128-byte string literal not displayed */
	ExecutionEffort       uint64 `protobuf:"varint,9,opt,name=execution_effort,json=executionEffort,proto3" json:"execution_effort,omitempty"`
	Fees                  uint64 `protobuf:"varint,8,opt,name=fees,proto3" json:"fees,omitempty"`
	KeyId                 uint32 `protobuf:"varint,12,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"`
	InclusionEffort       uint64 `protobuf:"varint,10,opt,name=inclusion_effort,json=inclusionEffort,proto3" json:"inclusion_effort,omitempty"`
	Inner                 bool   `protobuf:"varint,2,opt,name=inner,proto3" json:"inner,omitempty"`
	NewAccounts           uint64 `protobuf:"varint,11,opt,name=new_accounts,json=newAccounts,proto3" json:"new_accounts,omitempty"`
	Payer                 []byte `protobuf:"bytes,3,opt,name=payer,proto3" json:"payer,omitempty"`
	ProxyTransferPayload  string `protobuf:"bytes,4,opt,name=proxy_transfer_payload,json=proxyTransferPayload,proto3" json:"proxy_transfer_payload,omitempty"` // hex-encoded
	SequenceNumber        int64  `protobuf:"varint,5,opt,name=sequence_number,json=sequenceNumber,proto3" json:"sequence_number,omitempty"`
	// contains filtered or unexported fields
}

ConstructOpts defines the options for Rosetta construction calls.

func (*ConstructOpts) Descriptor deprecated

func (*ConstructOpts) Descriptor() ([]byte, []int)

Deprecated: Use ConstructOpts.ProtoReflect.Descriptor instead.

func (*ConstructOpts) GetBlockHash

func (x *ConstructOpts) GetBlockHash() []byte

func (*ConstructOpts) GetBlockHashFromRemote

func (x *ConstructOpts) GetBlockHashFromRemote() bool

func (*ConstructOpts) GetBlockHashRemoteServer

func (x *ConstructOpts) GetBlockHashRemoteServer() string

func (*ConstructOpts) GetExecutionEffort

func (x *ConstructOpts) GetExecutionEffort() uint64

func (*ConstructOpts) GetFees

func (x *ConstructOpts) GetFees() uint64

func (*ConstructOpts) GetInclusionEffort

func (x *ConstructOpts) GetInclusionEffort() uint64

func (*ConstructOpts) GetInner

func (x *ConstructOpts) GetInner() bool

func (*ConstructOpts) GetKeyId added in v0.4.23

func (x *ConstructOpts) GetKeyId() uint32

func (*ConstructOpts) GetNewAccounts

func (x *ConstructOpts) GetNewAccounts() uint64

func (*ConstructOpts) GetPayer

func (x *ConstructOpts) GetPayer() []byte

func (*ConstructOpts) GetProxyTransferPayload

func (x *ConstructOpts) GetProxyTransferPayload() string

func (*ConstructOpts) GetSequenceNumber

func (x *ConstructOpts) GetSequenceNumber() int64

func (*ConstructOpts) ProtoMessage

func (*ConstructOpts) ProtoMessage()

func (*ConstructOpts) ProtoReflect

func (x *ConstructOpts) ProtoReflect() protoreflect.Message

func (*ConstructOpts) Reset

func (x *ConstructOpts) Reset()

func (*ConstructOpts) String

func (x *ConstructOpts) String() string

type IndexedBlock

type IndexedBlock struct {
	Timestamp    uint64                `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Transactions []*IndexedTransaction `protobuf:"bytes,2,rep,name=transactions,proto3" json:"transactions,omitempty"`
	// contains filtered or unexported fields
}

IndexedBlock represents a sealed block at a specific height.

func (*IndexedBlock) Descriptor deprecated

func (*IndexedBlock) Descriptor() ([]byte, []int)

Deprecated: Use IndexedBlock.ProtoReflect.Descriptor instead.

func (*IndexedBlock) GetTimestamp

func (x *IndexedBlock) GetTimestamp() uint64

func (*IndexedBlock) GetTransactions

func (x *IndexedBlock) GetTransactions() []*IndexedTransaction

func (*IndexedBlock) ProtoMessage

func (*IndexedBlock) ProtoMessage()

func (*IndexedBlock) ProtoReflect

func (x *IndexedBlock) ProtoReflect() protoreflect.Message

func (*IndexedBlock) Reset

func (x *IndexedBlock) Reset()

func (*IndexedBlock) String

func (x *IndexedBlock) String() string

type IndexedTransaction

type IndexedTransaction struct {
	ErrorMessage string           `protobuf:"bytes,5,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
	Events       []*TransferEvent `protobuf:"bytes,4,rep,name=events,proto3" json:"events,omitempty"`
	Failed       bool             `protobuf:"varint,1,opt,name=failed,proto3" json:"failed,omitempty"`
	Hash         []byte           `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	Operations   []*Operation     `protobuf:"bytes,3,rep,name=operations,proto3" json:"operations,omitempty"`
	// contains filtered or unexported fields
}

IndexedTransaction represents a transaction within a sealed block.

func (*IndexedTransaction) Descriptor deprecated

func (*IndexedTransaction) Descriptor() ([]byte, []int)

Deprecated: Use IndexedTransaction.ProtoReflect.Descriptor instead.

func (*IndexedTransaction) GetErrorMessage

func (x *IndexedTransaction) GetErrorMessage() string

func (*IndexedTransaction) GetEvents

func (x *IndexedTransaction) GetEvents() []*TransferEvent

func (*IndexedTransaction) GetFailed

func (x *IndexedTransaction) GetFailed() bool

func (*IndexedTransaction) GetHash

func (x *IndexedTransaction) GetHash() []byte

func (*IndexedTransaction) GetOperations

func (x *IndexedTransaction) GetOperations() []*Operation

func (*IndexedTransaction) ProtoMessage

func (*IndexedTransaction) ProtoMessage()

func (*IndexedTransaction) ProtoReflect

func (x *IndexedTransaction) ProtoReflect() protoreflect.Message

func (*IndexedTransaction) Reset

func (x *IndexedTransaction) Reset()

func (*IndexedTransaction) String

func (x *IndexedTransaction) String() string

type Network

type Network int32

Network specifies the Flow network.

const (
	Network_UNSPECIFIED_NETWORK Network = 0
	Network_MAINNET             Network = 1
	Network_TESTNET             Network = 2
	Network_PREVIEWNET          Network = 3
)

func (Network) Descriptor

func (Network) Descriptor() protoreflect.EnumDescriptor

func (Network) Enum

func (x Network) Enum() *Network

func (Network) EnumDescriptor deprecated

func (Network) EnumDescriptor() ([]byte, []int)

Deprecated: Use Network.Descriptor instead.

func (Network) Number

func (x Network) Number() protoreflect.EnumNumber

func (Network) String

func (x Network) String() string

func (Network) Type

func (Network) Type() protoreflect.EnumType

type Operation

type Operation struct {
	Account        []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
	Amount         uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	ProxyPublicKey []byte `protobuf:"bytes,3,opt,name=proxy_public_key,json=proxyPublicKey,proto3" json:"proxy_public_key,omitempty"`
	Receiver       []byte `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"`
	// Deprecated: Do not use.
	TransferEvents []*TransferEvent `protobuf:"bytes,5,rep,name=transfer_events,json=transferEvents,proto3" json:"transfer_events,omitempty"`
	Type           OperationType    `protobuf:"varint,6,opt,name=type,proto3,enum=model.OperationType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

Operation represents an individual operation within a transaction.

  • CREATE_ACCOUNT type operations have account specified, and if it happens to be an account created with a Proxy.Vault, then the proxy_public_key will also be specified.

* FEE type operations have sender account, amount, and receiver specified.

  • PROXY_TRANSFER and TRANSFER type operations have sender account, amount, and receiver specified. They might also include transfer_events if there are non-originator accounts involved in the transfer.

func (*Operation) Descriptor deprecated

func (*Operation) Descriptor() ([]byte, []int)

Deprecated: Use Operation.ProtoReflect.Descriptor instead.

func (*Operation) GetAccount

func (x *Operation) GetAccount() []byte

func (*Operation) GetAmount

func (x *Operation) GetAmount() uint64

func (*Operation) GetProxyPublicKey

func (x *Operation) GetProxyPublicKey() []byte

func (*Operation) GetReceiver

func (x *Operation) GetReceiver() []byte

func (*Operation) GetTransferEvents deprecated

func (x *Operation) GetTransferEvents() []*TransferEvent

Deprecated: Do not use.

func (*Operation) GetType

func (x *Operation) GetType() OperationType

func (*Operation) Pretty added in v0.4.22

func (o *Operation) Pretty() string

Pretty generates a custom-formatted representation of an operation.

func (*Operation) ProtoMessage

func (*Operation) ProtoMessage()

func (*Operation) ProtoReflect

func (x *Operation) ProtoReflect() protoreflect.Message

func (*Operation) Reset

func (x *Operation) Reset()

func (*Operation) String

func (x *Operation) String() string

type OperationType

type OperationType int32

OperationType specifies the type of an operation within an indexed transaction.

const (
	OperationType_OPERATION_TYPE_UNSPECIFIED OperationType = 0
	OperationType_CREATE_ACCOUNT             OperationType = 1
	OperationType_FEE                        OperationType = 2
	OperationType_PROXY_TRANSFER             OperationType = 3
	OperationType_TRANSFER                   OperationType = 4
)

func (OperationType) Descriptor

func (OperationType) Enum

func (x OperationType) Enum() *OperationType

func (OperationType) EnumDescriptor deprecated

func (OperationType) EnumDescriptor() ([]byte, []int)

Deprecated: Use OperationType.Descriptor instead.

func (OperationType) Number

func (OperationType) String

func (x OperationType) String() string

func (OperationType) Type

type TransferEvent

type TransferEvent struct {

	// Deprecated: Do not use.
	Account  []byte       `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
	Amount   uint64       `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
	Receiver []byte       `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"`
	Sender   []byte       `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"`
	Type     TransferType `protobuf:"varint,3,opt,name=type,proto3,enum=model.TransferType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

TransferEvent represents an event corresponding to a transfer of FLOW within a transaction.

func (*TransferEvent) Descriptor deprecated

func (*TransferEvent) Descriptor() ([]byte, []int)

Deprecated: Use TransferEvent.ProtoReflect.Descriptor instead.

func (*TransferEvent) GetAccount deprecated

func (x *TransferEvent) GetAccount() []byte

Deprecated: Do not use.

func (*TransferEvent) GetAmount

func (x *TransferEvent) GetAmount() uint64

func (*TransferEvent) GetReceiver

func (x *TransferEvent) GetReceiver() []byte

func (*TransferEvent) GetSender

func (x *TransferEvent) GetSender() []byte

func (*TransferEvent) GetType

func (x *TransferEvent) GetType() TransferType

func (*TransferEvent) ProtoMessage

func (*TransferEvent) ProtoMessage()

func (*TransferEvent) ProtoReflect

func (x *TransferEvent) ProtoReflect() protoreflect.Message

func (*TransferEvent) Reset

func (x *TransferEvent) Reset()

func (*TransferEvent) String

func (x *TransferEvent) String() string

type TransferType

type TransferType int32

TransferType specifies the type of a TransferEvent.

const (
	TransferType_TRANSFER_TYPE_UNSPECIFIED TransferType = 0
	TransferType_DEPOSIT                   TransferType = 1
	TransferType_FEE_DEPOSIT               TransferType = 3
	TransferType_PROXY_DEPOSIT             TransferType = 4
	TransferType_PROXY_WITHDRAWAL          TransferType = 5
	TransferType_WITHDRAWAL                TransferType = 2
)

func (TransferType) Descriptor

func (TransferType) Enum

func (x TransferType) Enum() *TransferType

func (TransferType) EnumDescriptor deprecated

func (TransferType) EnumDescriptor() ([]byte, []int)

Deprecated: Use TransferType.Descriptor instead.

func (TransferType) Number

func (TransferType) String

func (x TransferType) String() string

func (TransferType) Type

Jump to

Keyboard shortcuts

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