transaction

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Nft

type Nft struct {
	AccountID         string `json:"account_id"`         // The account ID of the account associated with the NFT
	CreatedTimestamp  string `json:"created_timestamp"`  // The timestamp of when the NFT was created
	Deleted           bool   `json:"deleted"`            // Whether the token was deleted or not
	Metadata          string `json:"metadata"`           // The metadata of the NFT, in base64
	ModifiedTimestamp string `json:"modified_timestamp"` // The last time the token properties were modified
	SerialNumber      int64  `json:"serial_number"`      // The serial number of the NFT
	TokenID           string `json:"token_id"`           // The token ID of the NFT
}

Nft struct used by Hedera Mirror node REST API to return information for a given Nft entity

type NftTransaction

type NftTransaction struct {
	TransactionID     string `json:"transaction_id"`      // The transaction ID of the transaction
	Type              string `json:"type"`                // The type of transaction TOKENBURN, TOKEMINT, CRYPTOTRANSFER
	SenderAccountID   string `json:"sender_account_id"`   // The account that sent the NFT
	ReceiverAccountID string `json:"receiver_account_id"` // The account that received the NFT
}

type NftTransactionsResponse

type NftTransactionsResponse struct {
	Transactions []NftTransaction `json:"transactions"`
	Links        Pagination       `json:"links"`
}

NftTransactionsResponse struct used by Hedera Mirror node REST API to return information about an NFT's transaction

type NftTransfer

type NftTransfer struct {
	ReceiverAccountID string `json:"receiver_account_id"`
	SenderAccountID   string `json:"sender_account_id"`
	SerialNumber      int64  `json:"serial_number"`
	Token             string `json:"token_id"`
}

NftTransfer struct used by the Hedera mirror node REST API

type Pagination

type Pagination struct {
	Next string `json:"next"` // Hyperlink to the next page of results
}

type ParsedTransfer

type ParsedTransfer struct {
	IsNft             bool
	AmountOrSerialNum int64
	Asset             string
}

ParsedTransfer Used in GetIncomingTransfer to return the information about an Incoming Transfer

type Response

type Response struct {
	Transactions         []Transaction
	mirrorNodeErr.Status `json:"_status"`
}

Response struct used by the Hedera Mirror node REST API and returned once account transactions are queried

func (Response) GetLatestTxnConsensusTime

func (r Response) GetLatestTxnConsensusTime() (int64, error)

GetLatestTxnConsensusTime iterates all transactions and returns the consensus timestamp of the latest one

func (Response) IsNotFound

func (r Response) IsNotFound() bool

IsNotFound traverses all Error messages and searches for Not Found message

type Schedule

type Schedule struct {
	ConsensusTimestamp string `json:"consensus_timestamp"`
	CreatorAccountId   string `json:"creator_account_id"`
	ExecutedTimestamp  string `json:"executed_timestamp"`
	Memo               string `json:"memo"`
	PayerAccountId     string `json:"payer_account_id"`
	ScheduleId         string `json:"schedule_id"`
}

Schedule struct used by the Hedera Mirror node REST API to return information regarding a given Schedule entity

type Transaction

type Transaction struct {
	ConsensusTimestamp   string        `json:"consensus_timestamp"`
	EntityId             string        `json:"entity_id"`
	TransactionHash      string        `json:"transaction_hash"`
	ValidStartTimestamp  string        `json:"valid_start_timestamp"`
	ChargedTxFee         int           `json:"charged_tx_fee"`
	MemoBase64           string        `json:"memo_base64"`
	Result               string        `json:"result"`
	Name                 string        `json:"name"`
	MaxFee               string        `json:"max_fee"`
	ValidDurationSeconds string        `json:"valid_duration_seconds"`
	Node                 string        `json:"node"`
	Scheduled            bool          `json:"scheduled"`
	TransactionID        string        `json:"transaction_id"`
	Transfers            []Transfer    `json:"transfers"`
	TokenTransfers       []Transfer    `json:"token_transfers"`
	NftTransfers         []NftTransfer `json:"nft_transfers"`
}

Transaction struct used by the Hedera Mirror node REST API

func (Transaction) GetHBARTransfer

func (t Transaction) GetHBARTransfer(account string) (amount int64, isFound bool)

GetHBARTransfer gets the HBAR transfer for an Account

func (Transaction) GetIncomingTransfer

func (t Transaction) GetIncomingTransfer(account string) (parsed ParsedTransfer, err error)

Process Hedera -> EVM TX GetIncomingTransfer returns the transfer to an account in the following order: 1. Checks if there is an NFT transfer 2. Checks if there is a Fungible Token transfer 3. Checks if there is an HBAR transfer

func (Transaction) GetTokenTransfer

func (t Transaction) GetTokenTransfer(account string) (amount int64, isFound bool)

GetTokenTransfer gets the token transfer for an Account

type Transfer

type Transfer struct {
	Account string `json:"account"`
	Amount  int64  `json:"amount"`
	// When retrieving ordinary hbar transfers, this field does not get populated
	Token string `json:"token_id"`
}

Transfer struct used by the Hedera Mirror node REST API

Jump to

Keyboard shortcuts

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