@ar.io/sdk 1.2.1 → 2.0.0-alpha.2
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 +132 -331
- package/lib/cjs/common/ant.js +1 -351
- package/lib/cjs/common/index.js +0 -4
- package/lib/cjs/common/io.js +1 -1
- package/lib/cjs/common/logger.js +27 -15
- 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/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 +1 -1
- package/lib/esm/common/logger.js +27 -12
- 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/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/logger.d.ts +2 -2
- 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
|
@@ -14,24 +14,8 @@
|
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
18
|
-
import { RemoteContract } from './contracts/remote-contract.js';
|
|
19
|
-
import { WarpContract } from './index.js';
|
|
17
|
+
import { AoANTRead, AoANTWrite, ProcessConfiguration, WithSigner } from '../types.js';
|
|
20
18
|
export declare class ANT {
|
|
21
|
-
/**
|
|
22
|
-
* @param config - @type {ContractConfiguration} The configuration object.
|
|
23
|
-
* @returns {WarpContract<ANTState>} The contract object.
|
|
24
|
-
* @example
|
|
25
|
-
* Using the contract object
|
|
26
|
-
* ```ts
|
|
27
|
-
* ANT.createContract({ contract: new WarpContract<ANTState>({ contractTxId: 'myContractTxId' });
|
|
28
|
-
* ```
|
|
29
|
-
* Using the contractTxId
|
|
30
|
-
* ```ts
|
|
31
|
-
* ANT.createContract({ contractTxId: 'myContractTxId' });
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
static createWriteableContract(config: Required<ContractConfiguration<ANTState>>): WarpContract<ANTState>;
|
|
35
19
|
/**
|
|
36
20
|
* Initializes an ANT instance.
|
|
37
21
|
*
|
|
@@ -56,265 +40,8 @@ export declare class ANT {
|
|
|
56
40
|
* const readable = ANT.init({ contract: myContract });
|
|
57
41
|
* ```
|
|
58
42
|
*/
|
|
59
|
-
static init(config: Required<ContractConfiguration<ANTState>>): ANTReadable;
|
|
60
|
-
static init({ signer, ...config }: WithSigner<{
|
|
61
|
-
contract: WarpContract<ANTState>;
|
|
62
|
-
} | {
|
|
63
|
-
contractTxId: string;
|
|
64
|
-
}>): ANTWritable;
|
|
65
43
|
static init(config: Required<ProcessConfiguration> & {
|
|
66
44
|
signer?: undefined;
|
|
67
45
|
}): AoANTRead;
|
|
68
46
|
static init({ signer, ...config }: WithSigner<Required<ProcessConfiguration>>): AoANTWrite;
|
|
69
47
|
}
|
|
70
|
-
export declare class ANTReadable implements ANTReadContract {
|
|
71
|
-
protected contract: RemoteContract<ANTState> | WarpContract<ANTState>;
|
|
72
|
-
constructor(config: Required<ContractConfiguration<ANTState>>);
|
|
73
|
-
/**
|
|
74
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
75
|
-
* @returns {Promise<ANTState>} The state of the contract.
|
|
76
|
-
* @example
|
|
77
|
-
* Get the current state
|
|
78
|
-
* ```ts
|
|
79
|
-
* ant.getState();
|
|
80
|
-
* ```
|
|
81
|
-
* Get the state at a specific block height or sortkey
|
|
82
|
-
* ```ts
|
|
83
|
-
* ant.getState({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
84
|
-
* ant.getState({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
getState({ evaluationOptions, }?: EvaluationParameters): Promise<ANTState>;
|
|
88
|
-
/**
|
|
89
|
-
* @param domain @type {string} The domain name.
|
|
90
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
91
|
-
* @returns {Promise<ANTRecord>} The record of the undername domain.
|
|
92
|
-
* @example
|
|
93
|
-
* Get the current record
|
|
94
|
-
* ```ts
|
|
95
|
-
* ant.getRecord({ domain: "john" });
|
|
96
|
-
* ```
|
|
97
|
-
* Get the record at a specific block height or sortkey
|
|
98
|
-
* ```ts
|
|
99
|
-
* ant.getRecord({ domain: "john", evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
100
|
-
* ant.getRecord({ domain: "john", evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
getRecord({ domain, evaluationOptions, }: EvaluationParameters<{
|
|
104
|
-
domain: string;
|
|
105
|
-
}>): Promise<ANTRecord>;
|
|
106
|
-
/**
|
|
107
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
108
|
-
* @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
|
|
109
|
-
* @example
|
|
110
|
-
* Get the current records
|
|
111
|
-
* ```ts
|
|
112
|
-
* ant.getRecords();
|
|
113
|
-
* ```
|
|
114
|
-
* Get the records at a specific block height or sortkey
|
|
115
|
-
* ```ts
|
|
116
|
-
* ant.getRecords({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
117
|
-
* ant.getRecords({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
getRecords({ evaluationOptions, }?: {
|
|
121
|
-
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
|
|
122
|
-
}): Promise<Record<string, ANTRecord>>;
|
|
123
|
-
/**
|
|
124
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
125
|
-
* @returns {Promise<string>} The owner of the ANT.
|
|
126
|
-
* @example
|
|
127
|
-
* Get the current owner
|
|
128
|
-
* ```ts
|
|
129
|
-
* ant.getOwner();
|
|
130
|
-
* ```
|
|
131
|
-
* Get the owner at a specific block height or sortkey
|
|
132
|
-
* ```ts
|
|
133
|
-
* ant.getOwner({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
134
|
-
* ant.getOwner({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
getOwner({ evaluationOptions, }?: {
|
|
138
|
-
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
|
|
139
|
-
}): Promise<string>;
|
|
140
|
-
/**
|
|
141
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
142
|
-
* @returns {Promise<string[]>} The controllers of the ANT.
|
|
143
|
-
* @example
|
|
144
|
-
* Get the controllers of the ANT.
|
|
145
|
-
* ```ts
|
|
146
|
-
* ant.getControllers();
|
|
147
|
-
* ```
|
|
148
|
-
* Get the controllers at a specific block height or sortkey
|
|
149
|
-
* ```ts
|
|
150
|
-
* ant.getControllers({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
151
|
-
* ant.getControllers({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
getControllers({ evaluationOptions, }?: {
|
|
155
|
-
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
|
|
156
|
-
}): Promise<string[]>;
|
|
157
|
-
/**
|
|
158
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
159
|
-
* @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
|
|
160
|
-
* @example
|
|
161
|
-
* Get the current name
|
|
162
|
-
* ```ts
|
|
163
|
-
* ant.getName();
|
|
164
|
-
* ```
|
|
165
|
-
* @example
|
|
166
|
-
* Get the ticker at a specific block height or sortkey
|
|
167
|
-
* ```ts
|
|
168
|
-
* ant.getName({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
169
|
-
* ant.getName({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
170
|
-
* ```
|
|
171
|
-
*/
|
|
172
|
-
getName({ evaluationOptions, }?: {
|
|
173
|
-
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
|
|
174
|
-
}): Promise<string>;
|
|
175
|
-
/**
|
|
176
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
177
|
-
* @returns {Promise<string>} The name of the ANT (not the same as ArNS name).
|
|
178
|
-
* @example
|
|
179
|
-
* The current ticker of the ANT.
|
|
180
|
-
* ```ts
|
|
181
|
-
* ant.getTicker();
|
|
182
|
-
* ```
|
|
183
|
-
* @example
|
|
184
|
-
* Get the ticker at a specific block height or sortkey
|
|
185
|
-
* ```ts
|
|
186
|
-
* ant.getTicker({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
187
|
-
* ant.getTicker({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
getTicker({ evaluationOptions, }?: {
|
|
191
|
-
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
|
|
192
|
-
}): Promise<string>;
|
|
193
|
-
/**
|
|
194
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
195
|
-
* @returns {Promise<Record<string, number>>} The balances of the ANT
|
|
196
|
-
* @example
|
|
197
|
-
* The current balances of the ANT.
|
|
198
|
-
* ```ts
|
|
199
|
-
* ant.getBalances();
|
|
200
|
-
* ```
|
|
201
|
-
* @example
|
|
202
|
-
* Get the balances at a specific block height or sortkey
|
|
203
|
-
* ```ts
|
|
204
|
-
* ant.getBalances({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
205
|
-
* ant.getBalances({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
getBalances({ evaluationOptions, }?: {
|
|
209
|
-
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
|
|
210
|
-
}): Promise<Record<string, number>>;
|
|
211
|
-
/**
|
|
212
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
213
|
-
* @param address @type {string} The address of the account you want the balance of.
|
|
214
|
-
* @returns {Promise<number>} The balance of the provided address
|
|
215
|
-
* @example
|
|
216
|
-
* The current balance of the address.
|
|
217
|
-
* ```ts
|
|
218
|
-
* ant.getBalance({ address });
|
|
219
|
-
* ```
|
|
220
|
-
* @example
|
|
221
|
-
* Get the balance at a specific block height or sortkey
|
|
222
|
-
* ```ts
|
|
223
|
-
* ant.getBalance({ address, evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
224
|
-
* ant.getBalance({ address, evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
225
|
-
* ```
|
|
226
|
-
*/
|
|
227
|
-
getBalance({ address, evaluationOptions, }: EvaluationParameters<{
|
|
228
|
-
address: string;
|
|
229
|
-
}>): Promise<number>;
|
|
230
|
-
}
|
|
231
|
-
export declare class ANTWritable extends ANTReadable {
|
|
232
|
-
protected contract: WarpContract<ANTState>;
|
|
233
|
-
private signer;
|
|
234
|
-
constructor({ signer, ...config }: WithSigner<{
|
|
235
|
-
contract: WarpContract<ANTState>;
|
|
236
|
-
} | {
|
|
237
|
-
contractTxId: string;
|
|
238
|
-
}>);
|
|
239
|
-
/**
|
|
240
|
-
* @param target @type {string} The address of the account you want to transfer the ANT to.
|
|
241
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
242
|
-
* @example
|
|
243
|
-
* ```ts
|
|
244
|
-
* ant.transfer({ target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
245
|
-
* ```
|
|
246
|
-
*/
|
|
247
|
-
transfer({ target, }: {
|
|
248
|
-
target: string;
|
|
249
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
250
|
-
/**
|
|
251
|
-
* @param controller @type {string} The address of the account you want to set as a controller.
|
|
252
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
253
|
-
* @example
|
|
254
|
-
* ```ts
|
|
255
|
-
* ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
256
|
-
* ```
|
|
257
|
-
*/
|
|
258
|
-
setController({ controller, }: {
|
|
259
|
-
controller: string;
|
|
260
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
261
|
-
/**
|
|
262
|
-
* @param controller @type {string} The address of the account you want to remove from the controllers list
|
|
263
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
264
|
-
* @example
|
|
265
|
-
* ```ts
|
|
266
|
-
* ant.removeController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
267
|
-
* ```
|
|
268
|
-
*/
|
|
269
|
-
removeController({ controller, }: {
|
|
270
|
-
controller: string;
|
|
271
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
272
|
-
/**
|
|
273
|
-
* @param subDomain @type {string} The record you want to set the transactionId and ttlSeconds of.
|
|
274
|
-
* @param transactionId @type {string} The transactionId of the record.
|
|
275
|
-
* @param ttlSeconds @type {number} The time to live of the record.
|
|
276
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
277
|
-
* @example
|
|
278
|
-
* ```ts
|
|
279
|
-
* ant.setController({ controller: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk" });
|
|
280
|
-
* ```
|
|
281
|
-
*/
|
|
282
|
-
setRecord({ subDomain, transactionId, ttlSeconds, }: {
|
|
283
|
-
subDomain: string;
|
|
284
|
-
transactionId: string;
|
|
285
|
-
ttlSeconds: number;
|
|
286
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
287
|
-
/**
|
|
288
|
-
* @param subDomain @type {string} The record you want to remove.
|
|
289
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
290
|
-
* @example
|
|
291
|
-
* ```ts
|
|
292
|
-
* ant.removeRecord({ subDomain: "shorts" });
|
|
293
|
-
* ```
|
|
294
|
-
*/
|
|
295
|
-
removeRecord({ subDomain, }: {
|
|
296
|
-
subDomain: string;
|
|
297
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
298
|
-
/**
|
|
299
|
-
* @param ticker @type {string} Sets the ANT Ticker.
|
|
300
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
301
|
-
* @example
|
|
302
|
-
* ```ts
|
|
303
|
-
* ant.setTicker({ ticker: "KAPOW" });
|
|
304
|
-
* ```
|
|
305
|
-
*/
|
|
306
|
-
setTicker({ ticker, }: {
|
|
307
|
-
ticker: string;
|
|
308
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
309
|
-
/**
|
|
310
|
-
* @param name @type {string} Sets the Name of the ANT.
|
|
311
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
312
|
-
* @example
|
|
313
|
-
* ```ts
|
|
314
|
-
* ant.setName({ name: "ships at sea" });
|
|
315
|
-
* ```
|
|
316
|
-
*/
|
|
317
|
-
setName({ name }: {
|
|
318
|
-
name: string;
|
|
319
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
320
|
-
}
|
|
@@ -14,12 +14,9 @@
|
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
|
-
export * from './ar-io.js';
|
|
18
17
|
export * from './error.js';
|
|
19
18
|
export * from './logger.js';
|
|
20
19
|
export * from './ant.js';
|
|
21
|
-
export * from './contracts/remote-contract.js';
|
|
22
|
-
export * from './contracts/warp-contract.js';
|
|
23
20
|
export * from './io.js';
|
|
24
21
|
export * from './ant-ao.js';
|
|
25
22
|
export * from './contracts/ao-process.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Logger } from '../types.js';
|
|
2
|
-
export declare class DefaultLogger implements
|
|
1
|
+
import { Logger as ILogger } from '../types.js';
|
|
2
|
+
export declare class DefaultLogger implements ILogger {
|
|
3
3
|
private logger;
|
|
4
4
|
private silent;
|
|
5
5
|
constructor({ level, }?: {
|
package/lib/types/common.d.ts
CHANGED
|
@@ -17,9 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { dryrun, message, monitor, result, results, spawn, unmonitor } from '@permaweb/aoconnect';
|
|
19
19
|
import { ArconnectSigner, ArweaveSigner } from 'arbundles';
|
|
20
|
-
import {
|
|
21
|
-
import { RemoteContract, WarpContract } from './common/index.js';
|
|
22
|
-
import { ANTRecord, ANTState, AllowedProtocols, ArIOState, ArNSAuctionData, ArNSNameData, ArNSReservedNameData, DENOMINATIONS, EpochDistributionData, Gateway, GatewayConnectionSettings, GatewayMetadata, GatewayStakingSettings, IOContractInteractionsWithIOFees, Observations, RegistrationType, WeightedObserver } from './contract-state.js';
|
|
20
|
+
import { AllowedProtocols, GatewayConnectionSettings, GatewayMetadata, GatewayStakingSettings } from './contract-state.js';
|
|
23
21
|
import { mIOToken } from './token.js';
|
|
24
22
|
export type BlockHeight = number;
|
|
25
23
|
export type SortKey = string;
|
|
@@ -27,7 +25,6 @@ export type Timestamp = number;
|
|
|
27
25
|
export type WalletAddress = string;
|
|
28
26
|
export type TransactionId = string;
|
|
29
27
|
export type ProcessId = string;
|
|
30
|
-
export type DataProtocolTransaction = Pick<GQLNodeInterface, 'id' | 'tags' | 'data'>;
|
|
31
28
|
export type ContractSigner = ArweaveSigner | ArconnectSigner;
|
|
32
29
|
export type WithSigner<T = NonNullable<unknown>> = {
|
|
33
30
|
signer: ContractSigner;
|
|
@@ -35,21 +32,6 @@ export type WithSigner<T = NonNullable<unknown>> = {
|
|
|
35
32
|
export type OptionalSigner<T = NonNullable<unknown>> = {
|
|
36
33
|
signer?: ContractSigner | undefined;
|
|
37
34
|
} & T;
|
|
38
|
-
export type ContractConfiguration<T = NonNullable<unknown>> = {
|
|
39
|
-
contract?: WarpContract<T> | RemoteContract<T>;
|
|
40
|
-
} | {
|
|
41
|
-
contractTxId?: string;
|
|
42
|
-
};
|
|
43
|
-
export type EvaluationOptions = {
|
|
44
|
-
evalTo?: {
|
|
45
|
-
sortKey: SortKey;
|
|
46
|
-
} | {
|
|
47
|
-
blockHeight: BlockHeight;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export type EvaluationParameters<T = NonNullable<unknown>> = {
|
|
51
|
-
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
|
|
52
|
-
} & T;
|
|
53
35
|
export type ReadParameters<Input> = {
|
|
54
36
|
functionName: string;
|
|
55
37
|
inputs?: Input;
|
|
@@ -61,89 +43,9 @@ export type WriteOptions = {
|
|
|
61
43
|
}[];
|
|
62
44
|
};
|
|
63
45
|
export type WriteParameters<Input> = WithSigner<Required<ReadParameters<Input>>>;
|
|
64
|
-
export interface BaseContract<T> {
|
|
65
|
-
getState(params: EvaluationParameters): Promise<T>;
|
|
66
|
-
}
|
|
67
|
-
export interface ReadContract {
|
|
68
|
-
readInteraction<Input, State>({ functionName, inputs, evaluationOptions, }: EvaluationParameters<ReadParameters<Input>>): Promise<State>;
|
|
69
|
-
}
|
|
70
|
-
export interface WriteContract {
|
|
71
|
-
writeInteraction<Input>({ functionName, inputs }: WriteParameters<Input>, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
72
|
-
}
|
|
73
|
-
export interface ArIOReadContract extends BaseContract<ArIOState> {
|
|
74
|
-
getGateway({ address, evaluationOptions, }: EvaluationParameters<{
|
|
75
|
-
address: WalletAddress;
|
|
76
|
-
}>): Promise<Gateway | undefined>;
|
|
77
|
-
getGateways(params?: EvaluationParameters): Promise<Record<WalletAddress, Gateway> | Record<string, never>>;
|
|
78
|
-
getBalance(params: {
|
|
79
|
-
address: WalletAddress;
|
|
80
|
-
} & EvaluationOptions): Promise<number>;
|
|
81
|
-
getBalances(params?: EvaluationParameters): Promise<Record<WalletAddress, number> | Record<string, never>>;
|
|
82
|
-
getArNSRecord({ domain, evaluationOptions, }: EvaluationParameters<{
|
|
83
|
-
domain: string;
|
|
84
|
-
}>): Promise<ArNSNameData | undefined>;
|
|
85
|
-
getArNSRecords(params?: EvaluationParameters): Promise<Record<string, ArNSNameData> | Record<string, never>>;
|
|
86
|
-
getArNSReservedNames(params?: EvaluationParameters): Promise<Record<string, ArNSReservedNameData> | Record<string, never>>;
|
|
87
|
-
getArNSReservedName({ domain, evaluationOptions, }: EvaluationParameters<{
|
|
88
|
-
domain: string;
|
|
89
|
-
}>): Promise<ArNSReservedNameData | undefined>;
|
|
90
|
-
getEpoch({ blockHeight, evaluationOptions, }: EvaluationParameters<{
|
|
91
|
-
blockHeight: number;
|
|
92
|
-
}>): Promise<EpochDistributionData>;
|
|
93
|
-
getCurrentEpoch(params?: EvaluationParameters): Promise<EpochDistributionData>;
|
|
94
|
-
getPrescribedObservers(params?: EvaluationParameters): Promise<WeightedObserver[]>;
|
|
95
|
-
getObservations(params?: EvaluationParameters): Promise<Observations>;
|
|
96
|
-
getDistributions(params?: EvaluationParameters): Promise<EpochDistributionData>;
|
|
97
|
-
getAuctions(params?: EvaluationParameters): Promise<Record<string, ArNSAuctionData>>;
|
|
98
|
-
getAuction({ domain, type, evaluationOptions, }: EvaluationParameters<{
|
|
99
|
-
domain: string;
|
|
100
|
-
type?: RegistrationType;
|
|
101
|
-
}>): Promise<ArNSAuctionData>;
|
|
102
|
-
getPriceForInteraction({ interactionName, payload, evaluationOptions, }: EvaluationParameters<{
|
|
103
|
-
interactionName: IOContractInteractionsWithIOFees;
|
|
104
|
-
payload: object;
|
|
105
|
-
}>): Promise<number>;
|
|
106
|
-
}
|
|
107
|
-
export interface ArIOWriteContract extends ArIOReadContract {
|
|
108
|
-
transfer({ target, qty, denomination, }: {
|
|
109
|
-
target: WalletAddress;
|
|
110
|
-
qty: number;
|
|
111
|
-
denomination: DENOMINATIONS;
|
|
112
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
113
|
-
joinNetwork({ qty, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerWallet, }: JoinNetworkParams, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
114
|
-
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerWallet, }: UpdateGatewaySettingsParams, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
115
|
-
increaseOperatorStake(params: {
|
|
116
|
-
qty: number | mIOToken;
|
|
117
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
118
|
-
decreaseOperatorStake(params: {
|
|
119
|
-
qty: number | mIOToken;
|
|
120
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
121
|
-
increaseDelegateStake(params: {
|
|
122
|
-
target: WalletAddress;
|
|
123
|
-
qty: number | mIOToken;
|
|
124
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
125
|
-
decreaseDelegateStake(params: {
|
|
126
|
-
target: WalletAddress;
|
|
127
|
-
qty: number | mIOToken;
|
|
128
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
129
|
-
saveObservations(params: {
|
|
130
|
-
reportTxId: TransactionId;
|
|
131
|
-
failedGateways: WalletAddress[];
|
|
132
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
133
|
-
extendLease(params: {
|
|
134
|
-
domain: string;
|
|
135
|
-
years: number;
|
|
136
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
137
|
-
increaseUndernameLimit(params: {
|
|
138
|
-
domain: string;
|
|
139
|
-
qty: number;
|
|
140
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
141
|
-
}
|
|
142
46
|
export type AoMessageResult = {
|
|
143
47
|
id: string;
|
|
144
48
|
};
|
|
145
|
-
export type SmartWeaveInteractionResult = Transaction;
|
|
146
|
-
export type WriteInteractionResult = SmartWeaveInteractionResult;
|
|
147
49
|
type Overwrite<T, U> = {
|
|
148
50
|
[K in keyof T]: K extends keyof U ? U[K] : T[K];
|
|
149
51
|
};
|
|
@@ -170,45 +72,6 @@ export type AtLeastOne<T, U = {
|
|
|
170
72
|
[K in keyof T]-?: Record<K, T[K]>;
|
|
171
73
|
}> = Partial<T> & U[keyof U];
|
|
172
74
|
export type UpdateGatewaySettingsParams = AtLeastOne<UpdateGatewaySettingsParamsBase>;
|
|
173
|
-
export interface ANTReadContract extends BaseContract<ANTState> {
|
|
174
|
-
getRecord({ domain, evaluationOptions, }: EvaluationParameters<{
|
|
175
|
-
domain: string;
|
|
176
|
-
}>): Promise<ANTRecord>;
|
|
177
|
-
getRecords(params?: EvaluationParameters): Promise<Record<string, ANTRecord>>;
|
|
178
|
-
getOwner(params?: EvaluationParameters): Promise<string>;
|
|
179
|
-
getControllers(params?: EvaluationParameters): Promise<string[]>;
|
|
180
|
-
getTicker(params?: EvaluationParameters): Promise<string>;
|
|
181
|
-
getName(params?: EvaluationParameters): Promise<string>;
|
|
182
|
-
getBalance({ address, evaluationOptions, }: EvaluationParameters<{
|
|
183
|
-
address: string;
|
|
184
|
-
}>): Promise<number>;
|
|
185
|
-
getBalances(params?: EvaluationParameters): Promise<Record<string, number>>;
|
|
186
|
-
}
|
|
187
|
-
export interface ANTWriteContract {
|
|
188
|
-
transfer({ target, }: {
|
|
189
|
-
target: WalletAddress;
|
|
190
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
191
|
-
setController({ controller, }: {
|
|
192
|
-
controller: WalletAddress;
|
|
193
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
194
|
-
removeController({ controller, }: {
|
|
195
|
-
controller: WalletAddress;
|
|
196
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
197
|
-
setRecord({ subDomain, transactionId, ttlSeconds, }: {
|
|
198
|
-
subDomain: string;
|
|
199
|
-
transactionId: string;
|
|
200
|
-
ttlSeconds: number;
|
|
201
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
202
|
-
removeRecord({ subDomain, }: {
|
|
203
|
-
subDomain: string;
|
|
204
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
205
|
-
setTicker({ ticker }: {
|
|
206
|
-
ticker: string;
|
|
207
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
208
|
-
setName({ name }: {
|
|
209
|
-
name: string;
|
|
210
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
211
|
-
}
|
|
212
75
|
export interface Logger {
|
|
213
76
|
setLogLevel: (level: string) => void;
|
|
214
77
|
info: (message: string, ...args: unknown[]) => void;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
|
-
export * from './arns-service.js';
|
|
18
17
|
export * from './contract-state.js';
|
|
19
18
|
export * from './common.js';
|
|
20
19
|
export * from './token.js';
|
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
|
-
import { Tag, Transaction } from 'warp-contracts';
|
|
18
17
|
import { BlockHeight } from '../common.js';
|
|
19
18
|
export declare const validateArweaveId: (id: string) => boolean;
|
|
20
19
|
export declare function isBlockHeight(height: string | number): height is BlockHeight;
|
|
21
|
-
export declare const isTransaction: (tx: object) => tx is Transaction;
|
|
22
|
-
export declare function tagsToObject(tags: Tag[]): {
|
|
23
|
-
[x: string]: string;
|
|
24
|
-
};
|
package/lib/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ar.io/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
|
|
@@ -33,8 +33,6 @@
|
|
|
33
33
|
"arweave",
|
|
34
34
|
"ar",
|
|
35
35
|
"blockchain",
|
|
36
|
-
"warp",
|
|
37
|
-
"contracts",
|
|
38
36
|
"ar.io",
|
|
39
37
|
"ao"
|
|
40
38
|
],
|
|
@@ -51,7 +49,7 @@
|
|
|
51
49
|
"types": "./lib/types/node/index.d.ts"
|
|
52
50
|
},
|
|
53
51
|
"./web": {
|
|
54
|
-
"import": "./
|
|
52
|
+
"import": "./lib/esm/web/index.js",
|
|
55
53
|
"require": "./bundles/web.bundle.min.js",
|
|
56
54
|
"types": "./lib/types/web/index.d.ts",
|
|
57
55
|
"browser": "./bundles/web.bundle.min.js"
|
|
@@ -67,15 +65,13 @@
|
|
|
67
65
|
"lint:fix": "eslint src --fix",
|
|
68
66
|
"format": "prettier --check .",
|
|
69
67
|
"format:fix": "prettier --write .",
|
|
70
|
-
"test": "yarn test:unit && yarn test:
|
|
68
|
+
"test": "yarn test:unit && yarn test:e2e",
|
|
71
69
|
"test:cjs": "cd ./tests/e2e/cjs && yarn && yarn test",
|
|
72
70
|
"test:esm": "cd ./tests/e2e/esm && yarn && yarn test",
|
|
73
71
|
"test:web": "cd ./tests/e2e/web && yarn && yarn test",
|
|
74
72
|
"test:unit": "jest --config=jest.config.mjs",
|
|
75
73
|
"test:link": "yarn build && yarn link",
|
|
76
74
|
"test:e2e": "yarn test:link && yarn test:cjs && yarn test:esm && yarn test:web",
|
|
77
|
-
"test:integration": "jest --config=jest.integration.config.mjs --runInBand",
|
|
78
|
-
"test:docker": "docker-compose up --exit-code-from test-runner --build",
|
|
79
75
|
"prepare": "husky install",
|
|
80
76
|
"example:esm": "cd examples/esm && yarn && node index.mjs",
|
|
81
77
|
"example:cjs": "cd examples/cjs && yarn && node index.cjs",
|
|
@@ -119,7 +115,7 @@
|
|
|
119
115
|
"ts-jest": "^29.1.2",
|
|
120
116
|
"ts-node": "^10.9.1",
|
|
121
117
|
"typescript": "^5.1.6",
|
|
122
|
-
"
|
|
118
|
+
"vite-plugin-node-polyfills": "^0.22.0"
|
|
123
119
|
},
|
|
124
120
|
"dependencies": {
|
|
125
121
|
"@permaweb/aoconnect": "^0.0.55",
|
|
@@ -127,10 +123,9 @@
|
|
|
127
123
|
"arweave": "1.14.4",
|
|
128
124
|
"axios": "1.7.2",
|
|
129
125
|
"axios-retry": "^4.3.0",
|
|
130
|
-
"bunyan": "^1.8.15",
|
|
131
126
|
"eventemitter3": "^5.0.1",
|
|
132
127
|
"plimit-lit": "^3.0.1",
|
|
133
|
-
"
|
|
128
|
+
"winston": "^3.13.0"
|
|
134
129
|
},
|
|
135
130
|
"lint-staged": {
|
|
136
131
|
"**/*.{ts,js,mjs,cjs,md,json}": [
|
package/lib/cjs/arns-service.js
DELETED