solana-ruby-kit 7.1.1 → 7.1.1.2

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/solana/ruby/kit/codecs/bytes.rb +5 -1
  3. data/lib/solana/ruby/kit/codecs/data_structures.rb +5 -1
  4. data/lib/solana/ruby/kit/codecs/numbers.rb +5 -1
  5. data/lib/solana/ruby/kit/codecs/strings.rb +5 -1
  6. data/lib/solana/ruby/kit/codecs.rb +3 -1
  7. data/lib/solana/ruby/kit/errors.rb +2 -0
  8. data/lib/solana/ruby/kit/functional.rb +1 -1
  9. data/lib/solana/ruby/kit/instruction_plans/instruction_plan.rb +13 -1
  10. data/lib/solana/ruby/kit/instruction_plans/transaction_plan.rb +9 -0
  11. data/lib/solana/ruby/kit/instruction_plans/transaction_plan_executor.rb +13 -3
  12. data/lib/solana/ruby/kit/instruction_plans/transaction_plan_result.rb +18 -0
  13. data/lib/solana/ruby/kit/instruction_plans/transaction_planner.rb +24 -2
  14. data/lib/solana/ruby/kit/rpc/api/get_account_info.rb +5 -0
  15. data/lib/solana/ruby/kit/rpc/api/get_balance.rb +4 -0
  16. data/lib/solana/ruby/kit/rpc/api/get_block_height.rb +5 -0
  17. data/lib/solana/ruby/kit/rpc/api/get_block_time.rb +5 -0
  18. data/lib/solana/ruby/kit/rpc/api/get_epoch_info.rb +5 -0
  19. data/lib/solana/ruby/kit/rpc/api/get_epoch_schedule.rb +5 -0
  20. data/lib/solana/ruby/kit/rpc/api/get_inflation_reward.rb +6 -1
  21. data/lib/solana/ruby/kit/rpc/api/get_latest_blockhash.rb +4 -0
  22. data/lib/solana/ruby/kit/rpc/api/get_minimum_balance_for_rent_exemption.rb +5 -0
  23. data/lib/solana/ruby/kit/rpc/api/get_multiple_accounts.rb +5 -0
  24. data/lib/solana/ruby/kit/rpc/api/get_program_accounts.rb +5 -0
  25. data/lib/solana/ruby/kit/rpc/api/get_signature_statuses.rb +4 -0
  26. data/lib/solana/ruby/kit/rpc/api/get_signatures_for_address.rb +5 -0
  27. data/lib/solana/ruby/kit/rpc/api/get_slot.rb +5 -0
  28. data/lib/solana/ruby/kit/rpc/api/get_token_account_balance.rb +5 -0
  29. data/lib/solana/ruby/kit/rpc/api/get_token_accounts_by_owner.rb +5 -0
  30. data/lib/solana/ruby/kit/rpc/api/get_token_supply.rb +43 -0
  31. data/lib/solana/ruby/kit/rpc/api/get_transaction.rb +5 -0
  32. data/lib/solana/ruby/kit/rpc/api/get_transactions_for_address.rb +5 -0
  33. data/lib/solana/ruby/kit/rpc/api/get_vote_accounts.rb +5 -0
  34. data/lib/solana/ruby/kit/rpc/api/has_transport.rb +25 -0
  35. data/lib/solana/ruby/kit/rpc/api/is_blockhash_valid.rb +4 -0
  36. data/lib/solana/ruby/kit/rpc/api/request_airdrop.rb +4 -0
  37. data/lib/solana/ruby/kit/rpc/api/send_transaction.rb +5 -0
  38. data/lib/solana/ruby/kit/rpc/api/simulate_transaction.rb +5 -0
  39. data/lib/solana/ruby/kit/rpc/client.rb +6 -1
  40. data/lib/solana/ruby/kit/rpc_subscriptions/api/account_notifications.rb +5 -0
  41. data/lib/solana/ruby/kit/rpc_subscriptions/api/has_transport.rb +35 -0
  42. data/lib/solana/ruby/kit/rpc_subscriptions/api/logs_notifications.rb +5 -0
  43. data/lib/solana/ruby/kit/rpc_subscriptions/api/program_notifications.rb +5 -0
  44. data/lib/solana/ruby/kit/rpc_subscriptions/api/root_notifications.rb +5 -0
  45. data/lib/solana/ruby/kit/rpc_subscriptions/api/signature_notifications.rb +5 -0
  46. data/lib/solana/ruby/kit/rpc_subscriptions/api/slot_notifications.rb +5 -0
  47. data/lib/solana/ruby/kit/rpc_subscriptions/client.rb +5 -2
  48. data/lib/solana/ruby/kit/rpc_types/sol.rb +8 -6
  49. data/lib/solana/ruby/kit/subscribable/reactive_action_store.rb +6 -6
  50. data/lib/solana/ruby/kit/subscribable/reactive_stream_store.rb +4 -4
  51. data/lib/solana/ruby/kit/transaction_messages/compute_budget.rb +4 -4
  52. data/lib/solana/ruby/kit/version.rb +1 -1
  53. data/lib/solana/ruby/kit/wallet_standard.rb +4 -4
  54. data/solana-ruby-kit.gemspec +6 -0
  55. metadata +24 -3
  56. data/lib/core_extensions/tapioca/name_patch.rb +0 -32
  57. data/lib/core_extensions/tapioca/required_ancestors.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e606f70ed09eacc4ad7ec919804b52657d9d2caaf72ae433060cb8bf3b35a2e
