solana-ruby-kit 7.1.1.1 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +24 -0
- data/lib/solana/ruby/kit/errors.rb +8 -0
- data/lib/solana/ruby/kit/functional.rb +1 -1
- data/lib/solana/ruby/kit/instruction_plans/instruction_plan.rb +13 -1
- data/lib/solana/ruby/kit/instruction_plans/transaction_plan.rb +9 -0
- data/lib/solana/ruby/kit/instruction_plans/transaction_plan_executor.rb +117 -2
- data/lib/solana/ruby/kit/instruction_plans/transaction_plan_result.rb +18 -0
- data/lib/solana/ruby/kit/instruction_plans/transaction_planner.rb +24 -2
- data/lib/solana/ruby/kit/rpc/api/get_account_info.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_ag_genesis_cert.rb +72 -0
- data/lib/solana/ruby/kit/rpc/api/get_balance.rb +4 -0
- data/lib/solana/ruby/kit/rpc/api/get_block_height.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_block_time.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_epoch_info.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_epoch_schedule.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_inflation_reward.rb +6 -1
- data/lib/solana/ruby/kit/rpc/api/get_latest_blockhash.rb +4 -0
- data/lib/solana/ruby/kit/rpc/api/get_minimum_balance_for_rent_exemption.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_multiple_accounts.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_program_accounts.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_signature_statuses.rb +4 -0
- data/lib/solana/ruby/kit/rpc/api/get_signatures_for_address.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_slot.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_token_account_balance.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_token_accounts_by_owner.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_token_supply.rb +43 -0
- data/lib/solana/ruby/kit/rpc/api/get_transaction.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_transactions_for_address.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/get_vote_accounts.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/has_transport.rb +25 -0
- data/lib/solana/ruby/kit/rpc/api/is_blockhash_valid.rb +4 -0
- data/lib/solana/ruby/kit/rpc/api/request_airdrop.rb +4 -0
- data/lib/solana/ruby/kit/rpc/api/send_transaction.rb +5 -0
- data/lib/solana/ruby/kit/rpc/api/simulate_transaction.rb +5 -0
- data/lib/solana/ruby/kit/rpc/client.rb +8 -1
- data/lib/solana/ruby/kit/rpc_subscriptions/api/account_notifications.rb +5 -0
- data/lib/solana/ruby/kit/rpc_subscriptions/api/has_transport.rb +35 -0
- data/lib/solana/ruby/kit/rpc_subscriptions/api/logs_notifications.rb +5 -0
- data/lib/solana/ruby/kit/rpc_subscriptions/api/program_notifications.rb +5 -0
- data/lib/solana/ruby/kit/rpc_subscriptions/api/root_notifications.rb +5 -0
- data/lib/solana/ruby/kit/rpc_subscriptions/api/signature_notifications.rb +5 -0
- data/lib/solana/ruby/kit/rpc_subscriptions/api/slot_notifications.rb +5 -0
- data/lib/solana/ruby/kit/rpc_subscriptions/client.rb +5 -2
- data/lib/solana/ruby/kit/rpc_types/sol.rb +8 -6
- data/lib/solana/ruby/kit/subscribable/reactive_action_store.rb +6 -6
- data/lib/solana/ruby/kit/subscribable/reactive_stream_store.rb +4 -4
- data/lib/solana/ruby/kit/transaction_messages/compute_budget.rb +6 -4
- data/lib/solana/ruby/kit/transaction_messages/resource_limit_validation.rb +70 -0
- data/lib/solana/ruby/kit/transaction_messages.rb +1 -0
- data/lib/solana/ruby/kit/version.rb +1 -1
- data/lib/solana/ruby/kit/wallet_standard.rb +4 -4
- metadata +6 -3
- data/lib/core_extensions/tapioca/name_patch.rb +0 -32
- data/lib/core_extensions/tapioca/required_ancestors.rb +0 -13
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -22,6 +24,9 @@ module Solana::Ruby::Kit
|
|
|
22
24
|
# Mirrors TypeScript's GetEpochInfoApi.getEpochInfo.
|
|
23
25
|
module GetEpochInfo
|
|
24
26
|
extend T::Sig
|
|
27
|
+
extend T::Helpers
|
|
28
|
+
|
|
29
|
+
requires_ancestor { HasTransport }
|
|
25
30
|
|
|
26
31
|
sig do
|
|
27
32
|
params(commitment: T.nilable(Symbol)).returns(T.untyped)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -21,6 +23,9 @@ module Solana::Ruby::Kit
|
|
|
21
23
|
# Mirrors TypeScript's GetEpochScheduleApi.getEpochSchedule.
|
|
22
24
|
module GetEpochSchedule
|
|
23
25
|
extend T::Sig
|
|
26
|
+
extend T::Helpers
|
|
27
|
+
|
|
28
|
+
requires_ancestor { HasTransport }
|
|
24
29
|
|
|
25
30
|
sig { returns(T.untyped) }
|
|
26
31
|
def get_epoch_schedule
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -24,6 +26,9 @@ module Solana::Ruby::Kit
|
|
|
24
26
|
# Mirrors TypeScript's GetInflationRewardApi.getInflationReward.
|
|
25
27
|
module GetInflationReward
|
|
26
28
|
extend T::Sig
|
|
29
|
+
extend T::Helpers
|
|
30
|
+
|
|
31
|
+
requires_ancestor { HasTransport }
|
|
27
32
|
|
|
28
33
|
sig do
|
|
29
34
|
params(
|
|
@@ -31,7 +36,7 @@ module Solana::Ruby::Kit
|
|
|
31
36
|
commitment: T.nilable(Symbol),
|
|
32
37
|
epoch: T.nilable(Integer),
|
|
33
38
|
min_context_slot: T.nilable(Integer)
|
|
34
|
-
).returns(T::Array[T.
|
|
39
|
+
).returns(T::Array[T.untyped])
|
|
35
40
|
end
|
|
36
41
|
def get_inflation_reward(addresses, commitment: nil, epoch: nil, min_context_slot: nil)
|
|
37
42
|
addr_strings = addresses.map { |a| a.respond_to?(:value) ? a.value : a.to_s }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
4
5
|
require_relative '../../rpc_types/account_info'
|
|
5
6
|
|
|
6
7
|
module Solana::Ruby::Kit
|
|
@@ -21,6 +22,9 @@ module Solana::Ruby::Kit
|
|
|
21
22
|
# .value — LatestBlockhash
|
|
22
23
|
module GetLatestBlockhash
|
|
23
24
|
extend T::Sig
|
|
25
|
+
extend T::Helpers
|
|
26
|
+
|
|
27
|
+
requires_ancestor { HasTransport }
|
|
24
28
|
|
|
25
29
|
sig do
|
|
26
30
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -9,6 +11,9 @@ module Solana::Ruby::Kit
|
|
|
9
11
|
# Mirrors `GetMinimumBalanceForRentExemptionApi.getMinimumBalanceForRentExemption()`.
|
|
10
12
|
module GetMinimumBalanceForRentExemption
|
|
11
13
|
extend T::Sig
|
|
14
|
+
extend T::Helpers
|
|
15
|
+
|
|
16
|
+
requires_ancestor { HasTransport }
|
|
12
17
|
|
|
13
18
|
sig do
|
|
14
19
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
require 'base64'
|
|
5
7
|
|
|
6
8
|
module Solana::Ruby::Kit
|
|
@@ -10,6 +12,9 @@ module Solana::Ruby::Kit
|
|
|
10
12
|
# Mirrors TypeScript's GetMultipleAccountsApi.getMultipleAccounts.
|
|
11
13
|
module GetMultipleAccounts
|
|
12
14
|
extend T::Sig
|
|
15
|
+
extend T::Helpers
|
|
16
|
+
|
|
17
|
+
requires_ancestor { HasTransport }
|
|
13
18
|
|
|
14
19
|
sig do
|
|
15
20
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -10,6 +12,9 @@ module Solana::Ruby::Kit
|
|
|
10
12
|
# Returns an Array of { pubkey:, account: AccountInfoWithBase64Data }.
|
|
11
13
|
module GetProgramAccounts
|
|
12
14
|
extend T::Sig
|
|
15
|
+
extend T::Helpers
|
|
16
|
+
|
|
17
|
+
requires_ancestor { HasTransport }
|
|
13
18
|
|
|
14
19
|
sig do
|
|
15
20
|
params(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
4
5
|
require_relative '../../rpc_types/account_info'
|
|
5
6
|
|
|
6
7
|
module Solana::Ruby::Kit
|
|
@@ -23,6 +24,9 @@ module Solana::Ruby::Kit
|
|
|
23
24
|
# .value — Array of SignatureStatus | nil (nil for unknown signatures)
|
|
24
25
|
module GetSignatureStatuses
|
|
25
26
|
extend T::Sig
|
|
27
|
+
extend T::Helpers
|
|
28
|
+
|
|
29
|
+
requires_ancestor { HasTransport }
|
|
26
30
|
|
|
27
31
|
sig do
|
|
28
32
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -25,6 +27,9 @@ module Solana::Ruby::Kit
|
|
|
25
27
|
# See https://solana.com/docs/rpc/http/getsignaturesforaddress
|
|
26
28
|
module GetSignaturesForAddress
|
|
27
29
|
extend T::Sig
|
|
30
|
+
extend T::Helpers
|
|
31
|
+
|
|
32
|
+
requires_ancestor { HasTransport }
|
|
28
33
|
|
|
29
34
|
sig do
|
|
30
35
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -8,6 +10,9 @@ module Solana::Ruby::Kit
|
|
|
8
10
|
# Mirrors TypeScript's `GetSlotApi.getSlot()`.
|
|
9
11
|
module GetSlot
|
|
10
12
|
extend T::Sig
|
|
13
|
+
extend T::Helpers
|
|
14
|
+
|
|
15
|
+
requires_ancestor { HasTransport }
|
|
11
16
|
|
|
12
17
|
sig do
|
|
13
18
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -8,6 +10,9 @@ module Solana::Ruby::Kit
|
|
|
8
10
|
# Mirrors TypeScript's GetTokenAccountBalanceApi.getTokenAccountBalance.
|
|
9
11
|
module GetTokenAccountBalance
|
|
10
12
|
extend T::Sig
|
|
13
|
+
extend T::Helpers
|
|
14
|
+
|
|
15
|
+
requires_ancestor { HasTransport }
|
|
11
16
|
|
|
12
17
|
sig do
|
|
13
18
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -10,6 +12,9 @@ module Solana::Ruby::Kit
|
|
|
10
12
|
# { 'programId' => program_id }
|
|
11
13
|
module GetTokenAccountsByOwner
|
|
12
14
|
extend T::Sig
|
|
15
|
+
extend T::Helpers
|
|
16
|
+
|
|
17
|
+
requires_ancestor { HasTransport }
|
|
13
18
|
|
|
14
19
|
sig do
|
|
15
20
|
params(
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
6
|
+
module Solana::Ruby::Kit
|
|
7
|
+
module Rpc
|
|
8
|
+
module Api
|
|
9
|
+
# Fetch the total supply of an SPL Token mint.
|
|
10
|
+
# Mirrors TypeScript's GetTokenSupplyApi.getTokenSupply.
|
|
11
|
+
module GetTokenSupply
|
|
12
|
+
extend T::Sig
|
|
13
|
+
extend T::Helpers
|
|
14
|
+
|
|
15
|
+
requires_ancestor { HasTransport }
|
|
16
|
+
|
|
17
|
+
sig do
|
|
18
|
+
params(
|
|
19
|
+
token_mint: String,
|
|
20
|
+
commitment: T.nilable(Symbol)
|
|
21
|
+
).returns(RpcTypes::RpcContextualValue)
|
|
22
|
+
end
|
|
23
|
+
def get_token_supply(token_mint, commitment: nil)
|
|
24
|
+
config = {}
|
|
25
|
+
config['commitment'] = commitment.to_s if commitment
|
|
26
|
+
|
|
27
|
+
result = transport.request('getTokenSupply', [token_mint, config].tap { |a| a.pop if a.last.empty? })
|
|
28
|
+
slot = Kernel.Integer(result['context']['slot'])
|
|
29
|
+
raw = result['value']
|
|
30
|
+
|
|
31
|
+
value = {
|
|
32
|
+
amount: raw['amount'],
|
|
33
|
+
decimals: Kernel.Integer(raw['decimals']),
|
|
34
|
+
ui_amount: raw['uiAmount'],
|
|
35
|
+
ui_amount_string: raw['uiAmountString']
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
RpcTypes::RpcContextualValue.new(slot: slot, value: value)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -9,6 +11,9 @@ module Solana::Ruby::Kit
|
|
|
9
11
|
# Returns the raw JSON hash (nil if not found / not yet confirmed).
|
|
10
12
|
module GetTransaction
|
|
11
13
|
extend T::Sig
|
|
14
|
+
extend T::Helpers
|
|
15
|
+
|
|
16
|
+
requires_ancestor { HasTransport }
|
|
12
17
|
|
|
13
18
|
sig do
|
|
14
19
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -54,6 +56,9 @@ module Solana::Ruby::Kit
|
|
|
54
56
|
# See https://solana.com/docs/rpc/http/gettransactionsforaddress
|
|
55
57
|
module GetTransactionsForAddress
|
|
56
58
|
extend T::Sig
|
|
59
|
+
extend T::Helpers
|
|
60
|
+
|
|
61
|
+
requires_ancestor { HasTransport }
|
|
57
62
|
|
|
58
63
|
# Maps the snake_case keys of a Ruby +filters+ hash onto the wire names.
|
|
59
64
|
# Comparison operators (:eq, :gt, :gte, :lt, :lte) pass through as-is.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -25,6 +27,9 @@ module Solana::Ruby::Kit
|
|
|
25
27
|
# Returns { current: [], delinquent: [] }.
|
|
26
28
|
module GetVoteAccounts
|
|
27
29
|
extend T::Sig
|
|
30
|
+
extend T::Helpers
|
|
31
|
+
|
|
32
|
+
requires_ancestor { HasTransport }
|
|
28
33
|
|
|
29
34
|
sig do
|
|
30
35
|
params(
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Solana::Ruby::Kit
|
|
5
|
+
module Rpc
|
|
6
|
+
module Api
|
|
7
|
+
# Interface supplying the JSON-RPC connection that every API mixin uses.
|
|
8
|
+
#
|
|
9
|
+
# The mixins in this namespace are not usable on their own — each one
|
|
10
|
+
# issues its request through `transport`, which is provided by the object
|
|
11
|
+
# they are mixed into (`Rpc::Client`). Declaring that requirement here,
|
|
12
|
+
# and having each mixin `requires_ancestor { HasTransport }`, lets Sorbet
|
|
13
|
+
# resolve `transport` inside the mixins instead of reporting it missing.
|
|
14
|
+
module HasTransport
|
|
15
|
+
extend T::Sig
|
|
16
|
+
extend T::Helpers
|
|
17
|
+
interface!
|
|
18
|
+
|
|
19
|
+
# The HTTP connection used to issue JSON-RPC requests.
|
|
20
|
+
sig { abstract.returns(Transport) }
|
|
21
|
+
def transport; end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
4
5
|
require_relative '../../rpc_types/account_info'
|
|
5
6
|
|
|
6
7
|
module Solana::Ruby::Kit
|
|
@@ -14,6 +15,9 @@ module Solana::Ruby::Kit
|
|
|
14
15
|
# .value — Boolean
|
|
15
16
|
module IsBlockhashValid
|
|
16
17
|
extend T::Sig
|
|
18
|
+
extend T::Helpers
|
|
19
|
+
|
|
20
|
+
requires_ancestor { HasTransport }
|
|
17
21
|
|
|
18
22
|
sig do
|
|
19
23
|
params(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
4
5
|
require_relative '../../keys/signatures'
|
|
5
6
|
|
|
6
7
|
module Solana::Ruby::Kit
|
|
@@ -13,6 +14,9 @@ module Solana::Ruby::Kit
|
|
|
13
14
|
# Returns the transaction `Signature` of the airdrop.
|
|
14
15
|
module RequestAirdrop
|
|
15
16
|
extend T::Sig
|
|
17
|
+
extend T::Helpers
|
|
18
|
+
|
|
19
|
+
requires_ancestor { HasTransport }
|
|
16
20
|
|
|
17
21
|
sig do
|
|
18
22
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
require 'base64'
|
|
5
7
|
require_relative '../../keys/signatures'
|
|
6
8
|
require_relative '../../transactions/compiler'
|
|
@@ -21,6 +23,9 @@ module Solana::Ruby::Kit
|
|
|
21
23
|
# NOT wait for confirmation. Use `get_signature_statuses` to poll for commitment.
|
|
22
24
|
module SendTransaction
|
|
23
25
|
extend T::Sig
|
|
26
|
+
extend T::Helpers
|
|
27
|
+
|
|
28
|
+
requires_ancestor { HasTransport }
|
|
24
29
|
|
|
25
30
|
sig do
|
|
26
31
|
params(
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module Rpc
|
|
6
8
|
module Api
|
|
@@ -9,6 +11,9 @@ module Solana::Ruby::Kit
|
|
|
9
11
|
# Returns an RpcContextualValue whose value is the simulation result hash.
|
|
10
12
|
module SimulateTransaction
|
|
11
13
|
extend T::Sig
|
|
14
|
+
extend T::Helpers
|
|
15
|
+
|
|
16
|
+
requires_ancestor { HasTransport }
|
|
12
17
|
|
|
13
18
|
sig do
|
|
14
19
|
params(
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative 'transport'
|
|
5
|
+
require_relative 'api/has_transport'
|
|
5
6
|
require_relative 'api/get_slot'
|
|
6
7
|
require_relative 'api/get_balance'
|
|
7
8
|
require_relative 'api/get_latest_blockhash'
|
|
8
9
|
require_relative 'api/get_account_info'
|
|
10
|
+
require_relative 'api/get_ag_genesis_cert'
|
|
9
11
|
require_relative 'api/get_block_height'
|
|
10
12
|
require_relative 'api/get_signature_statuses'
|
|
11
13
|
require_relative 'api/send_transaction'
|
|
@@ -17,6 +19,7 @@ require_relative 'api/get_program_accounts'
|
|
|
17
19
|
require_relative 'api/get_transaction'
|
|
18
20
|
require_relative 'api/get_token_account_balance'
|
|
19
21
|
require_relative 'api/get_token_accounts_by_owner'
|
|
22
|
+
require_relative 'api/get_token_supply'
|
|
20
23
|
require_relative 'api/get_epoch_info'
|
|
21
24
|
require_relative 'api/get_vote_accounts'
|
|
22
25
|
require_relative 'api/simulate_transaction'
|
|
@@ -43,10 +46,13 @@ module Solana::Ruby::Kit
|
|
|
43
46
|
class Client
|
|
44
47
|
extend T::Sig
|
|
45
48
|
|
|
49
|
+
include Api::HasTransport
|
|
50
|
+
|
|
46
51
|
include Api::GetSlot
|
|
47
52
|
include Api::GetBalance
|
|
48
53
|
include Api::GetLatestBlockhash
|
|
49
54
|
include Api::GetAccountInfo
|
|
55
|
+
include Api::GetAgGenesisCert
|
|
50
56
|
include Api::GetBlockHeight
|
|
51
57
|
include Api::GetSignatureStatuses
|
|
52
58
|
include Api::SendTransaction
|
|
@@ -58,6 +64,7 @@ module Solana::Ruby::Kit
|
|
|
58
64
|
include Api::GetTransaction
|
|
59
65
|
include Api::GetTokenAccountBalance
|
|
60
66
|
include Api::GetTokenAccountsByOwner
|
|
67
|
+
include Api::GetTokenSupply
|
|
61
68
|
include Api::GetEpochInfo
|
|
62
69
|
include Api::GetVoteAccounts
|
|
63
70
|
include Api::SimulateTransaction
|
|
@@ -67,7 +74,7 @@ module Solana::Ruby::Kit
|
|
|
67
74
|
include Api::GetSignaturesForAddress
|
|
68
75
|
include Api::GetTransactionsForAddress
|
|
69
76
|
|
|
70
|
-
sig { returns(Transport) }
|
|
77
|
+
sig { override.returns(Transport) }
|
|
71
78
|
attr_reader :transport
|
|
72
79
|
|
|
73
80
|
# @param cluster_url [RpcTypes::ClusterUrl, String] endpoint to connect to.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module RpcSubscriptions
|
|
6
8
|
module Api
|
|
@@ -8,6 +10,9 @@ module Solana::Ruby::Kit
|
|
|
8
10
|
# Mirrors TypeScript's AccountNotificationsApi.accountSubscribe.
|
|
9
11
|
module AccountNotifications
|
|
10
12
|
extend T::Sig
|
|
13
|
+
extend T::Helpers
|
|
14
|
+
|
|
15
|
+
requires_ancestor { HasTransport }
|
|
11
16
|
|
|
12
17
|
sig do
|
|
13
18
|
params(
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Solana::Ruby::Kit
|
|
5
|
+
module RpcSubscriptions
|
|
6
|
+
module Api
|
|
7
|
+
# Interface supplying the WebSocket connection and subscription plumbing
|
|
8
|
+
# that every notification mixin uses.
|
|
9
|
+
#
|
|
10
|
+
# The mixins in this namespace are not usable on their own — each one
|
|
11
|
+
# opens its subscription through `transport` and wraps it with
|
|
12
|
+
# `_build_subscription`, both provided by the object they are mixed into
|
|
13
|
+
# (`RpcSubscriptions::Client`). Declaring that requirement here, and
|
|
14
|
+
# having each mixin `requires_ancestor { HasTransport }`, lets Sorbet
|
|
15
|
+
# resolve those calls inside the mixins instead of reporting them missing.
|
|
16
|
+
module HasTransport
|
|
17
|
+
extend T::Sig
|
|
18
|
+
extend T::Helpers
|
|
19
|
+
abstract!
|
|
20
|
+
|
|
21
|
+
# The WebSocket connection used to issue JSON-RPC subscription requests.
|
|
22
|
+
sig { abstract.returns(Transport) }
|
|
23
|
+
def transport; end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
# Wrap a server-assigned subscription id in a `Subscription` that
|
|
28
|
+
# unsubscribes via `unsub_method` when closed. Private, matching the
|
|
29
|
+
# visibility it has on `RpcSubscriptions::Client`.
|
|
30
|
+
sig { abstract.params(sub_id: T.untyped, unsub_method: String).returns(Subscription) }
|
|
31
|
+
def _build_subscription(sub_id, unsub_method); end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module RpcSubscriptions
|
|
6
8
|
module Api
|
|
@@ -8,6 +10,9 @@ module Solana::Ruby::Kit
|
|
|
8
10
|
# +filter+ may be 'all', 'allWithVotes', or { 'mentions' => [pubkey] }.
|
|
9
11
|
module LogsNotifications
|
|
10
12
|
extend T::Sig
|
|
13
|
+
extend T::Helpers
|
|
14
|
+
|
|
15
|
+
requires_ancestor { HasTransport }
|
|
11
16
|
|
|
12
17
|
sig do
|
|
13
18
|
params(
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module RpcSubscriptions
|
|
6
8
|
module Api
|
|
7
9
|
# Subscribe to program account change notifications.
|
|
8
10
|
module ProgramNotifications
|
|
9
11
|
extend T::Sig
|
|
12
|
+
extend T::Helpers
|
|
13
|
+
|
|
14
|
+
requires_ancestor { HasTransport }
|
|
10
15
|
|
|
11
16
|
sig do
|
|
12
17
|
params(
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module RpcSubscriptions
|
|
6
8
|
module Api
|
|
7
9
|
# Subscribe to root change notifications.
|
|
8
10
|
module RootNotifications
|
|
9
11
|
extend T::Sig
|
|
12
|
+
extend T::Helpers
|
|
13
|
+
|
|
14
|
+
requires_ancestor { HasTransport }
|
|
10
15
|
|
|
11
16
|
sig { returns(Subscription) }
|
|
12
17
|
def root_subscribe
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module RpcSubscriptions
|
|
6
8
|
module Api
|
|
@@ -8,6 +10,9 @@ module Solana::Ruby::Kit
|
|
|
8
10
|
# The subscription auto-unsubscribes once the signature is confirmed.
|
|
9
11
|
module SignatureNotifications
|
|
10
12
|
extend T::Sig
|
|
13
|
+
extend T::Helpers
|
|
14
|
+
|
|
15
|
+
requires_ancestor { HasTransport }
|
|
11
16
|
|
|
12
17
|
sig do
|
|
13
18
|
params(
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative 'has_transport'
|
|
5
|
+
|
|
4
6
|
module Solana::Ruby::Kit
|
|
5
7
|
module RpcSubscriptions
|
|
6
8
|
module Api
|
|
7
9
|
# Subscribe to slot change notifications.
|
|
8
10
|
module SlotNotifications
|
|
9
11
|
extend T::Sig
|
|
12
|
+
extend T::Helpers
|
|
13
|
+
|
|
14
|
+
requires_ancestor { HasTransport }
|
|
10
15
|
|
|
11
16
|
sig { returns(Subscription) }
|
|
12
17
|
def slot_subscribe
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative 'transport'
|
|
5
5
|
require_relative 'subscription'
|
|
6
|
+
require_relative 'api/has_transport'
|
|
6
7
|
require_relative 'autopinger'
|
|
7
8
|
require_relative 'api/account_notifications'
|
|
8
9
|
require_relative 'api/logs_notifications'
|
|
@@ -23,6 +24,8 @@ module Solana::Ruby::Kit
|
|
|
23
24
|
class Client
|
|
24
25
|
extend T::Sig
|
|
25
26
|
|
|
27
|
+
include Api::HasTransport
|
|
28
|
+
|
|
26
29
|
include Api::AccountNotifications
|
|
27
30
|
include Api::LogsNotifications
|
|
28
31
|
include Api::ProgramNotifications
|
|
@@ -30,7 +33,7 @@ module Solana::Ruby::Kit
|
|
|
30
33
|
include Api::SignatureNotifications
|
|
31
34
|
include Api::SlotNotifications
|
|
32
35
|
|
|
33
|
-
sig { returns(Transport) }
|
|
36
|
+
sig { override.returns(Transport) }
|
|
34
37
|
attr_reader :transport
|
|
35
38
|
|
|
36
39
|
sig do
|
|
@@ -56,7 +59,7 @@ module Solana::Ruby::Kit
|
|
|
56
59
|
|
|
57
60
|
# Build a Subscription wrapping an AsyncIterable enumerator and
|
|
58
61
|
# an auto-unsubscribe on close.
|
|
59
|
-
sig { params(sub_id: T.untyped, unsub_method: String).returns(Subscription) }
|
|
62
|
+
sig { override.params(sub_id: T.untyped, unsub_method: String).returns(Subscription) }
|
|
60
63
|
def _build_subscription(sub_id, unsub_method)
|
|
61
64
|
publisher = @transport.publisher
|
|
62
65
|
enumerator = Subscribable::AsyncIterable.from_publisher(
|