@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
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
import { ArIOReadContract, ArIOState, ArIOWriteContract, ArNSAuctionData, ArNSNameData, ArNSReservedNameData, ContractConfiguration, ContractSigner, DENOMINATIONS, EpochDistributionData, EvaluationOptions, EvaluationParameters, Gateway, JoinNetworkParams, Observations, RegistrationType, TransactionId, UpdateGatewaySettingsParams, WalletAddress, WeightedObserver, WithSigner, WriteInteractionResult, WriteOptions, mIOToken } from '../types.js';
|
|
2
|
-
import { RemoteContract } from './contracts/remote-contract.js';
|
|
3
|
-
import { WarpContract } from './index.js';
|
|
4
|
-
/**
|
|
5
|
-
* The ArIO class provides an interface to interact with the Arweave Interoperability Contract.
|
|
6
|
-
* @deprecated - This class will be removed in the next major release.
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { ArIO } from '@permaweb/ar-io';
|
|
10
|
-
* const arIO = ArIO.init();
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare class ArIO {
|
|
14
|
-
/**
|
|
15
|
-
* @param config - @type {ContractConfiguration} The configuration object.
|
|
16
|
-
* @returns {WarpContract<ArIOState>} The contract object.
|
|
17
|
-
* @example
|
|
18
|
-
* Using the contract object
|
|
19
|
-
* ```ts
|
|
20
|
-
* ArIO.createContract({ contract: new WarpContract<ArIOState>({ contractTxId: 'myContractTxId' });
|
|
21
|
-
* ```
|
|
22
|
-
* Using the contractTxId
|
|
23
|
-
* ```ts
|
|
24
|
-
* ArIO.createContract({ contractTxId: 'myContractTxId' });
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
static createWriteableContract(config?: ContractConfiguration<ArIOState>): WarpContract<ArIOState>;
|
|
28
|
-
/**
|
|
29
|
-
* Initializes an ArIO instance.
|
|
30
|
-
*
|
|
31
|
-
* There are multiple overloads for this function:
|
|
32
|
-
* 1. When nothing is provided, it returns an instance of ArIOReadable.
|
|
33
|
-
* 1. When a signer is provided, it returns an instance of ArIOWritable.
|
|
34
|
-
* 2. When a signer is NOT provided, it returns an instance of ArIOReadable.
|
|
35
|
-
*
|
|
36
|
-
* @param {WithSigner<ContractConfiguration<ArIOState>>} config - The configuration object.
|
|
37
|
-
* If a signer is provided, it should be an object that implements the ContractSigner interface.
|
|
38
|
-
*
|
|
39
|
-
* @returns {ArIOWritable | ArIOReadable} - An instance of ArIOWritable if a signer is provided, otherwise an instance of ArIOReadable.
|
|
40
|
-
* @throws {Error} - Throws an error if the configuration is invalid.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* Overload 1: When nothing is provide, ArIOReadable is returned.
|
|
44
|
-
* ```ts
|
|
45
|
-
* const readable = ArIO.init();
|
|
46
|
-
* ```
|
|
47
|
-
* Overload 2: When signer is not provided with contract, ArIOReadable is returned.
|
|
48
|
-
* ```ts
|
|
49
|
-
* const readable = ArIO.init({ contract: myContract });
|
|
50
|
-
* ```
|
|
51
|
-
* Overload 3: When signer is not provided with a contractTxId, ArIOReadable is returned.
|
|
52
|
-
* ```ts
|
|
53
|
-
* const readable = ArIO.init({ contractTxId: 'myContractTxId' });
|
|
54
|
-
* ```
|
|
55
|
-
* Overload 4: When a signer is provided but is undefined, ArIOReadable is returned.
|
|
56
|
-
* ```ts
|
|
57
|
-
* const readable = ArIO.init({ signer: undefined });
|
|
58
|
-
* ```
|
|
59
|
-
* Overload 5: When signer is provided without any contract configuration, ArIOWritable is returned.
|
|
60
|
-
* ```ts
|
|
61
|
-
* const writable = ArIO.init({ signer: mySigner });
|
|
62
|
-
*```
|
|
63
|
-
* Overload 6: When signer is provided with a contract configuration, ArIOWritable is returned.
|
|
64
|
-
* ```ts
|
|
65
|
-
* const writable = ArIO.init({ signer: mySigner, contract: myContract });
|
|
66
|
-
* ```
|
|
67
|
-
* Overload 7: When signer is provided with a contractTxId, ArIOWritable is returned.
|
|
68
|
-
* ```ts
|
|
69
|
-
* const writable = ArIO.init({ signer: mySigner, contractTxId: 'myContractTxId' });
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
static init(): ArIOReadable;
|
|
73
|
-
static init({ signer }: WithSigner): ArIOWritable;
|
|
74
|
-
static init({ signer, contractTxId, }: WithSigner<{
|
|
75
|
-
contractTxId: string;
|
|
76
|
-
}>): ArIOWritable;
|
|
77
|
-
static init({ contract, signer, }: WithSigner<{
|
|
78
|
-
contract: WarpContract<ArIOState>;
|
|
79
|
-
}>): ArIOWritable;
|
|
80
|
-
static init({ contractTxId, signer, }: {
|
|
81
|
-
contractTxId: string;
|
|
82
|
-
signer?: ContractSigner | undefined;
|
|
83
|
-
}): ArIOReadable;
|
|
84
|
-
static init({ contract, signer, }: {
|
|
85
|
-
contract: WarpContract<ArIOState>;
|
|
86
|
-
signer?: ContractSigner | undefined;
|
|
87
|
-
}): ArIOReadable;
|
|
88
|
-
static init(config?: ContractConfiguration<ArIOState>): ArIOReadable;
|
|
89
|
-
}
|
|
90
|
-
export declare class ArIOReadable implements ArIOReadContract {
|
|
91
|
-
protected contract: RemoteContract<ArIOState> | WarpContract<ArIOState>;
|
|
92
|
-
constructor(config?: ContractConfiguration<ArIOState>);
|
|
93
|
-
/**
|
|
94
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
95
|
-
* @returns {Promise<ArIOState>} The state of the contract.
|
|
96
|
-
* @example
|
|
97
|
-
* Get the current state
|
|
98
|
-
* ```ts
|
|
99
|
-
* arIO.getState();
|
|
100
|
-
* ```
|
|
101
|
-
* Get the state at a specific block height or sortkey
|
|
102
|
-
* ```ts
|
|
103
|
-
* arIO.getState({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
104
|
-
* arIO.getState({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
getState(params?: EvaluationParameters): Promise<ArIOState>;
|
|
108
|
-
/**
|
|
109
|
-
* @param domain @type {string} The domain name.
|
|
110
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
111
|
-
* @returns {Promise<ArNSNameData | undefined>} The record of the undername domain.
|
|
112
|
-
* @example
|
|
113
|
-
* Get the current record
|
|
114
|
-
* ```ts
|
|
115
|
-
* arIO.getRecord({ domain: "john" });
|
|
116
|
-
* ```
|
|
117
|
-
* Get the record at a specific block height or sortkey
|
|
118
|
-
* ```ts
|
|
119
|
-
* arIO.getRecord({ domain: "john", evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
120
|
-
* arIO.getRecord({ domain: "john", evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
getArNSRecord({ domain, evaluationOptions, }: EvaluationParameters<{
|
|
124
|
-
domain: string;
|
|
125
|
-
}>): Promise<ArNSNameData | undefined>;
|
|
126
|
-
/**
|
|
127
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
128
|
-
* @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
|
|
129
|
-
* @example
|
|
130
|
-
* Get the current records
|
|
131
|
-
* ```ts
|
|
132
|
-
* ant.getRecords();
|
|
133
|
-
* ```
|
|
134
|
-
* Get the records at a specific block height or sortkey
|
|
135
|
-
* ```ts
|
|
136
|
-
* ant.getRecords({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
137
|
-
* ant.getRecords({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
getArNSRecords({ evaluationOptions, }?: EvaluationParameters): Promise<Record<string, ArNSNameData>>;
|
|
141
|
-
/**
|
|
142
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
143
|
-
* @returns {Promise<Record<string, ArNSReservedNameData>>} The reserved names.
|
|
144
|
-
* @example
|
|
145
|
-
* Get the current reserved names
|
|
146
|
-
* ```ts
|
|
147
|
-
* arIO.getArNSReservedNames();
|
|
148
|
-
* ```
|
|
149
|
-
* Get the reserved names at a specific block height or sortkey
|
|
150
|
-
* ```ts
|
|
151
|
-
* arIO.getArNSReservedNames({ evaluationOptions: { evalTo: { blockHeight: 1000 } });
|
|
152
|
-
* arIO.getArNSReservedNames({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } });
|
|
153
|
-
* ```
|
|
154
|
-
*/
|
|
155
|
-
getArNSReservedNames({ evaluationOptions, }?: EvaluationParameters): Promise<Record<string, ArNSReservedNameData> | Record<string, never>>;
|
|
156
|
-
/**
|
|
157
|
-
* @param domain @type {string} The domain name.
|
|
158
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
159
|
-
* @returns {Promise<ArNSReservedNameData | undefined>} The reserved name data.
|
|
160
|
-
* @example
|
|
161
|
-
* Get the current reserved name
|
|
162
|
-
* ```ts
|
|
163
|
-
* arIO.getArNSReservedName({ domain: "myDomain" });
|
|
164
|
-
* ```
|
|
165
|
-
* Get the reserved name at a specific block height or sortkey
|
|
166
|
-
* ```ts
|
|
167
|
-
* arIO.getArNSReservedName({ domain: "myDomain", evaluationOptions: { evalTo: { blockHeight: 1000 } });
|
|
168
|
-
* arIO.getArNSReservedName({ domain: "myDomain", evaluationOptions: { evalTo: { sortKey: 'mySortKey' } });
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
getArNSReservedName({ domain, evaluationOptions, }: EvaluationParameters<{
|
|
172
|
-
domain: string;
|
|
173
|
-
}>): Promise<ArNSReservedNameData | undefined>;
|
|
174
|
-
/**
|
|
175
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
176
|
-
* @param address @type {string} The address of the account you want the balance of.
|
|
177
|
-
* @returns {Promise<number>} The balance of the provided address
|
|
178
|
-
* @example
|
|
179
|
-
* The current balance of the address.
|
|
180
|
-
* ```ts
|
|
181
|
-
* arIO.getBalance({ address });
|
|
182
|
-
* ```
|
|
183
|
-
* @example
|
|
184
|
-
* Get the balance at a specific block height or sortkey
|
|
185
|
-
* ```ts
|
|
186
|
-
* arIO.getBalance({ address, evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
187
|
-
* arIO.getBalance({ address, evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
getBalance({ address, evaluationOptions, }: EvaluationParameters<{
|
|
191
|
-
address: string;
|
|
192
|
-
}>): Promise<number>;
|
|
193
|
-
/**
|
|
194
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
195
|
-
* @returns {Promise<Record<string, number>>} The balances of the ArIO Contract
|
|
196
|
-
* @example
|
|
197
|
-
* The current balances of the ANT.
|
|
198
|
-
* ```ts
|
|
199
|
-
* arIO.getBalances();
|
|
200
|
-
* ```
|
|
201
|
-
* @example
|
|
202
|
-
* Get the balances at a specific block height or sortkey
|
|
203
|
-
* ```ts
|
|
204
|
-
* arIO.getBalances({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
205
|
-
* arIO.getBalances({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
getBalances({ evaluationOptions }?: EvaluationParameters): Promise<Record<string, number>>;
|
|
209
|
-
/**
|
|
210
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
211
|
-
* @param address @type {string} The address of the gateway you want information about.
|
|
212
|
-
* @returns {Promise<Gateway>} The balance of the provided address
|
|
213
|
-
* @example
|
|
214
|
-
* The current gateway info of the address.
|
|
215
|
-
* ```ts
|
|
216
|
-
* arIO.getGateway({ address });
|
|
217
|
-
* ```
|
|
218
|
-
* @example
|
|
219
|
-
* Get the gateway info of the address at a certain block height or sortkey
|
|
220
|
-
* ```ts
|
|
221
|
-
* arIO.getGateway({ address, evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
222
|
-
* arIO.getGateway({ address, evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
getGateway({ address, evaluationOptions, }: EvaluationParameters<{
|
|
226
|
-
address: string;
|
|
227
|
-
}>): Promise<Gateway | undefined>;
|
|
228
|
-
/**
|
|
229
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
230
|
-
* @returns {Promise<Record<string, Gateway> >} The registered gateways of the ArIO Network.
|
|
231
|
-
* @example
|
|
232
|
-
* The current gateways.
|
|
233
|
-
* ```ts
|
|
234
|
-
* arIO.getGateways();
|
|
235
|
-
* ```
|
|
236
|
-
* @example
|
|
237
|
-
* Get the gateways at a specific block height or sortkey
|
|
238
|
-
* ```ts
|
|
239
|
-
* arIO.getGateways({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
240
|
-
* arIO.getGateways({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
|
-
getGateways({ evaluationOptions }?: EvaluationParameters): Promise<Record<WalletAddress, Gateway> | Record<string, never>>;
|
|
244
|
-
/**
|
|
245
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
246
|
-
* @returns {Promise<EpochDistributionData>} The current distribution data of the epoch.
|
|
247
|
-
* @example
|
|
248
|
-
* The current epoch
|
|
249
|
-
* ```ts
|
|
250
|
-
* arIO.getCurrentEpoch();
|
|
251
|
-
* ```
|
|
252
|
-
* @example
|
|
253
|
-
* Get the epoch at a given block height or sortkey
|
|
254
|
-
* ```ts
|
|
255
|
-
* arIO.getCurrentEpoch({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
256
|
-
* arIO.getCurrentEpoch({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
257
|
-
* ```
|
|
258
|
-
*/
|
|
259
|
-
getCurrentEpoch({ evaluationOptions, }?: EvaluationParameters): Promise<EpochDistributionData>;
|
|
260
|
-
/**
|
|
261
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
262
|
-
* @param blockHeight @type {number} The block height of the epoch you want to get.
|
|
263
|
-
* @returns {Promise<EpochDistributionData>} The current distribution data of the epoch.
|
|
264
|
-
* @example
|
|
265
|
-
* The current epoch
|
|
266
|
-
* ```ts
|
|
267
|
-
* arIO.getEpoch({ blockHeight: 1000 });
|
|
268
|
-
* ```
|
|
269
|
-
* @example
|
|
270
|
-
* Get the epoch at a given block height or sortkey
|
|
271
|
-
* ```ts
|
|
272
|
-
* arIO.getEpoch({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
273
|
-
* arIO.getEpoch({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
274
|
-
* ```
|
|
275
|
-
*/
|
|
276
|
-
getEpoch({ blockHeight, evaluationOptions, }: {
|
|
277
|
-
blockHeight: number;
|
|
278
|
-
} & EvaluationParameters): Promise<EpochDistributionData>;
|
|
279
|
-
/**
|
|
280
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
281
|
-
* @returns {Promise<WeightedObserver[]>} The current distribution data of the epoch.
|
|
282
|
-
* @example
|
|
283
|
-
* Current prescribed observers
|
|
284
|
-
* ```ts
|
|
285
|
-
* arIO.getPrescribedObservers();
|
|
286
|
-
* ```
|
|
287
|
-
* @example
|
|
288
|
-
* Get the previous prescribed observers at a given block height or sortkey
|
|
289
|
-
* ```ts
|
|
290
|
-
* arIO.getPrescribedObservers({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
291
|
-
* arIO.getPrescribedObservers({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
292
|
-
* ```
|
|
293
|
-
*/
|
|
294
|
-
getPrescribedObservers({ evaluationOptions, }?: EvaluationParameters): Promise<WeightedObserver[]>;
|
|
295
|
-
/**
|
|
296
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
297
|
-
* @returns {Promise<Observations>} The current observations data.
|
|
298
|
-
* @example
|
|
299
|
-
* All observations.
|
|
300
|
-
* ```ts
|
|
301
|
-
* arIO.getObservations();
|
|
302
|
-
* ```
|
|
303
|
-
* @example
|
|
304
|
-
* Get observations at a given block height or sortkey
|
|
305
|
-
* ```ts
|
|
306
|
-
* arIO.getObservations({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
307
|
-
* arIO.getObservations({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
308
|
-
* ```
|
|
309
|
-
*/
|
|
310
|
-
getObservations({ evaluationOptions, }?: EvaluationParameters): Promise<Observations>;
|
|
311
|
-
/**
|
|
312
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
313
|
-
* @returns {Promise<EpochDistributionData>} The current distribution data of the epoch.
|
|
314
|
-
* @example
|
|
315
|
-
* Get the current distribution data.
|
|
316
|
-
* ```ts
|
|
317
|
-
* arIO.getDistributions();
|
|
318
|
-
* ```
|
|
319
|
-
* @example
|
|
320
|
-
* Get distributions at a given block height or sortkey
|
|
321
|
-
* ```ts
|
|
322
|
-
* arIO.getDistributions({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
323
|
-
* arIO.getDistributions({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
324
|
-
* ```
|
|
325
|
-
*/
|
|
326
|
-
getDistributions({ evaluationOptions, }?: EvaluationParameters): Promise<EpochDistributionData>;
|
|
327
|
-
/**
|
|
328
|
-
* Fetches the in-auction domain or the pricing data for how much it would cost to initiate the auction.
|
|
329
|
-
*
|
|
330
|
-
* @param domain @type {string} The domain name in auction
|
|
331
|
-
* @param type @type {RegistrationType} The type of registration, relevant for reading auction prices
|
|
332
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
333
|
-
* @returns {Promise<ArNSAuctionData>} The auction data for the specified name.
|
|
334
|
-
* @example
|
|
335
|
-
* Get the current auction data
|
|
336
|
-
* ```ts
|
|
337
|
-
* arIO.getAuction({ domain: 'myDomain' });
|
|
338
|
-
* ```
|
|
339
|
-
* @example
|
|
340
|
-
* Get the auction data at a given block height or sortkey
|
|
341
|
-
* ```ts
|
|
342
|
-
* arIO.getAuction({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
343
|
-
* arIO.getAuction({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
344
|
-
* ```
|
|
345
|
-
*/
|
|
346
|
-
getAuction({ domain, type, evaluationOptions, }: EvaluationParameters<{
|
|
347
|
-
domain: string;
|
|
348
|
-
type?: RegistrationType;
|
|
349
|
-
}>): Promise<ArNSAuctionData>;
|
|
350
|
-
/**
|
|
351
|
-
* Fetches the current auctions.
|
|
352
|
-
*
|
|
353
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
354
|
-
* @returns {Promise<Record<string, ArNSAuctionData>>} The current auctions data.
|
|
355
|
-
* @example
|
|
356
|
-
* Get the current auction data
|
|
357
|
-
* ```ts
|
|
358
|
-
* arIO.getAuctions();
|
|
359
|
-
* ```
|
|
360
|
-
* @example
|
|
361
|
-
* Get the auction data at a given block height or sortkey
|
|
362
|
-
* ```ts
|
|
363
|
-
* arIO.getAuctions({ evaluationOptions: { evalTo: { blockHeight: 1000 } } });
|
|
364
|
-
* arIO.getAuctions({ evaluationOptions: { evalTo: { sortKey: 'mySortKey' } } });
|
|
365
|
-
* ```
|
|
366
|
-
*/
|
|
367
|
-
getAuctions({ evaluationOptions, }?: {
|
|
368
|
-
evaluationOptions?: EvaluationOptions | Record<string, never> | undefined;
|
|
369
|
-
}): Promise<Record<string, ArNSAuctionData>>;
|
|
370
|
-
/**
|
|
371
|
-
* Fetches the price for an interaction
|
|
372
|
-
*
|
|
373
|
-
* @param evaluationOptions @type {EvaluationOptions} The evaluation options.
|
|
374
|
-
* @returns {Promise<number>} The price to perform the interaction - eg the registration cost.
|
|
375
|
-
* @example
|
|
376
|
-
* Get the current auction data
|
|
377
|
-
* ```ts
|
|
378
|
-
* arIO.getPriceForInteraction({
|
|
379
|
-
* interactionName: 'buyRecord',
|
|
380
|
-
* payload: { name: 'ardrive', years: 1, type: 'lease', auction: false},
|
|
381
|
-
* });
|
|
382
|
-
* ```
|
|
383
|
-
* @example
|
|
384
|
-
* Get the auction data at a given block height or sortkey
|
|
385
|
-
* ```ts
|
|
386
|
-
* arIO.getPriceForInteraction({
|
|
387
|
-
* interactionName: 'buyRecord',
|
|
388
|
-
* payload: { name: 'ardrive', years: 1, type: 'lease', auction: false},
|
|
389
|
-
* evaluationOptions: { evalTo: { blockHeight: 1000 } }
|
|
390
|
-
* });
|
|
391
|
-
*
|
|
392
|
-
* arIO.getPriceForInteraction({
|
|
393
|
-
* interactionName: 'buyRecord',
|
|
394
|
-
* payload: { name: 'ardrive', years: 1, type: 'lease', auction: false},
|
|
395
|
-
* evaluationOptions: { evalTo: { sortKey: 'mySortKey' } }
|
|
396
|
-
* });
|
|
397
|
-
* ```
|
|
398
|
-
*/
|
|
399
|
-
getPriceForInteraction({ interactionName, payload, evaluationOptions, }: EvaluationParameters<{
|
|
400
|
-
interactionName: string;
|
|
401
|
-
payload: object;
|
|
402
|
-
}>): Promise<number>;
|
|
403
|
-
}
|
|
404
|
-
export declare class ArIOWritable extends ArIOReadable implements ArIOWriteContract {
|
|
405
|
-
protected contract: WarpContract<ArIOState>;
|
|
406
|
-
private signer;
|
|
407
|
-
constructor({ signer, ...config }: WithSigner<{
|
|
408
|
-
contract?: WarpContract<ArIOState>;
|
|
409
|
-
} | {
|
|
410
|
-
contractTxId?: string;
|
|
411
|
-
}>);
|
|
412
|
-
/**
|
|
413
|
-
* @param target @type {string} The address of the account you want to transfer IO tokens to.
|
|
414
|
-
* @param qty @type {number | mIOToken} The amount of IO or mIO to transfer.
|
|
415
|
-
* @param denomination @type {DENOMINATIONS} The denomination of the amount to transfer (io or mio).
|
|
416
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
417
|
-
* @example
|
|
418
|
-
* mIO transfer
|
|
419
|
-
* ```ts
|
|
420
|
-
* arIO.transfer({
|
|
421
|
-
* target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk",
|
|
422
|
-
* qty: 1 * 10 ** 6,
|
|
423
|
-
* denomination: DENOMINATIONS.MIO
|
|
424
|
-
* });
|
|
425
|
-
*```
|
|
426
|
-
* IO transfer
|
|
427
|
-
* ```ts
|
|
428
|
-
* arIO.transfer({
|
|
429
|
-
target: "fGht8v4STuwPnTck1zFVkQqJh5K9q9Zik4Y5-5dV7nk",
|
|
430
|
-
qty: new IOToken(100).toMIO(),
|
|
431
|
-
denomination: DENOMINATIONS.IO
|
|
432
|
-
});
|
|
433
|
-
* ```
|
|
434
|
-
*/
|
|
435
|
-
transfer({ target, qty, denomination, }: {
|
|
436
|
-
target: string;
|
|
437
|
-
qty: number | mIOToken;
|
|
438
|
-
denomination?: DENOMINATIONS;
|
|
439
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
440
|
-
/**
|
|
441
|
-
* @param params @type {JoinNetworkParams} Your gateway configuration.
|
|
442
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
443
|
-
* @example
|
|
444
|
-
* Join the network with the your configuration.
|
|
445
|
-
* ```ts
|
|
446
|
-
* const jointNetworkParams = {
|
|
447
|
-
qty: new IOToken(10000).toMIO(), // initial operator stake
|
|
448
|
-
allowDelegatedStaking: true, // delegated staking settings
|
|
449
|
-
minDelegatedStake: new IOToken(100).toMIO(), // min delegated stake
|
|
450
|
-
delegateRewardShareRatio: 1, // delegate reward share ratio
|
|
451
|
-
autoStake: true, // auto stake operator tokens
|
|
452
|
-
label: 'john smith', // min 1, max 64 characters
|
|
453
|
-
note: 'The example gateway', // max 256 characters
|
|
454
|
-
properties: 'FH1aVetOoulPGqgYukj0VE0wIhDy90WiQoV3U2PeY44', // Arweave transaction ID containing additional properties of the Gateway.
|
|
455
|
-
observerWallet: '0VE0wIhDy90WiQoV3U2PeY44FH1aVetOoulPGqgYukj', // wallet address of the observer
|
|
456
|
-
fqdn: 'example.com', // fully qualified domain name
|
|
457
|
-
port: 443, // port number
|
|
458
|
-
protocol: 'https', // protocol
|
|
459
|
-
};
|
|
460
|
-
* arIO.joinNetwork(jointNetworkParams);
|
|
461
|
-
* ```
|
|
462
|
-
*/
|
|
463
|
-
joinNetwork({ qty, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerWallet, }: JoinNetworkParams, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
464
|
-
/**
|
|
465
|
-
* @param params @type {UpdateGatewaySettingsParams} Gateway settings to update
|
|
466
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
467
|
-
* @example
|
|
468
|
-
* Update a setting of the gateway.
|
|
469
|
-
* ```ts
|
|
470
|
-
* arIO.updateGatewaySettings({ autoStake: true, minDelegatedStake: new IOToken(100).toMIO()});
|
|
471
|
-
* ```
|
|
472
|
-
*/
|
|
473
|
-
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerWallet, }: UpdateGatewaySettingsParams, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
474
|
-
/**
|
|
475
|
-
* @param target @type {string} The gateway you wish to delegate stake to.
|
|
476
|
-
* @param qty @type {number | mIOToken} The amount of stake to delegate represented in mIO.
|
|
477
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
478
|
-
* @example
|
|
479
|
-
* Delegate stake to a gateway.
|
|
480
|
-
* ```ts
|
|
481
|
-
* arIO.increaseDelegateStake({ target: "FH1aVetOoulPGqgYukj0VE0wIhDy90WiQoV3U2PeY44", qty: 1000 });
|
|
482
|
-
* ```
|
|
483
|
-
*/
|
|
484
|
-
increaseDelegateStake(params: {
|
|
485
|
-
target: string;
|
|
486
|
-
qty: number | mIOToken;
|
|
487
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
488
|
-
/**
|
|
489
|
-
* @param target @type {string} The gateway you wish to decrease stake at.
|
|
490
|
-
* @param qty @type {number | mIOToken} The amount of stake to decrease represented in mIO.
|
|
491
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
492
|
-
* @example
|
|
493
|
-
* Decrease your delegated staked tokens at a gateway.
|
|
494
|
-
* ```ts
|
|
495
|
-
* arIO.decreaseDelegateStake({ target: "FH1aVetOoulPGqgYukj0VE0wIhDy90WiQoV3U2PeY44", qty: new IOToken(1000).toMIO() });
|
|
496
|
-
* ```
|
|
497
|
-
*/
|
|
498
|
-
decreaseDelegateStake(params: {
|
|
499
|
-
target: string;
|
|
500
|
-
qty: number | mIOToken;
|
|
501
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
502
|
-
/**
|
|
503
|
-
* @param qty @type {number | mIOToken} The amount of stake to increase by represented in mIO.
|
|
504
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
505
|
-
* @example
|
|
506
|
-
* Increase your staked tokens as an operator
|
|
507
|
-
* ```new IOToken(1000).toMIO()
|
|
508
|
-
* arIO.increaseOperatorStake({ qty: new IOToken(1000).toMIO() });
|
|
509
|
-
* ```
|
|
510
|
-
*/
|
|
511
|
-
increaseOperatorStake(params: {
|
|
512
|
-
qty: number | mIOToken;
|
|
513
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
514
|
-
/**
|
|
515
|
-
* @param qty @type {number} The amount of stake to decrease by.
|
|
516
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
517
|
-
* @example
|
|
518
|
-
* Decrease your staked tokens as an operator
|
|
519
|
-
* ```ts
|
|
520
|
-
* arIO.decreaseOperatorStake({ qty: 1000 });
|
|
521
|
-
* ```
|
|
522
|
-
*/
|
|
523
|
-
decreaseOperatorStake(params: {
|
|
524
|
-
qty: number | mIOToken;
|
|
525
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
526
|
-
/**
|
|
527
|
-
* @param reportTxId @type {TransactionId} The transaction ID of the report.
|
|
528
|
-
* @param failedGateways @type {WalletAddress[]} The failed gateways you are reporting.
|
|
529
|
-
* @returns {Promise<WriteInteractionResult>} The result of the interaction.
|
|
530
|
-
* @example
|
|
531
|
-
* Save your observations.
|
|
532
|
-
* ```ts
|
|
533
|
-
* arIO.saveObservations({
|
|
534
|
-
* reportTxId: '5f7aVetOoulPGqgYukj0VE0wIhDy90WiQoV3U2Pe6ko',
|
|
535
|
-
* failedGateways: ['FH1aVetOoulPGqgYukj0VE0wIhDy90WiQoV3U2PeY44']
|
|
536
|
-
* });
|
|
537
|
-
* ```
|
|
538
|
-
*/
|
|
539
|
-
saveObservations(params: {
|
|
540
|
-
reportTxId: TransactionId;
|
|
541
|
-
failedGateways: WalletAddress[];
|
|
542
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
543
|
-
extendLease(params: {
|
|
544
|
-
domain: string;
|
|
545
|
-
years: number;
|
|
546
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
547
|
-
increaseUndernameLimit(params: {
|
|
548
|
-
domain: string;
|
|
549
|
-
qty: number;
|
|
550
|
-
}, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
551
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* This program is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU Affero General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
import { BaseContract, EvaluationParameters, ReadContract } from '../../types.js';
|
|
18
|
-
import { DefaultLogger } from '../logger.js';
|
|
19
|
-
export declare class RemoteContract<T> implements BaseContract<T>, ReadContract {
|
|
20
|
-
private logger;
|
|
21
|
-
private http;
|
|
22
|
-
private contractTxId;
|
|
23
|
-
private cacheUrl;
|
|
24
|
-
constructor({ cacheUrl, contractTxId, logger, }: {
|
|
25
|
-
contractTxId: string;
|
|
26
|
-
cacheUrl?: string;
|
|
27
|
-
logger?: DefaultLogger;
|
|
28
|
-
});
|
|
29
|
-
configuration(): {
|
|
30
|
-
contractTxId: string;
|
|
31
|
-
cacheUrl: string;
|
|
32
|
-
};
|
|
33
|
-
getState({ evaluationOptions }?: EvaluationParameters): Promise<T>;
|
|
34
|
-
readInteraction<I, K>({ functionName, inputs, evaluationOptions, }: EvaluationParameters<{
|
|
35
|
-
functionName: string;
|
|
36
|
-
inputs?: I;
|
|
37
|
-
}>): Promise<K>;
|
|
38
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* This program is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU Affero General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
import { CustomSignature, Warp } from 'warp-contracts';
|
|
18
|
-
import { BaseContract, ContractSigner, EvaluationParameters, Logger, OptionalSigner, ReadContract, WriteContract, WriteInteractionResult, WriteOptions, WriteParameters } from '../../types.js';
|
|
19
|
-
export declare class WarpContract<T> implements BaseContract<T>, ReadContract, WriteContract {
|
|
20
|
-
private contract;
|
|
21
|
-
private contractTxId;
|
|
22
|
-
private cacheUrl;
|
|
23
|
-
private logger;
|
|
24
|
-
private warp;
|
|
25
|
-
constructor({ contractTxId, cacheUrl, warp, logger, }: {
|
|
26
|
-
contractTxId: string;
|
|
27
|
-
cacheUrl?: string;
|
|
28
|
-
warp?: Warp;
|
|
29
|
-
logger?: Logger;
|
|
30
|
-
});
|
|
31
|
-
configuration(): {
|
|
32
|
-
contractTxId: string;
|
|
33
|
-
cacheUrl: string | undefined;
|
|
34
|
-
};
|
|
35
|
-
createWarpSigner(signer: ContractSigner): Promise<CustomSignature>;
|
|
36
|
-
getState({ evaluationOptions }: EvaluationParameters): Promise<T>;
|
|
37
|
-
ensureContractInit({ signer }?: OptionalSigner): Promise<void>;
|
|
38
|
-
readInteraction<I, K>({ functionName, inputs, }: EvaluationParameters<{
|
|
39
|
-
functionName: string;
|
|
40
|
-
inputs?: I;
|
|
41
|
-
}>): Promise<K>;
|
|
42
|
-
writeInteraction<Input>({ functionName, inputs, signer, }: WriteParameters<Input>, options?: WriteOptions): Promise<WriteInteractionResult>;
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const defaultWarp: import("warp-contracts").Warp;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU Affero General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
import Arweave from 'arweave';
|
|
19
|
-
import { DataProtocolTransaction } from '../../types.js';
|
|
20
|
-
export declare const MAX_REQUEST_SIZE = 100;
|
|
21
|
-
/**
|
|
22
|
-
* @param arweave - arweave instance to perform gql request
|
|
23
|
-
* @param address - address of the wallet to get transactions for
|
|
24
|
-
* @param signal - signal to abort the request
|
|
25
|
-
* @returns @type {Promise<DataProtocolTransaction[]>} - returns the list of data protocol txs, for e.g smartweave contracts
|
|
26
|
-
*/
|
|
27
|
-
export declare function getSmartweaveContractsFromGQL({ address, arweave, signal, }: {
|
|
28
|
-
arweave: Arweave;
|
|
29
|
-
address: string;
|
|
30
|
-
signal?: AbortSignal;
|
|
31
|
-
}): Promise<DataProtocolTransaction[]>;
|
|
32
|
-
/**
|
|
33
|
-
* @param arweave - arweave instance to perform gql request
|
|
34
|
-
* @param address - address of the wallet to get transactions for
|
|
35
|
-
* @param contractTxId - contract tx id to filter the transactions
|
|
36
|
-
* @param signal - signal to abort the request
|
|
37
|
-
* @returns @type {Promise<DataProtocolTransaction[]>} - returns the list of data protocol txs, for e.g smartweave contracts
|
|
38
|
-
*/
|
|
39
|
-
export declare function getSmartweaveTransactionsFromGQL({ address, contractTxId, arweave, signal, }: {
|
|
40
|
-
arweave: Arweave;
|
|
41
|
-
address: string;
|
|
42
|
-
contractTxId: string;
|
|
43
|
-
signal?: AbortSignal;
|
|
44
|
-
}): Promise<DataProtocolTransaction[]>;
|
|
45
|
-
export declare function getContractsTransferredToOrControlledByWallet(arweave: Arweave, params: {
|
|
46
|
-
address: string;
|
|
47
|
-
}, signal?: AbortSignal): Promise<DataProtocolTransaction[]>;
|