@ar.io/sdk 3.8.0 → 3.8.2-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.
- package/README.md +97 -22
- package/bundles/web.bundle.min.js +55 -55
- package/lib/cjs/cli/utils.js +2 -5
- package/lib/cjs/common/ant.js +4 -4
- package/lib/cjs/common/contracts/ao-process.js +86 -79
- package/lib/cjs/common/io.js +2 -2
- package/lib/cjs/utils/arweave.js +3 -3
- package/lib/cjs/utils/processes.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/utils.js +2 -5
- package/lib/esm/common/ant.js +4 -4
- package/lib/esm/common/contracts/ao-process.js +86 -79
- package/lib/esm/common/io.js +3 -3
- package/lib/esm/utils/arweave.js +4 -4
- package/lib/esm/utils/processes.js +3 -3
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/utils.d.ts +1 -1
- package/lib/types/common/ant.d.ts +4 -4
- package/lib/types/types/common.d.ts +12 -0
- package/lib/types/utils/arweave.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/esm/utils/arweave.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ARIO_MAINNET_PROCESS_ID, ARWEAVE_TX_REGEX } from '../constants.js';
|
|
2
2
|
import { isDistributedEpoch, } from '../types/io.js';
|
|
3
3
|
import { parseAoEpochData } from './ao.js';
|
|
4
4
|
export const validateArweaveId = (id) => {
|
|
@@ -29,7 +29,7 @@ export const paginationParamsToTags = (params) => {
|
|
|
29
29
|
* @param arweave - The Arweave instance
|
|
30
30
|
* @returns The epoch with distribution data
|
|
31
31
|
*/
|
|
32
|
-
export const getEpochDataFromGql = async ({ arweave, epochIndex, processId =
|
|
32
|
+
export const getEpochDataFromGql = async ({ arweave, epochIndex, processId = ARIO_MAINNET_PROCESS_ID, retries = 3, gqlUrl = 'https://arweave-search.goldsky.com/graphql', }) => {
|
|
33
33
|
// fetch from gql
|
|
34
34
|
const query = epochDistributionNoticeGqlQuery({ epochIndex, processId });
|
|
35
35
|
// add three retries with exponential backoff
|
|
@@ -65,10 +65,10 @@ export const getEpochDataFromGql = async ({ arweave, epochIndex, processId = ARI
|
|
|
65
65
|
* Get the epoch with distribution data for the current epoch
|
|
66
66
|
* @param arweave - The Arweave instance
|
|
67
67
|
* @param epochIndex - The index of the epoch
|
|
68
|
-
* @param processId - The process ID (optional, defaults to
|
|
68
|
+
* @param processId - The process ID (optional, defaults to ARIO_MAINNET_PROCESS_ID)
|
|
69
69
|
* @returns string - The stringified GQL query
|
|
70
70
|
*/
|
|
71
|
-
export const epochDistributionNoticeGqlQuery = ({ epochIndex, processId =
|
|
71
|
+
export const epochDistributionNoticeGqlQuery = ({ epochIndex, processId = ARIO_MAINNET_PROCESS_ID, authorities = ['fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY'], }) => {
|
|
72
72
|
// write the query
|
|
73
73
|
const gqlQuery = JSON.stringify({
|
|
74
74
|
query: `
|
|
@@ -21,7 +21,7 @@ import { ANT } from '../common/ant.js';
|
|
|
21
21
|
import { AOProcess } from '../common/index.js';
|
|
22
22
|
import { ARIO } from '../common/io.js';
|
|
23
23
|
import { Logger } from '../common/logger.js';
|
|
24
|
-
import {
|
|
24
|
+
import { ARIO_MAINNET_PROCESS_ID } from '../constants.js';
|
|
25
25
|
/**
|
|
26
26
|
* @beta This API is in beta and may change in the future.
|
|
27
27
|
*/
|
|
@@ -53,7 +53,7 @@ export class ArNSEventEmitter extends EventEmitter {
|
|
|
53
53
|
strict;
|
|
54
54
|
antAoClient;
|
|
55
55
|
constructor({ contract = ARIO.init({
|
|
56
|
-
processId:
|
|
56
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
57
57
|
}), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, antAoClient = connect(), } = {}) {
|
|
58
58
|
super();
|
|
59
59
|
this.contract = contract;
|
|
@@ -120,7 +120,7 @@ export class ArNSEventEmitter extends EventEmitter {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
export const fetchAllArNSRecords = async ({ contract = ARIO.init({
|
|
123
|
-
processId:
|
|
123
|
+
processId: ARIO_MAINNET_PROCESS_ID,
|
|
124
124
|
}), emitter, logger = Logger.default, pageSize = 1000, }) => {
|
|
125
125
|
let cursor;
|
|
126
126
|
const startTimestamp = Date.now();
|
package/lib/esm/version.js
CHANGED
package/lib/types/cli/utils.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function makeCommand<O extends OptionValues = GlobalCLIOptions>({
|
|
|
17
17
|
action?: (options: O) => Promise<JsonSerializable>;
|
|
18
18
|
options?: CommanderOption[];
|
|
19
19
|
}): Command;
|
|
20
|
-
export declare function arioProcessIdFromOptions({ arioProcessId, devnet, testnet,
|
|
20
|
+
export declare function arioProcessIdFromOptions({ arioProcessId, devnet, testnet, }: GlobalCLIOptions): string;
|
|
21
21
|
export declare function requiredJwkFromOptions(options: WalletCLIOptions): JWKInterface;
|
|
22
22
|
export declare function jwkToAddress(jwk: JWKInterface): string;
|
|
23
23
|
export declare function getLoggerFromOptions(options: GlobalCLIOptions): Logger;
|
|
@@ -284,7 +284,7 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
|
|
|
284
284
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
285
285
|
* @example
|
|
286
286
|
* ```ts
|
|
287
|
-
* ant.releaseName({ name: "ardrive", arioProcessId:
|
|
287
|
+
* ant.releaseName({ name: "ardrive", arioProcessId: ARIO_MAINNET_PROCESS_ID });
|
|
288
288
|
* ```
|
|
289
289
|
*/
|
|
290
290
|
releaseName({ name, arioProcessId }: {
|
|
@@ -300,7 +300,7 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
|
|
|
300
300
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
301
301
|
* @example
|
|
302
302
|
* ```ts
|
|
303
|
-
* ant.reassignName({ name: "ardrive", arioProcessId:
|
|
303
|
+
* ant.reassignName({ name: "ardrive", arioProcessId: ARIO_MAINNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
|
|
304
304
|
* ```
|
|
305
305
|
*/
|
|
306
306
|
reassignName({ name, arioProcessId, antProcessId, }: {
|
|
@@ -317,7 +317,7 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
|
|
|
317
317
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
318
318
|
* @example
|
|
319
319
|
* ```ts
|
|
320
|
-
* ant.approvePrimaryNameRequest({ name: "ardrive", address: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f", arioProcessId:
|
|
320
|
+
* ant.approvePrimaryNameRequest({ name: "ardrive", address: "U7RXcpaVShG4u9nIcPVmm2FJSM5Gru9gQCIiRaIPV7f", arioProcessId: ARIO_MAINNET_PROCESS_ID }); // approves the request for ardrive.ar.io to be registered by the address
|
|
321
321
|
* ```
|
|
322
322
|
*/
|
|
323
323
|
approvePrimaryNameRequest({ name, address, arioProcessId, }: {
|
|
@@ -334,7 +334,7 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
|
|
|
334
334
|
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
335
335
|
* @example
|
|
336
336
|
* ```ts
|
|
337
|
-
* ant.removePrimaryNames({ names: ["ardrive", "dapp_ardrive"], arioProcessId:
|
|
337
|
+
* 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"
|
|
338
338
|
* ```
|
|
339
339
|
*/
|
|
340
340
|
removePrimaryNames({ names, arioProcessId, notifyOwners, }: {
|
|
@@ -113,3 +113,15 @@ export interface AOContract {
|
|
|
113
113
|
}
|
|
114
114
|
/** utility type to ensure WriteOptions are appended to each parameter set */
|
|
115
115
|
export type AoWriteAction<P, R = AoMessageResult> = (params: P, options?: WriteOptions) => Promise<R>;
|
|
116
|
+
export type DryRunResult = {
|
|
117
|
+
Output: any;
|
|
118
|
+
Messages: any[];
|
|
119
|
+
Spawns: any[];
|
|
120
|
+
Error?: any;
|
|
121
|
+
};
|
|
122
|
+
export type MessageResult = {
|
|
123
|
+
Output: any;
|
|
124
|
+
Messages: any[];
|
|
125
|
+
Spawns: any[];
|
|
126
|
+
Error?: any;
|
|
127
|
+
};
|
|
@@ -50,7 +50,7 @@ export declare const getEpochDataFromGql: ({ arweave, epochIndex, processId, ret
|
|
|
50
50
|
* Get the epoch with distribution data for the current epoch
|
|
51
51
|
* @param arweave - The Arweave instance
|
|
52
52
|
* @param epochIndex - The index of the epoch
|
|
53
|
-
* @param processId - The process ID (optional, defaults to
|
|
53
|
+
* @param processId - The process ID (optional, defaults to ARIO_MAINNET_PROCESS_ID)
|
|
54
54
|
* @returns string - The stringified GQL query
|
|
55
55
|
*/
|
|
56
56
|
export declare const epochDistributionNoticeGqlQuery: ({ epochIndex, processId, authorities, }: {
|
package/lib/types/version.d.ts
CHANGED