@ar.io/sdk 2.1.0-alpha.1 → 2.1.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 +103 -22
- package/bundles/web.bundle.min.js +105 -105
- package/lib/cjs/common/ant-registry.js +87 -0
- package/lib/cjs/common/ant.js +3 -9
- package/lib/cjs/common/contracts/ao-process.js +2 -19
- package/lib/cjs/common/index.js +1 -0
- package/lib/cjs/common/io.js +14 -12
- package/lib/cjs/constants.js +2 -1
- package/lib/cjs/io.js +2 -1
- package/lib/cjs/types.js +0 -1
- package/lib/cjs/utils/ao.js +31 -3
- package/lib/cjs/utils/json.js +3 -2
- package/lib/cjs/utils/processes.js +24 -43
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant-registry.js +81 -0
- package/lib/esm/common/ant.js +3 -9
- package/lib/esm/common/contracts/ao-process.js +2 -19
- package/lib/esm/common/index.js +1 -0
- package/lib/esm/common/io.js +14 -12
- package/lib/esm/constants.js +1 -0
- package/lib/esm/io.js +2 -1
- package/lib/esm/types.js +0 -1
- package/lib/esm/utils/ao.js +31 -4
- package/lib/esm/utils/json.js +1 -0
- package/lib/esm/utils/processes.js +24 -43
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant-registry.d.ts +26 -0
- package/lib/types/common/ant.d.ts +4 -4
- package/lib/types/common/contracts/ao-process.d.ts +4 -17
- package/lib/types/common/index.d.ts +1 -0
- package/lib/types/common/io.d.ts +9 -12
- package/lib/types/common.d.ts +2 -25
- package/lib/types/constants.d.ts +1 -0
- package/lib/types/io.d.ts +180 -116
- package/lib/types/token.d.ts +13 -0
- package/lib/types/types.d.ts +0 -1
- package/lib/types/utils/ao.d.ts +14 -6
- package/lib/types/utils/processes.d.ts +11 -5
- package/lib/types/version.d.ts +1 -1
- package/package.json +7 -2
- package/lib/cjs/contract-state.js +0 -68
- package/lib/esm/contract-state.js +0 -65
- package/lib/types/contract-state.d.ts +0 -201
package/lib/types/io.d.ts
CHANGED
|
@@ -15,16 +15,8 @@
|
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
import { AOProcess } from './common/index.js';
|
|
18
|
-
import { ANTRecord, ArNSReservedNameData, EpochDistributionData, EpochObservations, GatewayDelegate, GatewaySettings, RegistrationType, VaultData, WeightedObserver } from './contract-state.js';
|
|
19
18
|
import { mIOToken } from './token.js';
|
|
20
|
-
import { AoMessageResult,
|
|
21
|
-
export declare function isProcessConfiguration(config: object): config is {
|
|
22
|
-
process: AOProcess;
|
|
23
|
-
};
|
|
24
|
-
export declare function isProcessIdConfiguration(config: object): config is {
|
|
25
|
-
processId: string;
|
|
26
|
-
};
|
|
27
|
-
export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
|
|
19
|
+
import { AoMessageResult, AoSigner, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './types.js';
|
|
28
20
|
export type PaginationParams = {
|
|
29
21
|
cursor?: string;
|
|
30
22
|
limit?: number;
|
|
@@ -49,6 +41,156 @@ export type EpochInput = {
|
|
|
49
41
|
} | {
|
|
50
42
|
timestamp: Timestamp;
|
|
51
43
|
} | undefined;
|
|
44
|
+
export type AoBalances = Record<WalletAddress, number>;
|
|
45
|
+
export type AoFees = Record<string, number>;
|
|
46
|
+
export type AoObservations = Record<number, AoEpochObservationData>;
|
|
47
|
+
export type AoEpochIndex = number;
|
|
48
|
+
export interface AoIOState {
|
|
49
|
+
GatewayRegistry: Record<WalletAddress, AoGateway>;
|
|
50
|
+
Epochs: Record<AoEpochIndex, AoEpochData>;
|
|
51
|
+
NameRegistry: {
|
|
52
|
+
records: Record<string, AoArNSNameData>;
|
|
53
|
+
reserved: Record<string, AoArNSReservedNameData>;
|
|
54
|
+
};
|
|
55
|
+
Balances: Record<WalletAddress, number>;
|
|
56
|
+
Vaults: Record<WalletAddress, AoVaultData>;
|
|
57
|
+
Ticker: string;
|
|
58
|
+
Name: string;
|
|
59
|
+
Logo: string;
|
|
60
|
+
}
|
|
61
|
+
export type AoEpochObservationData = {
|
|
62
|
+
failureSummaries: Record<WalletAddress, WalletAddress[]>;
|
|
63
|
+
reports: Record<WalletAddress, TransactionId>;
|
|
64
|
+
};
|
|
65
|
+
export type AoVaultData = {
|
|
66
|
+
balance: number;
|
|
67
|
+
locked: number;
|
|
68
|
+
endTimestamp: Timestamp;
|
|
69
|
+
};
|
|
70
|
+
export type AoEpochDistributionData = {
|
|
71
|
+
rewards: Record<WalletAddress, number>;
|
|
72
|
+
distributedTimestamp: Timestamp;
|
|
73
|
+
totalDistributedRewards: number;
|
|
74
|
+
totalEligibleRewards: number;
|
|
75
|
+
};
|
|
76
|
+
export type AoArNSReservedNameData = {
|
|
77
|
+
target?: string;
|
|
78
|
+
endTimestamp?: number;
|
|
79
|
+
};
|
|
80
|
+
export type AoArNSNameData = AoArNSPermabuyData | AoArNSLeaseData;
|
|
81
|
+
export type AoArNSNameDataWithName = AoArNSNameData & {
|
|
82
|
+
name: string;
|
|
83
|
+
};
|
|
84
|
+
export type AoArNSBaseNameData = {
|
|
85
|
+
processId: ProcessId;
|
|
86
|
+
startTimestamp: number;
|
|
87
|
+
type: 'lease' | 'permabuy';
|
|
88
|
+
undernameLimit: number;
|
|
89
|
+
purchasePrice: number;
|
|
90
|
+
};
|
|
91
|
+
export type AoArNSPermabuyData = AoArNSBaseNameData & {
|
|
92
|
+
type: 'permabuy';
|
|
93
|
+
};
|
|
94
|
+
export type AoArNSLeaseData = AoArNSBaseNameData & {
|
|
95
|
+
type: 'lease';
|
|
96
|
+
endTimestamp: Timestamp;
|
|
97
|
+
};
|
|
98
|
+
export type AoEpochSettings = {
|
|
99
|
+
epochZeroStartTimestamp: Timestamp;
|
|
100
|
+
durationMs: number;
|
|
101
|
+
prescribedNameCount: number;
|
|
102
|
+
rewardPercentage: number;
|
|
103
|
+
maxObservers: number;
|
|
104
|
+
distributionDelayMs: number;
|
|
105
|
+
};
|
|
106
|
+
export type AoEpochData = {
|
|
107
|
+
epochIndex: AoEpochIndex;
|
|
108
|
+
startHeight: BlockHeight;
|
|
109
|
+
observations: AoObservations;
|
|
110
|
+
prescribedObservers: AoWeightedObserver[];
|
|
111
|
+
startTimestamp: Timestamp;
|
|
112
|
+
endTimestamp: Timestamp;
|
|
113
|
+
distributionTimestamp: Timestamp;
|
|
114
|
+
distributions: AoEpochDistributionData;
|
|
115
|
+
};
|
|
116
|
+
export type AoGateway = {
|
|
117
|
+
settings: AoGatewaySettings;
|
|
118
|
+
stats: AoGatewayStats;
|
|
119
|
+
delegates: Record<WalletAddress, AoGatewayDelegate>;
|
|
120
|
+
totalDelegatedStake: number;
|
|
121
|
+
vaults: Record<WalletAddress, AoVaultData>;
|
|
122
|
+
startTimestamp: Timestamp;
|
|
123
|
+
endTimestamp: Timestamp;
|
|
124
|
+
observerAddress: WalletAddress;
|
|
125
|
+
operatorStake: number;
|
|
126
|
+
status: 'joined' | 'leaving';
|
|
127
|
+
weights: AoGatewayWeights;
|
|
128
|
+
};
|
|
129
|
+
export type AoGatewayStats = {
|
|
130
|
+
passedConsecutiveEpochs: number;
|
|
131
|
+
failedConsecutiveEpochs: number;
|
|
132
|
+
totalEpochParticipationCount: number;
|
|
133
|
+
passedEpochCount: number;
|
|
134
|
+
failedEpochCount: number;
|
|
135
|
+
observedEpochCount: number;
|
|
136
|
+
prescribedEpochCount: number;
|
|
137
|
+
};
|
|
138
|
+
export type AoWeightedObserver = {
|
|
139
|
+
gatewayAddress: WalletAddress;
|
|
140
|
+
observerAddress: WalletAddress;
|
|
141
|
+
stake: number;
|
|
142
|
+
startTimestamp: number;
|
|
143
|
+
} & AoGatewayWeights;
|
|
144
|
+
export type AoGatewayWeights = {
|
|
145
|
+
stakeWeight: number;
|
|
146
|
+
tenureWeight: number;
|
|
147
|
+
gatewayRewardRatioWeight: number;
|
|
148
|
+
observerRewardRatioWeight: number;
|
|
149
|
+
compositeWeight: number;
|
|
150
|
+
normalizedCompositeWeight: number;
|
|
151
|
+
};
|
|
152
|
+
export type AoGatewayWithAddress = AoGateway & {
|
|
153
|
+
gatewayAddress: WalletAddress;
|
|
154
|
+
};
|
|
155
|
+
export type AoGatewayDelegate = {
|
|
156
|
+
delegatedStake: number;
|
|
157
|
+
startTimestamp: Timestamp;
|
|
158
|
+
vaults: Record<WalletAddress, AoVaultData>;
|
|
159
|
+
};
|
|
160
|
+
export type AoGatewaySettings = {
|
|
161
|
+
allowDelegatedStaking: boolean;
|
|
162
|
+
delegateRewardShareRatio: number;
|
|
163
|
+
minDelegatedStake: number;
|
|
164
|
+
autoStake: boolean;
|
|
165
|
+
label: string;
|
|
166
|
+
note: string;
|
|
167
|
+
properties: string;
|
|
168
|
+
fqdn: string;
|
|
169
|
+
port: number;
|
|
170
|
+
protocol: 'https';
|
|
171
|
+
};
|
|
172
|
+
export type AoBalanceWithAddress = {
|
|
173
|
+
address: WalletAddress;
|
|
174
|
+
balance: number;
|
|
175
|
+
};
|
|
176
|
+
export type AoANTState = {
|
|
177
|
+
Name: string;
|
|
178
|
+
Ticker: string;
|
|
179
|
+
Denomination: number;
|
|
180
|
+
Owner: WalletAddress;
|
|
181
|
+
Controllers: WalletAddress[];
|
|
182
|
+
Records: Record<string, AoANTRecord>;
|
|
183
|
+
Balances: Record<WalletAddress, number>;
|
|
184
|
+
Logo: string;
|
|
185
|
+
TotalSupply: number;
|
|
186
|
+
Initialized: boolean;
|
|
187
|
+
};
|
|
188
|
+
export type AoANTRecord = {
|
|
189
|
+
transactionId: string;
|
|
190
|
+
ttlSeconds: number;
|
|
191
|
+
};
|
|
192
|
+
export type AoJoinNetworkParams = Pick<AoGateway, 'operatorStake' | 'observerAddress'> & Partial<AoGatewaySettings>;
|
|
193
|
+
export type AoUpdateGatewaySettingsParams = AtLeastOne<AoJoinNetworkParams>;
|
|
52
194
|
export interface AOContract {
|
|
53
195
|
read<K>({ tags, retries, }: {
|
|
54
196
|
tags?: {
|
|
@@ -57,13 +199,13 @@ export interface AOContract {
|
|
|
57
199
|
}[];
|
|
58
200
|
retries?: number;
|
|
59
201
|
}): Promise<K>;
|
|
60
|
-
send<
|
|
202
|
+
send<K>({ tags, data, signer, }: {
|
|
61
203
|
tags: {
|
|
62
204
|
name: string;
|
|
63
205
|
value: string;
|
|
64
206
|
}[];
|
|
65
|
-
data:
|
|
66
|
-
signer:
|
|
207
|
+
data: string | undefined;
|
|
208
|
+
signer: AoSigner;
|
|
67
209
|
}): Promise<{
|
|
68
210
|
id: string;
|
|
69
211
|
result?: K;
|
|
@@ -76,6 +218,7 @@ export interface AoIORead {
|
|
|
76
218
|
Logo: string;
|
|
77
219
|
Denomination: number;
|
|
78
220
|
}>;
|
|
221
|
+
getTokenSupply(): Promise<number>;
|
|
79
222
|
getEpochSettings(params?: EpochInput): Promise<AoEpochSettings>;
|
|
80
223
|
getGateway({ address, }: {
|
|
81
224
|
address: WalletAddress;
|
|
@@ -92,13 +235,13 @@ export interface AoIORead {
|
|
|
92
235
|
getArNSReservedNames(): Promise<Record<string, AoArNSReservedNameData> | Record<string, never>>;
|
|
93
236
|
getArNSReservedName({ name, }: {
|
|
94
237
|
name: string;
|
|
95
|
-
}): Promise<
|
|
238
|
+
}): Promise<AoArNSReservedNameData | undefined>;
|
|
96
239
|
getEpoch(epoch?: EpochInput): Promise<AoEpochData>;
|
|
97
240
|
getCurrentEpoch(): Promise<AoEpochData>;
|
|
98
|
-
getPrescribedObservers(epoch?: EpochInput): Promise<
|
|
241
|
+
getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
|
|
99
242
|
getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
|
|
100
|
-
getObservations(epoch?: EpochInput): Promise<
|
|
101
|
-
getDistributions(epoch?: EpochInput): Promise<
|
|
243
|
+
getObservations(epoch?: EpochInput): Promise<AoEpochObservationData>;
|
|
244
|
+
getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData>;
|
|
102
245
|
getTokenCost({ intent, purchaseType, years, name, quantity, }: {
|
|
103
246
|
intent: 'Buy-Record' | 'Extend-Lease' | 'Increase-Undername-Limit';
|
|
104
247
|
purchaseType?: 'permabuy' | 'lease';
|
|
@@ -112,12 +255,9 @@ export interface AoIOWrite extends AoIORead {
|
|
|
112
255
|
target: WalletAddress;
|
|
113
256
|
qty: number;
|
|
114
257
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
115
|
-
joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }:
|
|
116
|
-
observerAddress: string;
|
|
117
|
-
operatorStake: number | mIOToken;
|
|
118
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
258
|
+
joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoJoinNetworkParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
119
259
|
leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
|
|
120
|
-
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }:
|
|
260
|
+
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoUpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
121
261
|
increaseOperatorStake(params: {
|
|
122
262
|
increaseQty: number | mIOToken;
|
|
123
263
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
@@ -162,8 +302,8 @@ export interface AoANTRead {
|
|
|
162
302
|
}>;
|
|
163
303
|
getRecord({ undername }: {
|
|
164
304
|
undername: any;
|
|
165
|
-
}): Promise<
|
|
166
|
-
getRecords(): Promise<Record<string,
|
|
305
|
+
}): Promise<AoANTRecord | undefined>;
|
|
306
|
+
getRecords(): Promise<Record<string, AoANTRecord>>;
|
|
167
307
|
getOwner(): Promise<WalletAddress>;
|
|
168
308
|
getControllers(): Promise<WalletAddress[]>;
|
|
169
309
|
getTicker(): Promise<string>;
|
|
@@ -198,99 +338,23 @@ export interface AoANTWrite extends AoANTRead {
|
|
|
198
338
|
name: any;
|
|
199
339
|
}): Promise<AoMessageResult>;
|
|
200
340
|
}
|
|
201
|
-
export interface
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
Balances: Record<WalletAddress, number>;
|
|
209
|
-
Vaults: Record<WalletAddress, VaultData>;
|
|
210
|
-
Ticker: string;
|
|
211
|
-
Name: string;
|
|
212
|
-
Logo: string;
|
|
341
|
+
export interface AoANTRegistryRead {
|
|
342
|
+
accessControlList(params: {
|
|
343
|
+
address: string;
|
|
344
|
+
}): Promise<{
|
|
345
|
+
Owned: string[];
|
|
346
|
+
Controlled: string[];
|
|
347
|
+
}>;
|
|
213
348
|
}
|
|
214
|
-
export
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
processId: ProcessId;
|
|
222
|
-
startTimestamp: number;
|
|
223
|
-
type: RegistrationType;
|
|
224
|
-
undernameLimit: number;
|
|
225
|
-
purchasePrice: number;
|
|
226
|
-
};
|
|
227
|
-
export type AoArNSPermabuyData = AoArNSBaseNameData & {
|
|
228
|
-
type: 'permabuy';
|
|
229
|
-
};
|
|
230
|
-
export type AoArNSLeaseData = AoArNSBaseNameData & {
|
|
231
|
-
type: 'lease';
|
|
232
|
-
endTimestamp: number;
|
|
233
|
-
};
|
|
234
|
-
export type AoEpochSettings = {
|
|
235
|
-
epochZeroStartTimestamp: Timestamp;
|
|
236
|
-
durationMs: number;
|
|
237
|
-
prescribedNameCount: number;
|
|
238
|
-
rewardPercentage: number;
|
|
239
|
-
maxObservers: number;
|
|
240
|
-
distributionDelayMs: number;
|
|
241
|
-
};
|
|
242
|
-
export type AoEpochData = {
|
|
243
|
-
epochIndex: AoEpochIndex;
|
|
244
|
-
startHeight: BlockHeight;
|
|
245
|
-
observations: EpochObservations;
|
|
246
|
-
prescribedObservers: WeightedObserver[];
|
|
247
|
-
startTimestamp: Timestamp;
|
|
248
|
-
endTimestamp: Timestamp;
|
|
249
|
-
distributionTimestamp: Timestamp;
|
|
250
|
-
distributions: {
|
|
251
|
-
rewards: Record<WalletAddress, number>;
|
|
252
|
-
distributedTimestamp: Timestamp;
|
|
253
|
-
totalDistributedRewards: number;
|
|
254
|
-
totalEligibleRewards: number;
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
export type AoGatewayStats = {
|
|
258
|
-
passedConsecutiveEpochs: number;
|
|
259
|
-
failedConsecutiveEpochs: number;
|
|
260
|
-
totalEpochParticipationCount: number;
|
|
261
|
-
passedEpochCount: number;
|
|
262
|
-
failedEpochCount: number;
|
|
263
|
-
observedEpochCount: number;
|
|
264
|
-
prescribedEpochCount: number;
|
|
265
|
-
};
|
|
266
|
-
export type AoGateway = {
|
|
267
|
-
settings: GatewaySettings;
|
|
268
|
-
stats: AoGatewayStats;
|
|
269
|
-
delegates: Record<WalletAddress, GatewayDelegate>;
|
|
270
|
-
totalDelegatedStake: number;
|
|
271
|
-
vaults: Record<WalletAddress, VaultData>;
|
|
272
|
-
startTimestamp: Timestamp;
|
|
273
|
-
endTimestamp: Timestamp;
|
|
274
|
-
observerAddress: WalletAddress;
|
|
275
|
-
operatorStake: number;
|
|
276
|
-
status: 'joined' | 'leaving';
|
|
277
|
-
};
|
|
278
|
-
export type AoBalanceWithAddress = {
|
|
279
|
-
address: WalletAddress;
|
|
280
|
-
balance: number;
|
|
281
|
-
};
|
|
282
|
-
export type AoGatewayWithAddress = AoGateway & {
|
|
283
|
-
gatewayAddress: WalletAddress;
|
|
349
|
+
export interface AoANTRegistryWrite extends AoANTRegistryRead {
|
|
350
|
+
register(params: {
|
|
351
|
+
processId: string;
|
|
352
|
+
}): Promise<AoMessageResult>;
|
|
353
|
+
}
|
|
354
|
+
export declare function isProcessConfiguration(config: object): config is {
|
|
355
|
+
process: AOProcess;
|
|
284
356
|
};
|
|
285
|
-
export
|
|
286
|
-
|
|
287
|
-
Ticker: string;
|
|
288
|
-
Denomination: number;
|
|
289
|
-
Owner: WalletAddress;
|
|
290
|
-
Controllers: WalletAddress[];
|
|
291
|
-
Records: Record<string, ANTRecord>;
|
|
292
|
-
Balances: Record<WalletAddress, number>;
|
|
293
|
-
Logo: string;
|
|
294
|
-
TotalSupply: number;
|
|
295
|
-
Initialized: boolean;
|
|
357
|
+
export declare function isProcessIdConfiguration(config: object): config is {
|
|
358
|
+
processId: string;
|
|
296
359
|
};
|
|
360
|
+
export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
|
package/lib/types/token.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
interface Equatable<T> {
|
|
2
3
|
equals(other: T): boolean;
|
|
3
4
|
}
|
|
@@ -31,4 +32,16 @@ export declare class mIOToken extends PositiveFiniteInteger {
|
|
|
31
32
|
minus(subtractHend: mIOToken): mIOToken;
|
|
32
33
|
toIO(): IOToken;
|
|
33
34
|
}
|
|
35
|
+
export type AoSigner = (args: {
|
|
36
|
+
data: string | Buffer;
|
|
37
|
+
tags?: {
|
|
38
|
+
name: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}[];
|
|
41
|
+
target?: string;
|
|
42
|
+
anchor?: string;
|
|
43
|
+
}) => Promise<{
|
|
44
|
+
id: string;
|
|
45
|
+
raw: ArrayBuffer;
|
|
46
|
+
}>;
|
|
34
47
|
export {};
|
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 './contract-state.js';
|
|
18
17
|
export * from './common.js';
|
|
19
18
|
export * from './token.js';
|
|
20
19
|
export * from './io.js';
|
package/lib/types/utils/ao.d.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
signer: ContractSigner;
|
|
1
|
+
import { AoANTRecord, AoClient, AoSigner, ContractSigner, WalletAddress } from '../types.js';
|
|
2
|
+
export declare function spawnANT({ signer, module, luaCodeTxId, ao, scheduler, state, stateContractTxId, antRegistryId, }: {
|
|
3
|
+
signer: AoSigner;
|
|
5
4
|
module?: string;
|
|
6
5
|
luaCodeTxId?: string;
|
|
7
6
|
ao?: AoClient;
|
|
8
7
|
scheduler?: string;
|
|
9
|
-
state?:
|
|
8
|
+
state?: {
|
|
9
|
+
owner: WalletAddress;
|
|
10
|
+
controllers: WalletAddress[];
|
|
11
|
+
name: string;
|
|
12
|
+
ticker: string;
|
|
13
|
+
records: Record<string, AoANTRecord>;
|
|
14
|
+
balances: Record<WalletAddress, number>;
|
|
15
|
+
};
|
|
10
16
|
stateContractTxId?: string;
|
|
17
|
+
antRegistryId?: string;
|
|
11
18
|
}): Promise<string>;
|
|
12
19
|
export declare function evolveANT({ signer, processId, luaCodeTxId, ao, }: {
|
|
13
|
-
signer:
|
|
20
|
+
signer: AoSigner;
|
|
14
21
|
processId: string;
|
|
15
22
|
luaCodeTxId?: string;
|
|
16
23
|
ao?: AoClient;
|
|
17
24
|
}): Promise<string>;
|
|
25
|
+
export declare function createAoSigner(signer: ContractSigner): AoSigner;
|
|
@@ -16,10 +16,13 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { EventEmitter } from 'eventemitter3';
|
|
18
18
|
import { ILogger } from '../common/logger.js';
|
|
19
|
-
import { AoArNSNameData, AoIORead, ProcessId, WalletAddress } from '../types.js';
|
|
20
|
-
|
|
19
|
+
import { AoANTRegistryRead, AoArNSNameData, AoIORead, ProcessId, WalletAddress } from '../types.js';
|
|
20
|
+
/**
|
|
21
|
+
* @beta This API is in beta and may change in the future.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getANTProcessesOwnedByWallet: ({ address, registry, }: {
|
|
21
24
|
address: WalletAddress;
|
|
22
|
-
|
|
25
|
+
registry?: AoANTRegistryRead;
|
|
23
26
|
}) => Promise<ProcessId[]>;
|
|
24
27
|
export declare class ArNSEventEmitter extends EventEmitter {
|
|
25
28
|
protected contract: AoIORead;
|
|
@@ -32,12 +35,15 @@ export declare class ArNSEventEmitter extends EventEmitter {
|
|
|
32
35
|
concurrency?: number;
|
|
33
36
|
logger?: ILogger;
|
|
34
37
|
});
|
|
35
|
-
fetchProcessesOwnedByWallet({ address }: {
|
|
38
|
+
fetchProcessesOwnedByWallet({ address, pageSize, antRegistry, }: {
|
|
36
39
|
address: WalletAddress;
|
|
40
|
+
pageSize?: number;
|
|
41
|
+
antRegistry?: AoANTRegistryRead;
|
|
37
42
|
}): Promise<void>;
|
|
38
43
|
}
|
|
39
|
-
export declare const fetchAllArNSRecords: ({ contract, emitter, logger, }: {
|
|
44
|
+
export declare const fetchAllArNSRecords: ({ contract, emitter, logger, pageSize, }: {
|
|
40
45
|
contract?: AoIORead;
|
|
41
46
|
emitter?: EventEmitter;
|
|
42
47
|
logger?: ILogger;
|
|
48
|
+
pageSize?: number;
|
|
43
49
|
}) => Promise<Record<string, AoArNSNameData>>;
|
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": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"@types/sinon": "^10.0.15",
|
|
92
92
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
93
93
|
"@typescript-eslint/parser": "^6.4.0",
|
|
94
|
+
"arconnect": "^1.0.3",
|
|
94
95
|
"dotenv": "^16.4.5",
|
|
95
96
|
"dotenv-cli": "^7.4.2",
|
|
96
97
|
"esbuild": "^0.19.2",
|
|
@@ -108,6 +109,7 @@
|
|
|
108
109
|
"husky": "^8.0.3",
|
|
109
110
|
"jest": "^29.7.0",
|
|
110
111
|
"lint-staged": "^15.2.2",
|
|
112
|
+
"markdown-toc-gen": "^1.0.1",
|
|
111
113
|
"prettier": "^3.0.2",
|
|
112
114
|
"rimraf": "^5.0.1",
|
|
113
115
|
"semantic-release": "^21.0.7",
|
|
@@ -118,7 +120,7 @@
|
|
|
118
120
|
"vite-plugin-node-polyfills": "^0.22.0"
|
|
119
121
|
},
|
|
120
122
|
"dependencies": {
|
|
121
|
-
"@permaweb/aoconnect": "^0.0.
|
|
123
|
+
"@permaweb/aoconnect": "^0.0.57",
|
|
122
124
|
"arbundles": "0.11.0",
|
|
123
125
|
"arweave": "1.14.4",
|
|
124
126
|
"axios": "1.7.2",
|
|
@@ -130,6 +132,9 @@
|
|
|
130
132
|
"lint-staged": {
|
|
131
133
|
"**/*.{ts,js,mjs,cjs,md,json}": [
|
|
132
134
|
"prettier --write ."
|
|
135
|
+
],
|
|
136
|
+
"**/*.md": [
|
|
137
|
+
"markdown-toc-gen insert"
|
|
133
138
|
]
|
|
134
139
|
}
|
|
135
140
|
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ANT_CONTRACT_FUNCTIONS = exports.DENOMINATIONS = exports.AR_IO_CONTRACT_FUNCTIONS = exports.ioContractInteractions = exports.ioContractWriteInteractions = exports.ioContractReadInteractions = void 0;
|
|
4
|
-
exports.ioContractReadInteractions = [
|
|
5
|
-
'gateway',
|
|
6
|
-
'gateways',
|
|
7
|
-
'prescribedObservers',
|
|
8
|
-
'record',
|
|
9
|
-
'auction',
|
|
10
|
-
'balance',
|
|
11
|
-
'epoch',
|
|
12
|
-
'priceForInteraction',
|
|
13
|
-
];
|
|
14
|
-
exports.ioContractWriteInteractions = [
|
|
15
|
-
'delegateStake',
|
|
16
|
-
'decreaseDelegateStake',
|
|
17
|
-
'joinNetwork',
|
|
18
|
-
'increaseOperatorStake',
|
|
19
|
-
'decreaseOperatorStake',
|
|
20
|
-
'updateGatewaySettings',
|
|
21
|
-
'saveObservations',
|
|
22
|
-
'extendRecord',
|
|
23
|
-
'buyRecord',
|
|
24
|
-
'increaseUndernameCount',
|
|
25
|
-
'transfer',
|
|
26
|
-
];
|
|
27
|
-
exports.ioContractInteractions = [
|
|
28
|
-
...exports.ioContractReadInteractions,
|
|
29
|
-
...exports.ioContractWriteInteractions,
|
|
30
|
-
];
|
|
31
|
-
exports.AR_IO_CONTRACT_FUNCTIONS = {
|
|
32
|
-
GATEWAY: 'gateway',
|
|
33
|
-
GATEWAYS: 'gateways',
|
|
34
|
-
PRESCRIBED_OBSERVERS: 'prescribedObservers',
|
|
35
|
-
DELEGATE_STAKE: 'delegateStake',
|
|
36
|
-
DECREASE_DELEGATE_STAKE: 'decreaseDelegateStake',
|
|
37
|
-
JOIN_NETWORK: 'joinNetwork',
|
|
38
|
-
INCREASE_OPERATOR_STAKE: 'increaseOperatorStake',
|
|
39
|
-
DECREASE_OPERATOR_STAKE: 'decreaseOperatorStake',
|
|
40
|
-
UPDATE_GATEWAY_SETTINGS: 'updateGatewaySettings',
|
|
41
|
-
SAVE_OBSERVATIONS: 'saveObservations',
|
|
42
|
-
EXTEND_RECORD: 'extendRecord',
|
|
43
|
-
INCREASE_UNDERNAME_COUNT: 'increaseUndernameCount',
|
|
44
|
-
RECORD: 'record',
|
|
45
|
-
AUCTION: 'auction',
|
|
46
|
-
TRANSFER: 'transfer',
|
|
47
|
-
BALANCE: 'balance',
|
|
48
|
-
PRICE_FOR_INTERACTION: 'priceForInteraction',
|
|
49
|
-
EPOCH: 'epoch',
|
|
50
|
-
BUY_RECORD: 'buyRecord',
|
|
51
|
-
};
|
|
52
|
-
// Balances
|
|
53
|
-
var DENOMINATIONS;
|
|
54
|
-
(function (DENOMINATIONS) {
|
|
55
|
-
DENOMINATIONS["IO"] = "IO";
|
|
56
|
-
DENOMINATIONS["MIO"] = "mIO";
|
|
57
|
-
})(DENOMINATIONS || (exports.DENOMINATIONS = DENOMINATIONS = {}));
|
|
58
|
-
exports.ANT_CONTRACT_FUNCTIONS = {
|
|
59
|
-
TRANSFER: 'transfer',
|
|
60
|
-
SET_CONTROLLER: 'setController',
|
|
61
|
-
REMOVE_CONTROLLER: 'removeController',
|
|
62
|
-
SET_NAME: 'setName',
|
|
63
|
-
SET_TICKER: 'setTicker',
|
|
64
|
-
SET_RECORD: 'setRecord',
|
|
65
|
-
REMOVE_RECORD: 'removeRecord',
|
|
66
|
-
BALANCE: 'balance',
|
|
67
|
-
EVOLVE: 'evolve',
|
|
68
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export const ioContractReadInteractions = [
|
|
2
|
-
'gateway',
|
|
3
|
-
'gateways',
|
|
4
|
-
'prescribedObservers',
|
|
5
|
-
'record',
|
|
6
|
-
'auction',
|
|
7
|
-
'balance',
|
|
8
|
-
'epoch',
|
|
9
|
-
'priceForInteraction',
|
|
10
|
-
];
|
|
11
|
-
export const ioContractWriteInteractions = [
|
|
12
|
-
'delegateStake',
|
|
13
|
-
'decreaseDelegateStake',
|
|
14
|
-
'joinNetwork',
|
|
15
|
-
'increaseOperatorStake',
|
|
16
|
-
'decreaseOperatorStake',
|
|
17
|
-
'updateGatewaySettings',
|
|
18
|
-
'saveObservations',
|
|
19
|
-
'extendRecord',
|
|
20
|
-
'buyRecord',
|
|
21
|
-
'increaseUndernameCount',
|
|
22
|
-
'transfer',
|
|
23
|
-
];
|
|
24
|
-
export const ioContractInteractions = [
|
|
25
|
-
...ioContractReadInteractions,
|
|
26
|
-
...ioContractWriteInteractions,
|
|
27
|
-
];
|
|
28
|
-
export const AR_IO_CONTRACT_FUNCTIONS = {
|
|
29
|
-
GATEWAY: 'gateway',
|
|
30
|
-
GATEWAYS: 'gateways',
|
|
31
|
-
PRESCRIBED_OBSERVERS: 'prescribedObservers',
|
|
32
|
-
DELEGATE_STAKE: 'delegateStake',
|
|
33
|
-
DECREASE_DELEGATE_STAKE: 'decreaseDelegateStake',
|
|
34
|
-
JOIN_NETWORK: 'joinNetwork',
|
|
35
|
-
INCREASE_OPERATOR_STAKE: 'increaseOperatorStake',
|
|
36
|
-
DECREASE_OPERATOR_STAKE: 'decreaseOperatorStake',
|
|
37
|
-
UPDATE_GATEWAY_SETTINGS: 'updateGatewaySettings',
|
|
38
|
-
SAVE_OBSERVATIONS: 'saveObservations',
|
|
39
|
-
EXTEND_RECORD: 'extendRecord',
|
|
40
|
-
INCREASE_UNDERNAME_COUNT: 'increaseUndernameCount',
|
|
41
|
-
RECORD: 'record',
|
|
42
|
-
AUCTION: 'auction',
|
|
43
|
-
TRANSFER: 'transfer',
|
|
44
|
-
BALANCE: 'balance',
|
|
45
|
-
PRICE_FOR_INTERACTION: 'priceForInteraction',
|
|
46
|
-
EPOCH: 'epoch',
|
|
47
|
-
BUY_RECORD: 'buyRecord',
|
|
48
|
-
};
|
|
49
|
-
// Balances
|
|
50
|
-
export var DENOMINATIONS;
|
|
51
|
-
(function (DENOMINATIONS) {
|
|
52
|
-
DENOMINATIONS["IO"] = "IO";
|
|
53
|
-
DENOMINATIONS["MIO"] = "mIO";
|
|
54
|
-
})(DENOMINATIONS || (DENOMINATIONS = {}));
|
|
55
|
-
export const ANT_CONTRACT_FUNCTIONS = {
|
|
56
|
-
TRANSFER: 'transfer',
|
|
57
|
-
SET_CONTROLLER: 'setController',
|
|
58
|
-
REMOVE_CONTROLLER: 'removeController',
|
|
59
|
-
SET_NAME: 'setName',
|
|
60
|
-
SET_TICKER: 'setTicker',
|
|
61
|
-
SET_RECORD: 'setRecord',
|
|
62
|
-
REMOVE_RECORD: 'removeRecord',
|
|
63
|
-
BALANCE: 'balance',
|
|
64
|
-
EVOLVE: 'evolve',
|
|
65
|
-
};
|