@ar.io/sdk 2.1.0-alpha.8 → 2.1.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/bundles/web.bundle.min.js +46 -46
- package/lib/cjs/common/ant.js +1 -1
- package/lib/cjs/common/io.js +5 -5
- package/lib/cjs/io.js +2 -1
- package/lib/cjs/types.js +0 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +1 -1
- package/lib/esm/common/io.js +5 -5
- package/lib/esm/io.js +2 -1
- package/lib/esm/types.js +0 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +4 -4
- package/lib/types/common/io.d.ts +8 -12
- package/lib/types/common.d.ts +0 -23
- package/lib/types/io.d.ts +165 -124
- package/lib/types/types.d.ts +0 -1
- package/lib/types/utils/ao.d.ts +9 -3
- package/lib/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/lib/cjs/contract-state.js +0 -68
- package/lib/esm/contract-state.js +0 -65
- package/lib/types/contract-state.d.ts +0 -203
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ar.io/sdk",
|
|
3
|
-
"version": "2.1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ar-io/ar-io-sdk.git"
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"**/*.{ts,js,mjs,cjs,md,json}": [
|
|
134
134
|
"prettier --write ."
|
|
135
135
|
],
|
|
136
|
-
"
|
|
136
|
+
"**/README.md": [
|
|
137
137
|
"markdown-toc-gen insert"
|
|
138
138
|
]
|
|
139
139
|
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ANT_CONTRACT_FUNCTIONS = exports.DENOMINATIONS = exports.AR_IO_CONTRACT_FUNCTIONS = exports.ioContractInteractions = exports.ioContractWriteInteractions = exports.ioContractReadInteractions = void 0;
|
|
4
|
-
exports.ioContractReadInteractions = [
|
|
5
|
-
'gateway',
|
|
6
|
-
'gateways',
|
|
7
|
-
'prescribedObservers',
|
|
8
|
-
'record',
|
|
9
|
-
'auction',
|
|
10
|
-
'balance',
|
|
11
|
-
'epoch',
|
|
12
|
-
'priceForInteraction',
|
|
13
|
-
];
|
|
14
|
-
exports.ioContractWriteInteractions = [
|
|
15
|
-
'delegateStake',
|
|
16
|
-
'decreaseDelegateStake',
|
|
17
|
-
'joinNetwork',
|
|
18
|
-
'increaseOperatorStake',
|
|
19
|
-
'decreaseOperatorStake',
|
|
20
|
-
'updateGatewaySettings',
|
|
21
|
-
'saveObservations',
|
|
22
|
-
'extendRecord',
|
|
23
|
-
'buyRecord',
|
|
24
|
-
'increaseUndernameCount',
|
|
25
|
-
'transfer',
|
|
26
|
-
];
|
|
27
|
-
exports.ioContractInteractions = [
|
|
28
|
-
...exports.ioContractReadInteractions,
|
|
29
|
-
...exports.ioContractWriteInteractions,
|
|
30
|
-
];
|
|
31
|
-
exports.AR_IO_CONTRACT_FUNCTIONS = {
|
|
32
|
-
GATEWAY: 'gateway',
|
|
33
|
-
GATEWAYS: 'gateways',
|
|
34
|
-
PRESCRIBED_OBSERVERS: 'prescribedObservers',
|
|
35
|
-
DELEGATE_STAKE: 'delegateStake',
|
|
36
|
-
DECREASE_DELEGATE_STAKE: 'decreaseDelegateStake',
|
|
37
|
-
JOIN_NETWORK: 'joinNetwork',
|
|
38
|
-
INCREASE_OPERATOR_STAKE: 'increaseOperatorStake',
|
|
39
|
-
DECREASE_OPERATOR_STAKE: 'decreaseOperatorStake',
|
|
40
|
-
UPDATE_GATEWAY_SETTINGS: 'updateGatewaySettings',
|
|
41
|
-
SAVE_OBSERVATIONS: 'saveObservations',
|
|
42
|
-
EXTEND_RECORD: 'extendRecord',
|
|
43
|
-
INCREASE_UNDERNAME_COUNT: 'increaseUndernameCount',
|
|
44
|
-
RECORD: 'record',
|
|
45
|
-
AUCTION: 'auction',
|
|
46
|
-
TRANSFER: 'transfer',
|
|
47
|
-
BALANCE: 'balance',
|
|
48
|
-
PRICE_FOR_INTERACTION: 'priceForInteraction',
|
|
49
|
-
EPOCH: 'epoch',
|
|
50
|
-
BUY_RECORD: 'buyRecord',
|
|
51
|
-
};
|
|
52
|
-
// Balances
|
|
53
|
-
var DENOMINATIONS;
|
|
54
|
-
(function (DENOMINATIONS) {
|
|
55
|
-
DENOMINATIONS["IO"] = "IO";
|
|
56
|
-
DENOMINATIONS["MIO"] = "mIO";
|
|
57
|
-
})(DENOMINATIONS || (exports.DENOMINATIONS = DENOMINATIONS = {}));
|
|
58
|
-
exports.ANT_CONTRACT_FUNCTIONS = {
|
|
59
|
-
TRANSFER: 'transfer',
|
|
60
|
-
SET_CONTROLLER: 'setController',
|
|
61
|
-
REMOVE_CONTROLLER: 'removeController',
|
|
62
|
-
SET_NAME: 'setName',
|
|
63
|
-
SET_TICKER: 'setTicker',
|
|
64
|
-
SET_RECORD: 'setRecord',
|
|
65
|
-
REMOVE_RECORD: 'removeRecord',
|
|
66
|
-
BALANCE: 'balance',
|
|
67
|
-
EVOLVE: 'evolve',
|
|
68
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export const ioContractReadInteractions = [
|
|
2
|
-
'gateway',
|
|
3
|
-
'gateways',
|
|
4
|
-
'prescribedObservers',
|
|
5
|
-
'record',
|
|
6
|
-
'auction',
|
|
7
|
-
'balance',
|
|
8
|
-
'epoch',
|
|
9
|
-
'priceForInteraction',
|
|
10
|
-
];
|
|
11
|
-
export const ioContractWriteInteractions = [
|
|
12
|
-
'delegateStake',
|
|
13
|
-
'decreaseDelegateStake',
|
|
14
|
-
'joinNetwork',
|
|
15
|
-
'increaseOperatorStake',
|
|
16
|
-
'decreaseOperatorStake',
|
|
17
|
-
'updateGatewaySettings',
|
|
18
|
-
'saveObservations',
|
|
19
|
-
'extendRecord',
|
|
20
|
-
'buyRecord',
|
|
21
|
-
'increaseUndernameCount',
|
|
22
|
-
'transfer',
|
|
23
|
-
];
|
|
24
|
-
export const ioContractInteractions = [
|
|
25
|
-
...ioContractReadInteractions,
|
|
26
|
-
...ioContractWriteInteractions,
|
|
27
|
-
];
|
|
28
|
-
export const AR_IO_CONTRACT_FUNCTIONS = {
|
|
29
|
-
GATEWAY: 'gateway',
|
|
30
|
-
GATEWAYS: 'gateways',
|
|
31
|
-
PRESCRIBED_OBSERVERS: 'prescribedObservers',
|
|
32
|
-
DELEGATE_STAKE: 'delegateStake',
|
|
33
|
-
DECREASE_DELEGATE_STAKE: 'decreaseDelegateStake',
|
|
34
|
-
JOIN_NETWORK: 'joinNetwork',
|
|
35
|
-
INCREASE_OPERATOR_STAKE: 'increaseOperatorStake',
|
|
36
|
-
DECREASE_OPERATOR_STAKE: 'decreaseOperatorStake',
|
|
37
|
-
UPDATE_GATEWAY_SETTINGS: 'updateGatewaySettings',
|
|
38
|
-
SAVE_OBSERVATIONS: 'saveObservations',
|
|
39
|
-
EXTEND_RECORD: 'extendRecord',
|
|
40
|
-
INCREASE_UNDERNAME_COUNT: 'increaseUndernameCount',
|
|
41
|
-
RECORD: 'record',
|
|
42
|
-
AUCTION: 'auction',
|
|
43
|
-
TRANSFER: 'transfer',
|
|
44
|
-
BALANCE: 'balance',
|
|
45
|
-
PRICE_FOR_INTERACTION: 'priceForInteraction',
|
|
46
|
-
EPOCH: 'epoch',
|
|
47
|
-
BUY_RECORD: 'buyRecord',
|
|
48
|
-
};
|
|
49
|
-
// Balances
|
|
50
|
-
export var DENOMINATIONS;
|
|
51
|
-
(function (DENOMINATIONS) {
|
|
52
|
-
DENOMINATIONS["IO"] = "IO";
|
|
53
|
-
DENOMINATIONS["MIO"] = "mIO";
|
|
54
|
-
})(DENOMINATIONS || (DENOMINATIONS = {}));
|
|
55
|
-
export const ANT_CONTRACT_FUNCTIONS = {
|
|
56
|
-
TRANSFER: 'transfer',
|
|
57
|
-
SET_CONTROLLER: 'setController',
|
|
58
|
-
REMOVE_CONTROLLER: 'removeController',
|
|
59
|
-
SET_NAME: 'setName',
|
|
60
|
-
SET_TICKER: 'setTicker',
|
|
61
|
-
SET_RECORD: 'setRecord',
|
|
62
|
-
REMOVE_RECORD: 'removeRecord',
|
|
63
|
-
BALANCE: 'balance',
|
|
64
|
-
EVOLVE: 'evolve',
|
|
65
|
-
};
|
|
@@ -1,203 +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
|
-
import { WalletAddress } from './common.js';
|
|
18
|
-
export type Balances = Record<WalletAddress, number>;
|
|
19
|
-
export type Fees = Record<string, number>;
|
|
20
|
-
export type Observations = Record<number, EpochObservations>;
|
|
21
|
-
export declare const ioContractReadInteractions: readonly ["gateway", "gateways", "prescribedObservers", "record", "auction", "balance", "epoch", "priceForInteraction"];
|
|
22
|
-
export declare const ioContractWriteInteractions: readonly ["delegateStake", "decreaseDelegateStake", "joinNetwork", "increaseOperatorStake", "decreaseOperatorStake", "updateGatewaySettings", "saveObservations", "extendRecord", "buyRecord", "increaseUndernameCount", "transfer"];
|
|
23
|
-
export declare const ioContractInteractions: readonly ["gateway", "gateways", "prescribedObservers", "record", "auction", "balance", "epoch", "priceForInteraction", "delegateStake", "decreaseDelegateStake", "joinNetwork", "increaseOperatorStake", "decreaseOperatorStake", "updateGatewaySettings", "saveObservations", "extendRecord", "buyRecord", "increaseUndernameCount", "transfer"];
|
|
24
|
-
export type IOContractReadInteractions = (typeof ioContractReadInteractions)[number];
|
|
25
|
-
export type IOContractWriteInteractions = (typeof ioContractWriteInteractions)[number];
|
|
26
|
-
export type IOContractInteractions = (typeof ioContractInteractions)[number];
|
|
27
|
-
export type IOContractInteractionsWithIOFees = Extract<IOContractInteractions, 'buyRecord' | 'extendRecord' | 'increaseUndernameCount'>;
|
|
28
|
-
export declare const AR_IO_CONTRACT_FUNCTIONS: Record<string, IOContractInteractions>;
|
|
29
|
-
export type Gateway = {
|
|
30
|
-
delegates: Record<WalletAddress, GatewayDelegate>;
|
|
31
|
-
end: number;
|
|
32
|
-
observerWallet: WalletAddress;
|
|
33
|
-
operatorStake: number;
|
|
34
|
-
settings: GatewaySettings;
|
|
35
|
-
start: number;
|
|
36
|
-
stats: GatewayStats;
|
|
37
|
-
status: string;
|
|
38
|
-
totalDelegatedStake: number;
|
|
39
|
-
vaults: Record<WalletAddress, VaultData>;
|
|
40
|
-
weights: ObserverWeights;
|
|
41
|
-
};
|
|
42
|
-
export type GatewayDelegate = {
|
|
43
|
-
delegatedStake: number;
|
|
44
|
-
start: number;
|
|
45
|
-
vaults: Record<WalletAddress, VaultData>;
|
|
46
|
-
};
|
|
47
|
-
export type GatewayStakingSettings = {
|
|
48
|
-
allowDelegatedStaking: boolean;
|
|
49
|
-
delegateRewardShareRatio: number;
|
|
50
|
-
minDelegatedStake: number;
|
|
51
|
-
autoStake: boolean;
|
|
52
|
-
};
|
|
53
|
-
export type GatewayMetadata = {
|
|
54
|
-
label: string;
|
|
55
|
-
note: string;
|
|
56
|
-
properties: string;
|
|
57
|
-
};
|
|
58
|
-
export type GatewayConnectionSettings = {
|
|
59
|
-
fqdn: string;
|
|
60
|
-
port: number;
|
|
61
|
-
protocol: AllowedProtocols;
|
|
62
|
-
};
|
|
63
|
-
export type GatewaySettings = GatewayConnectionSettings & GatewayStakingSettings & GatewayMetadata;
|
|
64
|
-
export type AllowedProtocols = 'https';
|
|
65
|
-
export type GatewayStats = {
|
|
66
|
-
prescribedEpochCount: number;
|
|
67
|
-
observedEpochCount: number;
|
|
68
|
-
totalEpochCount: number;
|
|
69
|
-
passedEpochCount: number;
|
|
70
|
-
failedEpochCount: number;
|
|
71
|
-
failedConsecutiveEpochs: number;
|
|
72
|
-
passedConsecutiveEpochs: number;
|
|
73
|
-
};
|
|
74
|
-
export type WeightedObserver = {
|
|
75
|
-
gatewayAddress: WalletAddress;
|
|
76
|
-
observerAddress: WalletAddress;
|
|
77
|
-
stake: number;
|
|
78
|
-
start: number;
|
|
79
|
-
} & ObserverWeights;
|
|
80
|
-
export type ObserverWeights = {
|
|
81
|
-
stakeWeight: number;
|
|
82
|
-
tenureWeight: number;
|
|
83
|
-
gatewayRewardRatioWeight: number;
|
|
84
|
-
observerRewardRatioWeight: number;
|
|
85
|
-
compositeWeight: number;
|
|
86
|
-
normalizedCompositeWeight: number;
|
|
87
|
-
};
|
|
88
|
-
export type RegistrationType = 'lease' | 'permabuy';
|
|
89
|
-
export type ArNSBaseNameData = {
|
|
90
|
-
contractTxId: string;
|
|
91
|
-
startTimestamp: number;
|
|
92
|
-
type: RegistrationType;
|
|
93
|
-
undernames: number;
|
|
94
|
-
purchasePrice: number;
|
|
95
|
-
};
|
|
96
|
-
export type ArNSPermabuyData = ArNSBaseNameData & {
|
|
97
|
-
type: 'permabuy';
|
|
98
|
-
};
|
|
99
|
-
export type ArNSLeaseData = ArNSBaseNameData & {
|
|
100
|
-
type: 'lease';
|
|
101
|
-
endTimestamp: number;
|
|
102
|
-
};
|
|
103
|
-
export type ArNSReservedNameData = {
|
|
104
|
-
target?: string;
|
|
105
|
-
endTimestamp?: number;
|
|
106
|
-
};
|
|
107
|
-
export type ArNSNameData = ArNSPermabuyData | ArNSLeaseData;
|
|
108
|
-
export type VaultData = {
|
|
109
|
-
balance: number;
|
|
110
|
-
start: number;
|
|
111
|
-
end: number;
|
|
112
|
-
};
|
|
113
|
-
export declare enum DENOMINATIONS {
|
|
114
|
-
IO = "IO",
|
|
115
|
-
MIO = "mIO"
|
|
116
|
-
}
|
|
117
|
-
export type ReservedNameData = {
|
|
118
|
-
target?: string;
|
|
119
|
-
endTimestamp?: number;
|
|
120
|
-
};
|
|
121
|
-
export type ArNSBaseAuctionData = {
|
|
122
|
-
startPrice: number;
|
|
123
|
-
floorPrice: number;
|
|
124
|
-
startHeight: number;
|
|
125
|
-
endHeight: number;
|
|
126
|
-
type: RegistrationType;
|
|
127
|
-
initiator: string;
|
|
128
|
-
contractTxId: string;
|
|
129
|
-
};
|
|
130
|
-
export type ArNSLeaseAuctionData = ArNSBaseAuctionData & {
|
|
131
|
-
type: 'lease';
|
|
132
|
-
years: 1;
|
|
133
|
-
};
|
|
134
|
-
export type ArNSPermabuyAuctionData = ArNSBaseAuctionData & {
|
|
135
|
-
type: 'permabuy';
|
|
136
|
-
};
|
|
137
|
-
export type ArNSAuctionData = ArNSLeaseAuctionData | ArNSPermabuyAuctionData;
|
|
138
|
-
export type DemandFactoringData = {
|
|
139
|
-
periodZeroBlockHeight: number;
|
|
140
|
-
currentPeriod: number;
|
|
141
|
-
trailingPeriodPurchases: number[];
|
|
142
|
-
trailingPeriodRevenues: number[];
|
|
143
|
-
purchasesThisPeriod: number;
|
|
144
|
-
revenueThisPeriod: number;
|
|
145
|
-
demandFactor: number;
|
|
146
|
-
consecutivePeriodsWithMinDemandFactor: number;
|
|
147
|
-
};
|
|
148
|
-
export type EpochObservations = {
|
|
149
|
-
failureSummaries: Record<string, string[]>;
|
|
150
|
-
reports: Record<string, string>;
|
|
151
|
-
};
|
|
152
|
-
export type EpochDistributionData = {
|
|
153
|
-
epochZeroStartHeight: number;
|
|
154
|
-
epochStartHeight: number;
|
|
155
|
-
epochEndHeight: number;
|
|
156
|
-
epochPeriod: number;
|
|
157
|
-
epochDistributionHeight: number;
|
|
158
|
-
epochBlockLength: number;
|
|
159
|
-
};
|
|
160
|
-
export type Vaults = Record<string, VaultData>;
|
|
161
|
-
export type RegistryVaults = Record<string, Vaults>;
|
|
162
|
-
export type PrescribedObservers = Record<number, WeightedObserver[]>;
|
|
163
|
-
export interface ArIOState {
|
|
164
|
-
balances: Balances;
|
|
165
|
-
name: string;
|
|
166
|
-
records: Record<string, ArNSNameData>;
|
|
167
|
-
gateways: Record<string, Gateway>;
|
|
168
|
-
fees: Fees;
|
|
169
|
-
reserved: Record<string, ReservedNameData>;
|
|
170
|
-
auctions: Record<string, ArNSAuctionData>;
|
|
171
|
-
lastTickedHeight: number;
|
|
172
|
-
demandFactoring: DemandFactoringData;
|
|
173
|
-
observations: Observations;
|
|
174
|
-
distributions: EpochDistributionData;
|
|
175
|
-
vaults: RegistryVaults;
|
|
176
|
-
prescribedObservers: PrescribedObservers;
|
|
177
|
-
}
|
|
178
|
-
export type ANTRecord = {
|
|
179
|
-
transactionId: string;
|
|
180
|
-
ttlSeconds: number;
|
|
181
|
-
};
|
|
182
|
-
export type ANTRecords = Record<string, ANTRecord> & {
|
|
183
|
-
'@': ANTRecord;
|
|
184
|
-
};
|
|
185
|
-
export type ANTState = {
|
|
186
|
-
owner: WalletAddress;
|
|
187
|
-
controllers: WalletAddress[];
|
|
188
|
-
name: string;
|
|
189
|
-
ticker: string;
|
|
190
|
-
records: ANTRecords;
|
|
191
|
-
balances: Balances;
|
|
192
|
-
};
|
|
193
|
-
export declare const ANT_CONTRACT_FUNCTIONS: {
|
|
194
|
-
TRANSFER: string;
|
|
195
|
-
SET_CONTROLLER: string;
|
|
196
|
-
REMOVE_CONTROLLER: string;
|
|
197
|
-
SET_NAME: string;
|
|
198
|
-
SET_TICKER: string;
|
|
199
|
-
SET_RECORD: string;
|
|
200
|
-
REMOVE_RECORD: string;
|
|
201
|
-
BALANCE: string;
|
|
202
|
-
EVOLVE: string;
|
|
203
|
-
};
|