@ar.io/sdk 2.1.0-alpha.7 → 2.1.0-alpha.9

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.
@@ -0,0 +1,26 @@
1
+ import { AoANTRegistryRead, AoANTRegistryWrite, AoMessageResult, ProcessConfiguration, WithSigner } from '../types.js';
2
+ import { AOProcess } from './index.js';
3
+ export declare class ANTRegistry {
4
+ static init(): AoANTRegistryRead;
5
+ static init(config: Required<ProcessConfiguration> & {
6
+ signer?: undefined;
7
+ }): AoANTRegistryRead;
8
+ static init({ signer, ...config }: WithSigner<Required<ProcessConfiguration>>): AoANTRegistryRead;
9
+ }
10
+ export declare class AoANTRegistryReadable implements AoANTRegistryRead {
11
+ protected process: AOProcess;
12
+ constructor(config?: ProcessConfiguration);
13
+ accessControlList({ address, }: {
14
+ address: string;
15
+ }): Promise<{
16
+ Owned: string[];
17
+ Controlled: string[];
18
+ }>;
19
+ }
20
+ export declare class AoANTRegistryWriteable extends AoANTRegistryReadable implements AoANTRegistryWrite {
21
+ private signer;
22
+ constructor({ signer, ...config }: WithSigner<ProcessConfiguration>);
23
+ register({ processId, }: {
24
+ processId: string;
25
+ }): Promise<AoMessageResult>;
26
+ }
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- import { ANTRecord, AoANTRead, AoANTState, AoANTWrite, AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner } from '../types.js';
17
+ import { AoANTRead, AoANTRecord, AoANTState, AoANTWrite, AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner } from '../types.js';
18
18
  import { AOProcess } from './index.js';
