From 9c9f6d1799a97b757251283c3231d974b8de9b2c Mon Sep 17 00:00:00 2001 From: Slavomir Date: Wed, 28 Jul 2021 23:52:51 +0200 Subject: [PATCH] Update examples --- README.md | 76 ++++++++++--------- rpc/examples/getAccountInfo/getAccountInfo.go | 4 +- rpc/examples/getBalance/getBalance.go | 2 +- rpc/examples/getBlock/getBlock.go | 4 +- .../getBlockCommitment/getBlockCommitment.go | 2 +- rpc/examples/getBlockHeight/getBlockHeight.go | 2 +- .../getBlockProduction/getBlockProduction.go | 2 +- rpc/examples/getBlockTime/getBlockTime.go | 2 +- rpc/examples/getBlocks/getBlocks.go | 4 +- .../getBlocksWithLimit/getBlocksWithLimit.go | 4 +- .../getConfirmedBlock/getConfirmedBlock.go | 4 +- .../getConfirmedBlocks/getConfirmedBlocks.go | 4 +- .../getConfirmedBlocksWithLimit.go | 4 +- rpc/examples/getEpochInfo/getEpochInfo.go | 2 +- .../getFeeCalculatorForBlockhash.go | 4 +- rpc/examples/getFees/getFees.go | 2 +- .../getInflationGovernor.go | 2 +- .../getInflationReward/getInflationReward.go | 2 +- .../getLargestAccounts/getLargestAccounts.go | 2 +- .../getMinimumBalanceForRentExemption.go | 2 +- .../getMultipleAccounts.go | 2 +- .../getRecentBlockhash/getRecentBlockhash.go | 2 +- rpc/examples/getSlot/getSlot.go | 2 +- rpc/examples/getSlotLeader/getSlotLeader.go | 2 +- rpc/examples/getSlotLeaders/getSlotLeaders.go | 2 +- .../getStakeActivation/getStakeActivation.go | 2 +- rpc/examples/getSupply/getSupply.go | 2 +- .../getTokenAccountBalance.go | 2 +- .../getTokenLargestAccounts.go | 2 +- rpc/examples/getTokenSupply/getTokenSupply.go | 2 +- .../getTransactionCount.go | 2 +- 31 files changed, 78 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 5b79befc..eaa579bd 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,8 @@ func main() { spew.Dump(resp) var mint token.Mint + // Account{}.Data.GetBinary() returns the *decoded* binary data + // regardless the original encoding (it can handle them all). err = bin.NewDecoder(resp.Value.Data.GetBinary()).Decode(&mint) if err != nil { panic(err) @@ -239,7 +241,7 @@ func main() { // You can specify more options here: &rpc.GetAccountInfoOpts{ Encoding: solana.EncodingBase64Zstd, - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // You can get just a part of the account data by specify a DataSlice: // DataSlice: &rpc.DataSlice{ // Offset: pointer.ToUint64(0), @@ -285,7 +287,7 @@ func main() { out, err := client.GetBalance( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -319,7 +321,7 @@ func main() { endpoint := rpc.TestNet_RPC client := rpc.New(endpoint) - example, err := client.GetRecentBlockhash(context.TODO(), rpc.CommitmentType("finalized")) + example, err := client.GetRecentBlockhash(context.TODO(), rpc.CommitmentFinalized) if err != nil { panic(err) } @@ -341,7 +343,7 @@ func main() { // You can specify more options here: &rpc.GetBlockOpts{ Encoding: solana.EncodingBase64, - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // Get only signatures: TransactionDetails: rpc.TransactionDetailsSignatures, // Exclude rewards: @@ -372,7 +374,7 @@ func main() { endpoint := rpc.TestNet_RPC client := rpc.New(endpoint) - example, err := client.GetRecentBlockhash(context.TODO(), rpc.CommitmentType("finalized")) + example, err := client.GetRecentBlockhash(context.TODO(), rpc.CommitmentFinalized) if err != nil { panic(err) } @@ -406,7 +408,7 @@ func main() { out, err := client.GetBlockHeight( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -442,7 +444,7 @@ func main() { out, err := client.GetBlockProductionWithOpts( context.TODO(), &rpc.GetBlockProductionOpts{ - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // Range: &rpc.SlotRangeRequest{ // FirstSlot: XXXXXX, // Identity: solana.MustPublicKeyFromBase58("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), @@ -476,7 +478,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -512,7 +514,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -523,7 +525,7 @@ func main() { context.TODO(), uint64(example.Context.Slot-3), &endSlot, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -550,7 +552,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -561,7 +563,7 @@ func main() { context.TODO(), uint64(example.Context.Slot-10), limit, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -616,7 +618,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -640,7 +642,7 @@ func main() { // You can specify more options here: &rpc.GetConfirmedBlockOpts{ Encoding: solana.EncodingBase64, - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // Get only signatures: TransactionDetails: rpc.TransactionDetailsSignatures, // Exclude rewards: @@ -673,7 +675,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -686,7 +688,7 @@ func main() { context.TODO(), uint64(example.Context.Slot-3), &endSlot, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -714,7 +716,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -726,7 +728,7 @@ func main() { context.TODO(), uint64(example.Context.Slot-10), limit, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -827,7 +829,7 @@ func main() { out, err := client.GetEpochInfo( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -880,7 +882,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -889,7 +891,7 @@ func main() { out, err := client.GetFeeCalculatorForBlockhash( context.TODO(), example.Value.Blockhash, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -942,7 +944,7 @@ func main() { out, err := client.GetFees( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1074,7 +1076,7 @@ func main() { out, err := client.GetInflationGovernor( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1134,7 +1136,7 @@ func main() { pubKey, }, &rpc.GetInflationRewardOpts{ - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, }, ) if err != nil { @@ -1162,7 +1164,7 @@ func main() { out, err := client.GetLargestAccounts( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, rpc.LargestAccountsFilterCirculating, ) if err != nil { @@ -1270,7 +1272,7 @@ func main() { out, err := client.GetMinimumBalanceForRentExemption( context.TODO(), dataSize, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1315,7 +1317,7 @@ func main() { }, &rpc.GetMultipleAccountsOpts{ Encoding: solana.EncodingBase64Zstd, - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // You can get just a part of the account data by specify a DataSlice: // DataSlice: &rpc.DataSlice{ // Offset: pointer.ToUint64(0), @@ -1378,7 +1380,7 @@ func main() { recent, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1492,7 +1494,7 @@ func main() { out, err := client.GetSlot( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1519,7 +1521,7 @@ func main() { out, err := client.GetSlotLeader( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1546,7 +1548,7 @@ func main() { recent, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1611,7 +1613,7 @@ func main() { out, err := client.GetStakeActivation( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, nil, ) if err != nil { @@ -1639,7 +1641,7 @@ func main() { out, err := client.GetSupply( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1669,7 +1671,7 @@ func main() { out, err := client.GetTokenAccountBalance( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1765,7 +1767,7 @@ func main() { out, err := client.GetTokenLargestAccounts( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1795,7 +1797,7 @@ func main() { out, err := client.GetTokenSupply( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -1897,7 +1899,7 @@ func main() { out, err := client.GetTransactionCount( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getAccountInfo/getAccountInfo.go b/rpc/examples/getAccountInfo/getAccountInfo.go index 91b09f9e..31dab4d1 100644 --- a/rpc/examples/getAccountInfo/getAccountInfo.go +++ b/rpc/examples/getAccountInfo/getAccountInfo.go @@ -27,6 +27,8 @@ func main() { spew.Dump(resp) var mint token.Mint + // Account{}.Data.GetBinary() returns the *decoded* binary data + // regardless the original encoding (it can handle them all). err = bin.NewDecoder(resp.Value.Data.GetBinary()).Decode(&mint) if err != nil { panic(err) @@ -61,7 +63,7 @@ func main() { // You can specify more options here: &rpc.GetAccountInfoOpts{ Encoding: solana.EncodingBase64Zstd, - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // You can get just a part of the account data by specify a DataSlice: // DataSlice: &rpc.DataSlice{ // Offset: pointer.ToUint64(0), diff --git a/rpc/examples/getBalance/getBalance.go b/rpc/examples/getBalance/getBalance.go index 148d5d03..8a6b21f3 100644 --- a/rpc/examples/getBalance/getBalance.go +++ b/rpc/examples/getBalance/getBalance.go @@ -18,7 +18,7 @@ func main() { out, err := client.GetBalance( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getBlock/getBlock.go b/rpc/examples/getBlock/getBlock.go index 146227d3..913f15eb 100644 --- a/rpc/examples/getBlock/getBlock.go +++ b/rpc/examples/getBlock/getBlock.go @@ -12,7 +12,7 @@ func main() { endpoint := rpc.TestNet_RPC client := rpc.New(endpoint) - example, err := client.GetRecentBlockhash(context.TODO(), rpc.CommitmentType("finalized")) + example, err := client.GetRecentBlockhash(context.TODO(), rpc.CommitmentFinalized) if err != nil { panic(err) } @@ -34,7 +34,7 @@ func main() { // You can specify more options here: &rpc.GetBlockOpts{ Encoding: solana.EncodingBase64, - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // Get only signatures: TransactionDetails: rpc.TransactionDetailsSignatures, // Exclude rewards: diff --git a/rpc/examples/getBlockCommitment/getBlockCommitment.go b/rpc/examples/getBlockCommitment/getBlockCommitment.go index 2c2270e8..fb0ff52a 100644 --- a/rpc/examples/getBlockCommitment/getBlockCommitment.go +++ b/rpc/examples/getBlockCommitment/getBlockCommitment.go @@ -11,7 +11,7 @@ func main() { endpoint := rpc.TestNet_RPC client := rpc.New(endpoint) - example, err := client.GetRecentBlockhash(context.TODO(), rpc.CommitmentType("finalized")) + example, err := client.GetRecentBlockhash(context.TODO(), rpc.CommitmentFinalized) if err != nil { panic(err) } diff --git a/rpc/examples/getBlockHeight/getBlockHeight.go b/rpc/examples/getBlockHeight/getBlockHeight.go index d3d70a15..c753acf1 100644 --- a/rpc/examples/getBlockHeight/getBlockHeight.go +++ b/rpc/examples/getBlockHeight/getBlockHeight.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetBlockHeight( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getBlockProduction/getBlockProduction.go b/rpc/examples/getBlockProduction/getBlockProduction.go index e679c9a4..735627d4 100644 --- a/rpc/examples/getBlockProduction/getBlockProduction.go +++ b/rpc/examples/getBlockProduction/getBlockProduction.go @@ -22,7 +22,7 @@ func main() { out, err := client.GetBlockProductionWithOpts( context.TODO(), &rpc.GetBlockProductionOpts{ - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // Range: &rpc.SlotRangeRequest{ // FirstSlot: XXXXXX, // Identity: solana.MustPublicKeyFromBase58("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), diff --git a/rpc/examples/getBlockTime/getBlockTime.go b/rpc/examples/getBlockTime/getBlockTime.go index df828f3a..fb3df644 100644 --- a/rpc/examples/getBlockTime/getBlockTime.go +++ b/rpc/examples/getBlockTime/getBlockTime.go @@ -14,7 +14,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getBlocks/getBlocks.go b/rpc/examples/getBlocks/getBlocks.go index 05d1f94a..6b0a997a 100644 --- a/rpc/examples/getBlocks/getBlocks.go +++ b/rpc/examples/getBlocks/getBlocks.go @@ -13,7 +13,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -24,7 +24,7 @@ func main() { context.TODO(), uint64(example.Context.Slot-3), &endSlot, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getBlocksWithLimit/getBlocksWithLimit.go b/rpc/examples/getBlocksWithLimit/getBlocksWithLimit.go index df1e0f34..b52687aa 100644 --- a/rpc/examples/getBlocksWithLimit/getBlocksWithLimit.go +++ b/rpc/examples/getBlocksWithLimit/getBlocksWithLimit.go @@ -13,7 +13,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -24,7 +24,7 @@ func main() { context.TODO(), uint64(example.Context.Slot-10), limit, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getConfirmedBlock/getConfirmedBlock.go b/rpc/examples/getConfirmedBlock/getConfirmedBlock.go index 0c33c7d6..01f907cb 100644 --- a/rpc/examples/getConfirmedBlock/getConfirmedBlock.go +++ b/rpc/examples/getConfirmedBlock/getConfirmedBlock.go @@ -15,7 +15,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -39,7 +39,7 @@ func main() { // You can specify more options here: &rpc.GetConfirmedBlockOpts{ Encoding: solana.EncodingBase64, - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // Get only signatures: TransactionDetails: rpc.TransactionDetailsSignatures, // Exclude rewards: diff --git a/rpc/examples/getConfirmedBlocks/getConfirmedBlocks.go b/rpc/examples/getConfirmedBlocks/getConfirmedBlocks.go index 25242b1a..a9d834a9 100644 --- a/rpc/examples/getConfirmedBlocks/getConfirmedBlocks.go +++ b/rpc/examples/getConfirmedBlocks/getConfirmedBlocks.go @@ -13,7 +13,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -26,7 +26,7 @@ func main() { context.TODO(), uint64(example.Context.Slot-3), &endSlot, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getConfirmedBlocksWithLimit/getConfirmedBlocksWithLimit.go b/rpc/examples/getConfirmedBlocksWithLimit/getConfirmedBlocksWithLimit.go index 72984d2b..1cac8588 100644 --- a/rpc/examples/getConfirmedBlocksWithLimit/getConfirmedBlocksWithLimit.go +++ b/rpc/examples/getConfirmedBlocksWithLimit/getConfirmedBlocksWithLimit.go @@ -13,7 +13,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -25,7 +25,7 @@ func main() { context.TODO(), uint64(example.Context.Slot-10), limit, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getEpochInfo/getEpochInfo.go b/rpc/examples/getEpochInfo/getEpochInfo.go index 42eb0ce0..b149e831 100644 --- a/rpc/examples/getEpochInfo/getEpochInfo.go +++ b/rpc/examples/getEpochInfo/getEpochInfo.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetEpochInfo( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getFeeCalculatorForBlockhash/getFeeCalculatorForBlockhash.go b/rpc/examples/getFeeCalculatorForBlockhash/getFeeCalculatorForBlockhash.go index 7c77d41a..ec0199ee 100644 --- a/rpc/examples/getFeeCalculatorForBlockhash/getFeeCalculatorForBlockhash.go +++ b/rpc/examples/getFeeCalculatorForBlockhash/getFeeCalculatorForBlockhash.go @@ -13,7 +13,7 @@ func main() { example, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) @@ -22,7 +22,7 @@ func main() { out, err := client.GetFeeCalculatorForBlockhash( context.TODO(), example.Value.Blockhash, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getFees/getFees.go b/rpc/examples/getFees/getFees.go index b2309440..688882a3 100644 --- a/rpc/examples/getFees/getFees.go +++ b/rpc/examples/getFees/getFees.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetFees( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getInflationGovernor/getInflationGovernor.go b/rpc/examples/getInflationGovernor/getInflationGovernor.go index 9e703f63..ec159247 100644 --- a/rpc/examples/getInflationGovernor/getInflationGovernor.go +++ b/rpc/examples/getInflationGovernor/getInflationGovernor.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetInflationGovernor( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getInflationReward/getInflationReward.go b/rpc/examples/getInflationReward/getInflationReward.go index cbc96f88..98630355 100644 --- a/rpc/examples/getInflationReward/getInflationReward.go +++ b/rpc/examples/getInflationReward/getInflationReward.go @@ -20,7 +20,7 @@ func main() { pubKey, }, &rpc.GetInflationRewardOpts{ - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, }, ) if err != nil { diff --git a/rpc/examples/getLargestAccounts/getLargestAccounts.go b/rpc/examples/getLargestAccounts/getLargestAccounts.go index e7ed34e6..631accc2 100644 --- a/rpc/examples/getLargestAccounts/getLargestAccounts.go +++ b/rpc/examples/getLargestAccounts/getLargestAccounts.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetLargestAccounts( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, rpc.LargestAccountsFilterCirculating, ) if err != nil { diff --git a/rpc/examples/getMinimumBalanceForRentExemption/getMinimumBalanceForRentExemption.go b/rpc/examples/getMinimumBalanceForRentExemption/getMinimumBalanceForRentExemption.go index b285d5d0..61ca2d2d 100644 --- a/rpc/examples/getMinimumBalanceForRentExemption/getMinimumBalanceForRentExemption.go +++ b/rpc/examples/getMinimumBalanceForRentExemption/getMinimumBalanceForRentExemption.go @@ -15,7 +15,7 @@ func main() { out, err := client.GetMinimumBalanceForRentExemption( context.TODO(), dataSize, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getMultipleAccounts/getMultipleAccounts.go b/rpc/examples/getMultipleAccounts/getMultipleAccounts.go index 22904c06..11daa4e7 100644 --- a/rpc/examples/getMultipleAccounts/getMultipleAccounts.go +++ b/rpc/examples/getMultipleAccounts/getMultipleAccounts.go @@ -31,7 +31,7 @@ func main() { }, &rpc.GetMultipleAccountsOpts{ Encoding: solana.EncodingBase64Zstd, - Commitment: rpc.CommitmentType("finalized"), + Commitment: rpc.CommitmentFinalized, // You can get just a part of the account data by specify a DataSlice: // DataSlice: &rpc.DataSlice{ // Offset: pointer.ToUint64(0), diff --git a/rpc/examples/getRecentBlockhash/getRecentBlockhash.go b/rpc/examples/getRecentBlockhash/getRecentBlockhash.go index 7f189e23..56da9a6e 100644 --- a/rpc/examples/getRecentBlockhash/getRecentBlockhash.go +++ b/rpc/examples/getRecentBlockhash/getRecentBlockhash.go @@ -13,7 +13,7 @@ func main() { recent, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getSlot/getSlot.go b/rpc/examples/getSlot/getSlot.go index 6b8a59e7..4ac4398b 100644 --- a/rpc/examples/getSlot/getSlot.go +++ b/rpc/examples/getSlot/getSlot.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetSlot( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getSlotLeader/getSlotLeader.go b/rpc/examples/getSlotLeader/getSlotLeader.go index a4e22914..080254fc 100644 --- a/rpc/examples/getSlotLeader/getSlotLeader.go +++ b/rpc/examples/getSlotLeader/getSlotLeader.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetSlotLeader( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getSlotLeaders/getSlotLeaders.go b/rpc/examples/getSlotLeaders/getSlotLeaders.go index 00dc03af..27b4bde9 100644 --- a/rpc/examples/getSlotLeaders/getSlotLeaders.go +++ b/rpc/examples/getSlotLeaders/getSlotLeaders.go @@ -13,7 +13,7 @@ func main() { recent, err := client.GetRecentBlockhash( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getStakeActivation/getStakeActivation.go b/rpc/examples/getStakeActivation/getStakeActivation.go index 1b8796df..e9e87fd3 100644 --- a/rpc/examples/getStakeActivation/getStakeActivation.go +++ b/rpc/examples/getStakeActivation/getStakeActivation.go @@ -16,7 +16,7 @@ func main() { out, err := client.GetStakeActivation( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, nil, ) if err != nil { diff --git a/rpc/examples/getSupply/getSupply.go b/rpc/examples/getSupply/getSupply.go index 13c03da4..ef0c1754 100644 --- a/rpc/examples/getSupply/getSupply.go +++ b/rpc/examples/getSupply/getSupply.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetSupply( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getTokenAccountBalance/getTokenAccountBalance.go b/rpc/examples/getTokenAccountBalance/getTokenAccountBalance.go index 79fde936..71992ee3 100644 --- a/rpc/examples/getTokenAccountBalance/getTokenAccountBalance.go +++ b/rpc/examples/getTokenAccountBalance/getTokenAccountBalance.go @@ -16,7 +16,7 @@ func main() { out, err := client.GetTokenAccountBalance( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getTokenLargestAccounts/getTokenLargestAccounts.go b/rpc/examples/getTokenLargestAccounts/getTokenLargestAccounts.go index 1ccb8d60..045dce0f 100644 --- a/rpc/examples/getTokenLargestAccounts/getTokenLargestAccounts.go +++ b/rpc/examples/getTokenLargestAccounts/getTokenLargestAccounts.go @@ -16,7 +16,7 @@ func main() { out, err := client.GetTokenLargestAccounts( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getTokenSupply/getTokenSupply.go b/rpc/examples/getTokenSupply/getTokenSupply.go index a2edda67..26b36847 100644 --- a/rpc/examples/getTokenSupply/getTokenSupply.go +++ b/rpc/examples/getTokenSupply/getTokenSupply.go @@ -16,7 +16,7 @@ func main() { out, err := client.GetTokenSupply( context.TODO(), pubKey, - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err) diff --git a/rpc/examples/getTransactionCount/getTransactionCount.go b/rpc/examples/getTransactionCount/getTransactionCount.go index 7d3ecfc5..bbbf6337 100644 --- a/rpc/examples/getTransactionCount/getTransactionCount.go +++ b/rpc/examples/getTransactionCount/getTransactionCount.go @@ -13,7 +13,7 @@ func main() { out, err := client.GetTransactionCount( context.TODO(), - rpc.CommitmentType("finalized"), + rpc.CommitmentFinalized, ) if err != nil { panic(err)