@ar.io/sdk 1.2.0-alpha.11 → 1.2.0-alpha.13
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 +2 -2
- package/lib/cjs/common/ant-ao.js +11 -4
- package/lib/cjs/common/contracts/ao-process.js +5 -5
- package/lib/cjs/common/io.js +43 -43
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant-ao.js +11 -4
- package/lib/esm/common/contracts/ao-process.js +5 -5
- package/lib/esm/common/io.js +43 -43
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant-ao.d.ts +2 -1
- package/lib/types/common/io.d.ts +3 -3
- package/lib/types/io.d.ts +13 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/esm/common/io.js
CHANGED
|
@@ -66,11 +66,11 @@ export class IOReadable {
|
|
|
66
66
|
value: epoch.timestamp?.toString() ?? '',
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
name: '
|
|
69
|
+
name: 'Block-Height',
|
|
70
70
|
value: epoch?.blockHeight?.toString(),
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
name: '
|
|
73
|
+
name: 'Epoch-Index',
|
|
74
74
|
value: epoch?.epochIndex?.toString(),
|
|
75
75
|
},
|
|
76
76
|
];
|
|
@@ -101,13 +101,13 @@ export class IOReadable {
|
|
|
101
101
|
}
|
|
102
102
|
async getArNSReservedNames() {
|
|
103
103
|
return this.process.read({
|
|
104
|
-
tags: [{ name: 'Action', value: '
|
|
104
|
+
tags: [{ name: 'Action', value: 'Reserved-Names' }],
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
async getArNSReservedName({ name, }) {
|
|
108
108
|
return this.process.read({
|
|
109
109
|
tags: [
|
|
110
|
-
{ name: 'Action', value: '
|
|
110
|
+
{ name: 'Action', value: 'Reserved-Name' },
|
|
111
111
|
{ name: 'Name', value: name },
|
|
112
112
|
],
|
|
113
113
|
});
|
|
@@ -148,17 +148,17 @@ export class IOReadable {
|
|
|
148
148
|
}
|
|
149
149
|
async getPrescribedObservers(epoch) {
|
|
150
150
|
const allTags = [
|
|
151
|
-
{ name: 'Action', value: '
|
|
151
|
+
{ name: 'Action', value: 'Epoch-Prescribed-Observers' },
|
|
152
152
|
{
|
|
153
153
|
name: 'Timestamp',
|
|
154
154
|
value: epoch.timestamp?.toString(),
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
|
-
name: '
|
|
157
|
+
name: 'Block-Height',
|
|
158
158
|
value: epoch?.blockHeight?.toString(),
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
|
-
name: '
|
|
161
|
+
name: 'Epoch-Index',
|
|
162
162
|
value: epoch?.epochIndex?.toString(),
|
|
163
163
|
},
|
|
164
164
|
];
|
|
@@ -176,17 +176,17 @@ export class IOReadable {
|
|
|
176
176
|
}
|
|
177
177
|
async getPrescribedNames(epoch) {
|
|
178
178
|
const allTags = [
|
|
179
|
-
{ name: 'Action', value: '
|
|
179
|
+
{ name: 'Action', value: 'Epoch-Prescribed-Names' },
|
|
180
180
|
{
|
|
181
181
|
name: 'Timestamp',
|
|
182
182
|
value: epoch.timestamp?.toString(),
|
|
183
183
|
},
|
|
184
184
|
{
|
|
185
|
-
name: '
|
|
185
|
+
name: 'Block-Height',
|
|
186
186
|
value: epoch?.blockHeight?.toString(),
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
name: '
|
|
189
|
+
name: 'Epoch-Index',
|
|
190
190
|
value: epoch?.epochIndex?.toString(),
|
|
191
191
|
},
|
|
192
192
|
];
|
|
@@ -204,17 +204,17 @@ export class IOReadable {
|
|
|
204
204
|
}
|
|
205
205
|
async getObservations(epoch) {
|
|
206
206
|
const allTags = [
|
|
207
|
-
{ name: 'Action', value: '
|
|
207
|
+
{ name: 'Action', value: 'Epoch-Observations' },
|
|
208
208
|
{
|
|
209
209
|
name: 'Timestamp',
|
|
210
210
|
value: epoch.timestamp?.toString(),
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
|
-
name: '
|
|
213
|
+
name: 'Block-Height',
|
|
214
214
|
value: epoch?.blockHeight?.toString(),
|
|
215
215
|
},
|
|
216
216
|
{
|
|
217
|
-
name: '
|
|
217
|
+
name: 'Epoch-Index',
|
|
218
218
|
value: epoch?.epochIndex?.toString(),
|
|
219
219
|
},
|
|
220
220
|
];
|
|
@@ -232,17 +232,17 @@ export class IOReadable {
|
|
|
232
232
|
}
|
|
233
233
|
async getDistributions(epoch) {
|
|
234
234
|
const allTags = [
|
|
235
|
-
{ name: 'Action', value: '
|
|
235
|
+
{ name: 'Action', value: 'Epoch-Distributions' },
|
|
236
236
|
{
|
|
237
237
|
name: 'Timestamp',
|
|
238
238
|
value: epoch.timestamp?.toString() ?? '',
|
|
239
239
|
},
|
|
240
240
|
{
|
|
241
|
-
name: '
|
|
241
|
+
name: 'Block-Height',
|
|
242
242
|
value: epoch?.blockHeight?.toString(),
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
|
-
name: '
|
|
245
|
+
name: 'Epoch-Index',
|
|
246
246
|
value: epoch?.epochIndex?.toString(),
|
|
247
247
|
},
|
|
248
248
|
];
|
|
@@ -260,7 +260,7 @@ export class IOReadable {
|
|
|
260
260
|
}
|
|
261
261
|
async getTokenCost({ intent, purchaseType, years, name, quantity, }) {
|
|
262
262
|
const allTags = [
|
|
263
|
-
{ name: 'Action', value: '
|
|
263
|
+
{ name: 'Action', value: 'Token-Cost' },
|
|
264
264
|
{
|
|
265
265
|
name: 'Intent',
|
|
266
266
|
value: intent,
|
|
@@ -278,7 +278,7 @@ export class IOReadable {
|
|
|
278
278
|
value: quantity?.toString(),
|
|
279
279
|
},
|
|
280
280
|
{
|
|
281
|
-
name: '
|
|
281
|
+
name: 'Purchase-Type',
|
|
282
282
|
value: purchaseType,
|
|
283
283
|
},
|
|
284
284
|
];
|
|
@@ -337,17 +337,17 @@ export class IOWriteable extends IOReadable {
|
|
|
337
337
|
const { tags = [] } = options || {};
|
|
338
338
|
const allTags = [
|
|
339
339
|
...tags,
|
|
340
|
-
{ name: 'Action', value: '
|
|
340
|
+
{ name: 'Action', value: 'Join-Network' },
|
|
341
341
|
{
|
|
342
|
-
name: '
|
|
342
|
+
name: 'Operator-Stake',
|
|
343
343
|
value: operatorStake.valueOf().toString(),
|
|
344
344
|
},
|
|
345
345
|
{
|
|
346
|
-
name: '
|
|
346
|
+
name: 'Allow-Delegated-Staking',
|
|
347
347
|
value: allowDelegatedStaking.toString(),
|
|
348
348
|
},
|
|
349
349
|
{
|
|
350
|
-
name: '
|
|
350
|
+
name: 'Delegate-Reward-Share-Ratio',
|
|
351
351
|
value: delegateRewardShareRatio.toString(),
|
|
352
352
|
},
|
|
353
353
|
{
|
|
@@ -359,7 +359,7 @@ export class IOWriteable extends IOReadable {
|
|
|
359
359
|
value: label,
|
|
360
360
|
},
|
|
361
361
|
{
|
|
362
|
-
name: '
|
|
362
|
+
name: 'Min-Delegated-Stake',
|
|
363
363
|
value: minDelegatedStake.valueOf().toString(),
|
|
364
364
|
},
|
|
365
365
|
{
|
|
@@ -379,11 +379,11 @@ export class IOWriteable extends IOReadable {
|
|
|
379
379
|
value: protocol,
|
|
380
380
|
},
|
|
381
381
|
{
|
|
382
|
-
name: '
|
|
382
|
+
name: 'Auto-Stake',
|
|
383
383
|
value: autoStake.toString(),
|
|
384
384
|
},
|
|
385
385
|
{
|
|
386
|
-
name: '
|
|
386
|
+
name: 'Observer-Address',
|
|
387
387
|
value: observerAddress,
|
|
388
388
|
},
|
|
389
389
|
];
|
|
@@ -397,27 +397,27 @@ export class IOWriteable extends IOReadable {
|
|
|
397
397
|
const { tags = [] } = options || {};
|
|
398
398
|
const allTags = [
|
|
399
399
|
...tags,
|
|
400
|
-
{ name: 'Action', value: '
|
|
400
|
+
{ name: 'Action', value: 'Update-Gateway-Settings' },
|
|
401
401
|
{ name: 'Label', value: label },
|
|
402
402
|
{ name: 'Note', value: note },
|
|
403
403
|
{ name: 'FQDN', value: fqdn },
|
|
404
404
|
{ name: 'Port', value: port?.toString() },
|
|
405
405
|
{ name: 'Properties', value: properties },
|
|
406
406
|
{ name: 'Protocol', value: protocol },
|
|
407
|
-
{ name: '
|
|
407
|
+
{ name: 'Observer-Address', value: observerAddress },
|
|
408
408
|
{
|
|
409
|
-
name: '
|
|
409
|
+
name: 'Allow-Delegated-Staking',
|
|
410
410
|
value: allowDelegatedStaking?.toString(),
|
|
411
411
|
},
|
|
412
412
|
{
|
|
413
|
-
name: '
|
|
413
|
+
name: 'Delegate-Reward-Share-Ratio',
|
|
414
414
|
value: delegateRewardShareRatio?.toString(),
|
|
415
415
|
},
|
|
416
416
|
{
|
|
417
|
-
name: '
|
|
417
|
+
name: 'Min-Delegated-Stake',
|
|
418
418
|
value: minDelegatedStake?.valueOf().toString(),
|
|
419
419
|
},
|
|
420
|
-
{ name: '
|
|
420
|
+
{ name: 'Auto-Stake', value: autoStake?.toString() },
|
|
421
421
|
];
|
|
422
422
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
423
423
|
return this.process.send({
|
|
@@ -431,7 +431,7 @@ export class IOWriteable extends IOReadable {
|
|
|
431
431
|
signer: this.signer,
|
|
432
432
|
tags: [
|
|
433
433
|
...tags,
|
|
434
|
-
{ name: 'Action', value: '
|
|
434
|
+
{ name: 'Action', value: 'Delegate-Stake' },
|
|
435
435
|
{ name: 'Target', value: params.target },
|
|
436
436
|
{ name: 'Quantity', value: params.stakeQty.valueOf().toString() },
|
|
437
437
|
],
|
|
@@ -443,7 +443,7 @@ export class IOWriteable extends IOReadable {
|
|
|
443
443
|
signer: this.signer,
|
|
444
444
|
tags: [
|
|
445
445
|
...tags,
|
|
446
|
-
{ name: 'Action', value: '
|
|
446
|
+
{ name: 'Action', value: 'Decrease-Delegate-Stake' },
|
|
447
447
|
{ name: 'Target', value: params.target },
|
|
448
448
|
{ name: 'Quantity', value: params.decreaseQty.valueOf().toString() },
|
|
449
449
|
],
|
|
@@ -455,7 +455,7 @@ export class IOWriteable extends IOReadable {
|
|
|
455
455
|
signer: this.signer,
|
|
456
456
|
tags: [
|
|
457
457
|
...tags,
|
|
458
|
-
{ name: 'Action', value: '
|
|
458
|
+
{ name: 'Action', value: 'Increase-Operator-Stake' },
|
|
459
459
|
{ name: 'Quantity', value: params.increaseQty.valueOf().toString() },
|
|
460
460
|
],
|
|
461
461
|
});
|
|
@@ -466,7 +466,7 @@ export class IOWriteable extends IOReadable {
|
|
|
466
466
|
signer: this.signer,
|
|
467
467
|
tags: [
|
|
468
468
|
...tags,
|
|
469
|
-
{ name: 'Action', value: '
|
|
469
|
+
{ name: 'Action', value: 'Decrease-Operator-Stake' },
|
|
470
470
|
{ name: 'Quantity', value: params.decreaseQty.valueOf().toString() },
|
|
471
471
|
],
|
|
472
472
|
});
|
|
@@ -477,13 +477,13 @@ export class IOWriteable extends IOReadable {
|
|
|
477
477
|
signer: this.signer,
|
|
478
478
|
tags: [
|
|
479
479
|
...tags,
|
|
480
|
-
{ name: 'Action', value: '
|
|
480
|
+
{ name: 'Action', value: 'Save-Observations' },
|
|
481
481
|
{
|
|
482
|
-
name: '
|
|
482
|
+
name: 'Report-Tx-Id',
|
|
483
483
|
value: params.reportTxId,
|
|
484
484
|
},
|
|
485
485
|
{
|
|
486
|
-
name: '
|
|
486
|
+
name: 'Failed-Gateways',
|
|
487
487
|
value: params.failedGateways.join(','),
|
|
488
488
|
},
|
|
489
489
|
],
|
|
@@ -497,11 +497,11 @@ export class IOWriteable extends IOReadable {
|
|
|
497
497
|
const { tags = [] } = options || {};
|
|
498
498
|
const allTags = [
|
|
499
499
|
...tags,
|
|
500
|
-
{ name: 'Action', value: '
|
|
500
|
+
{ name: 'Action', value: 'Buy-Record' },
|
|
501
501
|
{ name: 'Name', value: params.name },
|
|
502
502
|
{ name: 'Years', value: params.years?.toString() ?? '1' },
|
|
503
|
-
{ name: '
|
|
504
|
-
{ name: '
|
|
503
|
+
{ name: 'Process-Id', value: params.processId },
|
|
504
|
+
{ name: 'Purchase-Type', value: params.type || 'lease' },
|
|
505
505
|
];
|
|
506
506
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
507
507
|
return this.process.send({
|
|
@@ -515,7 +515,7 @@ export class IOWriteable extends IOReadable {
|
|
|
515
515
|
signer: this.signer,
|
|
516
516
|
tags: [
|
|
517
517
|
...tags,
|
|
518
|
-
{ name: 'Action', value: '
|
|
518
|
+
{ name: 'Action', value: 'Extend-Lease' },
|
|
519
519
|
{ name: 'Name', value: params.name },
|
|
520
520
|
{ name: 'Years', value: params.years.toString() },
|
|
521
521
|
],
|
|
@@ -527,7 +527,7 @@ export class IOWriteable extends IOReadable {
|
|
|
527
527
|
signer: this.signer,
|
|
528
528
|
tags: [
|
|
529
529
|
...tags,
|
|
530
|
-
{ name: 'Action', value: '
|
|
530
|
+
{ name: 'Action', value: 'Increase-Undername-Limit' },
|
|
531
531
|
{ name: 'Name', value: params.name },
|
|
532
532
|
{ name: 'Quantity', value: params.increaseCount.toString() },
|
|
533
533
|
],
|
package/lib/esm/version.js
CHANGED
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
import { ANTRecord } from '../contract-state.js';
|
|
18
|
-
import { AoANTRead, AoANTWrite, ProcessConfiguration } from '../io.js';
|
|
18
|
+
import { AoANTRead, AoANTState, AoANTWrite, ProcessConfiguration } from '../io.js';
|
|
19
19
|
import { AoMessageResult, WalletAddress, WithSigner } from '../types.js';
|
|
20
20
|
import { AOProcess } from './contracts/ao-process.js';
|
|
21
21
|
export declare class AoANTReadable implements AoANTRead {
|
|
22
22
|
protected process: AOProcess;
|
|
23
23
|
constructor(config: Required<ProcessConfiguration>);
|
|
24
|
+
getState(): Promise<AoANTState>;
|
|
24
25
|
getInfo(): Promise<{
|
|
25
26
|
Name: string;
|
|
26
27
|
Ticker: string;
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -66,18 +66,18 @@ export declare class IOReadable implements AoIORead {
|
|
|
66
66
|
getObservations(epoch?: EpochInput): Promise<EpochObservations>;
|
|
67
67
|
getDistributions(epoch?: EpochInput): Promise<EpochDistributionData>;
|
|
68
68
|
getTokenCost(params: {
|
|
69
|
-
intent: '
|
|
69
|
+
intent: 'Buy-Record';
|
|
70
70
|
purchaseType: 'permabuy' | 'lease';
|
|
71
71
|
years: number;
|
|
72
72
|
name: string;
|
|
73
73
|
}): Promise<number>;
|
|
74
74
|
getTokenCost(params: {
|
|
75
|
-
intent: '
|
|
75
|
+
intent: 'Extend-Lease';
|
|
76
76
|
years: number;
|
|
77
77
|
name: string;
|
|
78
78
|
}): Promise<number>;
|
|
79
79
|
getTokenCost(params: {
|
|
80
|
-
intent: '
|
|
80
|
+
intent: 'Increase-Undername-Limit';
|
|
81
81
|
quantity: number;
|
|
82
82
|
name: string;
|
|
83
83
|
}): Promise<number>;
|
package/lib/types/io.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface AoIORead {
|
|
|
81
81
|
getObservations(epoch?: EpochInput): Promise<EpochObservations>;
|
|
82
82
|
getDistributions(epoch?: EpochInput): Promise<EpochDistributionData>;
|
|
83
83
|
getTokenCost({ intent, purchaseType, years, name, quantity, }: {
|
|
84
|
-
intent: '
|
|
84
|
+
intent: 'Buy-Record' | 'Extend-Lease' | 'Increase-Undername-Limit';
|
|
85
85
|
purchaseType?: 'permabuy' | 'lease';
|
|
86
86
|
years?: number;
|
|
87
87
|
name?: string;
|
|
@@ -244,3 +244,15 @@ export type AoGateway = {
|
|
|
244
244
|
operatorStake: number;
|
|
245
245
|
status: 'joined' | 'leaving';
|
|
246
246
|
};
|
|
247
|
+
export type AoANTState = {
|
|
248
|
+
Name: string;
|
|
249
|
+
Ticker: string;
|
|
250
|
+
Denomination: number;
|
|
251
|
+
Owner: WalletAddress;
|
|
252
|
+
Controllers: WalletAddress[];
|
|
253
|
+
Records: Record<string, ANTRecord>;
|
|
254
|
+
Balances: Record<WalletAddress, number>;
|
|
255
|
+
Logo: string;
|
|
256
|
+
TotalSupply: number;
|
|
257
|
+
Initialized: boolean;
|
|
258
|
+
};
|
package/lib/types/version.d.ts
CHANGED