@ar.io/sdk 3.0.1-alpha.1 → 3.1.0-alpha.10
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/README.md +38 -0
- package/bundles/web.bundle.min.js +79 -79
- package/lib/cjs/cli/cli.js +27 -71
- 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 +17 -38
- package/lib/cjs/cli/commands/transfer.js +5 -1
- package/lib/cjs/cli/options.js +14 -7
- package/lib/cjs/cli/utils.js +59 -7
- package/lib/cjs/common/contracts/ao-process.js +41 -19
- package/lib/cjs/common/io.js +107 -101
- package/lib/cjs/types/io.js +6 -1
- package/lib/cjs/utils/arweave.js +22 -13
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +30 -74
- 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 +16 -38
- package/lib/esm/cli/commands/transfer.js +6 -2
- package/lib/esm/cli/options.js +13 -6
- package/lib/esm/cli/utils.js +53 -5
- package/lib/esm/common/contracts/ao-process.js +41 -19
- package/lib/esm/common/io.js +108 -102
- package/lib/esm/types/io.js +4 -0
- 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/commands/readCommands.d.ts +24 -2
- package/lib/types/cli/options.d.ts +5 -9
- package/lib/types/cli/types.d.ts +3 -5
- package/lib/types/cli/utils.d.ts +25 -4
- package/lib/types/common/contracts/ao-process.d.ts +3 -1
- package/lib/types/common/io.d.ts +15 -43
- package/lib/types/types/common.d.ts +1 -0
- package/lib/types/types/io.d.ts +46 -12
- 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/cli/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JWKInterface } from 'arweave/node/lib/wallet.js';
|
|
2
2
|
import { Command, OptionValues } from 'commander';
|
|
3
|
-
import { ARIOToken, AoANTRead, AoANTWrite, AoARIORead, AoARIOWrite, AoRedelegateStakeParams, AoSigner, AoUpdateGatewaySettingsParams, ContractSigner, EpochInput, Logger, PaginationParams, SpawnANTState, WriteOptions, mARIOToken } from '../node/index.js';
|
|
4
|
-
import { ANTStateCLIOptions, AddressCLIOptions, EpochCLIOptions, GlobalCLIOptions, InitiatorCLIOptions, JsonSerializable, PaginationCLIOptions, ProcessIdCLIOptions, RedelegateStakeCLIOptions, TransferCLIOptions, UpdateGatewaySettingsCLIOptions, WalletCLIOptions, WriteActionCLIOptions } from './types.js';
|
|
3
|
+
import { ARIOToken, AoANTRead, AoANTWrite, AoARIORead, AoARIOWrite, AoGetCostDetailsParams, AoRedelegateStakeParams, AoSigner, AoUpdateGatewaySettingsParams, ContractSigner, EpochInput, FundFrom, Logger, PaginationParams, SpawnANTState, WriteOptions, mARIOToken } from '../node/index.js';
|
|
4
|
+
import { ANTStateCLIOptions, AddressCLIOptions, EpochCLIOptions, GetTokenCostCLIOptions, GlobalCLIOptions, InitiatorCLIOptions, JsonSerializable, PaginationCLIOptions, ProcessIdCLIOptions, RedelegateStakeCLIOptions, TransferCLIOptions, UpdateGatewaySettingsCLIOptions, WalletCLIOptions, WriteActionCLIOptions } from './types.js';
|
|
5
5
|
export declare function stringifyJsonForCLIDisplay(json: JsonSerializable | unknown): string;
|
|
6
6
|
export declare function runCommand<O extends OptionValues>(command: Command, action: (options: O) => Promise<JsonSerializable>): Promise<void>;
|
|
7
7
|
export interface CommanderOption {
|
|
@@ -31,6 +31,7 @@ export declare function writeARIOFromOptions(options: GlobalCLIOptions): {
|
|
|
31
31
|
signerAddress: string;
|
|
32
32
|
};
|
|
33
33
|
export declare function formatARIOWithCommas(value: ARIOToken): string;
|
|
34
|
+
export declare function formatMARIOToARIOWithCommas(value: mARIOToken): string;
|
|
34
35
|
/** helper to get address from --address option first, then check wallet options */
|
|
35
36
|
export declare function addressFromOptions<O extends AddressCLIOptions>(options: O): string | undefined;
|
|
36
37
|
export declare function requiredAddressFromOptions<O extends AddressCLIOptions>(options: O): string;
|
|
@@ -51,8 +52,17 @@ export declare function redelegateParamsFromOptions(options: RedelegateStakeCLIO
|
|
|
51
52
|
export declare function recordTypeFromOptions<O extends {
|
|
52
53
|
type?: string;
|
|
53
54
|
}>(options: O): 'lease' | 'permabuy';
|
|
54
|
-
export declare function
|
|
55
|
-
export declare function
|
|
55
|
+
export declare function requiredMARIOFromOptions<O extends GlobalCLIOptions>(options: O, key: string): mARIOToken;
|
|
56
|
+
export declare function assertEnoughBalanceForArNSPurchase({ ario, address, costDetailsParams, }: {
|
|
57
|
+
ario: AoARIORead;
|
|
58
|
+
address: string;
|
|
59
|
+
costDetailsParams: AoGetCostDetailsParams;
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
export declare function assertEnoughMARIOBalance({ address, ario, mARIOQuantity, }: {
|
|
62
|
+
ario: AoARIORead;
|
|
63
|
+
address: string;
|
|
64
|
+
mARIOQuantity: mARIOToken | number;
|
|
65
|
+
}): Promise<void>;
|
|
56
66
|
export declare function confirmationPrompt(message: string): Promise<boolean>;
|
|
57
67
|
export declare function assertConfirmationPrompt<O extends {
|
|
58
68
|
skipConfirmation?: boolean;
|
|
@@ -65,3 +75,14 @@ export declare function requiredStringArrayFromOptions<O extends GlobalCLIOption
|
|
|
65
75
|
export declare function positiveIntegerFromOptions<O extends GlobalCLIOptions>(options: O, key: string): number | undefined;
|
|
66
76
|
export declare function requiredPositiveIntegerFromOptions<O extends GlobalCLIOptions>(options: O, key: string): number;
|
|
67
77
|
export declare function getANTStateFromOptions(options: ANTStateCLIOptions): SpawnANTState;
|
|
78
|
+
export declare function getTokenCostParamsFromOptions(o: GetTokenCostCLIOptions): {
|
|
79
|
+
type: "lease" | "permabuy";
|
|
80
|
+
quantity: number | undefined;
|
|
81
|
+
years: number;
|
|
82
|
+
intent: "Buy-Record" | "Extend-Lease" | "Increase-Undername-Limit" | "Upgrade-Name" | "Primary-Name-Request";
|
|
83
|
+
name: string;
|
|
84
|
+
fromAddress: string | undefined;
|
|
85
|
+
};
|
|
86
|
+
export declare function fundFromFromOptions<O extends {
|
|
87
|
+
fundFrom?: string;
|
|
88
|
+
}>(o: O): FundFrom;
|
|
@@ -9,12 +9,14 @@ export declare class AOProcess implements AOContract {
|
|
|
9
9
|
ao?: AoClient;
|
|
10
10
|
logger?: ILogger;
|
|
11
11
|
});
|
|
12
|
-
|
|
12
|
+
private isMessageDataEmpty;
|
|
13
|
+
read<K>({ tags, retries, fromAddress, }: {
|
|
13
14
|
tags?: Array<{
|
|
14
15
|
name: string;
|
|
15
16
|
value: string;
|
|
16
17
|
}>;
|
|
17
18
|
retries?: number;
|
|
19
|
+
fromAddress?: string;
|
|
18
20
|
}): Promise<K>;
|
|
19
21
|
send<K>({ tags, data, signer, retries, }: {
|
|
20
22
|
tags: Array<{
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
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 { 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, AoArNSReservedNameDataWithName, AoDelegation, AoEpochData, AoEpochSettings, AoGateway, AoGatewayDelegateWithAddress, AoGatewayRegistrySettings, AoGatewayVault, AoPaginatedAddressParams, AoRegistrationFees, AoVaultData, AoWalletVault, DemandFactorSettings, EpochInput } from '../types/io.js';
|
|
2
|
+
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';
|
|
19
3
|
import { mARIOToken } from '../types/token.js';
|
|
20
4
|
import { AOProcess } from './contracts/ao-process.js';
|
|
21
5
|
export declare class ARIO {
|
|
@@ -27,7 +11,7 @@ export declare class ARIO {
|
|
|
27
11
|
process: AOProcess;
|
|
28
12
|
}>): AoARIOWrite;
|
|
29
13
|
static init({ processId, signer, }: WithSigner<{
|
|
30
|
-
processId
|
|
14
|
+
processId?: string;
|
|
31
15
|
}>): AoARIOWrite;
|
|
32
16
|
static init({ processId, signer, }: {
|
|
33
17
|
signer?: ContractSigner | undefined;
|
|
@@ -39,8 +23,8 @@ export declare class ARIO {
|
|
|
39
23
|
}
|
|
40
24
|
export declare class ARIOReadable implements AoARIORead {
|
|
41
25
|
protected process: AOProcess;
|
|
42
|
-
|
|
43
|
-
constructor(config?: ProcessConfiguration
|
|
26
|
+
protected epochSettings: AoEpochSettings | undefined;
|
|
27
|
+
constructor(config?: ProcessConfiguration);
|
|
44
28
|
getInfo(): Promise<{
|
|
45
29
|
Name: string;
|
|
46
30
|
Ticker: string;
|
|
@@ -50,7 +34,9 @@ export declare class ARIOReadable implements AoARIORead {
|
|
|
50
34
|
LastTickedEpochIndex: number;
|
|
51
35
|
}>;
|
|
52
36
|
getTokenSupply(): Promise<AoTokenSupplyData>;
|
|
53
|
-
|
|
37
|
+
private computeEpochIndexForTimestamp;
|
|
38
|
+
private computeEpochIndex;
|
|
39
|
+
getEpochSettings(): Promise<AoEpochSettings>;
|
|
54
40
|
getEpoch(epoch?: EpochInput): Promise<AoEpochData>;
|
|
55
41
|
getArNSRecord({ name, }: {
|
|
56
42
|
name: string;
|
|
@@ -67,7 +53,7 @@ export declare class ARIOReadable implements AoARIORead {
|
|
|
67
53
|
getVault({ address, vaultId, }: {
|
|
68
54
|
address: WalletAddress;
|
|
69
55
|
vaultId: string;
|
|
70
|
-
}): Promise<AoVaultData>;
|
|
56
|
+
}): Promise<AoVaultData | undefined>;
|
|
71
57
|
getVaults(params?: PaginationParams<AoWalletVault>): Promise<PaginationResult<AoWalletVault>>;
|
|
72
58
|
getGateway({ address, }: {
|
|
73
59
|
address: WalletAddress;
|
|
@@ -107,6 +93,7 @@ export declare class ARIOReadable implements AoARIORead {
|
|
|
107
93
|
intent: 'Primary-Name-Request';
|
|
108
94
|
name: string;
|
|
109
95
|
}): Promise<number>;
|
|
96
|
+
getCostDetails({ intent, type, years, name, quantity, fromAddress, fundFrom, }: AoGetCostDetailsParams): Promise<CostDetailsResult>;
|
|
110
97
|
getRegistrationFees(): Promise<AoRegistrationFees>;
|
|
111
98
|
getDemandFactor(): Promise<number>;
|
|
112
99
|
getDemandFactorSettings(): Promise<DemandFactorSettings>;
|
|
@@ -124,7 +111,7 @@ export declare class ARIOReadable implements AoARIORead {
|
|
|
124
111
|
getPrimaryNameRequest(params: {
|
|
125
112
|
initiator: WalletAddress;
|
|
126
113
|
}): Promise<AoPrimaryNameRequest>;
|
|
127
|
-
getPrimaryNameRequests(params
|
|
114
|
+
getPrimaryNameRequests(params?: PaginationParams<AoPrimaryNameRequest>): Promise<PaginationResult<AoPrimaryNameRequest>>;
|
|
128
115
|
getPrimaryName(params: {
|
|
129
116
|
address: WalletAddress;
|
|
130
117
|
} | {
|
|
@@ -190,12 +177,7 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
190
177
|
reportTxId: TransactionId;
|
|
191
178
|
failedGateways: WalletAddress[];
|
|
192
179
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
193
|
-
buyRecord(params:
|
|
194
|
-
name: string;
|
|
195
|
-
years?: number;
|
|
196
|
-
type: 'lease' | 'permabuy';
|
|
197
|
-
processId: string;
|
|
198
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
180
|
+
buyRecord(params: AoBuyRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
199
181
|
/**
|
|
200
182
|
* Upgrades an existing leased record to a permabuy.
|
|
201
183
|
*
|
|
@@ -204,9 +186,7 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
204
186
|
* @param {Object} [options] - The options for the upgrade
|
|
205
187
|
* @returns {Promise<AoMessageResult>} The result of the upgrade
|
|
206
188
|
*/
|
|
207
|
-
upgradeRecord(params:
|
|
208
|
-
name: string;
|
|
209
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
189
|
+
upgradeRecord(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
210
190
|
/**
|
|
211
191
|
* Extends the lease of an existing leased record.
|
|
212
192
|
*
|
|
@@ -216,14 +196,8 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
216
196
|
* @param {Object} [options] - The options for the extension
|
|
217
197
|
* @returns {Promise<AoMessageResult>} The result of the extension
|
|
218
198
|
*/
|
|
219
|
-
extendLease(params:
|
|
220
|
-
|
|
221
|
-
years: number;
|
|
222
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
223
|
-
increaseUndernameLimit(params: {
|
|
224
|
-
name: string;
|
|
225
|
-
increaseCount: number;
|
|
226
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
199
|
+
extendLease(params: AoExtendLeaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
200
|
+
increaseUndernameLimit(params: AoIncreaseUndernameLimitParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
227
201
|
/**
|
|
228
202
|
* Cancel a withdrawal from a gateway.
|
|
229
203
|
*
|
|
@@ -237,9 +211,7 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
237
211
|
gatewayAddress?: WalletAddress;
|
|
238
212
|
vaultId: string;
|
|
239
213
|
}, options?: WriteOptions | undefined): Promise<AoMessageResult>;
|
|
240
|
-
requestPrimaryName(params:
|
|
241
|
-
name: string;
|
|
242
|
-
}): Promise<AoMessageResult>;
|
|
214
|
+
requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
243
215
|
/**
|
|
244
216
|
* Redelegate stake from one gateway to another gateway.
|
|
245
217
|
*
|
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;
|
|
@@ -252,30 +257,60 @@ export type AoRedelegateStakeParams = {
|
|
|
252
257
|
stakeQty: number | mARIOToken;
|
|
253
258
|
vaultId?: string;
|
|
254
259
|
};
|
|
255
|
-
export declare const validIntents:
|
|
256
|
-
export declare const intentsUsingYears:
|
|
260
|
+
export declare const validIntents: readonly ["Buy-Record", "Extend-Lease", "Increase-Undername-Limit", "Upgrade-Name", "Primary-Name-Request"];
|
|
261
|
+
export declare const intentsUsingYears: readonly ["Buy-Record", "Extend-Lease"];
|
|
257
262
|
export type Intent = (typeof validIntents)[number];
|
|
258
|
-
export declare const isValidIntent: (intent: string) => intent is
|
|
263
|
+
export declare const isValidIntent: (intent: string) => intent is "Buy-Record" | "Extend-Lease" | "Increase-Undername-Limit" | "Upgrade-Name" | "Primary-Name-Request";
|
|
259
264
|
export type AoTokenCostParams = {
|
|
260
265
|
intent: Intent;
|
|
261
266
|
type?: 'permabuy' | 'lease';
|
|
262
267
|
years?: number;
|
|
263
268
|
name: string;
|
|
264
269
|
quantity?: number;
|
|
270
|
+
fromAddress?: WalletAddress;
|
|
271
|
+
};
|
|
272
|
+
export declare const fundFromOptions: readonly ["balance", "stakes", "any"];
|
|
273
|
+
export type FundFrom = (typeof fundFromOptions)[number];
|
|
274
|
+
export declare const isValidFundFrom: (fundFrom: string) => fundFrom is "balance" | "stakes" | "any";
|
|
275
|
+
export type AoGetCostDetailsParams = AoTokenCostParams & {
|
|
276
|
+
fundFrom?: FundFrom;
|
|
277
|
+
};
|
|
278
|
+
export type AoFundingPlan = {
|
|
279
|
+
address: WalletAddress;
|
|
280
|
+
balance: number;
|
|
281
|
+
stakes: Record<WalletAddress, {
|
|
282
|
+
vaults: string[];
|
|
283
|
+
delegatedStake: number;
|
|
284
|
+
}>;
|
|
285
|
+
/** Any remaining shortfall will indicate an insufficient balance for the action */
|
|
286
|
+
shortfall: number;
|
|
287
|
+
};
|
|
288
|
+
export type CostDiscount = {
|
|
289
|
+
name: string;
|
|
290
|
+
discountTotal: number;
|
|
291
|
+
multiplier: number;
|
|
292
|
+
};
|
|
293
|
+
export type CostDetailsResult = {
|
|
294
|
+
tokenCost: number;
|
|
295
|
+
discounts: CostDiscount[];
|
|
296
|
+
fundingPlan?: AoFundingPlan;
|
|
265
297
|
};
|
|
266
298
|
export type AoGetVaultParams = {
|
|
267
299
|
address: WalletAddress;
|
|
268
300
|
vaultId: string;
|
|
269
301
|
};
|
|
270
|
-
export type
|
|
302
|
+
export type AoArNSPurchaseParams = AoArNSNameParams & {
|
|
303
|
+
fundFrom?: FundFrom;
|
|
304
|
+
};
|
|
305
|
+
export type AoBuyRecordParams = AoArNSPurchaseParams & {
|
|
271
306
|
years?: number;
|
|
272
307
|
type: 'lease' | 'permabuy';
|
|
273
308
|
processId: string;
|
|
274
309
|
};
|
|
275
|
-
export type AoExtendLeaseParams =
|
|
310
|
+
export type AoExtendLeaseParams = AoArNSPurchaseParams & {
|
|
276
311
|
years: number;
|
|
277
312
|
};
|
|
278
|
-
export type AoIncreaseUndernameLimitParams =
|
|
313
|
+
export type AoIncreaseUndernameLimitParams = AoArNSPurchaseParams & {
|
|
279
314
|
increaseCount: number;
|
|
280
315
|
};
|
|
281
316
|
export type AoGatewayRegistrySettings = {
|
|
@@ -318,7 +353,7 @@ export interface AoARIORead {
|
|
|
318
353
|
LastTickedEpochIndex: number;
|
|
319
354
|
}>;
|
|
320
355
|
getTokenSupply(): Promise<AoTokenSupplyData>;
|
|
321
|
-
getEpochSettings(
|
|
356
|
+
getEpochSettings(): Promise<AoEpochSettings>;
|
|
322
357
|
getGateway({ address }: AoAddressParams): Promise<AoGateway | undefined>;
|
|
323
358
|
getGatewayDelegates({ address, ...pageParams }: AoAddressParams & PaginationParams<AoGatewayDelegateWithAddress>): Promise<PaginationResult<AoGatewayDelegateWithAddress>>;
|
|
324
359
|
getGatewayDelegateAllowList(params: AoPaginatedAddressParams): Promise<PaginationResult<WalletAddress>>;
|
|
@@ -353,6 +388,7 @@ export interface AoARIORead {
|
|
|
353
388
|
getObservations(epoch?: EpochInput): Promise<AoEpochObservationData>;
|
|
354
389
|
getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData>;
|
|
355
390
|
getTokenCost({ intent, type, years, name, quantity, }: AoTokenCostParams): Promise<number>;
|
|
391
|
+
getCostDetails({ intent, type, years, name, quantity, fundFrom, }: AoGetCostDetailsParams): Promise<CostDetailsResult>;
|
|
356
392
|
getRegistrationFees(): Promise<AoRegistrationFees>;
|
|
357
393
|
getDemandFactor(): Promise<number>;
|
|
358
394
|
getDemandFactorSettings(): Promise<DemandFactorSettings>;
|
|
@@ -361,7 +397,7 @@ export interface AoARIORead {
|
|
|
361
397
|
getPrimaryNameRequest(params: {
|
|
362
398
|
initiator: WalletAddress;
|
|
363
399
|
}): Promise<AoPrimaryNameRequest>;
|
|
364
|
-
getPrimaryNameRequests(params
|
|
400
|
+
getPrimaryNameRequests(params?: PaginationParams<AoPrimaryNameRequest>): Promise<PaginationResult<AoPrimaryNameRequest>>;
|
|
365
401
|
getPrimaryName(params: {
|
|
366
402
|
address: WalletAddress;
|
|
367
403
|
} | {
|
|
@@ -406,16 +442,14 @@ export interface AoARIOWrite extends AoARIORead {
|
|
|
406
442
|
failedGateways: WalletAddress[];
|
|
407
443
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
408
444
|
buyRecord(params: AoBuyRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
409
|
-
upgradeRecord(params:
|
|
445
|
+
upgradeRecord(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
410
446
|
extendLease(params: AoExtendLeaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
411
447
|
increaseUndernameLimit(params: AoIncreaseUndernameLimitParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
412
448
|
cancelWithdrawal(params: {
|
|
413
449
|
gatewayAddress?: WalletAddress;
|
|
414
450
|
vaultId: string;
|
|
415
451
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
416
|
-
requestPrimaryName(params:
|
|
417
|
-
name: string;
|
|
418
|
-
}): Promise<AoMessageResult>;
|
|
452
|
+
requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
419
453
|
redelegateStake(params: AoRedelegateStakeParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
420
454
|
}
|
|
421
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.0
|
|
3
|
+
"version": "3.1.0-alpha.10",
|
|
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",
|