@ar.io/sdk 3.3.0-alpha.14 → 3.3.0-alpha.15
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.
|
@@ -16,10 +16,12 @@ exports.fetchAllArNSRecords = exports.ArNSEventEmitter = exports.getANTProcesses
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
+
const aoconnect_1 = require("@permaweb/aoconnect");
|
|
19
20
|
const eventemitter3_1 = require("eventemitter3");
|
|
20
21
|
const plimit_lit_1 = require("plimit-lit");
|
|
21
22
|
const ant_registry_js_1 = require("../common/ant-registry.js");
|
|
22
23
|
const ant_js_1 = require("../common/ant.js");
|
|
24
|
+
const index_js_1 = require("../common/index.js");
|
|
23
25
|
const io_js_1 = require("../common/io.js");
|
|
24
26
|
const logger_js_1 = require("../common/logger.js");
|
|
25
27
|
const constants_js_1 = require("../constants.js");
|
|
@@ -53,15 +55,17 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
|
|
|
53
55
|
throttle;
|
|
54
56
|
logger;
|
|
55
57
|
strict;
|
|
58
|
+
antAoClient;
|
|
56
59
|
constructor({ contract = io_js_1.ARIO.init({
|
|
57
60
|
processId: constants_js_1.ARIO_TESTNET_PROCESS_ID,
|
|
58
|
-
}), timeoutMs = 60_000, concurrency = 30, logger = logger_js_1.Logger.default, strict = false, } = {}) {
|
|
61
|
+
}), timeoutMs = 60_000, concurrency = 30, logger = logger_js_1.Logger.default, strict = false, antAoClient = (0, aoconnect_1.connect)(), } = {}) {
|
|
59
62
|
super();
|
|
60
63
|
this.contract = contract;
|
|
61
64
|
this.timeoutMs = timeoutMs;
|
|
62
65
|
this.throttle = (0, plimit_lit_1.pLimit)(concurrency);
|
|
63
66
|
this.logger = logger;
|
|
64
67
|
this.strict = strict;
|
|
68
|
+
this.antAoClient = antAoClient;
|
|
65
69
|
}
|
|
66
70
|
async fetchProcessesOwnedByWallet({ address, pageSize, antRegistry = ant_registry_js_1.ANTRegistry.init(), }) {
|
|
67
71
|
const uniqueContractProcessIds = {};
|
|
@@ -99,7 +103,10 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
|
|
|
99
103
|
return;
|
|
100
104
|
}
|
|
101
105
|
const ant = ant_js_1.ANT.init({
|
|
102
|
-
|
|
106
|
+
process: new index_js_1.AOProcess({
|
|
107
|
+
processId,
|
|
108
|
+
ao: this.antAoClient,
|
|
109
|
+
}),
|
|
103
110
|
strict: this.strict,
|
|
104
111
|
});
|
|
105
112
|
const state = (await timeout(this.timeoutMs, ant.getState()).catch((e) => {
|
package/lib/cjs/version.js
CHANGED
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { connect } from '@permaweb/aoconnect';
|
|
16
17
|
import { EventEmitter } from 'eventemitter3';
|
|
17
18
|
import { pLimit } from 'plimit-lit';
|
|
18
19
|
import { ANTRegistry } from '../common/ant-registry.js';
|
|
19
20
|
import { ANT } from '../common/ant.js';
|
|
21
|
+
import { AOProcess } from '../common/index.js';
|
|
20
22
|
import { ARIO } from '../common/io.js';
|
|
21
23
|
import { Logger } from '../common/logger.js';
|
|
22
24
|
import { ARIO_TESTNET_PROCESS_ID } from '../constants.js';
|
|
@@ -49,15 +51,17 @@ export class ArNSEventEmitter extends EventEmitter {
|
|
|
49
51
|
throttle;
|
|
50
52
|
logger;
|
|
51
53
|
strict;
|
|
54
|
+
antAoClient;
|
|
52
55
|
constructor({ contract = ARIO.init({
|
|
53
56
|
processId: ARIO_TESTNET_PROCESS_ID,
|
|
54
|
-
}), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, } = {}) {
|
|
57
|
+
}), timeoutMs = 60_000, concurrency = 30, logger = Logger.default, strict = false, antAoClient = connect(), } = {}) {
|
|
55
58
|
super();
|
|
56
59
|
this.contract = contract;
|
|
57
60
|
this.timeoutMs = timeoutMs;
|
|
58
61
|
this.throttle = pLimit(concurrency);
|
|
59
62
|
this.logger = logger;
|
|
60
63
|
this.strict = strict;
|
|
64
|
+
this.antAoClient = antAoClient;
|
|
61
65
|
}
|
|
62
66
|
async fetchProcessesOwnedByWallet({ address, pageSize, antRegistry = ANTRegistry.init(), }) {
|
|
63
67
|
const uniqueContractProcessIds = {};
|
|
@@ -95,7 +99,10 @@ export class ArNSEventEmitter extends EventEmitter {
|
|
|
95
99
|
return;
|
|
96
100
|
}
|
|
97
101
|
const ant = ANT.init({
|
|
98
|
-
|
|
102
|
+
process: new AOProcess({
|
|
103
|
+
processId,
|
|
104
|
+
ao: this.antAoClient,
|
|
105
|
+
}),
|
|
99
106
|
strict: this.strict,
|
|
100
107
|
});
|
|
101
108
|
const state = (await timeout(this.timeoutMs, ant.getState()).catch((e) => {
|
package/lib/esm/version.js
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
import { EventEmitter } from 'eventemitter3';
|
|
17
2
|
import { ILogger } from '../common/logger.js';
|
|
18
3
|
import { AoANTRegistryRead } from '../types/ant-registry.js';
|
|
19
|
-
import { AoARIORead, AoArNSNameData, ProcessId, WalletAddress } from '../types/index.js';
|
|
4
|
+
import { AoARIORead, AoArNSNameData, AoClient, ProcessId, WalletAddress } from '../types/index.js';
|
|
20
5
|
/**
|
|
21
6
|
* @beta This API is in beta and may change in the future.
|
|
22
7
|
*/
|
|
@@ -30,12 +15,14 @@ export declare class ArNSEventEmitter extends EventEmitter {
|
|
|
30
15
|
private throttle;
|
|
31
16
|
private logger;
|
|
32
17
|
private strict;
|
|
33
|
-
|
|
18
|
+
private antAoClient;
|
|
19
|
+
constructor({ contract, timeoutMs, concurrency, logger, strict, antAoClient, }?: {
|
|
34
20
|
contract?: AoARIORead;
|
|
35
21
|
timeoutMs?: number;
|
|
36
22
|
concurrency?: number;
|
|
37
23
|
logger?: ILogger;
|
|
38
24
|
strict?: boolean;
|
|
25
|
+
antAoClient?: AoClient;
|
|
39
26
|
});
|
|
40
27
|
fetchProcessesOwnedByWallet({ address, pageSize, antRegistry, }: {
|
|
41
28
|
address: WalletAddress;
|
package/lib/types/version.d.ts
CHANGED