@ar.io/sdk 1.2.0 → 2.0.0-alpha.1
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 +5 -1
- package/bundles/web.bundle.min.js +101 -333
- package/lib/cjs/common/ant.js +1 -351
- package/lib/cjs/common/index.js +0 -4
- package/lib/cjs/common/io.js +3 -3
- package/lib/cjs/types.js +0 -1
- package/lib/cjs/utils/arweave.js +1 -15
- package/lib/cjs/utils/graphql/index.js +0 -1
- package/lib/cjs/utils/graphql/processes.js +2 -2
- package/lib/cjs/utils/index.js +0 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +2 -350
- package/lib/esm/common/index.js +0 -4
- package/lib/esm/common/io.js +4 -4
- package/lib/esm/types.js +0 -1
- package/lib/esm/utils/arweave.js +0 -12
- package/lib/esm/utils/graphql/index.js +0 -1
- package/lib/esm/utils/graphql/processes.js +3 -3
- package/lib/esm/utils/index.js +0 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +1 -274
- package/lib/types/common/index.d.ts +0 -3
- package/lib/types/common.d.ts +1 -138
- package/lib/types/types.d.ts +0 -1
- package/lib/types/utils/arweave.d.ts +0 -5
- package/lib/types/utils/graphql/index.d.ts +0 -1
- package/lib/types/utils/index.d.ts +0 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +5 -10
- package/lib/cjs/arns-service.js +0 -2
- package/lib/cjs/common/ar-io.js +0 -741
- package/lib/cjs/common/contracts/remote-contract.js +0 -55
- package/lib/cjs/common/contracts/warp-contract.js +0 -176
- package/lib/cjs/common/warp.js +0 -25
- package/lib/cjs/utils/graphql/smartweave.js +0 -309
- package/lib/cjs/utils/smartweave.js +0 -58
- package/lib/esm/arns-service.js +0 -1
- package/lib/esm/common/ar-io.js +0 -735
- package/lib/esm/common/contracts/remote-contract.js +0 -51
- package/lib/esm/common/contracts/warp-contract.js +0 -172
- package/lib/esm/common/warp.js +0 -22
- package/lib/esm/utils/graphql/smartweave.js +0 -303
- package/lib/esm/utils/smartweave.js +0 -50
- package/lib/types/arns-service.d.ts +0 -23
- package/lib/types/common/ar-io.d.ts +0 -551
- package/lib/types/common/contracts/remote-contract.d.ts +0 -38
- package/lib/types/common/contracts/warp-contract.d.ts +0 -43
- package/lib/types/common/warp.d.ts +0 -1
- package/lib/types/utils/graphql/smartweave.d.ts +0 -47
- package/lib/types/utils/smartweave.d.ts +0 -41
package/lib/cjs/common/ant.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ANT = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -18,46 +18,9 @@ exports.ANTWritable = exports.ANTReadable = exports.ANT = void 0;
|
|
|
18
18
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
const types_js_1 = require("../types.js");
|
|
21
|
-
const smartweave_js_1 = require("../utils/smartweave.js");
|
|
22
|
-
const remote_contract_js_1 = require("./contracts/remote-contract.js");
|
|
23
21
|
const index_js_1 = require("./index.js");
|
|
24
22
|
class ANT {
|
|
25
|
-
/**
|
|
26
|
-
* @param config - @type {ContractConfiguration} The configuration object.
|
|
27
|
-
* @returns {WarpContract<ANTState>} The contract object.
|
|
28
|
-
* @example
|
|
29
|
-
* Using the contract object
|
|
30
|
-
* ```ts
|
|
31
|
-
* ANT.createContract({ contract: new WarpContract<ANTState>({ contractTxId: 'myContractTxId' });
|
|
32
|
-
* ```
|
|
33
|
-
* Using the contractTxId
|
|
34
|
-
* ```ts
|
|
35
|
-
* ANT.createContract({ contractTxId: 'myContractTxId' });
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
static createWriteableContract(config) {
|
|
39
|
-
if ((0, smartweave_js_1.isContractConfiguration)(config)) {
|
|
40
|
-
return config.contract instanceof index_js_1.WarpContract
|
|
41
|
-
? config.contract
|
|
42
|
-
: new index_js_1.WarpContract(config.contract.configuration());
|
|
43
|
-
}
|
|
44
|
-
else if ((0, smartweave_js_1.isContractTxIdConfiguration)(config)) {
|
|
45
|
-
return new index_js_1.WarpContract({ contractTxId: config.contractTxId });
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
throw new index_js_1.InvalidContractConfigurationError();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
23
|
static init({ signer, ...config }) {
|
|
52
|
-
// TODO: these will be deprecated in the future
|
|
53
|
-
if ((0, smartweave_js_1.isContractConfiguration)(config) ||
|
|
54
|
-
(0, smartweave_js_1.isContractTxIdConfiguration)(config)) {
|
|
55
|
-
if (!signer) {
|
|
56
|
-
return new ANTReadable(config);
|
|
57
|
-
}
|
|
58
|
-
const contract = this.createWriteableContract(config);
|
|
59
|
-
return new ANTWritable({ signer, contract });
|
|
60
|
-
}
|
|
61
24
|
// ao supported implementation
|
|
62
25
|
if ((0, types_js_1.isProcessConfiguration)(config) || (0, types_js_1.isProcessIdConfiguration)(config)) {
|
|
63
26
|
if (!signer) {
|
|
@@ -69,316 +32,3 @@ class ANT {
|
|
|
69
32
|
}
|
|
70
33
|
}
|
|
71
34
|
exports.ANT = ANT;
|
|
72
|
-
class ANTReadable {
|
|
73
|
-
contract;
|
|
74
|
-
constructor(config) {
|
|
75
|
-
if ((0, smartweave_js_1.isContractConfiguration)(config)) {
|
|
76
|
-
this.contract = config.contract;
|
|
77
|
-
}
|
|
78
|
-
else if ((0, smartweave_js_1.isContractTxIdConfiguration)(config)) {
|
|
79
|
-
this.contract = new remote_contract_js_1.RemoteContract({
|
|
80
|
-
contractTxId: config.contractTxId,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
throw new index_js_1.InvalidContractConfigurationError();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
89
|
-
* @returns {Promise<ANTState>} The state of the contract.
|
|
90
|
-
* @example
|
|
91
|
-
* Get the current state
|
|
92
|
-
* ```ts
|
|
93
|
-
* ant.getState();
|
|
94
|
-
* ```
|
|
95
|
-
* Get the state at a specific block height or sortkey
|
|
96
|
-
* ```ts
|
|
97
|
-
* ant.getState({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
98
|
-
* ant.getState({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
async getState({ evaluationOptions, } = {}) {
|
|
102
|
-
const state = await this.contract.getState({ evaluationOptions });
|
|
103
|
-
return state;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* @param domain @type {string} The domain name.
|
|
107
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
108
|
-
* @returns {Promise<ANTRecord>} The record of the undername domain.
|
|
109
|
-
* @example
|
|
110
|
-
* Get the current record
|
|
111
|
-
* ```ts
|
|
112
|
-
* ant.getRecord({ domain: "john" });
|
|
113
|
-
* ```
|
|
114
|
-
* Get the record at a specific block height or sortkey
|
|
115
|
-
* ```ts
|
|
116
|
-
* ant.getRecord({ domain: "john", evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
117
|
-
* ant.getRecord({ domain: "john", evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
async getRecord({ domain, evaluationOptions, }) {
|
|
121
|
-
const records = await this.getRecords({ evaluationOptions });
|
|
122
|
-
return records[domain];
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
126
|
-
* @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
|
|
127
|
-
* @example
|
|
128
|
-
* Get the current records
|
|
129
|
-
* ```ts
|
|
130
|
-
* ant.getRecords();
|
|
131
|
-
* ```
|
|
132
|
-
* Get the records at a specific block height or sortkey
|
|
133
|
-
* ```ts
|
|
134
|
-
* ant.getRecords({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
135
|
-
* ant.getRecords({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
|
-
async getRecords({ evaluationOptions, } = {}) {
|
|
139
|
-
const state = await this.contract.getState({ evaluationOptions });
|
|
140
|
-
return state.records;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
144
|
-
* @returns {Promise<string>} The owner of the ANT.
|
|
145
|
-
* @example
|
|
146
|
-
* Get the current owner
|
|
147
|
-
* ```ts
|
|
148
|
-
* ant.getOwner();
|
|
149
|
-
* ```
|
|
150
|
-
* Get the owner at a specific block height or sortkey
|
|
151
|
-
* ```ts
|
|
152
|
-
* ant.getOwner({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
153
|
-
* ant.getOwner({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
154
|
-
* ```
|
|
155
|
-
*/
|
|
156
|
-
async getOwner({ evaluationOptions, } = {}) {
|
|
157
|
-
const state = await this.contract.getState({ evaluationOptions });
|
|
158
|
-
return state.owner;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
162
|
-
* @returns {Promise<string[]>} The controllers of the ANT.
|
|
163
|
-
* @example
|
|
164
|
-
* Get the controllers of the ANT.
|
|
165
|
-
* ```ts
|
|
166
|
-
* ant.getControllers();
|
|
167
|
-
* ```
|
|
168
|
-
* Get the controllers at a specific block height or sortkey
|
|
169
|
-
* ```ts
|
|
170
|
-
* ant.getControllers({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
171
|
-
* ant.getControllers({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
172
|
-
* ```
|
|
173
|
-
*/
|
|
174
|
-
async getControllers({ evaluationOptions, } = {}) {
|
|
175
|
-
const state = await this.contract.getState({ evaluationOptions });
|
|
176
|
-
return state.controllers;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
180
|
-
* @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
|
|
181
|
-
* @example
|
|
182
|
-
* Get the current name
|
|
183
|
-
* ```ts
|
|
184
|
-
* ant.getName();
|
|
185
|
-
* ```
|
|
186
|
-
* @example
|
|
187
|
-
* Get the ticker at a specific block height or sortkey
|
|
188
|
-
* ```ts
|
|
189
|
-
* ant.getName({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
190
|
-
* ant.getName({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
191
|
-
* ```
|
|
192
|
-
*/
|
|
193
|
-
async getName({ evaluationOptions, } = {}) {
|
|
194
|
-
const state = await this.contract.getState({ evaluationOptions });
|
|
195
|
-
return state.name;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
199
|
-
* @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
|
|
200
|
-
* @example
|
|
201
|
-
* The current ticker of the ANT.
|
|
202
|
-
* ```ts
|
|
203
|
-
* ant.getTicker();
|
|
204
|
-
* ```
|
|
205
|
-
* @example
|
|
206
|
-
* Get the ticker at a specific block height or sortkey
|
|
207
|
-
* ```ts
|
|
208
|
-
* ant.getTicker({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
209
|
-
* ant.getTicker({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
210
|
-
* ```
|
|
211
|
-
*/
|
|
212
|
-
async getTicker({ evaluationOptions, } = {}) {
|
|
213
|
-
const state = await this.contract.getState({ evaluationOptions });
|
|
214
|
-
return state.ticker;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
218
|
-
* @returns {Promise<Record<string, number>>} The balances of the ANT
|
|
219
|
-
* @example
|
|
220
|
-
* The current balances of the ANT.
|
|
221
|
-
* ```ts
|
|
222
|
-
* ant.getBalances();
|
|
223
|
-
* ```
|
|
224
|
-
* @example
|
|
225
|
-
* Get the balances at a specific block height or sortkey
|
|
226
|
-
* ```ts
|
|
227
|
-
* ant.getBalances({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
228
|
-
* ant.getBalances({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
229
|
-
* ```
|
|
230
|
-
*/
|
|
231
|
-
async getBalances({ evaluationOptions, } = {}) {
|
|
232
|
-
const state = await this.contract.getState({ evaluationOptions });
|
|
233
|
-
return state.balances;
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
237
|
-
* @param address @type {string} The address of the account you want the balance of.
|
|
238
|
-
* @returns {Promise<number>} The balance of the provided address
|
|
239
|
-
* @example
|
|
240
|
-
* The current balance of the address.
|
|
241
|
-
* ```ts
|
|
242
|
-
* ant.getBalance({ address });
|
|
243
|
-
* ```
|
|
244
|
-
* @example
|
|
245
|
-
* Get the balance at a specific block height or sortkey
|
|
246
|
-
* ```ts
|
|
247
|
-
* ant.getBalance({ address, evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
248
|
-
* ant.getBalance({ address, evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
249
|
-
* ```
|
|
250
|
-
*/
|
|
251
|
-
async getBalance({ address, evaluationOptions, }) {
|
|
252
|
-
const balances = await this.getBalances({ evaluationOptions });
|
|
253
|
-
return balances[address] || 0;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
exports.ANTReadable = ANTReadable;
|
|
257
|
-
class ANTWritable extends ANTReadable {
|
|
258
|
-
signer;
|
|
259
|
-
constructor({ signer, ...config }) {
|
|
260
|
-
if ((0, smartweave_js_1.isContractConfiguration)(config)) {
|
|
261
|
-
super({ contract: config.contract });
|
|
262
|
-
this.signer = signer;
|
|
263
|
-
}
|
|
264
|
-
else if ((0, smartweave_js_1.isContractTxIdConfiguration)(config)) {
|
|
265
|
-
super({
|
|
266
|
-
contract: new index_js_1.WarpContract({
|
|
267
|
-
contractTxId: config.contractTxId,
|
|
268
|
-
}),
|
|
269
|
-
});
|
|
270
|
-
this.signer = signer;
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
throw new index_js_1.InvalidContractConfigurationError();
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* @param target @type {string} The address of the account you want to transfer the ANT to.
|
|
278
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
279
|
-
* @example
|
|
280
|
-
* ```ts
|
|
281
|
-
* ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
282
|
-
* ```
|
|
283
|
-
*/
|
|
284
|
-
async transfer({ target, }, options) {
|
|
285
|
-
return this.contract.writeInteraction({
|
|
286
|
-
functionName: types_js_1.ANT_CONTRACT_FUNCTIONS.TRANSFER,
|
|
287
|
-
inputs: { target },
|
|
288
|
-
signer: this.signer,
|
|
289
|
-
}, options);
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* @param controller @type {string} The address of the account you want to set as a controller.
|
|
293
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
294
|
-
* @example
|
|
295
|
-
* ```ts
|
|
296
|
-
* ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
297
|
-
* ```
|
|
298
|
-
*/
|
|
299
|
-
async setController({ controller, }, options) {
|
|
300
|
-
return this.contract.writeInteraction({
|
|
301
|
-
functionName: types_js_1.ANT_CONTRACT_FUNCTIONS.SET_CONTROLLER,
|
|
302
|
-
inputs: { target: controller },
|
|
303
|
-
signer: this.signer,
|
|
304
|
-
}, options);
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* @param controller @type {string} The address of the account you want to remove from the controllers list
|
|
308
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
309
|
-
* @example
|
|
310
|
-
* ```ts
|
|
311
|
-
* ant.removeController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
312
|
-
* ```
|
|
313
|
-
*/
|
|
314
|
-
async removeController({ controller, }, options) {
|
|
315
|
-
return this.contract.writeInteraction({
|
|
316
|
-
functionName: types_js_1.ANT_CONTRACT_FUNCTIONS.REMOVE_CONTROLLER,
|
|
317
|
-
inputs: { target: controller },
|
|
318
|
-
signer: this.signer,
|
|
319
|
-
}, options);
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* @param subDomain @type {string} The record you want to set the transactionId and ttlSeconds of.
|
|
323
|
-
* @param transactionId @type {string} The transactionId of the record.
|
|
324
|
-
* @param ttlSeconds @type {number} The time to live of the record.
|
|
325
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
326
|
-
* @example
|
|
327
|
-
* ```ts
|
|
328
|
-
* ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
|
-
async setRecord({ subDomain, transactionId, ttlSeconds, }, options) {
|
|
332
|
-
return this.contract.writeInteraction({
|
|
333
|
-
functionName: types_js_1.ANT_CONTRACT_FUNCTIONS.SET_RECORD,
|
|
334
|
-
inputs: { subDomain, transactionId, ttlSeconds },
|
|
335
|
-
signer: this.signer,
|
|
336
|
-
}, options);
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* @param subDomain @type {string} The record you want to remove.
|
|
340
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
341
|
-
* @example
|
|
342
|
-
* ```ts
|
|
343
|
-
* ant.removeRecord({ subDomain: "shorts" });
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
async removeRecord({ subDomain, }, options) {
|
|
347
|
-
return this.contract.writeInteraction({
|
|
348
|
-
functionName: types_js_1.ANT_CONTRACT_FUNCTIONS.REMOVE_RECORD,
|
|
349
|
-
inputs: { subDomain },
|
|
350
|
-
signer: this.signer,
|
|
351
|
-
}, options);
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* @param ticker @type {string} Sets the ANT Ticker.
|
|
355
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
356
|
-
* @example
|
|
357
|
-
* ```ts
|
|
358
|
-
* ant.setTicker({ ticker: "KAPOW" });
|
|
359
|
-
* ```
|
|
360
|
-
*/
|
|
361
|
-
async setTicker({ ticker, }, options) {
|
|
362
|
-
return this.contract.writeInteraction({
|
|
363
|
-
functionName: types_js_1.ANT_CONTRACT_FUNCTIONS.SET_TICKER,
|
|
364
|
-
inputs: { ticker },
|
|
365
|
-
signer: this.signer,
|
|
366
|
-
}, options);
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* @param name @type {string} Sets the Name of the ANT.
|
|
370
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
371
|
-
* @example
|
|
372
|
-
* ```ts
|
|
373
|
-
* ant.setName({ name: "ships at sea" });
|
|
374
|
-
* ```
|
|
375
|
-
*/
|
|
376
|
-
async setName({ name }, options) {
|
|
377
|
-
return this.contract.writeInteraction({
|
|
378
|
-
functionName: types_js_1.ANT_CONTRACT_FUNCTIONS.SET_NAME,
|
|
379
|
-
inputs: { name },
|
|
380
|
-
signer: this.signer,
|
|
381
|
-
}, options);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
exports.ANTWritable = ANTWritable;
|
package/lib/cjs/common/index.js
CHANGED
|
@@ -30,13 +30,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
* You should have received a copy of the GNU Affero General Public License
|
|
31
31
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
32
|
*/
|
|
33
|
-
__exportStar(require("./ar-io.js"), exports);
|
|
34
33
|
__exportStar(require("./error.js"), exports);
|
|
35
34
|
__exportStar(require("./logger.js"), exports);
|
|
36
35
|
__exportStar(require("./ant.js"), exports);
|
|
37
|
-
// contracts - deprecated
|
|
38
|
-
__exportStar(require("./contracts/remote-contract.js"), exports);
|
|
39
|
-
__exportStar(require("./contracts/warp-contract.js"), exports);
|
|
40
36
|
// ao
|
|
41
37
|
__exportStar(require("./io.js"), exports);
|
|
42
38
|
__exportStar(require("./ant-ao.js"), exports);
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -42,10 +42,10 @@ exports.IO = IO;
|
|
|
42
42
|
class IOReadable {
|
|
43
43
|
process;
|
|
44
44
|
arweave;
|
|
45
|
-
constructor(config, arweave = arweave_1.default
|
|
45
|
+
constructor(config, arweave = new arweave_1.default({})) {
|
|
46
46
|
if (!config) {
|
|
47
47
|
this.process = new ao_process_js_1.AOProcess({
|
|
48
|
-
processId: constants_js_1.
|
|
48
|
+
processId: constants_js_1.IO_TESTNET_PROCESS_ID,
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
else if ((0, io_js_1.isProcessConfiguration)(config)) {
|
|
@@ -297,7 +297,7 @@ class IOWriteable extends IOReadable {
|
|
|
297
297
|
if (Object.keys(config).length === 0) {
|
|
298
298
|
super({
|
|
299
299
|
process: new ao_process_js_1.AOProcess({
|
|
300
|
-
processId: constants_js_1.
|
|
300
|
+
processId: constants_js_1.IO_TESTNET_PROCESS_ID,
|
|
301
301
|
}),
|
|
302
302
|
});
|
|
303
303
|
this.signer = signer;
|
package/lib/cjs/types.js
CHANGED
|
@@ -30,7 +30,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
* You should have received a copy of the GNU Affero General Public License
|
|
31
31
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
32
|
*/
|
|
33
|
-
__exportStar(require("./arns-service.js"), exports);
|
|
34
33
|
__exportStar(require("./contract-state.js"), exports);
|
|
35
34
|
__exportStar(require("./common.js"), exports);
|
|
36
35
|
__exportStar(require("./token.js"), exports);
|
package/lib/cjs/utils/arweave.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isBlockHeight = exports.validateArweaveId = void 0;
|
|
4
4
|
const constants_js_1 = require("../constants.js");
|
|
5
5
|
const validateArweaveId = (id) => {
|
|
6
6
|
return constants_js_1.ARWEAVE_TX_REGEX.test(id);
|
|
@@ -10,17 +10,3 @@ function isBlockHeight(height) {
|
|
|
10
10
|
return height !== undefined && !isNaN(parseInt(height.toString()));
|
|
11
11
|
}
|
|
12
12
|
exports.isBlockHeight = isBlockHeight;
|
|
13
|
-
const isTransaction = (tx) => {
|
|
14
|
-
const requiredTxKeys = ['id', 'owner', 'tags', 'signature'];
|
|
15
|
-
return requiredTxKeys.every((key) => key in tx);
|
|
16
|
-
};
|
|
17
|
-
exports.isTransaction = isTransaction;
|
|
18
|
-
function tagsToObject(tags) {
|
|
19
|
-
return tags.reduce((decodedTags, tag) => {
|
|
20
|
-
const key = tag.get('name', { decode: true, string: true });
|
|
21
|
-
const value = tag.get('value', { decode: true, string: true });
|
|
22
|
-
decodedTags[key] = value;
|
|
23
|
-
return decodedTags;
|
|
24
|
-
}, {});
|
|
25
|
-
}
|
|
26
|
-
exports.tagsToObject = tagsToObject;
|
|
@@ -30,5 +30,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
* You should have received a copy of the GNU Affero General Public License
|
|
31
31
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
32
|
*/
|
|
33
|
-
__exportStar(require("./smartweave.js"), exports);
|
|
34
33
|
__exportStar(require("./processes.js"), exports);
|
|
@@ -23,7 +23,7 @@ const ant_js_1 = require("../../common/ant.js");
|
|
|
23
23
|
const io_js_1 = require("../../common/io.js");
|
|
24
24
|
const constants_js_1 = require("../../constants.js");
|
|
25
25
|
const getANTProcessesOwnedByWallet = async ({ address, contract = io_js_1.IO.init({
|
|
26
|
-
processId: constants_js_1.
|
|
26
|
+
processId: constants_js_1.IO_TESTNET_PROCESS_ID,
|
|
27
27
|
}), }) => {
|
|
28
28
|
const throttle = (0, plimit_lit_1.pLimit)(50);
|
|
29
29
|
// get the record names of the registry - TODO: this may need to be paginated
|
|
@@ -71,7 +71,7 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
|
|
|
71
71
|
timeoutMs; // timeout for each request to 3 seconds
|
|
72
72
|
throttle;
|
|
73
73
|
constructor({ contract = io_js_1.IO.init({
|
|
74
|
-
processId: constants_js_1.
|
|
74
|
+
processId: constants_js_1.IO_TESTNET_PROCESS_ID,
|
|
75
75
|
}), timeoutMs = 60_000, concurrency = 30, }) {
|
|
76
76
|
super();
|
|
77
77
|
this.contract = contract;
|
package/lib/cjs/utils/index.js
CHANGED
|
@@ -32,7 +32,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
*/
|
|
33
33
|
__exportStar(require("./arweave.js"), exports);
|
|
34
34
|
__exportStar(require("./http-client.js"), exports);
|
|
35
|
-
__exportStar(require("./smartweave.js"), exports);
|
|
36
35
|
__exportStar(require("./graphql/index.js"), exports);
|
|
37
36
|
__exportStar(require("./ao.js"), exports);
|
|
38
37
|
__exportStar(require("./json.js"), exports);
|
package/lib/cjs/version.js
CHANGED