Use uint64

This commit is contained in:
Slavomir 2021-07-09 17:56:15 +02:00
parent 1979dbf4bf
commit 8a0f582db6
13 changed files with 39 additions and 39 deletions

View File

@ -72,8 +72,8 @@ func TestClient_GetAccountInfoWithOpts(t *testing.T) {
defer closer()
client := NewClient(server.URL)
offset := 22
length := 33
offset := uint64(22)
length := uint64(33)
pubkeyString := "7xLk17EQQ5KLDLDe44wCmupJKJjTGd8hs3eSVVhCx932"
pubKey := solana.MustPublicKeyFromBase58(pubkeyString)
@ -337,7 +337,7 @@ func TestClient_decode_GetBlock(t *testing.T) {
block := 33
out, err := client.GetBlock(
context.Background(),
block,
uint64(block),
)
require.NoError(t, err)
@ -488,7 +488,7 @@ func TestClient_decode_GetBlockWithOpts(t *testing.T) {
rewards := true
_, err := client.GetBlockWithOpts(
context.Background(),
block,
uint64(block),
&GetBlockOpts{
TransactionDetails: TransactionDetailsSignatures,
Rewards: &rewards,
@ -589,8 +589,8 @@ func TestClient_decode_GetBlockProductionWithOpts(t *testing.T) {
client := NewClient(server.URL)
// NOTE: the parameters don't make a difference here because the response is already defined.
firstSlot := 2
lastSlot := 3
firstSlot := uint64(2)
lastSlot := uint64(3)
identity := "dummy"
_, err := client.GetBlockProductionWithOpts(
context.Background(),
@ -635,7 +635,7 @@ func TestClient_decode_GetBlockCommitment(t *testing.T) {
// NOTE: the parameters don't make a difference here because the response is already defined.
out, err := client.GetBlockCommitment(
context.Background(),
block,
uint64(block),
)
require.NoError(t, err)
@ -700,10 +700,10 @@ func TestClient_decode_GetBlocks(t *testing.T) {
// NOTE: the parameters don't make a difference here because the response is already defined.
startSlot := 1
endSlot := 33
endSlot := uint64(33)
out, err := client.GetBlocks(
context.Background(),
startSlot,
uint64(startSlot),
&endSlot,
CommitmentMax,
)
@ -740,10 +740,10 @@ func TestClient_decode_GetBlocksWithLimit(t *testing.T) {
// NOTE: the parameters don't make a difference here because the response is already defined.
startSlot := 1
limit := 10
limit := uint64(10)
out, err := client.GetBlocksWithLimit(
context.Background(),
startSlot,
uint64(startSlot),
limit,
CommitmentMax,
)
@ -782,7 +782,7 @@ func TestClient_decode_GetBlockTime(t *testing.T) {
block := 55
out, err := client.GetBlockTime(
context.Background(),
block,
uint64(block),
)
require.NoError(t, err)
@ -1185,7 +1185,7 @@ func TestClient_decode_GetInflationReward(t *testing.T) {
keys := []solana.PublicKey{
pubKey,
}
epoch := 56
epoch := uint64(56)
opts := GetInflationRewardOpts{
Commitment: CommitmentMax,
Epoch: &epoch,
@ -1353,7 +1353,7 @@ func TestClient_decode_GetLeaderSchedule(t *testing.T) {
client := NewClient(server.URL)
// NOTE: the parameters don't make a difference here because the response is already defined.
epoch := 333
epoch := uint64(333)
identity := "TODO" // TODO: what is an identity ???
out, err := client.GetLeaderScheduleWithOpts(
context.Background(),
@ -1538,8 +1538,8 @@ func TestClient_decode_GetProgramAccounts(t *testing.T) {
pubkeyString := "7xLk17EQQ5KLDLDe44wCmupJKJjTGd8hs3eSVVhCx932"
pubKey := solana.MustPublicKeyFromBase58(pubkeyString)
offset := 13
length := 30
offset := uint64(13)
length := uint64(30)
opts := GetProgramAccountsOpts{
Commitment: CommitmentMax,
Encoding: EncodingBase58,
@ -1837,8 +1837,8 @@ func TestClient_decode_GetSlotLeaders(t *testing.T) {
client := NewClient(server.URL)
// NOTE: the parameters don't make a difference here because the response is already defined.
start := 83220831
limit := 10
start := uint64(83220831)
limit := uint64(10)
out, err := client.GetSlotLeaders(
context.Background(),
start,
@ -2220,7 +2220,7 @@ func TestClient_decode_RequestAirdrop(t *testing.T) {
pubkeyString := "7xLk17EQQ5KLDLDe44wCmupJKJjTGd8hs3eSVVhCx932"
pubKey := solana.MustPublicKeyFromBase58(pubkeyString)
// NOTE: the parameters don't make a difference here because the response is already defined.
lamports := 10000000
lamports := uint64(10000000)
out, err := client.RequestAirdrop(
context.Background(),
pubKey,

View File

@ -48,8 +48,8 @@ func (cl *Client) GetAccountDataIn(ctx context.Context, account solana.PublicKey
type GetAccountInfoOpts struct {
Encoding EncodingType
Commitment CommitmentType
Offset *int
Length *int
Offset *uint64
Length *uint64
}
// GetAccountInfoWithOpts returns all information associated with the account of provided publicKey.

View File

@ -11,7 +11,7 @@ import (
// NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlock for solana-core v1.6
func (cl *Client) GetBlock(
ctx context.Context,
slot int,
slot uint64,
) (out *GetBlockResult, err error) {
return cl.GetBlockWithOpts(
ctx,
@ -38,7 +38,7 @@ type GetBlockOpts struct {
func (cl *Client) GetBlockWithOpts(
ctx context.Context,
slot int,
slot uint64,
opts *GetBlockOpts,
) (out *GetBlockResult, err error) {
obj := M{

View File

@ -19,7 +19,7 @@ type GetBlockCommitmentResult struct {
// GetBlockCommitment returns commitment for particular block.
func (cl *Client) GetBlockCommitment(
ctx context.Context,
block int, // block, identified by Slot
block uint64, // block, identified by Slot
) (out *GetBlockCommitmentResult, err error) {
params := []interface{}{block}
err = cl.rpcClient.CallFor(&out, "getBlockCommitment", params)

View File

@ -23,8 +23,8 @@ type SlotRangeResponse struct {
LastSlot bin.Uint64 `json:"lastSlot"` // last slot of block production information (inclusive)
}
type SlotRangeRequest struct {
FirstSlot int `json:"firstSlot"` // first slot to return block production information for (inclusive)
LastSlot *int `json:"lastSlot,omitempty"` // (optional) last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot
FirstSlot uint64 `json:"firstSlot"` // first slot to return block production information for (inclusive)
LastSlot *uint64 `json:"lastSlot,omitempty"` // (optional) last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot
Identity *string `json:"identity,omitempty"` // (optional) Only return results for this validator identity (base-58 encoded)
}

View File

@ -19,7 +19,7 @@ type GetBlockTimeResult int64
// or nil if the timestamp is not available for this block.
func (cl *Client) GetBlockTime(
ctx context.Context,
block int, // block, identified by Slot
block uint64, // block, identified by Slot
) (out *GetBlockTimeResult, err error) {
params := []interface{}{block}
err = cl.rpcClient.CallFor(&out, "getBlockTime", params)

View File

@ -16,8 +16,8 @@ type BlocksResult []bin.Uint64
// confirmed block, inclusive. Max range allowed is 500,000 slots.
func (cl *Client) GetBlocks(
ctx context.Context,
startSlot int,
endSlot *int,
startSlot uint64,
endSlot *uint64,
commitment CommitmentType,
) (out *BlocksResult, err error) {
params := []interface{}{startSlot}

View File

@ -11,8 +11,8 @@ import (
// confirmed blocks starting at startSlot for up to limit blocks, inclusive.
func (cl *Client) GetBlocksWithLimit(
ctx context.Context,
startSlot int,
limit int,
startSlot uint64,
limit uint64,
commitment CommitmentType, // "processed" is not supported. If parameter not provided, the default is "finalized".
) (out *BlocksResult, err error) {
params := []interface{}{startSlot, limit}

View File

@ -16,7 +16,7 @@ type GetInflationRewardResult struct {
type GetInflationRewardOpts struct {
Commitment CommitmentType
Epoch *int
Epoch *uint64
}
// GetInflationReward returns the inflation reward for a list of addresses for an epoch.

View File

@ -23,7 +23,7 @@ func (cl *Client) GetLeaderSchedule(
}
type GetLeaderScheduleOpts struct {
Epoch *int // Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched
Epoch *uint64 // Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched
Commitment CommitmentType
// TODO: is identity a pubkey?
Identity string // Only return results for this validator identity (base-58 encoded)

View File

@ -9,8 +9,8 @@ import (
// GetSlotLeaders returns the slot leaders for a given slot range.
func (cl *Client) GetSlotLeaders(
ctx context.Context,
start int,
limit int,
start uint64,
limit uint64,
) (out []solana.PublicKey, err error) {
params := []interface{}{start, limit}
err = cl.rpcClient.CallFor(&out, "getSlotLeaders", params)

View File

@ -23,7 +23,7 @@ import (
func (cl *Client) RequestAirdrop(
ctx context.Context,
account solana.PublicKey,
lamport int,
lamport uint64,
commitment CommitmentType,
) (signature solana.Signature, err error) {
params := []interface{}{

View File

@ -146,8 +146,8 @@ type Account struct {
}
type DataSlice struct {
Offset *int `json:"offset,omitempty"`
Length *int `json:"length,omitempty"`
Offset *uint64 `json:"offset,omitempty"`
Length *uint64 `json:"length,omitempty"`
}
type GetProgramAccountsOpts struct {
Commitment CommitmentType `json:"commitment,omitempty"`
@ -184,7 +184,7 @@ type RPCFilter struct {
}
type RPCFilterMemcmp struct {
Offset int `json:"offset"`
Offset uint64 `json:"offset"`
Bytes solana.Base58 `json:"bytes"`
}