2020-11-06 08:38:43 -08:00
|
|
|
package rpc
|
2020-07-31 09:17:36 -07:00
|
|
|
|
2020-11-06 07:40:28 -08:00
|
|
|
import (
|
2020-11-06 08:38:43 -08:00
|
|
|
"github.com/dfuse-io/solana-go"
|
2020-11-06 07:40:28 -08:00
|
|
|
)
|
|
|
|
|
2020-07-31 13:34:44 -07:00
|
|
|
// type ContactInfo struct {
|
|
|
|
// Pubkey string `json:"pubkey"`
|
|
|
|
// Gossip string `json:"gossip,omitempty"`
|
|
|
|
// TPU string `json:"tpu,omitempty"`
|
|
|
|
// RPC string `json:"rpc,omitempty"`
|
|
|
|
// Version string `json:"version,omitempty"`
|
|
|
|
// }
|
2020-07-31 09:17:36 -07:00
|
|
|
|
|
|
|
type RPCContext struct {
|
|
|
|
Context struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Slot solana.U64
|
2020-07-31 09:17:36 -07:00
|
|
|
} `json:"context,omitempty"`
|
|
|
|
}
|
2020-07-31 13:34:44 -07:00
|
|
|
|
|
|
|
///
|
|
|
|
|
2020-07-31 14:54:41 -07:00
|
|
|
type GetBalanceResult struct {
|
2020-07-31 09:17:36 -07:00
|
|
|
RPCContext
|
2020-11-06 08:38:43 -08:00
|
|
|
Value solana.U64 `json:"value"`
|
2020-07-31 09:17:36 -07:00
|
|
|
}
|
|
|
|
|
2020-07-31 13:34:44 -07:00
|
|
|
///
|
|
|
|
|
2020-11-06 08:38:43 -08:00
|
|
|
type GetSlotResult solana.U64
|
2020-07-31 14:54:41 -07:00
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
type GetRecentBlockhashResult struct {
|
|
|
|
RPCContext
|
|
|
|
Value BlockhashResult `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type BlockhashResult struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Blockhash solana.PublicKey `json:"blockhash"` /* make this a `Hash` type, which is a copy of the PublicKey` type */
|
|
|
|
FeeCalculator FeeCalculator `json:"feeCalculator"`
|
2020-07-31 14:54:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
type FeeCalculator struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
LamportsPerSignature solana.U64 `json:"lamportsPerSignature"`
|
2020-07-31 14:54:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
type GetConfirmedBlockResult struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Blockhash solana.PublicKey `json:"blockhash"`
|
|
|
|
PreviousBlockhash solana.PublicKey `json:"previousBlockhash"` // could be zeroes if ledger was clean-up and this is unavailable
|
|
|
|
ParentSlot solana.U64 `json:"parentSlot"`
|
2020-07-31 14:54:41 -07:00
|
|
|
Transactions []TransactionWithMeta `json:"transactions"`
|
|
|
|
Rewards []BlockReward `json:"rewards"`
|
2020-11-06 08:38:43 -08:00
|
|
|
BlockTime solana.U64 `json:"blockTime,omitempty"`
|
2020-07-31 14:54:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
type BlockReward struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Pubkey solana.PublicKey `json:"pubkey"`
|
|
|
|
Lamports solana.U64 `json:"lamports"`
|
2020-07-31 14:54:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
type TransactionWithMeta struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Transaction *solana.Transaction `json:"transaction"`
|
|
|
|
Meta *TransactionMeta `json:"meta,omitempty"`
|
2020-07-31 14:54:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
type TransactionMeta struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Err interface{} `json:"err"`
|
|
|
|
Fee solana.U64 `json:"fee"`
|
|
|
|
PreBalances []solana.U64 `json:"preBalances"`
|
|
|
|
PostBalances []solana.U64 `json:"postBalances"`
|
2020-07-31 14:54:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
type GetAccountInfoResult struct {
|
2020-07-31 09:17:36 -07:00
|
|
|
RPCContext
|
2020-07-31 13:34:44 -07:00
|
|
|
Value *Account `json:"value"`
|
2020-07-31 09:17:36 -07:00
|
|
|
}
|
2020-07-31 13:34:44 -07:00
|
|
|
|
|
|
|
type Account struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Lamports solana.U64 `json:"lamports"`
|
2020-11-09 09:59:24 -08:00
|
|
|
Data solana.Data `json:"data"`
|
2020-11-06 08:38:43 -08:00
|
|
|
Owner solana.PublicKey `json:"owner"`
|
|
|
|
Executable bool `json:"executable"`
|
|
|
|
RentEpoch solana.U64 `json:"rentEpoch"`
|
2020-07-31 09:17:36 -07:00
|
|
|
}
|
|
|
|
|
2020-07-31 13:34:44 -07:00
|
|
|
type KeyedAccount struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Pubkey solana.PublicKey `json:"pubkey"`
|
|
|
|
Account *Account `json:"account"`
|
2020-07-31 13:34:44 -07:00
|
|
|
}
|
2020-07-31 14:54:41 -07:00
|
|
|
type GetProgramAccountsResult []*KeyedAccount
|
2020-07-31 13:34:44 -07:00
|
|
|
|
|
|
|
type GetProgramAccountsOpts struct {
|
|
|
|
Commitment CommitmentType `json:"commitment,omitempty"`
|
|
|
|
|
|
|
|
// Filter on accounts, implicit AND between filters
|
|
|
|
Filters []RPCFilter `json:"filters,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type RPCFilter struct {
|
|
|
|
Memcmp *RPCFilterMemcmp `json:"memcmp,omitempty"`
|
2020-11-06 08:38:43 -08:00
|
|
|
DataSize solana.U64 `json:"dataSize,omitempty"`
|
2020-07-31 13:34:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
type RPCFilterMemcmp struct {
|
2020-11-06 08:38:43 -08:00
|
|
|
Offset int `json:"offset"`
|
|
|
|
Bytes solana.Base58 `json:"bytes"`
|
2020-07-31 13:34:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
///
|
|
|
|
|
2020-07-31 09:17:36 -07:00
|
|
|
type CommitmentType string
|
|
|
|
|
|
|
|
const (
|
|
|
|
CommitmentMax = CommitmentType("max")
|
|
|
|
CommitmentRecent = CommitmentType("recent")
|
|
|
|
CommitmentRoot = CommitmentType("root")
|
|
|
|
CommitmentSingle = CommitmentType("single")
|
|
|
|
CommitmentSingleGossip = CommitmentType("singleGossip")
|
|
|
|
)
|