@ar.io/sdk 2.0.0-alpha.9 → 2.0.0
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/README.md +211 -128
- package/bundles/web.bundle.min.js +79 -79
- package/lib/cjs/common/io.js +30 -6
- package/lib/cjs/utils/index.js +1 -1
- package/lib/cjs/utils/{graphql/processes.js → processes.js} +40 -10
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/io.js +30 -6
- package/lib/esm/utils/index.js +1 -1
- package/lib/esm/utils/{graphql/processes.js → processes.js} +38 -9
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +0 -24
- package/lib/types/common/io.d.ts +4 -4
- package/lib/types/io.d.ts +27 -3
- package/lib/types/utils/index.d.ts +1 -1
- package/lib/types/utils/{graphql/processes.d.ts → processes.d.ts} +6 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
- package/lib/cjs/utils/graphql/index.js +0 -33
- package/lib/esm/utils/graphql/index.js +0 -17
- package/lib/types/utils/graphql/index.d.ts +0 -17
package/lib/cjs/common/io.js
CHANGED
|
@@ -104,9 +104,17 @@ class IOReadable {
|
|
|
104
104
|
],
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
async getArNSRecords() {
|
|
107
|
+
async getArNSRecords(pageParams) {
|
|
108
|
+
const allTags = [
|
|
109
|
+
{ name: 'Action', value: 'Paginated-Records' },
|
|
110
|
+
{ name: 'Cursor', value: pageParams?.cursor?.toString() },
|
|
111
|
+
{ name: 'Limit', value: pageParams?.limit?.toString() },
|
|
112
|
+
{ name: 'Sort-By', value: pageParams?.sortBy },
|
|
113
|
+
{ name: 'Sort-Order', value: pageParams?.sortOrder },
|
|
114
|
+
];
|
|
115
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
108
116
|
return this.process.read({
|
|
109
|
-
tags:
|
|
117
|
+
tags: prunedTags,
|
|
110
118
|
});
|
|
111
119
|
}
|
|
112
120
|
async getArNSReservedNames() {
|
|
@@ -130,9 +138,17 @@ class IOReadable {
|
|
|
130
138
|
],
|
|
131
139
|
});
|
|
132
140
|
}
|
|
133
|
-
async getBalances() {
|
|
141
|
+
async getBalances(pageParams) {
|
|
142
|
+
const allTags = [
|
|
143
|
+
{ name: 'Action', value: 'Paginated-Balances' },
|
|
144
|
+
{ name: 'Cursor', value: pageParams?.cursor?.toString() },
|
|
145
|
+
{ name: 'Limit', value: pageParams?.limit?.toString() },
|
|
146
|
+
{ name: 'Sort-By', value: pageParams?.sortBy },
|
|
147
|
+
{ name: 'Sort-Order', value: pageParams?.sortOrder },
|
|
148
|
+
];
|
|
149
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
134
150
|
return this.process.read({
|
|
135
|
-
tags:
|
|
151
|
+
tags: prunedTags,
|
|
136
152
|
});
|
|
137
153
|
}
|
|
138
154
|
async getGateway({ address, }) {
|
|
@@ -143,9 +159,17 @@ class IOReadable {
|
|
|
143
159
|
],
|
|
144
160
|
});
|
|
145
161
|
}
|
|
146
|
-
async getGateways() {
|
|
162
|
+
async getGateways(pageParams) {
|
|
163
|
+
const allTags = [
|
|
164
|
+
{ name: 'Action', value: 'Paginated-Gateways' },
|
|
165
|
+
{ name: 'Cursor', value: pageParams?.cursor?.toString() },
|
|
166
|
+
{ name: 'Limit', value: pageParams?.limit?.toString() },
|
|
167
|
+
{ name: 'Sort-By', value: pageParams?.sortBy },
|
|
168
|
+
{ name: 'Sort-Order', value: pageParams?.sortOrder },
|
|
169
|
+
];
|
|
170
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
147
171
|
return this.process.read({
|
|
148
|
-
tags:
|
|
172
|
+
tags: prunedTags,
|
|
149
173
|
});
|
|
150
174
|
}
|
|
151
175
|
async getCurrentEpoch() {
|
package/lib/cjs/utils/index.js
CHANGED
|
@@ -32,6 +32,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
*/
|
|
33
33
|
__exportStar(require("./arweave.js"), exports);
|
|
34
34
|
__exportStar(require("./http-client.js"), exports);
|
|
35
|
-
__exportStar(require("./graphql/index.js"), exports);
|
|
36
35
|
__exportStar(require("./ao.js"), exports);
|
|
37
36
|
__exportStar(require("./json.js"), exports);
|
|
37
|
+
__exportStar(require("./processes.js"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArNSEventEmitter = exports.getANTProcessesOwnedByWallet = void 0;
|
|
3
|
+
exports.fetchAllArNSRecords = exports.ArNSEventEmitter = exports.getANTProcessesOwnedByWallet = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -19,19 +19,20 @@ exports.ArNSEventEmitter = exports.getANTProcessesOwnedByWallet = void 0;
|
|
|
19
19
|
*/
|
|
20
20
|
const eventemitter3_1 = require("eventemitter3");
|
|
21
21
|
const plimit_lit_1 = require("plimit-lit");
|
|
22
|
-
const ant_js_1 = require("
|
|
23
|
-
const io_js_1 = require("
|
|
24
|
-
const constants_js_1 = require("
|
|
22
|
+
const ant_js_1 = require("../common/ant.js");
|
|
23
|
+
const io_js_1 = require("../common/io.js");
|
|
24
|
+
const constants_js_1 = require("../constants.js");
|
|
25
25
|
const getANTProcessesOwnedByWallet = async ({ address, contract = io_js_1.IO.init({
|
|
26
26
|
processId: constants_js_1.IO_TESTNET_PROCESS_ID,
|
|
27
27
|
}), }) => {
|
|
28
28
|
const throttle = (0, plimit_lit_1.pLimit)(50);
|
|
29
29
|
// get the record names of the registry - TODO: this may need to be paginated
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const records = await (0, exports.fetchAllArNSRecords)({
|
|
31
|
+
contract: contract,
|
|
32
|
+
});
|
|
33
|
+
const uniqueContractProcessIds = Object.values(records)
|
|
33
34
|
.filter((record) => record.processId !== undefined)
|
|
34
|
-
.map((record) => record.processId)
|
|
35
|
+
.map((record) => record.processId);
|
|
35
36
|
// check the contract owner and controllers
|
|
36
37
|
const ownedOrControlledByWallet = await Promise.all(uniqueContractProcessIds.map(async (processId) => throttle(async () => {
|
|
37
38
|
const ant = ant_js_1.ANT.init({
|
|
@@ -80,10 +81,12 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
|
|
|
80
81
|
}
|
|
81
82
|
async fetchProcessesOwnedByWallet({ address }) {
|
|
82
83
|
const uniqueContractProcessIds = {};
|
|
83
|
-
await timeout(this.timeoutMs, this.contract
|
|
84
|
+
await timeout(this.timeoutMs, (0, exports.fetchAllArNSRecords)({ contract: this.contract }))
|
|
85
|
+
.catch((e) => {
|
|
84
86
|
this.emit('error', `Error getting ArNS records: ${e}`);
|
|
85
87
|
return {};
|
|
86
|
-
})
|
|
88
|
+
})
|
|
89
|
+
.then((records) => {
|
|
87
90
|
if (!records)
|
|
88
91
|
return;
|
|
89
92
|
Object.entries(records).forEach(([name, record]) => {
|
|
@@ -125,3 +128,30 @@ class ArNSEventEmitter extends eventemitter3_1.EventEmitter {
|
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
exports.ArNSEventEmitter = ArNSEventEmitter;
|
|
131
|
+
const fetchAllArNSRecords = async ({ contract = io_js_1.IO.init({
|
|
132
|
+
processId: constants_js_1.IO_TESTNET_PROCESS_ID,
|
|
133
|
+
}), logger, }) => {
|
|
134
|
+
let cursor;
|
|
135
|
+
const records = {};
|
|
136
|
+
do {
|
|
137
|
+
const pageResult = await contract
|
|
138
|
+
.getArNSRecords({ cursor })
|
|
139
|
+
.catch((e) => {
|
|
140
|
+
logger?.error(`Error getting ArNS records`, {
|
|
141
|
+
message: e?.message,
|
|
142
|
+
stack: e?.stack,
|
|
143
|
+
});
|
|
144
|
+
return undefined;
|
|
145
|
+
});
|
|
146
|
+
if (!pageResult) {
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
pageResult.items.forEach((record) => {
|
|
150
|
+
const { name, ...recordDetails } = record;
|
|
151
|
+
records[name] = recordDetails;
|
|
152
|
+
});
|
|
153
|
+
cursor = pageResult.nextCursor;
|
|
154
|
+
} while (cursor !== undefined);
|
|
155
|
+
return records;
|
|
156
|
+
};
|
|
157
|
+
exports.fetchAllArNSRecords = fetchAllArNSRecords;
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/io.js
CHANGED
|
@@ -100,9 +100,17 @@ export class IOReadable {
|
|
|
100
100
|
],
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
async getArNSRecords() {
|
|
103
|
+
async getArNSRecords(pageParams) {
|
|
104
|
+
const allTags = [
|
|
105
|
+
{ name: 'Action', value: 'Paginated-Records' },
|
|
106
|
+
{ name: 'Cursor', value: pageParams?.cursor?.toString() },
|
|
107
|
+
{ name: 'Limit', value: pageParams?.limit?.toString() },
|
|
108
|
+
{ name: 'Sort-By', value: pageParams?.sortBy },
|
|
109
|
+
{ name: 'Sort-Order', value: pageParams?.sortOrder },
|
|
110
|
+
];
|
|
111
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
104
112
|
return this.process.read({
|
|
105
|
-
tags:
|
|
113
|
+
tags: prunedTags,
|
|
106
114
|
});
|
|
107
115
|
}
|
|
108
116
|
async getArNSReservedNames() {
|
|
@@ -126,9 +134,17 @@ export class IOReadable {
|
|
|
126
134
|
],
|
|
127
135
|
});
|
|
128
136
|
}
|
|
129
|
-
async getBalances() {
|
|
137
|
+
async getBalances(pageParams) {
|
|
138
|
+
const allTags = [
|
|
139
|
+
{ name: 'Action', value: 'Paginated-Balances' },
|
|
140
|
+
{ name: 'Cursor', value: pageParams?.cursor?.toString() },
|
|
141
|
+
{ name: 'Limit', value: pageParams?.limit?.toString() },
|
|
142
|
+
{ name: 'Sort-By', value: pageParams?.sortBy },
|
|
143
|
+
{ name: 'Sort-Order', value: pageParams?.sortOrder },
|
|
144
|
+
];
|
|
145
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
130
146
|
return this.process.read({
|
|
131
|
-
tags:
|
|
147
|
+
tags: prunedTags,
|
|
132
148
|
});
|
|
133
149
|
}
|
|
134
150
|
async getGateway({ address, }) {
|
|
@@ -139,9 +155,17 @@ export class IOReadable {
|
|
|
139
155
|
],
|
|
140
156
|
});
|
|
141
157
|
}
|
|
142
|
-
async getGateways() {
|
|
158
|
+
async getGateways(pageParams) {
|
|
159
|
+
const allTags = [
|
|
160
|
+
{ name: 'Action', value: 'Paginated-Gateways' },
|
|
161
|
+
{ name: 'Cursor', value: pageParams?.cursor?.toString() },
|
|
162
|
+
{ name: 'Limit', value: pageParams?.limit?.toString() },
|
|
163
|
+
{ name: 'Sort-By', value: pageParams?.sortBy },
|
|
164
|
+
{ name: 'Sort-Order', value: pageParams?.sortOrder },
|
|
165
|
+
];
|
|
166
|
+
const prunedTags = allTags.filter((tag) => tag.value !== undefined);
|
|
143
167
|
return this.process.read({
|
|
144
|
-
tags:
|
|
168
|
+
tags: prunedTags,
|
|
145
169
|
});
|
|
146
170
|
}
|
|
147
171
|
async getCurrentEpoch() {
|
package/lib/esm/utils/index.js
CHANGED
|
@@ -16,19 +16,20 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { EventEmitter } from 'eventemitter3';
|
|
18
18
|
import { pLimit } from 'plimit-lit';
|
|
19
|
-
import { ANT } from '
|
|
20
|
-
import { IO } from '
|
|
21
|
-
import { IO_TESTNET_PROCESS_ID } from '
|
|
19
|
+
import { ANT } from '../common/ant.js';
|
|
20
|
+
import { IO } from '../common/io.js';
|
|
21
|
+
import { IO_TESTNET_PROCESS_ID } from '../constants.js';
|
|
22
22
|
export const getANTProcessesOwnedByWallet = async ({ address, contract = IO.init({
|
|
23
23
|
processId: IO_TESTNET_PROCESS_ID,
|
|
24
24
|
}), }) => {
|
|
25
25
|
const throttle = pLimit(50);
|
|
26
26
|
// get the record names of the registry - TODO: this may need to be paginated
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const records = await fetchAllArNSRecords({
|
|
28
|
+
contract: contract,
|
|
29
|
+
});
|
|
30
|
+
const uniqueContractProcessIds = Object.values(records)
|
|
30
31
|
.filter((record) => record.processId !== undefined)
|
|
31
|
-
.map((record) => record.processId)
|
|
32
|
+
.map((record) => record.processId);
|
|
32
33
|
// check the contract owner and controllers
|
|
33
34
|
const ownedOrControlledByWallet = await Promise.all(uniqueContractProcessIds.map(async (processId) => throttle(async () => {
|
|
34
35
|
const ant = ANT.init({
|
|
@@ -76,10 +77,12 @@ export class ArNSEventEmitter extends EventEmitter {
|
|
|
76
77
|
}
|
|
77
78
|
async fetchProcessesOwnedByWallet({ address }) {
|
|
78
79
|
const uniqueContractProcessIds = {};
|
|
79
|
-
await timeout(this.timeoutMs, this.contract
|
|
80
|
+
await timeout(this.timeoutMs, fetchAllArNSRecords({ contract: this.contract }))
|
|
81
|
+
.catch((e) => {
|
|
80
82
|
this.emit('error', `Error getting ArNS records: ${e}`);
|
|
81
83
|
return {};
|
|
82
|
-
})
|
|
84
|
+
})
|
|
85
|
+
.then((records) => {
|
|
83
86
|
if (!records)
|
|
84
87
|
return;
|
|
85
88
|
Object.entries(records).forEach(([name, record]) => {
|
|
@@ -120,3 +123,29 @@ export class ArNSEventEmitter extends EventEmitter {
|
|
|
120
123
|
this.emit('end', uniqueContractProcessIds);
|
|
121
124
|
}
|
|
122
125
|
}
|
|
126
|
+
export const fetchAllArNSRecords = async ({ contract = IO.init({
|
|
127
|
+
processId: IO_TESTNET_PROCESS_ID,
|
|
128
|
+
}), logger, }) => {
|
|
129
|
+
let cursor;
|
|
130
|
+
const records = {};
|
|
131
|
+
do {
|
|
132
|
+
const pageResult = await contract
|
|
133
|
+
.getArNSRecords({ cursor })
|
|
134
|
+
.catch((e) => {
|
|
135
|
+
logger?.error(`Error getting ArNS records`, {
|
|
136
|
+
message: e?.message,
|
|
137
|
+
stack: e?.stack,
|
|
138
|
+
});
|
|
139
|
+
return undefined;
|
|
140
|
+
});
|
|
141
|
+
if (!pageResult) {
|
|
142
|
+
return {};
|
|
143
|
+
}
|
|
144
|
+
pageResult.items.forEach((record) => {
|
|
145
|
+
const { name, ...recordDetails } = record;
|
|
146
|
+
records[name] = recordDetails;
|
|
147
|
+
});
|
|
148
|
+
cursor = pageResult.nextCursor;
|
|
149
|
+
} while (cursor !== undefined);
|
|
150
|
+
return records;
|
|
151
|
+
};
|
package/lib/esm/version.js
CHANGED
|
@@ -17,30 +17,6 @@
|
|
|
17
17
|
import { ANTRecord, AoANTRead, AoANTState, AoANTWrite, AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner } from '../types.js';
|
|
18
18
|
import { AOProcess } from './index.js';
|
|
19
19
|
export declare class ANT {
|
|
20
|
-
/**
|
|
21
|
-
* Initializes an ANT instance.
|
|
22
|
-
*
|
|
23
|
-
* There are two overloads for this function:
|
|
24
|
-
* 1. When a signer is provided in the configuration, it returns an instance of ANTWritable.
|
|
25
|
-
* 2. When a signer is NOT provided in the configuration, it returns an instance of ANTReadable.
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @param {ContractConfiguration & WithSigner} config - The configuration object.
|
|
29
|
-
* If a signer is provided, it should be an object that implements the ContractSigner interface.
|
|
30
|
-
*
|
|
31
|
-
* @returns {ANTWritable | ANTReadable} - An instance of ANTWritable if a signer is provided, otherwise an instance of ANTReadable.
|
|
32
|
-
* @throws {Error} - Throws an error if the configuration is invalid.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* Overload 1: When signer is provided
|
|
36
|
-
* ```ts
|
|
37
|
-
* const writable = ANT.init({ signer: mySigner, contract: myContract });
|
|
38
|
-
*```
|
|
39
|
-
* Overload 2: When signer is not provided
|
|
40
|
-
* ```ts
|
|
41
|
-
* const readable = ANT.init({ contract: myContract });
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
20
|
static init(config: Required<ProcessConfiguration> & {
|
|
45
21
|
signer?: undefined;
|
|
46
22
|
}): AoANTRead;
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import Arweave from 'arweave';
|
|
|
18
18
|
import { ArNSReservedNameData, EpochDistributionData, EpochObservations, WeightedObserver } from '../contract-state.js';
|
|
19
19
|
import { AoArNSNameData, AoEpochData, AoEpochSettings, AoGateway, AoIORead, AoIOWrite, EpochInput } from '../io.js';
|
|
20
20
|
import { mIOToken } from '../token.js';
|
|
21
|
-
import { AoMessageResult, ContractSigner, JoinNetworkParams, ProcessConfiguration, TransactionId, UpdateGatewaySettingsParams, WalletAddress, WithSigner, WriteOptions } from '../types.js';
|
|
21
|
+
import { AoArNSNameDataWithName, AoBalanceWithAddress, AoGatewayWithAddress, AoMessageResult, ContractSigner, JoinNetworkParams, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, UpdateGatewaySettingsParams, WalletAddress, WithSigner, WriteOptions } from '../types.js';
|
|
22
22
|
import { AOProcess } from './contracts/ao-process.js';
|
|
23
23
|
export declare class IO {
|
|
24
24
|
static init(): AoIORead;
|
|
@@ -54,7 +54,7 @@ export declare class IOReadable implements AoIORead {
|
|
|
54
54
|
getArNSRecord({ name, }: {
|
|
55
55
|
name: string;
|
|
56
56
|
}): Promise<AoArNSNameData | undefined>;
|
|
57
|
-
getArNSRecords(): Promise<
|
|
57
|
+
getArNSRecords(pageParams?: PaginationParams): Promise<PaginationResult<AoArNSNameDataWithName>>;
|
|
58
58
|
getArNSReservedNames(): Promise<Record<string, ArNSReservedNameData> | Record<string, never>>;
|
|
59
59
|
getArNSReservedName({ name, }: {
|
|
60
60
|
name: string;
|
|
@@ -62,11 +62,11 @@ export declare class IOReadable implements AoIORead {
|
|
|
62
62
|
getBalance({ address }: {
|
|
63
63
|
address: WalletAddress;
|
|
64
64
|
}): Promise<number>;
|
|
65
|
-
getBalances(): Promise<
|
|
65
|
+
getBalances(pageParams?: PaginationParams): Promise<PaginationResult<AoBalanceWithAddress>>;
|
|
66
66
|
getGateway({ address, }: {
|
|
67
67
|
address: WalletAddress;
|
|
68
68
|
}): Promise<AoGateway | undefined>;
|
|
69
|
-
getGateways(): Promise<
|
|
69
|
+
getGateways(pageParams?: PaginationParams): Promise<PaginationResult<AoGatewayWithAddress>>;
|
|
70
70
|
getCurrentEpoch(): Promise<AoEpochData>;
|
|
71
71
|
getPrescribedObservers(epoch?: EpochInput): Promise<WeightedObserver[]>;
|
|
72
72
|
getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
|
package/lib/types/io.d.ts
CHANGED
|
@@ -25,6 +25,20 @@ export declare function isProcessIdConfiguration(config: object): config is {
|
|
|
25
25
|
processId: string;
|
|
26
26
|
};
|
|
27
27
|
export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
|
|
28
|
+
export type PaginationParams = {
|
|
29
|
+
cursor?: string;
|
|
30
|
+
limit?: number;
|
|
31
|
+
sortBy?: string;
|
|
32
|
+
sortOrder?: 'asc' | 'desc';
|
|
33
|
+
};
|
|
34
|
+
export type PaginationResult<T> = {
|
|
35
|
+
items: T[];
|
|
36
|
+
nextCursor: string | undefined;
|
|
37
|
+
totalItems: number;
|
|
38
|
+
sortBy: keyof T;
|
|
39
|
+
sortOrder: 'asc' | 'desc';
|
|
40
|
+
hasMore: boolean;
|
|
41
|
+
};
|
|
28
42
|
export type ProcessConfiguration = {
|
|
29
43
|
process?: AOProcess;
|
|
30
44
|
} | {
|
|
@@ -66,15 +80,15 @@ export interface AoIORead {
|
|
|
66
80
|
getGateway({ address, }: {
|
|
67
81
|
address: WalletAddress;
|
|
68
82
|
}): Promise<AoGateway | undefined>;
|
|
69
|
-
getGateways(): Promise<
|
|
83
|
+
getGateways(params?: PaginationParams): Promise<PaginationResult<AoGatewayWithAddress>>;
|
|
70
84
|
getBalance(params: {
|
|
71
85
|
address: WalletAddress;
|
|
72
86
|
}): Promise<number>;
|
|
73
|
-
getBalances(): Promise<
|
|
87
|
+
getBalances(params?: PaginationParams): Promise<PaginationResult<AoBalanceWithAddress>>;
|
|
74
88
|
getArNSRecord({ name, }: {
|
|
75
89
|
name: string;
|
|
76
90
|
}): Promise<AoArNSNameData | undefined>;
|
|
77
|
-
getArNSRecords(): Promise<
|
|
91
|
+
getArNSRecords(params?: PaginationParams): Promise<PaginationResult<AoArNSNameDataWithName>>;
|
|
78
92
|
getArNSReservedNames(): Promise<Record<string, AoArNSReservedNameData> | Record<string, never>>;
|
|
79
93
|
getArNSReservedName({ name, }: {
|
|
80
94
|
name: string;
|
|
@@ -201,6 +215,9 @@ export interface AoIOState {
|
|
|
201
215
|
export type AoEpochIndex = number;
|
|
202
216
|
export type AoArNSReservedNameData = ArNSReservedNameData;
|
|
203
217
|
export type AoArNSNameData = AoArNSPermabuyData | AoArNSLeaseData;
|
|
218
|
+
export type AoArNSNameDataWithName = AoArNSNameData & {
|
|
219
|
+
name: string;
|
|
220
|
+
};
|
|
204
221
|
export type AoArNSBaseNameData = {
|
|
205
222
|
processId: ProcessId;
|
|
206
223
|
startTimestamp: number;
|
|
@@ -259,6 +276,13 @@ export type AoGateway = {
|
|
|
259
276
|
operatorStake: number;
|
|
260
277
|
status: 'joined' | 'leaving';
|
|
261
278
|
};
|
|
279
|
+
export type AoBalanceWithAddress = {
|
|
280
|
+
address: WalletAddress;
|
|
281
|
+
balance: number;
|
|
282
|
+
};
|
|
283
|
+
export type AoGatewayWithAddress = AoGateway & {
|
|
284
|
+
gatewayAddress: WalletAddress;
|
|
285
|
+
};
|
|
262
286
|
export type AoANTState = {
|
|
263
287
|
Name: string;
|
|
264
288
|
Ticker: string;
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
import { EventEmitter } from 'eventemitter3';
|
|
18
|
-
import {
|
|
18
|
+
import { ILogger } from '../common/logger.js';
|
|
19
|
+
import { AoArNSNameData, AoIORead, ProcessId, WalletAddress } from '../types.js';
|
|
19
20
|
export declare const getANTProcessesOwnedByWallet: ({ address, contract, }: {
|
|
20
21
|
address: WalletAddress;
|
|
21
22
|
contract?: AoIORead;
|
|
@@ -33,3 +34,7 @@ export declare class ArNSEventEmitter extends EventEmitter {
|
|
|
33
34
|
address: WalletAddress;
|
|
34
35
|
}): Promise<void>;
|
|
35
36
|
}
|
|
37
|
+
export declare const fetchAllArNSRecords: ({ contract, logger, }: {
|
|
38
|
+
contract?: AoIORead;
|
|
39
|
+
logger?: ILogger;
|
|
40
|
+
}) => Promise<Record<string, AoArNSNameData>>;
|
package/lib/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/**
|
|
18
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
19
|
-
*
|
|
20
|
-
* This program is free software: you can redistribute it and/or modify
|
|
21
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
22
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
23
|
-
* (at your option) any later version.
|
|
24
|
-
*
|
|
25
|
-
* This program is distributed in the hope that it will be useful,
|
|
26
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28
|
-
* GNU Affero General Public License for more details.
|
|
29
|
-
*
|
|
30
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
31
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
|
-
*/
|
|
33
|
-
__exportStar(require("./processes.js"), exports);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* This program is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU Affero General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
export * from './processes.js';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* This program is free software: you can redistribute it and/or modify
|
|
5
|
-
* it under the terms of the GNU Affero General Public License as published by
|
|
6
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
7
|
-
* (at your option) any later version.
|
|
8
|
-
*
|
|
9
|
-
* This program is distributed in the hope that it will be useful,
|
|
10
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
* GNU Affero General Public License for more details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
export * from './processes.js';
|