19
19
  export declare class ANT {
20
20
  static init(config: Required<ProcessConfiguration> & {
@@ -44,16 +44,16 @@ export declare class AoANTReadable implements AoANTRead {
44
44
  */
45
45
  getRecord({ undername }: {
46
46
  undername: string;
47
- }): Promise<ANTRecord>;
47
+ }): Promise<AoANTRecord>;
48
48
  /**
49
- * @returns {Promise<Record<string, ANTRecord>>} All the undernames managed by the ANT.
49
+ * @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
50
50
  * @example
51
51
  * Get the current records
52
52
  * ```ts
53
53
  * ant.getRecords();
54
54
  * ````
55
55
  */
56
- getRecords(): Promise<Record<string, ANTRecord>>;
56
+ getRecords(): Promise<Record<string, AoANTRecord>>;
57
57
  /**
58
58
  * @returns {Promise<string>} The owner of the ANT.
59
59
  * @example
@@ -17,5 +17,6 @@
17
17
  export * from './error.js';
18
18
  export * from './logger.js';
19
19
  export * from './ant.js';
20
+ export * from './ant-registry.js';
20
21
  export * from './io.js';
21
22
  export * from './contracts/ao-process.js';
@@ -15,10 +15,9 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  import Arweave from 'arweave';
18
- import { ArNSReservedNameData, EpochDistributionData, EpochObservations, WeightedObserver } from '../contract-state.js';
19
18
  import { AoArNSNameData, AoEpochData, AoEpochSettings, AoGateway, AoIORead, AoIOWrite, EpochInput } from '../io.js';
20
19
  import { mIOToken } from '../token.js';
21
- import { AoArNSNameDataWithName, AoBalanceWithAddress, AoGatewayWithAddress, AoMessageResult, ContractSigner, JoinNetworkParams, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, UpdateGatewaySettingsParams, WalletAddress, WithSigner, WriteOptions } from '../types.js';
20
+ import { AoArNSNameDataWithName, AoArNSReservedNameData, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types.js';
22
21
  import { AOProcess } from './contracts/ao-process.js';
23
22
  export declare class IO {
24
23
  static init(): AoIORead;
@@ -56,10 +55,10 @@ export declare class IOReadable implements AoIORead {
56
55
  name: string;
57
56
  }): Promise<AoArNSNameData | undefined>;
58
57
  getArNSRecords(pageParams?: PaginationParams): Promise<PaginationResult<AoArNSNameDataWithName>>;
59
- getArNSReservedNames(): Promise<Record<string, ArNSReservedNameData> | Record<string, never>>;
58
+ getArNSReservedNames(): Promise<Record<string, AoArNSReservedNameData> | Record<string, never>>;
60
59
  getArNSReservedName({ name, }: {
61
60
  name: string;
62
- }): Promise<ArNSReservedNameData | undefined>;
61
+ }): Promise<AoArNSReservedNameData | undefined>;
63
62
  getBalance({ address }: {
64
63
  address: WalletAddress;
65
64
  }): Promise<number>;
@@ -69,10 +68,10 @@ export declare class IOReadable implements AoIORead {
69
68
  }): Promise<AoGateway | undefined>;
70
69
  getGateways(pageParams?: PaginationParams): Promise<PaginationResult<AoGatewayWithAddress>>;
71
70
  getCurrentEpoch(): Promise<AoEpochData>;
72
- getPrescribedObservers(epoch?: EpochInput): Promise<WeightedObserver[]>;
71
+ getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
73
72
  getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
74
- getObservations(epoch?: EpochInput): Promise<EpochObservations>;
75
- getDistributions(epoch?: EpochInput): Promise<EpochDistributionData>;
73
+ getObservations(epoch?: EpochInput): Promise<AoEpochObservationData>;
74
+ getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData>;
76
75
  getTokenCost(params: {
77
76
  intent: 'Buy-Record';
78
77
  purchaseType: 'permabuy' | 'lease';
@@ -102,12 +101,9 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
102
101
  target: string;
103
102
  qty: number | mIOToken;
104
103
  }, options?: WriteOptions): Promise<AoMessageResult>;
105
- joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: Omit<JoinNetworkParams, 'observerWallet' | 'qty'> & {
106
- observerAddress: string;
107
- operatorStake: number | mIOToken;
108
- }, options?: WriteOptions): Promise<AoMessageResult>;
104
+ joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoJoinNetworkParams, options?: WriteOptions): Promise<AoMessageResult>;
109
105
  leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
110
- updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: UpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
106
+ updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoUpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
111
107
  delegateStake(params: {
112
108
  target: string;
113
109
  stakeQty: number | mIOToken;
@@ -17,8 +17,6 @@
17
17
  */
18
18
  import { dryrun, message, monitor, result, results, spawn, unmonitor } from '@permaweb/aoconnect';
19
19
  import { Signer } from 'arbundles';
20
- import { AllowedProtocols, GatewayConnectionSettings, GatewayMetadata, GatewayStakingSettings } from './contract-state.js';
21
- import { mIOToken } from './token.js';
22
20
  export type BlockHeight = number;
23
21
  export type SortKey = string;
24
22
  export type Timestamp = number;
@@ -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,6 +23,7 @@ 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
29
  export declare const ANT_LUA_ID = "Flwio4Lr08g6s6uim6lEJNnVGD9ylvz0_aafvpiL8FI";
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
- import { AoSigner, mIOToken } from './token.js';
20
- import { AoMessageResult, BlockHeight, 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;
18
+ import { mIOToken } from './token.js';
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,155 @@ 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
+ };
128
+ export type AoGatewayStats = {
129
+ passedConsecutiveEpochs: number;
130
+ failedConsecutiveEpochs: number;
131
+ totalEpochParticipationCount: number;
132
+ passedEpochCount: number;
133
+ failedEpochCount: number;
134
+ observedEpochCount: number;
135
+ prescribedEpochCount: number;
136
+ };
137
+ export type AoWeightedObserver = {
138
+ gatewayAddress: WalletAddress;
139
+ observerAddress: WalletAddress;
140
+ stake: number;
141
+ startTimestamp: number;
142
+ } & AoGatewayWeights;
143
+ export type AoGatewayWeights = {
144
+ stakeWeight: number;
145
+ tenureWeight: number;
146
+ gatewayRewardRatioWeight: number;
147
+ observerRewardRatioWeight: number;
148
+ compositeWeight: number;
149
+ normalizedCompositeWeight: number;
150
+ };
151
+ export type AoGatewayWithAddress = AoGateway & {
152
+ gatewayAddress: WalletAddress;
153
+ };
154
+ export type AoGatewayDelegate = {
155
+ delegatedStake: number;
156
+ startTimestamp: Timestamp;
157
+ vaults: Record<WalletAddress, AoVaultData>;
158
+ };
159
+ export type AoGatewaySettings = {
160
+ allowDelegatedStaking: boolean;
161
+ delegateRewardShareRatio: number;
162
+ minDelegatedStake: number;
163
+ autoStake: boolean;
164
+ label: string;
165
+ note: string;
166
+ properties: string;
167
+ fqdn: string;
168
+ port: number;
169
+ protocol: 'https';
170
+ };
171
+ export type AoBalanceWithAddress = {
172
+ address: WalletAddress;
173
+ balance: number;
174
+ };
175
+ export type AoANTState = {
176
+ Name: string;
177
+ Ticker: string;
178
+ Denomination: number;
179
+ Owner: WalletAddress;
180
+ Controllers: WalletAddress[];
181
+ Records: Record<string, AoANTRecord>;
182
+ Balances: Record<WalletAddress, number>;
183
+ Logo: string;
184
+ TotalSupply: number;
185
+ Initialized: boolean;
186
+ };
187
+ export type AoANTRecord = {
188
+ transactionId: string;
189
+ ttlSeconds: number;
190
+ };
191
+ export type AoJoinNetworkParams = Pick<AoGateway, 'operatorStake' | 'observerAddress'> & Partial<AoGatewaySettings>;
192
+ export type AoUpdateGatewaySettingsParams = AtLeastOne<AoJoinNetworkParams>;
52
193
  export interface AOContract {
53
194
  read<K>({ tags, retries, }: {
54
195
  tags?: {
@@ -93,13 +234,13 @@ export interface AoIORead {
93
234
  getArNSReservedNames(): Promise<Record<string, AoArNSReservedNameData> | Record<string, never>>;
94
235
  getArNSReservedName({ name, }: {
95
236
  name: string;
96
- }): Promise<ArNSReservedNameData | undefined>;
237
+ }): Promise<AoArNSReservedNameData | undefined>;
97
238
  getEpoch(epoch?: EpochInput): Promise<AoEpochData>;
98
239
  getCurrentEpoch(): Promise<AoEpochData>;
99
- getPrescribedObservers(epoch?: EpochInput): Promise<WeightedObserver[]>;
240
+ getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
100
241
  getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
101
- getObservations(epoch?: EpochInput): Promise<EpochObservations>;
102
- getDistributions(epoch?: EpochInput): Promise<EpochDistributionData>;
242
+ getObservations(epoch?: EpochInput): Promise<AoEpochObservationData>;
243
+ getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData>;
103
244
  getTokenCost({ intent, purchaseType, years, name, quantity, }: {
104
245
  intent: 'Buy-Record' | 'Extend-Lease' | 'Increase-Undername-Limit';
105
246
  purchaseType?: 'permabuy' | 'lease';
@@ -113,12 +254,9 @@ export interface AoIOWrite extends AoIORead {
113
254
  target: WalletAddress;
114
255
  qty: number;
115
256
  }, options?: WriteOptions): Promise<AoMessageResult>;
116
- joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: Omit<JoinNetworkParams, 'observerWallet' | 'qty'> & {
117
- observerAddress: string;
118
- operatorStake: number | mIOToken;
119
- }, options?: WriteOptions): Promise<AoMessageResult>;
257
+ joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoJoinNetworkParams, options?: WriteOptions): Promise<AoMessageResult>;
120
258
  leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
121
- updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: UpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
259
+ updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoUpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
122
260
  increaseOperatorStake(params: {
123
261
  increaseQty: number | mIOToken;
124
262
  }, options?: WriteOptions): Promise<AoMessageResult>;
@@ -163,8 +301,8 @@ export interface AoANTRead {
163
301
  }>;
164
302
  getRecord({ undername }: {
165
303
  undername: any;
166
- }): Promise<ANTRecord | undefined>;
167
- getRecords(): Promise<Record<string, ANTRecord>>;
304
+ }): Promise<AoANTRecord | undefined>;
305
+ getRecords(): Promise<Record<string, AoANTRecord>>;
168
306
  getOwner(): Promise<WalletAddress>;
169
307
  getControllers(): Promise<WalletAddress[]>;
170
308
  getTicker(): Promise<string>;
@@ -199,108 +337,23 @@ export interface AoANTWrite extends AoANTRead {
199
337
  name: any;
200
338
  }): Promise<AoMessageResult>;
201
339
  }
