@ar.io/sdk 3.3.0-alpha.9 → 3.3.1-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.
@@ -16,10 +16,14 @@
16
16
  import { AOProcess } from '../common/index.js';
17
17
  import { AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './index.js';
18
18
  import { mARIOToken } from './token.js';
19
+ type NestedKeys<T> = T extends object ? T extends readonly unknown[] ? never : {
20
+ [K in keyof T & string]: T[K] extends object ? `${K}.${NestedKeys<T[K]>}` : K;
21
+ }[keyof T & string] : never;
22
+ export type SortBy<T> = T extends string ? string : keyof T extends never ? string : NestedKeys<T>;
19
23
  export type PaginationParams<T = Record<string, never>> = {
20
24
  cursor?: string;
21
25
  limit?: number;
22
- sortBy?: keyof T extends never ? string : keyof T;
26
+ sortBy?: SortBy<T>;
23
27
  sortOrder?: 'asc' | 'desc';
24
28
  };
25
29
  export type PaginationResult<T> = {
@@ -27,7 +31,7 @@ export type PaginationResult<T> = {
27
31
  nextCursor?: string;
28
32
  limit: number;
29
33
  totalItems: number;
30
- sortBy?: T extends string ? string : keyof T;
34
+ sortBy?: SortBy<T>;
31
35
  sortOrder: 'asc' | 'desc';
32
36
  hasMore: boolean;
33
37
  };
@@ -193,6 +197,11 @@ export type AoGatewayDelegate = {
193
197
  export type AoGatewayDelegateWithAddress = AoGatewayDelegate & {
194
198
  address: WalletAddress;
195
199
  };
200
+ export type AoAllDelegates = AoGatewayDelegateWithAddress & {
201
+ gatewayAddress: WalletAddress;
202
+ vaultedStake: number;
203
+ cursorId: string;
204
+ };
196
205
  export type AoGatewaySettings = {
197
206
  allowDelegatedStaking: boolean | 'allowlist';
198
207
  delegateRewardShareRatio: number;
@@ -232,6 +241,7 @@ export type AoStakeDelegation = AoDelegationBase & {
232
241
  balance: number;
233
242
  };
234
243
  export type AoDelegation = AoStakeDelegation | AoVaultDelegation;
244
+ /** Operator stake being withdrawn from a given gateway */
235
245
  export type AoGatewayVault = {
236
246
  cursorId: string;
237
247
  vaultId: TransactionId;
@@ -239,6 +249,10 @@ export type AoGatewayVault = {
239
249
  endTimestamp: Timestamp;
240
250
  startTimestamp: Timestamp;
241
251
  };
252
+ /** Operator stake being withdrawn from all gateway gateways */
253
+ export type AoAllGatewayVaults = AoGatewayVault & {
254
+ gatewayAddress: WalletAddress;
255
+ };
242
256
  export type AoJoinNetworkParams = Pick<AoGateway, 'operatorStake'> & Partial<AoGatewaySettings> & {
243
257
  observerAddress?: WalletAddress;
244
258
  };
@@ -250,7 +264,7 @@ export type AoAddressParams = {
250
264
  address: WalletAddress;
251
265
  };
252
266
  export type AoBalanceParams = AoAddressParams;
253
- export type AoPaginatedAddressParams = PaginationParams & AoAddressParams;
267
+ export type AoPaginatedAddressParams = PaginationParams<string> & AoAddressParams;
254
268
  export type AoDelegateStakeParams = {
255
269
  target: WalletAddress;
256
270
  stakeQty: number | mARIOToken;
@@ -418,15 +432,8 @@ export interface AoARIORead {
418
432
  }): Promise<AoRedelegationFeeInfo>;
419
433
  getGatewayRegistrySettings(): Promise<AoGatewayRegistrySettings>;
420
434
  getAllDelegates(params?: PaginationParams<AoAllDelegates>): Promise<PaginationResult<AoAllDelegates>>;
435
+ getAllGatewayVaults(params?: PaginationParams<AoAllGatewayVaults>): Promise<PaginationResult<AoAllGatewayVaults>>;
421
436
  }
422
- export type AoAllDelegates = {
423
- address: WalletAddress;
424
- gatewayAddress: WalletAddress;
425
- delegatedStake: number;
426
- startTimestamp: Timestamp;
427
- vaultedStake: number;
428
- cursorId: string;
429
- };
430
437
  export interface AoARIOWrite extends AoARIORead {
431
438
  transfer({ target, qty, }: {
432
439
  target: WalletAddress;
@@ -473,3 +480,4 @@ export interface AoARIOWrite extends AoARIORead {
473
480
  export declare function isProcessConfiguration(config: object): config is Required<ProcessConfiguration> & Record<string, never>;
474
481
  export declare function isProcessIdConfiguration(config: object): config is Required<ProcessIdConfig> & Record<string, never>;
475
482
  export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
483
+ export {};
@@ -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;
@@ -51,3 +52,13 @@ export declare function initANTStateForAddress({ owner, targetId, ttlSeconds, ke
51
52
  * Uses zod schema to parse the epoch data
52
53
  */
53
54
  export declare function parseAoEpochData(value: unknown): AoEpochData;
55
+ export declare function errorMessageFromOutput(output: {
56
+ Error?: string;
57
+ Messages?: {
58
+ Tags?: {
59
+ name: string;
60
+ value: string;
61
+ }[];
62
+ }[];
63
+ }): string | undefined;
64
+ export declare function removeUnicodeFromError(error: string): string;
@@ -39,11 +39,19 @@ export declare const paginationParamsToTags: <T>(params?: PaginationParams<T>) =
39
39
  * @param arweave - The Arweave instance
40
40
  * @returns The epoch with distribution data
41
41
  */
42
- export declare const getEpochDataFromGql: ({ arweave, epochIndex, processId, }: {
42
+ export declare const getEpochDataFromGql: ({ arweave, epochIndex, processId, retries, }: {
43
43
  arweave: Arweave;
44
44
  epochIndex: number;
45
45
  processId?: string;
46
+ retries?: number;
46
47
  }) => Promise<AoEpochData | undefined>;
48
+ /**
49
+ * Get the epoch with distribution data for the current epoch
50
+ * @param arweave - The Arweave instance
51
+ * @param epochIndex - The index of the epoch
52
+ * @param processId - The process ID (optional, defaults to ARIO_TESTNET_PROCESS_ID)
53
+ * @returns string - The stringified GQL query
54
+ */
47
55
  export declare const epochDistributionNoticeGqlQuery: ({ epochIndex, processId, }: {
48
56
  epochIndex: number;
49
57
  processId?: string;
@@ -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.8";
16
+ export declare const version = "3.3.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.3.0-alpha.9",
3
+ "version": "3.3.1-alpha.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"