@ar.io/sdk 3.3.0-alpha.13 → 3.3.0-alpha.15

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.
@@ -258,6 +258,12 @@ const utils_js_1 = require("./utils.js");
258
258
  options: options_js_1.paginationAddressOptions,
259
259
  action: readCommands_js_1.getGatewayVaults,
260
260
  });
261
+ (0, utils_js_1.makeCommand)({
262
+ name: 'list-all-gateway-vaults',
263
+ description: 'List vaults from all gateways',
264
+ options: options_js_1.paginationAddressOptions,
265
+ action: readCommands_js_1.getAllGatewayVaults,
266
+ });
261
267
  (0, utils_js_1.makeCommand)({
262
268
  name: 'transfer',
263
269
  description: 'Transfer ARIO to another address',
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVault = exports.getGatewayVaults = exports.getPrimaryName = exports.getCostDetails = exports.getTokenCost = exports.getPrescribedNames = exports.getPrescribedObservers = exports.getEpoch = exports.listArNSReturnedNames = exports.getArNSReturnedName = exports.listArNSReservedNames = exports.getArNSReservedName = exports.listArNSRecords = exports.getArNSRecord = exports.getAllowedDelegates = exports.getDelegations = exports.getGatewayDelegates = exports.listAllDelegatesCLICommand = exports.listGateways = exports.getGateway = void 0;
3
+ exports.getVault = exports.getAllGatewayVaults = exports.getGatewayVaults = exports.getPrimaryName = exports.getCostDetails = exports.getTokenCost = exports.getPrescribedNames = exports.getPrescribedObservers = exports.getEpoch = exports.listArNSReturnedNames = exports.getArNSReturnedName = exports.listArNSReservedNames = exports.getArNSReservedName = exports.listArNSRecords = exports.getArNSRecord = exports.getAllowedDelegates = exports.getDelegations = exports.getGatewayDelegates = exports.listAllDelegatesCLICommand = exports.listGateways = exports.getGateway = void 0;
4
4
  const token_js_1 = require("../../types/token.js");
5
5
  const utils_js_1 = require("../utils.js");
6
6
  async function getGateway(o) {
@@ -173,6 +173,15 @@ async function getGatewayVaults(o) {
173
173
  };
174
174
  }
175
175
  exports.getGatewayVaults = getGatewayVaults;
176
+ async function getAllGatewayVaults(o) {
177
+ const result = await (0, utils_js_1.readARIOFromOptions)(o).getAllGatewayVaults((0, utils_js_1.paginationParamsFromOptions)(o));
178
+ return result.items?.length
179
+ ? result
180
+ : {
181
+ message: `No vaults found`,
182
+ };
183
+ }
184
+ exports.getAllGatewayVaults = getAllGatewayVaults;
176
185
  async function getVault(o) {
177
186
  return (0, utils_js_1.readARIOFromOptions)(o)
178
187
  .getVault({
@@ -449,6 +449,14 @@ class ARIOReadable {
449
449
  ],
450
450
  });
451
451
  }
452
+ async getAllGatewayVaults(params) {
453
+ return this.process.read({
454
+ tags: [
455
+ { name: 'Action', value: 'All-Gateway-Vaults' },
456
+ ...(0, arweave_js_1.paginationParamsToTags)(params),
457
+ ],
458
+ });
459
+ }
452
460
  }
453
461
  exports.ARIOReadable = ARIOReadable;
454
462
  class ARIOWriteable extends ARIOReadable {
@@ -16,10 +16,12 @@ exports.fetchAllArNSRecords = exports.ArNSEventEmitter = exports.getANTProcesses
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
+ const aoconnect_1 = require("@permaweb/aoconnect");
19
20
  const eventemitter3_1 = require("eventemitter3");
20
21
  const plimit_lit_1 = require("plimit-lit");
21
22
  const ant_registry_js_1 = require("../common/ant-registry.js");
22
23
  const ant_js_1 = require("../common/ant.js");
24
+ const index_js_1 = require("../common/index.js");
23
25
  const io_js_1 = require("../common/io.js");
24
26
  const logger_js_1 = require("../common/logger.js");
25
27
  const constants_js_1 = require("../constants.js");
@@ -53,15 +55,17 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
53
55
  throttle;
54
56
  logger;
55
57
  strict;
58
+ antAoClient;
56
59
  constructor({ contract = io_js_1.ARIO.init({
57
60
  processId: constants_js_1.ARIO_TESTNET_PROCESS_ID,
58
- }), timeoutMs = 60_000, concurrency = 30, logger = logger_js_1.Logger.default, strict = false, } = {}) {
61
+ }), timeoutMs = 60_000, concurrency = 30, logger = logger_js_1.Logger.default, strict = false, antAoClient = (0, aoconnect_1.connect)(), } = {}) {
59
62
  super();
60
63
  this.contract = contract;
61
64
  this.timeoutMs = timeoutMs;
62
65
  this.throttle = (0, plimit_lit_1.pLimit)(concurrency);
63
66
  this.logger = logger;
64
67
  this.strict = strict;
68
+ this.antAoClient = antAoClient;
65
69
  }
