@ar.io/sdk 3.1.0-alpha.1 → 3.1.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.
- package/bundles/web.bundle.min.js +68 -68
- package/lib/cjs/cli/cli.js +19 -69
- package/lib/cjs/cli/commands/arnsPurchaseCommands.js +167 -0
- package/lib/cjs/cli/commands/gatewayWriteCommands.js +8 -4
- package/lib/cjs/cli/commands/readCommands.js +1 -22
- package/lib/cjs/cli/commands/transfer.js +5 -1
- package/lib/cjs/cli/options.js +8 -7
- package/lib/cjs/cli/utils.js +39 -7
- package/lib/cjs/common/contracts/ao-process.js +34 -16
- package/lib/cjs/common/io.js +76 -116
- package/lib/cjs/utils/arweave.js +22 -13
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +21 -71
- package/lib/esm/cli/commands/arnsPurchaseCommands.js +159 -0
- package/lib/esm/cli/commands/gatewayWriteCommands.js +6 -2
- package/lib/esm/cli/commands/readCommands.js +2 -23
- package/lib/esm/cli/commands/transfer.js +6 -2
- package/lib/esm/cli/options.js +7 -6
- package/lib/esm/cli/utils.js +34 -5
- package/lib/esm/common/contracts/ao-process.js +34 -16
- package/lib/esm/common/io.js +77 -117
- package/lib/esm/utils/arweave.js +21 -11
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/arnsPurchaseCommands.d.ts +22 -0
- package/lib/types/cli/options.d.ts +1 -9
- package/lib/types/cli/types.d.ts +3 -5
- package/lib/types/cli/utils.d.ts +16 -3
- package/lib/types/common/contracts/ao-process.d.ts +1 -0
- package/lib/types/common/io.d.ts +14 -43
- package/lib/types/types/common.d.ts +1 -0
- package/lib/types/types/io.d.ts +16 -10
- package/lib/types/utils/arweave.d.ts +6 -18
- package/lib/types/version.d.ts +1 -1
- package/package.json +2 -2
package/lib/types/types/io.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type PaginationParams<T = Record<string, never>> = {
|
|
|
25
25
|
export type PaginationResult<T> = {
|
|
26
26
|
items: T[];
|
|
27
27
|
nextCursor?: string;
|
|
28
|
+
limit: number;
|
|
28
29
|
totalItems: number;
|
|
29
30
|
sortBy?: T extends string ? string : keyof T;
|
|
30
31
|
sortOrder: 'asc' | 'desc';
|
|
@@ -50,6 +51,7 @@ export type AoEpochObservationData = {
|
|
|
50
51
|
failureSummaries: Record<WalletAddress, WalletAddress[]>;
|
|
51
52
|
reports: Record<WalletAddress, TransactionId>;
|
|
52
53
|
};
|
|
54
|
+
export type AoEpochPrescribedObservers = Record<WalletAddress, WalletAddress[]>;
|
|
53
55
|
export type AoVaultData = {
|
|
54
56
|
balance: number;
|
|
55
57
|
startTimestamp: Timestamp;
|
|
@@ -103,12 +105,15 @@ export type AoEpochSettings = {
|
|
|
103
105
|
rewardPercentage: number;
|
|
104
106
|
maxObservers: number;
|
|
105
107
|
distributionDelayMs: number;
|
|
108
|
+
epochZeroTimestamp: Timestamp;
|
|
109
|
+
pruneEpochsCount: number;
|
|
106
110
|
};
|
|
107
111
|
export type AoEpochData = {
|
|
108
112
|
epochIndex: AoEpochIndex;
|
|
109
113
|
startHeight: BlockHeight;
|
|
110
114
|
observations: AoEpochObservationData;
|
|
111
115
|
prescribedObservers: AoWeightedObserver[];
|
|
116
|
+
prescribedNames: string[];
|
|
112
117
|
startTimestamp: Timestamp;
|
|
113
118
|
endTimestamp: Timestamp;
|
|
114
119
|
distributionTimestamp: Timestamp;
|
|
@@ -274,7 +279,7 @@ export type AoFundingPlan = {
|
|
|
274
279
|
address: WalletAddress;
|
|
275
280
|
balance: number;
|
|
276
281
|
stakes: Record<WalletAddress, {
|
|
277
|
-
vaults: string[];
|
|
282
|
+
vaults: Record<string, number>[];
|
|
278
283
|
delegatedStake: number;
|
|
279
284
|
}>;
|
|
280
285
|
/** Any remaining shortfall will indicate an insufficient balance for the action */
|
|
@@ -294,15 +299,18 @@ export type AoGetVaultParams = {
|
|
|
294
299
|
address: WalletAddress;
|
|
295
300
|
vaultId: string;
|
|
296
301
|
};
|
|
297
|
-
export type
|
|
302
|
+
export type AoArNSPurchaseParams = AoArNSNameParams & {
|
|
303
|
+
fundFrom?: FundFrom;
|
|
304
|
+
};
|
|
305
|
+
export type AoBuyRecordParams = AoArNSPurchaseParams & {
|
|
298
306
|
years?: number;
|
|
299
307
|
type: 'lease' | 'permabuy';
|
|
300
308
|
processId: string;
|
|
301
309
|
};
|
|
302
|
-
export type AoExtendLeaseParams =
|
|
310
|
+
export type AoExtendLeaseParams = AoArNSPurchaseParams & {
|
|
303
311
|
years: number;
|
|
304
312
|
};
|
|
305
|
-
export type AoIncreaseUndernameLimitParams =
|
|
313
|
+
export type AoIncreaseUndernameLimitParams = AoArNSPurchaseParams & {
|
|
306
314
|
increaseCount: number;
|
|
307
315
|
};
|
|
308
316
|
export type AoGatewayRegistrySettings = {
|
|
@@ -345,7 +353,7 @@ export interface AoARIORead {
|
|
|
345
353
|
LastTickedEpochIndex: number;
|
|
346
354
|
}>;
|
|
347
355
|
getTokenSupply(): Promise<AoTokenSupplyData>;
|
|
348
|
-
getEpochSettings(
|
|
356
|
+
getEpochSettings(): Promise<AoEpochSettings>;
|
|
349
357
|
getGateway({ address }: AoAddressParams): Promise<AoGateway | undefined>;
|
|
350
358
|
getGatewayDelegates({ address, ...pageParams }: AoAddressParams & PaginationParams<AoGatewayDelegateWithAddress>): Promise<PaginationResult<AoGatewayDelegateWithAddress>>;
|
|
351
359
|
getGatewayDelegateAllowList(params: AoPaginatedAddressParams): Promise<PaginationResult<WalletAddress>>;
|
|
@@ -389,7 +397,7 @@ export interface AoARIORead {
|
|
|
389
397
|
getPrimaryNameRequest(params: {
|
|
390
398
|
initiator: WalletAddress;
|
|
391
399
|
}): Promise<AoPrimaryNameRequest>;
|
|
392
|
-
getPrimaryNameRequests(params
|
|
400
|
+
getPrimaryNameRequests(params?: PaginationParams<AoPrimaryNameRequest>): Promise<PaginationResult<AoPrimaryNameRequest>>;
|
|
393
401
|
getPrimaryName(params: {
|
|
394
402
|
address: WalletAddress;
|
|
395
403
|
} | {
|
|
@@ -434,16 +442,14 @@ export interface AoARIOWrite extends AoARIORead {
|
|
|
434
442
|
failedGateways: WalletAddress[];
|
|
435
443
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
436
444
|
buyRecord(params: AoBuyRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
437
|
-
upgradeRecord(params:
|
|
445
|
+
upgradeRecord(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
438
446
|
extendLease(params: AoExtendLeaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
439
447
|
increaseUndernameLimit(params: AoIncreaseUndernameLimitParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
440
448
|
cancelWithdrawal(params: {
|
|
441
449
|
gatewayAddress?: WalletAddress;
|
|
442
450
|
vaultId: string;
|
|
443
451
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
444
|
-
requestPrimaryName(params:
|
|
445
|
-
name: string;
|
|
446
|
-
}): Promise<AoMessageResult>;
|
|
452
|
+
requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
447
453
|
redelegateStake(params: AoRedelegateStakeParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
448
454
|
}
|
|
449
455
|
export declare function isProcessConfiguration(config: object): config is {
|
|
@@ -1,23 +1,12 @@
|
|
|
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';
|
|
1
|
+
import { BlockHeight } from '../types/common.js';
|
|
18
2
|
import { PaginationParams } from '../types/io.js';
|
|
19
3
|
export declare const validateArweaveId: (id: string) => boolean;
|
|
20
4
|
export declare function isBlockHeight(height: string | number): height is BlockHeight;
|
|
5
|
+
/**
|
|
6
|
+
* Prune tags that are undefined or empty.
|
|
7
|
+
* @param tags - The tags to prune.
|
|
8
|
+
* @returns The pruned tags.
|
|
9
|
+
*/
|
|
21
10
|
export declare const pruneTags: (tags: {
|
|
22
11
|
name: string;
|
|
23
12
|
value: string | undefined;
|
|
@@ -25,7 +14,6 @@ export declare const pruneTags: (tags: {
|
|
|
25
14
|
name: string;
|
|
26
15
|
value: string;
|
|
27
16
|
}[];
|
|
28
|
-
export declare const getCurrentBlockUnixTimestampMs: (arweave: Arweave) => Promise<Timestamp>;
|
|
29
17
|
export declare const paginationParamsToTags: <T>(params?: PaginationParams<T>) => {
|
|
30
18
|
name: string;
|
|
31
19
|
value: string;
|
package/lib/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ar.io/sdk",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
3
|
+
"version": "3.1.0-alpha.11",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"@dha-team/arbundles": "^1.0.1",
|
|
128
128
|
"@permaweb/aoconnect": "^0.0.57",
|
|
129
129
|
"arweave": "1.14.4",
|
|
130
|
-
"axios": "1.7.
|
|
130
|
+
"axios": "1.7.9",
|
|
131
131
|
"axios-retry": "^4.3.0",
|
|
132
132
|
"commander": "^12.1.0",
|
|
133
133
|
"eventemitter3": "^5.0.1",
|