4
- data.tar.gz: d7256752b6cdae6e59a69e310718f9a3c242881a6aa5856ed8a81cae92f28c35
3
+ metadata.gz: 4a30b73ebab9578e0345910ab3f7d019cb6cacc9840797abfb8a177a3de9b2bb
4
+ data.tar.gz: e540ed2b2b3cc1bb87a5f584b587d1ea4f86cad324c04385311289501ce48cf7
5
5
  SHA512:
6
- metadata.gz: 7a4df93245a990edae1fd4548baa5c967cd7540c91ecc5366a8a9055f994d43243e33c7747bd4b2227f6fce548330d42061af1371ba3a84aaea25676d7d22f07
7
- data.tar.gz: 9bdbc5b7f93872b9bf7524f51d48a3868bc9439e598a5f6adc8847f0f9797e06a6747bd2e01c78b0998ab198967135e14d6f945124437b27997340aee466591d
6
+ metadata.gz: 29728a4e25c5f9d7dabd89e75cb9fd2b583f03930b6640c48c68ff070e90e06345bbfa75d636383dda51c9dc8044f9942f4a299866f39f8b93189f832fbf03a6
7
+ data.tar.gz: 04c68d1f2e6f249c4be788e1c9e6919b056f9780eebd5a26bb6dc8aae6b15ceafe7838d39ed6af4ba24269ebdc5cbdd4cc028f8947db842631aace626750df45
@@ -8,7 +8,11 @@ module Solana::Ruby::Kit
8
8
  module Bytes
9
9
  extend T::Sig
10
10
 
11
- module_function
11
+ # `extend self`, not `module_function`: both expose these as module
12
+ # methods, but module_function also marks the instance methods PRIVATE,
13
+ # and `Codecs extend Bytes` then inherits that privacy - which silently
14
+ # defeated the "directly available as Codecs.x" intent in codecs.rb.
15
+ extend self
12
16
 
13
17
  # Concatenate multiple binary strings into one.
14
18
  sig { params(byte_strings: String).returns(String) }
@@ -7,7 +7,11 @@ module Solana::Ruby::Kit
7
7
  module DataStructures
8
8
  extend T::Sig
9
9
 
