@ar.io/sdk 1.2.0-alpha.8 → 1.2.0
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 +362 -634
- package/bundles/web.bundle.min.js +83 -83
- package/lib/cjs/common/ant-ao.js +11 -4
- package/lib/cjs/common/contracts/ao-process.js +16 -5
- package/lib/cjs/common/io.js +121 -97
- package/lib/cjs/constants.js +7 -4
- package/lib/cjs/utils/ao.js +1 -1
- package/lib/cjs/utils/graphql/processes.js +87 -7
- package/lib/cjs/utils/index.js +1 -0
- package/lib/cjs/utils/json.js +28 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant-ao.js +11 -4
- package/lib/esm/common/contracts/ao-process.js +16 -5
- package/lib/esm/common/io.js +121 -97
- package/lib/esm/constants.js +6 -3
- package/lib/esm/utils/ao.js +1 -1
- package/lib/esm/utils/graphql/processes.js +85 -6
- package/lib/esm/utils/index.js +1 -0
- package/lib/esm/utils/json.js +24 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant-ao.d.ts +2 -1
- package/lib/types/common/io.d.ts +24 -1
- package/lib/types/constants.d.ts +4 -2
- package/lib/types/io.d.ts +35 -2
- package/lib/types/utils/ao.d.ts +5 -5
- package/lib/types/utils/graphql/processes.d.ts +30 -0
- package/lib/types/utils/index.d.ts +1 -0
- package/lib/types/utils/json.d.ts +17 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +7 -1
package/lib/cjs/common/ant-ao.js
CHANGED
|
@@ -19,6 +19,13 @@ class AoANTReadable {
|
|
|
19
19
|
throw new error_js_1.InvalidContractConfigurationError();
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
async getState() {
|
|
23
|
+
const tags = [{ name: 'Action', value: 'State' }];
|
|
24
|
+
const res = await this.process.read({
|
|
25
|
+
tags,
|
|
26
|
+
});
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
22
29
|
async getInfo() {
|
|
23
30
|
const tags = [{ name: 'Action', value: 'Info' }];
|
|
24
31
|
const info = await this.process.read({
|
|
@@ -38,7 +45,7 @@ class AoANTReadable {
|
|
|
38
45
|
async getRecord({ undername }) {
|
|
39
46
|
const tags = [
|
|
40
47
|
{ name: 'Sub-Domain', value: undername },
|
|
41
|
-
{ name: 'Action', value: '
|
|
48
|
+
{ name: 'Action', value: 'Record' },
|
|
42
49
|
];
|
|
43
50
|
const record = await this.process.read({
|
|
44
51
|
tags,
|
|
@@ -54,7 +61,7 @@ class AoANTReadable {
|
|
|
54
61
|
* ````
|
|
55
62
|
*/
|
|
56
63
|
async getRecords() {
|
|
57
|
-
const tags = [{ name: 'Action', value: '
|
|
64
|
+
const tags = [{ name: 'Action', value: 'Records' }];
|
|
58
65
|
const records = await this.process.read({
|
|
59
66
|
tags,
|
|
60
67
|
});
|
|
@@ -81,7 +88,7 @@ class AoANTReadable {
|
|
|
81
88
|
* ```
|
|
82
89
|
*/
|
|
83
90
|
async getControllers() {
|
|
84
|
-
const tags = [{ name: 'Action', value: '
|
|
91
|
+
const tags = [{ name: 'Action', value: 'Controllers' }];
|
|
85
92
|
const controllers = await this.process.read({
|
|
86
93
|
tags,
|
|
87
94
|
});
|
|
@@ -182,7 +189,7 @@ class AoANTWriteable extends AoANTReadable {
|
|
|
182
189
|
*/
|
|
183
190
|
async addController({ controller, }) {
|
|
184
191
|
const tags = [
|
|
185
|
-
{ name: 'Action', value: '
|
|
192
|
+
{ name: 'Action', value: 'Add-Controller' },
|
|
186
193
|
{ name: 'Controller', value: controller },
|
|
187
194
|
];
|
|
188
195
|
return this.process.send({
|
|
@@ -19,6 +19,7 @@ exports.AOProcess = void 0;
|
|
|
19
19
|
*/
|
|
20
20
|
const aoconnect_1 = require("@permaweb/aoconnect");
|
|
21
21
|
const arbundles_1 = require("arbundles");
|
|
22
|
+
const json_js_1 = require("../../utils/json.js");
|
|
22
23
|
const version_js_1 = require("../../version.js");
|
|
23
24
|
const error_js_1 = require("../error.js");
|
|
24
25
|
const logger_js_1 = require("../logger.js");
|
|
@@ -60,18 +61,22 @@ class AOProcess {
|
|
|
60
61
|
process: this.processId,
|
|
61
62
|
tags,
|
|
62
63
|
});
|
|
64
|
+
if (result.Messages.length === 0) {
|
|
65
|
+
throw new Error(`Process ${this.processId} does not support provided action.`);
|
|
66
|
+
}
|
|
63
67
|
const tagsOutput = result.Messages[0].Tags;
|
|
64
68
|
const error = tagsOutput.find((tag) => tag.name === 'Error');
|
|
65
69
|
if (error) {
|
|
66
70
|
throw new Error(`${error.Value}: ${result.Messages[0].Data}`);
|
|
67
71
|
}
|
|
68
|
-
if (result.Messages.length === 0) {
|
|
69
|
-
throw new Error('Process does not support provided action.');
|
|
70
|
-
}
|
|
71
72
|
this.logger.debug(`Read interaction result`, {
|
|
72
73
|
result: result.Messages[0].Data,
|
|
73
74
|
});
|
|
74
|
-
|
|
75
|
+
// return empty object if no data is returned
|
|
76
|
+
if (result.Messages[0].Data === undefined) {
|
|
77
|
+
return {};
|
|
78
|
+
}
|
|
79
|
+
const response = (0, json_js_1.safeDecode)(result.Messages[0].Data);
|
|
75
80
|
return response;
|
|
76
81
|
}
|
|
77
82
|
catch (e) {
|
|
@@ -131,7 +136,13 @@ class AOProcess {
|
|
|
131
136
|
const result = output.Messages[0].Data;
|
|
132
137
|
throw new error_js_1.WriteInteractionError(`${error.Value}: ${result}`);
|
|
133
138
|
}
|
|
134
|
-
|
|
139
|
+
if (output.Messages.length === 0) {
|
|
140
|
+
throw new Error(`Process ${this.processId} does not support provided action.`);
|
|
141
|
+
}
|
|
142
|
+
if (output.Messages[0].Data === undefined) {
|
|
143
|
+
return { id: messageId };
|
|
144
|
+
}
|
|
145
|
+
const resultData = (0, json_js_1.safeDecode)(output.Messages[0].Data);
|
|
135
146
|
this.logger.debug('Message result data', {
|
|
136
147
|
resultData,
|
|
137
148
|
messageId,
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -64,31 +64,47 @@ class IOReadable {
|
|
|
64
64
|
}
|
|
65
65
|
this.arweave = arweave;
|
|
66
66
|
}
|
|
67
|
-
async
|
|
67
|
+
async getInfo() {
|
|
68
|
+
return this.process.read({
|
|
69
|
+
tags: [{ name: 'Action', value: 'Info' }],
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
async getEpochSettings(params) {
|
|
68
73
|
const allTags = [
|
|
69
|
-
{ name: 'Action', value: 'Epoch' },
|
|
74
|
+
{ name: 'Action', value: 'Epoch-Settings' },
|
|
70
75
|
{
|
|
71
|
-
// TODO: default this to the current network time
|
|
72
76
|
name: 'Timestamp',
|
|
73
|
-
value:
|
|
77
|
+
value: params?.timestamp?.toString() ??
|
|
78
|
+
(await this.arweave.blocks.getCurrent().catch(() => {
|
|
79
|
+
return { timestamp: Date.now() }; // fallback to current time
|
|
80
|
+
})).timestamp.toString(),
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'Epoch-Index',
|
|
84
|
+
value: params?.epochIndex?.toString(),
|
|
74
85
|
},
|
|
86
|
+
];
|
|
87
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
88
|
+
return this.process.read({
|
|
89
|
+
tags: prunedTags,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async getEpoch(epoch) {
|
|
93
|
+
const allTags = [
|
|
94
|
+
{ name: 'Action', value: 'Epoch' },
|
|
75
95
|
{
|
|
76
|
-
name: '
|
|
77
|
-
value: epoch?.
|
|
96
|
+
name: 'Timestamp',
|
|
97
|
+
value: epoch?.timestamp?.toString() ??
|
|
98
|
+
(await this.arweave.blocks.getCurrent().catch(() => {
|
|
99
|
+
return { timestamp: Date.now() }; // fallback to current time
|
|
100
|
+
})).timestamp.toString(),
|
|
78
101
|
},
|
|
79
102
|
{
|
|
80
|
-
name: '
|
|
103
|
+
name: 'Epoch-Index',
|
|
81
104
|
value: epoch?.epochIndex?.toString(),
|
|
82
105
|
},
|
|
83
106
|
];
|
|
84
107
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
85
|
-
// if it only contains the action, add default timestamp
|
|
86
|
-
if (prunedTags.length === 1) {
|
|
87
|
-
prunedTags.push({
|
|
88
|
-
name: 'Timestamp',
|
|
89
|
-
value: (await this.arweave.blocks.getCurrent()).timestamp.toString(),
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
108
|
return this.process.read({
|
|
93
109
|
tags: prunedTags,
|
|
94
110
|
});
|
|
@@ -108,13 +124,13 @@ class IOReadable {
|
|
|
108
124
|
}
|
|
109
125
|
async getArNSReservedNames() {
|
|
110
126
|
return this.process.read({
|
|
111
|
-
tags: [{ name: 'Action', value: '
|
|
127
|
+
tags: [{ name: 'Action', value: 'Reserved-Names' }],
|
|
112
128
|
});
|
|
113
129
|
}
|
|
114
130
|
async getArNSReservedName({ name, }) {
|
|
115
131
|
return this.process.read({
|
|
116
132
|
tags: [
|
|
117
|
-
{ name: 'Action', value: '
|
|
133
|
+
{ name: 'Action', value: 'Reserved-Name' },
|
|
118
134
|
{ name: 'Name', value: name },
|
|
119
135
|
],
|
|
120
136
|
});
|
|
@@ -149,118 +165,126 @@ class IOReadable {
|
|
|
149
165
|
return this.process.read({
|
|
150
166
|
tags: [
|
|
151
167
|
{ name: 'Action', value: 'Epoch' },
|
|
152
|
-
{
|
|
168
|
+
{
|
|
169
|
+
name: 'Timestamp',
|
|
170
|
+
value: (await this.arweave.blocks.getCurrent().catch(() => {
|
|
171
|
+
return { timestamp: Date.now() }; // fallback to current time
|
|
172
|
+
})).timestamp.toString(),
|
|
173
|
+
},
|
|
153
174
|
],
|
|
154
175
|
});
|
|
155
176
|
}
|
|
156
177
|
async getPrescribedObservers(epoch) {
|
|
157
178
|
const allTags = [
|
|
158
|
-
{ name: 'Action', value: '
|
|
179
|
+
{ name: 'Action', value: 'Epoch-Prescribed-Observers' },
|
|
159
180
|
{
|
|
160
181
|
name: 'Timestamp',
|
|
161
|
-
value: epoch
|
|
182
|
+
value: epoch?.timestamp?.toString() ??
|
|
183
|
+
(await this.arweave.blocks.getCurrent().catch(() => {
|
|
184
|
+
return { timestamp: Date.now() }; // fallback to current time
|
|
185
|
+
})).timestamp.toString(),
|
|
162
186
|
},
|
|
163
187
|
{
|
|
164
|
-
name: '
|
|
165
|
-
value: epoch?.blockHeight?.toString(),
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: 'EpochIndex',
|
|
188
|
+
name: 'Epoch-Index',
|
|
169
189
|
value: epoch?.epochIndex?.toString(),
|
|
170
190
|
},
|
|
171
191
|
];
|
|
172
192
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
173
|
-
// if it only contains the action, add default timestamp
|
|
174
|
-
if (prunedTags.length === 1) {
|
|
175
|
-
prunedTags.push({
|
|
176
|
-
name: 'Timestamp',
|
|
177
|
-
value: `${Date.now()}`,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
193
|
return this.process.read({
|
|
181
194
|
tags: prunedTags,
|
|
182
195
|
});
|
|
183
196
|
}
|
|
184
197
|
async getPrescribedNames(epoch) {
|
|
185
198
|
const allTags = [
|
|
186
|
-
{ name: 'Action', value: '
|
|
199
|
+
{ name: 'Action', value: 'Epoch-Prescribed-Names' },
|
|
187
200
|
{
|
|
188
201
|
name: 'Timestamp',
|
|
189
|
-
value: epoch
|
|
202
|
+
value: epoch?.timestamp?.toString() ??
|
|
203
|
+
(await this.arweave.blocks.getCurrent().catch(() => {
|
|
204
|
+
return { timestamp: Date.now() }; // fallback to current time
|
|
205
|
+
})).timestamp.toString(),
|
|
190
206
|
},
|
|
191
207
|
{
|
|
192
|
-
name: '
|
|
193
|
-
value: epoch?.blockHeight?.toString(),
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
name: 'EpochIndex',
|
|
208
|
+
name: 'Epoch-Index',
|
|
197
209
|
value: epoch?.epochIndex?.toString(),
|
|
198
210
|
},
|
|
199
211
|
];
|
|
200
212
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
201
|
-
// if it only contains the action, add default timestamp
|
|
202
|
-
if (prunedTags.length === 1) {
|
|
203
|
-
prunedTags.push({
|
|
204
|
-
name: 'Timestamp',
|
|
205
|
-
value: `${Date.now()}`, // TODO; replace with fetch the current network time
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
213
|
return this.process.read({
|
|
209
214
|
tags: prunedTags,
|
|
210
215
|
});
|
|
211
216
|
}
|
|
212
217
|
async getObservations(epoch) {
|
|
213
218
|
const allTags = [
|
|
214
|
-
{ name: 'Action', value: '
|
|
219
|
+
{ name: 'Action', value: 'Epoch-Observations' },
|
|
215
220
|
{
|
|
216
221
|
name: 'Timestamp',
|
|
217
|
-
value: epoch
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
value: epoch?.blockHeight?.toString(),
|
|
222
|
+
value: epoch?.timestamp?.toString() ??
|
|
223
|
+
(await this.arweave.blocks.getCurrent().catch(() => {
|
|
224
|
+
return { timestamp: `${Date.now()}` }; // fallback to current time
|
|
225
|
+
})).timestamp.toString(),
|
|
222
226
|
},
|
|
223
227
|
{
|
|
224
|
-
name: '
|
|
228
|
+
name: 'Epoch-Index',
|
|
225
229
|
value: epoch?.epochIndex?.toString(),
|
|
226
230
|
},
|
|
227
231
|
];
|
|
228
232
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
229
|
-
// if it only contains the action, add default timestamp
|
|
230
|
-
if (prunedTags.length === 1) {
|
|
231
|
-
prunedTags.push({
|
|
232
|
-
name: 'Timestamp',
|
|
233
|
-
value: (await this.arweave.blocks.getCurrent()).timestamp.toString(),
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
233
|
return this.process.read({
|
|
237
234
|
tags: prunedTags,
|
|
238
235
|
});
|
|
239
236
|
}
|
|
240
237
|
async getDistributions(epoch) {
|
|
241
238
|
const allTags = [
|
|
242
|
-
{ name: 'Action', value: '
|
|
239
|
+
{ name: 'Action', value: 'Epoch-Distributions' },
|
|
243
240
|
{
|
|
244
241
|
name: 'Timestamp',
|
|
245
|
-
value: epoch
|
|
242
|
+
value: epoch?.timestamp?.toString() ??
|
|
243
|
+
(await this.arweave.blocks.getCurrent().catch(() => {
|
|
244
|
+
return { timestamp: Date.now() }; // fallback to current time
|
|
245
|
+
})).timestamp.toString(),
|
|
246
246
|
},
|
|
247
247
|
{
|
|
248
|
-
name: '
|
|
249
|
-
value: epoch?.blockHeight?.toString(),
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
name: 'EpochIndex',
|
|
248
|
+
name: 'Epoch-Index',
|
|
253
249
|
value: epoch?.epochIndex?.toString(),
|
|
254
250
|
},
|
|
255
251
|
];
|
|
256
252
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
253
|
+
return this.process.read({
|
|
254
|
+
tags: prunedTags,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
async getTokenCost({ intent, purchaseType, years, name, quantity, }) {
|
|
258
|
+
const allTags = [
|
|
259
|
+
{ name: 'Action', value: 'Token-Cost' },
|
|
260
|
+
{
|
|
261
|
+
name: 'Intent',
|
|
262
|
+
value: intent,
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: 'Name',
|
|
266
|
+
value: name,
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'Years',
|
|
270
|
+
value: years?.toString(),
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: 'Quantity',
|
|
274
|
+
value: quantity?.toString(),
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: 'Purchase-Type',
|
|
278
|
+
value: purchaseType,
|
|
279
|
+
},
|
|
280
|
+
{
|
|
260
281
|
name: 'Timestamp',
|
|
261
|
-
value: (await this.arweave.blocks.getCurrent()
|
|
262
|
-
|
|
263
|
-
|
|
282
|
+
value: (await this.arweave.blocks.getCurrent().catch(() => {
|
|
283
|
+
return { timestamp: Date.now() }; // fallback to current time
|
|
284
|
+
})).timestamp.toString(),
|
|
285
|
+
},
|
|
286
|
+
];
|
|
287
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
264
288
|
return this.process.read({
|
|
265
289
|
tags: prunedTags,
|
|
266
290
|
});
|
|
@@ -316,17 +340,17 @@ class IOWriteable extends IOReadable {
|
|
|
316
340
|
const { tags = [] } = options || {};
|
|
317
341
|
const allTags = [
|
|
318
342
|
...tags,
|
|
319
|
-
{ name: 'Action', value: '
|
|
343
|
+
{ name: 'Action', value: 'Join-Network' },
|
|
320
344
|
{
|
|
321
|
-
name: '
|
|
345
|
+
name: 'Operator-Stake',
|
|
322
346
|
value: operatorStake.valueOf().toString(),
|
|
323
347
|
},
|
|
324
348
|
{
|
|
325
|
-
name: '
|
|
349
|
+
name: 'Allow-Delegated-Staking',
|
|
326
350
|
value: allowDelegatedStaking.toString(),
|
|
327
351
|
},
|
|
328
352
|
{
|
|
329
|
-
name: '
|
|
353
|
+
name: 'Delegate-Reward-Share-Ratio',
|
|
330
354
|
value: delegateRewardShareRatio.toString(),
|
|
331
355
|
},
|
|
332
356
|
{
|
|
@@ -338,7 +362,7 @@ class IOWriteable extends IOReadable {
|
|
|
338
362
|
value: label,
|
|
339
363
|
},
|
|
340
364
|
{
|
|
341
|
-
name: '
|
|
365
|
+
name: 'Min-Delegated-Stake',
|
|
342
366
|
value: minDelegatedStake.valueOf().toString(),
|
|
343
367
|
},
|
|
344
368
|
{
|
|
@@ -358,11 +382,11 @@ class IOWriteable extends IOReadable {
|
|
|
358
382
|
value: protocol,
|
|
359
383
|
},
|
|
360
384
|
{
|
|
361
|
-
name: '
|
|
385
|
+
name: 'Auto-Stake',
|
|
362
386
|
value: autoStake.toString(),
|
|
363
387
|
},
|
|
364
388
|
{
|
|
365
|
-
name: '
|
|
389
|
+
name: 'Observer-Address',
|
|
366
390
|
value: observerAddress,
|
|
367
391
|
},
|
|
368
392
|
];
|
|
@@ -376,27 +400,27 @@ class IOWriteable extends IOReadable {
|
|
|
376
400
|
const { tags = [] } = options || {};
|
|
377
401
|
const allTags = [
|
|
378
402
|
...tags,
|
|
379
|
-
{ name: 'Action', value: '
|
|
403
|
+
{ name: 'Action', value: 'Update-Gateway-Settings' },
|
|
380
404
|
{ name: 'Label', value: label },
|
|
381
405
|
{ name: 'Note', value: note },
|
|
382
406
|
{ name: 'FQDN', value: fqdn },
|
|
383
407
|
{ name: 'Port', value: port?.toString() },
|
|
384
408
|
{ name: 'Properties', value: properties },
|
|
385
409
|
{ name: 'Protocol', value: protocol },
|
|
386
|
-
{ name: '
|
|
410
|
+
{ name: 'Observer-Address', value: observerAddress },
|
|
387
411
|
{
|
|
388
|
-
name: '
|
|
412
|
+
name: 'Allow-Delegated-Staking',
|
|
389
413
|
value: allowDelegatedStaking?.toString(),
|
|
390
414
|
},
|
|
391
415
|
{
|
|
392
|
-
name: '
|
|
416
|
+
name: 'Delegate-Reward-Share-Ratio',
|
|
393
417
|
value: delegateRewardShareRatio?.toString(),
|
|
394
418
|
},
|
|
395
419
|
{
|
|
396
|
-
name: '
|
|
420
|
+
name: 'Min-Delegated-Stake',
|
|
397
421
|
value: minDelegatedStake?.valueOf().toString(),
|
|
398
422
|
},
|
|
399
|
-
{ name: '
|
|
423
|
+
{ name: 'Auto-Stake', value: autoStake?.toString() },
|
|
400
424
|
];
|
|
401
425
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
402
426
|
return this.process.send({
|
|
@@ -410,7 +434,7 @@ class IOWriteable extends IOReadable {
|
|
|
410
434
|
signer: this.signer,
|
|
411
435
|
tags: [
|
|
412
436
|
...tags,
|
|
413
|
-
{ name: 'Action', value: '
|
|
437
|
+
{ name: 'Action', value: 'Delegate-Stake' },
|
|
414
438
|
{ name: 'Target', value: params.target },
|
|
415
439
|
{ name: 'Quantity', value: params.stakeQty.valueOf().toString() },
|
|
416
440
|
],
|
|
@@ -422,7 +446,7 @@ class IOWriteable extends IOReadable {
|
|
|
422
446
|
signer: this.signer,
|
|
423
447
|
tags: [
|
|
424
448
|
...tags,
|
|
425
|
-
{ name: 'Action', value: '
|
|
449
|
+
{ name: 'Action', value: 'Decrease-Delegate-Stake' },
|
|
426
450
|
{ name: 'Target', value: params.target },
|
|
427
451
|
{ name: 'Quantity', value: params.decreaseQty.valueOf().toString() },
|
|
428
452
|
],
|
|
@@ -434,7 +458,7 @@ class IOWriteable extends IOReadable {
|
|
|
434
458
|
signer: this.signer,
|
|
435
459
|
tags: [
|
|
436
460
|
...tags,
|
|
437
|
-
{ name: 'Action', value: '
|
|
461
|
+
{ name: 'Action', value: 'Increase-Operator-Stake' },
|
|
438
462
|
{ name: 'Quantity', value: params.increaseQty.valueOf().toString() },
|
|
439
463
|
],
|
|
440
464
|
});
|
|
@@ -445,7 +469,7 @@ class IOWriteable extends IOReadable {
|
|
|
445
469
|
signer: this.signer,
|
|
446
470
|
tags: [
|
|
447
471
|
...tags,
|
|
448
|
-
{ name: 'Action', value: '
|
|
472
|
+
{ name: 'Action', value: 'Decrease-Operator-Stake' },
|
|
449
473
|
{ name: 'Quantity', value: params.decreaseQty.valueOf().toString() },
|
|
450
474
|
],
|
|
451
475
|
});
|
|
@@ -456,13 +480,13 @@ class IOWriteable extends IOReadable {
|
|
|
456
480
|
signer: this.signer,
|
|
457
481
|
tags: [
|
|
458
482
|
...tags,
|
|
459
|
-
{ name: 'Action', value: '
|
|
483
|
+
{ name: 'Action', value: 'Save-Observations' },
|
|
460
484
|
{
|
|
461
|
-
name: '
|
|
485
|
+
name: 'Report-Tx-Id',
|
|
462
486
|
value: params.reportTxId,
|
|
463
487
|
},
|
|
464
488
|
{
|
|
465
|
-
name: '
|
|
489
|
+
name: 'Failed-Gateways',
|
|
466
490
|
value: params.failedGateways.join(','),
|
|
467
491
|
},
|
|
468
492
|
],
|
|
@@ -476,11 +500,11 @@ class IOWriteable extends IOReadable {
|
|
|
476
500
|
const { tags = [] } = options || {};
|
|
477
501
|
const allTags = [
|
|
478
502
|
...tags,
|
|
479
|
-
{ name: 'Action', value: '
|
|
503
|
+
{ name: 'Action', value: 'Buy-Record' },
|
|
480
504
|
{ name: 'Name', value: params.name },
|
|
481
505
|
{ name: 'Years', value: params.years?.toString() ?? '1' },
|
|
482
|
-
{ name: '
|
|
483
|
-
{ name: '
|
|
506
|
+
{ name: 'Process-Id', value: params.processId },
|
|
507
|
+
{ name: 'Purchase-Type', value: params.type || 'lease' },
|
|
484
508
|
];
|
|
485
509
|
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
486
510
|
return this.process.send({
|
|
@@ -494,7 +518,7 @@ class IOWriteable extends IOReadable {
|
|
|
494
518
|
signer: this.signer,
|
|
495
519
|
tags: [
|
|
496
520
|
...tags,
|
|
497
|
-
{ name: 'Action', value: '
|
|
521
|
+
{ name: 'Action', value: 'Extend-Lease' },
|
|
498
522
|
{ name: 'Name', value: params.name },
|
|
499
523
|
{ name: 'Years', value: params.years.toString() },
|
|
500
524
|
],
|
|
@@ -506,7 +530,7 @@ class IOWriteable extends IOReadable {
|
|
|
506
530
|
signer: this.signer,
|
|
507
531
|
tags: [
|
|
508
532
|
...tags,
|
|
509
|
-
{ name: 'Action', value: '
|
|
533
|
+
{ name: 'Action', value: 'Increase-Undername-Limit' },
|
|
510
534
|
{ name: 'Name', value: params.name },
|
|
511
535
|
{ name: 'Quantity', value: params.increaseCount.toString() },
|
|
512
536
|
],
|
package/lib/cjs/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_SCHEDULER_ID = exports.ANT_LUA_ID = exports.AOS_MODULE_ID = exports.MIO_PER_IO = exports.ioDevnetProcessId = exports.ARNS_DEVNET_REGISTRY_TX = exports.ARNS_TESTNET_REGISTRY_TX = exports.SORT_KEY_REGEX = exports.FQDN_REGEX = exports.ARWEAVE_TX_REGEX = void 0;
|
|
3
|
+
exports.DEFAULT_SCHEDULER_ID = exports.ANT_LUA_ID = exports.AOS_MODULE_ID = exports.MIO_PER_IO = exports.IO_TESTNET_PROCESS_ID = exports.ioDevnetProcessId = exports.IO_DEVNET_PROCESS_ID = exports.ARNS_DEVNET_REGISTRY_TX = exports.ARNS_TESTNET_REGISTRY_TX = exports.SORT_KEY_REGEX = exports.FQDN_REGEX = exports.ARWEAVE_TX_REGEX = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -24,8 +24,11 @@ exports.FQDN_REGEX = new RegExp('^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{
|
|
|
24
24
|
exports.SORT_KEY_REGEX = new RegExp('^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$');
|
|
25
25
|
exports.ARNS_TESTNET_REGISTRY_TX = process.env.ARNS_REGISTRY_TX ?? 'bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U';
|
|
26
26
|
exports.ARNS_DEVNET_REGISTRY_TX = '_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8';
|
|
27
|
-
exports.
|
|
27
|
+
exports.IO_DEVNET_PROCESS_ID = 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc';
|
|
28
|
+
// backwards compatibility - TODO: remove in v2.0.0
|
|
29
|
+
exports.ioDevnetProcessId = exports.IO_DEVNET_PROCESS_ID;
|
|
30
|
+
exports.IO_TESTNET_PROCESS_ID = 'agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA';
|
|
28
31
|
exports.MIO_PER_IO = 1_000_000;
|
|
29
|
-
exports.AOS_MODULE_ID = '
|
|
30
|
-
exports.ANT_LUA_ID = '
|
|
32
|
+
exports.AOS_MODULE_ID = 'cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk';
|
|
33
|
+
exports.ANT_LUA_ID = '3OlGzE5mrsN2GsxCYM0Tae1KzWepGOr5a94deOWmApM';
|
|
31
34
|
exports.DEFAULT_SCHEDULER_ID = '_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA';
|
package/lib/cjs/utils/ao.js
CHANGED
|
@@ -21,7 +21,7 @@ const aoconnect_1 = require("@permaweb/aoconnect");
|
|
|
21
21
|
const arweave_js_1 = require("../common/arweave.js");
|
|
22
22
|
const index_js_1 = require("../common/index.js");
|
|
23
23
|
const constants_js_1 = require("../constants.js");
|
|
24
|
-
async function spawnANT({ module = constants_js_1.AOS_MODULE_ID, luaCodeTxId = constants_js_1.ANT_LUA_ID,
|
|
24
|
+
async function spawnANT({ signer, module = constants_js_1.AOS_MODULE_ID, luaCodeTxId = constants_js_1.ANT_LUA_ID, ao = (0, aoconnect_1.connect)(), scheduler = constants_js_1.DEFAULT_SCHEDULER_ID, state, stateContractTxId, }) {
|
|
25
25
|
//TODO: cache locally and only fetch if not cached
|
|
26
26
|
const luaString = (await arweave_js_1.defaultArweave.transactions.getData(luaCodeTxId, {
|
|
27
27
|
decode: true,
|