types

package
v0.0.0-...-031580b Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MetadataKeyMetadatas     = "metadatas"
	MetadataKeySerialNumbers = "serial_numbers"
	MetadataKeyType          = "type"
)
View Source
const (
	MetadataKeyMemo = "memo"

	OperationTypeCryptoCreateAccount = "CRYPTOCREATEACCOUNT"
	OperationTypeCryptoTransfer      = "CRYPTOTRANSFER"
	OperationTypeTokenAssociate      = "TOKENASSOCIATE"
	OperationTypeTokenBurn           = "TOKENBURN"
	OperationTypeTokenCreate         = "TOKENCREATION"
	OperationTypeTokenDelete         = "TOKENDELETION"
	OperationTypeTokenDissociate     = "TOKENDISSOCIATE" // #nosec
	OperationTypeTokenFreeze         = "TOKENFREEZE"
	OperationTypeTokenGrantKyc       = "TOKENGRANTKYC"
	OperationTypeTokenMint           = "TOKENMINT"
	OperationTypeTokenRevokeKyc      = "TOKENREVOKEKYC"
	OperationTypeTokenUnfreeze       = "TOKENUNFREEZE"
	OperationTypeTokenUpdate         = "TOKENUPDATE"
	OperationTypeTokenWipe           = "TOKENWIPE"

	OperationTypeFee = "FEE"
)
View Source
const (
	Blockchain = "Hedera"
)

Variables

View Source
var TransactionTypes = map[int32]string{
	0:  "UNKNOWN",
	7:  "CONTRACTCALL",
	8:  "CONTRACTCREATEINSTANCE",
	9:  "CONTRACTUPDATEINSTANCE",
	10: "CRYPTOADDLIVEHASH",
	11: OperationTypeCryptoCreateAccount,
	12: "CRYPTODELETE",
	13: "CRYPTODELETELIVEHASH",
	14: OperationTypeCryptoTransfer,
	15: "CRYPTOUPDATEACCOUNT",
	16: "FILEAPPEND",
	17: "FILECREATE",
	18: "FILEDELETE",
	19: "FILEUPDATE",
	20: "SYSTEMDELETE",
	21: "SYSTEMUNDELETE",
	22: "CONTRACTDELETEINSTANCE",
	23: "FREEZE",
	24: "CONSENSUSCREATETOPIC",
	25: "CONSENSUSUPDATETOPIC",
	26: "CONSENSUSDELETETOPIC",
	27: "CONSENSUSSUBMITMESSAGE",
	28: "UNCHECKEDSUBMIT",
	29: OperationTypeTokenCreate,
	31: OperationTypeTokenFreeze,
	32: OperationTypeTokenUnfreeze,
	33: OperationTypeTokenGrantKyc,
	34: OperationTypeTokenRevokeKyc,
	35: OperationTypeTokenDelete,
	36: OperationTypeTokenUpdate,
	37: OperationTypeTokenMint,
	38: OperationTypeTokenBurn,
	39: OperationTypeTokenWipe,
	40: OperationTypeTokenAssociate,
	41: OperationTypeTokenDissociate,
	42: "SCHEDULECREATE",
	43: "SCHEDULEDELETE",
	44: "SCHEDULESIGN",
	45: "TOKENFEESCHEDULEUPDATE",
	46: "TOKENPAUSE",
	47: "TOKENUNPAUSE",
	48: "CRYPTOAPPROVEALLOWANCE",
	49: "CRYPTODELETEALLOWANCE",
	50: "ETHEREUMTRANSACTION",
	51: "NODESTAKEUPDATE",
	52: "UTILPRNG",
}

Functions

func GetTransactionResult

func GetTransactionResult(code int32) string

func GetTransactionResults

func GetTransactionResults() map[int32]string

Types

type AccountId

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

func NewAccountIdFromAlias

func NewAccountIdFromAlias(alias []byte, shard, realm int64) (zero AccountId, _ error)

func NewAccountIdFromEntity

func NewAccountIdFromEntity(entity domain.Entity) (zero AccountId, _ error)

NewAccountIdFromEntity creates AccountId from the entity. If the entity has a network alias, the function will parse it to the rosetta format

func NewAccountIdFromEntityId

func NewAccountIdFromEntityId(accountId domain.EntityId) AccountId

func NewAccountIdFromPublicKeyBytes

func NewAccountIdFromPublicKeyBytes(keyBytes []byte, shard, realm int64) (zero AccountId, _ error)

func NewAccountIdFromSdkAccountId

func NewAccountIdFromSdkAccountId(accountId hedera.AccountID) (zero AccountId, _ error)

func NewAccountIdFromString

func NewAccountIdFromString(address string, shard, realm int64) (zero AccountId, _ error)

