@ar.io/sdk 2.4.0-alpha.6 → 2.4.0-alpha.8
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 +40 -10
- package/bundles/web.bundle.min.js +2 -2
- package/lib/cjs/common/ant.js +23 -0
- package/lib/cjs/common/io.js +18 -8
- package/lib/cjs/types/ant.js +1 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +23 -0
- package/lib/esm/common/io.js +18 -8
- package/lib/esm/types/ant.js +1 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +16 -0
- package/lib/types/common/io.d.ts +11 -3
- package/lib/types/types/ant.d.ts +5 -0
- package/lib/types/types/io.d.ts +3 -3
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/common/ant.js
CHANGED
|
@@ -400,5 +400,28 @@ class AoANTWriteable extends AoANTReadable {
|
|
|
400
400
|
signer: this.signer,
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Sends a message to the IO contract to reassign the name to a new ANT. This can only be done by the current owner of the ANT.
|
|
405
|
+
* @param name @type {string} The name you want to reassign.
|
|
406
|
+
* @param ioProcessId @type {string} The processId of the IO contract.
|
|
407
|
+
* @param antProcessId @type {string} The processId of the ANT contract.
|
|
408
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
409
|
+
* @example
|
|
410
|
+
* ```ts
|
|
411
|
+
* ant.reassignName({ name: "ardrive", ioProcessId: IO_TESTNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
async reassignName({ name, ioProcessId, antProcessId, }, options) {
|
|
415
|
+
return this.process.send({
|
|
416
|
+
tags: [
|
|
417
|
+
...(options?.tags ?? []),
|
|
418
|
+
{ name: 'Action', value: 'Reassign-Name' },
|
|
419
|
+
{ name: 'Name', value: name },
|
|
420
|
+
{ name: 'IO-Process-Id', value: ioProcessId },
|
|
421
|
+
{ name: 'Process-Id', value: antProcessId },
|
|
422
|
+
],
|
|
423
|
+
signer: this.signer,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
403
426
|
}
|
|
404
427
|
exports.AoANTWriteable = AoANTWriteable;
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -575,16 +575,26 @@ class IOWriteable extends IOReadable {
|
|
|
575
575
|
],
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
|
-
|
|
578
|
+
/**
|
|
579
|
+
* Initiates an instant withdrawal from a gateway.
|
|
580
|
+
*
|
|
581
|
+
* @param {Object} params - The parameters for initiating an instant withdrawal
|
|
582
|
+
* @param {string} params.address - The gateway address of the withdrawal, if not provided, the signer's address will be used
|
|
583
|
+
* @param {string} params.vaultId - The vault ID of the withdrawal
|
|
584
|
+
* @returns {Promise<AoMessageResult>} The result of the withdrawal
|
|
585
|
+
*/
|
|
586
|
+
async instantWithdrawal(params, options) {
|
|
579
587
|
const { tags = [] } = options || {};
|
|
588
|
+
const allTags = [
|
|
589
|
+
...tags,
|
|
590
|
+
{ name: 'Action', value: 'Instant-Withdrawal' },
|
|
591
|
+
{ name: 'Vault-Id', value: params.vaultId },
|
|
592
|
+
{ name: 'Address', value: params.gatewayAddress },
|
|
593
|
+
];
|
|
594
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
580
595
|
return this.process.send({
|
|
581
596
|
signer: this.signer,
|
|
582
|
-
tags:
|
|
583
|
-
...tags,
|
|
584
|
-
{ name: 'Action', value: 'Decrease-Delegate-Stake' },
|
|
585
|
-
{ name: 'Target', value: params.target },
|
|
586
|
-
{ name: 'Vault-Id', value: params.vaultId },
|
|
587
|
-
],
|
|
597
|
+
tags: prunedTags,
|
|
588
598
|
});
|
|
589
599
|
}
|
|
590
600
|
async increaseOperatorStake(params, options) {
|
|
@@ -709,8 +719,8 @@ class IOWriteable extends IOReadable {
|
|
|
709
719
|
const allTags = [
|
|
710
720
|
...tags,
|
|
711
721
|
{ name: 'Action', value: 'Cancel-Withdrawal' },
|
|
712
|
-
{ name: 'Address', value: params.address },
|
|
713
722
|
{ name: 'Vault-Id', value: params.vaultId },
|
|
723
|
+
{ name: 'Address', value: params.gatewayAddress },
|
|
714
724
|
];
|
|
715
725
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
716
726
|
return this.process.send({
|
package/lib/cjs/types/ant.js
CHANGED
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/ant.js
CHANGED
|
@@ -395,4 +395,27 @@ export class AoANTWriteable extends AoANTReadable {
|
|
|
395
395
|
signer: this.signer,
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Sends a message to the IO contract to reassign the name to a new ANT. This can only be done by the current owner of the ANT.
|
|
400
|
+
* @param name @type {string} The name you want to reassign.
|
|
401
|
+
* @param ioProcessId @type {string} The processId of the IO contract.
|
|
402
|
+
* @param antProcessId @type {string} The processId of the ANT contract.
|
|
403
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
404
|
+
* @example
|
|
405
|
+
* ```ts
|
|
406
|
+
* ant.reassignName({ name: "ardrive", ioProcessId: IO_TESTNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
async reassignName({ name, ioProcessId, antProcessId, }, options) {
|
|
410
|
+
return this.process.send({
|
|
411
|
+
tags: [
|
|
412
|
+
...(options?.tags ?? []),
|
|
413
|
+
{ name: 'Action', value: 'Reassign-Name' },
|
|
414
|
+
{ name: 'Name', value: name },
|
|
415
|
+
{ name: 'IO-Process-Id', value: ioProcessId },
|
|
416
|
+
{ name: 'Process-Id', value: antProcessId },
|
|
417
|
+
],
|
|
418
|
+
signer: this.signer,
|
|
419
|
+
});
|
|
420
|
+
}
|
|
398
421
|
}
|
package/lib/esm/common/io.js
CHANGED
|
@@ -570,16 +570,26 @@ export class IOWriteable extends IOReadable {
|
|
|
570
570
|
],
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
|
-
|
|
573
|
+
/**
|
|
574
|
+
* Initiates an instant withdrawal from a gateway.
|
|
575
|
+
*
|
|
576
|
+
* @param {Object} params - The parameters for initiating an instant withdrawal
|
|
577
|
+
* @param {string} params.address - The gateway address of the withdrawal, if not provided, the signer's address will be used
|
|
578
|
+
* @param {string} params.vaultId - The vault ID of the withdrawal
|
|
579
|
+
* @returns {Promise<AoMessageResult>} The result of the withdrawal
|
|
580
|
+
*/
|
|
581
|
+
async instantWithdrawal(params, options) {
|
|
574
582
|
const { tags = [] } = options || {};
|
|
583
|
+
const allTags = [
|
|
584
|
+
...tags,
|
|
585
|
+
{ name: 'Action', value: 'Instant-Withdrawal' },
|
|
586
|
+
{ name: 'Vault-Id', value: params.vaultId },
|
|
587
|
+
{ name: 'Address', value: params.gatewayAddress },
|
|
588
|
+
];
|
|
589
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
575
590
|
return this.process.send({
|
|
576
591
|
signer: this.signer,
|
|
577
|
-
tags:
|
|
578
|
-
...tags,
|
|
579
|
-
{ name: 'Action', value: 'Decrease-Delegate-Stake' },
|
|
580
|
-
{ name: 'Target', value: params.target },
|
|
581
|
-
{ name: 'Vault-Id', value: params.vaultId },
|
|
582
|
-
],
|
|
592
|
+
tags: prunedTags,
|
|
583
593
|
});
|
|
584
594
|
}
|
|
585
595
|
async increaseOperatorStake(params, options) {
|
|
@@ -704,8 +714,8 @@ export class IOWriteable extends IOReadable {
|
|
|
704
714
|
const allTags = [
|
|
705
715
|
...tags,
|
|
706
716
|
{ name: 'Action', value: 'Cancel-Withdrawal' },
|
|
707
|
-
{ name: 'Address', value: params.address },
|
|
708
717
|
{ name: 'Vault-Id', value: params.vaultId },
|
|
718
|
+
{ name: 'Address', value: params.gatewayAddress },
|
|
709
719
|
];
|
|
710
720
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
711
721
|
return this.process.send({
|
package/lib/esm/types/ant.js
CHANGED
package/lib/esm/version.js
CHANGED
|
@@ -218,4 +218,20 @@ export declare class AoANTWriteable extends AoANTReadable implements AoANTWrite
|
|
|
218
218
|
name: string;
|
|
219
219
|
ioProcessId: string;
|
|
220
220
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
221
|
+
/**
|
|
222
|
+
* Sends a message to the IO contract to reassign the name to a new ANT. This can only be done by the current owner of the ANT.
|
|
223
|
+
* @param name @type {string} The name you want to reassign.
|
|
224
|
+
* @param ioProcessId @type {string} The processId of the IO contract.
|
|
225
|
+
* @param antProcessId @type {string} The processId of the ANT contract.
|
|
226
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* ant.reassignName({ name: "ardrive", ioProcessId: IO_TESTNET_PROCESS_ID, antProcessId: NEW_ANT_PROCESS_ID });
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
reassignName({ name, ioProcessId, antProcessId, }: {
|
|
233
|
+
name: string;
|
|
234
|
+
ioProcessId: string;
|
|
235
|
+
antProcessId: string;
|
|
236
|
+
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
221
237
|
}
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -138,8 +138,16 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
|
138
138
|
decreaseQty: number | mIOToken;
|
|
139
139
|
instant?: boolean;
|
|
140
140
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Initiates an instant withdrawal from a gateway.
|
|
143
|
+
*
|
|
144
|
+
* @param {Object} params - The parameters for initiating an instant withdrawal
|
|
145
|
+
* @param {string} params.address - The gateway address of the withdrawal, if not provided, the signer's address will be used
|
|
146
|
+
* @param {string} params.vaultId - The vault ID of the withdrawal
|
|
147
|
+
* @returns {Promise<AoMessageResult>} The result of the withdrawal
|
|
148
|
+
*/
|
|
149
|
+
instantWithdrawal(params: {
|
|
150
|
+
gatewayAddress?: string;
|
|
143
151
|
vaultId: string;
|
|
144
152
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
145
153
|
increaseOperatorStake(params: {
|
|
@@ -196,7 +204,7 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
|
196
204
|
* @returns {Promise<AoMessageResult>} The result of the cancellation
|
|
197
205
|
*/
|
|
198
206
|
cancelWithdrawal(params: {
|
|
199
|
-
|
|
207
|
+
gatewayAddress?: WalletAddress;
|
|
200
208
|
vaultId: string;
|
|
201
209
|
}, options?: WriteOptions | undefined): Promise<AoMessageResult>;
|
|
202
210
|
submitAuctionBid(params: {
|
package/lib/types/types/ant.d.ts
CHANGED
|
@@ -211,4 +211,9 @@ export interface AoANTWrite extends AoANTRead {
|
|
|
211
211
|
name: string;
|
|
212
212
|
ioProcessId: string;
|
|
213
213
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
214
|
+
reassignName({ name, ioProcessId, antProcessId, }: {
|
|
215
|
+
name: string;
|
|
216
|
+
ioProcessId: string;
|
|
217
|
+
antProcessId: string;
|
|
218
|
+
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
214
219
|
}
|
package/lib/types/types/io.d.ts
CHANGED
|
@@ -303,8 +303,8 @@ export interface AoIOWrite extends AoIORead {
|
|
|
303
303
|
decreaseQty: number | mIOToken;
|
|
304
304
|
instant?: boolean;
|
|
305
305
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
instantWithdrawal(params: {
|
|
307
|
+
gatewayAddress?: WalletAddress;
|
|
308
308
|
vaultId: string;
|
|
309
309
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
310
310
|
saveObservations(params: {
|
|
@@ -329,7 +329,7 @@ export interface AoIOWrite extends AoIORead {
|
|
|
329
329
|
increaseCount: number;
|
|
330
330
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
331
331
|
cancelWithdrawal(params: {
|
|
332
|
-
|
|
332
|
+
gatewayAddress?: WalletAddress;
|
|
333
333
|
vaultId: string;
|
|
334
334
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
335
335
|
submitAuctionBid(params: {
|
package/lib/types/version.d.ts
CHANGED