10
- module_function
10
+ # `extend self`, not `module_function`: both expose these as module
11
+ # methods, but module_function also marks the instance methods PRIVATE,
12
+ # and `Codecs extend DataStructures` then inherits that privacy - which silently
13
+ # defeated the "directly available as Codecs.x" intent in codecs.rb.
14
+ extend self
11
15
 
12
16
  # Encode/decode a fixed ordered list of named fields.
13
17
  # +fields+ is an Array of [name, codec] pairs (name can be String or Symbol).
@@ -13,7 +13,11 @@ module Solana::Ruby::Kit
13
13
  module Numbers
14
14
  extend T::Sig
15
15
 
16
- module_function
16
+ # `extend self`, not `module_function`: both expose these as module
17
+ # methods, but module_function also marks the instance methods PRIVATE,
18
+ # and `Codecs extend Numbers` then inherits that privacy - which silently
19
+ # defeated the "directly available as Codecs.x" intent in codecs.rb.
20
+ extend self
17
21
 
18
22
  # ── Unsigned integers ────────────────────────────────────────────────────
19
23
 
@@ -9,7 +9,11 @@ module Solana::Ruby::Kit
9
9
  module Strings
10
10
  extend T::Sig
11
11
 
12
- module_function
12
+ # `extend self`, not `module_function`: both expose these as module
13
+ # methods, but module_function also marks the instance methods PRIVATE,
14
+ # and `Codecs extend Strings` then inherits that privacy - which silently
15
+ # defeated the "directly available as Codecs.x" intent in codecs.rb.
16
+ extend self
13
17
 
14
18
  # UTF-8 string codec.
15
19
  # When +size+ is given the encoded bytes are fixed to that length
@@ -16,7 +16,9 @@ require_relative 'codecs/data_structures'
16
16
 
17
17
  module Solana::Ruby::Kit
18
18
  module Codecs
19
- # Make number helpers directly available as Codecs.u8_codec etc.
19
+ # Makes the whole helper surface available as Codecs.u8_codec etc. This
20
+ # relies on each module using `extend self` rather than `module_function`
21
+ # - see the note in numbers.rb for why the distinction matters here.
20
22
  extend Numbers
21
23
  extend Strings
22
24
  extend DataStructures
@@ -147,6 +147,7 @@ module Solana::Ruby::Kit
147
147
 
148
148
  # ── Fixed-points ──────────────────────────────────────────────────────────
149
149
  FIXED_POINTS__STRICT_MODE_PRECISION_LOSS = :SOLANA_ERROR__FIXED_POINTS__STRICT_MODE_PRECISION_LOSS
150
+ LAMPORTS_OUT_OF_RANGE = :SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE
150
151
 
151
152
  # ── Invariant violations (internal) ──────────────────────────────────────
152
153
  INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING = :SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING
@@ -286,6 +287,7 @@ module Solana::Ruby::Kit
286
287
 
287
288
  # Fixed-points
288
289
  FIXED_POINTS__STRICT_MODE_PRECISION_LOSS => 'Value has more than 9 fractional digits and cannot be represented exactly as a Sol amount',
290
+ LAMPORTS_OUT_OF_RANGE => 'Lamports value out of range; must fit in an unsigned 64-bit integer',
289
291
 
290
292
  # Wallet Standard
291
293
  WALLET_STANDARD__INVALID_WIRE_FORMAT => 'Invalid transaction wire format: %{reason}',
@@ -21,7 +21,7 @@ module Solana::Ruby::Kit
21
21
  # ->(tx) { Solana::Ruby::Kit::TransactionMessages.set_fee_payer(fee_payer_address, tx) },
22
22
  # ->(tx) { Solana::Ruby::Kit::TransactionMessages.set_blockhash_lifetime(blockhash, tx) },
23
23
  # )
