@ar.io/sdk 3.24.0 → 4.0.0-alpha.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 (169) hide show
  1. package/README.md +757 -589
  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 +227 -0
  6. package/lib/esm/cli/commands/gatewayWriteCommands.js +140 -23
  7. package/lib/esm/cli/commands/pruneCommands.js +154 -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 +303 -175
  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 +17 -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 +66 -258
  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
@@ -1,544 +1,59 @@
1
- import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord, AoANTSetBaseNameRecordParams, AoANTSetUndernameRecordParams, AoANTState, AoANTWrite, SortedANTRecords } from '../types/ant.js';
2
- import { AoClient, AoMessageResult, AoSigner, ProcessConfiguration, UpgradeAntProgressEvent, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
3
- import { forkANT, spawnANT } from '../utils/ao.js';
4
- import { AOProcess, Logger } from './index.js';
5
- type ANTConfigOptionalStrict = Required<ProcessConfiguration> & {
6
- strict?: boolean;
7
- hyperbeamUrl?: string;
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
+ import type { Address, Commitment } from '@solana/kit';
17
+ import type { SolanaRpc, SolanaRpcSubscriptions, SolanaSigner } from '../solana/types.js';
18
+ import type { ANTRead, ANTWrite } from '../types/ant.js';
19
+ /**
20
+ * Configuration for `ANT.init` (Solana-only).
21
+ *
22
+ * `processId` is the MPL Core asset pubkey (base58) for the ANT.
23
+ *
24
+ * `antProgramId` overrides the deployed `ario-ant` program id. Required on any
25
+ * cluster other than mainnet (devnet, localnet, Surfpool). If omitted, the
26
+ * SDK reads the `ANT Program` entry from the asset's Attributes plugin
27
+ * (BYO-ANT) and falls back to the canonical default. Callers who already know
28
+ * the program (e.g. immediately after `ANT.spawn`) can pass it explicitly to
29
+ * skip the lookup.
30
+ *
31
+ * SECURITY: the `ANT Program` trait is untrusted asset/RPC data. For a
32
+ * read-only client it's used as-is, but a writeable client (signer present)
33
+ * will NOT sign against an auto-detected *non-canonical* program — it throws
34
+ * unless you opted in by passing `antProgramId` explicitly. This prevents a
35
+ * malicious asset or spoofed RPC response from redirecting your signed
36
+ * transaction to an attacker-controlled program.
37
+ */
38
+ export type ANTConfig = {
39
+ processId: string;
40
+ rpc: SolanaRpc;
41
+ /** Required for write operations (needed by kit's sendAndConfirm). */
42
+ rpcSubscriptions?: SolanaRpcSubscriptions;
43
+ commitment?: Commitment;
44
+ signer?: SolanaSigner;
45
+ antProgramId?: Address;
8
46
  };
9
- type ANTConfigNoSigner = ANTConfigOptionalStrict;
10
- type ANTConfigWithSigner = WithSigner<ANTConfigOptionalStrict>;
11
47
  export declare class ANT {
48
+ static init(config: ANTConfig & {
49
+ signer: SolanaSigner;
50
+ rpcSubscriptions: SolanaRpcSubscriptions;
51
+ }): Promise<ANTWrite>;
52
+ static init(config: ANTConfig): Promise<ANTRead>;
12
53
  /**
13
- * Versions of ANTs according to the ANT registry.
14
- *
15
- * Needs to be wrapped in a getter to avoid circular dependency issues.
54
+ * Spawn a new ANT mints an MPL Core asset and initializes the
55
+ * `ario-ant` PDAs in a single transaction. Returns
56
+ * `{ processId, mint, signature }`.
16
57
  */
17
- static get versions(): import("../types/ant.js").AoANTVersionsRead;
18
- /**
19
- * Spawn a new ANT.
20
- */
21
- static spawn: typeof spawnANT;
22
- /**
23
- * Fork an ANT to a new process.
24
- *
25
- * @param config
26
- */
27
- static fork: typeof forkANT;
28
- /**
29
- * Upgrade an ANT by forking it to the latest version and reassigning names.
30
- *
31
- *
32
- * @param config Configuration object for the upgrade process
33
- * @returns Promise resolving to the forked process ID and successfully reassigned names
34
- */
35
- static upgrade({ signer, antProcessId, reassignAffiliatedNames, names, arioProcessId, antRegistryId, ao, logger, skipVersionCheck, onSigningProgress, hyperbeamUrl, }: {
36
- signer: AoSigner;
37
- antProcessId: string;
38
- arioProcessId?: string;
39
- skipVersionCheck?: boolean;
40
- ao?: AoClient;
41
- logger?: Logger;
42
- antRegistryId?: string;
43
- hyperbeamUrl?: string;
44
- onSigningProgress?: (name: keyof UpgradeAntProgressEvent, payload: UpgradeAntProgressEvent[keyof UpgradeAntProgressEvent]) => void;
45
- } & ({
46
- names: string[];
47
- reassignAffiliatedNames?: false;
48
- } | {
49
- names?: never;
50
- reassignAffiliatedNames: true;
51
- })): Promise<{
52
- forkedProcessId: string;
53
- reassignedNames: Record<string, AoMessageResult>;
54
- failedReassignedNames: Record<string, {
55
- id?: string;
56
- error: Error;
57
- }>;
58
- }>;
59
- /**
60
- * Initialize overloads.
61
- *
62
- * @param config
63
- */
64
- static init(config: ANTConfigNoSigner): AoANTRead;
65
- static init(config: ANTConfigWithSigner): AoANTWrite;
66
- }
67
- export declare class AoANTReadable implements AoANTRead {
68
- protected process: AOProcess;
69
- readonly processId: string;
70
- readonly hyperbeamUrl: URL | undefined;
71
- private strict;
72
- private checkHyperBeamPromise;
73
- private moduleId;
74
- private moduleIdPromise;
75
- private logger;
76
- constructor(config: ANTConfigOptionalStrict);
77
- /**
78
- * Check if the process is HyperBeam compatible. If so, we'll use the HyperBeam node to fetch the state.
79
- *
80
- * @returns {Promise<boolean>} True if the process is HyperBeam compatible, false otherwise.
81
- */
82
- private checkHyperBeamCompatibility;
83
- getState({ strict }?: AntReadOptions): Promise<AoANTState>;
84
- getInfo({ strict }?: AntReadOptions): Promise<AoANTInfo>;
85
- /**
86
- * Returns the TX ID of the logo set for the ANT.
87
- */
88
- getLogo(): Promise<string>;
89
- /**
90
- * Gets the module ID of the current ANT process by querying its spawn transaction tags.
91
- * Results are cached after the first successful fetch.
92
- *
93
- * @param graphqlUrl The GraphQL endpoint URL (defaults to Arweave's GraphQL endpoint)
94
- * @param retries Number of retry attempts (defaults to 3)
95
- * @returns Promise<string> The module ID used to spawn this ANT process
96
- * @example
97
- * ```ts
98
- * const moduleId = await ant.getModuleId();
99
- * console.log(`ANT was spawned with module: ${moduleId}`);
100
- * ```
101
- */
102
- getModuleId({ graphqlUrl, retries, }?: {
103
- graphqlUrl?: string;
104
- retries?: number;
105
- }): Promise<string>;
106
- /**
107
- * Internal method to fetch the module ID from GraphQL.
108
- *
109
- * TODO: this could be more like get process headers/metadata and fetch additional details.
110
- *
111
- * It seems like module is the only relevant one, but scheduler and authority are also available.
112
- */
113
- private fetchModuleId;
114
- /**
115
- * Gets the version string of the current ANT by matching its module ID
116
- * with versions from the ANT registry.
117
- *
118
- * @param antRegistryId The ANT registry process ID (defaults to mainnet registry)
119
- * @param graphqlUrl The GraphQL endpoint URL for getModuleId (defaults to Arweave's GraphQL endpoint)
120
- * @param retries Number of retry attempts for getModuleId (defaults to 3)
121
- * @returns Promise<string> The version string (e.g., "1.0.15") or "unknown" if not found
122
- * @example
123
- * ```ts
124
- * const version = await ant.getVersion();
125
- * console.log(`ANT is running version: ${version}`);
126
- * ```
127
- */
128
- getVersion({ antRegistryId, graphqlUrl, retries, }?: {
129
- antRegistryId?: string;
130
- graphqlUrl?: string;
131
- retries?: number;
132
- }): Promise<string>;
133
- /**
134
- * Checks if the current ANT version is the latest according to the ANT registry.
135
- *
136
- * @param antRegistryId Optional ANT registry process ID. Defaults to mainnet ANT registry.
137
- * @param graphqlUrl Optional GraphQL endpoint. Defaults to https://arweave.net/graphql.
138
- * @param retries Optional number of retries for fetching module ID. Defaults to 3.
139
- * @returns {Promise<boolean>} True if current ANT version is the latest, false otherwise.
140
- */
141
- isLatestVersion({ antRegistryId, graphqlUrl, retries, }?: {
142
- antRegistryId?: string;
143
- graphqlUrl?: string;
144
- retries?: number;
145
- }): Promise<boolean>;
146
- /**
147
- * @param undername @type {string} The domain name.
148
- * @returns {Promise<ANTRecord>} The record of the undername domain.
149
- * @example
150
- * Get the current record
151
- * ```ts
152
- * ant.getRecord({ undername: "john" });
153
- * ```
154
- */
155
- getRecord({ undername }: {
156
- undername: string;
157
- }, { strict }?: AntReadOptions): Promise<AoANTRecord>;
158
- /**
159
- * @returns {Promise<SortedANTRecords>} All the undernames managed by the ANT.
160
- * @example
161
- * Get the current records
162
- * ```ts
163
- * ant.getRecords();
164
- * ````
165
- */
166
- getRecords({ strict }?: AntReadOptions): Promise<SortedANTRecords>;
167
- /**
168
- * @returns {Promise<string>} The owner of the ANT.
169
- * @example
170
- * Get the current owner
171
- * ```ts
172
- * ant.getOwner();
173
- * ```
174
- */
175
- getOwner({ strict }?: AntReadOptions): Promise<string>;
176
- /**
177
- * @returns {Promise<string[]>} The controllers of the ANT.
178
- * @example
179
- * Get the controllers of the ANT.
180
- * ```ts
181
- * ant.getControllers();
182
- * ```
183
- */
184
- getControllers({ strict }?: AntReadOptions): Promise<WalletAddress[]>;
185
- /**
186
- * @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
187
- * @example
188
- * Get the current name
189
- * ```ts
190
- * ant.getName();
191
- * ```
192
- */
193
- getName({ strict }?: AntReadOptions): Promise<string>;
194
- /**
195
- * @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
196
- * @example
197
- * The current ticker of the ANT.
198
- * ```ts
199
- * ant.getTicker();
200
- * ```
201
- */
202
- getTicker({ strict }?: AntReadOptions): Promise<string>;
203
- /**
204
- * @returns {Promise<Record<WalletAddress, number>>} The balances of the ANT
205
- * @example
206
- * The current balances of the ANT.
207
- * ```ts
208
- * ant.getBalances();
209
- * ```
210
- */
211
- getBalances({ strict }?: AntReadOptions): Promise<Record<string, number>>;
212
- /**
213
- * @param address @type {string} The address of the account you want the balance of.
214
- * @returns {Promise<number>} The balance of the provided address
215
- * @example
216
- * The current balance of the address.
217
- * ```ts
218
- * ant.getBalance({ address });
219
- * ```
220
- */
221
- getBalance({ address }: {
222
- address: string;
223
- }, { strict }?: AntReadOptions): Promise<number>;
224
- /**
225
- * @returns {Promise<AoANTHandler[]>} The handlers of the ANT.
226
- * @example
227
- * Get the handlers of the ANT.
228
- * ```ts
229
- * const handlers = await ant.getHandlers();
230
- * ```
231
- */
232
- getHandlers(): Promise<AoANTHandler[]>;
233
- }
234
- export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite {
235
- private signer;
236
- constructor({ signer, ...config }: WithSigner<Required<ProcessConfiguration>> & {
237
- strict?: boolean;
238
- });
239
- /**
240
- * @param target @type {string} The address of the account you want to transfer the ANT to.
241
- * @param removeControllers @type {boolean} Whether to remove the controllers of the ANT. Default is true.
242
- * @example
243
- * ```ts
244
- * ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk", removeControllers: false }); // will not remove the controllers of the ANT and just transfer ownership
245
- * ```
246
- * @returns {Promise<AoMessageResult>} The result of the interaction.
247
- * @example
248
- * ```ts
249
- * ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
250
- * ```
251
- */
252
- transfer({ target, removeControllers, }: {
253
- target: string;
254
- removeControllers?: boolean;
255
- }, options?: WriteOptions): Promise<AoMessageResult>;
256
- /**
257
- * @param controller @type {string} The address of the account you want to set as a controller.
258
- * @returns {Promise<AoMessageResult>} The result of the interaction.
259
- * @example
260
- * ```ts
261
- * ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
262
- * ```
263
- */
264
- addController({ controller, }: {
265
- controller: string;
266
- }, options?: WriteOptions): Promise<AoMessageResult>;
267
- /**
268
- * @param controller @type {string} The address of the account you want to remove from the controllers list
269
- * @returns {Promise<AoMessageResult>} The result of the interaction.
270
- * @example
271
- * ```ts
272
- * ant.removeController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
273
- * ```
274
- */
275
- removeController({ controller, }: {
276
- controller: string;
277
- }, options?: WriteOptions): Promise<AoMessageResult>;
278
- /**
279
- * Sets the transactionId and ttlSeconds of a record (for updating the top level name, use undername "@".)
280
- *
281
- * @deprecated Use setUndernameRecord instead for undernames, and setBaseNameRecord instead for the top level name (e.g. "@")
282
- * @param undername @type {string} The record you want to set the transactionId and ttlSeconds of.
283
- * @param transactionId @type {string} The transactionId of the record.
284
- * @param ttlSeconds @type {number} The time to live of the record.
285
- * @param owner @type {string} Optional owner address for the record.
286
- * @param displayName @type {string} Optional display name for the record.
287
- * @param logo @type {string} Optional logo transaction ID for the record.
288
- * @param description @type {string} Optional description for the record.
289
- * @param keywords @type {string[]} Optional keywords array for the record.
290
- * @returns {Promise<AoMessageResult>} The result of the interaction.
291
- */
292
- setRecord({ undername, transactionId, ttlSeconds, owner, displayName, logo, description, keywords, }: AoANTSetUndernameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
293
- /**
294
- * Sets the top level name of the ANT. This is the name that will be used to resolve the ANT (e.g. ardrive.ar.io)
295
- *
296
- * @param transactionId @type {string} The transactionId of the record.
297
- * @param ttlSeconds @type {number} The time to live of the record.
298
- * @param owner @type {string} Optional owner address for the record.
299
- * @param displayName @type {string} Optional display name for the record.
300
- * @param logo @type {string} Optional logo transaction ID for the record.
301
- * @param description @type {string} Optional description for the record.
302
- * @param keywords @type {string[]} Optional keywords array for the record.
303
- * @returns {Promise<AoMessageResult>} The result of the interaction.
304
- * @example
305
- * ```ts
306
- * ant.setBaseNameRecord({ transactionId: "432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM", ttlSeconds: 100 }); // ardrive.ar.io will resolve to the provided transaction id and be cached for 100 seconds by clients
307
- * ```
308
- */
309
- setBaseNameRecord({ transactionId, ttlSeconds, owner, displayName, logo, description, keywords, }: AoANTSetBaseNameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
310
- /**
311
- * Adds or updates an undername of the ANT. An undername is appended to the base name of the ANT (e.g. ardrive.ar.io) to form a fully qualified name (e.g. dapp_ardrive.ar.io)
312
- *
313
- * @param undername @type {string} The undername of the ANT.
314
- * @param transactionId @type {string} The transactionId of the record.
315
- * @param ttlSeconds @type {number} The time to live of the record.
316
- * @param owner @type {string} Optional owner address for the record.
317
- * @param displayName @type {string} Optional display name for the record.
318
- * @param logo @type {string} Optional logo transaction ID for the record.
319
- * @param description @type {string} Optional description for the record.
320
- * @param keywords @type {string[]} Optional keywords array for the record.
321
- * @returns {Promise<AoMessageResult>} The result of the interaction.
322
- * @example
323
- * ```ts
324
- * ant.setUndernameRecord({ undername: "dapp", transactionId: "432l1cy0aksiL_x9M359faGzM_yjralacHIUo8_nQXM", ttlSeconds: 100 }); // dapp_ardrive.ar.io will resolve to the provided transaction id and be cached for 100 seconds by clients
325
- * ```
326
- */
327
- setUndernameRecord({ undername, transactionId, ttlSeconds, owner, displayName, logo, description, keywords, }: AoANTSetUndernameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
328
- /**
329
- * Removes an undername from the ANT. This will remove the undername from the ANT.
330
- *
331
- * @param undername @type {string} The undername you want to remove.
332
- * @returns {Promise<AoMessageResult>} The result of the interaction.
333
- * @example
334
- * ```ts
335
- * ant.removeUndernameRecord({ undername: "dapp" }); // removes dapp_ardrive.ar.io
336
- * ```
337
- */
338
- removeUndernameRecord({ undername, }: {
339
- undername: string;
340
- }): Promise<AoMessageResult>;
341
- /**
342
- * Removes a record from the ANT. This will remove the record from the ANT. If '@' is provided, the top level name will be removed.
343
- *
344
- * @deprecated Use removeUndernameRecord instead.
345
- * @param undername @type {string} The record you want to remove.
346
- * @returns {Promise<AoMessageResult>} The result of the interaction.
347
- * @example
348
- * ```ts
349
- * ant.removeRecord({ undername: "dapp" }); // removes dapp_ardrive.ar.io
350
- * ```
351
- */
352
- removeRecord({ undername, }: {
353
- undername: string;
354
- }, options?: WriteOptions): Promise<AoMessageResult>;
355
- /**
356
- * Sets the ticker of the ANT. This is the abbreviation displayed in ecosystem apps.
357
- *
358
- * @param ticker @type {string} Sets the ANT Ticker.
359
- * @returns {Promise<AoMessageResult>} The result of the interaction.
360
- * @example
361
- * ```ts
362
- * ant.setTicker({ ticker: "KAPOW" });
363
- * ```
364
- */
365
- setTicker({ ticker }: {
366
- ticker: string;
367
- }, options?: WriteOptions): Promise<AoMessageResult>;
368
- /**
369
- * Sets the name of the ANT. This is the display name of the ANT. This is NOT the base name record.
370
- *
371
- * @param name @type {string} Sets the Name of the ANT.
372
- * @returns {Promise<AoMessageResult>} The result of the interaction.
373
- * @example
374
- * ```ts
375
- * ant.setName({ name: "test" }); // results in the resolution of `test_<apexName>.ar.io`
376
- * ```
377
- */
378
- setName({ name }: {
379
- name: string;
380
- }, options?: WriteOptions): Promise<AoMessageResult>;
381
- /**
382
- * Sets the description of the ANT. This is the description of the ANT displayed in ecosystem apps.
383
- *
384
- * @param description @type {string} Sets the ANT Description.
385
- * @returns {Promise<AoMessageResult>} The result of the interaction.
386
- * @example
387
- * ```ts
388
- * ant.setDescription({ description: "This name is used for the ArDrive" });
389
- * ```
390
- */
391
- setDescription({ description }: {
392
- description: string;
393
- }, options?: WriteOptions): Promise<AoMessageResult>;
394
- /**
395
- * Sets the keywords of the ANT. This is the keywords of the ANT displayed in ecosystem apps.
396
- *
397
- * @param keywords @type {string[]} Sets the ANT Keywords.
398
- * @returns {Promise<AoMessageResult>} The result of the interaction.
399
- * @example
400
- * ```ts
401
- * ant.setKeywords({ keywords: ['keyword1', 'keyword2', 'keyword3']});
402
- * ```
403
- */
404
- setKeywords({ keywords }: {
405
- keywords: string[];
406
- }, options?: WriteOptions): Promise<AoMessageResult>;
407
- /**
408
- * Sets the logo of the ANT. This is the logo of the ANT displayed in ecosystem apps. Additionally, this logo is displayed for any primary names affiliated with the ANT.
409
- *
410
- * @param txId @type {string} - Arweave transaction id of the logo we want to set
411
- * @param options @type {WriteOptions} - additional options to add to the write interaction (optional)
412
- * @returns {Promise<AoMessageResult>} The result of the interaction.
413
- * @example
414
- * ```ts
415
- * ant.setLogo({ logo: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f" });
416
- * ```
417
- */
418
- setLogo({ txId }: {
419
- txId: string;
420
- }, options?: WriteOptions): Promise<AoMessageResult>;
421
- /**
422
- * Releases an ArNS name associated with the ANT. This will release the name to the public and allow anyone to register it. All primary names must be removed before the name can be released.
423
- *
424
- * @param name @type {string} The name you want to release. The name will be put up for as a recently returned name on the ARIO contract. 50% of the winning bid will be distributed to the ANT owner at the time of purchase. If no purchase in the recently returned name period (14 epochs), the name will be released and can be reregistered by anyone.
425
- * @param arioProcessId @type {string} The processId of the ARIO contract. This is where the ANT will send the message to release the name.
426
- * @returns {Promise<AoMessageResult>} The result of the interaction.
427
- * @example
428
- * ```ts
429
- * ant.releaseName({ name: "ardrive", arioProcessId: ARIO_MAINNET_PROCESS_ID });
430
- * ```
431
- */
432
- releaseName({ name, arioProcessId }: {
433
- name: string;
434
- arioProcessId: string;
435
- }, options?: WriteOptions): Promise<AoMessageResult>;
436
- /**
437
- * Sends a message to the ARIO contract to reassign the the base ArNS name to a new ANT. This can only be done by the current owner of the ANT.
438
- *
439
- * @param name @type {string} The name you want to reassign.
440
- * @param arioProcessId @type {string} The processId of the ARIO contract.
441
- * @param antProcessId @type {string} The processId of the ANT contract.
442
- * @returns {Promise<AoMessageResult>} The result of the interaction.
443
- * @example
444
- * ```ts
445
- * ant.reassignName({ name: "ardrive", arioProcessId: ARIO_MAINNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
446
- * ```
447
- */
448
- reassignName({ name, arioProcessId, antProcessId, }: {
449
- name: string;
450
- arioProcessId: string;
451
- antProcessId: string;
452
- }, options?: WriteOptions): Promise<AoMessageResult>;
453
- /**
454
- * Approves a primary name request for a given name or address.
455
- *
456
- * @param name @type {string} The name you want to approve.
457
- * @param address @type {WalletAddress} The address you want to approve.
458
- * @param arioProcessId @type {string} The processId of the ARIO contract.
459
- * @returns {Promise<AoMessageResult>} The result of the interaction.
460
- * @example
461
- * ```ts
462
- * ant.approvePrimaryNameRequest({ name: "ardrive", address: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f", arioProcessId: ARIO_MAINNET_PROCESS_ID }); // approves the request for ardrive.ar.io to be registered by the address
463
- * ```
464
- */
465
- approvePrimaryNameRequest({ name, address, arioProcessId, }: {
466
- name: string;
467
- address: WalletAddress;
468
- arioProcessId: string;
469
- }, options?: WriteOptions): Promise<AoMessageResult>;
470
- /**
471
- * Removes primary names from the ANT. This will remove the primary names associated with the base ArNS name controlled by this ANT. All primary names must be removed before the name can be released.
472
- *
473
- * @param names @type {string[]} The names you want to remove.
474
- * @param arioProcessId @type {string} The processId of the ARIO contract.
475
- * @param notifyOwners @type {boolean} Whether to notify the owners of the primary names.
476
- * @returns {Promise<AoMessageResult>} The result of the interaction.
477
- * @example
478
- * ```ts
479
- * ant.removePrimaryNames({ names: ["ardrive", "dapp_ardrive"], arioProcessId: ARIO_MAINNET_PROCESS_ID, notifyOwners: true }); // removes the primary names and associated wallet addresses assigned to "ardrive" and "dapp_ardrive"
480
- * ```
481
- */
482
- removePrimaryNames({ names, arioProcessId, notifyOwners, }: {
483
- names: string[];
484
- arioProcessId: string;
485
- notifyOwners?: boolean;
486
- }, options?: WriteOptions): Promise<AoMessageResult>;
487
- /**
488
- * Upgrade this ANT by forking it to the latest version and reassigning names.
489
- *
490
- * This is a convenience method that calls the static ANT.upgrade() method
491
- * using this instance's process ID and signer.
492
- *
493
- * current version with latest ANT registry version and skip if already up to date.
494
- *
495
- * @param names @type {string[]} The ArNS names to reassign to the upgraded ANT.
496
- * @param arioProcessId @type {string} The processId of the ARIO contract.
497
- * @param antRegistryId @type {string} Optional ANT registry ID.
498
- * @param onSigningProgress Progress callback function.
499
- * @returns {Promise} The upgrade results.
500
- * @example
501
- * ```ts
502
- * const result = await ant.upgrade({
503
- * names: ["example", "test"],
504
- * arioProcessId: ARIO_MAINNET_PROCESS_ID
505
- * });
506
- * console.log(`Upgraded to process: ${result.forkedProcessId}`);
507
- * ```
508
- */
509
- upgrade(params?: {
510
- arioProcessId?: string;
511
- antRegistryId?: string;
512
- skipVersionCheck?: boolean;
513
- onSigningProgress?: (name: keyof UpgradeAntProgressEvent, payload: UpgradeAntProgressEvent[keyof UpgradeAntProgressEvent]) => void;
514
- } & ({
515
- names: string[];
516
- reassignAffiliatedNames?: false;
517
- } | {
518
- names?: never;
519
- reassignAffiliatedNames?: true;
520
- })): Promise<{
521
- forkedProcessId: string;
522
- reassignedNames: Record<string, AoMessageResult>;
523
- failedReassignedNames: Record<string, {
524
- id?: string;
525
- error: Error;
526
- }>;
527
- }>;
528
- /**
529
- * Transfers ownership of a specific record (undername) to another address. This allows delegation of control for individual records within an ANT while maintaining the ANT owner's ultimate authority.
530
- *
531
- * @param undername @type {string} The subdomain/record whose ownership you want to transfer.
532
- * @param recipient @type {string} The address of the new owner for this record.
533
- * @returns {Promise<AoMessageResult>} The result of the interaction.
534
- * @example
535
- * ```ts
536
- * ant.transferRecord({ undername: "alice", recipient: "new-owner-address-123..." }); // transfers ownership of the "alice" record to the new owner
537
- * ```
538
- */
539
- transferRecord({ undername, recipient, }: {
540
- undername: string;
541
- recipient: string;
542
- }, options?: WriteOptions): Promise<AoMessageResult>;
58
+ static spawn(params: import('../solana/spawn-ant.js').SpawnSolanaANTParams): Promise<import('../solana/spawn-ant.js').SpawnSolanaANTResult>;
543
59
  }
544
- export {};
@@ -14,17 +14,29 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ARIOWithFaucet, TokenFaucet } from '../types/faucet.js';
17
- import { ARIOReadable, ARIOWriteable } from './io.js';
17
+ import { ARIORead, ARIOWrite } from '../types/index.js';
18
18
  /**
19
- * Creates a proxy object that implements the TokenFaucet interface. It wraps the ARIOReadable instance and adds methods for claiming tokens from the faucet API.
20
- * @param arioInstance - The ARIOReadable instance
21
- * @param faucetApiUrl - The URL of the faucet API
22
- * @returns A proxy object that implements the TokenFaucet interface
19
+ * Wrap an ARIO instance with a `.faucet` namespace bound to the HTTP faucet
20
+ * backend. The faucet itself talks to a hosted HTTP service that issues
21
+ * test-ARIO transfers it is not tied to any specific on-chain backend.
22
+ *
23
+ * NOTE: the AR.IO faucet backend has not yet been ported to issue Solana-
24
+ * mint transfers. The SDK surface is kept stable so consumers can wire up
25
+ * the new backend without code changes once it ships. The `processId`
26
+ * parameter identifies the faucet on the server side (legacy AO process
27
+ * id today; will likely become a Solana mint pubkey).
23
28
  */
24
- export declare function createFaucet({ arioInstance, faucetApiUrl, }: {
25
- arioInstance: ARIOReadable | ARIOWriteable;
29
+ export declare function createFaucet({ arioInstance, faucetApiUrl, processId, }: {
30
+ arioInstance: ARIORead | ARIOWrite;
26
31
  faucetApiUrl?: string;
27
- }): ARIOWithFaucet<ARIOReadable | ARIOWriteable>;
32
+ /**
33
+ * Identifier the faucet backend uses to scope claim requests. Required —
34
+ * the backend has no implicit default. Today this is the AO process id
35
+ * for ARIO; on Solana this will be replaced by the ARIO mint pubkey when
36
+ * the faucet backend gains Solana support.
37
+ */
38
+ processId: string;
39
+ }): ARIOWithFaucet<ARIORead | ARIOWrite>;
28
40
  export declare class ARIOTokenFaucet implements TokenFaucet {
29
41
  private faucetUrl;
30
42
  private processId;
@@ -18,8 +18,5 @@ export * from './logger.js';
18
18
  export * from './loggers/winston.js';
19
19
  export * from './ant.js';
20
20
  export * from './ant-registry.js';
21
- export * from './ant-versions.js';
22
21
  export * from './faucet.js';
23
- export * from './marketplace.js';
24
22
  export * from './io.js';
25
- export * from './contracts/ao-process.js';