@ar.io/sdk 2.4.0-alpha.5 → 2.4.0-alpha.7
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 +25 -10
- package/bundles/web.bundle.min.js +52 -52
- package/lib/cjs/common/io.js +46 -8
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/io.js +46 -8
- package/lib/esm/version.js +1 -1
- package/lib/types/common/io.d.ts +31 -3
- package/lib/types/types/io.d.ts +6 -3
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
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) {
|
|
@@ -643,6 +653,34 @@ class IOWriteable extends IOReadable {
|
|
|
643
653
|
tags: prunedTags,
|
|
644
654
|
});
|
|
645
655
|
}
|
|
656
|
+
/**
|
|
657
|
+
* Upgrades an existing leased record to a permabuy.
|
|
658
|
+
*
|
|
659
|
+
* @param {Object} params - The parameters for upgrading a record
|
|
660
|
+
* @param {string} params.name - The name of the record to upgrade
|
|
661
|
+
* @param {Object} [options] - The options for the upgrade
|
|
662
|
+
* @returns {Promise<AoMessageResult>} The result of the upgrade
|
|
663
|
+
*/
|
|
664
|
+
async upgradeRecord(params, options) {
|
|
665
|
+
const { tags = [] } = options || {};
|
|
666
|
+
return this.process.send({
|
|
667
|
+
signer: this.signer,
|
|
668
|
+
tags: [
|
|
669
|
+
...tags,
|
|
670
|
+
{ name: 'Action', value: 'Upgrade-Name' }, // TODO: align on Update-Record vs. Upgrade-Name (contract currently uses Upgrade-Name)
|
|
671
|
+
{ name: 'Name', value: params.name },
|
|
672
|
+
],
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Extends the lease of an existing leased record.
|
|
677
|
+
*
|
|
678
|
+
* @param {Object} params - The parameters for extending a lease
|
|
679
|
+
* @param {string} params.name - The name of the record to extend
|
|
680
|
+
* @param {number} params.years - The number of years to extend the lease
|
|
681
|
+
* @param {Object} [options] - The options for the extension
|
|
682
|
+
* @returns {Promise<AoMessageResult>} The result of the extension
|
|
683
|
+
*/
|
|
646
684
|
async extendLease(params, options) {
|
|
647
685
|
const { tags = [] } = options || {};
|
|
648
686
|
return this.process.send({
|
|
@@ -681,8 +719,8 @@ class IOWriteable extends IOReadable {
|
|
|
681
719
|
const allTags = [
|
|
682
720
|
...tags,
|
|
683
721
|
{ name: 'Action', value: 'Cancel-Withdrawal' },
|
|
684
|
-
{ name: 'Address', value: params.address },
|
|
685
722
|
{ name: 'Vault-Id', value: params.vaultId },
|
|
723
|
+
{ name: 'Address', value: params.gatewayAddress },
|
|
686
724
|
];
|
|
687
725
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
688
726
|
return this.process.send({
|
package/lib/cjs/version.js
CHANGED
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) {
|
|
@@ -638,6 +648,34 @@ export class IOWriteable extends IOReadable {
|
|
|
638
648
|
tags: prunedTags,
|
|
639
649
|
});
|
|
640
650
|
}
|
|
651
|
+
/**
|
|
652
|
+
* Upgrades an existing leased record to a permabuy.
|
|
653
|
+
*
|
|
654
|
+
* @param {Object} params - The parameters for upgrading a record
|
|
655
|
+
* @param {string} params.name - The name of the record to upgrade
|
|
656
|
+
* @param {Object} [options] - The options for the upgrade
|
|
657
|
+
* @returns {Promise<AoMessageResult>} The result of the upgrade
|
|
658
|
+
*/
|
|
659
|
+
async upgradeRecord(params, options) {
|
|
660
|
+
const { tags = [] } = options || {};
|
|
661
|
+
return this.process.send({
|
|
662
|
+
signer: this.signer,
|
|
663
|
+
tags: [
|
|
664
|
+
...tags,
|
|
665
|
+
{ name: 'Action', value: 'Upgrade-Name' }, // TODO: align on Update-Record vs. Upgrade-Name (contract currently uses Upgrade-Name)
|
|
666
|
+
{ name: 'Name', value: params.name },
|
|
667
|
+
],
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Extends the lease of an existing leased record.
|
|
672
|
+
*
|
|
673
|
+
* @param {Object} params - The parameters for extending a lease
|
|
674
|
+
* @param {string} params.name - The name of the record to extend
|
|
675
|
+
* @param {number} params.years - The number of years to extend the lease
|
|
676
|
+
* @param {Object} [options] - The options for the extension
|
|
677
|
+
* @returns {Promise<AoMessageResult>} The result of the extension
|
|
678
|
+
*/
|
|
641
679
|
async extendLease(params, options) {
|
|
642
680
|
const { tags = [] } = options || {};
|
|
643
681
|
return this.process.send({
|
|
@@ -676,8 +714,8 @@ export class IOWriteable extends IOReadable {
|
|
|
676
714
|
const allTags = [
|
|
677
715
|
...tags,
|
|
678
716
|
{ name: 'Action', value: 'Cancel-Withdrawal' },
|
|
679
|
-
{ name: 'Address', value: params.address },
|
|
680
717
|
{ name: 'Vault-Id', value: params.vaultId },
|
|
718
|
+
{ name: 'Address', value: params.gatewayAddress },
|
|
681
719
|
];
|
|
682
720
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
683
721
|
return this.process.send({
|
package/lib/esm/version.js
CHANGED
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: {
|
|
@@ -158,6 +166,26 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
|
158
166
|
type: 'lease' | 'permabuy';
|
|
159
167
|
processId: string;
|
|
160
168
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
169
|
+
/**
|
|
170
|
+
* Upgrades an existing leased record to a permabuy.
|
|
171
|
+
*
|
|
172
|
+
* @param {Object} params - The parameters for upgrading a record
|
|
173
|
+
* @param {string} params.name - The name of the record to upgrade
|
|
174
|
+
* @param {Object} [options] - The options for the upgrade
|
|
175
|
+
* @returns {Promise<AoMessageResult>} The result of the upgrade
|
|
176
|
+
*/
|
|
177
|
+
upgradeRecord(params: {
|
|
178
|
+
name: string;
|
|
179
|
+
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
180
|
+
/**
|
|
181
|
+
* Extends the lease of an existing leased record.
|
|
182
|
+
*
|
|
183
|
+
* @param {Object} params - The parameters for extending a lease
|
|
184
|
+
* @param {string} params.name - The name of the record to extend
|
|
185
|
+
* @param {number} params.years - The number of years to extend the lease
|
|
186
|
+
* @param {Object} [options] - The options for the extension
|
|
187
|
+
* @returns {Promise<AoMessageResult>} The result of the extension
|
|
188
|
+
*/
|
|
161
189
|
extendLease(params: {
|
|
162
190
|
name: string;
|
|
163
191
|
years: number;
|
|
@@ -176,7 +204,7 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
|
176
204
|
* @returns {Promise<AoMessageResult>} The result of the cancellation
|
|
177
205
|
*/
|
|
178
206
|
cancelWithdrawal(params: {
|
|
179
|
-
|
|
207
|
+
gatewayAddress?: WalletAddress;
|
|
180
208
|
vaultId: string;
|
|
181
209
|
}, options?: WriteOptions | undefined): Promise<AoMessageResult>;
|
|
182
210
|
submitAuctionBid(params: {
|
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: {
|
|
@@ -317,6 +317,9 @@ export interface AoIOWrite extends AoIORead {
|
|
|
317
317
|
type: 'lease' | 'permabuy';
|
|
318
318
|
processId: string;
|
|
319
319
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
320
|
+
upgradeRecord(params: {
|
|
321
|
+
name: string;
|
|
322
|
+
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
320
323
|
extendLease(params: {
|
|
321
324
|
name: string;
|
|
322
325
|
years: number;
|
|
@@ -326,7 +329,7 @@ export interface AoIOWrite extends AoIORead {
|
|
|
326
329
|
increaseCount: number;
|
|
327
330
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
328
331
|
cancelWithdrawal(params: {
|
|
329
|
-
|
|
332
|
+
gatewayAddress?: WalletAddress;
|
|
330
333
|
vaultId: string;
|
|
331
334
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
332
335
|
submitAuctionBid(params: {
|
package/lib/types/version.d.ts
CHANGED