24
- sig { params(value: T.untyped, fns: T::Array[T.proc.params(arg0: T.untyped).returns(T.untyped)]).returns(T.untyped) }
24
+ sig { params(value: T.untyped, fns: T.proc.params(arg0: T.untyped).returns(T.untyped)).returns(T.untyped) }
25
25
  def pipe(value, *fns)
26
26
  fns.reduce(value) { |acc, fn| T.unsafe(fn).call(acc) }
27
27
  end
@@ -23,7 +23,10 @@ module Solana::Ruby::Kit
23
23
 
24
24
  # A plan that wraps a single instruction.
25
25
  class SingleInstructionPlan < T::Struct
26
+ extend T::Sig
27
+
26
28
  const :instruction, Instructions::Instruction
29
+ sig { returns(Symbol) }
27
30
  def kind = :single
28
31
  end
29
32
 
@@ -31,21 +34,30 @@ module Solana::Ruby::Kit
31
34
  # +divisible: true+ allows the planner to split children across transactions.
32
35
  # +divisible: false+ means all children should be atomic (one tx or a bundle).
33
36
  class SequentialInstructionPlan < T::Struct
37
+ extend T::Sig
38
+
34
39
  const :plans, T::Array[T.untyped] # Array[InstructionPlan]
35
40
  const :divisible, T::Boolean
41
+ sig { returns(Symbol) }
36
42
  def kind = :sequential
37
43
  end
38
44
 
39
45
  # A plan whose children may execute concurrently or be packed in any order.
40
46
  class ParallelInstructionPlan < T::Struct
47
+ extend T::Sig
48
+
41
49
  const :plans, T::Array[T.untyped] # Array[InstructionPlan]
50
+ sig { returns(Symbol) }
42
51
  def kind = :parallel
43
52
  end
44
53
 
45
54
  # Provides a MessagePacker that dynamically packs instructions into messages.
46
55
  # The +get_message_packer+ proc returns a fresh MessagePacker each call.
47
56
  class MessagePackerInstructionPlan < T::Struct
57
+ extend T::Sig
58
+
48
59
  const :get_message_packer, T.untyped # Proc -> MessagePacker
60
+ sig { returns(Symbol) }
49
61
  def kind = :message_packer
50
62
  end
51
63
 
@@ -199,7 +211,7 @@ module Solana::Ruby::Kit
199
211
  return packed
200
212
  end
201
213
 
202
- next_packed = TransactionMessages.append_instructions(packed, [instructions[i]])
214
+ next_packed = TransactionMessages.append_instructions(packed, [T.must(instructions[i])])
203
215
  size = Transactions.get_transaction_message_size(next_packed)
204
216
 
205
217
  if size > Transactions::TRANSACTION_SIZE_LIMIT
@@ -17,18 +17,27 @@ module Solana::Ruby::Kit
17
17
  # | ParallelTransactionPlan
18
18
 
19
19
  class SingleTransactionPlan < T::Struct
20
+ extend T::Sig
21
+
20
22
  const :message, TransactionMessages::TransactionMessage
23
+ sig { returns(Symbol) }
21
24
  def kind = :single
22
25
  end
23
26
 
24
27
  class SequentialTransactionPlan < T::Struct
28
+ extend T::Sig
29
+
25
30
  const :plans, T::Array[T.untyped] # Array[TransactionPlan]
26
31
  const :divisible, T::Boolean
32
+ sig { returns(Symbol) }
27
33
  def kind = :sequential
28
34
  end
29
35
 
30
36
  class ParallelTransactionPlan < T::Struct
37
+ extend T::Sig
38
+
31
39
  const :plans, T::Array[T.untyped] # Array[TransactionPlan]
40
+ sig { returns(Symbol) }
32
41
  def kind = :parallel
33
42
  end
34
43
 
@@ -9,6 +9,8 @@ module Solana::Ruby::Kit
9
9
  module InstructionPlans
10
10
  extend T::Sig
11
11
 
