@ar.io/sdk 2.0.3-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.
Files changed (43) hide show
  1. package/README.md +103 -22
  2. package/bundles/web.bundle.min.js +104 -104
  3. package/lib/cjs/common/ant-registry.js +87 -0
  4. package/lib/cjs/common/ant.js +3 -9
  5. package/lib/cjs/common/contracts/ao-process.js +2 -19
  6. package/lib/cjs/common/index.js +1 -0
  7. package/lib/cjs/common/io.js +14 -12
  8. package/lib/cjs/constants.js +3 -2
  9. package/lib/cjs/io.js +2 -1
  10. package/lib/cjs/types.js +0 -1
  11. package/lib/cjs/utils/ao.js +53 -3
  12. package/lib/cjs/utils/json.js +3 -2
  13. package/lib/cjs/utils/processes.js +24 -43
  14. package/lib/cjs/version.js +1 -1
  15. package/lib/esm/common/ant-registry.js +81 -0
  16. package/lib/esm/common/ant.js +3 -9
  17. package/lib/esm/common/contracts/ao-process.js +2 -19
  18. package/lib/esm/common/index.js +1 -0
  19. package/lib/esm/common/io.js +14 -12
  20. package/lib/esm/constants.js +2 -1
  21. package/lib/esm/io.js +2 -1
  22. package/lib/esm/types.js +0 -1
  23. package/lib/esm/utils/ao.js +52 -4
  24. package/lib/esm/utils/json.js +1 -0
  25. package/lib/esm/utils/processes.js +24 -43
  26. package/lib/esm/version.js +1 -1
  27. package/lib/types/common/ant-registry.d.ts +26 -0
  28. package/lib/types/common/ant.d.ts +5 -4
  29. package/lib/types/common/contracts/ao-process.d.ts +4 -17
  30. package/lib/types/common/index.d.ts +1 -0
  31. package/lib/types/common/io.d.ts +9 -12
  32. package/lib/types/common.d.ts +2 -25
  33. package/lib/types/constants.d.ts +2 -1
  34. package/lib/types/io.d.ts +181 -116
  35. package/lib/types/token.d.ts +13 -0
  36. package/lib/types/types.d.ts +0 -1
  37. package/lib/types/utils/ao.d.ts +19 -5
  38. package/lib/types/utils/processes.d.ts +11 -5
  39. package/lib/types/version.d.ts +1 -1
  40. package/package.json +7 -2
  41. package/lib/cjs/contract-state.js +0 -68
  42. package/lib/esm/contract-state.js +0 -65
  43. package/lib/types/contract-state.d.ts +0 -201
@@ -16,16 +16,14 @@
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
  import { dryrun, message, monitor, result, results, spawn, unmonitor } from '@permaweb/aoconnect';
19
- import { ArconnectSigner, ArweaveSigner } from 'arbundles';
20
- import { AllowedProtocols, GatewayConnectionSettings, GatewayMetadata, GatewayStakingSettings } from './contract-state.js';
21
- import { mIOToken } from './token.js';
19
+ import { Signer } from 'arbundles';
22
20
  export type BlockHeight = number;
23
21
  export type SortKey = string;
24
22
  export type Timestamp = number;
25
23
  export type WalletAddress = string;
26
24
  export type TransactionId = string;
27
25
  export type ProcessId = string;
28
- export type ContractSigner = ArweaveSigner | ArconnectSigner;
26
+ export type ContractSigner = Signer | Window['arweaveWallet'];
29
27
  export type WithSigner<T = NonNullable<unknown>> = {
30
28
  signer: ContractSigner;
31
29
  } & T;
@@ -46,29 +44,9 @@ export type WriteParameters<Input> = WithSigner<Required<ReadParameters<Input>>>
46
44
  export type AoMessageResult = {
47
45
  id: string;
48
46
  };
49
- type Overwrite<T, U> = {
50
- [K in keyof T]: K extends keyof U ? U[K] : T[K];
51
- };
52
- export type JoinNetworkParams = Overwrite<GatewayConnectionSettings & GatewayStakingSettings & GatewayMetadata, {
53
- minDelegatedStake: number | mIOToken;
54
- }>;
55
- export type UpdateGatewaySettingsParamsBase = {
56
- allowDelegatedStaking?: boolean;
57
- delegateRewardShareRatio?: number;
58
- fqdn?: string;
59
- label?: string;
60
- minDelegatedStake?: number | mIOToken;
61
- note?: string;
62
- port?: number;
63
- properties?: string;
64
- protocol?: AllowedProtocols;
65
- autoStake?: boolean;
66
- observerAddress?: WalletAddress;
67
- };
68
47
  export type AtLeastOne<T, U = {
69
48
  [K in keyof T]-?: Record<K, T[K]>;
70
49
  }> = Partial<T> & U[keyof U];
