@ar.io/sdk 3.14.1-alpha.1 → 3.14.1-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.
@@ -427,6 +427,17 @@ const utils_js_1 = require("./utils.js");
427
427
  options: options_js_1.arnsPurchaseOptions,
428
428
  action: arnsPurchaseCommands_js_1.requestPrimaryNameCLICommand,
429
429
  });
430
+ // # ANT Registry
431
+ (0, utils_js_1.makeCommand)({
432
+ name: 'get-ant-registry-acl',
433
+ description: 'Get the ACL of an ANT registry',
434
+ options: [
435
+ options_js_1.optionMap.address,
436
+ options_js_1.optionMap.antRegistryProcessId,
437
+ options_js_1.optionMap.hyperbeamUrl,
438
+ ],
439
+ action: readCommands_js_1.listAntsForAddress,
440
+ });
430
441
  // # ANTS
431
442
  // # Getters
432
443
  (0, utils_js_1.makeCommand)({
@@ -22,6 +22,7 @@ exports.getGatewayVaults = getGatewayVaults;
22
22
  exports.getAllGatewayVaults = getAllGatewayVaults;
23
23
  exports.getVault = getVault;
24
24
  exports.resolveArNSName = resolveArNSName;
25
+ exports.listAntsForAddress = listAntsForAddress;
25
26
  const token_js_1 = require("../../types/token.js");
26
27
  const utils_js_1 = require("../utils.js");
27
28
  async function getGateway(o) {
@@ -194,3 +195,10 @@ async function resolveArNSName(o) {
194
195
  const result = await (0, utils_js_1.readARIOFromOptions)(o).resolveArNSName({ name });
195
196
  return result ?? { message: `No record found for name ${name}` };
196
197
  }
198
+ async function listAntsForAddress(o) {
199
+ const address = (0, utils_js_1.requiredAddressFromOptions)(o);
200
+ const result = await (0, utils_js_1.readANTRegistryFromOptions)(o).accessControlList({
201
+ address,
202
+ });
203
+ return result ?? { message: `No ANTs found for address ${address}` };
204
+ }
@@ -48,6 +48,14 @@ exports.optionMap = {
48
48
  alias: '--ario-process-id <arioProcessId>',
49
49
  description: 'Run against a custom AR.IO process id',
50
50
  },
51
+ antRegistryProcessId: {
52
+ alias: '--ant-registry-process-id <antRegistryProcessId>',
53
+ description: 'Run against a custom ANT registry process id',
54
+ },
55
+ hyperbeamUrl: {
56
+ alias: '--hyperbeam-url <hyperbeamUrl>',
57
+ description: 'The URL for a custom hyperbeam node',
58
+ },
51
59
  cuUrl: {
52
60
  alias: '--cu-url <cuUrl>',
53
61
  description: 'The URL for a custom compute unit',
@@ -13,6 +13,8 @@ exports.requiredJwkFromOptions = requiredJwkFromOptions;
13
13
  exports.jwkToAddress = jwkToAddress;
14
14
  exports.getLoggerFromOptions = getLoggerFromOptions;
15
15
  exports.readARIOFromOptions = readARIOFromOptions;
16
+ exports.ANTRegistryProcessFromOptions = ANTRegistryProcessFromOptions;
17
+ exports.readANTRegistryFromOptions = readANTRegistryFromOptions;
16
18
  exports.contractSignerFromOptions = contractSignerFromOptions;
17
19
  exports.requiredContractSignerFromOptions = requiredContractSignerFromOptions;
18
20
  exports.requiredAoSignerFromOptions = requiredAoSignerFromOptions;
@@ -175,6 +177,21 @@ function readARIOFromOptions(options) {
175
177
  paymentUrl: options.paymentUrl,
176
178
  });
177
179
  }
180
+ function ANTRegistryProcessFromOptions(options) {
181
+ return new index_js_1.AOProcess({
182
+ processId: options.antRegistryProcessId ?? index_js_1.ANT_REGISTRY_ID,
183
+ ao: (0, aoconnect_1.connect)({
184
+ MODE: 'legacy',
185
+ CU_URL: options.cuUrl,
186
+ }),
187
+ });
188
+ }
189
+ function readANTRegistryFromOptions(options) {
190
+ return index_js_1.ANTRegistry.init({
191
+ process: ANTRegistryProcessFromOptions(options),
192
+ hyperbeamUrl: options.hyperbeamUrl,
193
+ });
194
+ }
178
195
  function contractSignerFromOptions(options) {
179
196
  const wallet = walletFromOptions(options);
180
197
  if (wallet === undefined) {
@@ -20,6 +20,7 @@ const constants_js_1 = require("../constants.js");
20
20
  const index_js_1 = require("../types/index.js");
21
21
  const ao_js_1 = require("../utils/ao.js");
22
22
  const index_js_2 = require("./index.js");
23
+ const logger_js_1 = require("./logger.js");
23
24
  class ANTRegistry {
24
25
  static init(config) {
25
26
  if (config !== undefined && 'signer' in config) {
@@ -31,7 +32,11 @@ class ANTRegistry {
31
32
  exports.ANTRegistry = ANTRegistry;
32
33
  class AoANTRegistryReadable {
33
34
  process;
35
+ hyperbeamUrl;
36
+ checkHyperBeamPromise;
37
+ logger;
34
38
  constructor(config) {
39
+ this.logger = config?.logger ?? logger_js_1.Logger.default;
35
40
  if (config === undefined || Object.keys(config).length === 0) {
36
41
  this.process = new index_js_2.AOProcess({
37
42
  processId: constants_js_1.ANT_REGISTRY_ID,
@@ -48,9 +53,63 @@ class AoANTRegistryReadable {
48
53
  else {
49
54
  throw new index_js_2.InvalidContractConfigurationError();
50
55
  }
56
+ if (config?.hyperbeamUrl !== undefined) {
57
+ this.hyperbeamUrl = new URL(config.hyperbeamUrl).toString();
58
+ this.checkHyperBeamPromise = this.checkHyperBeamCompatibility();
59
+ }
60
+ }
61
+ /**
62
+ * Check if the process is HyperBeam compatible. If so, we'll use the HyperBeam node to fetch the state.
63
+ *
64
+ * @returns {Promise<boolean>} True if the process is HyperBeam compatible, false otherwise.
65
+ */
66
+ async checkHyperBeamCompatibility() {
67
+ if (this.hyperbeamUrl === undefined) {
68
+ return Promise.resolve(false);
69
+ }
70
+ if (this.checkHyperBeamPromise !== undefined) {
71
+ return this.checkHyperBeamPromise;
72
+ }
73
+ this.logger.debug('Checking HyperBeam compatibility');
74
+ this.checkHyperBeamPromise = fetch(`${this.hyperbeamUrl.toString()}${this.process.processId}~process@1.0/now/cache/acl`, {
75
+ method: 'HEAD',
76
+ }).then((res) => {
77
+ if (res.ok) {
78
+ this.logger.debug('HyperBeam compatible');
79
+ return true;
80
+ }
81
+ this.logger.debug('HyperBeam not compatible');
82
+ return false;
83
+ });
84
+ return this.checkHyperBeamPromise;
51
85
  }
52
86
  // Should we rename this to "getANTsByAddress"? seems more clear, though not same as handler name
53
87
  async accessControlList({ address, }) {
88
+ if (await this.checkHyperBeamCompatibility()) {
89
+ let retries = 0;
90
+ while (retries < 3) {
91
+ try {
92
+ this.logger.debug('Fetching ant registry acl for address from hyperbeam', address);
93
+ const res = await fetch(`${this.hyperbeamUrl?.toString()}${this.process.processId}~process@1.0/now/cache/acl/${address}/serialize~json@1.0`);
94
+ if (res.status !== 200) {
95
+ this.logger.debug('Failed to fetch ant registry acl for address from hyperbeam', address, res.status, res.statusText);
96
+ throw new Error(`Failed to fetch ant registry acl for address ${address}: ${res?.statusText ?? 'Unknown error'}`);
97
+ }
98
+ this.logger.debug('Fetched ant registry acl for address from hyperbeam', address);
99
+ const json = (await res.json());
100
+ return {
101
+ Owned: json.Owned,
102
+ Controlled: json.Controlled,
103
+ };
104
+ }
105
+ catch (error) {
106
+ retries++;
107
+ this.logger.debug('Failed to fetch ant registry acl for address from hyperbeam', address, retries);
108
+ await new Promise((resolve) => setTimeout(resolve, 1000 * retries ** 2));
109
+ }
110
+ }
111
+ }
112
+ this.logger.debug('Fetching ant registry acl for address from process', address);
54
113
  return this.process.read({
55
114
  tags: [
56
115
  { name: 'Action', value: 'Access-Control-List' },
@@ -247,10 +247,12 @@ function errorMessageFromOutput(output) {
247
247
  const error = errorData ??
248
248
  output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')?.value;
249
249
  if (error !== undefined) {
250
- // Consolidated regex to match and extract line number and AO error message or Error Tags
251
- const match = error.match(/\[string "aos"]:(\d+):\s*(.+)/);
250
+ // Regex to match AO error messages like: [string ".src.main"]:5111: Primary name data not found
251
+ // or [string "aos"]:128: some error
252
+ const match = error.match(/\[string "(.+)"\]:(\d+):\s*(.*)/);
252
253
  if (match) {
253
- const [, lineNumber, errorMessage] = match;
254
+ // The first group is the src file, the second is the line number, and the third is the error message
255
+ const [, , lineNumber, errorMessage] = match;
254
256
  const cleanError = removeUnicodeFromError(errorMessage);
255
257
  return `${cleanError.trim()} (line ${lineNumber.trim()})`.trim();
256
258
  }
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '3.14.1-alpha.1';
20
+ exports.version = '3.14.1-alpha.2';
@@ -22,7 +22,7 @@ import { version } from '../version.js';
22
22
  import { setAntBaseNameCLICommand, setAntRecordCLICommand, } from './commands/antCommands.js';
23
23
  import { buyRecordCLICommand, extendLeaseCLICommand, increaseUndernameLimitCLICommand, requestPrimaryNameCLICommand, upgradeRecordCLICommand, } from './commands/arnsPurchaseCommands.js';
24
24
  import { cancelWithdrawal, decreaseDelegateStake, decreaseOperatorStake, delegateStake, increaseOperatorStake, instantWithdrawal, joinNetwork, leaveNetwork, redelegateStake, saveObservations, updateGatewaySettings, } from './commands/gatewayWriteCommands.js';
25
- import { getAllGatewayVaults, getAllowedDelegates, getArNSRecord, getArNSReservedName, getArNSReturnedName, getCostDetails, getDelegations, getEpoch, getGateway, getGatewayDelegates, getGatewayVaults, getPrescribedNames, getPrescribedObservers, getPrimaryName, getTokenCost, getVault, listAllDelegatesCLICommand, listArNSRecords, listArNSReservedNames, listArNSReturnedNames, listGateways, resolveArNSName, } from './commands/readCommands.js';
25
+ import { getAllGatewayVaults, getAllowedDelegates, getArNSRecord, getArNSReservedName, getArNSReturnedName, getCostDetails, getDelegations, getEpoch, getGateway, getGatewayDelegates, getGatewayVaults, getPrescribedNames, getPrescribedObservers, getPrimaryName, getTokenCost, getVault, listAllDelegatesCLICommand, listAntsForAddress, listArNSRecords, listArNSReservedNames, listArNSReturnedNames, listGateways, resolveArNSName, } from './commands/readCommands.js';
26
26
  import { createVaultCLICommand, extendVaultCLICommand, increaseVaultCLICommand, revokeVaultCLICommand, transferCLICommand, vaultedTransferCLICommand, } from './commands/transfer.js';
27
27
  import { addressAndVaultIdOptions, antStateOptions, arnsPurchaseOptions, buyRecordOptions, decreaseDelegateStakeOptions, delegateStakeOptions, epochOptions, getVaultOptions, globalOptions, joinNetworkOptions, operatorStakeOptions, optionMap, paginationAddressOptions, paginationOptions, redelegateStakeOptions, setAntBaseNameOptions, setAntUndernameOptions, tokenCostOptions, transferOptions, updateGatewaySettingsOptions, vaultedTransferOptions, writeActionOptions, } from './options.js';
28
28
  import { applyOptions, arioProcessIdFromOptions, assertConfirmationPrompt, customTagsFromOptions, epochInputFromOptions, formatARIOWithCommas, getANTStateFromOptions, getLoggerFromOptions, makeCommand, paginationParamsFromOptions, readANTFromOptions, readARIOFromOptions, requiredAddressFromOptions, requiredAoSignerFromOptions, requiredProcessIdFromOptions, requiredStringArrayFromOptions, requiredStringFromOptions, writeANTFromOptions, } from './utils.js';
@@ -425,6 +425,17 @@ makeCommand({
425
425
  options: arnsPurchaseOptions,
426
426
  action: requestPrimaryNameCLICommand,
427
427
  });
428
+ // # ANT Registry
429
+ makeCommand({
430
+ name: 'get-ant-registry-acl',
431
+ description: 'Get the ACL of an ANT registry',
432
+ options: [
433
+ optionMap.address,
434
+ optionMap.antRegistryProcessId,
435
+ optionMap.hyperbeamUrl,
436
+ ],
437
+ action: listAntsForAddress,
438
+ });
428
439
  // # ANTS
429
440
  // # Getters
430
441
  makeCommand({
@@ -1,5 +1,5 @@
1
1
  import { mARIOToken } from '../../types/token.js';
2
- import { addressFromOptions, epochInputFromOptions, formatARIOWithCommas, fundFromFromOptions, getTokenCostParamsFromOptions, paginationParamsFromOptions, readARIOFromOptions, requiredAddressFromOptions, requiredStringFromOptions, } from '../utils.js';
2
+ import { addressFromOptions, epochInputFromOptions, formatARIOWithCommas, fundFromFromOptions, getTokenCostParamsFromOptions, paginationParamsFromOptions, readANTRegistryFromOptions, readARIOFromOptions, requiredAddressFromOptions, requiredStringFromOptions, } from '../utils.js';
3
3
  export async function getGateway(o) {
4
4
  const address = requiredAddressFromOptions(o);
5
5
  const gateway = await readARIOFromOptions(o).getGateway({
@@ -170,3 +170,10 @@ export async function resolveArNSName(o) {
170
170
  const result = await readARIOFromOptions(o).resolveArNSName({ name });
171
171
  return result ?? { message: `No record found for name ${name}` };
172
172
  }
173
+ export async function listAntsForAddress(o) {
174
+ const address = requiredAddressFromOptions(o);
175
+ const result = await readANTRegistryFromOptions(o).accessControlList({
176
+ address,
177
+ });
178
+ return result ?? { message: `No ANTs found for address ${address}` };
179
+ }
@@ -45,6 +45,14 @@ export const optionMap = {
45
45
  alias: '--ario-process-id <arioProcessId>',
46
46
  description: 'Run against a custom AR.IO process id',
47
47
  },
48
+ antRegistryProcessId: {
49
+ alias: '--ant-registry-process-id <antRegistryProcessId>',
50
+ description: 'Run against a custom ANT registry process id',
51
+ },
52
+ hyperbeamUrl: {
53
+ alias: '--hyperbeam-url <hyperbeamUrl>',
54
+ description: 'The URL for a custom hyperbeam node',
55
+ },
48
56
  cuUrl: {
49
57
  alias: '--cu-url <cuUrl>',
50
58
  description: 'The URL for a custom compute unit',
@@ -18,7 +18,7 @@ import { connect } from '@permaweb/aoconnect';
18
18
  import { program } from 'commander';
19
19
  import { readFileSync } from 'fs';
20
20
  import prompts from 'prompts';
21
- import { ANT, AOProcess, ARIO, ARIOToken, ARIO_DEVNET_PROCESS_ID, ARIO_MAINNET_PROCESS_ID, ARIO_TESTNET_PROCESS_ID, ArweaveSigner, Logger, createAoSigner, fromB64Url, fundFromOptions, initANTStateForAddress, isValidFundFrom, isValidIntent, mARIOToken, sha256B64Url, validIntents, } from '../node/index.js';
21
+ import { ANT, ANTRegistry, ANT_REGISTRY_ID, AOProcess, ARIO, ARIOToken, ARIO_DEVNET_PROCESS_ID, ARIO_MAINNET_PROCESS_ID, ARIO_TESTNET_PROCESS_ID, ArweaveSigner, Logger, createAoSigner, fromB64Url, fundFromOptions, initANTStateForAddress, isValidFundFrom, isValidIntent, mARIOToken, sha256B64Url, validIntents, } from '../node/index.js';
22
22
  import { globalOptions } from './options.js';
23
23
  export const defaultTtlSecondsCLI = 3600;
24
24
  export function stringifyJsonForCLIDisplay(json) {
@@ -125,6 +125,21 @@ export function readARIOFromOptions(options) {
125
125
  paymentUrl: options.paymentUrl,
126
126
  });
127
127
  }
128
+ export function ANTRegistryProcessFromOptions(options) {
129
+ return new AOProcess({
130
+ processId: options.antRegistryProcessId ?? ANT_REGISTRY_ID,
131
+ ao: connect({
132
+ MODE: 'legacy',
133
+ CU_URL: options.cuUrl,
134
+ }),
135
+ });
136
+ }
137
+ export function readANTRegistryFromOptions(options) {
138
+ return ANTRegistry.init({
139
+ process: ANTRegistryProcessFromOptions(options),
140
+ hyperbeamUrl: options.hyperbeamUrl,
141
+ });
142
+ }
128
143
  export function contractSignerFromOptions(options) {
129
144
  const wallet = walletFromOptions(options);
130
145
  if (wallet === undefined) {
@@ -17,6 +17,7 @@ import { ANT_REGISTRY_ID } from '../constants.js';
17
17
  import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/index.js';
18
18
  import { createAoSigner } from '../utils/ao.js';
19
19
  import { AOProcess, InvalidContractConfigurationError } from './index.js';
20
+ import { Logger } from './logger.js';
20
21
  export class ANTRegistry {
21
22
  static init(config) {
22
23
  if (config !== undefined && 'signer' in config) {
@@ -27,7 +28,11 @@ export class ANTRegistry {
27
28
  }
28
29
  export class AoANTRegistryReadable {
29
30
  process;
31
+ hyperbeamUrl;
32
+ checkHyperBeamPromise;
33
+ logger;
30
34
  constructor(config) {
35
+ this.logger = config?.logger ?? Logger.default;
31
36
  if (config === undefined || Object.keys(config).length === 0) {
32
37
  this.process = new AOProcess({
33
38
  processId: ANT_REGISTRY_ID,
@@ -44,9 +49,63 @@ export class AoANTRegistryReadable {
44
49
  else {
45
50
  throw new InvalidContractConfigurationError();
46
51
  }
52
+ if (config?.hyperbeamUrl !== undefined) {
53
+ this.hyperbeamUrl = new URL(config.hyperbeamUrl).toString();
54
+ this.checkHyperBeamPromise = this.checkHyperBeamCompatibility();
55
+ }
56
+ }
57
+ /**
58
+ * Check if the process is HyperBeam compatible. If so, we'll use the HyperBeam node to fetch the state.
59
+ *
60
+ * @returns {Promise<boolean>} True if the process is HyperBeam compatible, false otherwise.
61
+ */
62
+ async checkHyperBeamCompatibility() {
63
+ if (this.hyperbeamUrl === undefined) {
64
+ return Promise.resolve(false);
65
+ }
66
+ if (this.checkHyperBeamPromise !== undefined) {
67
+ return this.checkHyperBeamPromise;
68
+ }
69
+ this.logger.debug('Checking HyperBeam compatibility');
70
+ this.checkHyperBeamPromise = fetch(`${this.hyperbeamUrl.toString()}${this.process.processId}~process@1.0/now/cache/acl`, {
71
+ method: 'HEAD',
72
+ }).then((res) => {
73
+ if (res.ok) {
74
+ this.logger.debug('HyperBeam compatible');
75
+ return true;
76
+ }
77
+ this.logger.debug('HyperBeam not compatible');
78
+ return false;
79
+ });
80
+ return this.checkHyperBeamPromise;
47
81
  }
48
82
  // Should we rename this to "getANTsByAddress"? seems more clear, though not same as handler name
49
83
  async accessControlList({ address, }) {
84
+ if (await this.checkHyperBeamCompatibility()) {
85
+ let retries = 0;
86
+ while (retries < 3) {
87
+ try {
88
+ this.logger.debug('Fetching ant registry acl for address from hyperbeam', address);
89
+ const res = await fetch(`${this.hyperbeamUrl?.toString()}${this.process.processId}~process@1.0/now/cache/acl/${address}/serialize~json@1.0`);
90
+ if (res.status !== 200) {
91
+ this.logger.debug('Failed to fetch ant registry acl for address from hyperbeam', address, res.status, res.statusText);
92
+ throw new Error(`Failed to fetch ant registry acl for address ${address}: ${res?.statusText ?? 'Unknown error'}`);
93
+ }
94
+ this.logger.debug('Fetched ant registry acl for address from hyperbeam', address);
95
+ const json = (await res.json());
96
+ return {
97
+ Owned: json.Owned,
98
+ Controlled: json.Controlled,
99
+ };
100
+ }
101
+ catch (error) {
102
+ retries++;
103
+ this.logger.debug('Failed to fetch ant registry acl for address from hyperbeam', address, retries);
104
+ await new Promise((resolve) => setTimeout(resolve, 1000 * retries ** 2));
105
+ }
106
+ }
107
+ }
108
+ this.logger.debug('Fetching ant registry acl for address from process', address);
50
109
  return this.process.read({
51
110
  tags: [
52
111
  { name: 'Action', value: 'Access-Control-List' },
@@ -236,10 +236,12 @@ export function errorMessageFromOutput(output) {
236
236
  const error = errorData ??
237
237
  output.Messages?.[0]?.Tags?.find((tag) => tag.name === 'Error')?.value;
238
238
  if (error !== undefined) {
239
- // Consolidated regex to match and extract line number and AO error message or Error Tags
240
- const match = error.match(/\[string "aos"]:(\d+):\s*(.+)/);
239
+ // Regex to match AO error messages like: [string ".src.main"]:5111: Primary name data not found
240
+ // or [string "aos"]:128: some error
241
+ const match = error.match(/\[string "(.+)"\]:(\d+):\s*(.*)/);
241
242
  if (match) {
242
- const [, lineNumber, errorMessage] = match;
243
+ // The first group is the src file, the second is the line number, and the third is the error message
244
+ const [, , lineNumber, errorMessage] = match;
243
245
  const cleanError = removeUnicodeFromError(errorMessage);
244
246
  return `${cleanError.trim()} (line ${lineNumber.trim()})`.trim();
245
247
  }
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.14.1-alpha.1';
17
+ export const version = '3.14.1-alpha.2';
@@ -69,3 +69,7 @@ export declare function getAllGatewayVaults(o: PaginationCLIOptions): Promise<im
69
69
  }>;
70
70
  export declare function getVault(o: AddressAndVaultIdCLIOptions): Promise<import("../../types/io.js").AoVaultData>;
71
71
  export declare function resolveArNSName(o: NameCLIOptions): Promise<import("../../types/io.js").ArNSNameResolutionData>;
72
+ export declare function listAntsForAddress(o: AddressCLIOptions): Promise<{
73
+ Owned: string[];
74
+ Controlled: string[];
75
+ }>;
@@ -41,6 +41,14 @@ export declare const optionMap: {
41
41
  alias: string;
42
42
  description: string;
43
43
  };
44
+ antRegistryProcessId: {
45
+ alias: string;
46
+ description: string;
47
+ };
48
+ hyperbeamUrl: {
49
+ alias: string;
50
+ description: string;
51
+ };
44
52
  cuUrl: {
45
53
  alias: string;
46
54
  description: string;
@@ -26,6 +26,8 @@ export type GlobalCLIOptions = WalletCLIOptions & {
26
26
  mainnet: boolean;
27
27
  debug: boolean;
28
28
  arioProcessId?: string;
29
+ antRegistryProcessId?: string;
30
+ hyperbeamUrl?: string;
29
31
  cuUrl?: string;
30
32
  paymentUrl?: string;
31
33
  };
@@ -1,6 +1,6 @@
1
1
  import { JWKInterface } from 'arweave/node/lib/wallet.js';
2
2
  import { Command, OptionValues } from 'commander';
3
- import { ARIOToken, AoANTRead, AoANTWrite, AoARIORead, AoARIOWrite, AoGetCostDetailsParams, AoRedelegateStakeParams, AoSigner, AoUpdateGatewaySettingsParams, ContractSigner, EpochInput, FundFrom, Logger, PaginationParams, SpawnANTState, WriteOptions, mARIOToken } from '../node/index.js';
3
+ import { AOProcess, ARIOToken, AoANTRead, AoANTRegistryRead, AoANTWrite, AoARIORead, AoARIOWrite, AoGetCostDetailsParams, AoRedelegateStakeParams, AoSigner, AoUpdateGatewaySettingsParams, ContractSigner, EpochInput, FundFrom, Logger, PaginationParams, SpawnANTState, WriteOptions, mARIOToken } from '../node/index.js';
4
4
  import { ANTStateCLIOptions, AddressCLIOptions, EpochCLIOptions, GetTokenCostCLIOptions, GlobalCLIOptions, InitiatorCLIOptions, JsonSerializable, PaginationCLIOptions, ProcessIdCLIOptions, RedelegateStakeCLIOptions, TransferCLIOptions, UpdateGatewaySettingsCLIOptions, WalletCLIOptions, WriteActionCLIOptions } from './types.js';
5
5
  export declare const defaultTtlSecondsCLI = 3600;
6
6
  export declare function stringifyJsonForCLIDisplay(json: JsonSerializable | unknown): string;
@@ -22,6 +22,8 @@ export declare function requiredJwkFromOptions(options: WalletCLIOptions): JWKIn
22
22
  export declare function jwkToAddress(jwk: JWKInterface): string;
23
23
  export declare function getLoggerFromOptions(options: GlobalCLIOptions): Logger;
24
24
  export declare function readARIOFromOptions(options: GlobalCLIOptions): AoARIORead;
25
+ export declare function ANTRegistryProcessFromOptions(options: ProcessIdCLIOptions): AOProcess;
26
+ export declare function readANTRegistryFromOptions(options: ProcessIdCLIOptions): AoANTRegistryRead;
25
27
  export declare function contractSignerFromOptions(options: WalletCLIOptions): {
26
28
  signer: ContractSigner;
27
29
  signerAddress: string;
@@ -1,8 +1,14 @@
1
1
  import { AoANTRegistryRead, AoANTRegistryWrite } from '../types/ant-registry.js';
2
2
  import { AoMessageResult, ProcessConfiguration, WithSigner } from '../types/index.js';
3
3
  import { AOProcess } from './index.js';
4
- type ANTRegistryNoSigner = ProcessConfiguration;
5
- type ANTRegistryWithSigner = WithSigner<ProcessConfiguration>;
4
+ import { ILogger } from './logger.js';
5
+ type ANTRegistryProcessConfig = Required<ProcessConfiguration> & {
6
+ strict?: boolean;
7
+ hyperbeamUrl?: string;
8
+ logger?: ILogger;
9
+ };
10
+ type ANTRegistryNoSigner = ANTRegistryProcessConfig;
11
+ type ANTRegistryWithSigner = WithSigner<ANTRegistryProcessConfig>;
6
12
  export declare class ANTRegistry {
7
13
  static init(): AoANTRegistryRead;
8
14
  static init(config: ANTRegistryNoSigner): AoANTRegistryRead;
@@ -10,7 +16,18 @@ export declare class ANTRegistry {
10
16
  }
11
17
  export declare class AoANTRegistryReadable implements AoANTRegistryRead {
12
18
  protected process: AOProcess;
13
- constructor(config?: ProcessConfiguration);
19
+ private hyperbeamUrl;
20
+ private checkHyperBeamPromise;
21
+ private logger;
22
+ constructor(config?: ANTRegistryProcessConfig & {
23
+ logger?: ILogger;
24
+ });
25
+ /**
26
+ * Check if the process is HyperBeam compatible. If so, we'll use the HyperBeam node to fetch the state.
27
+ *
28
+ * @returns {Promise<boolean>} True if the process is HyperBeam compatible, false otherwise.
29
+ */
30
+ private checkHyperBeamCompatibility;
14
31
  accessControlList({ address, }: {
15
32
  address: string;
16
33
  }): Promise<{
@@ -20,7 +37,7 @@ export declare class AoANTRegistryReadable implements AoANTRegistryRead {
20
37
  }
21
38
  export declare class AoANTRegistryWriteable extends AoANTRegistryReadable implements AoANTRegistryWrite {
22
39
  private signer;
23
- constructor({ signer, ...config }: WithSigner<ProcessConfiguration>);
40
+ constructor({ signer, ...config }: WithSigner<ANTRegistryProcessConfig>);
24
41
  register({ processId, }: {
25
42
  processId: string;
26
43
  }): Promise<AoMessageResult>;
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "3.14.0";
16
+ export declare const version = "3.14.1-alpha.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.14.1-alpha.1",
3
+ "version": "3.14.1-alpha.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"