12
+ module_function
13
+
12
14
  # Creates a TransactionPlanExecutor — a callable that traverses a TransactionPlan,
13
15
  # executing each single transaction message and collecting results.
14
16
  #
@@ -48,7 +50,7 @@ module Solana::Ruby::Kit
48
50
  )
49
51
  # Store the full result tree as a non-enumerable attribute for recovery.
50
52
  err.instance_variable_set(:@transaction_plan_result, result)
51
- err.define_singleton_method(:transaction_plan_result) { @transaction_plan_result }
53
+ err.define_singleton_method(:transaction_plan_result) { result }
52
54
  Kernel.raise err
53
55
  end
54
56
 
@@ -56,12 +58,12 @@ module Solana::Ruby::Kit
56
58
  }
57
59
  end
58
60
 
59
- module_function :create_transaction_plan_executor
60
-
61
61
  # ── Private helpers ────────────────────────────────────────────────────────
62
62
 
63
63
  module_function
64
64
 
65
+ sig { params(plan: T.untyped, execute_fn: T.untyped, state: T.untyped).returns(T.untyped) }
66
+
65
67
  def executor_traverse(plan, execute_fn, state)
66
68
  case plan.kind
67
69
  when :sequential then executor_traverse_sequential(plan, execute_fn, state)
@@ -75,6 +77,8 @@ module Solana::Ruby::Kit
75
77
  end
76
78
  end
77
79
 
80
+ sig { params(plan: T.untyped, execute_fn: T.untyped, state: T.untyped).returns(T.untyped) }
81
+
78
82
  def executor_traverse_sequential(plan, execute_fn, state)
79
83
  results = plan.plans.map { |sub| executor_traverse(sub, execute_fn, state) }
80
84
  plan.divisible \
@@ -82,11 +86,15 @@ module Solana::Ruby::Kit
82
86
  : non_divisible_sequential_transaction_plan_result(results)
83
87
  end
84
88
 
89
+ sig { params(plan: T.untyped, execute_fn: T.untyped, state: T.untyped).returns(T.untyped) }
90
+
85
91
  def executor_traverse_parallel(plan, execute_fn, state)
86
92
  results = plan.plans.map { |sub| executor_traverse(sub, execute_fn, state) }
87
93
  parallel_transaction_plan_result(results)
88
94
  end
89
95
 
96
+ sig { params(plan: T.untyped, execute_fn: T.untyped, state: T.untyped).returns(T.untyped) }
97
+
90
98
  def executor_traverse_single(plan, execute_fn, state)
91
99
  # A fresh context per single transaction plan. Nothing is populated yet — filling
92
100
  # it in is the callback's job, which is what lets a partial context survive an error.
@@ -137,6 +145,8 @@ module Solana::Ruby::Kit
137
145
  returned
138
146
  end
139
147
 
148
+ sig { params(result: T.untyped).returns(T.untyped) }
149
+
140
150
  def executor_find_error(result)
141
151
  return result.status.error if result.kind == :single && result.status.kind == :failed
142
152
  return nil if result.kind == :single
@@ -21,38 +21,56 @@ module Solana::Ruby::Kit
21
21
  # the result. Mirrors TypeScript's TransactionPlanResultStatus union.
22
22
 
23
23
  class SuccessfulStatus < T::Struct
24
+ extend T::Sig
25
+
24
26
  const :transaction, T.nilable(Transactions::Transaction)
25
27
  const :context, T::Hash[T.untyped, T.untyped]
28
+ sig { returns(Symbol) }
26
29
  def kind = :successful
27
30
  end
28
31
 
29
32
  class FailedStatus < T::Struct
33
+ extend T::Sig
34
+
30
35
  const :error, SolanaError
31
36
  const :context, T::Hash[T.untyped, T.untyped], default: {}.freeze
37
+ sig { returns(Symbol) }
32
38
  def kind = :failed
33
39
  end
34
40
 
