@ar.io/sdk 3.18.2-alpha.1 → 3.18.3
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/bundles/web.bundle.min.js +7 -7
- package/lib/cjs/common/ant-registry.js +4 -2
- package/lib/cjs/common/ant.js +3 -1
- package/lib/cjs/common/io.js +2 -2
- package/lib/cjs/constants.js +1 -5
- package/lib/cjs/utils/processes.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant-registry.js +4 -2
- package/lib/esm/common/ant.js +3 -1
- package/lib/esm/common/io.js +2 -2
- package/lib/esm/constants.js +0 -4
- package/lib/esm/utils/processes.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/common/io.d.ts +1 -1
- package/lib/types/constants.d.ts +0 -3
- package/lib/types/utils/processes.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -71,7 +71,9 @@ class AoANTRegistryReadable {
|
|
|
71
71
|
return this.checkHyperBeamPromise;
|
|
72
72
|
}
|
|
73
73
|
this.logger.debug('Checking HyperBeam compatibility');
|
|
74
|
-
this.checkHyperBeamPromise = fetch(
|
|
74
|
+
this.checkHyperBeamPromise = fetch(
|
|
75
|
+
// use /now to force a refresh of the cache state, then compute when calling it for keys
|
|
76
|
+
`${this.hyperbeamUrl.toString()}${this.process.processId}~process@1.0/now/cache/acl`, {
|
|
75
77
|
method: 'HEAD',
|
|
76
78
|
signal: AbortSignal.timeout(5000), // 5 second timeout
|
|
77
79
|
})
|
|
@@ -98,7 +100,7 @@ class AoANTRegistryReadable {
|
|
|
98
100
|
while (retries < 3) {
|
|
99
101
|
try {
|
|
100
102
|
this.logger.debug('Fetching ant registry acl for address from hyperbeam', address);
|
|
101
|
-
const res = await fetch(`${this.hyperbeamUrl?.toString()}${this.process.processId}~process@1.0/
|
|
103
|
+
const res = await fetch(`${this.hyperbeamUrl?.toString()}${this.process.processId}~process@1.0/compute/cache/acl/${address}/serialize~json@1.0`);
|
|
102
104
|
if (res.status !== 200) {
|
|
103
105
|
this.logger.debug('Failed to fetch ant registry acl for address from hyperbeam', address, res.status, res.statusText);
|
|
104
106
|
throw new Error(`Failed to fetch ant registry acl for address ${address}: ${res?.statusText ?? 'Unknown error'}`);
|
package/lib/cjs/common/ant.js
CHANGED
|
@@ -89,7 +89,9 @@ class AoANTReadable {
|
|
|
89
89
|
if (this.checkHyperBeamPromise !== undefined) {
|
|
90
90
|
return this.checkHyperBeamPromise;
|
|
91
91
|
}
|
|
92
|
-
this.checkHyperBeamPromise = fetch(
|
|
92
|
+
this.checkHyperBeamPromise = fetch(
|
|
93
|
+
// use /now to force a refresh of the cache state, then compute when calling it for keys
|
|
94
|
+
`${this.hyperbeamUrl.toString()}${this.processId}~process@1.0/now/cache`, {
|
|
93
95
|
method: 'HEAD',
|
|
94
96
|
signal: AbortSignal.timeout(5000), // 5 second timeout
|
|
95
97
|
})
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -684,12 +684,12 @@ class ARIOReadable {
|
|
|
684
684
|
* @returns {Promise<AoArNSNameData[]>} The ARNS names associated with the address
|
|
685
685
|
*/
|
|
686
686
|
async getArNSRecordsForAddress(params) {
|
|
687
|
-
const {
|
|
687
|
+
const { antRegistryProcessId = constants_js_1.ANT_REGISTRY_ID, address } = params;
|
|
688
688
|
const antRegistry = ant_registry_js_1.ANTRegistry.init({
|
|
689
689
|
hyperbeamUrl: this.hyperbeamUrl,
|
|
690
690
|
process: new ao_process_js_1.AOProcess({
|
|
691
691
|
ao: this.process.ao,
|
|
692
|
-
processId:
|
|
692
|
+
processId: antRegistryProcessId,
|
|
693
693
|
}),
|
|
694
694
|
});
|
|
695
695
|
// Note: there could be a race condition here if the ACL changes during pagination requests, resulting in different results from the `getArNSRecords`.
|
package/lib/cjs/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_SCHEDULER_ID = exports.AO_AUTHORITY = exports.ANT_LUA_ID = exports.AOS_MODULE_ID = exports.MARIO_PER_ARIO = exports.ANT_REGISTRY_ID = exports.ARIO_MAINNET_PROCESS_ID = exports.ARIO_TESTNET_PROCESS_ID = exports.arioDevnetProcessId = exports.ARIO_DEVNET_PROCESS_ID = exports.
|
|
3
|
+
exports.DEFAULT_SCHEDULER_ID = exports.AO_AUTHORITY = exports.ANT_LUA_ID = exports.AOS_MODULE_ID = exports.MARIO_PER_ARIO = exports.ANT_REGISTRY_ID = exports.ARIO_MAINNET_PROCESS_ID = exports.ARIO_TESTNET_PROCESS_ID = exports.arioDevnetProcessId = exports.ARIO_DEVNET_PROCESS_ID = exports.FQDN_REGEX = exports.ARWEAVE_TX_REGEX = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
6
6
|
*
|
|
@@ -19,10 +19,6 @@ exports.DEFAULT_SCHEDULER_ID = exports.AO_AUTHORITY = exports.ANT_LUA_ID = expor
|
|
|
19
19
|
exports.ARWEAVE_TX_REGEX = new RegExp('^[a-zA-Z0-9_-]{43}$');
|
|
20
20
|
/** FQDN regex that matches the one used in the ArNS contract. */
|
|
21
21
|
exports.FQDN_REGEX = new RegExp('^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$');
|
|
22
|
-
// sortkey: padded blockheight to 12, JS timestamp, hash of transactionID + block hash. Timestamp only applicable to L2 and normally is all zeros.
|
|
23
|
-
exports.SORT_KEY_REGEX = new RegExp('^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$');
|
|
24
|
-
exports.ARNS_TESTNET_REGISTRY_TX = process.env.ARNS_REGISTRY_TX ?? 'bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U';
|
|
25
|
-
exports.ARNS_DEVNET_REGISTRY_TX = '_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8';
|
|
26
22
|
exports.ARIO_DEVNET_PROCESS_ID = 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc';
|
|
27
23
|
// backwards compatibility - TODO: remove in v2.0.0
|
|
28
24
|
exports.arioDevnetProcessId = exports.ARIO_DEVNET_PROCESS_ID;
|
|
@@ -26,7 +26,7 @@ const io_js_1 = require("../common/io.js");
|
|
|
26
26
|
const logger_js_1 = require("../common/logger.js");
|
|
27
27
|
const constants_js_1 = require("../constants.js");
|
|
28
28
|
/**
|
|
29
|
-
* @
|
|
29
|
+
* @deprecated Use getArNSRecordsForAddress instead
|
|
30
30
|
*/
|
|
31
31
|
const getANTProcessesOwnedByWallet = async ({ address, registry = ant_registry_js_1.ANTRegistry.init(), }) => {
|
|
32
32
|
const res = await registry.accessControlList({ address });
|
package/lib/cjs/version.js
CHANGED
|
@@ -67,7 +67,9 @@ export class AoANTRegistryReadable {
|
|
|
67
67
|
return this.checkHyperBeamPromise;
|
|
68
68
|
}
|
|
69
69
|
this.logger.debug('Checking HyperBeam compatibility');
|
|
70
|
-
this.checkHyperBeamPromise = fetch(
|
|
70
|
+
this.checkHyperBeamPromise = fetch(
|
|
71
|
+
// use /now to force a refresh of the cache state, then compute when calling it for keys
|
|
72
|
+
`${this.hyperbeamUrl.toString()}${this.process.processId}~process@1.0/now/cache/acl`, {
|
|
71
73
|
method: 'HEAD',
|
|
72
74
|
signal: AbortSignal.timeout(5000), // 5 second timeout
|
|
73
75
|
})
|
|
@@ -94,7 +96,7 @@ export class AoANTRegistryReadable {
|
|
|
94
96
|
while (retries < 3) {
|
|
95
97
|
try {
|
|
96
98
|
this.logger.debug('Fetching ant registry acl for address from hyperbeam', address);
|
|
97
|
-
const res = await fetch(`${this.hyperbeamUrl?.toString()}${this.process.processId}~process@1.0/
|
|
99
|
+
const res = await fetch(`${this.hyperbeamUrl?.toString()}${this.process.processId}~process@1.0/compute/cache/acl/${address}/serialize~json@1.0`);
|
|
98
100
|
if (res.status !== 200) {
|
|
99
101
|
this.logger.debug('Failed to fetch ant registry acl for address from hyperbeam', address, res.status, res.statusText);
|
|
100
102
|
throw new Error(`Failed to fetch ant registry acl for address ${address}: ${res?.statusText ?? 'Unknown error'}`);
|
package/lib/esm/common/ant.js
CHANGED
|
@@ -85,7 +85,9 @@ export class AoANTReadable {
|
|
|
85
85
|
if (this.checkHyperBeamPromise !== undefined) {
|
|
86
86
|
return this.checkHyperBeamPromise;
|
|
87
87
|
}
|
|
88
|
-
this.checkHyperBeamPromise = fetch(
|
|
88
|
+
this.checkHyperBeamPromise = fetch(
|
|
89
|
+
// use /now to force a refresh of the cache state, then compute when calling it for keys
|
|
90
|
+
`${this.hyperbeamUrl.toString()}${this.processId}~process@1.0/now/cache`, {
|
|
89
91
|
method: 'HEAD',
|
|
90
92
|
signal: AbortSignal.timeout(5000), // 5 second timeout
|
|
91
93
|
})
|
package/lib/esm/common/io.js
CHANGED
|
@@ -680,12 +680,12 @@ export class ARIOReadable {
|
|
|
680
680
|
* @returns {Promise<AoArNSNameData[]>} The ARNS names associated with the address
|
|
681
681
|
*/
|
|
682
682
|
async getArNSRecordsForAddress(params) {
|
|
683
|
-
const {
|
|
683
|
+
const { antRegistryProcessId = ANT_REGISTRY_ID, address } = params;
|
|
684
684
|
const antRegistry = ANTRegistry.init({
|
|
685
685
|
hyperbeamUrl: this.hyperbeamUrl,
|
|
686
686
|
process: new AOProcess({
|
|
687
687
|
ao: this.process.ao,
|
|
688
|
-
processId:
|
|
688
|
+
processId: antRegistryProcessId,
|
|
689
689
|
}),
|
|
690
690
|
});
|
|
691
691
|
// Note: there could be a race condition here if the ACL changes during pagination requests, resulting in different results from the `getArNSRecords`.
|
package/lib/esm/constants.js
CHANGED
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
export const ARWEAVE_TX_REGEX = new RegExp('^[a-zA-Z0-9_-]{43}$');
|
|
17
17
|
/** FQDN regex that matches the one used in the ArNS contract. */
|
|
18
18
|
export const FQDN_REGEX = new RegExp('^(?:(?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{1,63}$');
|
|
19
|
-
// sortkey: padded blockheight to 12, JS timestamp, hash of transactionID + block hash. Timestamp only applicable to L2 and normally is all zeros.
|
|
20
|
-
export const SORT_KEY_REGEX = new RegExp('^[0-9]{12},[0-9]{13},[a-fA-F0-9]{64}$');
|
|
21
|
-
export const ARNS_TESTNET_REGISTRY_TX = process.env.ARNS_REGISTRY_TX ?? 'bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U';
|
|
22
|
-
export const ARNS_DEVNET_REGISTRY_TX = '_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8';
|
|
23
19
|
export const ARIO_DEVNET_PROCESS_ID = 'GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc';
|
|
24
20
|
// backwards compatibility - TODO: remove in v2.0.0
|
|
25
21
|
export const arioDevnetProcessId = ARIO_DEVNET_PROCESS_ID;
|
|
@@ -23,7 +23,7 @@ import { ARIO } from '../common/io.js';
|
|
|
23
23
|
import { Logger } from '../common/logger.js';
|
|
24
24
|
import { ARIO_MAINNET_PROCESS_ID } from '../constants.js';
|
|
25
25
|
/**
|
|
26
|
-
* @
|
|
26
|
+
* @deprecated Use getArNSRecordsForAddress instead
|
|
27
27
|
*/
|
|
28
28
|
export const getANTProcessesOwnedByWallet = async ({ address, registry = ANTRegistry.init(), }) => {
|
|
29
29
|
const res = await registry.accessControlList({ address });
|
package/lib/esm/version.js
CHANGED
package/lib/types/common/io.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ export declare class ARIOReadable implements AoARIORead, ArNSNameResolver {
|
|
|
155
155
|
* @returns {Promise<AoArNSNameData[]>} The ARNS names associated with the address
|
|
156
156
|
*/
|
|
157
157
|
getArNSRecordsForAddress(params: PaginationParams<AoArNSNameDataWithName> & {
|
|
158
|
-
|
|
158
|
+
antRegistryProcessId?: string;
|
|
159
159
|
address: WalletAddress;
|
|
160
160
|
}): Promise<PaginationResult<AoArNSNameDataWithName>>;
|
|
161
161
|
}
|
package/lib/types/constants.d.ts
CHANGED
|
@@ -16,9 +16,6 @@
|
|
|
16
16
|
export declare const ARWEAVE_TX_REGEX: RegExp;
|
|
17
17
|
/** FQDN regex that matches the one used in the ArNS contract. */
|
|
18
18
|
export declare const FQDN_REGEX: RegExp;
|
|
19
|
-
export declare const SORT_KEY_REGEX: RegExp;
|
|
20
|
-
export declare const ARNS_TESTNET_REGISTRY_TX: string;
|
|
21
|
-
export declare const ARNS_DEVNET_REGISTRY_TX = "_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8";
|
|
22
19
|
export declare const ARIO_DEVNET_PROCESS_ID = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
|
|
23
20
|
export declare const arioDevnetProcessId = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
|
|
24
21
|
export declare const ARIO_TESTNET_PROCESS_ID = "agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA";
|
|
@@ -3,7 +3,7 @@ import { ILogger } from '../common/logger.js';
|
|
|
3
3
|
import { AoANTRegistryRead } from '../types/ant-registry.js';
|
|
4
4
|
import { AoARIORead, AoArNSNameData, AoClient, ProcessId, WalletAddress } from '../types/index.js';
|
|
5
5
|
/**
|
|
6
|
-
* @
|
|
6
|
+
* @deprecated Use getArNSRecordsForAddress instead
|
|
7
7
|
*/
|
|
8
8
|
export declare const getANTProcessesOwnedByWallet: ({ address, registry, }: {
|
|
9
9
|
address: WalletAddress;
|
package/lib/types/version.d.ts
CHANGED