Documentation ¶
Index ¶
- Constants
- Variables
- func Contains(s []string, str string) bool
- func EncodeBig(bigint *big.Int) string
- func GetRosOperationsFromTx(tx solPTypes.ParsedTransaction, status string) []*types.Operation
- func GetTxFromStr(t string) (solPTypes.Transaction, error)
- func IsBalanceChanging(opType string) bool
- func ParseInstruction(ins solPTypes.Instruction) (solPTypes.ParsedInstruction, error)
- func ToParsedTransaction(tx solPTypes.Transaction) (solPTypes.ParsedTransaction, error)
- func ToRosTx(tx solPTypes.ParsedTransaction) RosettaTypes.Transaction
- func ToRosTxs(txs []ss.ParsedTransactionWithMeta) []*RosettaTypes.Transaction
- func ValueToBaseAmount(valueStr string) uint64
- type Client
- func (ec *Client) Balance(ctx context.Context, account *RosettaTypes.AccountIdentifier, ...) (*RosettaTypes.AccountBalanceResponse, error)
- func (ec *Client) Block(ctx context.Context, blockIdentifier *RosettaTypes.PartialBlockIdentifier) (*RosettaTypes.Block, error)
- func (ec *Client) BlockTransaction(ctx context.Context, ...) (*RosettaTypes.Transaction, error)
- func (ec *Client) Call(ctx context.Context, request *RosettaTypes.CallRequest) (*RosettaTypes.CallResponse, error)
- func (ec *Client) Close()
- func (ec *Client) GetTokenAccountByMint(ctx context.Context, owner string, mint string) (string, error)
- func (ec *Client) Status(ctx context.Context) (*RosettaTypes.BlockIdentifier, int64, []*RosettaTypes.Peer, ...)
- type GetConfirmedBlockResult
- type OpMetaTokenAmount
- type ParsedInstructionMeta
- type SplAccounts
- type TokenParsed
- type WithNonce
Constants ¶
View Source
const ( // NodeVersion is the version of geth we are using. NodeVersion = "1.4.17" // Blockchain is solanago. Blockchain string = "solana" // MainnetNetwork is the value of the network // in MainnetNetworkIdentifier. MainnetNetwork string = "mainnet" // TestnetNetwork is the value of the network // in TestnetNetworkIdentifier. TestnetNetwork string = "testnet" // DevnetNetwork is the value of the network // in DevnetNetworkIdentifier. DevnetNetwork string = "devnet" // Symbol is the symbol value // used in Currency. Symbol = "SOL" // Decimals is the decimals value // used in Currency. Decimals = 9 // SuccessStatus is the status of any // Ethereum operation considered successful. SuccessStatus = "SUCCESS" // FailureStatus is the status of any // Ethereum operation considered unsuccessful. FailureStatus = "FAILURE" // HistoricalBalanceSupported is whether // historical balance is supported. HistoricalBalanceSupported = true // GenesisBlockIndex is the index of the // genesis block. GenesisBlockIndex = int64(0) Separator = "__" WithNonceKey = "with_nonce" SplSystemAccMapKey = "spl_system_acc_map" SplTokenAccMapKey = "spl_token_acc_map" MainnetGenesisHash = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d" TestnetGenesisHash = "4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY" DevnetGenesisHash = "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG" )
View Source
const ( System__Transfer = "System__Transfer" System__CreateAccount = "System__CreateAccount" System__Assign = "System__Assign" System__CreateNonceAccount = "System__CreateNonceAccount" System__AdvanceNonce = "System__AdvanceNonce" System__WithdrawFromNonce = "System__WithdrawFromNonce" System__AuthorizeNonce = "System__AuthorizeNonce" System__Allocate = "System__Allocate" SplToken__Transfer = "SplToken__Transfer" SplToken__InitializeMint = "SplToken__InitializeMint" SplToken__InitializeAccount = "SplToken__InitializeAccount" SplToken__CreateToken = "SplToken__CreateToken" SplToken__CreateAccount = "SplToken__CreateAccount" SplToken__Approve = "SplToken__Approve" SplToken__Revoke = "SplToken__Revoke" SplToken_MintTo = "SplToken_MintTo" SplToken_Burn = "SplToken_Burn" SplToken_CloseAccount = "SplToken_CloseAccount" SplToken_FreezeAccount = "SplToken_FreezeAccount" SplToken__TransferChecked = "SplToken__TransferChecked" SplToken__TransferNew = "SplToken__TransferNew" SplToken__TransferWithSystem = "SplToken__TransferWithSystem" SplAssociatedTokenAccount__Create = "SplAssociatedTokenAccount__Create" Unknown = "Unknown" )
Variables ¶
View Source
var ( ErrCallParametersInvalid = errors.New("call parameters invalid") ErrCallOutputMarshal = errors.New("call output marshal") ErrCallMethodInvalid = errors.New("call method invalid") )
Client errors
View Source
var ( // MainnetGenesisBlockIdentifier is the *types.BlockIdentifier // of the mainnet genesis block. MainnetGenesisBlockIdentifier = &types.BlockIdentifier{ Hash: MainnetGenesisHash, Index: GenesisBlockIndex, } // TestnetGenesisBlockIdentifier is the *types.BlockIdentifier // of the testnet genesis block. TestnetGenesisBlockIdentifier = &types.BlockIdentifier{ Hash: TestnetGenesisHash, Index: GenesisBlockIndex, } // TestnetGenesisBlockIdentifier is the *types.BlockIdentifier // of the testnet genesis block. DevnetGenesisHashBlockIdentifier = &types.BlockIdentifier{ Hash: DevnetGenesisHash, Index: GenesisBlockIndex, } // Currency is the *types.Currency for all // Ethereum networks. Currency = &types.Currency{ Symbol: Symbol, Decimals: Decimals, } // OperationTypes are all suppoorted operation types. OperationTypes = []string{ System__Transfer, System__CreateAccount, System__Assign, System__CreateNonceAccount, System__AdvanceNonce, System__WithdrawFromNonce, System__AuthorizeNonce, System__Allocate, SplToken__Transfer, SplToken__InitializeMint, SplToken__InitializeAccount, SplToken__CreateToken, SplToken__CreateAccount, SplToken__Approve, SplToken__Revoke, SplToken_MintTo, SplToken_Burn, SplToken_CloseAccount, SplToken_FreezeAccount, SplToken__TransferChecked, SplToken__TransferNew, SplToken__TransferWithSystem, SplAssociatedTokenAccount__Create, Unknown, } // OperationStatuses are all supported operation statuses. OperationStatuses = []*types.OperationStatus{ { Status: SuccessStatus, Successful: true, }, { Status: FailureStatus, Successful: false, }, } // CallMethods are all supported call methods. CallMethods = []string{ "deregisterNode", "validatorExit", "getAccountInfo", "getBalance", "getBlockTime", "getClusterNodes", "getConfirmedBlock", "getConfirmedBlocks", "getConfirmedBlocksWithLimit", "getConfirmedSignaturesForAddress", "getConfirmedSignaturesForAddress2", "getConfirmedTransaction", "getEpochInfo", "getEpochSchedule", "getFeeCalculatorForBlockhash", "getFeeRateGovernor", "getFees", "getFirstAvailableBlock", "getGenesisHash", "getHealth", "getIdentity", "getInflationGovernor", "getInflationRate", "getLargestAccounts", "getLeaderSchedule", "getMinimumBalanceForRentExemption", "getMultipleAccounts", "getProgramAccounts", "getRecentBlockhash", "getSnapshotSlot", "getSignatureStatuses", "getSlot", "getSlotLeader", "getStorageTurn", "getStorageTurnRate", "getSlotsPerSegment", "getStoragePubkeysForSlot", "getSupply", "getTokenAccountBalance", "getTokenAccountsByDelegate", "getTokenAccountsByOwner", "getTokenSupply", "getTotalSupply", "getTransactionCount", "getVersion", "getVoteAccounts", "minimumLedgerSlot", "registerNode", "requestAirdrop", "sendTransaction", "simulateTransaction", "signVote", } )
Functions ¶
func GetRosOperationsFromTx ¶
func GetRosOperationsFromTx(tx solPTypes.ParsedTransaction, status string) []*types.Operation
func GetTxFromStr ¶
func GetTxFromStr(t string) (solPTypes.Transaction, error)
func IsBalanceChanging ¶
func ParseInstruction ¶
func ParseInstruction(ins solPTypes.Instruction) (solPTypes.ParsedInstruction, error)
func ToParsedTransaction ¶
func ToParsedTransaction(tx solPTypes.Transaction) (solPTypes.ParsedTransaction, error)
func ToRosTx ¶
func ToRosTx(tx solPTypes.ParsedTransaction) RosettaTypes.Transaction
func ToRosTxs ¶
func ToRosTxs(txs []ss.ParsedTransactionWithMeta) []*RosettaTypes.Transaction
func ValueToBaseAmount ¶
Types ¶
type Client ¶
func (*Client) Balance ¶
func (ec *Client) Balance( ctx context.Context, account *RosettaTypes.AccountIdentifier, block *RosettaTypes.PartialBlockIdentifier, ) (*RosettaTypes.AccountBalanceResponse, error)
Balance returns the balance of a *RosettaTypes.AccountIdentifier at a *RosettaTypes.PartialBlockIdentifier.
We must use graphql to get the balance atomically (the rpc method for balance does not allow for querying by block hash nor return the block hash where the balance was fetched).
func (*Client) Block ¶
func (ec *Client) Block( ctx context.Context, blockIdentifier *RosettaTypes.PartialBlockIdentifier, ) (*RosettaTypes.Block, error)
Block returns a populated block at the *RosettaTypes.PartialBlockIdentifier. If neither the hash or index is populated in the *RosettaTypes.PartialBlockIdentifier, the current block is returned.
func (*Client) BlockTransaction ¶
func (ec *Client) BlockTransaction( ctx context.Context, blockTransactionRequest *RosettaTypes.BlockTransactionRequest, ) (*RosettaTypes.Transaction, error)
func (*Client) Call ¶
func (ec *Client) Call( ctx context.Context, request *RosettaTypes.CallRequest, ) (*RosettaTypes.CallResponse, error)
Call handles calls to the /call endpoint.
func (*Client) GetTokenAccountByMint ¶
func (*Client) Status ¶
func (ec *Client) Status(ctx context.Context) ( *RosettaTypes.BlockIdentifier, int64, []*RosettaTypes.Peer, *RosettaTypes.BlockIdentifier, error, )
Status returns geth status information for determining node healthiness.
type GetConfirmedBlockResult ¶
type GetConfirmedBlockResult struct { Blockhash solana.PublicKey `json:"blockhash"` PreviousBlockhash solana.PublicKey `json:"previousBlockhash"` // could be zeroes if ledger was clean-up and this is unavailable ParentSlot bin.Uint64 `json:"parentSlot"` Transactions []dfuserpc.TransactionParsed `json:"transactions"` Rewards []dfuserpc.BlockReward `json:"rewards"` BlockTime bin.Uint64 `json:"blockTime,omitempty"` }
type OpMetaTokenAmount ¶
type ParsedInstructionMeta ¶
type ParsedInstructionMeta struct { Authority string `json:"authority,omitempty"` NewAuthority string `json:"newAuthority,omitempty"` Source string `json:"source,omitempty"` Owner string `json:"owner,omitempty"` Account string `json:"account,omitempty"` Destination string `json:"destination,omitempty"` NewAccount string `json:"newAccount,omitempty"` Mint string `json:"mint,omitempty"` Decimals uint8 `json:"decimals,omitempty"` TokenAmount OpMetaTokenAmount `json:"tokenAmount,omitempty"` Amount uint64 `json:"amount,omitempty"` Lamports uint64 `json:"lamports,omitempty"` Space uint64 `json:"space,omitempty"` }
type SplAccounts ¶
type TokenParsed ¶
Click to show internal directories.
Click to hide internal directories.