71
- export type UpdateGatewaySettingsParams = AtLeastOne<UpdateGatewaySettingsParamsBase>;
72
50
  export interface HTTPClient {
73
51
  get<I, K>({ endpoint, signal, headers, allowedStatuses, params, }: {
74
52
  endpoint: string;
@@ -87,4 +65,3 @@ export interface AoClient {
87
65
  unmonitor: typeof unmonitor;
88
66
  dryrun: typeof dryrun;
89
67
  }
90
- export {};
@@ -23,7 +23,8 @@ export declare const ARNS_DEVNET_REGISTRY_TX = "_NctcA2sRy1-J4OmIQZbYFPM17piNcbd
23
23
  export declare const IO_DEVNET_PROCESS_ID = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
24
24
  export declare const ioDevnetProcessId = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
25
25
  export declare const IO_TESTNET_PROCESS_ID = "agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA";
26
+ export declare const ANT_REGISTRY_ID = "i_le_yKKPVstLTDSmkHRqf-wYphMnwB9OhleiTgMkWc";
26
27
  export declare const MIO_PER_IO = 1000000;
27
28
  export declare const AOS_MODULE_ID = "cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk";
28
- export declare const ANT_LUA_ID = "3OlGzE5mrsN2GsxCYM0Tae1KzWepGOr5a94deOWmApM";
29
+ export declare const ANT_LUA_ID = "Flwio4Lr08g6s6uim6lEJNnVGD9ylvz0_aafvpiL8FI";
29
30
  export declare const DEFAULT_SCHEDULER_ID = "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";
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, BlockHeight, ContractSigner, JoinNetworkParams, ProcessId, Timestamp, TransactionId, UpdateGatewaySettingsParams, WalletAddress, WriteOptions } from './types.js';
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<I, K>({ tags, data, signer, }: {
202
+ send<K>({ tags, data, signer, }: {
61
203
  tags: {
62
204
  name: string;
63
205
  value: string;
64
206
  }[];
65
- data: I;
66
- signer: ContractSigner;
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<ArNSReservedNameData | undefined>;
238
+ }): Promise<AoArNSReservedNameData | undefined>;
96
239
  getEpoch(epoch?: EpochInput): Promise<AoEpochData>;
97
240
  getCurrentEpoch(): Promise<AoEpochData>;
98
- getPrescribedObservers(epoch?: EpochInput): Promise<WeightedObserver[]>;
241
+ getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
99
242
  getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
100
- getObservations(epoch?: EpochInput): Promise<EpochObservations>;
101
- getDistributions(epoch?: EpochInput): Promise<EpochDistributionData>;
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, }: Omit<JoinNetworkParams, 'observerWallet' | 'qty'> & {
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, }: UpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
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>;
@@ -158,11 +298,12 @@ export interface AoANTRead {
158
298
  Ticker: string;
159
299
  Denomination: number;
160
300
  Owner: string;
301
+ ['Source-Code-TX-ID']?: string;
161
302
  }>;
162
303
  getRecord({ undername }: {
163
304
  undername: any;
164
- }): Promise<ANTRecord | undefined>;
165
- getRecords(): Promise<Record<string, ANTRecord>>;
305
+ }): Promise<AoANTRecord | undefined>;
306
+ getRecords(): Promise<Record<string, AoANTRecord>>;
166
307
  getOwner(): Promise<WalletAddress>;
167
308
  getControllers(): Promise<WalletAddress[]>;
168
309
  getTicker(): Promise<string>;
@@ -197,99 +338,23 @@ export interface AoANTWrite extends AoANTRead {
197
338
  name: any;
198
339
  }): Promise<AoMessageResult>;
199
340
  }
