@ar.io/sdk 1.2.2 → 2.0.0-alpha.10
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 +148 -60
- package/bundles/web.bundle.min.js +132 -331
- package/lib/cjs/common/ant.js +147 -206
- package/lib/cjs/common/contracts/ao-process.js +1 -1
- package/lib/cjs/common/http.js +1 -2
- package/lib/cjs/common/index.js +0 -5
- package/lib/cjs/common/io.js +39 -31
- package/lib/cjs/common/logger.js +31 -19
- package/lib/cjs/types.js +0 -1
- package/lib/cjs/utils/arweave.js +1 -15
- package/lib/cjs/utils/http-client.js +1 -1
- package/lib/cjs/utils/index.js +1 -2
- package/lib/cjs/utils/{graphql/processes.js → processes.js} +35 -10
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +144 -203
- package/lib/esm/common/contracts/ao-process.js +2 -2
- package/lib/esm/common/http.js +2 -3
- package/lib/esm/common/index.js +0 -5
- package/lib/esm/common/io.js +39 -28
- package/lib/esm/common/logger.js +29 -14
- package/lib/esm/types.js +0 -1
- package/lib/esm/utils/arweave.js +0 -12
- package/lib/esm/utils/http-client.js +2 -2
- package/lib/esm/utils/index.js +1 -2
- package/lib/esm/utils/{graphql/processes.js → processes.js} +33 -9
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +53 -175
- package/lib/types/common/contracts/ao-process.d.ts +2 -2
- package/lib/types/common/http.d.ts +3 -2
- package/lib/types/common/index.d.ts +0 -4
- package/lib/types/common/io.d.ts +5 -4
- package/lib/types/common/logger.d.ts +10 -3
- package/lib/types/common.d.ts +1 -145
- package/lib/types/io.d.ts +28 -3
- package/lib/types/types.d.ts +0 -1
- package/lib/types/utils/arweave.d.ts +0 -5
- package/lib/types/utils/http-client.d.ts +2 -2
- package/lib/types/utils/index.d.ts +1 -2
- package/lib/types/utils/{graphql/processes.d.ts → processes.d.ts} +4 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +8 -13
- package/lib/cjs/arns-service.js +0 -2
- package/lib/cjs/common/ant-ao.js +0 -297
- 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/index.js +0 -34
- 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/ant-ao.js +0 -292
- 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/index.js +0 -18
- 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/ant-ao.d.ts +0 -194
- 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/index.d.ts +0 -18
- 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.AoANTWriteable = exports.AoANTReadable = exports.ANT = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -18,222 +18,150 @@ 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) {
|
|
64
|
-
return new
|
|
27
|
+
return new AoANTReadable(config);
|
|
65
28
|
}
|
|
66
|
-
return new
|
|
29
|
+
return new AoANTWriteable({ signer, ...config });
|
|
67
30
|
}
|
|
68
31
|
throw new index_js_1.InvalidContractConfigurationError();
|
|
69
32
|
}
|
|
70
33
|
}
|
|
71
34
|
exports.ANT = ANT;
|
|
72
|
-
class
|
|
73
|
-
|
|
35
|
+
class AoANTReadable {
|
|
36
|
+
process;
|
|
74
37
|
constructor(config) {
|
|
75
|
-
if ((0,
|
|
76
|
-
this.
|
|
38
|
+
if ((0, types_js_1.isProcessConfiguration)(config)) {
|
|
39
|
+
this.process = config.process;
|
|
77
40
|
}
|
|
78
|
-
else if ((0,
|
|
79
|
-
this.
|
|
80
|
-
|
|
41
|
+
else if ((0, types_js_1.isProcessIdConfiguration)(config)) {
|
|
42
|
+
this.process = new index_js_1.AOProcess({
|
|
43
|
+
processId: config.processId,
|
|
81
44
|
});
|
|
82
45
|
}
|
|
83
46
|
else {
|
|
84
47
|
throw new index_js_1.InvalidContractConfigurationError();
|
|
85
48
|
}
|
|
86
49
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*/
|
|
101
|
-
async getState({ evaluationOptions, } = {}) {
|
|
102
|
-
const state = await this.contract.getState({ evaluationOptions });
|
|
103
|
-
return state;
|
|
50
|
+
async getState() {
|
|
51
|
+
const tags = [{ name: 'Action', value: 'State' }];
|
|
52
|
+
const res = await this.process.read({
|
|
53
|
+
tags,
|
|
54
|
+
});
|
|
55
|
+
return res;
|
|
56
|
+
}
|
|
57
|
+
async getInfo() {
|
|
58
|
+
const tags = [{ name: 'Action', value: 'Info' }];
|
|
59
|
+
const info = await this.process.read({
|
|
60
|
+
tags,
|
|
61
|
+
});
|
|
62
|
+
return info;
|
|
104
63
|
}
|
|
105
64
|
/**
|
|
106
|
-
* @param
|
|
107
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
65
|
+
* @param undername @type {string} The domain name.
|
|
108
66
|
* @returns {Promise<ANTRecord>} The record of the undername domain.
|
|
109
67
|
* @example
|
|
110
68
|
* Get the current record
|
|
111
69
|
* ```ts
|
|
112
|
-
* ant.getRecord({
|
|
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' } } });
|
|
70
|
+
* ant.getRecord({ undername: "john" });
|
|
118
71
|
* ```
|
|
119
72
|
*/
|
|
120
|
-
async getRecord({
|
|
121
|
-
const
|
|
122
|
-
|
|
73
|
+
async getRecord({ undername }) {
|
|
74
|
+
const tags = [
|
|
75
|
+
{ name: 'Sub-Domain', value: undername },
|
|
76
|
+
{ name: 'Action', value: 'Record' },
|
|
77
|
+
];
|
|
78
|
+
const record = await this.process.read({
|
|
79
|
+
tags,
|
|
80
|
+
});
|
|
81
|
+
return record;
|
|
123
82
|
}
|
|
124
83
|
/**
|
|
125
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
126
84
|
* @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
|
|
127
85
|
* @example
|
|
128
86
|
* Get the current records
|
|
129
87
|
* ```ts
|
|
130
88
|
* 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
|
-
* ```
|
|
89
|
+
* ````
|
|
137
90
|
*/
|
|
138
|
-
async getRecords(
|
|
139
|
-
const
|
|
140
|
-
|
|
91
|
+
async getRecords() {
|
|
92
|
+
const tags = [{ name: 'Action', value: 'Records' }];
|
|
93
|
+
const records = await this.process.read({
|
|
94
|
+
tags,
|
|
95
|
+
});
|
|
96
|
+
return records;
|
|
141
97
|
}
|
|
142
98
|
/**
|
|
143
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
144
99
|
* @returns {Promise<string>} The owner of the ANT.
|
|
145
100
|
* @example
|
|
146
101
|
* Get the current owner
|
|
147
102
|
* ```ts
|
|
148
103
|
* ant.getOwner();
|
|
149
104
|
* ```
|
|
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
105
|
*/
|
|
156
|
-
async getOwner(
|
|
157
|
-
const
|
|
158
|
-
return
|
|
106
|
+
async getOwner() {
|
|
107
|
+
const info = await this.getInfo();
|
|
108
|
+
return info.Owner;
|
|
159
109
|
}
|
|
160
110
|
/**
|
|
161
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
162
111
|
* @returns {Promise<string[]>} The controllers of the ANT.
|
|
163
112
|
* @example
|
|
164
113
|
* Get the controllers of the ANT.
|
|
165
114
|
* ```ts
|
|
166
115
|
* ant.getControllers();
|
|
167
116
|
* ```
|
|
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
117
|
*/
|
|
174
|
-
async getControllers(
|
|
175
|
-
const
|
|
176
|
-
|
|
118
|
+
async getControllers() {
|
|
119
|
+
const tags = [{ name: 'Action', value: 'Controllers' }];
|
|
120
|
+
const controllers = await this.process.read({
|
|
121
|
+
tags,
|
|
122
|
+
});
|
|
123
|
+
return controllers;
|
|
177
124
|
}
|
|
178
125
|
/**
|
|
179
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
180
126
|
* @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
|
|
181
127
|
* @example
|
|
182
128
|
* Get the current name
|
|
183
129
|
* ```ts
|
|
184
130
|
* ant.getName();
|
|
185
131
|
* ```
|
|
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
132
|
*/
|
|
193
|
-
async getName(
|
|
194
|
-
const
|
|
195
|
-
return
|
|
133
|
+
async getName() {
|
|
134
|
+
const info = await this.getInfo();
|
|
135
|
+
return info.Name;
|
|
196
136
|
}
|
|
197
137
|
/**
|
|
198
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
199
138
|
* @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
|
|
200
139
|
* @example
|
|
201
140
|
* The current ticker of the ANT.
|
|
202
141
|
* ```ts
|
|
203
142
|
* ant.getTicker();
|
|
204
143
|
* ```
|
|
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
144
|
*/
|
|
212
|
-
async getTicker(
|
|
213
|
-
const
|
|
214
|
-
return
|
|
145
|
+
async getTicker() {
|
|
146
|
+
const info = await this.getInfo();
|
|
147
|
+
return info.Ticker;
|
|
215
148
|
}
|
|
216
149
|
/**
|
|
217
|
-
* @
|
|
218
|
-
* @returns {Promise<Record<string, number>>} The balances of the ANT
|
|
150
|
+
* @returns {Promise<Record<WalletAddress, number>>} The balances of the ANT
|
|
219
151
|
* @example
|
|
220
152
|
* The current balances of the ANT.
|
|
221
153
|
* ```ts
|
|
222
154
|
* ant.getBalances();
|
|
223
155
|
* ```
|
|
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
156
|
*/
|
|
231
|
-
async getBalances(
|
|
232
|
-
const
|
|
233
|
-
|
|
157
|
+
async getBalances() {
|
|
158
|
+
const tags = [{ name: 'Action', value: 'Balances' }];
|
|
159
|
+
const balances = await this.process.read({
|
|
160
|
+
tags,
|
|
161
|
+
});
|
|
162
|
+
return balances;
|
|
234
163
|
}
|
|
235
164
|
/**
|
|
236
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
237
165
|
* @param address @type {string} The address of the account you want the balance of.
|
|
238
166
|
* @returns {Promise<number>} The balance of the provided address
|
|
239
167
|
* @example
|
|
@@ -241,144 +169,157 @@ class ANTReadable {
|
|
|
241
169
|
* ```ts
|
|
242
170
|
* ant.getBalance({ address });
|
|
243
171
|
* ```
|
|
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
172
|
*/
|
|
251
|
-
async getBalance({ address
|
|
252
|
-
const
|
|
253
|
-
|
|
173
|
+
async getBalance({ address }) {
|
|
174
|
+
const tags = [
|
|
175
|
+
{ name: 'Action', value: 'Balance' },
|
|
176
|
+
{ name: 'Recipient', value: address },
|
|
177
|
+
];
|
|
178
|
+
const balance = await this.process.read({
|
|
179
|
+
tags,
|
|
180
|
+
});
|
|
181
|
+
return balance;
|
|
254
182
|
}
|
|
255
183
|
}
|
|
256
|
-
exports.
|
|
257
|
-
class
|
|
184
|
+
exports.AoANTReadable = AoANTReadable;
|
|
185
|
+
class AoANTWriteable extends AoANTReadable {
|
|
258
186
|
signer;
|
|
259
187
|
constructor({ signer, ...config }) {
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
}
|
|
188
|
+
super(config);
|
|
189
|
+
this.signer = signer;
|
|
275
190
|
}
|
|
276
191
|
/**
|
|
277
192
|
* @param target @type {string} The address of the account you want to transfer the ANT to.
|
|
278
|
-
* @returns {Promise<
|
|
193
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
279
194
|
* @example
|
|
280
195
|
* ```ts
|
|
281
196
|
* ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
282
197
|
* ```
|
|
283
198
|
*/
|
|
284
|
-
async transfer({ target
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
199
|
+
async transfer({ target }) {
|
|
200
|
+
const tags = [
|
|
201
|
+
{ name: 'Action', value: 'Transfer' },
|
|
202
|
+
{ name: 'Recipient', value: target },
|
|
203
|
+
];
|
|
204
|
+
return this.process.send({
|
|
205
|
+
tags,
|
|
206
|
+
data: {},
|
|
288
207
|
signer: this.signer,
|
|
289
|
-
}
|
|
208
|
+
});
|
|
290
209
|
}
|
|
291
210
|
/**
|
|
292
211
|
* @param controller @type {string} The address of the account you want to set as a controller.
|
|
293
|
-
* @returns {Promise<
|
|
212
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
294
213
|
* @example
|
|
295
214
|
* ```ts
|
|
296
215
|
* ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
297
216
|
* ```
|
|
298
217
|
*/
|
|
299
|
-
async
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
218
|
+
async addController({ controller, }) {
|
|
219
|
+
const tags = [
|
|
220
|
+
{ name: 'Action', value: 'Add-Controller' },
|
|
221
|
+
{ name: 'Controller', value: controller },
|
|
222
|
+
];
|
|
223
|
+
return this.process.send({
|
|
224
|
+
tags,
|
|
225
|
+
data: {},
|
|
303
226
|
signer: this.signer,
|
|
304
|
-
}
|
|
227
|
+
});
|
|
305
228
|
}
|
|
306
229
|
/**
|
|
307
230
|
* @param controller @type {string} The address of the account you want to remove from the controllers list
|
|
308
|
-
* @returns {Promise<
|
|
231
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
309
232
|
* @example
|
|
310
233
|
* ```ts
|
|
311
234
|
* ant.removeController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
312
235
|
* ```
|
|
313
236
|
*/
|
|
314
|
-
async removeController({ controller, }
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
237
|
+
async removeController({ controller, }) {
|
|
238
|
+
const tags = [
|
|
239
|
+
{ name: 'Action', value: 'Remove-Controller' },
|
|
240
|
+
{ name: 'Controller', value: controller },
|
|
241
|
+
];
|
|
242
|
+
return this.process.send({
|
|
243
|
+
tags,
|
|
244
|
+
data: {},
|
|
318
245
|
signer: this.signer,
|
|
319
|
-
}
|
|
246
|
+
});
|
|
320
247
|
}
|
|
321
248
|
/**
|
|
322
|
-
* @param
|
|
249
|
+
* @param undername @type {string} The record you want to set the transactionId and ttlSeconds of.
|
|
323
250
|
* @param transactionId @type {string} The transactionId of the record.
|
|
324
251
|
* @param ttlSeconds @type {number} The time to live of the record.
|
|
325
|
-
* @returns {Promise<
|
|
252
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
326
253
|
* @example
|
|
327
254
|
* ```ts
|
|
328
255
|
* ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
329
256
|
* ```
|
|
330
257
|
*/
|
|
331
|
-
async setRecord({
|
|
332
|
-
return this.
|
|
333
|
-
|
|
334
|
-
|
|
258
|
+
async setRecord({ undername, transactionId, ttlSeconds, }) {
|
|
259
|
+
return this.process.send({
|
|
260
|
+
tags: [
|
|
261
|
+
{ name: 'Action', value: 'Set-Record' },
|
|
262
|
+
{ name: 'Sub-Domain', value: undername },
|
|
263
|
+
{ name: 'Transaction-Id', value: transactionId },
|
|
264
|
+
{ name: 'TTL-Seconds', value: ttlSeconds.toString() },
|
|
265
|
+
],
|
|
266
|
+
data: { transactionId, ttlSeconds },
|
|
335
267
|
signer: this.signer,
|
|
336
|
-
}
|
|
268
|
+
});
|
|
337
269
|
}
|
|
338
270
|
/**
|
|
339
|
-
* @param
|
|
340
|
-
* @returns {Promise<
|
|
271
|
+
* @param undername @type {string} The record you want to remove.
|
|
272
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
341
273
|
* @example
|
|
342
274
|
* ```ts
|
|
343
275
|
* ant.removeRecord({ subDomain: "shorts" });
|
|
344
276
|
* ```
|
|
345
277
|
*/
|
|
346
|
-
async removeRecord({
|
|
347
|
-
return this.
|
|
348
|
-
|
|
349
|
-
|
|
278
|
+
async removeRecord({ undername, }) {
|
|
279
|
+
return this.process.send({
|
|
280
|
+
tags: [
|
|
281
|
+
{ name: 'Action', value: 'Remove-Record' },
|
|
282
|
+
{ name: 'Sub-Domain', value: undername },
|
|
283
|
+
],
|
|
284
|
+
data: { undername },
|
|
350
285
|
signer: this.signer,
|
|
351
|
-
}
|
|
286
|
+
});
|
|
352
287
|
}
|
|
353
288
|
/**
|
|
354
289
|
* @param ticker @type {string} Sets the ANT Ticker.
|
|
355
|
-
* @returns {Promise<
|
|
290
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
356
291
|
* @example
|
|
357
292
|
* ```ts
|
|
358
293
|
* ant.setTicker({ ticker: "KAPOW" });
|
|
359
294
|
* ```
|
|
360
295
|
*/
|
|
361
|
-
async setTicker({ ticker
|
|
362
|
-
return this.
|
|
363
|
-
|
|
364
|
-
|
|
296
|
+
async setTicker({ ticker }) {
|
|
297
|
+
return this.process.send({
|
|
298
|
+
tags: [
|
|
299
|
+
{ name: 'Action', value: 'Set-Ticker' },
|
|
300
|
+
{ name: 'Ticker', value: ticker },
|
|
301
|
+
],
|
|
302
|
+
data: { ticker },
|
|
365
303
|
signer: this.signer,
|
|
366
|
-
}
|
|
304
|
+
});
|
|
367
305
|
}
|
|
368
306
|
/**
|
|
369
307
|
* @param name @type {string} Sets the Name of the ANT.
|
|
370
|
-
* @returns {Promise<
|
|
308
|
+
* @returns {Promise<AoMessageResult>} The result of the interaction.
|
|
371
309
|
* @example
|
|
372
310
|
* ```ts
|
|
373
311
|
* ant.setName({ name: "ships at sea" });
|
|
374
312
|
* ```
|
|
375
313
|
*/
|
|
376
|
-
async setName({ name }
|
|
377
|
-
return this.
|
|
378
|
-
|
|
379
|
-
|
|
314
|
+
async setName({ name }) {
|
|
315
|
+
return this.process.send({
|
|
316
|
+
tags: [
|
|
317
|
+
{ name: 'Action', value: 'Set-Name' },
|
|
318
|
+
{ name: 'Name', value: name },
|
|
319
|
+
],
|
|
320
|
+
data: { name },
|
|
380
321
|
signer: this.signer,
|
|
381
|
-
}
|
|
322
|
+
});
|
|
382
323
|
}
|
|
383
324
|
}
|
|
384
|
-
exports.
|
|
325
|
+
exports.AoANTWriteable = AoANTWriteable;
|
|
@@ -27,7 +27,7 @@ class AOProcess {
|
|
|
27
27
|
logger;
|
|
28
28
|
processId;
|
|
29
29
|
ao;
|
|
30
|
-
constructor({ processId, ao = (0, aoconnect_1.connect)(), logger =
|
|
30
|
+
constructor({ processId, ao = (0, aoconnect_1.connect)(), logger = logger_js_1.Logger.default, }) {
|
|
31
31
|
this.processId = processId;
|
|
32
32
|
this.logger = logger;
|
|
33
33
|
this.ao = ao;
|
package/lib/cjs/common/http.js
CHANGED
|
@@ -7,8 +7,7 @@ const logger_js_1 = require("./logger.js");
|
|
|
7
7
|
class AxiosHTTPService {
|
|
8
8
|
axios;
|
|
9
9
|
logger;
|
|
10
|
-
|
|
11
|
-
constructor({ url, logger = new logger_js_1.DefaultLogger(), }) {
|
|
10
|
+
constructor({ url, logger = logger_js_1.Logger.default, }) {
|
|
12
11
|
this.logger = logger;
|
|
13
12
|
this.axios = (0, index_js_1.createAxiosInstance)({
|
|
14
13
|
axiosConfig: {
|
package/lib/cjs/common/index.js
CHANGED
|
@@ -30,14 +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
|
-
__exportStar(require("./ant-ao.js"), exports);
|
|
43
38
|
__exportStar(require("./contracts/ao-process.js"), exports);
|