api

package
v0.4.4-testnet Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrefixAPIV1       = "/api/v1"
	PrefixTxAPIV1     = "/txapi/v1"
	PrefixWebSocketV1 = "/wsapi/v1"

	PathGetLedgerID                      = PrefixAPIV1 + "/get_ledger_id"
	PathGetAccountOutputs                = PrefixAPIV1 + "/get_account_outputs"
	PathGetAccountParsedOutputs          = PrefixAPIV1 + "/get_account_parsed_outputs"
	PathGetAccountSimpleSiglockedOutputs = PrefixAPIV1 + "/get_account_simple_siglocked"
	PathGetOutputsForAmount              = PrefixAPIV1 + "/get_outputs_for_amount"
	PathGetNonChainBalance               = PrefixAPIV1 + "/get_nonchain_balance"
	PathGetChainedOutputs                = PrefixAPIV1 + "/get_chain_outputs"
	PathGetChainOutput                   = PrefixAPIV1 + "/get_chain_output"
	PathGetOutput                        = PrefixAPIV1 + "/get_output"
	PathSubmitTransaction                = PrefixAPIV1 + "/submit_tx"
	PathGetSyncInfo                      = PrefixAPIV1 + "/sync_info"
	PathGetNodeInfo                      = PrefixAPIV1 + "/node_info"
	PathGetPeersInfo                     = PrefixAPIV1 + "/peers_info"
	PathGetLatestReliableBranch          = PrefixAPIV1 + "/get_latest_reliable_branch"
	PathCheckTxIDInLRB                   = PrefixAPIV1 + "/check_txid_in_lrb"
	PathGetLastKnownSequencerMilestones  = PrefixAPIV1 + "/last_known_milestones"
	PathGetMainChain                     = PrefixAPIV1 + "/get_mainchain"
	PathGetAllChains                     = PrefixAPIV1 + "/get_all_chains"
	// PathGetDelegationsBySequencer returns summarized delegation data in the form of DelegationsBySequencer
	PathGetDelegationsBySequencer = PrefixAPIV1 + "/get_delegations_by_sequencer"
	// PathGetDashboard returns dashboard
	PathGetDashboard = "/dashboard"

	PathCompileScript             = PrefixTxAPIV1 + "/compile_script"
	PathDecompileBytecode         = PrefixTxAPIV1 + "/decompile_bytecode"
	PathParseOutputData           = PrefixTxAPIV1 + "/parse_output_data"
	PathParseOutput               = PrefixTxAPIV1 + "/parse_output"
	PathGetTxBytes                = PrefixTxAPIV1 + "/get_txbytes"
	PathGetParsedTransaction      = PrefixTxAPIV1 + "/get_parsed_transaction"
	PathGetVertexWithDependencies = PrefixTxAPIV1 + "/get_vertex_dep"

	// WebSocket API
	PathDAGVertexStream = PrefixWebSocketV1 + "/dag_vertex_stream"
)
View Source
const ErrGetOutputNotFound = "output not found"

Variables

This section is empty.

Functions

func SetHeader

func SetHeader(w http.ResponseWriter)

func WriteErr

func WriteErr(w http.ResponseWriter, errStr string)

func WriteOk

func WriteOk(w http.ResponseWriter)

Types

type Balance

type Balance struct {
	Error
	Amount uint64 `json:"amount"`
	LRBID  string `json:"lrbid"`
}

type BranchData

type BranchData struct {
	ID   string                        `json:"id"`
	Data multistate.BranchDataJSONAble `json:"data"`
}

type Bytecode

type Bytecode struct {
	Bytecode string `json:"bytecode"`
}

type ChainOutput

type ChainOutput struct {
	Error
	OutputDataWithID
	// latest reliable branch used to extract chain ID
	LRBID string `json:"lrbid"`
}

ChainOutput is returned by 'get_chain_output'

type ChainedOutputs

type ChainedOutputs struct {
	Error
	Outputs map[string]string `json:"outputs,omitempty"`
	LRBID   string            `json:"lrbid"`
}

type Chains

type Chains struct {
	Error
	Chains map[string]OutputDataWithID `json:"chains"`
	LRBID  string                      `json:"lrbid"`
}

type CheckTxIDInLRB

