@ar.io/sdk 3.1.0-alpha.1 → 3.1.0-alpha.2
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 +60 -60
- 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/io.js +32 -22
- 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/io.js +32 -22
- 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/io.d.ts +6 -21
- package/lib/types/types/io.d.ts +8 -7
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/types/cli/types.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { AoAddressParams, AoArNSNameParams,
|
|
16
|
+
import { AoAddressParams, AoArNSNameParams, AoGetVaultParams, AoJoinNetworkParams, AoTokenCostParams, PaginationParams } from '../types/io.js';
|
|
17
17
|
export type WalletCLIOptions = {
|
|
18
18
|
walletFile?: string;
|
|
19
19
|
privateKey?: string;
|
|
@@ -47,6 +47,8 @@ export type ProcessIdWriteActionCLIOptions = WriteActionCLIOptions & {
|
|
|
47
47
|
export type CLIOptionsFromAoParams<T> = {
|
|
48
48
|
[K in keyof T]?: T[K] extends number | undefined ? string | undefined : T[K] extends string | boolean | symbol ? string : T[K] extends ReadonlyArray<infer U> ? ReadonlyArray<U> : T[K] extends object ? CLIOptionsFromAoParams<T[K]> : T[K];
|
|
49
49
|
};
|
|
50
|
+
export type CLIReadOptionsFromAoParams<T> = CLIOptionsFromAoParams<T> & GlobalCLIOptions;
|
|
51
|
+
export type CLIWriteOptionsFromAoParams<T> = WriteActionCLIOptions & CLIOptionsFromAoParams<T>;
|
|
50
52
|
export type PaginationCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<PaginationParams>;
|
|
51
53
|
export type AddressCLIOptions = GlobalCLIOptions & CLIOptionsFromAoParams<AoAddressParams>;
|
|
52
54
|
export type ProcessIdCLIOptions = GlobalCLIOptions & {
|
|
@@ -86,10 +88,6 @@ export type OperatorStakeCLIOptions = WriteActionCLIOptions & {
|
|
|
86
88
|
export type DecreaseDelegateStakeCLIOptions = DelegateStakeCLIOptions & {
|
|
87
89
|
instant: boolean;
|
|
88
90
|
};
|
|
89
|
-
export type BuyRecordCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoBuyRecordParams>;
|
|
90
|
-
export type UpgradeRecordCLIOptions = NameWriteCLIOptions;
|
|
91
|
-
export type ExtendLeaseCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoExtendLeaseParams>;
|
|
92
|
-
export type IncreaseUndernameLimitCLIOptions = WriteActionCLIOptions & CLIOptionsFromAoParams<AoIncreaseUndernameLimitParams>;
|
|
93
91
|
export type ANTStateCLIOptions = WriteActionCLIOptions & {
|
|
94
92
|
target?: string;
|
|
95
93
|
keywords?: string[];
|
package/lib/types/cli/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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';
|
|
3
|
+
import { ARIOToken, AoANTRead, AoANTWrite, AoARIORead, AoARIOWrite, AoGetCostDetailsParams, AoRedelegateStakeParams, AoSigner, AoUpdateGatewaySettingsParams, ContractSigner, EpochInput, FundFrom, Logger, PaginationParams, SpawnANTState, WriteOptions, mARIOToken } from '../node/index.js';
|
|
4
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>;
|
|
@@ -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;
|
|
@@ -73,3 +83,6 @@ export declare function getTokenCostParamsFromOptions(o: GetTokenCostCLIOptions)
|
|
|
73
83
|
name: string;
|
|
74
84
|
fromAddress: string | undefined;
|
|
75
85
|
};
|
|
86
|
+
export declare function fundFromFromOptions<O extends {
|
|
87
|
+
fundFrom?: string;
|
|
88
|
+
}>(o: O): FundFrom;
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -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, 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, AoGetCostDetailsParams, AoPaginatedAddressParams, AoRegistrationFees, AoVaultData, AoWalletVault, CostDetailsResult, DemandFactorSettings, EpochInput } from '../types/io.js';
|
|
18
|
+
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
19
|
import { mARIOToken } from '../types/token.js';
|
|
20
20
|
import { AOProcess } from './contracts/ao-process.js';
|
|
21
21
|
export declare class ARIO {
|
|
@@ -191,12 +191,7 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
191
191
|
reportTxId: TransactionId;
|
|
192
192
|
failedGateways: WalletAddress[];
|
|
193
193
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
194
|
-
buyRecord(params:
|
|
195
|
-
name: string;
|
|
196
|
-
years?: number;
|
|
197
|
-
type: 'lease' | 'permabuy';
|
|
198
|
-
processId: string;
|
|
199
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
194
|
+
buyRecord(params: AoBuyRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
200
195
|
/**
|
|
201
196
|
* Upgrades an existing leased record to a permabuy.
|
|
202
197
|
*
|
|
@@ -205,9 +200,7 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
205
200
|
* @param {Object} [options] - The options for the upgrade
|
|
206
201
|
* @returns {Promise<AoMessageResult>} The result of the upgrade
|
|
207
202
|
*/
|
|
208
|
-
upgradeRecord(params:
|
|
209
|
-
name: string;
|
|
210
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
203
|
+
upgradeRecord(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
211
204
|
/**
|
|
212
205
|
* Extends the lease of an existing leased record.
|
|
213
206
|
*
|
|
@@ -217,14 +210,8 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
217
210
|
* @param {Object} [options] - The options for the extension
|
|
218
211
|
* @returns {Promise<AoMessageResult>} The result of the extension
|
|
219
212
|
*/
|
|
220
|
-
extendLease(params:
|
|
221
|
-
|
|
222
|
-
years: number;
|
|
223
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
224
|
-
increaseUndernameLimit(params: {
|
|
225
|
-
name: string;
|
|
226
|
-
increaseCount: number;
|
|
227
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
213
|
+
extendLease(params: AoExtendLeaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
214
|
+
increaseUndernameLimit(params: AoIncreaseUndernameLimitParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
228
215
|
/**
|
|
229
216
|
* Cancel a withdrawal from a gateway.
|
|
230
217
|
*
|
|
@@ -238,9 +225,7 @@ export declare class ARIOWriteable extends ARIOReadable implements AoARIOWrite {
|
|
|
238
225
|
gatewayAddress?: WalletAddress;
|
|
239
226
|
vaultId: string;
|
|
240
227
|
}, options?: WriteOptions | undefined): Promise<AoMessageResult>;
|
|
241
|
-
requestPrimaryName(params:
|
|
242
|
-
name: string;
|
|
243
|
-
}): Promise<AoMessageResult>;
|
|
228
|
+
requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
244
229
|
/**
|
|
245
230
|
* Redelegate stake from one gateway to another gateway.
|
|
246
231
|
*
|
package/lib/types/types/io.d.ts
CHANGED
|
@@ -294,15 +294,18 @@ export type AoGetVaultParams = {
|
|
|
294
294
|
address: WalletAddress;
|
|
295
295
|
vaultId: string;
|
|
296
296
|
};
|
|
297
|
-
export type
|
|
297
|
+
export type AoArNSPurchaseParams = AoArNSNameParams & {
|
|
298
|
+
fundFrom?: FundFrom;
|
|
299
|
+
};
|
|
300
|
+
export type AoBuyRecordParams = AoArNSPurchaseParams & {
|
|
298
301
|
years?: number;
|
|
299
302
|
type: 'lease' | 'permabuy';
|
|
300
303
|
processId: string;
|
|
301
304
|
};
|
|
302
|
-
export type AoExtendLeaseParams =
|
|
305
|
+
export type AoExtendLeaseParams = AoArNSPurchaseParams & {
|
|
303
306
|
years: number;
|
|
304
307
|
};
|
|
305
|
-
export type AoIncreaseUndernameLimitParams =
|
|
308
|
+
export type AoIncreaseUndernameLimitParams = AoArNSPurchaseParams & {
|
|
306
309
|
increaseCount: number;
|
|
307
310
|
};
|
|
308
311
|
export type AoGatewayRegistrySettings = {
|
|
@@ -434,16 +437,14 @@ export interface AoARIOWrite extends AoARIORead {
|
|
|
434
437
|
failedGateways: WalletAddress[];
|
|
435
438
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
436
439
|
buyRecord(params: AoBuyRecordParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
437
|
-
upgradeRecord(params:
|
|
440
|
+
upgradeRecord(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
438
441
|
extendLease(params: AoExtendLeaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
439
442
|
increaseUndernameLimit(params: AoIncreaseUndernameLimitParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
440
443
|
cancelWithdrawal(params: {
|
|
441
444
|
gatewayAddress?: WalletAddress;
|
|
442
445
|
vaultId: string;
|
|
443
446
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
444
|
-
requestPrimaryName(params:
|
|
445
|
-
name: string;
|
|
446
|
-
}): Promise<AoMessageResult>;
|
|
447
|
+
requestPrimaryName(params: AoArNSPurchaseParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
447
448
|
redelegateStake(params: AoRedelegateStakeParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
448
449
|
}
|
|
449
450
|
export declare function isProcessConfiguration(config: object): config is {
|
package/lib/types/version.d.ts
CHANGED