@ar.io/sdk 1.2.0-alpha.9 → 1.2.1
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 +914 -70
- package/bundles/web.bundle.min.js +76 -76
- package/lib/cjs/common/ant-ao.js +11 -4
- package/lib/cjs/common/contracts/ao-process.js +16 -5
- package/lib/cjs/common/io.js +97 -102
- package/lib/cjs/constants.js +7 -4
- package/lib/cjs/utils/graphql/processes.js +88 -8
- package/lib/cjs/utils/index.js +1 -0
- package/lib/cjs/utils/json.js +28 -0
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant-ao.js +11 -4
- package/lib/esm/common/contracts/ao-process.js +16 -5
- package/lib/esm/common/io.js +98 -103
- package/lib/esm/constants.js +6 -3
- package/lib/esm/utils/graphql/processes.js +87 -8
- package/lib/esm/utils/index.js +1 -0
- package/lib/esm/utils/json.js +24 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant-ao.d.ts +2 -1
- package/lib/types/common/io.d.ts +11 -4
- package/lib/types/constants.d.ts +4 -2
- package/lib/types/io.d.ts +29 -3
- package/lib/types/utils/graphql/processes.d.ts +30 -0
- package/lib/types/utils/index.d.ts +1 -0
- package/lib/types/utils/json.d.ts +17 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +7 -1
package/lib/types/constants.d.ts
CHANGED
|
@@ -20,8 +20,10 @@ export declare const FQDN_REGEX: RegExp;
|
|
|
20
20
|
export declare const SORT_KEY_REGEX: RegExp;
|
|
21
21
|
export declare const ARNS_TESTNET_REGISTRY_TX: string;
|
|
22
22
|
export declare const ARNS_DEVNET_REGISTRY_TX = "_NctcA2sRy1-J4OmIQZbYFPM17piNcbdBPH2ncX2RL8";
|
|
23
|
+
export declare const IO_DEVNET_PROCESS_ID = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
|
|
23
24
|
export declare const ioDevnetProcessId = "GaQrvEMKBpkjofgnBi_B3IgIDmY_XYelVLB6GcRGrHc";
|
|
25
|
+
export declare const IO_TESTNET_PROCESS_ID = "agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA";
|
|
24
26
|
export declare const MIO_PER_IO = 1000000;
|
|
25
|
-
export declare const AOS_MODULE_ID = "
|
|
26
|
-
export declare const ANT_LUA_ID = "
|
|
27
|
+
export declare const AOS_MODULE_ID = "cbn0KKrBZH7hdNkNokuXLtGryrWM--PjSTBqIzw9Kkk";
|
|
28
|
+
export declare const ANT_LUA_ID = "3OlGzE5mrsN2GsxCYM0Tae1KzWepGOr5a94deOWmApM";
|
|
27
29
|
export declare const DEFAULT_SCHEDULER_ID = "_GQ33BkPtZrqxA84vM8Zk-N2aO0toNNu_C-l-rawrBA";
|
package/lib/types/io.d.ts
CHANGED
|
@@ -31,8 +31,6 @@ export type ProcessConfiguration = {
|
|
|
31
31
|
processId?: string;
|
|
32
32
|
};
|
|
33
33
|
export type EpochInput = {
|
|
34
|
-
blockHeight: BlockHeight;
|
|
35
|
-
} | {
|
|
36
34
|
epochIndex: AoEpochIndex;
|
|
37
35
|
} | {
|
|
38
36
|
timestamp: Timestamp;
|
|
@@ -58,6 +56,13 @@ export interface AOContract {
|
|
|
58
56
|
}>;
|
|
59
57
|
}
|
|
60
58
|
export interface AoIORead {
|
|
59
|
+
getInfo(): Promise<{
|
|
60
|
+
Ticker: string;
|
|
61
|
+
Name: string;
|
|
62
|
+
Logo: string;
|
|
63
|
+
Denomination: number;
|
|
64
|
+
}>;
|
|
65
|
+
getEpochSettings(params?: EpochInput): Promise<AoEpochSettings>;
|
|
61
66
|
getGateway({ address, }: {
|
|
62
67
|
address: WalletAddress;
|
|
63
68
|
}): Promise<AoGateway | undefined>;
|
|
@@ -81,7 +86,7 @@ export interface AoIORead {
|
|
|
81
86
|
getObservations(epoch?: EpochInput): Promise<EpochObservations>;
|
|
82
87
|
getDistributions(epoch?: EpochInput): Promise<EpochDistributionData>;
|
|
83
88
|
getTokenCost({ intent, purchaseType, years, name, quantity, }: {
|
|
84
|
-
intent: '
|
|
89
|
+
intent: 'Buy-Record' | 'Extend-Lease' | 'Increase-Undername-Limit';
|
|
85
90
|
purchaseType?: 'permabuy' | 'lease';
|
|
86
91
|
years?: number;
|
|
87
92
|
name?: string;
|
|
@@ -134,6 +139,7 @@ export interface AoIOWrite extends AoIORead {
|
|
|
134
139
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
135
140
|
}
|
|
136
141
|
export interface AoANTRead {
|
|
142
|
+
getState(): Promise<AoANTState>;
|
|
137
143
|
getInfo(): Promise<{
|
|
138
144
|
Name: string;
|
|
139
145
|
Ticker: string;
|
|
@@ -208,6 +214,14 @@ export type AoArNSLeaseData = AoArNSBaseNameData & {
|
|
|
208
214
|
type: 'lease';
|
|
209
215
|
endTimestamp: number;
|
|
210
216
|
};
|
|
217
|
+
export type AoEpochSettings = {
|
|
218
|
+
epochZeroStartTimestamp: Timestamp;
|
|
219
|
+
durationMs: number;
|
|
220
|
+
prescribedNameCount: number;
|
|
221
|
+
rewardPercentage: number;
|
|
222
|
+
maxObservers: number;
|
|
223
|
+
distributionDelayMs: number;
|
|
224
|
+
};
|
|
211
225
|
export type AoEpochData = {
|
|
212
226
|
epochIndex: AoEpochIndex;
|
|
213
227
|
startHeight: BlockHeight;
|
|
@@ -244,3 +258,15 @@ export type AoGateway = {
|
|
|
244
258
|
operatorStake: number;
|
|
245
259
|
status: 'joined' | 'leaving';
|
|
246
260
|
};
|
|
261
|
+
export type AoANTState = {
|
|
262
|
+
Name: string;
|
|
263
|
+
Ticker: string;
|
|
264
|
+
Denomination: number;
|
|
265
|
+
Owner: WalletAddress;
|
|
266
|
+
Controllers: WalletAddress[];
|
|
267
|
+
Records: Record<string, ANTRecord>;
|
|
268
|
+
Balances: Record<WalletAddress, number>;
|
|
269
|
+
Logo: string;
|
|
270
|
+
TotalSupply: number;
|
|
271
|
+
Initialized: boolean;
|
|
272
|
+
};
|
|
@@ -1,5 +1,35 @@
|
|
|
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
|
+
import { EventEmitter } from 'eventemitter3';
|
|
1
18
|
import { AoIORead, ProcessId, WalletAddress } from '../../types.js';
|
|
2
19
|
export declare const getANTProcessesOwnedByWallet: ({ address, contract, }: {
|
|
3
20
|
address: WalletAddress;
|
|
4
21
|
contract?: AoIORead;
|
|
5
22
|
}) => Promise<ProcessId[]>;
|
|
23
|
+
export declare class ArNSEventEmitter extends EventEmitter {
|
|
24
|
+
protected contract: AoIORead;
|
|
25
|
+
private timeoutMs;
|
|
26
|
+
private throttle;
|
|
27
|
+
constructor({ contract, timeoutMs, concurrency, }: {
|
|
28
|
+
contract?: AoIORead;
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
concurrency?: number;
|
|
31
|
+
});
|
|
32
|
+
fetchProcessesOwnedByWallet({ address }: {
|
|
33
|
+
address: WalletAddress;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 declare function safeDecode<R = unknown>(data: any): R;
|
package/lib/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ar.io/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
|
|
@@ -68,7 +68,12 @@
|
|
|
68
68
|
"format": "prettier --check .",
|
|
69
69
|
"format:fix": "prettier --write .",
|
|
70
70
|
"test": "yarn test:unit && yarn test:integration",
|
|
71
|
+
"test:cjs": "cd ./tests/e2e/cjs && yarn && yarn test",
|
|
72
|
+
"test:esm": "cd ./tests/e2e/esm && yarn && yarn test",
|
|
73
|
+
"test:web": "cd ./tests/e2e/web && yarn && yarn test",
|
|
71
74
|
"test:unit": "jest --config=jest.config.mjs",
|
|
75
|
+
"test:link": "yarn build && yarn link",
|
|
76
|
+
"test:e2e": "yarn test:link && yarn test:cjs && yarn test:esm && yarn test:web",
|
|
72
77
|
"test:integration": "jest --config=jest.integration.config.mjs --runInBand",
|
|
73
78
|
"test:docker": "docker-compose up --exit-code-from test-runner --build",
|
|
74
79
|
"prepare": "husky install",
|
|
@@ -123,6 +128,7 @@
|
|
|
123
128
|
"axios": "1.7.2",
|
|
124
129
|
"axios-retry": "^4.3.0",
|
|
125
130
|
"bunyan": "^1.8.15",
|
|
131
|
+
"eventemitter3": "^5.0.1",
|
|
126
132
|
"plimit-lit": "^3.0.1",
|
|
127
133
|
"warp-contracts": "1.4.45"
|
|
128
134
|
},
|