@substrate/api-sidecar 20.11.0 → 20.13.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/build/package.json +14 -14
- package/build/src/chains-config/assetHubKusamaControllers.js +1 -0
- package/build/src/chains-config/assetHubKusamaControllers.js.map +1 -1
- package/build/src/chains-config/assetHubNextWestendControllers.js +1 -0
- package/build/src/chains-config/assetHubNextWestendControllers.js.map +1 -1
- package/build/src/chains-config/assetHubPolkadotControllers.js +1 -0
- package/build/src/chains-config/assetHubPolkadotControllers.js.map +1 -1
- package/build/src/chains-config/assetHubWestendControllers.js +1 -0
- package/build/src/chains-config/assetHubWestendControllers.js.map +1 -1
- package/build/src/controllers/accounts/AccountsForeignAssetsController.d.ts +50 -0
- package/build/src/controllers/accounts/AccountsForeignAssetsController.js +110 -0
- package/build/src/controllers/accounts/AccountsForeignAssetsController.js.map +1 -0
- package/build/src/controllers/accounts/AccountsVestingInfoController.d.ts +18 -3
- package/build/src/controllers/accounts/AccountsVestingInfoController.js +24 -6
- package/build/src/controllers/accounts/AccountsVestingInfoController.js.map +1 -1
- package/build/src/controllers/accounts/index.d.ts +1 -0
- package/build/src/controllers/accounts/index.js +3 -1
- package/build/src/controllers/accounts/index.js.map +1 -1
- package/build/src/controllers/blocks/BlocksController.js +2 -0
- package/build/src/controllers/blocks/BlocksController.js.map +1 -1
- package/build/src/controllers/controllerInjection.spec.js +10 -10
- package/build/src/controllers/controllerInjection.spec.js.map +1 -1
- package/build/src/controllers/index.d.ts +2 -1
- package/build/src/controllers/index.js +1 -0
- package/build/src/controllers/index.js.map +1 -1
- package/build/src/controllers/rc/accounts/RcAccountsVestingInfoController.d.ts +12 -1
- package/build/src/controllers/rc/accounts/RcAccountsVestingInfoController.js +15 -3
- package/build/src/controllers/rc/accounts/RcAccountsVestingInfoController.js.map +1 -1
- package/build/src/controllers/rc/blocks/RcBlocksController.js +2 -0
- package/build/src/controllers/rc/blocks/RcBlocksController.js.map +1 -1
- package/build/src/services/accounts/AccountsForeignAssetsService.d.ts +45 -0
- package/build/src/services/accounts/AccountsForeignAssetsService.js +181 -0
- package/build/src/services/accounts/AccountsForeignAssetsService.js.map +1 -0
- package/build/src/services/accounts/AccountsVestingInfoService.d.ts +42 -1
- package/build/src/services/accounts/AccountsVestingInfoService.js +236 -5
- package/build/src/services/accounts/AccountsVestingInfoService.js.map +1 -1
- package/build/src/services/accounts/index.d.ts +1 -0
- package/build/src/services/accounts/index.js +1 -0
- package/build/src/services/accounts/index.js.map +1 -1
- package/build/src/services/consts.js +8 -0
- package/build/src/services/consts.js.map +1 -1
- package/build/src/services/paras/ParasInclusionService.d.ts +3 -11
- package/build/src/services/paras/ParasInclusionService.js +7 -60
- package/build/src/services/paras/ParasInclusionService.js.map +1 -1
- package/build/src/types/responses/AccountAssets.d.ts +33 -0
- package/build/src/types/responses/AccountVestingInfo.d.ts +56 -1
- package/build/src/util/relay/getRelayParentNumber.d.ts +80 -0
- package/build/src/util/relay/getRelayParentNumber.js +170 -0
- package/build/src/util/relay/getRelayParentNumber.js.map +1 -0
- package/build/src/util/relay/getRelayParentNumber.spec.d.ts +1 -0
- package/build/src/util/relay/getRelayParentNumber.spec.js +201 -0
- package/build/src/util/relay/getRelayParentNumber.spec.js.map +1 -0
- package/build/src/util/vesting/vestingCalculations.d.ts +87 -0
- package/build/src/util/vesting/vestingCalculations.js +141 -0
- package/build/src/util/vesting/vestingCalculations.js.map +1 -0
- package/build/src/util/vesting/vestingCalculations.spec.d.ts +1 -0
- package/build/src/util/vesting/vestingCalculations.spec.js +335 -0
- package/build/src/util/vesting/vestingCalculations.spec.js.map +1 -0
- package/package.json +14 -14
|
@@ -14,18 +14,38 @@
|
|
|
14
14
|
//
|
|
15
15
|
// You should have received a copy of the GNU General Public License
|
|
16
16
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
17
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
21
|
exports.AccountsVestingInfoService = void 0;
|
|
22
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
19
23
|
const http_errors_1 = require("http-errors");
|
|
24
|
+
const apiRegistry_1 = require("../../apiRegistry");
|
|
25
|
+
const chains_config_1 = require("../../chains-config");
|
|
26
|
+
const getRelayParentNumber_1 = require("../../util/relay/getRelayParentNumber");
|
|
27
|
+
const vestingCalculations_1 = require("../../util/vesting/vestingCalculations");
|
|
20
28
|
const AbstractService_1 = require("../AbstractService");
|
|
29
|
+
const consts_1 = require("../consts");
|
|
30
|
+
/**
|
|
31
|
+
* Asset Hub parachain ID on relay chains
|
|
32
|
+
*/
|
|
33
|
+
const ASSET_HUB_PARA_ID = 1000;
|
|
34
|
+
/**
|
|
35
|
+
* Vesting lock ID used in balances.locks
|
|
36
|
+
* This is "vesting " padded to 8 bytes (0x76657374696e6720)
|
|
37
|
+
*/
|
|
38
|
+
const VESTING_ID = '0x76657374696e6720';
|
|
21
39
|
class AccountsVestingInfoService extends AbstractService_1.AbstractService {
|
|
22
40
|
/**
|
|
23
41
|
* Fetch vesting information for an account at a given block.
|
|
24
42
|
*
|
|
25
43
|
* @param hash `BlockHash` to make call at
|
|
26
44
|
* @param address address of the account to get the vesting info of
|
|
45
|
+
* @param includeVested whether to calculate and include vested amounts (default: false)
|
|
46
|
+
* @param knownRelayBlockNumber optional relay block number to use for calculations (skips search when provided)
|
|
27
47
|
*/
|
|
28
|
-
async fetchAccountVestingInfo(hash, address) {
|
|
48
|
+
async fetchAccountVestingInfo(hash, address, includeVested = false, knownRelayBlockNumber) {
|
|
29
49
|
const { api } = this;
|
|
30
50
|
const historicApi = await api.at(hash);
|
|
31
51
|
if (!historicApi.query.vesting) {
|
|
@@ -37,9 +57,10 @@ class AccountsVestingInfoService extends AbstractService_1.AbstractService {
|
|
|
37
57
|
]).catch((err) => {
|
|
38
58
|
throw this.createHttpErrorForAddr(address, err);
|
|
39
59
|
});
|
|
60
|
+
const blockNumber = number.unwrap().toNumber();
|
|
40
61
|
const at = {
|
|
41
62
|
hash,
|
|
42
|
-
height:
|
|
63
|
+
height: blockNumber.toString(10),
|
|
43
64
|
};
|
|
44
65
|
if (vesting.isNone) {
|
|
45
66
|
return {
|
|
@@ -47,13 +68,223 @@ class AccountsVestingInfoService extends AbstractService_1.AbstractService {
|
|
|
47
68
|
vesting: [],
|
|
48
69
|
};
|
|
49
70
|
}
|
|
50
|
-
|
|
51
|
-
|
|
71
|
+
const unwrapVesting = vesting.unwrap();
|
|
72
|
+
const vestingArray = Array.isArray(unwrapVesting) ? unwrapVesting : [unwrapVesting];
|
|
73
|
+
// If includeVested is not requested, return raw vesting data
|
|
74
|
+
if (!includeVested) {
|
|
52
75
|
return {
|
|
53
76
|
at,
|
|
54
|
-
vesting:
|
|
77
|
+
vesting: vestingArray,
|
|
55
78
|
};
|
|
56
79
|
}
|
|
80
|
+
// Get the on-chain vesting lock amount from balances.locks
|
|
81
|
+
const vestingLocked = await this.getVestingLocked(historicApi, address);
|
|
82
|
+
// Calculate vested amounts based on chain type and migration state
|
|
83
|
+
const vestingResult = await this.calculateVestingAmounts(hash, blockNumber, vestingArray, vestingLocked, knownRelayBlockNumber);
|
|
84
|
+
if (vestingResult === null) {
|
|
85
|
+
// Unable to calculate (e.g., during migration or missing relay connection)
|
|
86
|
+
// Return raw vesting data without calculations
|
|
87
|
+
return {
|
|
88
|
+
at,
|
|
89
|
+
vesting: vestingArray,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
at,
|
|
94
|
+
vesting: vestingResult.schedules,
|
|
95
|
+
vestedBalance: vestingResult.vestedBalance,
|
|
96
|
+
vestingTotal: vestingResult.vestingTotal,
|
|
97
|
+
vestedClaimable: vestingResult.vestedClaimable,
|
|
98
|
+
blockNumberForCalculation: vestingResult.blockNumberForCalculation,
|
|
99
|
+
blockNumberSource: vestingResult.blockNumberSource,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get the vesting lock amount from balances.locks.
|
|
104
|
+
* Returns 0 if no vesting lock exists.
|
|
105
|
+
*/
|
|
106
|
+
async getVestingLocked(historicApi, address) {
|
|
107
|
+
var _a;
|
|
108
|
+
if (!((_a = historicApi.query.balances) === null || _a === void 0 ? void 0 : _a.locks)) {
|
|
109
|
+
return new bn_js_1.default(0);
|
|
110
|
+
}
|
|
111
|
+
const locks = await historicApi.query.balances.locks(address);
|
|
112
|
+
for (const lock of locks) {
|
|
113
|
+
if (lock.id.toHex() === VESTING_ID) {
|
|
114
|
+
return new bn_js_1.default(lock.amount.toString());
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return new bn_js_1.default(0);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Calculate vested amounts for vesting schedules.
|
|
121
|
+
* Returns null if calculation cannot be performed (e.g., during migration window).
|
|
122
|
+
*/
|
|
123
|
+
async calculateVestingAmounts(hash, blockNumber, vestingArray, vestingLocked, knownRelayBlockNumber) {
|
|
124
|
+
const specName = this.specName;
|
|
125
|
+
const isAssetHub = chains_config_1.assetHubSpecNames.has(specName);
|
|
126
|
+
if (isAssetHub) {
|
|
127
|
+
return this.calculateForAssetHub(hash, blockNumber, vestingArray, vestingLocked, knownRelayBlockNumber);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return this.calculateForRelayChain(blockNumber, vestingArray, vestingLocked);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Calculate vested amounts for Asset Hub chains.
|
|
135
|
+
* Post-migration: uses relay chain inclusion block number for calculations.
|
|
136
|
+
* If knownRelayBlockNumber is provided, uses it directly instead of searching.
|
|
137
|
+
*/
|
|
138
|
+
async calculateForAssetHub(hash, blockNumber, vestingArray, vestingLocked, knownRelayBlockNumber) {
|
|
139
|
+
const specName = this.specName;
|
|
140
|
+
const boundaries = consts_1.MIGRATION_BOUNDARIES[specName];
|
|
141
|
+
if (!boundaries) {
|
|
142
|
+
// No migration boundaries defined for this Asset Hub - can't calculate
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
const migrationState = this.getAssetHubMigrationState(blockNumber, boundaries);
|
|
146
|
+
if (migrationState === 'during-migration') {
|
|
147
|
+
// During migration window, return 0 for claimable
|
|
148
|
+
return this.createZeroClaimableResult(vestingArray, vestingLocked, blockNumber.toString(), 'self');
|
|
149
|
+
}
|
|
150
|
+
if (migrationState === 'pre-migration') {
|
|
151
|
+
// Pre-migration: vesting didn't exist on Asset Hub
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
// Post-migration: need relay chain block number for calculations
|
|
155
|
+
// If knownRelayBlockNumber is provided (e.g., from useRcBlock), use it directly
|
|
156
|
+
if (knownRelayBlockNumber !== undefined) {
|
|
157
|
+
return this.performCalculation(vestingArray, vestingLocked, knownRelayBlockNumber, 'relay');
|
|
158
|
+
}
|
|
159
|
+
// Otherwise, search for the relay chain inclusion block number
|
|
160
|
+
const relayApis = apiRegistry_1.ApiPromiseRegistry.getApiByType('relay');
|
|
161
|
+
if (relayApis.length === 0) {
|
|
162
|
+
throw new http_errors_1.InternalServerError('Relay chain connection required for vesting calculations on Asset Hub post-migration. ' +
|
|
163
|
+
'Please configure MULTI_CHAIN_URL with a relay chain endpoint.');
|
|
164
|
+
}
|
|
165
|
+
const rcApi = relayApis[0].api;
|
|
166
|
+
const inclusionResult = await (0, getRelayParentNumber_1.getInclusionBlockNumber)(this.api, rcApi, hash, ASSET_HUB_PARA_ID);
|
|
167
|
+
if (!inclusionResult.found || inclusionResult.inclusionBlockNumber === null) {
|
|
168
|
+
// Inclusion not found within search depth
|
|
169
|
+
// Fall back to relay parent number for calculation
|
|
170
|
+
return this.performCalculation(vestingArray, vestingLocked, new bn_js_1.default(inclusionResult.relayParentNumber), 'relay');
|
|
171
|
+
}
|
|
172
|
+
return this.performCalculation(vestingArray, vestingLocked, new bn_js_1.default(inclusionResult.inclusionBlockNumber), 'relay');
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Calculate vested amounts for relay chains.
|
|
176
|
+
* Pre-migration: uses the chain's own block number for calculations.
|
|
177
|
+
*/
|
|
178
|
+
calculateForRelayChain(blockNumber, vestingArray, vestingLocked) {
|
|
179
|
+
const specName = this.specName;
|
|
180
|
+
const assetHubSpec = consts_1.relayToSpecMapping.get(specName);
|
|
181
|
+
if (!assetHubSpec) {
|
|
182
|
+
// Not a known relay chain with migration boundaries
|
|
183
|
+
// Use single-chain calculation
|
|
184
|
+
return this.performCalculation(vestingArray, vestingLocked, new bn_js_1.default(blockNumber), 'self');
|
|
185
|
+
}
|
|
186
|
+
const boundaries = consts_1.MIGRATION_BOUNDARIES[assetHubSpec];
|
|
187
|
+
if (!boundaries) {
|
|
188
|
+
// No boundaries defined, use single-chain calculation
|
|
189
|
+
return this.performCalculation(vestingArray, vestingLocked, new bn_js_1.default(blockNumber), 'self');
|
|
190
|
+
}
|
|
191
|
+
const migrationState = this.getRelayChainMigrationState(blockNumber, boundaries);
|
|
192
|
+
if (migrationState === 'during-migration') {
|
|
193
|
+
// During migration window, return 0 for claimable
|
|
194
|
+
return this.createZeroClaimableResult(vestingArray, vestingLocked, blockNumber.toString(), 'self');
|
|
195
|
+
}
|
|
196
|
+
if (migrationState === 'post-migration') {
|
|
197
|
+
// Post-migration: vesting no longer exists on relay chain
|
|
198
|
+
// Return 0 for claimable since vesting has migrated
|
|
199
|
+
return this.createZeroClaimableResult(vestingArray, vestingLocked, blockNumber.toString(), 'self');
|
|
200
|
+
}
|
|
201
|
+
// Pre-migration: use relay chain's own block number
|
|
202
|
+
return this.performCalculation(vestingArray, vestingLocked, new bn_js_1.default(blockNumber), 'self');
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Perform the actual vesting calculation for vesting schedules.
|
|
206
|
+
*/
|
|
207
|
+
performCalculation(vestingArray, vestingLocked, currentBlock, source) {
|
|
208
|
+
// Convert VestingInfo to calculation interface
|
|
209
|
+
const calcSchedules = vestingArray.map((v) => ({
|
|
210
|
+
locked: new bn_js_1.default(v.locked.toString()),
|
|
211
|
+
perBlock: new bn_js_1.default(v.perBlock.toString()),
|
|
212
|
+
startingBlock: new bn_js_1.default(v.startingBlock.toString()),
|
|
213
|
+
}));
|
|
214
|
+
// Calculate vested for each schedule
|
|
215
|
+
const schedules = vestingArray.map((v, idx) => ({
|
|
216
|
+
locked: v.locked.toString(),
|
|
217
|
+
perBlock: v.perBlock.toString(),
|
|
218
|
+
startingBlock: v.startingBlock.toString(),
|
|
219
|
+
vested: (0, vestingCalculations_1.calculateVested)(currentBlock, calcSchedules[idx]).toString(),
|
|
220
|
+
}));
|
|
221
|
+
// Calculate aggregate values
|
|
222
|
+
const vestedBalance = (0, vestingCalculations_1.calculateTotalVested)(currentBlock, calcSchedules);
|
|
223
|
+
const vestingTotal = (0, vestingCalculations_1.calculateVestingTotal)(calcSchedules);
|
|
224
|
+
const vestedClaimable = (0, vestingCalculations_1.calculateVestedClaimable)(vestingLocked, vestingTotal, vestedBalance);
|
|
225
|
+
return {
|
|
226
|
+
schedules,
|
|
227
|
+
vestedBalance: vestedBalance.toString(),
|
|
228
|
+
vestingTotal: vestingTotal.toString(),
|
|
229
|
+
vestedClaimable: vestedClaimable.toString(),
|
|
230
|
+
blockNumberForCalculation: currentBlock.toString(),
|
|
231
|
+
blockNumberSource: source,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Create a result with zero claimable for all schedules.
|
|
236
|
+
* Used during migration windows or post-migration on relay chain.
|
|
237
|
+
*/
|
|
238
|
+
createZeroClaimableResult(vestingArray, _vestingLocked, blockNumber, source) {
|
|
239
|
+
// Convert VestingInfo to calculation interface
|
|
240
|
+
const calcSchedules = vestingArray.map((v) => ({
|
|
241
|
+
locked: new bn_js_1.default(v.locked.toString()),
|
|
242
|
+
perBlock: new bn_js_1.default(v.perBlock.toString()),
|
|
243
|
+
startingBlock: new bn_js_1.default(v.startingBlock.toString()),
|
|
244
|
+
}));
|
|
245
|
+
const vestingTotal = (0, vestingCalculations_1.calculateVestingTotal)(calcSchedules);
|
|
246
|
+
const schedules = vestingArray.map((v) => ({
|
|
247
|
+
locked: v.locked.toString(),
|
|
248
|
+
perBlock: v.perBlock.toString(),
|
|
249
|
+
startingBlock: v.startingBlock.toString(),
|
|
250
|
+
vested: '0',
|
|
251
|
+
}));
|
|
252
|
+
return {
|
|
253
|
+
schedules,
|
|
254
|
+
vestedBalance: '0',
|
|
255
|
+
vestingTotal: vestingTotal.toString(),
|
|
256
|
+
vestedClaimable: '0',
|
|
257
|
+
blockNumberForCalculation: blockNumber,
|
|
258
|
+
blockNumberSource: source,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Determine migration state for an Asset Hub block.
|
|
263
|
+
*/
|
|
264
|
+
getAssetHubMigrationState(blockNumber, boundaries) {
|
|
265
|
+
if (blockNumber < boundaries.assetHubMigrationStartedAt) {
|
|
266
|
+
return 'pre-migration';
|
|
267
|
+
}
|
|
268
|
+
else if (blockNumber >= boundaries.assetHubMigrationEndedAt) {
|
|
269
|
+
return 'post-migration';
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
return 'during-migration';
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Determine migration state for a relay chain block.
|
|
277
|
+
*/
|
|
278
|
+
getRelayChainMigrationState(blockNumber, boundaries) {
|
|
279
|
+
if (blockNumber < boundaries.relayMigrationStartedAt) {
|
|
280
|
+
return 'pre-migration';
|
|
281
|
+
}
|
|
282
|
+
else if (blockNumber >= boundaries.relayMigrationEndedAt) {
|
|
283
|
+
return 'post-migration';
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
return 'during-migration';
|
|
287
|
+
}
|
|
57
288
|
}
|
|
58
289
|
}
|
|
59
290
|
exports.AccountsVestingInfoService = AccountsVestingInfoService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountsVestingInfoService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsVestingInfoService.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE
|
|
1
|
+
{"version":3,"file":"AccountsVestingInfoService.js","sourceRoot":"","sources":["../../../../src/services/accounts/AccountsVestingInfoService.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;;;;AAIxE,kDAAuB;AACvB,6CAA8D;AAG9D,mDAAuD;AACvD,uDAAwD;AACxD,gFAAgF;AAChF,gFAMgD;AAChD,wDAAqD;AACrD,sCAAqE;AAOrE;;GAEG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC,MAAa,0BAA2B,SAAQ,iCAAe;IAC9D;;;;;;;OAOG;IACH,KAAK,CAAC,uBAAuB,CAC5B,IAAe,EACf,OAAe,EACf,aAAa,GAAG,KAAK,EACrB,qBAA0B;QAE1B,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAErB,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAEvC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EA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AAlXD,gEAkXC"}
|
|
@@ -2,6 +2,7 @@ export * from './AccountsAssetsService';
|
|
|
2
2
|
export * from './AccountsBalanceInfoService';
|
|
3
3
|
export * from './AccountsCompareService';
|
|
4
4
|
export * from './AccountsConvertService';
|
|
5
|
+
export * from './AccountsForeignAssetsService';
|
|
5
6
|
export * from './AccountsPoolAssetsService';
|
|
6
7
|
export * from './AccountsProxyInfoService';
|
|
7
8
|
export * from './AccountsStakingInfoService';
|
|
@@ -33,6 +33,7 @@ __exportStar(require("./AccountsAssetsService"), exports);
|
|
|
33
33
|
__exportStar(require("./AccountsBalanceInfoService"), exports);
|
|
34
34
|
__exportStar(require("./AccountsCompareService"), exports);
|
|
35
35
|
__exportStar(require("./AccountsConvertService"), exports);
|
|
36
|
+
__exportStar(require("./AccountsForeignAssetsService"), exports);
|
|
36
37
|
__exportStar(require("./AccountsPoolAssetsService"), exports);
|
|
37
38
|
__exportStar(require("./AccountsProxyInfoService"), exports);
|
|
38
39
|
__exportStar(require("./AccountsStakingInfoService"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/accounts/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;;;;;;;;;;;;;;AAExE,0DAAwC;AACxC,+DAA6C;AAC7C,2DAAyC;AACzC,2DAAyC;AACzC,8DAA4C;AAC5C,6DAA2C;AAC3C,+DAA6C;AAC7C,kEAAgD;AAChD,4DAA0C;AAC1C,+DAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/services/accounts/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;;;;;;;;;;;;;;AAExE,0DAAwC;AACxC,+DAA6C;AAC7C,2DAAyC;AACzC,2DAAyC;AACzC,iEAA+C;AAC/C,8DAA4C;AAC5C,6DAA2C;AAC3C,+DAA6C;AAC7C,kEAAgD;AAChD,4DAA0C;AAC1C,+DAA6C"}
|
|
@@ -41,6 +41,14 @@ exports.MIGRATION_BOUNDARIES = {
|
|
|
41
41
|
relayMigrationStartedAt: 30423691,
|
|
42
42
|
relayMigrationEndedAt: 30425590,
|
|
43
43
|
},
|
|
44
|
+
statemint: {
|
|
45
|
+
relayChainLastEra: 1981,
|
|
46
|
+
assetHubFirstEra: 1981,
|
|
47
|
+
assetHubMigrationStartedAt: 10254470,
|
|
48
|
+
assetHubMigrationEndedAt: 10259208,
|
|
49
|
+
relayMigrationStartedAt: 28490502,
|
|
50
|
+
relayMigrationEndedAt: 28495696,
|
|
51
|
+
},
|
|
44
52
|
};
|
|
45
53
|
exports.relayToSpecMapping = new Map([
|
|
46
54
|
['polkadot', 'statemint'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../src/services/consts.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;AAe3D,QAAA,oBAAoB,GAAyC;IACzE,QAAQ,EAAE;QACT,iBAAiB,EAAE,IAAI;QACvB,gBAAgB,EAAE,IAAI;QACtB,0BAA0B,EAA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B,EAAE,IAAI;QACvB,gBAAgB,EAAE,IAAI;QACtB,0BAA0B,EAAE,OAAO;QACnC,wBAAwB,EAAE,OAAO;QACjC,uBAAuB,EAAE,OAAO;QAChC,qBAAqB,EAAE,OAAO;KAC9B;IACD,SAAS,EAAE;QACV,iBAAiB,EAAE,IAAI;QACvB,gBAAgB,EAAE,IAAI;QACtB,0BAA0B,EAAE,QAAQ;QACpC,wBAAwB,EAAE,QAAQ;QAClC,uBAAuB,EAAE,QAAQ;QACjC,qBAAqB,EAAE,QAAQ;KAC/B;IACD,SAAS,EAAE;QACV,iBAAiB,EAAE,IAAI;QACvB,gBAAgB,EAAE,IAAI;QACtB,0BAA0B,EAAE,QAAQ;QACpC,wBAAwB,EAAE,QAAQ;QAClC,uBAAuB,EAAE,QAAQ;QACjC,qBAAqB,EAAE,QAAQ;KAC/B;CACD,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACzC,CAAC,UAAU,EAAE,WAAW,CAAC;IACzB,CAAC,QAAQ,EAAE,WAAW,CAAC;IACvB,CAAC,SAAS,EAAE,UAAU,CAAC;IACvB,CAAC,OAAO,EAAE,iBAAiB,CAAC;CAC5B,CAAC,CAAC"}
|
|
@@ -7,18 +7,10 @@ export declare class ParasInclusionService extends AbstractService {
|
|
|
7
7
|
/**
|
|
8
8
|
* Find the relay chain inclusion information for a specific parachain block.
|
|
9
9
|
*
|
|
10
|
-
* @param hash - The
|
|
11
|
-
* @param
|
|
10
|
+
* @param hash - The parachain block hash
|
|
11
|
+
* @param paraId - The parachain ID
|
|
12
|
+
* @param number - The parachain block number
|
|
12
13
|
* @param depth - Search depth (defaults to 10)
|
|
13
14
|
*/
|
|
14
15
|
getParachainInclusion(hash: BlockHash, paraId: u32, number: string, depth?: number): Promise<IParachainInclusion>;
|
|
15
|
-
/**
|
|
16
|
-
* Search relay chain blocks for inclusion of a specific parachain block
|
|
17
|
-
* Uses optimized candidate_events runtime API when available, falls back to system events for historical support
|
|
18
|
-
*/
|
|
19
|
-
private searchForInclusion;
|
|
20
|
-
/**
|
|
21
|
-
* Search using system events
|
|
22
|
-
*/
|
|
23
|
-
private searchWithSystemEvents;
|
|
24
16
|
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.ParasInclusionService = void 0;
|
|
19
19
|
const apiRegistry_1 = require("../../apiRegistry");
|
|
20
|
+
const getRelayParentNumber_1 = require("../../util/relay/getRelayParentNumber");
|
|
20
21
|
const AbstractService_1 = require("../AbstractService");
|
|
21
22
|
class ParasInclusionService extends AbstractService_1.AbstractService {
|
|
22
23
|
constructor(api) {
|
|
@@ -25,8 +26,9 @@ class ParasInclusionService extends AbstractService_1.AbstractService {
|
|
|
25
26
|
/**
|
|
26
27
|
* Find the relay chain inclusion information for a specific parachain block.
|
|
27
28
|
*
|
|
28
|
-
* @param hash - The
|
|
29
|
-
* @param
|
|
29
|
+
* @param hash - The parachain block hash
|
|
30
|
+
* @param paraId - The parachain ID
|
|
31
|
+
* @param number - The parachain block number
|
|
30
32
|
* @param depth - Search depth (defaults to 10)
|
|
31
33
|
*/
|
|
32
34
|
async getParachainInclusion(hash, paraId, number, depth = 10) {
|
|
@@ -36,19 +38,11 @@ class ParasInclusionService extends AbstractService_1.AbstractService {
|
|
|
36
38
|
if (!rcApi) {
|
|
37
39
|
throw new Error('Relay chain api must be available');
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
return ext.method.method.toString() === 'setValidationData';
|
|
42
|
-
});
|
|
43
|
-
if (!setValidationData) {
|
|
44
|
-
throw new Error("Block contains no set validation data. Can't find relayParentNumber");
|
|
45
|
-
}
|
|
46
|
-
const callArgs = apiAt.registry.createType('Call', setValidationData.method);
|
|
47
|
-
const { relayParentNumber } = callArgs.toJSON().args.data.validationData;
|
|
41
|
+
// Extract relay parent number from the parachain block
|
|
42
|
+
const relayParentNumber = await (0, getRelayParentNumber_1.getRelayParentNumberRaw)(api, hash);
|
|
48
43
|
// Search for inclusion starting from relay_parent_number + 1
|
|
49
|
-
const inclusionNumber = await
|
|
44
|
+
const inclusionNumber = await (0, getRelayParentNumber_1.searchForInclusionBlock)(rcApi, paraId.toNumber(), number, // parachain block number
|
|
50
45
|
relayParentNumber, depth);
|
|
51
|
-
// For now, return a placeholder response
|
|
52
46
|
return {
|
|
53
47
|
parachainBlock: parseInt(number, 10),
|
|
54
48
|
parachainBlockHash: hash.toString(),
|
|
@@ -58,53 +52,6 @@ class ParasInclusionService extends AbstractService_1.AbstractService {
|
|
|
58
52
|
found: inclusionNumber !== null,
|
|
59
53
|
};
|
|
60
54
|
}
|
|
61
|
-
/**
|
|
62
|
-
* Search relay chain blocks for inclusion of a specific parachain block
|
|
63
|
-
* Uses optimized candidate_events runtime API when available, falls back to system events for historical support
|
|
64
|
-
*/
|
|
65
|
-
async searchForInclusion(rcApi, paraId, parachainBlockNumber, relayParentNumber, maxDepth) {
|
|
66
|
-
return this.searchWithSystemEvents(rcApi, paraId, parachainBlockNumber, relayParentNumber, maxDepth);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Search using system events
|
|
70
|
-
*/
|
|
71
|
-
async searchWithSystemEvents(rcApi, paraId, parachainBlockNumber, relayParentNumber, maxDepth) {
|
|
72
|
-
// The number is 5 here since most searches are relative to 2-4 blocks from the `relayParentNumber`.
|
|
73
|
-
// Therefore we give 1 extra block for extra room, while also minimizing the amount of searches we do.
|
|
74
|
-
const BATCH_SIZE = 5;
|
|
75
|
-
// Search in batches of 5 for optimal performance
|
|
76
|
-
for (let offset = 0; offset < maxDepth; offset += BATCH_SIZE) {
|
|
77
|
-
const batchSize = Math.min(BATCH_SIZE, maxDepth - offset);
|
|
78
|
-
const searchBlocks = Array.from({ length: batchSize }, (_, i) => relayParentNumber + offset + i + 1);
|
|
79
|
-
const searchPromises = searchBlocks.map(async (blockNum) => {
|
|
80
|
-
try {
|
|
81
|
-
const relayBlockHash = await rcApi.rpc.chain.getBlockHash(blockNum);
|
|
82
|
-
const rcApiAt = await rcApi.at(relayBlockHash);
|
|
83
|
-
const events = await rcApiAt.query.system.events();
|
|
84
|
-
const foundInclusion = events.find((record) => {
|
|
85
|
-
if (record.event.section === 'paraInclusion' && record.event.method === 'CandidateIncluded') {
|
|
86
|
-
const eventData = record.event.data[0].toJSON();
|
|
87
|
-
if (eventData.descriptor.paraId === paraId) {
|
|
88
|
-
const header = rcApiAt.registry.createType('Header', record.event.data[1]);
|
|
89
|
-
return header.number.toString() === parachainBlockNumber;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return false;
|
|
93
|
-
});
|
|
94
|
-
return foundInclusion ? blockNum : null;
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
const results = await Promise.all(searchPromises);
|
|
101
|
-
const found = results.find((result) => result !== null);
|
|
102
|
-
if (found) {
|
|
103
|
-
return found; // Early termination when found in this batch
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return null; // Not found within search depth
|
|
107
|
-
}
|
|
108
55
|
}
|
|
109
56
|
exports.ParasInclusionService = ParasInclusionService;
|
|
110
57
|
//# sourceMappingURL=ParasInclusionService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParasInclusionService.js","sourceRoot":"","sources":["../../../../src/services/paras/ParasInclusionService.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;;;
|
|
1
|
+
{"version":3,"file":"ParasInclusionService.js","sourceRoot":"","sources":["../../../../src/services/paras/ParasInclusionService.ts"],"names":[],"mappings":";AAAA,oDAAoD;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CACD;AA1CD,sDA0CC"}
|
|
@@ -47,3 +47,36 @@ export interface IAccountAssetApproval {
|
|
|
47
47
|
rcBlockNumber?: string;
|
|
48
48
|
ahTimestamp?: string;
|
|
49
49
|
}
|
|
50
|
+
export interface IForeignAssetBalance {
|
|
51
|
+
/**
|
|
52
|
+
* The multilocation identifier for the foreign asset.
|
|
53
|
+
*/
|
|
54
|
+
multiLocation: unknown;
|
|
55
|
+
/**
|
|
56
|
+
* The units in which substrate records balances.
|
|
57
|
+
*/
|
|
58
|
+
balance: u128;
|
|
59
|
+
/**
|
|
60
|
+
* Whether this asset class is frozen except for permissioned/admin instructions.
|
|
61
|
+
* Returns false if the pallet doesn't support isFrozen.
|
|
62
|
+
*/
|
|
63
|
+
isFrozen: bool;
|
|
64
|
+
/**
|
|
65
|
+
* Whether a non-zero balance of this asset is deposit of sufficient
|
|
66
|
+
* value to account for the state bloat associated with its balance storage. If set to
|
|
67
|
+
* `true`, then non-zero balances may be stored without a `consumer` reference (and thus
|
|
68
|
+
* an ED in the Balances pallet or whatever else is used to control user-account state
|
|
69
|
+
* growth).
|
|
70
|
+
*/
|
|
71
|
+
isSufficient: bool | boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Response from `/accounts/{accountId}/foreign-asset-balances?foreignAssets=<multilocations>`
|
|
75
|
+
*/
|
|
76
|
+
export interface IAccountForeignAssetsBalances {
|
|
77
|
+
at: IAt;
|
|
78
|
+
foreignAssets: IForeignAssetBalance[];
|
|
79
|
+
rcBlockHash?: string;
|
|
80
|
+
rcBlockNumber?: string;
|
|
81
|
+
ahTimestamp?: string;
|
|
82
|
+
}
|
|
@@ -1,10 +1,65 @@
|
|
|
1
1
|
import { Option } from '@polkadot/types/codec';
|
|
2
2
|
import { VestingInfo } from '@polkadot/types/interfaces';
|
|
3
3
|
import { IAt } from '.';
|
|
4
|
+
/**
|
|
5
|
+
* Vesting schedule with calculated vested amount.
|
|
6
|
+
* Extends the base VestingInfo with additional computed fields.
|
|
7
|
+
*/
|
|
8
|
+
export interface IVestingSchedule {
|
|
9
|
+
/** Total amount of tokens locked at the start of vesting */
|
|
10
|
+
locked: string;
|
|
11
|
+
/** Number of tokens that unlock per block */
|
|
12
|
+
perBlock: string;
|
|
13
|
+
/** Block number when vesting/unlocking begins */
|
|
14
|
+
startingBlock: string;
|
|
15
|
+
/** Amount that has vested based on time elapsed at the queried block */
|
|
16
|
+
vested: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Indicates which chain's block number was used for vesting calculations.
|
|
20
|
+
* - 'relay': Relay chain block number (used for Asset Hub post-migration)
|
|
21
|
+
* - 'self': The queried chain's own block number (used for relay chain pre-migration)
|
|
22
|
+
*/
|
|
23
|
+
export type BlockNumberSource = 'relay' | 'self';
|
|
4
24
|
export interface IAccountVestingInfo {
|
|
5
25
|
at: IAt;
|
|
6
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Array of vesting schedules for the account.
|
|
28
|
+
* Can be raw VestingInfo from the pallet or enhanced IVestingSchedule with vested amounts.
|
|
29
|
+
*/
|
|
30
|
+
vesting: Option<VestingInfo> | IVestingSchedule[] | {};
|
|
31
|
+
/**
|
|
32
|
+
* Total amount that has vested across all schedules (sum of per-schedule vested).
|
|
33
|
+
* Only present when vesting calculations are performed.
|
|
34
|
+
*/
|
|
35
|
+
vestedBalance?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Total locked amount across all vesting schedules.
|
|
38
|
+
* Only present when vesting calculations are performed.
|
|
39
|
+
*/
|
|
40
|
+
vestingTotal?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Actual amount that can be claimed/unlocked right now.
|
|
43
|
+
* Calculated as: vestingLocked - (vestingTotal - vestedBalance)
|
|
44
|
+
* This accounts for previous claims that reduced the on-chain lock.
|
|
45
|
+
* Only present when vesting calculations are performed.
|
|
46
|
+
*/
|
|
47
|
+
vestedClaimable?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The block number used for calculating vested amounts.
|
|
50
|
+
* For Asset Hub post-migration, this is the relay chain block number.
|
|
51
|
+
* For relay chain pre-migration, this is the queried block number.
|
|
52
|
+
*/
|
|
53
|
+
blockNumberForCalculation?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Indicates which chain's block number was used for the calculation.
|
|
56
|
+
* 'relay' for Asset Hub post-migration, 'self' for relay chain pre-migration.
|
|
57
|
+
*/
|
|
58
|
+
blockNumberSource?: BlockNumberSource;
|
|
59
|
+
/** Relay chain block hash (when using useRcBlock parameter) */
|
|
7
60
|
rcBlockHash?: string;
|
|
61
|
+
/** Relay chain block number (when using useRcBlock parameter) */
|
|
8
62
|
rcBlockNumber?: string;
|
|
63
|
+
/** Asset Hub timestamp (when using useRcBlock parameter) */
|
|
9
64
|
ahTimestamp?: string;
|
|
10
65
|
}
|