200
- export interface AoIOState {
201
- GatewayRegistry: Record<WalletAddress, AoGateway>;
202
- Epochs: Record<AoEpochIndex, AoEpochData>;
203
- NameRegistry: {
204
- records: Record<string, AoArNSNameData>;
205
- reserved: Record<string, AoArNSReservedNameData>;
206
- };
207
- Balances: Record<WalletAddress, number>;
208
- Vaults: Record<WalletAddress, VaultData>;
209
- Ticker: string;
210
- Name: string;
211
- Logo: string;
341
+ export interface AoANTRegistryRead {
342
+ accessControlList(params: {
343
+ address: string;
344
+ }): Promise<{
345
+ Owned: string[];
346
+ Controlled: string[];
347
+ }>;
212
348
  }
213
- export type AoEpochIndex = number;
214
- export type AoArNSReservedNameData = ArNSReservedNameData;
215
- export type AoArNSNameData = AoArNSPermabuyData | AoArNSLeaseData;
216
- export type AoArNSNameDataWithName = AoArNSNameData & {
217
- name: string;
218
- };
219
- export type AoArNSBaseNameData = {
220
- processId: ProcessId;
221
- startTimestamp: number;
222
- type: RegistrationType;
223
- undernameLimit: number;
224
- purchasePrice: number;
225
- };
226
- export type AoArNSPermabuyData = AoArNSBaseNameData & {
227
- type: 'permabuy';
228
- };
229
- export type AoArNSLeaseData = AoArNSBaseNameData & {
230
- type: 'lease';
231
- endTimestamp: number;
232
- };
233
- export type AoEpochSettings = {
234
- epochZeroStartTimestamp: Timestamp;
235
- durationMs: number;
236
- prescribedNameCount: number;
237
- rewardPercentage: number;
238
- maxObservers: number;
239
- distributionDelayMs: number;
240
- };
241
- export type AoEpochData = {
242
- epochIndex: AoEpochIndex;
243
- startHeight: BlockHeight;
244
- observations: EpochObservations;
245
- prescribedObservers: WeightedObserver[];
246
- startTimestamp: Timestamp;
247
- endTimestamp: Timestamp;
248
- distributionTimestamp: Timestamp;
249
- distributions: {
250
- rewards: Record<WalletAddress, number>;
251
- distributedTimestamp: Timestamp;
252
- totalDistributedRewards: number;
253
- totalEligibleRewards: number;
254
- };
255
- };
256
- export type AoGatewayStats = {
257
- passedConsecutiveEpochs: number;
258
- failedConsecutiveEpochs: number;
259
- totalEpochParticipationCount: number;
260
- passedEpochCount: number;
261
- failedEpochCount: number;
262
- observedEpochCount: number;
263
- prescribedEpochCount: number;
264
- };
265
- export type AoGateway = {
266
- settings: GatewaySettings;
267
- stats: AoGatewayStats;
268
- delegates: Record<WalletAddress, GatewayDelegate>;
269
- totalDelegatedStake: number;
270
- vaults: Record<WalletAddress, VaultData>;
271
- startTimestamp: Timestamp;
272
- endTimestamp: Timestamp;
273
- observerAddress: WalletAddress;
274
- operatorStake: number;
275
- status: 'joined' | 'leaving';
276
- };
277
- export type AoBalanceWithAddress = {
278
- address: WalletAddress;
279
- balance: number;
280
- };
281
- export type AoGatewayWithAddress = AoGateway & {
282
- 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;
283
356
  };
284
- export type AoANTState = {
285
- Name: string;
286
- Ticker: string;
287
- Denomination: number;
288
- Owner: WalletAddress;
289
- Controllers: WalletAddress[];
290
- Records: Record<string, ANTRecord>;
291
- Balances: Record<WalletAddress, number>;
292
- Logo: string;
293
- TotalSupply: number;
294
- Initialized: boolean;
357
+ export declare function isProcessIdConfiguration(config: object): config is {
358
+ processId: string;
295
359
  };
360
+ export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
@@ -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 {};
@@ -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';
@@ -1,11 +1,25 @@
1
- import { ANTState } from '../contract-state.js';
2
- import { AoClient, ContractSigner } from '../types.js';
3
- export declare function spawnANT({ signer, module, luaCodeTxId, ao, scheduler, state, stateContractTxId, }: {
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?: ANTState;
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>;
19
+ export declare function evolveANT({ signer, processId, luaCodeTxId, ao, }: {
20
+ signer: AoSigner;
21
+ processId: string;
22
+ luaCodeTxId?: string;
23
+ ao?: AoClient;
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
- export declare const getANTProcessesOwnedByWallet: ({ address, contract, }: {
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
- contract?: AoIORead;
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>>;
@@ -14,4 +14,4 @@
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 declare const version = "2.0.2";
17
+ export declare const version = "2.1.0-alpha.9";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "2.0.3-alpha.1",
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.55",
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
- };