type CheckTxIDInLRB struct {
	Error
	TxID         string `json:"txid"`
	LRBID        string `json:"lrbid"`
	FoundAtDepth int    `json:"found_at_depth"`
}

type DelegationData

type DelegationData struct {
	Amount      uint64 `json:"amount"`
	SinceSlot   uint32 `json:"since_slot"`
	StartAmount uint64 `json:"start_amount"`
}

type DelegationsBySequencer

type DelegationsBySequencer struct {
	Error
	LRBID      string                            `json:"lrbid"`
	Sequencers map[string]DelegationsOnSequencer `json:"sequencers"`
}

type DelegationsOnSequencer

type DelegationsOnSequencer struct {
	SequencerOutputID string                    `json:"seq_output_id"`
	SequencerName     string                    `json:"seq_name"`
	Balance           uint64                    `json:"balance"`
	Delegations       map[string]DelegationData `json:"delegations"`
}

type Error

type Error struct {
	// empty string when no error
	Error string `json:"error,omitempty"`
}

type Input

type Input struct {
	OutputID   string `json:"output_id"`
	UnlockData string `json:"unlock_data"`
}

type KnownLatestMilestones

type KnownLatestMilestones struct {
	Error
	Sequencers map[string]tippool.LatestSequencerTipDataJSONAble `json:"sequencers"`
}

type LatestReliableBranch

type LatestReliableBranch struct {
	Error
	RootData multistate.RootRecordJSONAble `json:"root_record,omitempty"`
	BranchID ledger.TransactionID          `json:"branch_id,omitempty"`
}

LatestReliableBranch returned by get_latest_reliable_branch

type LedgerID

type LedgerID struct {
	Error
	// hex-encoded ledger id bytes
	LedgerIDBytes string `json:"ledger_id_bytes,omitempty"`
}

type MainChain

type MainChain struct {
	Error
	Branches []BranchData `json:"branches"`
}

type MilestoneData

type MilestoneData struct {
	Name         string `json:"name"`
	MinimumFee   uint64 `json:"minimum_fee"`
	ChainHeight  uint32 `json:"chain_height"`
	BranchHeight uint32 `json:"branch_height"`
}

type OutputData

type OutputData struct {
	Error
	// hex-encoded output data
	OutputData string `json:"output_data,omitempty"`
	// latest reliable branch used to extract output
	LRBID string `json:"lrbid"`
}

OutputData is returned by 'get_output'

type OutputDataWithID

type OutputDataWithID struct {
	// hex-encoded outputID
	ID string `json:"id"`
	// hex-encoded output data
	Data string `json:"data"`
}

type OutputList

type OutputList struct {
	Error
	// key is hex-encoded outputID bytes
	// value is hex-encoded raw output data
	Outputs map[string]string `json:"outputs,omitempty"`
	// latest reliable branch used to extract outputs
	LRBID string `json:"lrbid"`
}

OutputList is returned by 'get_account_outputs'

type ParsedOutput

type ParsedOutput struct {
	// raw hex-encoded output data
	Data string `json:"data"`
	// parsed constraints for display
	Constraints []string `json:"constraints"`
	// amount
	Amount uint64 `json:"amount"`
	// name of the lock constraint
	LockName string `json:"lock_name"`
	// Chain ID for chain outputs
	ChainID string `json:"chain_id,omitempty"`
}

type ParsedOutputList

type ParsedOutputList struct {
	Error
	// key is hex-encoded outputID bytes
	// value is hex-encoded raw output data
	Outputs map[string]ParsedOutput `json:"outputs,omitempty"`
	// latest reliable branch used to extract outputs
	LRBID string `json:"lrbid"`
}

ParsedOutputList is returned by 'get_account_parsed_outputs'

type PeerInfo

type PeerInfo struct {
	// The libp2p identifier of the peer.
	ID string `json:"id"`
	// The libp2p multi addresses of the peer.
	MultiAddresses            []string `json:"multiAddresses,omitempty"`
	IsStatic                  bool     `json:"is_static"`
	RespondsToPull            bool     `json:"responds_to_pull"`
	IsAlive                   bool     `json:"is_alive"`
	WhenAdded                 int64    `json:"when_added"`
	LastHeartbeatReceived     int64    `json:"last_heartbeat_received"`
	ClockDifferencesQuartiles [3]int64 `json:"clock_differences_quartiles"`
	HBMsgDifferencesQuartiles [3]int64 `json:"hb_differences_quartiles"`
	NumIncomingHB             int      `json:"num_incoming_hb"`
	NumIncomingPull           int      `json:"num_incoming_pull"`
	NumIncomingTx             int      `json:"num_incoming_tx"`
}

