@ar.io/sdk 3.24.0 → 4.0.0-alpha.1

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 (169) hide show
  1. package/README.md +682 -600
  2. package/lib/esm/cli/cli.js +188 -152
  3. package/lib/esm/cli/commands/antCommands.js +23 -58
  4. package/lib/esm/cli/commands/arnsPurchaseCommands.js +48 -30
  5. package/lib/esm/cli/commands/escrowCommands.js +221 -0
  6. package/lib/esm/cli/commands/gatewayWriteCommands.js +142 -23
  7. package/lib/esm/cli/commands/pruneCommands.js +150 -0
  8. package/lib/esm/cli/commands/readCommands.js +22 -3
  9. package/lib/esm/cli/commands/transfer.js +6 -6
  10. package/lib/esm/cli/options.js +124 -58
  11. package/lib/esm/cli/utils.js +280 -174
  12. package/lib/esm/common/ant-registry.js +17 -143
  13. package/lib/esm/common/ant.js +44 -1167
  14. package/lib/esm/common/faucet.js +11 -6
  15. package/lib/esm/common/index.js +0 -4
  16. package/lib/esm/common/io.js +25 -1412
  17. package/lib/esm/constants.js +13 -19
  18. package/lib/esm/solana/ant-readable.js +724 -0
  19. package/lib/esm/solana/ant-registry-readable.js +133 -0
  20. package/lib/esm/solana/ant-registry-writeable.js +472 -0
  21. package/lib/esm/solana/ant-writeable.js +384 -0
  22. package/lib/esm/solana/ata.js +70 -0
  23. package/lib/esm/solana/canonical-message.js +128 -0
  24. package/lib/esm/solana/clusters.js +111 -0
  25. package/lib/esm/solana/constants.js +146 -0
  26. package/lib/esm/solana/delegation-math.js +112 -0
  27. package/lib/esm/solana/deserialize.js +711 -0
  28. package/lib/esm/solana/escrow.js +839 -0
  29. package/lib/{cjs/utils/json.js → esm/solana/events.js} +15 -10
  30. package/lib/esm/solana/funding-plan.js +699 -0
  31. package/lib/esm/solana/index.js +126 -0
  32. package/lib/esm/solana/instruction.js +39 -0
  33. package/lib/esm/solana/io-readable.js +2182 -0
  34. package/lib/esm/solana/io-writeable.js +3196 -0
  35. package/lib/esm/solana/json-rpc.js +90 -0
  36. package/lib/esm/solana/metadata.js +81 -0
  37. package/lib/esm/solana/mpl-core.js +192 -0
  38. package/lib/esm/solana/pda.js +332 -0
  39. package/lib/esm/solana/predict-prescribed-observers.js +110 -0
  40. package/lib/esm/solana/retry.js +117 -0
  41. package/lib/esm/solana/rpc-circuit-breaker.js +258 -0
  42. package/lib/esm/solana/send.js +372 -0
  43. package/lib/esm/solana/spawn-ant.js +224 -0
  44. package/lib/esm/solana/types.js +1 -0
  45. package/lib/esm/types/ant.js +27 -15
  46. package/lib/esm/types/io.js +8 -11
  47. package/lib/esm/utils/ant.js +0 -63
  48. package/lib/esm/utils/index.js +0 -3
  49. package/lib/esm/version.js +1 -1
  50. package/lib/types/cli/commands/antCommands.d.ts +5 -13
  51. package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +33 -7
  52. package/lib/types/cli/commands/escrowCommands.d.ts +68 -0
  53. package/lib/types/cli/commands/gatewayWriteCommands.d.ts +12 -11
  54. package/lib/types/cli/commands/pruneCommands.d.ts +31 -0
  55. package/lib/types/cli/commands/readCommands.d.ts +27 -22
  56. package/lib/types/cli/commands/transfer.d.ts +9 -9
  57. package/lib/types/cli/options.d.ts +76 -21
  58. package/lib/types/cli/types.d.ts +11 -13
  59. package/lib/types/cli/utils.d.ts +71 -31
  60. package/lib/types/common/ant-registry.d.ts +49 -47
  61. package/lib/types/common/ant.d.ts +54 -539
  62. package/lib/types/common/faucet.d.ts +20 -8
  63. package/lib/types/common/index.d.ts +0 -3
  64. package/lib/types/common/io.d.ts +51 -263
  65. package/lib/types/constants.d.ts +11 -18
  66. package/lib/types/solana/ant-readable.d.ts +180 -0
  67. package/lib/types/solana/ant-registry-readable.d.ts +105 -0
  68. package/lib/types/solana/ant-registry-writeable.d.ts +249 -0
  69. package/lib/types/solana/ant-writeable.d.ts +177 -0
  70. package/lib/types/solana/ata.d.ts +44 -0
  71. package/lib/types/solana/canonical-message.d.ts +121 -0
  72. package/lib/types/solana/clusters.d.ts +109 -0
  73. package/lib/types/solana/constants.d.ts +119 -0
  74. package/lib/types/solana/delegation-math.d.ts +45 -0
  75. package/lib/types/solana/deserialize.d.ts +262 -0
  76. package/lib/types/solana/escrow.d.ts +480 -0
  77. package/lib/types/solana/events.d.ts +38 -0
  78. package/lib/types/solana/funding-plan.d.ts +225 -0
  79. package/lib/types/solana/index.d.ts +87 -0
  80. package/lib/types/solana/instruction.d.ts +39 -0
  81. package/lib/types/solana/io-readable.d.ts +499 -0
  82. package/lib/types/solana/io-writeable.d.ts +893 -0
  83. package/lib/types/solana/json-rpc.d.ts +47 -0
  84. package/lib/types/solana/metadata.d.ts +84 -0
  85. package/lib/types/solana/mpl-core.d.ts +120 -0
  86. package/lib/types/solana/pda.d.ts +95 -0
  87. package/lib/types/solana/predict-prescribed-observers.d.ts +28 -0
  88. package/lib/types/solana/retry.d.ts +62 -0
  89. package/lib/types/solana/rpc-circuit-breaker.d.ts +78 -0
  90. package/lib/types/solana/send.d.ts +94 -0
  91. package/lib/types/solana/spawn-ant.d.ts +145 -0
  92. package/lib/types/solana/types.d.ts +82 -0
  93. package/lib/types/types/ant-registry.d.ts +43 -4
  94. package/lib/types/types/ant.d.ts +114 -96
  95. package/lib/types/types/common.d.ts +18 -74
  96. package/lib/types/types/faucet.d.ts +2 -2
  97. package/lib/types/types/io.d.ts +244 -158
  98. package/lib/types/types/token.d.ts +0 -12
  99. package/lib/types/utils/ant.d.ts +1 -12
  100. package/lib/types/utils/index.d.ts +0 -3
  101. package/lib/types/version.d.ts +1 -1
  102. package/package.json +36 -33
  103. package/lib/cjs/cli/cli.js +0 -822
  104. package/lib/cjs/cli/commands/antCommands.js +0 -113
  105. package/lib/cjs/cli/commands/arnsPurchaseCommands.js +0 -212
  106. package/lib/cjs/cli/commands/gatewayWriteCommands.js +0 -210
  107. package/lib/cjs/cli/commands/readCommands.js +0 -215
  108. package/lib/cjs/cli/commands/transfer.js +0 -159
  109. package/lib/cjs/cli/options.js +0 -470
  110. package/lib/cjs/cli/types.js +0 -2
  111. package/lib/cjs/cli/utils.js +0 -639
  112. package/lib/cjs/common/ant-registry.js +0 -155
  113. package/lib/cjs/common/ant-versions.js +0 -93
  114. package/lib/cjs/common/ant.js +0 -1182
  115. package/lib/cjs/common/arweave.js +0 -27
  116. package/lib/cjs/common/contracts/ao-process.js +0 -224
  117. package/lib/cjs/common/error.js +0 -64
  118. package/lib/cjs/common/faucet.js +0 -150
  119. package/lib/cjs/common/hyperbeam/hb.js +0 -173
  120. package/lib/cjs/common/index.js +0 -42
  121. package/lib/cjs/common/io.js +0 -1423
  122. package/lib/cjs/common/logger.js +0 -83
  123. package/lib/cjs/common/loggers/winston.js +0 -68
  124. package/lib/cjs/common/marketplace.js +0 -731
  125. package/lib/cjs/common/turbo.js +0 -223
  126. package/lib/cjs/constants.js +0 -41
  127. package/lib/cjs/node/index.js +0 -39
  128. package/lib/cjs/package.json +0 -1
  129. package/lib/cjs/types/ant-registry.js +0 -2
  130. package/lib/cjs/types/ant.js +0 -168
  131. package/lib/cjs/types/common.js +0 -2
  132. package/lib/cjs/types/faucet.js +0 -2
  133. package/lib/cjs/types/index.js +0 -37
  134. package/lib/cjs/types/io.js +0 -51
  135. package/lib/cjs/types/token.js +0 -116
  136. package/lib/cjs/utils/ant.js +0 -108
  137. package/lib/cjs/utils/ao.js +0 -432
  138. package/lib/cjs/utils/arweave.js +0 -285
  139. package/lib/cjs/utils/base64.js +0 -62
  140. package/lib/cjs/utils/hash.js +0 -56
  141. package/lib/cjs/utils/index.js +0 -38
  142. package/lib/cjs/utils/processes.js +0 -173
  143. package/lib/cjs/utils/random.js +0 -30
  144. package/lib/cjs/utils/schema.js +0 -15
  145. package/lib/cjs/utils/url.js +0 -37
  146. package/lib/cjs/version.js +0 -20
  147. package/lib/cjs/web/index.js +0 -41
  148. package/lib/esm/common/ant-versions.js +0 -87
  149. package/lib/esm/common/arweave.js +0 -21
  150. package/lib/esm/common/contracts/ao-process.js +0 -220
  151. package/lib/esm/common/hyperbeam/hb.js +0 -169
  152. package/lib/esm/common/marketplace.js +0 -724
  153. package/lib/esm/common/turbo.js +0 -215
  154. package/lib/esm/node/index.js +0 -20
  155. package/lib/esm/utils/ao.js +0 -420
  156. package/lib/esm/utils/arweave.js +0 -271
  157. package/lib/esm/utils/processes.js +0 -167
  158. package/lib/esm/web/index.js +0 -20
  159. package/lib/types/common/ant-versions.d.ts +0 -39
  160. package/lib/types/common/arweave.d.ts +0 -17
  161. package/lib/types/common/contracts/ao-process.d.ts +0 -47
  162. package/lib/types/common/hyperbeam/hb.d.ts +0 -88
  163. package/lib/types/common/marketplace.d.ts +0 -568
  164. package/lib/types/common/turbo.d.ts +0 -61
  165. package/lib/types/node/index.d.ts +0 -20
  166. package/lib/types/utils/ao.d.ts +0 -80
  167. package/lib/types/utils/arweave.d.ts +0 -79
  168. package/lib/types/utils/processes.d.ts +0 -39
  169. package/lib/types/web/index.d.ts +0 -20