66
70
  async fetchProcessesOwnedByWallet({ address, pageSize, antRegistry = ant_registry_js_1.ANTRegistry.init(), }) {
67
71
  const uniqueContractProcessIds = {};
@@ -99,7 +103,10 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
99
103
  return;
100
104
  }
101
105
  const ant = ant_js_1.ANT.init({
102
- processId,
106
+ process: new index_js_1.AOProcess({
107
+ processId,
108
+ ao: this.antAoClient,
109
+ }),
103
110
  strict: this.strict,
104
111
  });
105
112
  const state = (await timeout(this.timeoutMs, ant.getState()).catch((e) => {
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '3.3.0-alpha.13';
20
+ exports.version = '3.3.0-alpha.15';
@@ -21,7 +21,7 @@ import { mARIOToken } from '../types/token.js';
21
21
  import { version } from '../version.js';
22
22
  import { buyRecordCLICommand, extendLeaseCLICommand, increaseUndernameLimitCLICommand, requestPrimaryNameCLICommand, upgradeRecordCLICommand, } from './commands/arnsPurchaseCommands.js';
23
23
  import { cancelWithdrawal, decreaseDelegateStake, decreaseOperatorStake, delegateStake, increaseOperatorStake, instantWithdrawal, joinNetwork, leaveNetwork, redelegateStake, saveObservations, updateGatewaySettings, } from './commands/gatewayWriteCommands.js';
24
- import { getAllowedDelegates, getArNSRecord, getArNSReservedName, getArNSReturnedName, getCostDetails, getDelegations, getEpoch, getGateway, getGatewayDelegates, getGatewayVaults, getPrescribedNames, getPrescribedObservers, getPrimaryName, getTokenCost, getVault, listAllDelegatesCLICommand, listArNSRecords, listArNSReservedNames, listArNSReturnedNames, listGateways, } from './commands/readCommands.js';
24
+ import { getAllGatewayVaults, getAllowedDelegates, getArNSRecord, getArNSReservedName, getArNSReturnedName, getCostDetails, getDelegations, getEpoch, getGateway, getGatewayDelegates, getGatewayVaults, getPrescribedNames, getPrescribedObservers, getPrimaryName, getTokenCost, getVault, listAllDelegatesCLICommand, listArNSRecords, listArNSReservedNames, listArNSReturnedNames, listGateways, } from './commands/readCommands.js';
25
25
  import { transfer } from './commands/transfer.js';
26
26
  import { addressAndVaultIdOptions, antStateOptions, arnsPurchaseOptions, buyRecordOptions, decreaseDelegateStakeOptions, delegateStakeOptions, epochOptions, getVaultOptions, globalOptions, joinNetworkOptions, operatorStakeOptions, optionMap, paginationAddressOptions, paginationOptions, redelegateStakeOptions, tokenCostOptions, transferOptions, updateGatewaySettingsOptions, writeActionOptions, } from './options.js';
27
27
  import { applyOptions, arioProcessIdFromOptions, assertConfirmationPrompt, epochInputFromOptions, formatARIOWithCommas, getANTStateFromOptions, getLoggerFromOptions, makeCommand, paginationParamsFromOptions, readANTFromOptions, readARIOFromOptions, requiredAddressFromOptions, requiredAoSignerFromOptions, requiredProcessIdFromOptions, requiredStringArrayFromOptions, requiredStringFromOptions, writeANTFromOptions, writeActionTagsFromOptions, } from './utils.js';
@@ -256,6 +256,12 @@ makeCommand({
256
256
  options: paginationAddressOptions,
257
257
  action: getGatewayVaults,
258
258
  });
259
+ makeCommand({
260
+ name: 'list-all-gateway-vaults',
261
+ description: 'List vaults from all gateways',
262
+ options: paginationAddressOptions,
263
+ action: getAllGatewayVaults,
264
+ });
259
265
  makeCommand({
260
266
  name: 'transfer',
261
267
  description: 'Transfer ARIO to another address',
@@ -151,6 +151,14 @@ export async function getGatewayVaults(o) {
151
151
  message: `No vaults found for gateway ${address}`,
152
152
  };
153
153
  }
154
+ export async function getAllGatewayVaults(o) {
155
+ const result = await readARIOFromOptions(o).getAllGatewayVaults(paginationParamsFromOptions(o));
156
+ return result.items?.length
157
+ ? result
158
+ : {
159
+ message: `No vaults found`,
160
+ };
161
+ }
154
162
  export async function getVault(o) {
155
163
  return readARIOFromOptions(o)
156
164
  .getVault({
@@ -445,6 +445,14 @@ export class ARIOReadable {
445
445
  ],
446
446
  });
447
447
  }
448
+ async getAllGatewayVaults(params) {
449
+ return this.process.read({
450
+ tags: [
451
+ { name: 'Action', value: 'All-Gateway-Vaults' },
452
+ ...paginationParamsToTags(params),
453
+ ],
454
+ });
455
+ }
448
456
  }
449
457
  export class ARIOWriteable extends ARIOReadable {
450
458
  signer;
@@ -13,10 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { connect } from '@permaweb/aoconnect';
16
17
  import { EventEmitter } from 'eventemitter3';
17
18
  import { pLimit } from 'plimit-lit';
18
19
  import { ANTRegistry } from '../common/ant-registry.js';
19
20
  import { ANT } from '../common/ant.js';
21
+ import { AOProcess } from '../common/index.js';
20
22
  import { ARIO } from '../common/io.js';
21
23
  import { Logger } from '../common/logger.js';
22
24
  import { ARIO_TESTNET_PROCESS_ID } from '../constants.js';
@@ -49,15 +51,17 @@ export class ArNSEventEmitter extends EventEmitter {
49
51
  throttle;
50
52
  logger;
51
53
  strict;
54
+ antAoClient;
52
55
  constructor({ contract = ARIO.init({
53
56
  processId: ARIO_TESTNET_PROCESS_ID,
54
- }), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, } = {}) {
57
+ }), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, antAoClient = connect(), } = {}) {
55
58
  super();
56
59
  this.contract = contract;
57
60
  this.timeoutMs = timeoutMs;
58
61
  this.throttle = pLimit(concurrency);
59
62
  this.logger = logger;
60
63
  this.strict = strict;
64
+ this.antAoClient = antAoClient;
61
65
  }
62
66
  async fetchProcessesOwnedByWallet({ address, pageSize, antRegistry = ANTRegistry.init(), }) {
63
67
  const uniqueContractProcessIds = {};
@@ -95,7 +99,10 @@ export class ArNSEventEmitter extends EventEmitter {
95
99
  return;
96
100
  }
97
101
  const ant = ANT.init({
98
- processId,
102
+ process: new AOProcess({
103
+ processId,
104
+ ao: this.antAoClient,
105
+ }),
99
106
  strict: this.strict,
100
107
  });
101
108
  const state = (await timeout(this.timeoutMs, ant.getState()).catch((e) => {
@@ -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.13';
17
+ export const version = '3.3.0-alpha.15';
@@ -79,6 +79,9 @@ export declare function getPrimaryName(o: AddressAndNameCLIOptions): Promise<imp
79
79
  export declare function getGatewayVaults(o: PaginationAddressCLIOptions): Promise<import("../../types/io.js").PaginationResult<AoGatewayVault> | {
80
80
  message: string;
81
81
  }>;
82
+ export declare function getAllGatewayVaults(o: PaginationCLIOptions): Promise<import("../../types/io.js").PaginationResult<import("../../types/io.js").AoAllGatewayVaults> | {
83
+ message: string;
84
+ }>;
82
85
  export declare function getVault(o: AddressAndVaultIdCLIOptions): Promise<import("../../types/io.js").AoVaultData | {
83
86
  message: string;
84
87
  }>;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import Arweave from 'arweave';
17
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';
18
+ import { AoARIORead, AoARIOWrite, AoAllDelegates, AoAllGatewayVaults, 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
21
  type ARIOConfigNoSigner = OptionalArweave<ProcessConfiguration>;
@@ -137,6 +137,7 @@ export declare class ARIOReadable implements AoARIORead {
137
137
  }): Promise<AoRedelegationFeeInfo>;
138
138
  getGatewayRegistrySettings(): Promise<AoGatewayRegistrySettings>;
139
139
  getAllDelegates(params?: PaginationParams<AoAllDelegates>): Promise<PaginationResult<AoAllDelegates>>;
140
+ getAllGatewayVaults(params?: PaginationParams<AoAllGatewayVaults>): Promise<PaginationResult<AoAllGatewayVaults>>;
140
141
  }
141
142
  export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
142
143
  protected process: AOProcess;
@@ -197,6 +197,11 @@ export type AoGatewayDelegate = {
197
197
  export type AoGatewayDelegateWithAddress = AoGatewayDelegate & {
198
198
  address: WalletAddress;
199
199
  };
200
+ export type AoAllDelegates = AoGatewayDelegateWithAddress & {
201
+ gatewayAddress: WalletAddress;
202
+ vaultedStake: number;
203
+ cursorId: string;
204
+ };
200
205
  export type AoGatewaySettings = {
201
206
  allowDelegatedStaking: boolean | 'allowlist';
202
207
  delegateRewardShareRatio: number;
@@ -236,6 +241,7 @@ export type AoStakeDelegation = AoDelegationBase & {
236
241
  balance: number;
237
242
  };
238
243
  export type AoDelegation = AoStakeDelegation | AoVaultDelegation;
244
+ /** Operator stake being withdrawn from a given gateway */
239
245
  export type AoGatewayVault = {
240
246
  cursorId: string;
241
247
  vaultId: TransactionId;
@@ -243,6 +249,10 @@ export type AoGatewayVault = {
243
249
  endTimestamp: Timestamp;
244
250
  startTimestamp: Timestamp;
245
251
  };
252
+ /** Operator stake being withdrawn from all gateway gateways */
253
+ export type AoAllGatewayVaults = AoGatewayVault & {
254
+ gatewayAddress: WalletAddress;
255
+ };
246
256
  export type AoJoinNetworkParams = Pick<AoGateway, 'operatorStake'> & Partial<AoGatewaySettings> & {
247
257
  observerAddress?: WalletAddress;
248
258
  };
@@ -422,15 +432,8 @@ export interface AoARIORead {
422
432
  }): Promise<AoRedelegationFeeInfo>;
423
433
  getGatewayRegistrySettings(): Promise<AoGatewayRegistrySettings>;
424
434
  getAllDelegates(params?: PaginationParams<AoAllDelegates>): Promise<PaginationResult<AoAllDelegates>>;
435
+ getAllGatewayVaults(params?: PaginationParams<AoAllGatewayVaults>): Promise<PaginationResult<AoAllGatewayVaults>>;
425
436
  }
426
- export type AoAllDelegates = {
427
- address: WalletAddress;
428
- gatewayAddress: WalletAddress;
429
- delegatedStake: number;
430
- startTimestamp: Timestamp;
431
- vaultedStake: number;
432
- cursorId: string;
433
- };
434
437
  export interface AoARIOWrite extends AoARIORead {
435
438
  transfer({ target, qty, }: {
436
439
  target: WalletAddress;
@@ -1,22 +1,7 @@
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
1
  import { EventEmitter } from 'eventemitter3';
17
2
  import { ILogger } from '../common/logger.js';
18
3
  import { AoANTRegistryRead } from '../types/ant-registry.js';
19
- import { AoARIORead, AoArNSNameData, ProcessId, WalletAddress } from '../types/index.js';
4
+ import { AoARIORead, AoArNSNameData, AoClient, ProcessId, WalletAddress } from '../types/index.js';
20
5
  /**
21
6
  * @beta This API is in beta and may change in the future.
22
7
  */
@@ -30,12 +15,14 @@ export declare class ArNSEventEmitter extends EventEmitter {
30
15
  private throttle;
31
16
  private logger;
32
17
  private strict;
33
- constructor({ contract, timeoutMs, concurrency, logger, strict, }?: {
18
+ private antAoClient;
19
+ constructor({ contract, timeoutMs, concurrency, logger, strict, antAoClient, }?: {
34
20
  contract?: AoARIORead;
35
21
  timeoutMs?: number;
36
22
  concurrency?: number;
37
23
  logger?: ILogger;
38
24
  strict?: boolean;
25
+ antAoClient?: AoClient;
39
26
  });
40
27
  fetchProcessesOwnedByWallet({ address, pageSize, antRegistry, }: {
41
28
  address: WalletAddress;
@@ -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.3.0-alpha.12";
16
+ export declare const version = "3.3.0-alpha.14";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.3.0-alpha.13",
3
+ "version": "3.3.0-alpha.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"