NewAccountIdFromString creates AccountId from the address string. If the address is in the shard.realm.num form, shard and realm are ignored. The only valid form of the alias address is the hex string of the raw public key bytes.

func (AccountId) GetAlias

func (a AccountId) GetAlias() []byte

GetAlias returns the Hedera network alias

func (AccountId) GetCurveType

func (a AccountId) GetCurveType() types.CurveType

func (AccountId) GetId

func (a AccountId) GetId() int64

func (AccountId) HasAlias

func (a AccountId) HasAlias() bool

func (AccountId) IsZero

func (a AccountId) IsZero() bool

func (AccountId) String

func (a AccountId) String() string

func (AccountId) ToRosetta

func (a AccountId) ToRosetta() *types.AccountIdentifier

func (AccountId) ToSdkAccountId

func (a AccountId) ToSdkAccountId() hedera.AccountID

type AddressBookEntries

type AddressBookEntries struct {
	Entries []AddressBookEntry
}

AddressBookEntries is domain level struct used to represent an array of AddressBookEntry

func (*AddressBookEntries) ToRosetta

func (abe *AddressBookEntries) ToRosetta() []*types.Peer

ToRosetta returns an array of Rosetta type Peer

type AddressBookEntry

type AddressBookEntry struct {
	NodeId    int64
	AccountId domain.EntityId
	Endpoints []string
}

AddressBookEntry is domain level struct used to represent Rosetta Peer

type Amount

type Amount interface {
	GetDecimals() int64
	GetSymbol() string
	GetValue() int64
	ToRosetta() *types.Amount
}

func NewAmount

func NewAmount(amount *types.Amount) (Amount, *types.Error)

type AmountSlice

type AmountSlice []Amount

func (AmountSlice) ToRosetta

func (a AmountSlice) ToRosetta() []*types.Amount

type Block

type Block struct {
	ConsensusEndNanos   int64
	ConsensusStartNanos int64
	Hash                string
	Index               int64
	ParentHash          string
	ParentIndex         int64
	Transactions        []*Transaction
}

Block is domain level struct used to represent Block conceptual mapping in Hedera

func (*Block) GetRosettaBlockIdentifier

func (b *Block) GetRosettaBlockIdentifier() *types.BlockIdentifier

func (*Block) GetTimestampMillis

func (b *Block) GetTimestampMillis() int64

GetTimestampMillis returns the block timestamp in milliseconds

func (*Block) ToRosetta

func (b *Block) ToRosetta() *types.Block

ToRosetta returns Rosetta type Block from the current domain type Block

type HbarAmount

type HbarAmount struct {
	Value int64
}

func (*HbarAmount) GetDecimals

func (h *HbarAmount) GetDecimals() int64

func (*HbarAmount) GetSymbol

func (h *HbarAmount) GetSymbol() string

func (*HbarAmount) GetValue

func (h *HbarAmount) GetValue() int64

func (*HbarAmount) ToRosetta

func (h *HbarAmount) ToRosetta() *types.Amount

ToRosetta returns Rosetta type Amount with hbar currency

type Operation

type Operation struct {
	AccountId AccountId
	Amount    Amount
	Index     int64
	Metadata  map[string]interface{}
	Status    string
	Type      string
}

Operation is domain level struct used to represent Operation within Transaction

func (Operation) ToRosetta

func (o Operation) ToRosetta() *types.Operation

ToRosetta returns Rosetta type Operation from the current domain type Operation

type OperationSlice

type OperationSlice []Operation

func (OperationSlice) ToRosetta

func (o OperationSlice) ToRosetta() []*types.Operation

ToRosetta returns a slice of Rosetta Operation

type PublicKey

type PublicKey struct {
	hedera.PublicKey
}

PublicKey embed hedera.PublicKey and implement the Unmarshaler interface

func NewPublicKeyFromAlias

func NewPublicKeyFromAlias(alias []byte) (zeroCurveType types.CurveType, zeroPublicKey PublicKey, _ error)

func (PublicKey) IsEmpty

func (pk PublicKey) IsEmpty() bool

func (PublicKey) ToAlias

func (pk PublicKey) ToAlias() (_ []byte, zeroCurveType types.CurveType, _ error)

func (*PublicKey) UnmarshalJSON

func (pk *PublicKey) UnmarshalJSON(data []byte) error

type Transaction

type Transaction struct {
	EntityId   *domain.EntityId
	Hash       string
	Memo       []byte
	Operations OperationSlice
}

Transaction is domain level struct used to represent Transaction conceptual mapping in Hedera

func (*Transaction) ToRosetta

func (t *Transaction) ToRosetta() *types.Transaction

ToRosetta returns Rosetta type Transaction from the current domain type Transaction

Jump to

Keyboard shortcuts

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