@ar.io/sdk 2.5.0-alpha.12 → 2.5.0-alpha.14
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 +54 -33
- package/bundles/web.bundle.min.js +51 -51
- package/lib/cjs/common/ant.js +3 -4
- package/lib/cjs/common/io.js +41 -0
- package/lib/cjs/types/ant.js +1 -3
- package/lib/cjs/utils/ao.js +1 -27
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/ant.js +5 -6
- package/lib/esm/common/io.js +41 -0
- package/lib/esm/types/ant.js +0 -2
- package/lib/esm/utils/ao.js +0 -25
- package/lib/esm/version.js +1 -1
- package/lib/types/common/ant.d.ts +3 -3
- package/lib/types/common/io.d.ts +28 -1
- package/lib/types/types/ant.d.ts +1 -34
- package/lib/types/types/common.d.ts +10 -0
- package/lib/types/types/io.d.ts +10 -1
- package/lib/types/utils/ao.d.ts +1 -6
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/common/ant.js
CHANGED
|
@@ -96,7 +96,7 @@ class AoANTReadable {
|
|
|
96
96
|
return record;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* @returns {Promise<
|
|
99
|
+
* @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
|
|
100
100
|
* @example
|
|
101
101
|
* Get the current records
|
|
102
102
|
* ```ts
|
|
@@ -108,10 +108,9 @@ class AoANTReadable {
|
|
|
108
108
|
const records = await this.process.read({
|
|
109
109
|
tags,
|
|
110
110
|
});
|
|
111
|
-
const result = (0, ao_js_1.parseAntRecords)(records);
|
|
112
111
|
if (strict)
|
|
113
|
-
(0, schema_js_1.parseSchemaResult)(ant_js_1.
|
|
114
|
-
return
|
|
112
|
+
(0, schema_js_1.parseSchemaResult)(ant_js_1.AntRecordsSchema, records);
|
|
113
|
+
return records;
|
|
115
114
|
}
|
|
116
115
|
/**
|
|
117
116
|
* @returns {Promise<string>} The owner of the ANT.
|
package/lib/cjs/common/io.js
CHANGED
|
@@ -438,6 +438,21 @@ class IOReadable {
|
|
|
438
438
|
],
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
|
+
/**
|
|
442
|
+
* Get current redelegation fee percentage for address
|
|
443
|
+
*
|
|
444
|
+
* @param {Object} params - The parameters for fetching redelegation fee
|
|
445
|
+
* @param {string} params.address - The address to fetch the fee for
|
|
446
|
+
* @returns {Promise<AoMessageResult>} The redelegation fee result
|
|
447
|
+
*/
|
|
448
|
+
async getRedelegationFee(params) {
|
|
449
|
+
return this.process.read({
|
|
450
|
+
tags: [
|
|
451
|
+
{ name: 'Action', value: 'Redelegation-Fee' },
|
|
452
|
+
{ name: 'Address', value: params.address },
|
|
453
|
+
],
|
|
454
|
+
});
|
|
455
|
+
}
|
|
441
456
|
}
|
|
442
457
|
exports.IOReadable = IOReadable;
|
|
443
458
|
class IOWriteable extends IOReadable {
|
|
@@ -790,5 +805,31 @@ class IOWriteable extends IOReadable {
|
|
|
790
805
|
],
|
|
791
806
|
});
|
|
792
807
|
}
|
|
808
|
+
/**
|
|
809
|
+
* Redelegate stake from one gateway to another gateway.
|
|
810
|
+
*
|
|
811
|
+
* @param {Object} params - The parameters for redelegating stake
|
|
812
|
+
* @param {string} params.target - The target gateway address
|
|
813
|
+
* @param {string} params.source - The source gateway address
|
|
814
|
+
* @param {number} params.stakeQty - The quantity of stake to redelegate
|
|
815
|
+
* @param {string} params.vaultId - An optional vault ID to redelegate from
|
|
816
|
+
* @param {Object} [options] - The options for the redelegation
|
|
817
|
+
* @returns {Promise<AoMessageResult>} The result of the redelegation
|
|
818
|
+
*/
|
|
819
|
+
async redelegateStake(params, options) {
|
|
820
|
+
const { tags = [] } = options || {};
|
|
821
|
+
const allTags = [
|
|
822
|
+
...tags,
|
|
823
|
+
{ name: 'Action', value: 'Redelegate-Stake' },
|
|
824
|
+
{ name: 'Target', value: params.target },
|
|
825
|
+
{ name: 'Source', value: params.source },
|
|
826
|
+
{ name: 'Quantity', value: params.stakeQty.valueOf().toString() },
|
|
827
|
+
{ name: 'Vault-Id', value: params.vaultId },
|
|
828
|
+
];
|
|
829
|
+
return this.process.send({
|
|
830
|
+
signer: this.signer,
|
|
831
|
+
tags: (0, arweave_js_1.pruneTags)(allTags),
|
|
832
|
+
});
|
|
833
|
+
}
|
|
793
834
|
}
|
|
794
835
|
exports.IOWriteable = IOWriteable;
|
package/lib/cjs/types/ant.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAoANTState = exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntWriteHandlers = exports.AntReadHandlers = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.
|
|
3
|
+
exports.isAoANTState = exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntWriteHandlers = exports.AntReadHandlers = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.AntRecordsSchema = exports.AntRecordSchema = exports.AntKeywordsSchema = exports.AntDescriptionSchema = exports.IntegerStringSchema = exports.ArweaveTxIdSchema = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
6
6
|
*
|
|
@@ -51,9 +51,7 @@ exports.AntRecordSchema = zod_1.z.object({
|
|
|
51
51
|
transactionId: exports.ArweaveTxIdSchema.describe('The Target ID of the undername'),
|
|
52
52
|
ttlSeconds: zod_1.z.number(),
|
|
53
53
|
});
|
|
54
|
-
exports.AntEntrySchema = zod_1.z.intersection(exports.AntRecordSchema, zod_1.z.object({ name: zod_1.z.string() }));
|
|
55
54
|
exports.AntRecordsSchema = zod_1.z.record(zod_1.z.string(), exports.AntRecordSchema);
|
|
56
|
-
exports.AntEntriesSchema = zod_1.z.array(exports.AntEntrySchema);
|
|
57
55
|
exports.AntControllersSchema = zod_1.z.array(exports.ArweaveTxIdSchema.describe('Controller address'));
|
|
58
56
|
exports.AntBalancesSchema = zod_1.z.record(exports.ArweaveTxIdSchema.describe('Holder address'), zod_1.z.number());
|
|
59
57
|
exports.AntStateSchema = zod_1.z.object({
|
package/lib/cjs/utils/ao.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createAoSigner = exports.isAoSigner = exports.evolveANT = exports.spawnANT = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
|
|
6
6
|
*
|
|
@@ -181,29 +181,3 @@ function createAoSigner(signer) {
|
|
|
181
181
|
return aoSigner;
|
|
182
182
|
}
|
|
183
183
|
exports.createAoSigner = createAoSigner;
|
|
184
|
-
/**
|
|
185
|
-
* @param records @type {AoANTRecordEntry[] | Record<string, AoANTRecord>} - the records returned by an ANT
|
|
186
|
-
* @returns @type {AoANTRecordEntry[]} - the alphabetically sorted records
|
|
187
|
-
*/
|
|
188
|
-
function parseAntRecords(records) {
|
|
189
|
-
const result = Array.isArray(records)
|
|
190
|
-
? records // assumes if records is an array that its AoANTRecordEntry[]
|
|
191
|
-
: // backwards compatibility for when ANTs returned as Record<string, AoANTRecord>
|
|
192
|
-
Object.keys(records) // sort the keys since string indexed maps in lua do not retain order
|
|
193
|
-
.sort((a, b) => {
|
|
194
|
-
if (a == '@')
|
|
195
|
-
return -1;
|
|
196
|
-
if (b == '@')
|
|
197
|
-
return 1;
|
|
198
|
-
return a.localeCompare(b);
|
|
199
|
-
})
|
|
200
|
-
.reduce((acc, undername) => {
|
|
201
|
-
acc.push({
|
|
202
|
-
...records[undername],
|
|
203
|
-
name: undername,
|
|
204
|
-
});
|
|
205
|
-
return acc;
|
|
206
|
-
}, []);
|
|
207
|
-
return result;
|
|
208
|
-
}
|
|
209
|
-
exports.parseAntRecords = parseAntRecords;
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/common/ant.js
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { z } from 'zod';
|
|
17
|
-
import { AntBalancesSchema, AntControllersSchema,
|
|
17
|
+
import { AntBalancesSchema, AntControllersSchema, AntInfoSchema, AntRecordSchema, AntRecordsSchema, AntStateSchema, } from '../types/ant.js';
|
|
18
18
|
import { isProcessConfiguration, isProcessIdConfiguration, } from '../types/index.js';
|
|
19
|
-
import { createAoSigner
|
|
19
|
+
import { createAoSigner } from '../utils/ao.js';
|
|
20
20
|
import { parseSchemaResult } from '../utils/schema.js';
|
|
21
21
|
import { AOProcess, InvalidContractConfigurationError } from './index.js';
|
|
22
22
|
export class ANT {
|
|
@@ -92,7 +92,7 @@ export class AoANTReadable {
|
|
|
92
92
|
return record;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* @returns {Promise<
|
|
95
|
+
* @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
|
|
96
96
|
* @example
|
|
97
97
|
* Get the current records
|
|
98
98
|
* ```ts
|
|
@@ -104,10 +104,9 @@ export class AoANTReadable {
|
|
|
104
104
|
const records = await this.process.read({
|
|
105
105
|
tags,
|
|
106
106
|
});
|
|
107
|
-
const result = parseAntRecords(records);
|
|
108
107
|
if (strict)
|
|
109
|
-
parseSchemaResult(
|
|
110
|
-
return
|
|
108
|
+
parseSchemaResult(AntRecordsSchema, records);
|
|
109
|
+
return records;
|
|
111
110
|
}
|
|
112
111
|
/**
|
|
113
112
|
* @returns {Promise<string>} The owner of the ANT.
|
package/lib/esm/common/io.js
CHANGED
|
@@ -434,6 +434,21 @@ export class IOReadable {
|
|
|
434
434
|
],
|
|
435
435
|
});
|
|
436
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* Get current redelegation fee percentage for address
|
|
439
|
+
*
|
|
440
|
+
* @param {Object} params - The parameters for fetching redelegation fee
|
|
441
|
+
* @param {string} params.address - The address to fetch the fee for
|
|
442
|
+
* @returns {Promise<AoMessageResult>} The redelegation fee result
|
|
443
|
+
*/
|
|
444
|
+
async getRedelegationFee(params) {
|
|
445
|
+
return this.process.read({
|
|
446
|
+
tags: [
|
|
447
|
+
{ name: 'Action', value: 'Redelegation-Fee' },
|
|
448
|
+
{ name: 'Address', value: params.address },
|
|
449
|
+
],
|
|
450
|
+
});
|
|
451
|
+
}
|
|
437
452
|
}
|
|
438
453
|
export class IOWriteable extends IOReadable {
|
|
439
454
|
signer;
|
|
@@ -785,4 +800,30 @@ export class IOWriteable extends IOReadable {
|
|
|
785
800
|
],
|
|
786
801
|
});
|
|
787
802
|
}
|
|
803
|
+
/**
|
|
804
|
+
* Redelegate stake from one gateway to another gateway.
|
|
805
|
+
*
|
|
806
|
+
* @param {Object} params - The parameters for redelegating stake
|
|
807
|
+
* @param {string} params.target - The target gateway address
|
|
808
|
+
* @param {string} params.source - The source gateway address
|
|
809
|
+
* @param {number} params.stakeQty - The quantity of stake to redelegate
|
|
810
|
+
* @param {string} params.vaultId - An optional vault ID to redelegate from
|
|
811
|
+
* @param {Object} [options] - The options for the redelegation
|
|
812
|
+
* @returns {Promise<AoMessageResult>} The result of the redelegation
|
|
813
|
+
*/
|
|
814
|
+
async redelegateStake(params, options) {
|
|
815
|
+
const { tags = [] } = options || {};
|
|
816
|
+
const allTags = [
|
|
817
|
+
...tags,
|
|
818
|
+
{ name: 'Action', value: 'Redelegate-Stake' },
|
|
819
|
+
{ name: 'Target', value: params.target },
|
|
820
|
+
{ name: 'Source', value: params.source },
|
|
821
|
+
{ name: 'Quantity', value: params.stakeQty.valueOf().toString() },
|
|
822
|
+
{ name: 'Vault-Id', value: params.vaultId },
|
|
823
|
+
];
|
|
824
|
+
return this.process.send({
|
|
825
|
+
signer: this.signer,
|
|
826
|
+
tags: pruneTags(allTags),
|
|
827
|
+
});
|
|
828
|
+
}
|
|
788
829
|
}
|
package/lib/esm/types/ant.js
CHANGED
|
@@ -48,9 +48,7 @@ export const AntRecordSchema = z.object({
|
|
|
48
48
|
transactionId: ArweaveTxIdSchema.describe('The Target ID of the undername'),
|
|
49
49
|
ttlSeconds: z.number(),
|
|
50
50
|
});
|
|
51
|
-
export const AntEntrySchema = z.intersection(AntRecordSchema, z.object({ name: z.string() }));
|
|
52
51
|
export const AntRecordsSchema = z.record(z.string(), AntRecordSchema);
|
|
53
|
-
export const AntEntriesSchema = z.array(AntEntrySchema);
|
|
54
52
|
export const AntControllersSchema = z.array(ArweaveTxIdSchema.describe('Controller address'));
|
|
55
53
|
export const AntBalancesSchema = z.record(ArweaveTxIdSchema.describe('Holder address'), z.number());
|
|
56
54
|
export const AntStateSchema = z.object({
|
package/lib/esm/utils/ao.js
CHANGED
|
@@ -174,28 +174,3 @@ export function createAoSigner(signer) {
|
|
|
174
174
|
};
|
|
175
175
|
return aoSigner;
|
|
176
176
|
}
|
|
177
|
-
/**
|
|
178
|
-
* @param records @type {AoANTRecordEntry[] | Record<string, AoANTRecord>} - the records returned by an ANT
|
|
179
|
-
* @returns @type {AoANTRecordEntry[]} - the alphabetically sorted records
|
|
180
|
-
*/
|
|
181
|
-
export function parseAntRecords(records) {
|
|
182
|
-
const result = Array.isArray(records)
|
|
183
|
-
? records // assumes if records is an array that its AoANTRecordEntry[]
|
|
184
|
-
: // backwards compatibility for when ANTs returned as Record<string, AoANTRecord>
|
|
185
|
-
Object.keys(records) // sort the keys since string indexed maps in lua do not retain order
|
|
186
|
-
.sort((a, b) => {
|
|
187
|
-
if (a == '@')
|
|
188
|
-
return -1;
|
|
189
|
-
if (b == '@')
|
|
190
|
-
return 1;
|
|
191
|
-
return a.localeCompare(b);
|
|
192
|
-
})
|
|
193
|
-
.reduce((acc, undername) => {
|
|
194
|
-
acc.push({
|
|
195
|
-
...records[undername],
|
|
196
|
-
name: undername,
|
|
197
|
-
});
|
|
198
|
-
return acc;
|
|
199
|
-
}, []);
|
|
200
|
-
return result;
|
|
201
|
-
}
|
package/lib/esm/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord,
|
|
1
|
+
import { AntReadOptions, AoANTHandler, AoANTInfo, AoANTRead, AoANTRecord, AoANTState, AoANTWrite } from '../types/ant.js';
|
|
2
2
|
import { AoMessageResult, ProcessConfiguration, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
|
|
3
3
|
import { AOProcess } from './index.js';
|
|
4
4
|
export declare class ANT {
|
|
@@ -31,14 +31,14 @@ export declare class AoANTReadable implements AoANTRead {
|
|
|
31
31
|
undername: string;
|
|
32
32
|
}, { strict }?: AntReadOptions): Promise<AoANTRecord>;
|
|
33
33
|
/**
|
|
34
|
-
* @returns {Promise<
|
|
34
|
+
* @returns {Promise<Record<string, AoANTRecord>>} All the undernames managed by the ANT.
|
|
35
35
|
* @example
|
|
36
36
|
* Get the current records
|
|
37
37
|
* ```ts
|
|
38
38
|
* ant.getRecords();
|
|
39
39
|
* ````
|
|
40
40
|
*/
|
|
41
|
-
getRecords({ strict }?: AntReadOptions): Promise<
|
|
41
|
+
getRecords({ strict }?: AntReadOptions): Promise<Record<string, AoANTRecord>>;
|
|
42
42
|
/**
|
|
43
43
|
* @returns {Promise<string>} The owner of the ANT.
|
|
44
44
|
* @example
|
package/lib/types/common/io.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import Arweave from 'arweave';
|
|
17
|
-
import { AoArNSNameDataWithName, AoArNSReservedNameData, AoAuction, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
|
|
17
|
+
import { AoArNSNameDataWithName, AoArNSReservedNameData, AoAuction, AoBalanceWithAddress, AoEpochDistributionData, AoEpochObservationData, AoGatewayWithAddress, AoJoinNetworkParams, AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AoTokenSupplyData, AoUpdateGatewaySettingsParams, AoWeightedObserver, ContractSigner, PaginationParams, PaginationResult, ProcessConfiguration, TransactionId, WalletAddress, WithSigner, WriteOptions } from '../types/index.js';
|
|
18
18
|
import { AoArNSNameData, AoArNSReservedNameDataWithName, AoAuctionPriceData, AoDelegation, AoEpochData, AoEpochSettings, AoGateway, AoGatewayDelegateWithAddress, AoGatewayVault, AoIORead, AoIOWrite, AoRegistrationFees, AoVaultData, AoWalletVault, EpochInput } from '../types/io.js';
|
|
19
19
|
import { mIOToken } from '../types/token.js';
|
|
20
20
|
import { AOProcess } from './contracts/ao-process.js';
|
|
@@ -146,6 +146,16 @@ export declare class IOReadable implements AoIORead {
|
|
|
146
146
|
name: string;
|
|
147
147
|
}): Promise<AoPrimaryName>;
|
|
148
148
|
getPrimaryNames(params: PaginationParams<AoPrimaryName>): Promise<PaginationResult<AoPrimaryName>>;
|
|
149
|
+
/**
|
|
150
|
+
* Get current redelegation fee percentage for address
|
|
151
|
+
*
|
|
152
|
+
* @param {Object} params - The parameters for fetching redelegation fee
|
|
153
|
+
* @param {string} params.address - The address to fetch the fee for
|
|
154
|
+
* @returns {Promise<AoMessageResult>} The redelegation fee result
|
|
155
|
+
*/
|
|
156
|
+
getRedelegationFee(params: {
|
|
157
|
+
address: WalletAddress;
|
|
158
|
+
}): Promise<AoRedelegationFeeInfo>;
|
|
149
159
|
}
|
|
150
160
|
export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
151
161
|
protected process: AOProcess;
|
|
@@ -250,4 +260,21 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
|
|
|
250
260
|
requestPrimaryName(params: {
|
|
251
261
|
name: string;
|
|
252
262
|
}): Promise<AoMessageResult>;
|
|
263
|
+
/**
|
|
264
|
+
* Redelegate stake from one gateway to another gateway.
|
|
265
|
+
*
|
|
266
|
+
* @param {Object} params - The parameters for redelegating stake
|
|
267
|
+
* @param {string} params.target - The target gateway address
|
|
268
|
+
* @param {string} params.source - The source gateway address
|
|
269
|
+
* @param {number} params.stakeQty - The quantity of stake to redelegate
|
|
270
|
+
* @param {string} params.vaultId - An optional vault ID to redelegate from
|
|
271
|
+
* @param {Object} [options] - The options for the redelegation
|
|
272
|
+
* @returns {Promise<AoMessageResult>} The result of the redelegation
|
|
273
|
+
*/
|
|
274
|
+
redelegateStake(params: {
|
|
275
|
+
target: string;
|
|
276
|
+
source: string;
|
|
277
|
+
stakeQty: number | mIOToken;
|
|
278
|
+
vaultId?: string;
|
|
279
|
+
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
253
280
|
}
|
package/lib/types/types/ant.d.ts
CHANGED
|
@@ -41,24 +41,7 @@ export declare const AntRecordSchema: z.ZodObject<{
|
|
|
41
41
|
transactionId: string;
|
|
42
42
|
ttlSeconds: number;
|
|
43
43
|
}>;
|
|
44
|
-
export declare const AntEntrySchema: z.ZodIntersection<z.ZodObject<{
|
|
45
|
-
transactionId: z.ZodEffects<z.ZodString, string, string>;
|
|
46
|
-
ttlSeconds: z.ZodNumber;
|
|
47
|
-
}, "strip", z.ZodTypeAny, {
|
|
48
|
-
transactionId: string;
|
|
49
|
-
ttlSeconds: number;
|
|
50
|
-
}, {
|
|
51
|
-
transactionId: string;
|
|
52
|
-
ttlSeconds: number;
|
|
53
|
-
}>, z.ZodObject<{
|
|
54
|
-
name: z.ZodString;
|
|
55
|
-
}, "strip", z.ZodTypeAny, {
|
|
56
|
-
name: string;
|
|
57
|
-
}, {
|
|
58
|
-
name: string;
|
|
59
|
-
}>>;
|
|
60
44
|
export type AoANTRecord = z.infer<typeof AntRecordSchema>;
|
|
61
|
-
export type AoANTRecordEntry = z.infer<typeof AntEntrySchema>;
|
|
62
45
|
export declare const AntRecordsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
63
46
|
transactionId: z.ZodEffects<z.ZodString, string, string>;
|
|
64
47
|
ttlSeconds: z.ZodNumber;
|
|
@@ -69,22 +52,6 @@ export declare const AntRecordsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
69
52
|
transactionId: string;
|
|
70
53
|
ttlSeconds: number;
|
|
71
54
|
}>>;
|
|
72
|
-
export declare const AntEntriesSchema: z.ZodArray<z.ZodIntersection<z.ZodObject<{
|
|
73
|
-
transactionId: z.ZodEffects<z.ZodString, string, string>;
|
|
74
|
-
ttlSeconds: z.ZodNumber;
|
|
75
|
-
}, "strip", z.ZodTypeAny, {
|
|
76
|
-
transactionId: string;
|
|
77
|
-
ttlSeconds: number;
|
|
78
|
-
}, {
|
|
79
|
-
transactionId: string;
|
|
80
|
-
ttlSeconds: number;
|
|
81
|
-
}>, z.ZodObject<{
|
|
82
|
-
name: z.ZodString;
|
|
83
|
-
}, "strip", z.ZodTypeAny, {
|
|
84
|
-
name: string;
|
|
85
|
-
}, {
|
|
86
|
-
name: string;
|
|
87
|
-
}>>, "many">;
|
|
88
55
|
export declare const AntControllersSchema: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
89
56
|
export declare const AntBalancesSchema: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodNumber>;
|
|
90
57
|
export declare const AntStateSchema: z.ZodObject<{
|
|
@@ -199,7 +166,7 @@ export interface AoANTRead {
|
|
|
199
166
|
getRecord({ undername }: {
|
|
200
167
|
undername: string;
|
|
201
168
|
}, opts?: AntReadOptions): Promise<AoANTRecord | undefined>;
|
|
202
|
-
getRecords(opts?: AntReadOptions): Promise<
|
|
169
|
+
getRecords(opts?: AntReadOptions): Promise<Record<string, AoANTRecord>>;
|
|
203
170
|
getOwner(opts?: AntReadOptions): Promise<WalletAddress>;
|
|
204
171
|
getControllers(): Promise<WalletAddress[]>;
|
|
205
172
|
getTicker(opts?: AntReadOptions): Promise<string>;
|
|
@@ -54,6 +54,16 @@ export type AoPrimaryName = {
|
|
|
54
54
|
name: string;
|
|
55
55
|
startTimestamp: Timestamp;
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Users are allowed one free redelegation every seven epochs. Each additional
|
|
59
|
+
* redelegation increases the fee by 10%, capping at a 60% redelegation fee
|
|
60
|
+
*/
|
|
61
|
+
export type AoRedelegationFeeInfo = {
|
|
62
|
+
/** Percentage of redelegated stake that will be returned to the protocol on redelegation */
|
|
63
|
+
redelegationFeeRate: number;
|
|
64
|
+
/** Timestamp when the redelegation fee will reset to zero */
|
|
65
|
+
feeResetTimestamp: number;
|
|
66
|
+
};
|
|
57
67
|
export type AtLeastOne<T, U = {
|
|
58
68
|
[K in keyof T]-?: Record<K, T[K]>;
|
|
59
69
|
}> = Partial<T> & U[keyof U];
|
package/lib/types/types/io.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { AOProcess } from '../common/index.js';
|
|
17
|
-
import { AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './index.js';
|
|
17
|
+
import { AoMessageResult, AoPrimaryName, AoPrimaryNameRequest, AoRedelegationFeeInfo, AtLeastOne, BlockHeight, ProcessId, Timestamp, TransactionId, WalletAddress, WriteOptions } from './index.js';
|
|
18
18
|
import { mIOToken } from './token.js';
|
|
19
19
|
export type PaginationParams<T = Record<string, never>> = {
|
|
20
20
|
cursor?: string;
|
|
@@ -331,6 +331,9 @@ export interface AoIORead {
|
|
|
331
331
|
name: string;
|
|
332
332
|
}): Promise<AoPrimaryName>;
|
|
333
333
|
getPrimaryNames(params?: PaginationParams<AoPrimaryName>): Promise<PaginationResult<AoPrimaryName>>;
|
|
334
|
+
getRedelegationFee(params: {
|
|
335
|
+
address: WalletAddress;
|
|
336
|
+
}): Promise<AoRedelegationFeeInfo>;
|
|
334
337
|
}
|
|
335
338
|
export interface AoIOWrite extends AoIORead {
|
|
336
339
|
transfer({ target, qty, }: {
|
|
@@ -394,6 +397,12 @@ export interface AoIOWrite extends AoIORead {
|
|
|
394
397
|
requestPrimaryName(params: {
|
|
395
398
|
name: string;
|
|
396
399
|
}): Promise<AoMessageResult>;
|
|
400
|
+
redelegateStake(params: {
|
|
401
|
+
target: string;
|
|
402
|
+
source: string;
|
|
403
|
+
stakeQty: number | mIOToken;
|
|
404
|
+
vaultId?: string;
|
|
405
|
+
}, options?: WriteOptions): Promise<AoMessageResult>;
|
|
397
406
|
}
|
|
398
407
|
export declare function isProcessConfiguration(config: object): config is {
|
|
399
408
|
process: AOProcess;
|
package/lib/types/utils/ao.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Arweave from 'arweave';
|
|
2
2
|
import { Logger } from '../common/index.js';
|
|
3
|
-
import { AoANTRecord
|
|
3
|
+
import { AoANTRecord } from '../types/ant.js';
|
|
4
4
|
import { AoClient, AoSigner, ContractSigner, WalletAddress } from '../types/index.js';
|
|
5
5
|
export declare function spawnANT({ signer, module, luaCodeTxId, ao, scheduler, state, stateContractTxId, antRegistryId, logger, arweave, }: {
|
|
6
6
|
signer: AoSigner;
|
|
@@ -31,8 +31,3 @@ export declare function evolveANT({ signer, processId, luaCodeTxId, ao, logger,
|
|
|
31
31
|
}): Promise<string>;
|
|
32
32
|
export declare function isAoSigner(value: unknown): value is AoSigner;
|
|
33
33
|
export declare function createAoSigner(signer: ContractSigner): AoSigner;
|
|
34
|
-
/**
|
|
35
|
-
* @param records @type {AoANTRecordEntry[] | Record<string, AoANTRecord>} - the records returned by an ANT
|
|
36
|
-
* @returns @type {AoANTRecordEntry[]} - the alphabetically sorted records
|
|
37
|
-
*/
|
|
38
|
-
export declare function parseAntRecords(records: AoANTRecordEntry[] | Record<string, AoANTRecord>): AoANTRecordEntry[];
|
package/lib/types/version.d.ts
CHANGED