35
41
  class CanceledStatus < T::Struct
42
+ extend T::Sig
43
+
36
44
  const :context, T::Hash[T.untyped, T.untyped], default: {}.freeze
45
+ sig { returns(Symbol) }
37
46
  def kind = :canceled
38
47
  end
39
48
 
40
49
  # ── Result plan types ──────────────────────────────────────────────────────
41
50
 
42
51
  class SingleTransactionPlanResult < T::Struct
52
+ extend T::Sig
53
+
43
54
  const :message, TransactionMessages::TransactionMessage
44
55
  const :status, T.untyped # SuccessfulStatus | FailedStatus | CanceledStatus
56
+ sig { returns(Symbol) }
45
57
  def kind = :single
46
58
  end
47
59
 
48
60
  class SequentialTransactionPlanResult < T::Struct
61
+ extend T::Sig
62
+
49
63
  const :plans, T::Array[T.untyped] # Array[TransactionPlanResult]
50
64
  const :divisible, T::Boolean
65
+ sig { returns(Symbol) }
51
66
  def kind = :sequential
52
67
  end
53
68
 
54
69
  class ParallelTransactionPlanResult < T::Struct
70
+ extend T::Sig
71
+
55
72
  const :plans, T::Array[T.untyped] # Array[TransactionPlanResult]
73
+ sig { returns(Symbol) }
56
74
  def kind = :parallel
57
75
  end
58
76
 
@@ -11,6 +11,8 @@ module Solana::Ruby::Kit
11
11
  module InstructionPlans
12
12
  extend T::Sig
13
13
 
14
+ module_function
15
+
14
16
  # Creates a TransactionPlanner — a callable that converts an InstructionPlan
15
17
  # into a TransactionPlan by packing instructions into transaction messages.
16
18
  #
@@ -67,12 +69,12 @@ module Solana::Ruby::Kit
67
69
  }
68
70
  end
69
71
 
70
- module_function :create_transaction_planner
71
-
72
72
  # ── Private helpers ────────────────────────────────────────────────────────
73
73
 
74
74
  module_function
75
75
 
76
+ sig { params(plan: T.untyped, ctx: T.untyped).returns(T.untyped) }
77
+
76
78
  def planner_traverse(plan, ctx)
77
79
  case plan.kind
78
80
  when :sequential then planner_traverse_sequential(plan, ctx)
@@ -87,6 +89,8 @@ module Solana::Ruby::Kit
87
89
  end
88
90
  end
89
91
 
92
+ sig { params(plan: T.untyped, ctx: T.untyped).returns(T.untyped) }
93
+
90
94
  def planner_traverse_sequential(plan, ctx)
91
95
  must_fit_in_parent = ctx[:parent] && (ctx[:parent].kind == :parallel || !plan.divisible)
92
96
 
@@ -118,6 +122,8 @@ module Solana::Ruby::Kit
118
122
  { kind: :sequential, divisible: plan.divisible, plans: tx_plans }
119
123
  end
120
124
 
125
+ sig { params(plan: T.untyped, ctx: T.untyped).returns(T.untyped) }
126
+
121
127
  def planner_traverse_parallel(plan, ctx)
122
128
  candidates = ctx[:parent_candidates].dup
123
129
  tx_plans = []
@@ -139,6 +145,8 @@ module Solana::Ruby::Kit
139
145
  { kind: :parallel, plans: tx_plans }
140
146
  end
141
147
 
148
+ sig { params(plan: T.untyped, ctx: T.untyped).returns(T.untyped) }
149
+
142
150
  def planner_traverse_single(plan, ctx)
143
151
  predicate = ->(msg) { TransactionMessages.append_instructions(msg, [plan.instruction]) }
144
152
  candidate = planner_select_and_mutate_candidate(ctx, ctx[:parent_candidates], &predicate)
@@ -148,6 +156,8 @@ module Solana::Ruby::Kit
148
156
  { kind: :single, message: msg }
