@ar.io/sdk 2.4.0-alpha.9 → 2.5.0-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,17 +16,17 @@
16
16
  import { AOProcess } from '../common/index.js';
17
17
  import { AoMessageResult, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './index.js';
18
18
  import { mIOToken } from './token.js';
19
- export type PaginationParams = {
19
+ export type PaginationParams<T = Record<string, never>> = {
20
20
  cursor?: string;
21
21
  limit?: number;
22
- sortBy?: string;
22
+ sortBy?: keyof T extends never ? string : keyof T;
23
23
  sortOrder?: 'asc' | 'desc';
24
24
  };
25
25
  export type PaginationResult<T> = {
26
26
  items: T[];
27
27
  nextCursor: string | undefined;
28
28
  totalItems: number;
29
- sortBy: keyof T;
29
+ sortBy?: keyof T;
30
30
  sortOrder: 'asc' | 'desc';
31
31
  hasMore: boolean;
32
32
  };
@@ -65,7 +65,7 @@ export type AoEpochObservationData = {
65
65
  };
66
66
  export type AoVaultData = {
67
67
  balance: number;
68
- locked: number;
68
+ startTimestamp: Timestamp;
69
69
  endTimestamp: Timestamp;
70
70
  };
71
71
  export type AoEpochDistributionRewards = {
@@ -142,10 +142,16 @@ export type AoGatewayService = {
142
142
  export type AoGatewayServices = {
143
143
  bundlers: AoGatewayService[];
144
144
  } | undefined;
145
+ export type AoGatewayDelegates = Record<WalletAddress, AoGatewayDelegate>;
146
+ export type AoGatewayDelegateAllowList = WalletAddress[];
147
+ export type AoWalletVault = AoVaultData & {
148
+ address: WalletAddress;
149
+ vaultId: string;
150
+ };
145
151
  export type AoGateway = {
146
152
  settings: AoGatewaySettings;
153
+ delegates: AoGatewayDelegates;
147
154
  stats: AoGatewayStats;
148
- delegates: Record<WalletAddress, AoGatewayDelegate>;
149
155
  totalDelegatedStake: number;
150
156
  vaults: Record<WalletAddress, AoVaultData>;
151
157
  startTimestamp: Timestamp;
@@ -187,9 +193,13 @@ export type AoGatewayDelegate = {
187
193
  startTimestamp: Timestamp;
188
194
  vaults: Record<WalletAddress, AoVaultData>;
189
195
  };
196
+ export type AoGatewayDelegateWithAddress = AoGatewayDelegate & {
197
+ address: WalletAddress;
198
+ };
190
199
  export type AoGatewaySettings = {
191
- allowDelegatedStaking: boolean;
200
+ allowDelegatedStaking: boolean | 'allowlist';
192
201
  delegateRewardShareRatio: number;
202
+ allowedDelegates: WalletAddress[];
193
203
  minDelegatedStake: number;
194
204
  autoStake: boolean;
195
205
  label: string;
@@ -224,6 +234,19 @@ export type AoAuctionPriceData = {
224
234
  prices: Record<string, number>;
225
235
  currentPrice: number;
226
236
  };
237
+ export type AoDelegationBase = {
238
+ type: 'stake' | 'vault';
239
+ gatewayAddress: WalletAddress;
240
+ delegationId: string;
241
+ };
242
+ export type AoVaultDelegation = AoDelegationBase & AoVaultData & {
243
+ type: 'vault';
244
+ vaultId: TransactionId;
245
+ };
246
+ export type AoStakeDelegation = Omit<AoVaultDelegation, 'endTimestamp' | 'vaultId'> & {
247
+ type: 'stake';
248
+ };
249
+ export type AoDelegation = AoStakeDelegation | AoVaultDelegation;
227
250
  export type AoJoinNetworkParams = Pick<AoGateway, 'operatorStake' | 'observerAddress'> & Partial<AoGatewaySettings>;
228
251
  export type AoUpdateGatewaySettingsParams = AtLeastOne<AoJoinNetworkParams>;
229
252
  export interface AoIORead {
@@ -240,20 +263,24 @@ export interface AoIORead {
240
263
  getGateway({ address, }: {
241
264
  address: WalletAddress;
242
265
  }): Promise<AoGateway | undefined>;
243
- getGateways(params?: PaginationParams): Promise<PaginationResult<AoGatewayWithAddress>>;
266
+ getGatewayDelegates({ address, ...pageParams }: {
267
+ address: WalletAddress;
268
+ } & PaginationParams<AoGatewayDelegateWithAddress>): Promise<PaginationResult<AoGatewayDelegateWithAddress>>;
269
+ getGatewayDelegateAllowList(params?: PaginationParams<WalletAddress>): Promise<PaginationResult<WalletAddress>>;
270
+ getGateways(params?: PaginationParams<AoGatewayWithAddress>): Promise<PaginationResult<AoGatewayWithAddress>>;
244
271
  getBalance(params: {
245
272
  address: WalletAddress;
246
273
  }): Promise<number>;
247
- getBalances(params?: PaginationParams): Promise<PaginationResult<AoBalanceWithAddress>>;
274
+ getBalances(params?: PaginationParams<AoBalanceWithAddress>): Promise<PaginationResult<AoBalanceWithAddress>>;
248
275
  getArNSRecord({ name, }: {
249
276
  name: string;
250
277
  }): Promise<AoArNSNameData | undefined>;
251
- getArNSRecords(params?: PaginationParams): Promise<PaginationResult<AoArNSNameDataWithName>>;
278
+ getArNSRecords(params?: PaginationParams<AoArNSNameDataWithName>): Promise<PaginationResult<AoArNSNameDataWithName>>;
252
279
  getArNSReservedNames(): Promise<Record<string, AoArNSReservedNameData> | Record<string, never>>;
253
280
  getArNSReservedName({ name, }: {
254
281
  name: string;
255
282
  }): Promise<AoArNSReservedNameData | undefined>;
256
- getArNSAuctions(params?: PaginationParams): Promise<PaginationResult<AoAuction>>;
283
+ getArNSAuctions(params?: PaginationParams<AoAuction>): Promise<PaginationResult<AoAuction>>;
257
284
  getArNSAuction({ name }: {
258
285
  name: string;
259
286
  }): Promise<AoAuction | undefined>;
@@ -279,15 +306,20 @@ export interface AoIORead {
279
306
  }): Promise<number>;
280
307
  getRegistrationFees(): Promise<AoRegistrationFees>;
281
308
  getDemandFactor(): Promise<number>;
309
+ getVaults(params?: PaginationParams<AoWalletVault>): Promise<PaginationResult<AoWalletVault>>;
310
+ getVault({ address, vaultId, }: {
311
+ address: WalletAddress;
312
+ vaultId: string;
313
+ }): Promise<AoVaultData>;
282
314
  }
283
315
  export interface AoIOWrite extends AoIORead {
284
316
  transfer({ target, qty, }: {
285
317
  target: WalletAddress;
286
318
  qty: number;
287
319
  }, options?: WriteOptions): Promise<AoMessageResult>;
288
- joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoJoinNetworkParams, options?: WriteOptions): Promise<AoMessageResult>;
320
+ joinNetwork(params: AoJoinNetworkParams, options?: WriteOptions): Promise<AoMessageResult>;
289
321
  leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
290
- updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoUpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
322
+ updateGatewaySettings(params: AoUpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
291
323
  increaseOperatorStake(params: {
292
324
  increaseQty: number | mIOToken;
293
325
  }, options?: WriteOptions): Promise<AoMessageResult>;
@@ -1,3 +1,27 @@
1
- import { BlockHeight } from '../types/common.js';
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
+ import { BlockHeight, Timestamp } from '../types/common.js';
2
18
  export declare const validateArweaveId: (id: string) => boolean;
3
19
  export declare function isBlockHeight(height: string | number): height is BlockHeight;
20
+ export declare const pruneTags: (tags: {
21
+ name: string;
22
+ value: string | undefined;
23
+ }[]) => {
24
+ name: string;
25
+ value: string;
26
+ }[];
27
+ export declare const getCurrentBlockUnixTimestampMs: (arweave: Arweave) => Promise<Timestamp>;
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export * from './arweave.js';
17
- export * from './http-client.js';
18
16
  export * from './ao.js';
17
+ export * from './arweave.js';
18
+ export * from './base64.js';
19
19
  export * from './json.js';
20
20
  export * from './processes.js';
21
21
  export * from './schema.js';
@@ -29,11 +29,13 @@ export declare class ArNSEventEmitter extends EventEmitter {
29
29
  private timeoutMs;
30
30
  private throttle;
31
31
  private logger;
32
- constructor({ contract, timeoutMs, concurrency, logger, }?: {
32
+ private strict;
33
+ constructor({ contract, timeoutMs, concurrency, logger, strict, }?: {
33
34
  contract?: AoIORead;
34
35
  timeoutMs?: number;
35
36
  concurrency?: number;
36
37
  logger?: ILogger;
38
+ strict?: boolean;
37
39
  });
38
40
  fetchProcessesOwnedByWallet({ address, pageSize, antRegistry, }: {
39
41
  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 = "2.4.0-alpha.8";
16
+ export declare const version = "2.4.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "2.4.0-alpha.9",
3
+ "version": "2.5.0-alpha.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"
@@ -109,6 +109,7 @@
109
109
  "husky": "^8.0.3",
110
110
  "lint-staged": "^15.2.2",
111
111
  "markdown-toc-gen": "^1.0.1",
112
+ "nock": "^13.5.5",
112
113
  "prettier": "^3.0.2",
113
114
  "rimraf": "^5.0.1",
114
115
  "semantic-release": "^21.0.7",