@ar.io/sdk 3.3.0-alpha.1 → 3.3.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.
@@ -39,8 +39,9 @@ export class AOProcess {
39
39
  let lastError;
40
40
  while (attempts < retries) {
41
41
  try {
42
- this.logger.debug(`Evaluating read interaction on contract`, {
42
+ this.logger.debug(`Evaluating read interaction on process`, {
43
43
  tags,
44
+ processId: this.processId,
44
45
  });
45
46
  // map tags to inputs
46
47
  const dryRunInput = {
@@ -53,13 +54,18 @@ export class AOProcess {
53
54
  const result = await this.ao.dryrun(dryRunInput);
54
55
  this.logger.debug(`Read interaction result`, {
55
56
  result,
57
+ processId: this.processId,
56
58
  });
57
59
  const error = errorMessageFromOutput(result);
58
60
  if (error !== undefined) {
59
61
  throw new Error(error);
60
62
  }
61
63
  if (result.Messages === undefined || result.Messages.length === 0) {
62
- this.logger.debug(`Process ${this.processId} does not support provided action.`, result, tags);
64
+ this.logger.debug(`Process ${this.processId} does not support provided action.`, {
65
+ result,
66
+ tags,
67
+ processId: this.processId,
68
+ });
63
69
  throw new Error(`Process ${this.processId} does not support provided action.`);
64
70
  }
65
71
  const messageData = result.Messages?.[0]?.Data;
@@ -67,16 +73,18 @@ export class AOProcess {
67
73
  if (this.isMessageDataEmpty(messageData)) {
68
74
  return undefined;
69
75
  }
70
- const response = safeDecode(result.Messages[0].Data);
76
+ const response = safeDecode(messageData);
71
77
  return response;
72
78
  }
73
- catch (e) {
79
+ catch (error) {
74
80
  attempts++;
75
81
  this.logger.debug(`Read attempt ${attempts} failed`, {
76
- error: e instanceof Error ? e.message : e,
82
+ error: error?.message,
83
+ stack: error?.stack,
77
84
  tags,
85
+ processId: this.processId,
78
86
  });
79
- lastError = e;
87
+ lastError = error;
80
88
  // exponential backoff
81
89
  await new Promise((resolve) => setTimeout(resolve, 2 ** attempts * 1000));
82
90
  }
@@ -144,16 +152,17 @@ export class AOProcess {
144
152
  }
145
153
  catch (error) {
146
154
  this.logger.error('Error sending message to process', {
147
- error: error.message,
155
+ error: error?.message,
156
+ stack: error?.stack,
148
157
  processId: this.processId,
149
158
  tags,
150
159
  });
151
- // throw on write interaction errors. No point retrying wr ite interactions, waste of gas.
160
+ // throw on write interaction errors. No point retrying write interactions, waste of gas.
152
161
  if (error.message.includes('500')) {
153
162
  this.logger.debug('Retrying send interaction', {
154
163
  attempts,
155
164
  retries,
156
- error: error.message,
165
+ error: error?.message,
157
166
  processId: this.processId,
158
167
  });
159
168
  // exponential backoff
@@ -170,18 +179,16 @@ export class AOProcess {
170
179
  }
171
180
  function errorMessageFromOutput(output) {
172
181
  const errorData = output.Error;
173
- if (errorData !== undefined) {
174
- // TODO: Could clean this one up too, current error is verbose, but not always deterministic for parsing
175
- // Throw the whole raw error if AO process level error
176
- return errorData;
177
- }
178
- const error = output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')?.value;
182
+ // Attempt to extract error details from Messages.Tags if Error is undefined
183
+ const error = errorData ??
184
+ output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')?.value;
179
185
  if (error !== undefined) {
180
- // from [string "aos"]:6846: Name is already registered
181
- const lineNumber = error.match(/\d+/)?.[0];
182
- const message = error.replace(/\[string "aos"\]:\d+:/, '');
183
- // to more user friendly: Name is already registered (line 6846)
184
- return `${message} (line ${lineNumber})`.trim();
186
+ // Consolidated regex to match and extract line number and AO error message or Error Tags
187
+ const match = error.match(/\[string "aos"]:(\d+):\s*(.+)/);
188
+ if (match) {
189
+ const [, lineNumber, errorMessage] = match;
190
+ return `${errorMessage.trim()} (line ${lineNumber.trim()})`.trim();
191
+ }
185
192
  }
186
193
  return undefined;
187
194
  }
@@ -1,51 +1,26 @@
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 Arweave from 'arweave';
17
1
  import { ARIO_TESTNET_PROCESS_ID } from '../constants.js';
18
2
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/io.js';
19
3
  import { createAoSigner } from '../utils/ao.js';
20
4
  import { getEpochDataFromGql, paginationParamsToTags, pruneTags, } from '../utils/arweave.js';
5
+ import { defaultArweave } from './arweave.js';
21
6
  import { AOProcess } from './contracts/ao-process.js';
22
7
  import { InvalidContractConfigurationError } from './error.js';
23
8
  export class ARIO {
24
- static init({ arweave, ...config } = {}) {
25
- if (config !== undefined && config.signer) {
26
- const { signer, ...rest } = config;
27
- return new ARIOWriteable({
28
- ...rest,
29
- signer,
30
- arweave,
31
- });
9
+ // Implementation
10
+ static init(config) {
11
+ if (config !== undefined && 'signer' in config) {
12
+ return new ARIOWriteable(config);
32
13
  }
33
- return new ARIOReadable({
34
- arweave,
35
- ...config,
36
- });
14
+ return new ARIOReadable(config);
37
15
  }
38
16
  }
39
17
  export class ARIOReadable {
40
18
  process;
41
19
  epochSettings;
42
20
  arweave;
43
- constructor({ arweave = Arweave.init({
44
- host: 'arweave.net',
45
- port: 443,
46
- protocol: 'https',
47
- }), ...config }) {
48
- if (config === undefined) {
21
+ constructor(config) {
22
+ this.arweave = config?.arweave ?? defaultArweave;
23
+ if (config === undefined || Object.keys(config).length === 0) {
49
24
  this.process = new AOProcess({
50
25
  processId: ARIO_TESTNET_PROCESS_ID,
51
26
  });
@@ -61,7 +36,6 @@ export class ARIOReadable {
61
36
  else {
62
37
  throw new InvalidContractConfigurationError();
63
38
  }
64
- this.arweave = arweave;
65
39
  }
66
40
  async getInfo() {
67
41
  return this.process.read({
@@ -463,35 +437,29 @@ export class ARIOReadable {
463
437
  tags: [{ name: 'Action', value: 'Gateway-Registry-Settings' }],
464
438
  });
465
439
  }
440
+ async getAllDelegates(params) {
441
+ return this.process.read({
442
+ tags: [
443
+ { name: 'Action', value: 'All-Paginated-Delegates' },
444
+ ...paginationParamsToTags(params),
445
+ ],
446
+ });
447
+ }
466
448
  }
467
449
  export class ARIOWriteable extends ARIOReadable {
468
450
  signer;
469
- constructor({ signer, arweave, ...config }) {
470
- if (Object.keys(config).length === 0) {
451
+ constructor({ signer, ...config }) {
452
+ if (config === undefined) {
471
453
  super({
472
454
  process: new AOProcess({
473
455
  processId: ARIO_TESTNET_PROCESS_ID,
474
456
  }),
475
- arweave: arweave,
476
457
  });
477
- this.signer = createAoSigner(signer);
478
- }
479
- else if (isProcessConfiguration(config)) {
480
- super({ process: config.process });
481
- this.signer = createAoSigner(signer);
482
- }
483
- else if (isProcessIdConfiguration(config)) {
484
- super({
485
- process: new AOProcess({
486
- processId: config.processId,
487
- }),
488
- arweave: arweave,
489
- });
490
- this.signer = createAoSigner(signer);
491
458
  }
492
459
  else {
493
- throw new InvalidContractConfigurationError();
460
+ super(config);
494
461
  }
462
+ this.signer = createAoSigner(signer);
495
463
  }
496
464
  async transfer({ target, qty, }, options) {
497
465
  const { tags = [] } = options || {};
@@ -26,6 +26,7 @@ export const arioDevnetProcessId = ARIO_DEVNET_PROCESS_ID;
26
26
  export const ARIO_TESTNET_PROCESS_ID = 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA';
27
27
  export const ANT_REGISTRY_ID = 'i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc';
28
28
  export const MARIO_PER_ARIO = 1_000_000;
29
- export const AOS_MODULE_ID = 'tyojTpJ9fIva_7BjTA9ruGM4uk2vyTfhVUulnbVxR8I';
30
- export const ANT_LUA_ID = '16_FyX-V2QU0RPSh1GIaEETSaUjNb0oVjCFpVbAfQq4';
29
+ export const AOS_MODULE_ID = 'BRyNPIJWZaQ4IudfNnsfvMrZBO2YDPjgKqg_wCYT2U8';
30
+ export const ANT_LUA_ID = 'k9tQkbnFYZOGp6ist1yFuaqk_wOkzM5KUSNDtWzCLtg';
31
+ export const AO_AUTHORITY = 'fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY';
31
32
  export const DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
@@ -13,19 +13,24 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { createData } from '@dha-team/arbundles';
16
+ import { ArconnectSigner, DataItem, createData } from '@dha-team/arbundles';
17
17
  import { connect, createDataItemSigner } from '@permaweb/aoconnect';
18
18
  import { z } from 'zod';
19
19
  import { defaultArweave } from '../common/arweave.js';
20
20
  import { ANTRegistry, AOProcess, Logger } from '../common/index.js';
21
- import { ANT_LUA_ID, ANT_REGISTRY_ID, AOS_MODULE_ID, DEFAULT_SCHEDULER_ID, } from '../constants.js';
22
- export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(), scheduler = DEFAULT_SCHEDULER_ID, state, stateContractTxId, antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, }) {
21
+ import { ANT_LUA_ID, ANT_REGISTRY_ID, AOS_MODULE_ID, AO_AUTHORITY, DEFAULT_SCHEDULER_ID, } from '../constants.js';
22
+ export async function spawnANT({ signer, module = AOS_MODULE_ID, ao = connect(), scheduler = DEFAULT_SCHEDULER_ID, state, stateContractTxId, antRegistryId = ANT_REGISTRY_ID, logger = Logger.default, authority = AO_AUTHORITY, }) {
23
23
  // TODO: use On-Boot data handler for bootstrapping state instead of initialize-state
24
24
  const processId = await ao.spawn({
25
25
  module,
26
26
  scheduler,
27
27
  signer,
28
28
  tags: [
29
+ // Required for AOS to initialize the authorities table
30
+ {
31
+ name: 'Authority',
32
+ value: authority,
33
+ },
29
34
  {
30
35
  name: 'ANT-Registry-Id',
31
36
  value: antRegistryId,
@@ -147,6 +152,20 @@ export function createAoSigner(signer) {
147
152
  typeof signer.setPublicKey === 'function') {
148
153
  await signer.setPublicKey();
149
154
  }
155
+ if (signer instanceof ArconnectSigner) {
156
+ // Sign using Arconnect signDataItem API
157
+ const signedDataItem = await signer['signer'].signDataItem({
158
+ data,
159
+ tags,
160
+ target,
161
+ anchor,
162
+ });
163
+ const dataItem = new DataItem(Buffer.from(signedDataItem));
164
+ return {
165
+ id: await dataItem.id,
166
+ raw: await dataItem.getRaw(),
167
+ };
168
+ }
150
169
  const dataItem = createData(data, signer, { tags, target, anchor });
151
170
  const signedData = dataItem.sign(signer).then(async () => ({
152
171
  id: await dataItem.id,
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.3.0-alpha.1';
17
+ export const version = '3.3.0-alpha.11';
@@ -21,6 +21,9 @@ export declare function getGateway(o: AddressCLIOptions): Promise<import("../../
21
21
  export declare function listGateways(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoGatewayWithAddress> | {
22
22
  message: string;
23
23
  }>;
24
+ export declare function listAllDelegatesCLICommand(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoAllDelegates> | {
25
+ message: string;
26
+ }>;
24
27
  export declare function getGatewayDelegates(o: AddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoGatewayDelegateWithAddress> | {
25
28
  message: string;
26
29
  }>;
@@ -1,12 +1,12 @@
1
1
  import { AoANTRegistryRead, AoANTRegistryWrite } from '../types/ant-registry.js';
2
2
  import { AoMessageResult, ProcessConfiguration, WithSigner } from '../types/index.js';
3
3
  import { AOProcess } from './index.js';
4
+ type ANTRegistryNoSigner = ProcessConfiguration;
5
+ type ANTRegistryWithSigner = WithSigner<ProcessConfiguration>;
4
6
  export declare class ANTRegistry {
5
7
  static init(): AoANTRegistryRead;
6
- static init(config: Required<ProcessConfiguration> & {
7
- signer?: undefined;
8
- }): AoANTRegistryRead;
9
- static init({ signer, ...config }: WithSigner<Required<ProcessConfiguration>>): AoANTRegistryWrite;
8
+ static init(config: ANTRegistryNoSigner): AoANTRegistryRead;
9
+ static init(config: ANTRegistryWithSigner): AoANTRegistryWrite;
10
10
  }
11
11
  export declare class AoANTRegistryReadable implements AoANTRegistryRead {
12
12
  protected process: AOProcess;
@@ -25,3 +25,4 @@ export declare class AoANTRegistryWriteable extends AoANTRegistryReadable implem
25
25
  processId: string;
26
26
  }): Promise<AoMessageResult>;
27
27
  }
28
+ export {};
@@ -1,21 +1,19 @@
1
1
  import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord, AoANTState, AoANTWrite } from '../types/ant.js';
2
2
  import { AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
3
3
  import { AOProcess } from './index.js';
4
+ type ANTConfigOptionalStrict = Required<ProcessConfiguration> & {
5
+ strict?: boolean;
6
+ };
7
+ type ANTConfigNoSigner = ANTConfigOptionalStrict;
8
+ type ANTConfigWithSigner = WithSigner<ANTConfigOptionalStrict>;
4
9
  export declare class ANT {
5
- static init(config: Required<ProcessConfiguration> & {
6
- signer?: undefined;
7
- strict?: boolean;
8
- }): AoANTRead;
9
- static init({ signer, ...config }: WithSigner<Required<ProcessConfiguration>> & {
10
- strict?: boolean;
11
- }): AoANTWrite;
10
+ static init(config: ANTConfigNoSigner): AoANTRead;
11
+ static init(config: ANTConfigWithSigner): AoANTWrite;
12
12
  }
13
13
  export declare class AoANTReadable implements AoANTRead {
14
14
  protected process: AOProcess;
15
15
  private strict;
16
- constructor(config: Required<ProcessConfiguration> & {
17
- strict?: boolean;
18
- });
16
+ constructor(config: ANTConfigOptionalStrict);
19
17
  getState({ strict }?: AntReadOptions): Promise<AoANTState>;
20
18
  getInfo({ strict }?: AntReadOptions): Promise<AoANTInfo>;
21
19
  /**
@@ -273,3 +271,4 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
273
271
  notifyOwners?: boolean;
274
272
  }, options?: WriteOptions): Promise<AoMessageResult>;
275
273
  }
274
+ export {};
@@ -14,36 +14,22 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import Arweave from 'arweave';
17
- import { AoArNSNameDataWithName, AoArNSReservedNameData, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoReturnedName, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
18
- import { AoARIORead, AoARIOWrite, AoArNSNameData, AoArNSPurchaseParams, AoArNSReservedNameDataWithName, AoBuyRecordParams, AoDelegation, AoEpochData, AoEpochSettings, AoExtendLeaseParams, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoGetCostDetailsParams, AoIncreaseUndernameLimitParams, AoPaginatedAddressParams, AoRegistrationFees, AoVaultData, AoWalletVault, CostDetailsResult, DemandFactorSettings, EpochInput } from '../types/io.js';
17
+ import { AoArNSNameDataWithName, AoArNSReservedNameData, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoReturnedName, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoWeightedObserver, OptionalArweave, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
18
+ import { AoARIORead, AoARIOWrite, AoAllDelegates, AoArNSNameData, AoArNSPurchaseParams, AoArNSReservedNameDataWithName, AoBuyRecordParams, AoDelegation, AoEpochData, AoEpochSettings, AoExtendLeaseParams, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoGetCostDetailsParams, AoIncreaseUndernameLimitParams, AoPaginatedAddressParams, AoRegistrationFees, AoVaultData, AoWalletVault, CostDetailsResult, DemandFactorSettings, EpochInput } from '../types/io.js';
19
19
  import { mARIOToken } from '../types/token.js';
20
20
  import { AOProcess } from './contracts/ao-process.js';
21
+ type ARIOConfigNoSigner = OptionalArweave<ProcessConfiguration>;
22
+ type ARIOConfigWithSigner = WithSigner<OptionalArweave<ProcessConfiguration>>;
21
23
  export declare class ARIO {
22
24
  static init(): AoARIORead;
23
- static init({ process }: {
24
- process: AOProcess;
25
- }): AoARIORead;
26
- static init({ process, signer, }: WithSigner<{
27
- process: AOProcess;
28
- }>): AoARIOWrite;
29
- static init({ processId, signer, }: WithSigner<{
30
- processId?: string;
31
- }>): AoARIOWrite;
32
- static init({ processId, signer, }: {
33
- signer?: ContractSigner | undefined;
34
- processId: string;
35
- }): any;
36
- static init({ processId }: {
37
- processId: string;
38
- }): AoARIORead;
25
+ static init(config: ARIOConfigWithSigner): AoARIOWrite;
26
+ static init(config: ARIOConfigNoSigner): AoARIORead;
39
27
  }
40
28
  export declare class ARIOReadable implements AoARIORead {
41
29
  protected process: AOProcess;
42
30
  protected epochSettings: AoEpochSettings | undefined;
43
31
  protected arweave: Arweave;
44
- constructor({ arweave, ...config }: ProcessConfiguration & {
45
- arweave?: Arweave;
46
- });
32
+ constructor(config?: OptionalArweave<ProcessConfiguration>);
47
33
  getInfo(): Promise<{
48
34
  Name: string;
49
35
  Ticker: string;
@@ -150,17 +136,12 @@ export declare class ARIOReadable implements AoARIORead {
150
136
  address: WalletAddress;
151
137
  }): Promise<AoRedelegationFeeInfo>;
152
138
  getGatewayRegistrySettings(): Promise<AoGatewayRegistrySettings>;
139
+ getAllDelegates(params?: PaginationParams<AoAllDelegates>): Promise<PaginationResult<AoAllDelegates>>;
153
140
  }
154
141
  export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
155
142
  protected process: AOProcess;
156
143
  private signer;
157
- constructor({ signer, arweave, ...config }: WithSigner<{
158
- process?: AOProcess;
159
- } | {
160
- processId?: string;
161
- }> & {
162
- arweave?: Arweave;
163
- });
144
+ constructor({ signer, ...config }: ARIOConfigWithSigner);
164
145
  transfer({ target, qty, }: {
165
146
  target: string;
166
147
  qty: number | mARIOToken;
@@ -253,3 +234,4 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
253
234
  vaultId?: string;
254
235
  }, options?: WriteOptions): Promise<AoMessageResult>;
255
236
  }
237
+ export {};
@@ -24,6 +24,7 @@ export declare const arioDevnetProcessId = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6
24
24
  export declare const ARIO_TESTNET_PROCESS_ID = "agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA";
25
25
  export declare const ANT_REGISTRY_ID = "i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc";
26
26
  export declare const MARIO_PER_ARIO = 1000000;
27
- export declare const AOS_MODULE_ID = "tyojTpJ9fIva_7BjTA9ruGM4uk2vyTfhVUulnbVxR8I";
28
- export declare const ANT_LUA_ID = "16_FyX-V2QU0RPSh1GIaEETSaUjNb0oVjCFpVbAfQq4";
27
+ export declare const AOS_MODULE_ID = "BRyNPIJWZaQ4IudfNnsfvMrZBO2YDPjgKqg_wCYT2U8";
28
+ export declare const ANT_LUA_ID = "k9tQkbnFYZOGp6ist1yFuaqk_wOkzM5KUSNDtWzCLtg";
29
+ export declare const AO_AUTHORITY = "fcoN_xJeisVsPXA-trzVAuIiqO3ydLQxM-L4XbrQKzY";
29
30
  export declare const DEFAULT_SCHEDULER_ID = "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { Signer } from '@dha-team/arbundles';
18
18
  import { dryrun, message, monitor, result, results, spawn, unmonitor } from '@permaweb/aoconnect';
19
+ import Arweave from 'arweave';
19
20
  import { AoSigner } from './token.js';
20
21
  export type BlockHeight = number;
21
22
  export type SortKey = string;
@@ -23,6 +24,9 @@ export type Timestamp = number;
23
24
  export type WalletAddress = string;
24
25
  export type TransactionId = string;
25
26
  export type ProcessId = string;
27
+ export type OptionalArweave<T = NonNullable<unknown>> = {
28
+ arweave?: Arweave;
29
+ } & T;
26
30
  export type ContractSigner = Signer | Window['arweaveWallet'] | AoSigner;
27
31
  export type WithSigner<T = NonNullable<unknown>> = {
28
32
  signer: ContractSigner;
@@ -31,16 +31,20 @@ export type PaginationResult<T> = {
31
31
  sortOrder: 'asc' | 'desc';
32
32
  hasMore: boolean;
33
33
  };
34
- export type ProcessConfiguration = {
35
- process?: AOProcess;
36
- } | {
34
+ export type ProcessIdConfig = {
37
35
  processId?: string;
38
36
  };
39
- export type EpochInput = {
40
- epochIndex: AoEpochIndex;
41
- } | {
37
+ export type ProcessConfig = {
38
+ process?: AOProcess;
39
+ };
40
+ export type ProcessConfiguration = ProcessConfig | ProcessIdConfig;
41
+ export type EpochTimestampInput = {
42
42
  timestamp: Timestamp;
43
- } | undefined;
43
+ };
44
+ export type EpochIndexInput = {
45
+ epochIndex: AoEpochIndex;
46
+ };
47
+ export type EpochInput = EpochTimestampInput | EpochIndexInput | undefined;
44
48
  export type AoBalances = Record<WalletAddress, number>;
45
49
  export type AoRegistrationFees = Record<number, {
46
50
  lease: Record<number, number>;
@@ -117,6 +121,7 @@ export type AoEpochData = {
117
121
  startTimestamp: Timestamp;
118
122
  endTimestamp: Timestamp;
119
123
  distributionTimestamp: Timestamp;
124
+ /** @deprecated - use `getDistributions` to get distribution data for a given epoch **/
120
125
  distributions: AoEpochDistributionData;
121
126
  };
122
127
  export type AoTokenSupplyData = {
@@ -412,7 +417,16 @@ export interface AoARIORead {
412
417
  address: WalletAddress;
413
418
  }): Promise<AoRedelegationFeeInfo>;
414
419
  getGatewayRegistrySettings(): Promise<AoGatewayRegistrySettings>;
420
+ getAllDelegates(params?: PaginationParams<AoAllDelegates>): Promise<PaginationResult<AoAllDelegates>>;
415
421
  }
422
+ export type AoAllDelegates = {
423
+ address: WalletAddress;
424
+ gatewayAddress: WalletAddress;
425
+ delegatedStake: number;
426
+ startTimestamp: Timestamp;
427
+ vaultedStake: number;
428
+ cursorId: string;
429
+ };
416
430
  export interface AoARIOWrite extends AoARIORead {
417
431
  transfer({ target, qty, }: {
418
432
  target: WalletAddress;
@@ -456,10 +470,6 @@ export interface AoARIOWrite extends AoARIORead {
456
470
  requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
457
471
  redelegateStake(params: AoRedelegateStakeParams, options?: WriteOptions): Promise<AoMessageResult>;
458
472
  }
459
- export declare function isProcessConfiguration(config: object): config is {
460
- process: AOProcess;
461
- };
462
- export declare function isProcessIdConfiguration(config: object): config is {
463
- processId: string;
464
- };
473
+ export declare function isProcessConfiguration(config: object): config is Required<ProcessConfiguration> & Record<string, never>;
474
+ export declare function isProcessIdConfiguration(config: object): config is Required<ProcessIdConfig> & Record<string, never>;
465
475
  export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
@@ -21,6 +21,7 @@ export type SpawnANTParams = {
21
21
  stateContractTxId?: string;
22
22
  antRegistryId?: string;
23
23
  logger?: Logger;
24
+ authority?: string;
24
25
  /**
25
26
  * @deprecated Compiled modules are now being used instead of luaCodeTxId
26
27
  */
@@ -30,7 +31,7 @@ export type SpawnANTParams = {
30
31
  */
31
32
  arweave?: Arweave;
32
33
  };
33
- export declare function spawnANT({ signer, module, ao, scheduler, state, stateContractTxId, antRegistryId, logger, }: SpawnANTParams): Promise<string>;
34
+ export declare function spawnANT({ signer, module, ao, scheduler, state, stateContractTxId, antRegistryId, logger, authority, }: SpawnANTParams): Promise<string>;
34
35
  export declare function evolveANT({ signer, processId, luaCodeTxId, ao, logger, arweave, }: {
35
36
  signer: AoSigner;
36
37
  processId: string;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "3.2.0";
16
+ export declare const version = "3.3.0-alpha.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.3.0-alpha.1",
3
+ "version": "3.3.0-alpha.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"
@@ -126,7 +126,7 @@
126
126
  "dependencies": {
127
127
  "@dha-team/arbundles": "^1.0.1",
128
128
  "@permaweb/aoconnect": "^0.0.57",
129
- "arweave": "1.14.4",
129
+ "arweave": "1.15.5",
130
130
  "axios": "1.7.9",
131
131
  "axios-retry": "^4.3.0",
132
132
  "commander": "^12.1.0",