Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAddress(as string) error
- func GetOperations(fa string, els []*EventLog, lastOpIndex int64) []*types.Operation
- func GetRpcRequest(method string, reqPtr interface{}, id int64) (*jsonrpc.Request, error)
- func HandleBugTransaction(transaction *types.Transaction, address string)
- func IsContract(as string) bool
- func MakeBaseOperations() (*types.Operation, error)
- func MapNetwork(n string) *common.HexInt
- func MarshalJSONMap(i interface{}) (map[string]interface{}, error)
- func NewHttpError(r *http.Response) error
- func ParseBlock(blk *Block) (*types.Block, error)
- func ParseGenesisBlock(blk *Block) (*types.Block, error)
- func ParseGenesisOperationsV2(tx GenesisTransaction) ([]*types.Operation, error)
- func ParseGenesisTransaction(txArray []json.RawMessage) ([]*types.Transaction, error)
- func ParseOperationsV2(transaction Transaction) ([]*types.Operation, error)
- func ParseOperationsV3(transaction Transaction) ([]*types.Operation, error)
- func ParseTransactionV2(transaction Transaction) (*types.Transaction, error)
- func ParseTransactionV3(transaction Transaction) (*types.Transaction, error)
- func ParseTransactions(txArray []json.RawMessage) ([]*types.Transaction, error)
- func UnmarshalJSONMap(m map[string]interface{}, i interface{}) error
- type BalanceChange
- type BalanceRPCRequest
- type Block
- type BlockRPCRequest
- type Client
- func (ic *Client) GetBalance(account *RosettaTypes.AccountIdentifier, ...) (*RosettaTypes.AccountBalanceResponse, error)
- func (ic *Client) GetBlock(params *RosettaTypes.PartialBlockIdentifier) (*RosettaTypes.Block, error)
- func (ic *Client) GetDefaultStepCost() (*common.HexInt, error)
- func (ic *Client) GetPeer() ([]*RosettaTypes.Peer, error)
- func (ic *Client) GetTransaction(params *RosettaTypes.TransactionIdentifier) (*RosettaTypes.Transaction, error)
- func (ic *Client) SendTransaction(tx Transaction) error
- func (ic *Client) Status() (*RosettaTypes.BlockIdentifier, int64, []*RosettaTypes.Peer, error)
- type ClientAdmin
- type ClientV3
- type EventLog
- type GenesisAccount
- type GenesisTransaction
- type HttpError
- type JsonRpcClient
- type Operation
- type Response
- type RosettaTraceParam
- type RosettaTraceResponse
- type Transaction
- func (tx *Transaction) CalcHash() ([]byte, error)
- func (tx *Transaction) FeeValue() string
- func (tx *Transaction) FromAddr() string
- func (tx *Transaction) GetDataType() string
- func (tx *Transaction) MetaV2() map[string]interface{}
- func (tx *Transaction) MetaV3() map[string]interface{}
- func (tx *Transaction) StepValues() string
- func (tx *Transaction) ToAddr() string
- func (tx *Transaction) ToJSON() (map[string]interface{}, error)
- func (tx *Transaction) TxHash() []byte
- func (tx *Transaction) Values() string
- func (tx *Transaction) VerifySignature() error
- type TransactionRPCRequest
- type TransactionResult
Constants ¶
View Source
const ( // NodeVersion is the version of goloop we are using. NodeVersion = "1.2.13" // Blockchain is ICON. Blockchain string = "ICON" // MainnetNetwork is the value of the network // in MainnetNetworkIdentifier. MainnetNetwork string = "Mainnet" // LisbonNetwork is the value of the network // in LisbonNetworkIdentifier. LisbonNetwork string = "Lisbon" // BerlinNetwork is the value of the network // in BerlinNetworkIdentifier. BerlinNetwork string = "Berlin" // LocalNetwork is the value of the network // in LocalNetworkIdentifier. LocalNetwork string = "Localnet" EndpointPrefix = "api" EndpointVersion = "v3" EndpointAdmin = "admin" EndpointRosetta = "rosetta" ICXSymbol = "ICX" ICXDecimals = 18 GenesisBlockIndex = int64(0) HistoricalBalanceSupported = true IncludeMempoolCoins = false TreasuryAddress = "hx1000000000000000000000000000000000000000" SystemScoreAddress = "cx0000000000000000000000000000000000000000" GenesisOpType = "GENESIS" TransferOpType = "TRANSFER" FeeOpType = "FEE" IssueOpType = "ISSUE" BurnOpType = "BURN" LostOpType = "LOST" FSDepositOpType = "FS_DEPOSIT" FSWithdrawOpType = "FS_WITHDRAW" FSFeeOpType = "FS_FEE" StakeOpType = "STAKE" UnstakeOpType = "UNSTAKE" ClaimOpType = "CLAIM" GhostOpType = "GHOST" RewardOpType = "REWARD" RegPRepOpType = "REG_PREP" MessageOpType = "MESSAGE" BaseOpType = "BASE" WithdrawnType = "WITHDRAWN" ICXTransferOpType = "ICXTRANSFER" DeployOpType = "DEPLOY" CallOpType = "CALL" DepositOpType = "DEPOSIT" BugOpType = "BUG" BaseDataType = "base" TransferDataType = "transfer" MessageDataType = "message" DeployDataType = "deploy" CallDataType = "call" DepositDataType = "deposit" SuccessStatus = "SUCCESS" FailureStatus = "FAIL" GenesisTxHash = "0x0000000000000000000000000000000000000000000000000000000000000000" )
View Source
const AddressStringLength = 42
Variables ¶
View Source
var ( ICXCurrency = &types.Currency{ Symbol: ICXSymbol, Decimals: ICXDecimals, } OperationTypes = []string{ GenesisOpType, TransferOpType, FeeOpType, IssueOpType, BurnOpType, LostOpType, FSDepositOpType, FSWithdrawOpType, FSFeeOpType, StakeOpType, UnstakeOpType, ClaimOpType, GhostOpType, RewardOpType, RegPRepOpType, MessageOpType, } // OperationStatuses are all supported operation statuses. OperationStatuses = []*types.OperationStatus{ { Status: SuccessStatus, Successful: true, }, { Status: FailureStatus, Successful: false, }, } )
Functions ¶
func CheckAddress ¶
func GetOperations ¶
func GetRpcRequest ¶
func HandleBugTransaction ¶
func HandleBugTransaction(transaction *types.Transaction, address string)
func IsContract ¶
func MakeBaseOperations ¶
func MapNetwork ¶
func MarshalJSONMap ¶
func NewHttpError ¶
func ParseGenesisOperationsV2 ¶
func ParseGenesisOperationsV2(tx GenesisTransaction) ([]*types.Operation, error)
func ParseGenesisTransaction ¶
func ParseGenesisTransaction(txArray []json.RawMessage) ([]*types.Transaction, error)
func ParseOperationsV2 ¶
func ParseOperationsV2(transaction Transaction) ([]*types.Operation, error)
func ParseOperationsV3 ¶
func ParseOperationsV3(transaction Transaction) ([]*types.Operation, error)
func ParseTransactionV2 ¶
func ParseTransactionV2(transaction Transaction) (*types.Transaction, error)
func ParseTransactionV3 ¶
func ParseTransactionV3(transaction Transaction) (*types.Transaction, error)
func ParseTransactions ¶
func ParseTransactions(txArray []json.RawMessage) ([]*types.Transaction, error)
func UnmarshalJSONMap ¶
Types ¶
type BalanceChange ¶
type BalanceRPCRequest ¶
type Block ¶
type Block struct { BlockHash common.HexBytes `json:"block_hash"` Version string `json:"version"` Height int64 `json:"height"` Timestamp int64 `json:"time_stamp"` Proposer common.Address `json:"peer_id"` PrevBlockHash common.HexBytes `json:"prev_block_hash"` MerkleTreeRootHash common.HexBytes `json:"merkle_tree_root_hash"` Signature common.HexBytes `json:"signature"` Transactions []json.RawMessage `json:"confirmed_transaction_list"` }
func (Block) GenesisMeta ¶
func (Block) TimestampInMillis ¶
type BlockRPCRequest ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to fetch blocks from ICON Node and to parser ICON block data into Rosetta types.
func (*Client) GetBalance ¶
func (ic *Client) GetBalance( account *RosettaTypes.AccountIdentifier, block *RosettaTypes.PartialBlockIdentifier, ) (*RosettaTypes.AccountBalanceResponse, error)
func (*Client) GetBlock ¶
func (ic *Client) GetBlock(params *RosettaTypes.PartialBlockIdentifier) (*RosettaTypes.Block, error)
func (*Client) GetTransaction ¶
func (ic *Client) GetTransaction(params *RosettaTypes.TransactionIdentifier) (*RosettaTypes.Transaction, error)
func (*Client) SendTransaction ¶
func (ic *Client) SendTransaction(tx Transaction) error
func (*Client) Status ¶
func (ic *Client) Status() (*RosettaTypes.BlockIdentifier, int64, []*RosettaTypes.Peer, error)
type ClientAdmin ¶
type ClientAdmin struct {
// contains filtered or unexported fields
}
func NewClientAdmin ¶
func NewClientAdmin(endpoint string) *ClientAdmin
type GenesisAccount ¶
type GenesisAccount struct { Name string `json:"name"` Address common.Address `json:"address"` Balance *common.HexInt `json:"balance"` }
func (*GenesisAccount) Addr ¶
func (ga *GenesisAccount) Addr() string
func (*GenesisAccount) Balances ¶
func (ga *GenesisAccount) Balances() string
type GenesisTransaction ¶
type GenesisTransaction struct { Accounts []GenesisAccount `json:"accounts"` Message string `json:"message"` }
type JsonRpcClient ¶
type JsonRpcClient struct { Endpoint string CustomHeader map[string]string Pre func(req *http.Request) error // contains filtered or unexported fields }
func NewJsonRpcClient ¶
func NewJsonRpcClient(hc *http.Client, endpoint string) *JsonRpcClient
func (*JsonRpcClient) Request ¶
func (c *JsonRpcClient) Request(jrReq *jsonrpc.Request, respPtr interface{}) (*Response, error)
func (*JsonRpcClient) RequestBatch ¶
func (c *JsonRpcClient) RequestBatch(jrReq []*jsonrpc.Request, respPtr []interface{}) ([]*Response, error)
type Operation ¶
type Response ¶
type Response struct { Version string `json:"jsonrpc"` Result json.RawMessage `json:"result"` Error *jsonrpc.Error `json:"error,omitempty"` ID interface{} `json:"id"` }
type RosettaTraceParam ¶
type RosettaTraceResponse ¶
type RosettaTraceResponse struct { BlockHash string `json:"blockHash"` PrevBlockHash string `json:"prevBlockHash"` BlockHeight common.HexInt64 `json:"blockHeight"` Timestamp common.HexInt64 `json:"timestamp"` BalanceChanges []*BalanceChange `json:"balanceChanges"` }
func (RosettaTraceResponse) Index ¶
func (rt RosettaTraceResponse) Index() int64
func (RosettaTraceResponse) TimestampInMillis ¶
func (rt RosettaTraceResponse) TimestampInMillis() int64
type Transaction ¶
type Transaction struct { Version common.HexUint16 `json:"version"` From common.Address `json:"from"` To common.Address `json:"to"` Value *common.HexInt `json:"value,omitempty"` StepLimit common.HexInt `json:"stepLimit"` Timestamp common.HexInt64 `json:"timestamp"` NID *common.HexInt `json:"nid"` Nonce *common.HexInt `json:"nonce,omitempty"` Signature *common.Signature `json:"signature,omitempty"` DataType *string `json:"dataType,omitempty"` Data json.RawMessage `json:"data,omitempty"` Fee *common.HexInt `json:"fee,omitempty"` TxHashV3 common.HexBytes `json:"txHash,omitempty"` TxHashV2 common.HexBytes `json:"tx_hash,omitempty"` Method string `json:"method,omitempty"` }
func ParseV3JSON ¶
func ParseV3JSON(js []byte) (*Transaction, error)
func (*Transaction) CalcHash ¶
func (tx *Transaction) CalcHash() ([]byte, error)
func (*Transaction) FeeValue ¶
func (tx *Transaction) FeeValue() string
func (*Transaction) FromAddr ¶
func (tx *Transaction) FromAddr() string
func (*Transaction) GetDataType ¶
func (tx *Transaction) GetDataType() string
func (*Transaction) MetaV2 ¶
func (tx *Transaction) MetaV2() map[string]interface{}
func (*Transaction) MetaV3 ¶
func (tx *Transaction) MetaV3() map[string]interface{}
func (*Transaction) StepValues ¶
func (tx *Transaction) StepValues() string
func (*Transaction) ToAddr ¶
func (tx *Transaction) ToAddr() string
func (*Transaction) ToJSON ¶
func (tx *Transaction) ToJSON() (map[string]interface{}, error)
func (*Transaction) TxHash ¶
func (tx *Transaction) TxHash() []byte
func (*Transaction) Values ¶
func (tx *Transaction) Values() string
func (*Transaction) VerifySignature ¶
func (tx *Transaction) VerifySignature() error
type TransactionRPCRequest ¶
type TransactionRPCRequest struct {
Hash string `json:"txHash"`
}
type TransactionResult ¶
type TransactionResult struct { StatusFlag *string Status json.RawMessage `json:"status"` BlockHeight *json.RawMessage `json:"blockHeight"` BlockHash *json.RawMessage `json:"blockHash"` TxHash *json.RawMessage `json:"txHash"` TxIndex *json.RawMessage `json:"txIndex"` To *json.RawMessage `json:"to"` ScoreAddress *json.RawMessage `json:"scoreAddress"` StepUsed *common.HexInt `json:"stepUsed"` CumulativeStepUsed *common.HexInt `json:"cumulativeStepUsed"` StepPrice *common.HexInt `json:"stepPrice"` LogsBloom *json.RawMessage `json:"logsBloom"` EventLogs []*EventLog `json:"eventLogs"` Failure *json.RawMessage `json:"failure"` StepDetails map[string]*common.HexInt `json:"stepUsedDetails"` }
func ParseTransactionResult ¶
func ParseTransactionResult(tx interface{}) (*TransactionResult, error)
func ParseTransactionResults ¶
func ParseTransactionResults(trsRaws *[]interface{}) ([]*TransactionResult, error)
Click to show internal directories.
Click to hide internal directories.