202
- export interface AoIOState {
203
- GatewayRegistry: Record<WalletAddress, AoGateway>;
204
- Epochs: Record<AoEpochIndex, AoEpochData>;
205
- NameRegistry: {
206
- records: Record<string, AoArNSNameData>;
207
- reserved: Record<string, AoArNSReservedNameData>;
208
- };
209
- Balances: Record<WalletAddress, number>;
210
- Vaults: Record<WalletAddress, VaultData>;
211
- Ticker: string;
212
- Name: string;
213
- Logo: string;
340
+ export interface AoANTRegistryRead {
341
+ accessControlList(params: {
342
+ address: string;
343
+ }): Promise<{
344
+ Owned: string[];
345
+ Controlled: string[];
346
+ }>;
214
347
  }
215
- export type AoEpochIndex = number;
216
- export type AoArNSReservedNameData = ArNSReservedNameData;
217
- export type AoArNSNameData = AoArNSPermabuyData | AoArNSLeaseData;
218
- export type AoArNSNameDataWithName = AoArNSNameData & {
219
- name: string;
220
- };
221
- export type AoArNSBaseNameData = {
222
- processId: ProcessId;
223
- startTimestamp: number;
224
- type: RegistrationType;
225
- undernameLimit: number;
226
- purchasePrice: number;
227
- };
228
- export type AoArNSPermabuyData = AoArNSBaseNameData & {
229
- type: 'permabuy';
230
- };
231
- export type AoArNSLeaseData = AoArNSBaseNameData & {
232
- type: 'lease';
233
- endTimestamp: number;
234
- };
235
- export type AoEpochSettings = {
236
- epochZeroStartTimestamp: Timestamp;
237
- durationMs: number;
238
- prescribedNameCount: number;
239
- rewardPercentage: number;
240
- maxObservers: number;
241
- distributionDelayMs: number;
242
- };
243
- export type AoEpochData = {
244
- epochIndex: AoEpochIndex;
245
- startHeight: BlockHeight;
246
- observations: EpochObservations;
247
- prescribedObservers: WeightedObserver[];
248
- startTimestamp: Timestamp;
249
- endTimestamp: Timestamp;
250
- distributionTimestamp: Timestamp;
251
- distributions: {
252
- rewards: Record<WalletAddress, number>;
253
- distributedTimestamp: Timestamp;
254
- totalDistributedRewards: number;
255
- totalEligibleRewards: number;
256
- };
257
- };
258
- export type AoGatewayStats = {
259
- passedConsecutiveEpochs: number;
260
- failedConsecutiveEpochs: number;
261
- totalEpochCount: number;
262
- passedEpochCount: number;
263
- failedEpochCount: number;
264
- observedEpochCount: number;
265
- prescribedEpochCount: number;
266
- };
267
- export type AoGatewayWeights = {
268
- compositeWeight: number;
269
- gatewayRewardRatioWeight: number;
270
- tenureWeight: number;
271
- observerRewardRatioWeight: number;
272
- normalizedCompositeWeight: number;
273
- stakeWeight: number;
274
- };
275
- export type AoGateway = {
276
- settings: GatewaySettings;
277
- stats: AoGatewayStats;
278
- delegates: Record<WalletAddress, GatewayDelegate>;
279
- totalDelegatedStake: number;
280
- vaults: Record<WalletAddress, VaultData>;
281
- startTimestamp: Timestamp;
282
- endTimestamp: Timestamp;
283
- observerAddress: WalletAddress;
284
- operatorStake: number;
285
- status: 'joined' | 'leaving';
286
- weights: AoGatewayWeights;
287
- };
288
- export type AoBalanceWithAddress = {
289
- address: WalletAddress;
290
- balance: number;
291
- };
292
- export type AoGatewayWithAddress = AoGateway & {
293
- gatewayAddress: WalletAddress;
348
+ export interface AoANTRegistryWrite extends AoANTRegistryRead {
349
+ register(params: {
350
+ processId: string;
351
+ }): Promise<AoMessageResult>;
352
+ }
353
+ export declare function isProcessConfiguration(config: object): config is {
354
+ process: AOProcess;
294
355
  };
295
- export type AoANTState = {
296
- Name: string;
297
- Ticker: string;
298
- Denomination: number;
299
- Owner: WalletAddress;
300
- Controllers: WalletAddress[];
301
- Records: Record<string, ANTRecord>;
302
- Balances: Record<WalletAddress, number>;
303
- Logo: string;
304
- TotalSupply: number;
305
- Initialized: boolean;
356
+ export declare function isProcessIdConfiguration(config: object): config is {
357
+ processId: string;
306
358
  };
359
+ export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
@@ -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,13 +1,20 @@
1
- import { ANTState } from '../contract-state.js';
2
- import { AoClient, AoSigner, ContractSigner } from '../types.js';
3
- export declare function spawnANT({ signer, module, luaCodeTxId, ao, scheduler, state, stateContractTxId, }: {
1
+ import { AoANTRecord, AoClient, AoSigner, ContractSigner, WalletAddress } from '../types.js';
2
+ export declare function spawnANT({ signer, module, luaCodeTxId, ao, scheduler, state, stateContractTxId, antRegistryId, }: {
4
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>;
12
19
  export declare function evolveANT({ signer, processId, luaCodeTxId, ao, }: {
13
20
  signer: 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,9 +35,10 @@ export declare class ArNSEventEmitter extends EventEmitter {
32
35
  concurrency?: number;
33
36
  logger?: ILogger;
34
37
  });
35
- fetchProcessesOwnedByWallet({ address, pageSize, }: {
38
+ fetchProcessesOwnedByWallet({ address, pageSize, antRegistry, }: {
36
39
  address: WalletAddress;
37
40
  pageSize?: number;
41
+ antRegistry?: AoANTRegistryRead;
38
42
  }): Promise<void>;
39
43
  }
40
44
  export declare const fetchAllArNSRecords: ({ contract, emitter, logger, pageSize, }: {
@@ -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.1.0-alpha.6";
17
+ export declare const version = "2.1.0-alpha.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "2.1.0-alpha.7",
3
+ "version": "2.1.0-alpha.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"
@@ -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
- };