149
157
  end
150
158
 
159
+ sig { params(plan: T.untyped, ctx: T.untyped).returns(T.untyped) }
160
+
151
161
  def planner_traverse_message_packer(plan, ctx)
152
162
  packer = plan.get_message_packer.call
153
163
  tx_plans = []
@@ -175,6 +185,8 @@ module Solana::Ruby::Kit
175
185
  end
176
186
  end
177
187
 
188
+ sig { params(ctx: T.untyped, candidates: T.untyped, predicate: T.proc.params(arg0: T.untyped).returns(T.untyped)).returns(T.untyped) }
189
+
178
190
  def planner_select_and_mutate_candidate(ctx, candidates, &predicate)
179
191
  candidates.each do |candidate|
180
192
  begin
@@ -198,6 +210,8 @@ module Solana::Ruby::Kit
198
210
  nil
199
211
  end
200
212
 
213
+ sig { params(ctx: T.untyped, predicate: T.proc.params(arg0: T.untyped).returns(T.untyped)).returns(T.untyped) }
214
+
201
215
  def planner_create_new_message(ctx, &predicate)
202
216
  new_msg = ctx[:create_transaction_message].call
203
217
  updated_msg = ctx[:on_transaction_message_updated].call(predicate.call(new_msg))
@@ -220,6 +234,8 @@ module Solana::Ruby::Kit
220
234
  updated_msg
221
235
  end
222
236
 
237
+ sig { params(plan: T.untyped, message: T.untyped, ctx: T.untyped).returns(T.untyped) }
238
+
223
239
  def planner_fit_entire_plan(plan, message, ctx)
224
240
  case plan.kind
225
241
  when :sequential, :parallel
@@ -259,17 +275,23 @@ module Solana::Ruby::Kit
259
275
  end
260
276
  end
261
277
 
278
+ sig { params(plan: T.untyped).returns(T.untyped) }
279
+
262
280
  def planner_get_sequential_candidate(plan)
263
281
  return plan if plan[:kind] == :single
264
282
  return nil unless plan[:kind] == :sequential && plan[:plans]&.any?
265
283
  planner_get_sequential_candidate(plan[:plans].last)
266
284
  end
267
285
 
286
+ sig { params(plan: T.untyped).returns(T.untyped) }
287
+
268
288
  def planner_get_parallel_candidates(plan)
269
289
  return [plan] if plan[:kind] == :single
270
290
  (plan[:plans] || []).flat_map { |p| planner_get_parallel_candidates(p) }
271
291
  end
272
292
 
293
+ sig { params(plan: T.untyped).returns(T.untyped) }
294
+
273
295
  def planner_freeze(plan)
274
296
  case plan[:kind]
275
297
  when :single
@@ -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 '../../rpc_types/account_info'
6
8
 
@@ -16,6 +18,9 @@ module Solana::Ruby::Kit
16
18
  # (nil when the account does not exist)
17
19
  module GetAccountInfo
18
20
  extend T::Sig
21
+ extend T::Helpers
22
+
23
+ requires_ancestor { HasTransport }
19
24
 
20
25
  SUPPORTED_ENCODINGS = T.let(%w[base64 jsonParsed base64+zstd].freeze, T::Array[String])
21
26
 
@@ -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 — Integer (lamports)
15
16
  module GetBalance
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,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 `GetBlockHeightApi.getBlockHeight(config?)`.
9
11
  module GetBlockHeight
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 GetBlockTimeApi.getBlockTime.
9
11
  module GetBlockTime
10
12
  extend T::Sig
13
+ extend T::Helpers
14
+
15
+ requires_ancestor { HasTransport }
11
16
 
12
17
  sig { params(slot: Integer).returns(T.nilable(Integer)) }
13
18
  def get_block_time(slot)
@@ -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.nilable(T.untyped)])
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(