type PeersInfo

type PeersInfo struct {
	Error
	HostID    string            `json:"host_id"`
	Peers     []PeerInfo        `json:"peers,omitempty"`
	Blacklist map[string]string `json:"blacklist,omitempty"` // map: peerID -> reason why it is in the blacklist
}

type ScriptSource

type ScriptSource struct {
	Source string `json:"source"`
}

type SequencerSyncInfo

type SequencerSyncInfo struct {
	Synced              bool   `json:"synced"`
	LatestHealthySlot   uint32 `json:"latest_healthy_slot"`
	LatestCommittedSlot uint32 `json:"latest_committed_slot"`
	LedgerCoverage      uint64 `json:"ledger_coverage"`
}

type SequencerTxData

type SequencerTxData struct {
	SequencerID          string `json:"sequencer_id"`
	SequencerOutputIndex byte   `json:"sequencer_output_index"`
	StemOutputIndex      *byte  `json:"stem_output_index,omitempty"` // nil for non-branch transaction
	*MilestoneData       `json:"milestone_data,omitempty"`
}

type SyncInfo

type SyncInfo struct {
	Error
	Synced         bool                         `json:"synced"`
	CurrentSlot    uint32                       `json:"current_slot"`
	LrbSlot        uint32                       `json:"lrb_slot"`
	LedgerCoverage uint64                       `json:"ledger_coverage"`
	PerSequencer   map[string]SequencerSyncInfo `json:"per_sequencer,omitempty"`
}

type TransactionJSONAble

type TransactionJSONAble struct {
	// hex-encoded transaction ID
	ID               string `json:"id"`
	TotalAmount      uint64 `json:"total_amount"`
	TotalInflation   uint64 `json:"total_inflation"`
	IsBranch         bool   `json:"is_branch"`
	*SequencerTxData `json:"sequencer_tx_data,omitempty"`
	Sender           string                                  `json:"sender"`
	Signature        string                                  `json:"signature"`
	Inputs           []Input                                 `json:"inputs"`
	Outputs          []ParsedOutput                          `json:"outputs"`
	Endorsements     []string                                `json:"endorsements,omitempty"`
	TxMetadata       *txmetadata.TransactionMetadataJSONAble `json:"tx_metadata,omitempty"`
}

TransactionJSONAble is more or less human-readable form of the transaction. Intended mostly for display It is not a canonical form. The canonical form is binary blob. It cannot be reproduced from the TransactionJSONAble

func JSONAbleFromTransaction

func JSONAbleFromTransaction(tx *transaction.Transaction) *TransactionJSONAble

type TxBytes

type TxBytes struct {
	TxBytes    string                                  `json:"tx_bytes"`
	TxMetadata *txmetadata.TransactionMetadataJSONAble `json:"tx_metadata,omitempty"`
}

type VertexWithDependencies

type VertexWithDependencies struct {
	ID                    string   `json:"id"`                // transaction ID in hex form
	TotalAmount           uint64   `json:"a"`                 // total produced amount on transaction
	TotalInflation        uint64   `json:"i,omitempty"`       // total inflation on transaction
	SequencerID           string   `json:"seqid,omitempty"`   // "" (omitted) for non-seq. Useful for coloring
	SequencerInputTxIndex *byte    `json:"seqidx,omitempty"`  // sequencer predecessor tx index for sequencer predecessor tx in the Inputs list, otherwise nil
	StemInputTxIndex      *byte    `json:"stemidx,omitempty"` // stem predecessor (branch) tx index for stem predecessor tx in the Inputs list, otherwise nil
	Inputs                []string `json:"in"`                // list of input IDs (not empty)
	Endorsements          []string `json:"endorse,omitempty"` // list of endorsements (can be nil)
}

VertexWithDependencies primary purpose is streaming vertices for DAG visualization

func VertexWithDependenciesFromTransaction

func VertexWithDependenciesFromTransaction(tx *transaction.Transaction) *VertexWithDependencies

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