@ar.io/sdk 3.19.0-alpha.1 → 3.19.0-alpha.11
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.
- package/README.md +155 -7
- package/bundles/web.bundle.min.js +88 -72
- package/lib/cjs/cli/cli.js +14 -1
- package/lib/cjs/cli/commands/antCommands.js +82 -16
- package/lib/cjs/cli/options.js +36 -1
- package/lib/cjs/cli/utils.js +25 -11
- package/lib/cjs/common/ant.js +452 -12
- package/lib/cjs/common/io.js +2 -2
- package/lib/cjs/constants.js +2 -1
- package/lib/cjs/types/ant.js +18 -0
- package/lib/cjs/utils/ant.js +4 -0
- package/lib/cjs/utils/ao.js +3 -1
- package/lib/cjs/utils/processes.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +16 -3
- package/lib/esm/cli/commands/antCommands.js +81 -17
- package/lib/esm/cli/options.js +35 -0
- package/lib/esm/cli/utils.js +24 -11
- package/lib/esm/common/ant.js +453 -13
- package/lib/esm/common/io.js +2 -2
- package/lib/esm/constants.js +1 -0
- package/lib/esm/types/ant.js +18 -0
- package/lib/esm/utils/ant.js +4 -0
- package/lib/esm/utils/ao.js +3 -1
- package/lib/esm/utils/processes.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/antCommands.d.ts +12 -0
- package/lib/types/cli/options.d.ts +25 -0
- package/lib/types/cli/types.d.ts +1 -0
- package/lib/types/cli/utils.d.ts +15 -2
- package/lib/types/common/ant.d.ts +167 -6
- package/lib/types/common/io.d.ts +1 -1
- package/lib/types/constants.d.ts +1 -0
- package/lib/types/types/ant.d.ts +131 -9
- package/lib/types/types/common.d.ts +31 -0
- package/lib/types/utils/ant.d.ts +4 -0
- package/lib/types/utils/ao.d.ts +2 -1
- package/lib/types/utils/processes.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +3 -2
|
@@ -19,3 +19,15 @@ import { CLIWriteOptionsFromAoAntParams } from '../types.js';
|
|
|
19
19
|
export declare function setAntRecordCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
|
|
20
20
|
export declare function setAntBaseNameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetBaseNameRecordParams>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
|
|
21
21
|
export declare function setAntUndernameCLICommand(o: CLIWriteOptionsFromAoAntParams<AoANTSetUndernameRecordParams>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
|
|
22
|
+
export declare function transferRecordOwnershipCLICommand(o: CLIWriteOptionsFromAoAntParams<{
|
|
23
|
+
undername: string;
|
|
24
|
+
recipient: string;
|
|
25
|
+
}>): Promise<import("../../types/common.js").AoMessageResult<Record<string, string | number | boolean | null>>>;
|
|
26
|
+
export declare function upgradeAntCLICommand(o: CLIWriteOptionsFromAoAntParams<Record<string, unknown>>): Promise<{
|
|
27
|
+
forkedProcessId: string;
|
|
28
|
+
reassignedNames: Record<string, import("../../types/common.js").AoMessageResult>;
|
|
29
|
+
failedReassignedNames: Record<string, {
|
|
30
|
+
id?: string;
|
|
31
|
+
error: string;
|
|
32
|
+
}>;
|
|
33
|
+
}>;
|
|
@@ -247,6 +247,14 @@ export declare const optionMap: {
|
|
|
247
247
|
description: string;
|
|
248
248
|
type: string;
|
|
249
249
|
};
|
|
250
|
+
owner: {
|
|
251
|
+
alias: string;
|
|
252
|
+
description: string;
|
|
253
|
+
};
|
|
254
|
+
displayName: {
|
|
255
|
+
alias: string;
|
|
256
|
+
description: string;
|
|
257
|
+
};
|
|
250
258
|
names: {
|
|
251
259
|
alias: string;
|
|
252
260
|
description: string;
|
|
@@ -282,6 +290,10 @@ export declare const optionMap: {
|
|
|
282
290
|
alias: string;
|
|
283
291
|
description: string;
|
|
284
292
|
};
|
|
293
|
+
module: {
|
|
294
|
+
alias: string;
|
|
295
|
+
description: string;
|
|
296
|
+
};
|
|
285
297
|
token: {
|
|
286
298
|
alias: string;
|
|
287
299
|
description: string;
|
|
@@ -296,6 +308,11 @@ export declare const optionMap: {
|
|
|
296
308
|
alias: string;
|
|
297
309
|
description: string;
|
|
298
310
|
};
|
|
311
|
+
reassignAffiliatedNames: {
|
|
312
|
+
alias: string;
|
|
313
|
+
description: string;
|
|
314
|
+
type: string;
|
|
315
|
+
};
|
|
299
316
|
};
|
|
300
317
|
export declare const walletOptions: {
|
|
301
318
|
alias: string;
|
|
@@ -390,3 +407,11 @@ export declare const setAntUndernameOptions: {
|
|
|
390
407
|
alias: string;
|
|
391
408
|
description: string;
|
|
392
409
|
}[];
|
|
410
|
+
export declare const upgradeAntOptions: {
|
|
411
|
+
alias: string;
|
|
412
|
+
description: string;
|
|
413
|
+
}[];
|
|
414
|
+
export declare const transferRecordOwnershipOptions: {
|
|
415
|
+
alias: string;
|
|
416
|
+
description: string;
|
|
417
|
+
}[];
|
package/lib/types/cli/types.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export type ANTStateCLIOptions = WriteActionCLIOptions & {
|
|
|
107
107
|
controllers?: string[];
|
|
108
108
|
ttlSeconds?: string;
|
|
109
109
|
logo?: string;
|
|
110
|
+
module?: string;
|
|
110
111
|
};
|
|
111
112
|
export type JsonSerializable = string | number | boolean | null | JsonSerializable[] | {
|
|
112
113
|
[key: string]: JsonSerializable;
|
package/lib/types/cli/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JWKInterface } from 'arweave/node/lib/wallet.js';
|
|
2
2
|
import { Command, OptionValues } from 'commander';
|
|
3
|
-
import {
|
|
3
|
+
import { ARIOToken, AoANTRead, AoANTRegistryRead, AoANTWrite, AoARIORead, AoARIOWrite, AoGetCostDetailsParams, AoRedelegateStakeParams, AoSigner, AoUpdateGatewaySettingsParams, ContractSigner, EpochInput, FundFrom, Logger, PaginationParams, SpawnANTState, WriteOptions, mARIOToken } from '../node/index.js';
|
|
4
4
|
import { ANTStateCLIOptions, AddressCLIOptions, EpochCLIOptions, GetTokenCostCLIOptions, GlobalCLIOptions, InitiatorCLIOptions, JsonSerializable, PaginationCLIOptions, ProcessIdCLIOptions, RedelegateStakeCLIOptions, TransferCLIOptions, UpdateGatewaySettingsCLIOptions, WalletCLIOptions, WriteActionCLIOptions } from './types.js';
|
|
5
5
|
export declare const defaultTtlSecondsCLI = 3600;
|
|
6
6
|
export declare function stringifyJsonForCLIDisplay(json: JsonSerializable | unknown): string;
|
|
@@ -18,11 +18,11 @@ export declare function makeCommand<O extends OptionValues = GlobalCLIOptions>({
|
|
|
18
18
|
options?: CommanderOption[];
|
|
19
19
|
}): Command;
|
|
20
20
|
export declare function arioProcessIdFromOptions({ arioProcessId, devnet, testnet, }: GlobalCLIOptions): string;
|
|
21
|
+
export declare function antRegistryIdFromOptions({ antRegistryProcessId, testnet, }: GlobalCLIOptions): string;
|
|
21
22
|
export declare function requiredJwkFromOptions(options: WalletCLIOptions): JWKInterface;
|
|
22
23
|
export declare function jwkToAddress(jwk: JWKInterface): string;
|
|
23
24
|
export declare function getLoggerFromOptions(options: GlobalCLIOptions): Logger;
|
|
24
25
|
export declare function readARIOFromOptions(options: GlobalCLIOptions): AoARIORead;
|
|
25
|
-
export declare function ANTRegistryProcessFromOptions(options: ProcessIdCLIOptions): AOProcess;
|
|
26
26
|
export declare function readANTRegistryFromOptions(options: ProcessIdCLIOptions): AoANTRegistryRead;
|
|
27
27
|
export declare function contractSignerFromOptions(options: WalletCLIOptions): {
|
|
28
28
|
signer: ContractSigner;
|
|
@@ -97,3 +97,16 @@ export declare function referrerFromOptions<O extends {
|
|
|
97
97
|
referrer?: string;
|
|
98
98
|
}>(o: O): string | undefined;
|
|
99
99
|
export declare function assertLockLengthInRange(lockLengthMs: number, assertMin?: boolean): void;
|
|
100
|
+
export declare function antRecordMetadataFromOptions<O extends {
|
|
101
|
+
owner?: string;
|
|
102
|
+
displayName?: string;
|
|
103
|
+
logo?: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
keywords?: string[];
|
|
106
|
+
}>(options: O): {
|
|
107
|
+
owner?: string;
|
|
108
|
+
displayName?: string;
|
|
109
|
+
logo?: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
keywords?: string[];
|
|
112
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord, AoANTSetBaseNameRecordParams, AoANTSetUndernameRecordParams, AoANTState, AoANTWrite, SortedANTRecords } from '../types/ant.js';
|
|
2
|
-
import { AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
|
|
2
|
+
import { AoClient, AoMessageResult, AoSigner, ProcessConfiguration, UpgradeAntProgressEvent, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
|
|
3
3
|
import { forkANT, spawnANT } from '../utils/ao.js';
|
|
4
|
-
import { AOProcess } from './index.js';
|
|
4
|
+
import { AOProcess, Logger } from './index.js';
|
|
5
5
|
type ANTConfigOptionalStrict = Required<ProcessConfiguration> & {
|
|
6
6
|
strict?: boolean;
|
|
7
7
|
hyperbeamUrl?: string;
|
|
@@ -25,6 +25,37 @@ export declare class ANT {
|
|
|
25
25
|
* @param config
|
|
26
26
|
*/
|
|
27
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
|
+
}>;
|
|
28
59
|
/**
|
|
29
60
|
* Initialize overloads.
|
|
30
61
|
*
|
|
@@ -36,9 +67,11 @@ export declare class ANT {
|
|
|
36
67
|
export declare class AoANTReadable implements AoANTRead {
|
|
37
68
|
protected process: AOProcess;
|
|
38
69
|
readonly processId: string;
|
|
70
|
+
readonly hyperbeamUrl: URL | undefined;
|
|
39
71
|
private strict;
|
|
40
|
-
private hyperbeamUrl;
|
|
41
72
|
private checkHyperBeamPromise;
|
|
73
|
+
private moduleId;
|
|
74
|
+
private moduleIdPromise;
|
|
42
75
|
private logger;
|
|
43
76
|
constructor(config: ANTConfigOptionalStrict);
|
|
44
77
|
/**
|
|
@@ -53,6 +86,63 @@ export declare class AoANTReadable implements AoANTRead {
|
|
|
53
86
|
* Returns the TX ID of the logo set for the ANT.
|
|
54
87
|
*/
|
|
55
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>;
|
|
56
146
|
/**
|
|
57
147
|
* @param undername @type {string} The domain name.
|
|
58
148
|
* @returns {Promise<ANTRecord>} The record of the undername domain.
|
|
@@ -186,34 +276,49 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
|
|
|
186
276
|
* @param undername @type {string} The record you want to set the transactionId and ttlSeconds of.
|
|
187
277
|
* @param transactionId @type {string} The transactionId of the record.
|
|
188
278
|
* @param ttlSeconds @type {number} The time to live of the record.
|
|
279
|
+
* @param owner @type {string} Optional owner address for the record.
|
|
280
|
+
* @param displayName @type {string} Optional display name for the record.
|
|
281
|
+
* @param logo @type {string} Optional logo transaction ID for the record.
|
|
282
|
+
* @param description @type {string} Optional description for the record.
|
|
283
|
+
* @param keywords @type {string[]} Optional keywords array for the record.
|
|
189
284
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
190
285
|
*/
|
|
191
|
-
setRecord({ undername, transactionId, ttlSeconds }: AoANTSetUndernameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
286
|
+
setRecord({ undername, transactionId, ttlSeconds, owner, displayName, logo, description, keywords, }: AoANTSetUndernameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
192
287
|
/**
|
|
193
288
|
* 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)
|
|
194
289
|
*
|
|
195
290
|
* @param transactionId @type {string} The transactionId of the record.
|
|
196
291
|
* @param ttlSeconds @type {number} The time to live of the record.
|
|
292
|
+
* @param owner @type {string} Optional owner address for the record.
|
|
293
|
+
* @param displayName @type {string} Optional display name for the record.
|
|
294
|
+
* @param logo @type {string} Optional logo transaction ID for the record.
|
|
295
|
+
* @param description @type {string} Optional description for the record.
|
|
296
|
+
* @param keywords @type {string[]} Optional keywords array for the record.
|
|
197
297
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
198
298
|
* @example
|
|
199
299
|
* ```ts
|
|
200
300
|
* 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
|
|
201
301
|
* ```
|
|
202
302
|
*/
|
|
203
|
-
setBaseNameRecord({ transactionId, ttlSeconds }: AoANTSetBaseNameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
303
|
+
setBaseNameRecord({ transactionId, ttlSeconds, owner, displayName, logo, description, keywords, }: AoANTSetBaseNameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
204
304
|
/**
|
|
205
305
|
* 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)
|
|
206
306
|
*
|
|
207
307
|
* @param undername @type {string} The undername of the ANT.
|
|
208
308
|
* @param transactionId @type {string} The transactionId of the record.
|
|
209
309
|
* @param ttlSeconds @type {number} The time to live of the record.
|
|
310
|
+
* @param owner @type {string} Optional owner address for the record.
|
|
311
|
+
* @param displayName @type {string} Optional display name for the record.
|
|
312
|
+
* @param logo @type {string} Optional logo transaction ID for the record.
|
|
313
|
+
* @param description @type {string} Optional description for the record.
|
|
314
|
+
* @param keywords @type {string[]} Optional keywords array for the record.
|
|
210
315
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
211
316
|
* @example
|
|
212
317
|
* ```ts
|
|
213
318
|
* 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
|
|
214
319
|
* ```
|
|
215
320
|
*/
|
|
216
|
-
setUndernameRecord({ undername, transactionId, ttlSeconds }: AoANTSetUndernameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
321
|
+
setUndernameRecord({ undername, transactionId, ttlSeconds, owner, displayName, logo, description, keywords, }: AoANTSetUndernameRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
217
322
|
/**
|
|
218
323
|
* Removes an undername from the ANT. This will remove the undername from the ANT.
|
|
219
324
|
*
|
|
@@ -373,5 +478,61 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
|
|
|
373
478
|
arioProcessId: string;
|
|
374
479
|
notifyOwners?: boolean;
|
|
375
480
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
481
|
+
/**
|
|
482
|
+
* Upgrade this ANT by forking it to the latest version and reassigning names.
|
|
483
|
+
*
|
|
484
|
+
* This is a convenience method that calls the static ANT.upgrade() method
|
|
485
|
+
* using this instance's process ID and signer.
|
|
486
|
+
*
|
|
487
|
+
* current version with latest ANT registry version and skip if already up to date.
|
|
488
|
+
*
|
|
489
|
+
* @param names @type {string[]} The ArNS names to reassign to the upgraded ANT.
|
|
490
|
+
* @param arioProcessId @type {string} The processId of the ARIO contract.
|
|
491
|
+
* @param antRegistryId @type {string} Optional ANT registry ID.
|
|
492
|
+
* @param onSigningProgress Progress callback function.
|
|
493
|
+
* @returns {Promise} The upgrade results.
|
|
494
|
+
* @example
|
|
495
|
+
* ```ts
|
|
496
|
+
* const result = await ant.upgrade({
|
|
497
|
+
* names: ["example", "test"],
|
|
498
|
+
* arioProcessId: ARIO_MAINNET_PROCESS_ID
|
|
499
|
+
* });
|
|
500
|
+
* console.log(`Upgraded to process: ${result.forkedProcessId}`);
|
|
501
|
+
* ```
|
|
502
|
+
*/
|
|
503
|
+
upgrade(params?: {
|
|
504
|
+
arioProcessId?: string;
|
|
505
|
+
antRegistryId?: string;
|
|
506
|
+
skipVersionCheck?: boolean;
|
|
507
|
+
onSigningProgress?: (name: keyof UpgradeAntProgressEvent, payload: UpgradeAntProgressEvent[keyof UpgradeAntProgressEvent]) => void;
|
|
508
|
+
} & ({
|
|
509
|
+
names: string[];
|
|
510
|
+
reassignAffiliatedNames?: false;
|
|
511
|
+
} | {
|
|
512
|
+
names?: never;
|
|
513
|
+
reassignAffiliatedNames?: true;
|
|
514
|
+
})): Promise<{
|
|
515
|
+
forkedProcessId: string;
|
|
516
|
+
reassignedNames: Record<string, AoMessageResult>;
|
|
517
|
+
failedReassignedNames: Record<string, {
|
|
518
|
+
id?: string;
|
|
519
|
+
error: Error;
|
|
520
|
+
}>;
|
|
521
|
+
}>;
|
|
522
|
+
/**
|
|
523
|
+
* 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.
|
|
524
|
+
*
|
|
525
|
+
* @param undername @type {string} The subdomain/record whose ownership you want to transfer.
|
|
526
|
+
* @param recipient @type {string} The address of the new owner for this record.
|
|
527
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
528
|
+
* @example
|
|
529
|
+
* ```ts
|
|
530
|
+
* ant.transferRecord({ undername: "alice", recipient: "new-owner-address-123..." }); // transfers ownership of the "alice" record to the new owner
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
transferRecord({ undername, recipient, }: {
|
|
534
|
+
undername: string;
|
|
535
|
+
recipient: string;
|
|
536
|
+
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
376
537
|
}
|
|
377
538
|
export {};
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ export declare class ARIOReadable implements AoARIORead, ArNSNameResolver {
|
|
|
155
155
|
* @returns {Promise<AoArNSNameData[]>} The ARNS names associated with the address
|
|
156
156
|
*/
|
|
157
157
|
getArNSRecordsForAddress(params: PaginationParams<AoArNSNameDataWithName> & {
|
|
158
|
-
|
|
158
|
+
antRegistryProcessId?: string;
|
|
159
159
|
address: WalletAddress;
|
|
160
160
|
}): Promise<PaginationResult<AoArNSNameDataWithName>>;
|
|
161
161
|
}
|
package/lib/types/constants.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export declare const ARIO_DEVNET_PROCESS_ID = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelV
|
|
|
20
20
|
export declare const arioDevnetProcessId = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
|
|
21
21
|
export declare const ARIO_TESTNET_PROCESS_ID = "agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA";
|
|
22
22
|
export declare const ARIO_MAINNET_PROCESS_ID = "qNvAoz0TgcH7DMg8BCVn8jF32QH5L6T29VjHxhHqqGE";
|
|
23
|
+
export declare const ANT_REGISTRY_TESTNET_ID = "RR0vheYqtsKuJCWh6xj0beE35tjaEug5cejMw9n2aa8";
|
|
23
24
|
export declare const ANT_REGISTRY_ID = "i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc";
|
|
24
25
|
export declare const MARIO_PER_ARIO = 1000000;
|
|
25
26
|
/**
|
package/lib/types/types/ant.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { z } from 'zod';
|
|
17
|
-
import { AoWriteAction, WalletAddress } from './common.js';
|
|
17
|
+
import { AoMessageResult, AoWriteAction, UpgradeAntProgressEvent, WalletAddress } from './common.js';
|
|
18
18
|
/**
|
|
19
19
|
* example error:
|
|
20
20
|
* {
|
|
@@ -36,14 +36,29 @@ export declare const AntRecordSchema: z.ZodObject<{
|
|
|
36
36
|
transactionId: z.ZodEffects<z.ZodString, string, string>;
|
|
37
37
|
ttlSeconds: z.ZodNumber;
|
|
38
38
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
40
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
41
|
+
logo: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
42
|
+
description: z.ZodOptional<z.ZodString>;
|
|
43
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
39
44
|
}, "strip", z.ZodTypeAny, {
|
|
40
45
|
transactionId: string;
|
|
41
46
|
ttlSeconds: number;
|
|
47
|
+
description?: string | undefined;
|
|
42
48
|
priority?: number | undefined;
|
|
49
|
+
owner?: string | undefined;
|
|
50
|
+
displayName?: string | undefined;
|
|
51
|
+
logo?: string | undefined;
|
|
52
|
+
keywords?: string[] | undefined;
|
|
43
53
|
}, {
|
|
44
54
|
transactionId: string;
|
|
45
55
|
ttlSeconds: number;
|
|
56
|
+
description?: string | undefined;
|
|
46
57
|
priority?: number | undefined;
|
|
58
|
+
owner?: string | undefined;
|
|
59
|
+
displayName?: string | undefined;
|
|
60
|
+
logo?: string | undefined;
|
|
61
|
+
keywords?: string[] | undefined;
|
|
47
62
|
}>;
|
|
48
63
|
export type AoANTRecord = z.infer<typeof AntRecordSchema>;
|
|
49
64
|
export type ANTRecords = Record<string, AoANTRecord>;
|
|
@@ -55,14 +70,29 @@ export declare const AntRecordsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
55
70
|
transactionId: z.ZodEffects<z.ZodString, string, string>;
|
|
56
71
|
ttlSeconds: z.ZodNumber;
|
|
57
72
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
74
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
75
|
+
logo: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
76
|
+
description: z.ZodOptional<z.ZodString>;
|
|
77
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
58
78
|
}, "strip", z.ZodTypeAny, {
|
|
59
79
|
transactionId: string;
|
|
60
80
|
ttlSeconds: number;
|
|
81
|
+
description?: string | undefined;
|
|
61
82
|
priority?: number | undefined;
|
|
83
|
+
owner?: string | undefined;
|
|
84
|
+
displayName?: string | undefined;
|
|
85
|
+
logo?: string | undefined;
|
|
86
|
+
keywords?: string[] | undefined;
|
|
62
87
|
}, {
|
|
63
88
|
transactionId: string;
|
|
64
89
|
ttlSeconds: number;
|
|
90
|
+
description?: string | undefined;
|
|
65
91
|
priority?: number | undefined;
|
|
92
|
+
owner?: string | undefined;
|
|
93
|
+
displayName?: string | undefined;
|
|
94
|
+
logo?: string | undefined;
|
|
95
|
+
keywords?: string[] | undefined;
|
|
66
96
|
}>>;
|
|
67
97
|
export declare const AntControllersSchema: z.ZodArray<z.ZodString, "many">;
|
|
68
98
|
export declare const AntBalancesSchema: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
@@ -78,14 +108,29 @@ export declare const AntStateSchema: z.ZodObject<{
|
|
|
78
108
|
transactionId: z.ZodEffects<z.ZodString, string, string>;
|
|
79
109
|
ttlSeconds: z.ZodNumber;
|
|
80
110
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
112
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
113
|
+
logo: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
114
|
+
description: z.ZodOptional<z.ZodString>;
|
|
115
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
81
116
|
}, "strip", z.ZodTypeAny, {
|
|
82
117
|
transactionId: string;
|
|
83
118
|
ttlSeconds: number;
|
|
119
|
+
description?: string | undefined;
|
|
84
120
|
priority?: number | undefined;
|
|
121
|
+
owner?: string | undefined;
|
|
122
|
+
displayName?: string | undefined;
|
|
123
|
+
logo?: string | undefined;
|
|
124
|
+
keywords?: string[] | undefined;
|
|
85
125
|
}, {
|
|
86
126
|
transactionId: string;
|
|
87
127
|
ttlSeconds: number;
|
|
128
|
+
description?: string | undefined;
|
|
88
129
|
priority?: number | undefined;
|
|
130
|
+
owner?: string | undefined;
|
|
131
|
+
displayName?: string | undefined;
|
|
132
|
+
logo?: string | undefined;
|
|
133
|
+
keywords?: string[] | undefined;
|
|
89
134
|
}>>;
|
|
90
135
|
Balances: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
91
136
|
Logo: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -102,7 +147,12 @@ export declare const AntStateSchema: z.ZodObject<{
|
|
|
102
147
|
Records: Record<string, {
|
|
103
148
|
transactionId: string;
|
|
104
149
|
ttlSeconds: number;
|
|
150
|
+
description?: string | undefined;
|
|
105
151
|
priority?: number | undefined;
|
|
152
|
+
owner?: string | undefined;
|
|
153
|
+
displayName?: string | undefined;
|
|
154
|
+
logo?: string | undefined;
|
|
155
|
+
keywords?: string[] | undefined;
|
|
106
156
|
}>;
|
|
107
157
|
Balances: Record<string, number>;
|
|
108
158
|
Logo: string;
|
|
@@ -119,7 +169,12 @@ export declare const AntStateSchema: z.ZodObject<{
|
|
|
119
169
|
Records: Record<string, {
|
|
120
170
|
transactionId: string;
|
|
121
171
|
ttlSeconds: number;
|
|
172
|
+
description?: string | undefined;
|
|
122
173
|
priority?: number | undefined;
|
|
174
|
+
owner?: string | undefined;
|
|
175
|
+
displayName?: string | undefined;
|
|
176
|
+
logo?: string | undefined;
|
|
177
|
+
keywords?: string[] | undefined;
|
|
123
178
|
}>;
|
|
124
179
|
Balances: Record<string, number>;
|
|
125
180
|
Logo: string;
|
|
@@ -155,52 +210,77 @@ export declare const SpawnANTStateSchema: z.ZodObject<{
|
|
|
155
210
|
transactionId: z.ZodEffects<z.ZodString, string, string>;
|
|
156
211
|
ttlSeconds: z.ZodNumber;
|
|
157
212
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
213
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
214
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
215
|
+
logo: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
216
|
+
description: z.ZodOptional<z.ZodString>;
|
|
217
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
158
218
|
}, "strip", z.ZodTypeAny, {
|
|
159
219
|
transactionId: string;
|
|
160
220
|
ttlSeconds: number;
|
|
221
|
+
description?: string | undefined;
|
|
161
222
|
priority?: number | undefined;
|
|
223
|
+
owner?: string | undefined;
|
|
224
|
+
displayName?: string | undefined;
|
|
225
|
+
logo?: string | undefined;
|
|
226
|
+
keywords?: string[] | undefined;
|
|
162
227
|
}, {
|
|
163
228
|
transactionId: string;
|
|
164
229
|
ttlSeconds: number;
|
|
230
|
+
description?: string | undefined;
|
|
165
231
|
priority?: number | undefined;
|
|
232
|
+
owner?: string | undefined;
|
|
233
|
+
displayName?: string | undefined;
|
|
234
|
+
logo?: string | undefined;
|
|
235
|
+
keywords?: string[] | undefined;
|
|
166
236
|
}>>;
|
|
167
237
|
balances: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
168
238
|
logo: z.ZodEffects<z.ZodString, string, string>;
|
|
169
239
|
}, "strip", z.ZodTypeAny, {
|
|
170
240
|
description: string;
|
|
241
|
+
owner: string;
|
|
242
|
+
logo: string;
|
|
243
|
+
keywords: string[];
|
|
171
244
|
name: string;
|
|
172
245
|
ticker: string;
|
|
173
|
-
keywords: string[];
|
|
174
|
-
owner: string;
|
|
175
246
|
controllers: string[];
|
|
176
247
|
records: Record<string, {
|
|
177
248
|
transactionId: string;
|
|
178
249
|
ttlSeconds: number;
|
|
250
|
+
description?: string | undefined;
|
|
179
251
|
priority?: number | undefined;
|
|
252
|
+
owner?: string | undefined;
|
|
253
|
+
displayName?: string | undefined;
|
|
254
|
+
logo?: string | undefined;
|
|
255
|
+
keywords?: string[] | undefined;
|
|
180
256
|
}>;
|
|
181
257
|
balances: Record<string, number>;
|
|
182
|
-
logo: string;
|
|
183
258
|
}, {
|
|
184
259
|
description: string;
|
|
260
|
+
owner: string;
|
|
261
|
+
logo: string;
|
|
262
|
+
keywords: string[];
|
|
185
263
|
name: string;
|
|
186
264
|
ticker: string;
|
|
187
|
-
keywords: string[];
|
|
188
|
-
owner: string;
|
|
189
265
|
controllers: string[];
|
|
190
266
|
records: Record<string, {
|
|
191
267
|
transactionId: string;
|
|
192
268
|
ttlSeconds: number;
|
|
269
|
+
description?: string | undefined;
|
|
193
270
|
priority?: number | undefined;
|
|
271
|
+
owner?: string | undefined;
|
|
272
|
+
displayName?: string | undefined;
|
|
273
|
+
logo?: string | undefined;
|
|
274
|
+
keywords?: string[] | undefined;
|
|
194
275
|
}>;
|
|
195
276
|
balances: Record<string, number>;
|
|
196
|
-
logo: string;
|
|
197
277
|
}>;
|
|
198
278
|
export type SpawnANTState = z.infer<typeof SpawnANTStateSchema>;
|
|
199
279
|
export declare const AntReadHandlers: readonly ["balance", "balances", "totalSupply", "info", "controllers", "record", "records", "state"];
|
|
200
280
|
export type AoANTReadHandler = (typeof AntReadHandlers)[number];
|
|
201
|
-
export declare const AntWriteHandlers: readonly ["_eval", "_default", "transfer", "addController", "removeController", "setRecord", "removeRecord", "setName", "setTicker", "setDescription", "setKeywords", "setLogo", "initializeState", "releaseName", "reassignName", "approvePrimaryName", "removePrimaryNames"];
|
|
281
|
+
export declare const AntWriteHandlers: readonly ["_eval", "_default", "transfer", "addController", "removeController", "setRecord", "removeRecord", "setName", "setTicker", "setDescription", "setKeywords", "setLogo", "initializeState", "releaseName", "reassignName", "approvePrimaryName", "removePrimaryNames", "transferRecordOwnership"];
|
|
202
282
|
export type AoANTWriteHandler = (typeof AntWriteHandlers)[number];
|
|
203
|
-
export declare const AntHandlerNames: ("controllers" | "records" | "balances" | "balance" | "totalSupply" | "info" | "record" | "state" | "_eval" | "_default" | "transfer" | "addController" | "removeController" | "setRecord" | "removeRecord" | "setName" | "setTicker" | "setDescription" | "setKeywords" | "setLogo" | "initializeState" | "releaseName" | "reassignName" | "approvePrimaryName" | "removePrimaryNames")[];
|
|
283
|
+
export declare const AntHandlerNames: ("controllers" | "records" | "balances" | "balance" | "totalSupply" | "info" | "record" | "state" | "_eval" | "_default" | "transfer" | "addController" | "removeController" | "setRecord" | "removeRecord" | "setName" | "setTicker" | "setDescription" | "setKeywords" | "setLogo" | "initializeState" | "releaseName" | "reassignName" | "approvePrimaryName" | "removePrimaryNames" | "transferRecordOwnership")[];
|
|
204
284
|
export type AoANTHandler = AoANTWriteHandler | AoANTReadHandler;
|
|
205
285
|
export declare const AntHandlersSchema: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
|
206
286
|
export declare const AntInfoSchema: z.ZodObject<{
|
|
@@ -264,6 +344,20 @@ export interface AoANTRead {
|
|
|
264
344
|
}, opts?: AntReadOptions): Promise<number>;
|
|
265
345
|
getBalances(opts?: AntReadOptions): Promise<Record<WalletAddress, number>>;
|
|
266
346
|
getHandlers(): Promise<AoANTHandler[]>;
|
|
347
|
+
getModuleId(opts?: {
|
|
348
|
+
graphqlUrl?: string;
|
|
349
|
+
retries?: number;
|
|
350
|
+
}): Promise<string>;
|
|
351
|
+
getVersion(opts?: {
|
|
352
|
+
antRegistryId?: string;
|
|
353
|
+
graphqlUrl?: string;
|
|
354
|
+
retries?: number;
|
|
355
|
+
}): Promise<string>;
|
|
356
|
+
isLatestVersion(opts?: {
|
|
357
|
+
antRegistryId?: string;
|
|
358
|
+
graphqlUrl?: string;
|
|
359
|
+
retries?: number;
|
|
360
|
+
}): Promise<boolean>;
|
|
267
361
|
}
|
|
268
362
|
export interface AoANTWrite extends AoANTRead {
|
|
269
363
|
transfer: AoWriteAction<{
|
|
@@ -320,11 +414,39 @@ export interface AoANTWrite extends AoANTRead {
|
|
|
320
414
|
arioProcessId: string;
|
|
321
415
|
notifyOwners?: boolean;
|
|
322
416
|
}>;
|
|
417
|
+
upgrade(params?: {
|
|
418
|
+
arioProcessId?: string;
|
|
419
|
+
antRegistryId?: string;
|
|
420
|
+
skipVersionCheck?: boolean;
|
|
421
|
+
onSigningProgress?: (name: keyof UpgradeAntProgressEvent, payload: UpgradeAntProgressEvent[keyof UpgradeAntProgressEvent]) => void;
|
|
422
|
+
} & ({
|
|
423
|
+
names: string[];
|
|
424
|
+
reassignAffiliatedNames?: false;
|
|
425
|
+
} | {
|
|
426
|
+
names?: never;
|
|
427
|
+
reassignAffiliatedNames?: true;
|
|
428
|
+
})): Promise<{
|
|
429
|
+
forkedProcessId: string;
|
|
430
|
+
reassignedNames: Record<string, AoMessageResult>;
|
|
431
|
+
failedReassignedNames: Record<string, {
|
|
432
|
+
id?: string;
|
|
433
|
+
error: Error;
|
|
434
|
+
}>;
|
|
435
|
+
}>;
|
|
436
|
+
transferRecord: AoWriteAction<{
|
|
437
|
+
undername: string;
|
|
438
|
+
recipient: string;
|
|
439
|
+
}>;
|
|
323
440
|
}
|
|
324
441
|
export type AoANTSetBaseNameRecordParams = {
|
|
325
442
|
transactionId: string;
|
|
326
443
|
ttlSeconds: number;
|
|
327
444
|
priority?: number;
|
|
445
|
+
owner?: string;
|
|
446
|
+
displayName?: string;
|
|
447
|
+
logo?: string;
|
|
448
|
+
description?: string;
|
|
449
|
+
keywords?: string[];
|
|
328
450
|
};
|
|
329
451
|
export type AoANTSetUndernameRecordParams = AoANTSetBaseNameRecordParams & {
|
|
330
452
|
undername: string;
|