@ar.io/sdk 2.1.0-alpha.8 → 2.1.0-alpha.9
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 +164 -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 +1 -1
- 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/lib/cjs/common/ant.js
CHANGED
|
@@ -82,7 +82,7 @@ class AoANTReadable {
|
|
|
82
82
|
return record;
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* @returns {Promise<Record<string,
|
|
85
|
+
* @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
|
|
86
86
|
* @example
|
|
87
87
|
* Get the current records
|
|
88
88
|
* ```ts
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -394,11 +394,11 @@ class IOWriteable extends IOReadable {
|
|
|
394
394
|
},
|
|
395
395
|
{
|
|
396
396
|
name: 'Allow-Delegated-Staking',
|
|
397
|
-
value: allowDelegatedStaking
|
|
397
|
+
value: allowDelegatedStaking?.toString(),
|
|
398
398
|
},
|
|
399
399
|
{
|
|
400
400
|
name: 'Delegate-Reward-Share-Ratio',
|
|
401
|
-
value: delegateRewardShareRatio
|
|
401
|
+
value: delegateRewardShareRatio?.toString(),
|
|
402
402
|
},
|
|
403
403
|
{
|
|
404
404
|
name: 'FQDN',
|
|
@@ -410,7 +410,7 @@ class IOWriteable extends IOReadable {
|
|
|
410
410
|
},
|
|
411
411
|
{
|
|
412
412
|
name: 'Min-Delegated-Stake',
|
|
413
|
-
value: minDelegatedStake
|
|
413
|
+
value: minDelegatedStake?.valueOf().toString(),
|
|
414
414
|
},
|
|
415
415
|
{
|
|
416
416
|
name: 'Note',
|
|
@@ -418,7 +418,7 @@ class IOWriteable extends IOReadable {
|
|
|
418
418
|
},
|
|
419
419
|
{
|
|
420
420
|
name: 'Port',
|
|
421
|
-
value: port
|
|
421
|
+
value: port?.toString(),
|
|
422
422
|
},
|
|
423
423
|
{
|
|
424
424
|
name: 'Properties',
|
|
@@ -430,7 +430,7 @@ class IOWriteable extends IOReadable {
|
|
|
430
430
|
},
|
|
431
431
|
{
|
|
432
432
|
name: 'Auto-Stake',
|
|
433
|
-
value: autoStake
|
|
433
|
+
value: autoStake?.toString(),
|
|
434
434
|
},
|
|
435
435
|
{
|
|
436
436
|
name: 'Observer-Address',
|
package/lib/cjs/io.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isLeasedArNSRecord = exports.isProcessIdConfiguration = exports.isProcessConfiguration = void 0;
|
|
4
4
|
const arweave_js_1 = require("./utils/arweave.js");
|
|
5
|
+
// Typeguard functions
|
|
5
6
|
function isProcessConfiguration(config) {
|
|
6
7
|
return 'process' in config;
|
|
7
8
|
}
|
|
@@ -13,6 +14,6 @@ function isProcessIdConfiguration(config) {
|
|
|
13
14
|
}
|
|
14
15
|
exports.isProcessIdConfiguration = isProcessIdConfiguration;
|
|
15
16
|
function isLeasedArNSRecord(record) {
|
|
16
|
-
return record.type === 'lease'
|
|
17
|
+
return record.type === 'lease';
|
|
17
18
|
}
|
|
18
19
|
exports.isLeasedArNSRecord = isLeasedArNSRecord;
|
package/lib/cjs/types.js
CHANGED
|
@@ -30,7 +30,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
* You should have received a copy of the GNU Affero General Public License
|
|
31
31
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
32
|
*/
|
|
33
|
-
__exportStar(require("./contract-state.js"), exports);
|
|
34
33
|
__exportStar(require("./common.js"), exports);
|
|
35
34
|
__exportStar(require("./token.js"), exports);
|
|
36
35
|
__exportStar(require("./io.js"), exports);
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/ant.js
CHANGED
|
@@ -78,7 +78,7 @@ export class AoANTReadable {
|
|
|
78
78
|
return record;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
* @returns {Promise<Record<string,
|
|
81
|
+
* @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
|
|
82
82
|
* @example
|
|
83
83
|
* Get the current records
|
|
84
84
|
* ```ts
|
package/lib/esm/common/io.js
CHANGED
|
@@ -389,11 +389,11 @@ export class IOWriteable extends IOReadable {
|
|
|
389
389
|
},
|
|
390
390
|
{
|
|
391
391
|
name: 'Allow-Delegated-Staking',
|
|
392
|
-
value: allowDelegatedStaking
|
|
392
|
+
value: allowDelegatedStaking?.toString(),
|
|
393
393
|
},
|
|
394
394
|
{
|
|
395
395
|
name: 'Delegate-Reward-Share-Ratio',
|
|
396
|
-
value: delegateRewardShareRatio
|
|
396
|
+
value: delegateRewardShareRatio?.toString(),
|
|
397
397
|
},
|
|
398
398
|
{
|
|
399
399
|
name: 'FQDN',
|
|
@@ -405,7 +405,7 @@ export class IOWriteable extends IOReadable {
|
|
|
405
405
|
},
|
|
406
406
|
{
|
|
407
407
|
name: 'Min-Delegated-Stake',
|
|
408
|
-
value: minDelegatedStake
|
|
408
|
+
value: minDelegatedStake?.valueOf().toString(),
|
|
409
409
|
},
|
|
410
410
|
{
|
|
411
411
|
name: 'Note',
|
|
@@ -413,7 +413,7 @@ export class IOWriteable extends IOReadable {
|
|
|
413
413
|
},
|
|
414
414
|
{
|
|
415
415
|
name: 'Port',
|
|
416
|
-
value: port
|
|
416
|
+
value: port?.toString(),
|
|
417
417
|
},
|
|
418
418
|
{
|
|
419
419
|
name: 'Properties',
|
|
@@ -425,7 +425,7 @@ export class IOWriteable extends IOReadable {
|
|
|
425
425
|
},
|
|
426
426
|
{
|
|
427
427
|
name: 'Auto-Stake',
|
|
428
|
-
value: autoStake
|
|
428
|
+
value: autoStake?.toString(),
|
|
429
429
|
},
|
|
430
430
|
{
|
|
431
431
|
name: 'Observer-Address',
|
package/lib/esm/io.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { validateArweaveId } from './utils/arweave.js';
|
|
2
|
+
// Typeguard functions
|
|
2
3
|
export function isProcessConfiguration(config) {
|
|
3
4
|
return 'process' in config;
|
|
4
5
|
}
|
|
@@ -8,5 +9,5 @@ export function isProcessIdConfiguration(config) {
|
|
|
8
9
|
validateArweaveId(config.processId) === true);
|
|
9
10
|
}
|
|
10
11
|
export function isLeasedArNSRecord(record) {
|
|
11
|
-
return record.type === 'lease'
|
|
12
|
+
return record.type === 'lease';
|
|
12
13
|
}
|
package/lib/esm/types.js
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
|
-
export * from './contract-state.js';
|
|
18
17
|
export * from './common.js';
|
|
19
18
|
export * from './token.js';
|
|
20
19
|
export * from './io.js';
|
package/lib/esm/version.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { AoANTRead, AoANTRecord, AoANTState, AoANTWrite, AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner } from '../types.js';
|
|
18
18
|
import { AOProcess } from './index.js';
|
|
19
19
|
export declare class ANT {
|
|
20
20
|
static init(config: Required<ProcessConfiguration> & {
|
|
@@ -44,16 +44,16 @@ export declare class AoANTReadable implements AoANTRead {
|
|
|
44
44
|
*/
|
|
45
45
|
getRecord({ undername }: {
|
|
46
46
|
undername: string;
|
|
47
|
-
}): Promise<
|
|
47
|
+
}): Promise<AoANTRecord>;
|
|
48
48
|
/**
|
|
49
|
-
* @returns {Promise<Record<string,
|
|
49
|
+
* @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
|
|
50
50
|
* @example
|
|
51
51
|
* Get the current records
|
|
52
52
|
* ```ts
|
|
53
53
|
* ant.getRecords();
|
|
54
54
|
* ````
|
|
55
55
|
*/
|
|
56
|
-
getRecords(): Promise<Record<string,
|
|
56
|
+
getRecords(): Promise<Record<string, AoANTRecord>>;
|
|
57
57
|
/**
|
|
58
58
|
* @returns {Promise<string>} The owner of the ANT.
|
|
59
59
|
* @example
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
import Arweave from 'arweave';
|
|
18
|
-
import { ArNSReservedNameData, EpochDistributionData, EpochObservations, WeightedObserver } from '../contract-state.js';
|
|
19
18
|
import { AoArNSNameData, AoEpochData, AoEpochSettings, AoGateway, AoIORead, AoIOWrite, EpochInput } from '../io.js';
|
|
20
19
|
import { mIOToken } from '../token.js';
|
|
21
|
-
import { AoArNSNameDataWithName, AoBalanceWithAddress, AoGatewayWithAddress, AoMessageResult,
|
|
20
|
+
import { AoArNSNameDataWithName, AoArNSReservedNameData, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types.js';
|
|
22
21
|
import { AOProcess } from './contracts/ao-process.js';
|
|
23
22
|
export declare class IO {
|
|
24
23
|
static init(): AoIORead;
|
|
@@ -56,10 +55,10 @@ export declare class IOReadable implements AoIORead {
|
|
|
56
55
|
name: string;
|
|
57
56
|
}): Promise<AoArNSNameData | undefined>;
|
|
58
57
|
getArNSRecords(pageParams?: PaginationParams): Promise<PaginationResult<AoArNSNameDataWithName>>;
|
|
59
|
-
getArNSReservedNames(): Promise<Record<string,
|
|
58
|
+
getArNSReservedNames(): Promise<Record<string, AoArNSReservedNameData> | Record<string, never>>;
|
|
60
59
|
getArNSReservedName({ name, }: {
|
|
61
60
|
name: string;
|
|
62
|
-
}): Promise<
|
|
61
|
+
}): Promise<AoArNSReservedNameData | undefined>;
|
|
63
62
|
getBalance({ address }: {
|
|
64
63
|
address: WalletAddress;
|
|
65
64
|
}): Promise<number>;
|
|
@@ -69,10 +68,10 @@ export declare class IOReadable implements AoIORead {
|
|
|
69
68
|
}): Promise<AoGateway | undefined>;
|
|
70
69
|
getGateways(pageParams?: PaginationParams): Promise<PaginationResult<AoGatewayWithAddress>>;
|
|
71
70
|
getCurrentEpoch(): Promise<AoEpochData>;
|
|
72
|
-
getPrescribedObservers(epoch?: EpochInput): Promise<
|
|
71
|
+
getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
|
|
73
72
|
getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
|
|
74
|
-
getObservations(epoch?: EpochInput): Promise<
|
|
75
|
-
getDistributions(epoch?: EpochInput): Promise<
|
|
73
|
+
getObservations(epoch?: EpochInput): Promise<AoEpochObservationData>;
|
|
74
|
+
getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData>;
|
|
76
75
|
getTokenCost(params: {
|
|
77
76
|
intent: 'Buy-Record';
|
|
78
77
|
purchaseType: 'permabuy' | 'lease';
|
|
@@ -102,12 +101,9 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
|
102
101
|
target: string;
|
|
103
102
|
qty: number | mIOToken;
|
|
104
103
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
105
|
-
joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }:
|
|
106
|
-
observerAddress: string;
|
|
107
|
-
operatorStake: number | mIOToken;
|
|
108
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
104
|
+
joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoJoinNetworkParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
109
105
|
leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
|
|
110
|
-
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }:
|
|
106
|
+
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoUpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
111
107
|
delegateStake(params: {
|
|
112
108
|
target: string;
|
|
113
109
|
stakeQty: number | mIOToken;
|
package/lib/types/common.d.ts
CHANGED
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { dryrun, message, monitor, result, results, spawn, unmonitor } from '@permaweb/aoconnect';
|
|
19
19
|
import { Signer } from 'arbundles';
|
|
20
|
-
import { AllowedProtocols, GatewayConnectionSettings, GatewayMetadata, GatewayStakingSettings } from './contract-state.js';
|
|
21
|
-
import { mIOToken } from './token.js';
|
|
22
20
|
export type BlockHeight = number;
|
|
23
21
|
export type SortKey = string;
|
|
24
22
|
export type Timestamp = number;
|
|
@@ -46,29 +44,9 @@ export type WriteParameters<Input> = WithSigner<Required<ReadParameters<Input>>>
|
|
|
46
44
|
export type AoMessageResult = {
|
|
47
45
|
id: string;
|
|
48
46
|
};
|
|
49
|
-
type Overwrite<T, U> = {
|
|
50
|
-
[K in keyof T]: K extends keyof U ? U[K] : T[K];
|
|
51
|
-
};
|
|
52
|
-
export type JoinNetworkParams = Overwrite<GatewayConnectionSettings & GatewayStakingSettings & GatewayMetadata, {
|
|
53
|
-
minDelegatedStake: number | mIOToken;
|
|
54
|
-
}>;
|
|
55
|
-
export type UpdateGatewaySettingsParamsBase = {
|
|
56
|
-
allowDelegatedStaking?: boolean;
|
|
57
|
-
delegateRewardShareRatio?: number;
|
|
58
|
-
fqdn?: string;
|
|
59
|
-
label?: string;
|
|
60
|
-
minDelegatedStake?: number | mIOToken;
|
|
61
|
-
note?: string;
|
|
62
|
-
port?: number;
|
|
63
|
-
properties?: string;
|
|
64
|
-
protocol?: AllowedProtocols;
|
|
65
|
-
autoStake?: boolean;
|
|
66
|
-
observerAddress?: WalletAddress;
|
|
67
|
-
};
|
|
68
47
|
export type AtLeastOne<T, U = {
|
|
69
48
|
[K in keyof T]-?: Record<K, T[K]>;
|
|
70
49
|
}> = Partial<T> & U[keyof U];
|
|
71
|
-
export type UpdateGatewaySettingsParams = AtLeastOne<UpdateGatewaySettingsParamsBase>;
|
|
72
50
|
export interface HTTPClient {
|
|
73
51
|
get<I, K>({ endpoint, signal, headers, allowedStatuses, params, }: {
|
|
74
52
|
endpoint: string;
|
|
@@ -87,4 +65,3 @@ export interface AoClient {
|
|
|
87
65
|
unmonitor: typeof unmonitor;
|
|
88
66
|
dryrun: typeof dryrun;
|
|
89
67
|
}
|
|
90
|
-
export {};
|
package/lib/types/io.d.ts
CHANGED
|
@@ -15,16 +15,8 @@
|
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
import { AOProcess } from './common/index.js';
|
|
18
|
-
import {
|
|
19
|
-
import { AoSigner,
|
|
20
|
-
import { AoMessageResult, BlockHeight, JoinNetworkParams, ProcessId, Timestamp, TransactionId, UpdateGatewaySettingsParams, WalletAddress, WriteOptions } from './types.js';
|
|
21
|
-
export declare function isProcessConfiguration(config: object): config is {
|
|
22
|
-
process: AOProcess;
|
|
23
|
-
};
|
|
24
|
-
export declare function isProcessIdConfiguration(config: object): config is {
|
|
25
|
-
processId: string;
|
|
26
|
-
};
|
|
27
|
-
export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
|
|
18
|
+
import { mIOToken } from './token.js';
|
|
19
|
+
import { AoMessageResult, AoSigner, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './types.js';
|
|
28
20
|
export type PaginationParams = {
|
|
29
21
|
cursor?: string;
|
|
30
22
|
limit?: number;
|
|
@@ -49,6 +41,155 @@ export type EpochInput = {
|
|
|
49
41
|
} | {
|
|
50
42
|
timestamp: Timestamp;
|
|
51
43
|
} | undefined;
|
|
44
|
+
export type AoBalances = Record<WalletAddress, number>;
|
|
45
|
+
export type AoFees = Record<string, number>;
|
|
46
|
+
export type AoObservations = Record<number, AoEpochObservationData>;
|
|
47
|
+
export type AoEpochIndex = number;
|
|
48
|
+
export interface AoIOState {
|
|
49
|
+
GatewayRegistry: Record<WalletAddress, AoGateway>;
|
|
50
|
+
Epochs: Record<AoEpochIndex, AoEpochData>;
|
|
51
|
+
NameRegistry: {
|
|
52
|
+
records: Record<string, AoArNSNameData>;
|
|
53
|
+
reserved: Record<string, AoArNSReservedNameData>;
|
|
54
|
+
};
|
|
55
|
+
Balances: Record<WalletAddress, number>;
|
|
56
|
+
Vaults: Record<WalletAddress, AoVaultData>;
|
|
57
|
+
Ticker: string;
|
|
58
|
+
Name: string;
|
|
59
|
+
Logo: string;
|
|
60
|
+
}
|
|
61
|
+
export type AoEpochObservationData = {
|
|
62
|
+
failureSummaries: Record<WalletAddress, WalletAddress[]>;
|
|
63
|
+
reports: Record<WalletAddress, TransactionId>;
|
|
64
|
+
};
|
|
65
|
+
export type AoVaultData = {
|
|
66
|
+
balance: number;
|
|
67
|
+
locked: number;
|
|
68
|
+
endTimestamp: Timestamp;
|
|
69
|
+
};
|
|
70
|
+
export type AoEpochDistributionData = {
|
|
71
|
+
rewards: Record<WalletAddress, number>;
|
|
72
|
+
distributedTimestamp: Timestamp;
|
|
73
|
+
totalDistributedRewards: number;
|
|
74
|
+
totalEligibleRewards: number;
|
|
75
|
+
};
|
|
76
|
+
export type AoArNSReservedNameData = {
|
|
77
|
+
target?: string;
|
|
78
|
+
endTimestamp?: number;
|
|
79
|
+
};
|
|
80
|
+
export type AoArNSNameData = AoArNSPermabuyData | AoArNSLeaseData;
|
|
81
|
+
export type AoArNSNameDataWithName = AoArNSNameData & {
|
|
82
|
+
name: string;
|
|
83
|
+
};
|
|
84
|
+
export type AoArNSBaseNameData = {
|
|
85
|
+
processId: ProcessId;
|
|
86
|
+
startTimestamp: number;
|
|
87
|
+
type: 'lease' | 'permabuy';
|
|
88
|
+
undernameLimit: number;
|
|
89
|
+
purchasePrice: number;
|
|
90
|
+
};
|
|
91
|
+
export type AoArNSPermabuyData = AoArNSBaseNameData & {
|
|
92
|
+
type: 'permabuy';
|
|
93
|
+
};
|
|
94
|
+
export type AoArNSLeaseData = AoArNSBaseNameData & {
|
|
95
|
+
type: 'lease';
|
|
96
|
+
endTimestamp: Timestamp;
|
|
97
|
+
};
|
|
98
|
+
export type AoEpochSettings = {
|
|
99
|
+
epochZeroStartTimestamp: Timestamp;
|
|
100
|
+
durationMs: number;
|
|
101
|
+
prescribedNameCount: number;
|
|
102
|
+
rewardPercentage: number;
|
|
103
|
+
maxObservers: number;
|
|
104
|
+
distributionDelayMs: number;
|
|
105
|
+
};
|
|
106
|
+
export type AoEpochData = {
|
|
107
|
+
epochIndex: AoEpochIndex;
|
|
108
|
+
startHeight: BlockHeight;
|
|
109
|
+
observations: AoObservations;
|
|
110
|
+
prescribedObservers: AoWeightedObserver[];
|
|
111
|
+
startTimestamp: Timestamp;
|
|
112
|
+
endTimestamp: Timestamp;
|
|
113
|
+
distributionTimestamp: Timestamp;
|
|
114
|
+
distributions: AoEpochDistributionData;
|
|
115
|
+
};
|
|
116
|
+
export type AoGateway = {
|
|
117
|
+
settings: AoGatewaySettings;
|
|
118
|
+
stats: AoGatewayStats;
|
|
119
|
+
delegates: Record<WalletAddress, AoGatewayDelegate>;
|
|
120
|
+
totalDelegatedStake: number;
|
|
121
|
+
vaults: Record<WalletAddress, AoVaultData>;
|
|
122
|
+
startTimestamp: Timestamp;
|
|
123
|
+
endTimestamp: Timestamp;
|
|
124
|
+
observerAddress: WalletAddress;
|
|
125
|
+
operatorStake: number;
|
|
126
|
+
status: 'joined' | 'leaving';
|
|
127
|
+
};
|
|
128
|
+
export type AoGatewayStats = {
|
|
129
|
+
passedConsecutiveEpochs: number;
|
|
130
|
+
failedConsecutiveEpochs: number;
|
|
131
|
+
totalEpochParticipationCount: number;
|
|
132
|
+
passedEpochCount: number;
|
|
133
|
+
failedEpochCount: number;
|
|
134
|
+
observedEpochCount: number;
|
|
135
|
+
prescribedEpochCount: number;
|
|
136
|
+
};
|
|
137
|
+
export type AoWeightedObserver = {
|
|
138
|
+
gatewayAddress: WalletAddress;
|
|
139
|
+
observerAddress: WalletAddress;
|
|
140
|
+
stake: number;
|
|
141
|
+
startTimestamp: number;
|
|
142
|
+
} & AoGatewayWeights;
|
|
143
|
+
export type AoGatewayWeights = {
|
|
144
|
+
stakeWeight: number;
|
|
145
|
+
tenureWeight: number;
|
|
146
|
+
gatewayRewardRatioWeight: number;
|
|
147
|
+
observerRewardRatioWeight: number;
|
|
148
|
+
compositeWeight: number;
|
|
149
|
+
normalizedCompositeWeight: number;
|
|
150
|
+
};
|
|
151
|
+
export type AoGatewayWithAddress = AoGateway & {
|
|
152
|
+
gatewayAddress: WalletAddress;
|
|
153
|
+
};
|
|
154
|
+
export type AoGatewayDelegate = {
|
|
155
|
+
delegatedStake: number;
|
|
156
|
+
startTimestamp: Timestamp;
|
|
157
|
+
vaults: Record<WalletAddress, AoVaultData>;
|
|
158
|
+
};
|
|
159
|
+
export type AoGatewaySettings = {
|
|
160
|
+
allowDelegatedStaking: boolean;
|
|
161
|
+
delegateRewardShareRatio: number;
|
|
162
|
+
minDelegatedStake: number;
|
|
163
|
+
autoStake: boolean;
|
|
164
|
+
label: string;
|
|
165
|
+
note: string;
|
|
166
|
+
properties: string;
|
|
167
|
+
fqdn: string;
|
|
168
|
+
port: number;
|
|
169
|
+
protocol: 'https';
|
|
170
|
+
};
|
|
171
|
+
export type AoBalanceWithAddress = {
|
|
172
|
+
address: WalletAddress;
|
|
173
|
+
balance: number;
|
|
174
|
+
};
|
|
175
|
+
export type AoANTState = {
|
|
176
|
+
Name: string;
|
|
177
|
+
Ticker: string;
|
|
178
|
+
Denomination: number;
|
|
179
|
+
Owner: WalletAddress;
|
|
180
|
+
Controllers: WalletAddress[];
|
|
181
|
+
Records: Record<string, AoANTRecord>;
|
|
182
|
+
Balances: Record<WalletAddress, number>;
|
|
183
|
+
Logo: string;
|
|
184
|
+
TotalSupply: number;
|
|
185
|
+
Initialized: boolean;
|
|
186
|
+
};
|
|
187
|
+
export type AoANTRecord = {
|
|
188
|
+
transactionId: string;
|
|
189
|
+
ttlSeconds: number;
|
|
190
|
+
};
|
|
191
|
+
export type AoJoinNetworkParams = Pick<AoGateway, 'operatorStake' | 'observerAddress'> & Partial<AoGatewaySettings>;
|
|
192
|
+
export type AoUpdateGatewaySettingsParams = AtLeastOne<AoJoinNetworkParams>;
|
|
52
193
|
export interface AOContract {
|
|
53
194
|
read<K>({ tags, retries, }: {
|
|
54
195
|
tags?: {
|
|
@@ -93,13 +234,13 @@ export interface AoIORead {
|
|
|
93
234
|
getArNSReservedNames(): Promise<Record<string, AoArNSReservedNameData> | Record<string, never>>;
|
|
94
235
|
getArNSReservedName({ name, }: {
|
|
95
236
|
name: string;
|
|
96
|
-
}): Promise<
|
|
237
|
+
}): Promise<AoArNSReservedNameData | undefined>;
|
|
97
238
|
getEpoch(epoch?: EpochInput): Promise<AoEpochData>;
|
|
98
239
|
getCurrentEpoch(): Promise<AoEpochData>;
|
|
99
|
-
getPrescribedObservers(epoch?: EpochInput): Promise<
|
|
240
|
+
getPrescribedObservers(epoch?: EpochInput): Promise<AoWeightedObserver[]>;
|
|
100
241
|
getPrescribedNames(epoch?: EpochInput): Promise<string[]>;
|
|
101
|
-
getObservations(epoch?: EpochInput): Promise<
|
|
102
|
-
getDistributions(epoch?: EpochInput): Promise<
|
|
242
|
+
getObservations(epoch?: EpochInput): Promise<AoEpochObservationData>;
|
|
243
|
+
getDistributions(epoch?: EpochInput): Promise<AoEpochDistributionData>;
|
|
103
244
|
getTokenCost({ intent, purchaseType, years, name, quantity, }: {
|
|
104
245
|
intent: 'Buy-Record' | 'Extend-Lease' | 'Increase-Undername-Limit';
|
|
105
246
|
purchaseType?: 'permabuy' | 'lease';
|
|
@@ -113,12 +254,9 @@ export interface AoIOWrite extends AoIORead {
|
|
|
113
254
|
target: WalletAddress;
|
|
114
255
|
qty: number;
|
|
115
256
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
116
|
-
joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }:
|
|
117
|
-
observerAddress: string;
|
|
118
|
-
operatorStake: number | mIOToken;
|
|
119
|
-
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
257
|
+
joinNetwork({ operatorStake, allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoJoinNetworkParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
120
258
|
leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
|
|
121
|
-
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }:
|
|
259
|
+
updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: AoUpdateGatewaySettingsParams, options?: WriteOptions): Promise<AoMessageResult>;
|
|
122
260
|
increaseOperatorStake(params: {
|
|
123
261
|
increaseQty: number | mIOToken;
|
|
124
262
|
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
@@ -163,8 +301,8 @@ export interface AoANTRead {
|
|
|
163
301
|
}>;
|
|
164
302
|
getRecord({ undername }: {
|
|
165
303
|
undername: any;
|
|
166
|
-
}): Promise<
|
|
167
|
-
getRecords(): Promise<Record<string,
|
|
304
|
+
}): Promise<AoANTRecord | undefined>;
|
|
305
|
+
getRecords(): Promise<Record<string, AoANTRecord>>;
|
|
168
306
|
getOwner(): Promise<WalletAddress>;
|
|
169
307
|
getControllers(): Promise<WalletAddress[]>;
|
|
170
308
|
getTicker(): Promise<string>;
|
|
@@ -212,108 +350,10 @@ export interface AoANTRegistryWrite extends AoANTRegistryRead {
|
|
|
212
350
|
processId: string;
|
|
213
351
|
}): Promise<AoMessageResult>;
|
|
214
352
|
}
|
|
215
|
-
export
|
|
216
|
-
|
|
217
|
-
Epochs: Record<AoEpochIndex, AoEpochData>;
|
|
218
|
-
NameRegistry: {
|
|
219
|
-
records: Record<string, AoArNSNameData>;
|
|
220
|
-
reserved: Record<string, AoArNSReservedNameData>;
|
|
221
|
-
};
|
|
222
|
-
Balances: Record<WalletAddress, number>;
|
|
223
|
-
Vaults: Record<WalletAddress, VaultData>;
|
|
224
|
-
Ticker: string;
|
|
225
|
-
Name: string;
|
|
226
|
-
Logo: string;
|
|
227
|
-
}
|
|
228
|
-
export type AoEpochIndex = number;
|
|
229
|
-
export type AoArNSReservedNameData = ArNSReservedNameData;
|
|
230
|
-
export type AoArNSNameData = AoArNSPermabuyData | AoArNSLeaseData;
|
|
231
|
-
export type AoArNSNameDataWithName = AoArNSNameData & {
|
|
232
|
-
name: string;
|
|
233
|
-
};
|
|
234
|
-
export type AoArNSBaseNameData = {
|
|
235
|
-
processId: ProcessId;
|
|
236
|
-
startTimestamp: number;
|
|
237
|
-
type: RegistrationType;
|
|
238
|
-
undernameLimit: number;
|
|
239
|
-
purchasePrice: number;
|
|
240
|
-
};
|
|
241
|
-
export type AoArNSPermabuyData = AoArNSBaseNameData & {
|
|
242
|
-
type: 'permabuy';
|
|
243
|
-
};
|
|
244
|
-
export type AoArNSLeaseData = AoArNSBaseNameData & {
|
|
245
|
-
type: 'lease';
|
|
246
|
-
endTimestamp: number;
|
|
247
|
-
};
|
|
248
|
-
export type AoEpochSettings = {
|
|
249
|
-
epochZeroStartTimestamp: Timestamp;
|
|
250
|
-
durationMs: number;
|
|
251
|
-
prescribedNameCount: number;
|
|
252
|
-
rewardPercentage: number;
|
|
253
|
-
maxObservers: number;
|
|
254
|
-
distributionDelayMs: number;
|
|
255
|
-
};
|
|
256
|
-
export type AoEpochData = {
|
|
257
|
-
epochIndex: AoEpochIndex;
|
|
258
|
-
startHeight: BlockHeight;
|
|
259
|
-
observations: EpochObservations;
|
|
260
|
-
prescribedObservers: WeightedObserver[];
|
|
261
|
-
startTimestamp: Timestamp;
|
|
262
|
-
endTimestamp: Timestamp;
|
|
263
|
-
distributionTimestamp: Timestamp;
|
|
264
|
-
distributions: {
|
|
265
|
-
rewards: Record<WalletAddress, number>;
|
|
266
|
-
distributedTimestamp: Timestamp;
|
|
267
|
-
totalDistributedRewards: number;
|
|
268
|
-
totalEligibleRewards: number;
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
export type AoGatewayStats = {
|
|
272
|
-
passedConsecutiveEpochs: number;
|
|
273
|
-
failedConsecutiveEpochs: number;
|
|
274
|
-
totalEpochCount: number;
|
|
275
|
-
passedEpochCount: number;
|
|
276
|
-
failedEpochCount: number;
|
|
277
|
-
observedEpochCount: number;
|
|
278
|
-
prescribedEpochCount: number;
|
|
279
|
-
};
|
|
280
|
-
export type AoGatewayWeights = {
|
|
281
|
-
compositeWeight: number;
|
|
282
|
-
gatewayRewardRatioWeight: number;
|
|
283
|
-
tenureWeight: number;
|
|
284
|
-
observerRewardRatioWeight: number;
|
|
285
|
-
normalizedCompositeWeight: number;
|
|
286
|
-
stakeWeight: number;
|
|
287
|
-
};
|
|
288
|
-
export type AoGateway = {
|
|
289
|
-
settings: GatewaySettings;
|
|
290
|
-
stats: AoGatewayStats;
|
|
291
|
-
delegates: Record<WalletAddress, GatewayDelegate>;
|
|
292
|
-
totalDelegatedStake: number;
|
|
293
|
-
vaults: Record<WalletAddress, VaultData>;
|
|
294
|
-
startTimestamp: Timestamp;
|
|
295
|
-
endTimestamp: Timestamp;
|
|
296
|
-
observerAddress: WalletAddress;
|
|
297
|
-
operatorStake: number;
|
|
298
|
-
status: 'joined' | 'leaving';
|
|
299
|
-
weights: AoGatewayWeights;
|
|
300
|
-
};
|
|
301
|
-
export type AoBalanceWithAddress = {
|
|
302
|
-
address: WalletAddress;
|
|
303
|
-
balance: number;
|
|
304
|
-
};
|
|
305
|
-
export type AoGatewayWithAddress = AoGateway & {
|
|
306
|
-
gatewayAddress: WalletAddress;
|
|
353
|
+
export declare function isProcessConfiguration(config: object): config is {
|
|
354
|
+
process: AOProcess;
|
|
307
355
|
};
|
|
308
|
-
export
|
|
309
|
-
|
|
310
|
-
Ticker: string;
|
|
311
|
-
Denomination: number;
|
|
312
|
-
Owner: WalletAddress;
|
|
313
|
-
Controllers: WalletAddress[];
|
|
314
|
-
Records: Record<string, ANTRecord>;
|
|
315
|
-
Balances: Record<WalletAddress, number>;
|
|
316
|
-
Logo: string;
|
|
317
|
-
TotalSupply: number;
|
|
318
|
-
Initialized: boolean;
|
|
356
|
+
export declare function isProcessIdConfiguration(config: object): config is {
|
|
357
|
+
processId: string;
|
|
319
358
|
};
|
|
359
|
+
export declare function isLeasedArNSRecord(record: AoArNSNameData): record is AoArNSLeaseData;
|
package/lib/types/types.d.ts
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* You should have received a copy of the GNU Affero General Public License
|
|
15
15
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
|
-
export * from './contract-state.js';
|
|
18
17
|
export * from './common.js';
|
|
19
18
|
export * from './token.js';
|
|
20
19
|
export * from './io.js';
|
package/lib/types/utils/ao.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AoClient, AoSigner, ContractSigner } from '../types.js';
|
|
1
|
+
import { AoANTRecord, AoClient, AoSigner, ContractSigner, WalletAddress } from '../types.js';
|
|
3
2
|
export declare function spawnANT({ signer, module, luaCodeTxId, ao, scheduler, state, stateContractTxId, antRegistryId, }: {
|
|
4
3
|
signer: AoSigner;
|
|
5
4
|
module?: string;
|
|
6
5
|
luaCodeTxId?: string;
|
|
7
6
|
ao?: AoClient;
|
|
8
7
|
scheduler?: string;
|
|
9
|
-
state?:
|
|
8
|
+
state?: {
|
|
9
|
+
owner: WalletAddress;
|
|
10
|
+
controllers: WalletAddress[];
|
|
11
|
+
name: string;
|
|
12
|
+
ticker: string;
|
|
13
|
+
records: Record<string, AoANTRecord>;
|
|
14
|
+
balances: Record<WalletAddress, number>;
|
|
15
|
+
};
|
|
10
16
|
stateContractTxId?: string;
|
|
11
17
|
antRegistryId?: string;
|
|
12
18
|
}): Promise<string>;
|
package/lib/types/version.d.ts
CHANGED