@@ -0,0 +1,225 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Multi-source, multi-gateway funding plan builder + executor for the AR.IO
18
+ * Solana SDK.
19
+ *
20
+ * Lua-faithful port of `gar.getFundingPlan` / `gar.applyFundingPlan` from
21
+ * `ar-io-network-process/src/gar.lua`. Supports Delegation sources across
22
+ * multiple gateways in a single plan (closes BD-076).
23
+ *
24
+ * Drawdown order (matches Lua exactly):
25
+ * 1. Balance — taken first when `fundFrom in {'balance','any','plan'}`
26
+ * (`planBalanceDrawdown` in gar.lua:1456)
27
+ * 2. Withdrawal vaults — sorted asc by `available_at`, oldest-maturing
28
+ * first (`planVaultsDrawdown` in gar.lua:1510). Gateway-independent.
29
+ * 3. Excess delegated stake — iterates ALL gateways the user has delegated
30
+ * on (Lua-sorted: desc excess, asc perf, desc total stake, desc start
31
+ * timestamp). Up to MAX_DELEGATION_SOURCES gateways per plan.
32
+ * (`planExcessStakesDrawdown` in gar.lua:1559)
33
+ * 4. Minimum delegated stake — drains the floor on each touched gateway,
34
+ * auto-vaulting the residue. Same gateway iteration order as step 3.
35
+ * (`planMinimumStakesDrawdown` in gar.lua:1585)
36
+ *
37
+ * Operator stake is a Solana extension: Lua's funding plans never touch it.
38
+ * The picker excludes operator stake unless `opts.fundAsOperator === true`.
39
+ *
40
+ * The on-chain `pay_from_funding_plan` ix caps the source list at
41
+ * MAX_FUNDING_SOURCES (5) and Delegation sources at MAX_DELEGATION_SOURCES (3)
42
+ * (see `programs/ario-gar/src/state/mod.rs`). The planner enforces the same
43
+ * caps so `executeFundingPlan` calls never get rejected for
44
+ * `TooManyFundingSources` / `TooManyDelegationSources`.
45
+ */
46
+ import { AccountRole, type Address, type Rpc, type SolanaRpcApi, type SolanaRpcApiMainnet } from '@solana/kit';
47
+ /**
48
+ * The discovery + executor accept either the dev/test or the mainnet RPC API
49
+ * shape — they only use methods that are common to both (`getProgramAccounts`,
50
+ * `getAccountInfo`).
51
+ */
52
+ export type FundingPlanRpc = Rpc<SolanaRpcApi> | Rpc<SolanaRpcApiMainnet>;
53
+ import { type FundingSourceKind, type FundingSourceSpec } from '../types/io.js';
54
+ /**
55
+ * Hard cap on funding-plan length — must stay in sync with the on-chain
56
+ * `MAX_FUNDING_SOURCES` constant (`programs/ario-gar/src/state/mod.rs`).
57
+ */
58
+ export declare const MAX_FUNDING_SOURCES = 5;
59
+ /**
60
+ * Hard cap on Delegation sources within a single plan — must stay in sync
61
+ * with the on-chain `MAX_DELEGATION_SOURCES` constant.
62
+ */
63
+ export declare const MAX_DELEGATION_SOURCES = 3;
64
+ /** A single source the user can draw from. Discovery returns these. */
65
+ export type DiscoveredFundingSource = {
66
+ kind: 'balance';
67
+ available: bigint;
68
+ } | {
69
+ kind: 'delegation';
70
+ gateway: Address;
71
+ available: bigint;
72
+ /** Per-gateway floor; the residue auto-vaults if drained below this. */
73
+ minDelegationAmount: bigint;
74
+ /** Gateway performance ratio — used for Lua-faithful sort order. */
75
+ performanceRatio: number;
76
+ /** Total delegated stake on the gateway — secondary sort key. */
77
+ totalDelegatedStake: bigint;
78
+ /** Gateway start timestamp — tertiary sort key. */
79
+ startTimestamp: bigint;
80
+ } | {
81
+ kind: 'operatorStake';
82
+ gateway: Address;
83
+ available: bigint;
84
+ minOperatorStake: bigint;
85
+ } | {
86
+ kind: 'withdrawal';
87
+ withdrawalId: bigint;
88
+ gateway: Address;
89
+ available: bigint;
90
+ availableAt: bigint;
91
+ };
92
+ /** Output of `buildFundingPlan` when a plan covers the requested amount. */
93
+ export type FundingPlan = {
94
+ /** Source specs in declaration order — passed verbatim to the on-chain ix. */
95
+ sources: FundingSourceSpec[];
96
+ /**
97
+ * Per-source bound gateway, in declaration order. `undefined` for Balance
98
+ * and Withdrawal sources; set for Delegation and OperatorStake sources.
99
+ * Used by the executor to materialize per-source gateway PDA slots in
100
+ * `remaining_accounts`.
101
+ */
102
+ gatewayPerSource: (Address | undefined)[];
103
+ /**
104
+ * Indexes (into `sources`) of Delegation sources that will trigger an
105
+ * on-chain residue auto-vault (drained below `min_delegation_amount`).
106
+ * The executor must supply that many trailing residue_vault PDAs in
107
+ * `remaining_accounts`, in the same order as these indexes.
108
+ */
109
+ residueDelegationIndexes: number[];
110
+ /** Whether any Balance source is in the plan (drives optional `payer_token_account`). */
111
+ hasBalanceSource: boolean;
112
+ };
113
+ /** Discriminated error emitted when no plan covers the requested amount. */
114
+ export type InsufficientFundingError = {
115
+ kind: 'InsufficientFunding';
116
+ amountNeeded: bigint;
117
+ shortfall: bigint;
118
+ availableSources: DiscoveredFundingSource[];
119
+ message: string;
120
+ };
121
+ export type BuildFundingPlanOpts = {
122
+ /** SDK fundFrom mode — drives source preferences (balance / stakes / withdrawal / plan / any). */
123
+ fundFrom?: 'balance' | 'stakes' | 'withdrawal' | 'plan' | 'any';
124
+ /**
125
+ * When set, prefer this gateway first when iterating stake-locked
126
+ * delegation sources. Other gateways are still considered for additional
127
+ * fill (up to MAX_DELEGATION_SOURCES total).
128
+ */
129
+ preferGateway?: Address;
130
+ /** Solana extension: include OperatorStake in the picker. Default false (Lua parity). */
131
+ fundAsOperator?: boolean;
132
+ /** When set, use only sources of this kind (single-source mode). */
133
+ restrictToKind?: FundingSourceKind;
134
+ };
135
+ /**
136
+ * Enumerate the user's fund-from-eligible sources via `getProgramAccounts`
137
+ * + targeted reads.
138
+ *
139
+ * `getProgramAccounts` is restricted on most public Solana RPCs; callers
140
+ * pointing at default endpoints should switch to a DAS-equivalent RPC
141
+ * (Helius, Triton, etc.) or pass an explicit `sources` array on the
142
+ * fee-paying ix to skip discovery.
143
+ *
144
+ * Returns sources sorted in the Lua-faithful drawdown order so callers can
145
+ * iterate without re-sorting.
146
+ */
147
+ export declare function discoverFundingSources(rpc: FundingPlanRpc, owner: Address, opts: {
148
+ /** Mint of ARIO; required to compute the user's ATA. */
149
+ arioMint: Address;
150
+ /** Optional: pre-fetched balance from the user's ATA (bypasses RPC). */
151
+ balanceOverride?: bigint;
152
+ /** Optional ario-gar program override (defaults to deployed program). */
153
+ garProgram?: Address;
154
+ }): Promise<DiscoveredFundingSource[]>;
155
+ /**
156
+ * Build a multi-source funding plan that covers `amountNeeded` mARIO.
157
+ *
158
+ * Returns `{ kind: 'InsufficientFunding', ... }` when no plan covers the
159
+ * amount given the supplied sources — caller handles by topping up balance,
160
+ * choosing a different gateway, or surfacing the error to the user.
161
+ *
162
+ * Multi-gateway: Delegation sources span up to MAX_DELEGATION_SOURCES (3)
163
+ * different gateways. The planner iterates delegations in Lua-faithful order
164
+ * (or `opts.preferGateway` first if set), drawing excess from each before
165
+ * falling back to floor-draining (which auto-vaults the residue).
166
+ *
167
+ * OperatorStake (Solana extension) is bound to a single gateway when present.
168
+ * Withdrawal sources have NO gateway constraint.
169
+ */
170
+ export declare function buildFundingPlan(sources: DiscoveredFundingSource[], amountNeeded: bigint, opts?: BuildFundingPlanOpts): FundingPlan | InsufficientFundingError;
171
+ /**
172
+ * Materialize a `FundingPlan` into the per-source PDAs the on-chain ix
173
+ * expects in `remaining_accounts`.
174
+ *
175
+ * Layout (per source, in declaration order):
176
+ * - Balance: 0 slots
177
+ * - Delegation: 2 slots [gateway_pda, delegation_pda]
178
+ * - OperatorStake: 1 slot [gateway_pda]
179
+ * - Withdrawal: 1 slot [withdrawal_pda]
180
+ *
181
+ * Followed by N residue_vault PDAs (in the order produced by
182
+ * `predictResidueVaults`), one per element of `plan.residueDelegationIndexes`.
183
+ */
184
+ export declare function buildFundingPlanRemainingAccounts(plan: FundingPlan, owner: Address, opts?: {
185
+ /** Per-source override for Withdrawal PDAs. By index of Withdrawal sources in plan. */
186
+ withdrawalIds?: bigint[];
187
+ /** Residue-vault PDAs from `predictResidueVaults`, in plan order. */
188
+ residueVaults?: Address[];
189
+ garProgram?: Address;
190
+ }): Promise<{
191
+ address: Address;
192
+ role: AccountRole;
193
+ }[]>;
194
+ /**
195
+ * Pure helper: given an array of explicit `FundingSourceSpec`s and the
196
+ * decoded (delegation.amount, gateway.minDelegationAmount) for each
197
+ * Delegation source, return the indexes of sources that will trigger an
198
+ * on-chain residue auto-vault (post-drain in `(0, min)`).
199
+ *
200
+ * `delegationStates[i]` matches `sources[i]` by index — entries for non-
201
+ * Delegation sources are ignored. Pass `undefined` for those slots.
202
+ *
203
+ * Caller is responsible for fetching the on-chain state; this function
204
+ * is intentionally pure to keep it unit-testable without mocking RPC.
205
+ */
206
+ export declare function computeResidueIndexes(sources: {
207
+ kind: string;
208
+ amount: bigint;
209
+ }[], delegationStates: ({
210
+ delegationAmount: bigint;
211
+ minDelegationAmount: bigint;
212
+ } | undefined)[]): number[];
213
+ /**
214
+ * Predict the residue Withdrawal PDAs the on-chain ix will use for any
215
+ * Delegation source draining sub-min. Returns one PDA per
216
+ * `plan.residueDelegationIndexes` entry, sequenced from the user's current
217
+ * `WithdrawalCounter.next_id`.
218
+ */
219
+ export declare function predictResidueVaults(rpc: FundingPlanRpc, owner: Address, plan: FundingPlan, opts?: {
220
+ garProgram?: Address;
221
+ }): Promise<{
222
+ residueVaults: Address[];
223
+ withdrawalCounter: Address;
224
+ nextId: bigint;
225
+ }>;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Solana backend for the AR.IO SDK.
18
+ *
19
+ * This module provides Solana-native implementations of the AR.IO read/write
20
+ * interfaces, allowing consumers to interact with AR.IO protocol state
21
+ * stored on Solana instead of AO. All primitives come from `@solana/kit` —
22
+ * `@solana/web3.js` is not used.
23
+ *
24
+ * Usage:
25
+ * ```ts
26
+ * import {
27
+ * createSolanaRpc,
28
+ * createSolanaRpcSubscriptions,
29
+ * generateKeyPairSigner,
30
+ * } from '@solana/kit';
31
+ * import {
32
+ * SolanaARIOReadable,
33
+ * SolanaARIOWriteable,
34
+ * SolanaANTReadable,
35
+ * } from '@ar.io/sdk/solana';
36
+ *
37
+ * const rpc = createSolanaRpc('https://api.mainnet-beta.solana.com');
38
+ *
39
+ * // Read-only (RPC only)
40
+ * const ario = new SolanaARIOReadable({ rpc });
41
+ *
42
+ * // Read-write (signer + subscriptions client needed for confirmation)
43
+ * const rpcSubscriptions = createSolanaRpcSubscriptions(
44
+ * 'wss://api.mainnet-beta.solana.com',
45
+ * );
46
+ * const signer = await generateKeyPairSigner();
47
+ * const arioWrite = new SolanaARIOWriteable({ rpc, rpcSubscriptions, signer });
48
+ *
49
+ * // ANT (Arweave Name Token)
50
+ * const ant = new SolanaANTReadable({
51
+ * rpc,
52
+ * processId: 'MetaplexCoreAssetAddress...',
53
+ * });
54
+ * ```
55
+ */
56
+ export * from '../common/index.js';
57
+ export * from '../types/index.js';
58
+ export * from '../utils/index.js';
59
+ export { ARWEAVE_TX_REGEX, AR_IO_PROTOCOL, arweaveUri, FQDN_REGEX, MARIO_PER_ARIO, } from '../constants.js';
60
+ export { SolanaARIOReadable } from './io-readable.js';
61
+ export { type CrankAction, type CrankEpochStepOptions, type CrankEpochStepResult, isInvalidGatewayAccountError, SolanaARIOWriteable, } from './io-writeable.js';
62
+ export { SolanaANTReadable } from './ant-readable.js';
63
+ export { SolanaANTWriteable } from './ant-writeable.js';
64
+ export { SolanaANTRegistryReadable } from './ant-registry-readable.js';
65
+ export type { SolanaANTRegistryConfig } from './ant-registry-readable.js';
66
+ export { SolanaANTRegistryWriteable } from './ant-registry-writeable.js';
67
+ export type { SolanaANTRegistryWriteableConfig } from './ant-registry-writeable.js';
68
+ export type { AclMaintenanceOp, AclMaintenanceRole, } from '../types/ant-registry.js';
69
+ export { ANTEscrow, TokenEscrow, assertVaultClaimable, isVaultClaimable, CLOCK_SKEW_TOLERANCE_SECONDS, } from './escrow.js';
70
+ export type { ANTEscrowConfig, EscrowAntState, EscrowAssetType, EscrowProtocol, EscrowTokenState, } from './escrow.js';
71
+ export { canonicalMessage, canonicalMessageV2, deriveRecipientId, bytesToHexLower, } from './canonical-message.js';
72
+ export type { CanonicalMessageInput, CanonicalMessageV2Input, EscrowNetwork, } from './canonical-message.js';
73
+ export { spawnSolanaANT, ARIO_LOGO_TX_ID, DEFAULT_ANT_TRANSACTION_ID, } from './spawn-ant.js';
74
+ export type { SpawnSolanaANTParams, SpawnSolanaANTResult, SpawnSolanaANTState, } from './spawn-ant.js';
75
+ export { hashName, getArioConfigPDA, getBalancePDA, getVaultPDA, getVaultCounterPDA, getPrimaryNamePDA, getPrimaryNameRequestPDA, getGatewayRegistryPDA, getGarSettingsPDA, getGatewayPDA, getDelegationPDA, getWithdrawalPDA, getWithdrawalCounterPDA, getAllowlistPDA, getEpochPDA, getEpochSettingsPDA, getObservationPDA, getArnsRegistryPDA, getArnsSettingsPDA, getArnsRecordPDA, getArnsRecordPDAFromHash, getReservedNamePDA, getReturnedNamePDA, getDemandFactorPDA, getPrimaryNameReversePDA, getRedelegationRecordPDA, getAntConfigPDA, getAntControllersPDA, getAntRecordPDA, getAclConfigPDA, getAclPagePDA, getEscrowAntPDA, getEscrowTokenPDA, getEscrowVaultPDA, } from './pda.js';
76
+ export { BorshReader, BorshWriter, deserializeGateway, deserializeArnsRecord, deserializeVault, deserializeDelegation, deserializeBalance, deserializeEpochSettings, deserializeArioConfig, deserializeDemandFactor, deserializeReservedName, deserializeReturnedName, deserializeWithdrawal, deserializeRedelegationRecord, deserializePrimaryNameRequest, deserializePrimaryName, deserializeAllowlist, deserializeGarSettings, deserializeEpochSettingsFull, deserializeEpoch, deserializeObservation, deserializeAntConfig, deserializeAntControllers, deserializeAntRecord, deserializeAclConfig, deserializeAclPage, } from './deserialize.js';
77
+ export type { DeserializedAclEntry } from './deserialize.js';
78
+ export { predictPrescribedObservers, type RegistrySlotWeight, } from './predict-prescribed-observers.js';
79
+ export * from './constants.js';
80
+ export * from './clusters.js';
81
+ export { createCircuitBreakerRpc, defaultFallbackUrl, } from './rpc-circuit-breaker.js';
82
+ export type { CircuitBreakerRpcConfig, CircuitBreakerRpcOptions, } from './rpc-circuit-breaker.js';
83
+ export { withRetry, isRetryableError } from './retry.js';
84
+ export type { RetryOptions } from './retry.js';
85
+ export type { SolanaConfig, SolanaReadConfig, SolanaWriteConfig, SolanaRpc, SolanaRpcSubscriptions, SolanaSigner, SolanaTransactionResult, AccountData, } from './types.js';
86
+ export { parseTransactionEvents, parseEventsFromLogs, isEvent, } from './events.js';
87
+ export type { AnyEvent, AnyArioCoreEvent, AnyArioGarEvent, AnyArioArnsEvent, AnyArioAntEvent, AnyArioAntEscrowEvent, EventName, } from './events.js';
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Common Solana program/sysvar addresses used by the SDK.
18
+ *
19
+ * All AR.IO and Metaplex Core instructions are now built via Codama-generated
20
+ * builders under `./generated/<program>/instructions/*`. This module only
21
+ * re-exports the AR.IO program IDs and a few sysvar/system constants that
22
+ * the rest of the SDK still references by name.
23
+ */
24
+ import { type Address } from '@solana/kit';
25
+ import { ARIO_ANT_PROGRAM_ID, ARIO_ARNS_PROGRAM_ID, ARIO_CORE_PROGRAM_ID, ARIO_GAR_PROGRAM_ID } from './constants.js';
26
+ /**
27
+ * System program (11111111111111111111111111111111).
28
+ * Kit-native equivalent of web3.js's `SystemProgram.programId`.
29
+ */
30
+ export declare const SYSTEM_PROGRAM_ADDRESS: Address;
31
+ /**
32
+ * SPL Token program address.
33
+ */
34
+ export declare const TOKEN_PROGRAM_ADDRESS: Address;
35
+ /**
36
+ * Rent sysvar address.
37
+ */
38
+ export declare const SYSVAR_RENT_ADDRESS: Address;
39
+ export { ARIO_CORE_PROGRAM_ID, ARIO_GAR_PROGRAM_ID, ARIO_ARNS_PROGRAM_ID, ARIO_ANT_PROGRAM_ID, };