@ledgerhq/live-cli 24.19.5-nightly.1 → 24.19.5
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/lib/cli.js +650 -644
- package/package.json +2 -2
package/lib/cli.js
CHANGED
|
@@ -516671,7 +516671,7 @@ var require_package8 = __commonJS({
|
|
|
516671
516671
|
module2.exports = {
|
|
516672
516672
|
name: "@ledgerhq/live-common",
|
|
516673
516673
|
description: "Common ground for the Ledger Live apps",
|
|
516674
|
-
version: "34.42.0
|
|
516674
|
+
version: "34.42.0",
|
|
516675
516675
|
repository: {
|
|
516676
516676
|
type: "git",
|
|
516677
516677
|
url: "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -523472,7 +523472,7 @@ var require_package9 = __commonJS({
|
|
|
523472
523472
|
"package.json"(exports2, module2) {
|
|
523473
523473
|
module2.exports = {
|
|
523474
523474
|
name: "@ledgerhq/live-cli",
|
|
523475
|
-
version: "24.19.5
|
|
523475
|
+
version: "24.19.5",
|
|
523476
523476
|
description: "ledger-live CLI version",
|
|
523477
523477
|
repository: {
|
|
523478
523478
|
type: "git",
|
|
@@ -529948,9 +529948,6 @@ var cryptocurrenciesById = {
|
|
|
529948
529948
|
magnitude: 18
|
|
529949
529949
|
}
|
|
529950
529950
|
],
|
|
529951
|
-
ethereumLikeInfo: {
|
|
529952
|
-
chainId: 42220
|
|
529953
|
-
},
|
|
529954
529951
|
explorerViews: [
|
|
529955
529952
|
{
|
|
529956
529953
|
tx: "https://explorer.celo.org/tx/$hash",
|
|
@@ -587395,7 +587392,6 @@ var import_findLast = __toESM(require("lodash/findLast"));
|
|
|
587395
587392
|
var import_filter = __toESM(require("lodash/filter"));
|
|
587396
587393
|
var import_uniqBy = __toESM(require("lodash/uniqBy"));
|
|
587397
587394
|
init_lib_es2();
|
|
587398
|
-
var import_findIndex = __toESM(require("lodash/findIndex"));
|
|
587399
587395
|
var BitcoinLikeStorage = class {
|
|
587400
587396
|
txs = [];
|
|
587401
587397
|
// indexe: address + hash -> tx
|
|
@@ -587475,6 +587471,7 @@ var BitcoinLikeStorage = class {
|
|
|
587475
587471
|
this.txs[this.primaryIndex[index]] = tx;
|
|
587476
587472
|
return;
|
|
587477
587473
|
}
|
|
587474
|
+
log2("bitcoin[storage]", `Already stored ${index}, skipping`);
|
|
587478
587475
|
return;
|
|
587479
587476
|
}
|
|
587480
587477
|
const idx = this.txs.push(tx) - 1;
|
|
@@ -587485,24 +587482,35 @@ var BitcoinLikeStorage = class {
|
|
|
587485
587482
|
this.spentUtxos[indexAddress] = this.spentUtxos[indexAddress] || [];
|
|
587486
587483
|
tx.outputs.forEach((output5) => {
|
|
587487
587484
|
if (output5.address === tx.address) {
|
|
587485
|
+
log2("bitcoin[storage]", `Adding unspent output: ${output5.output_hash}:${output5.output_index} -> ${tx.address}`);
|
|
587488
587486
|
this.unspentUtxos[indexAddress].push(output5);
|
|
587489
587487
|
}
|
|
587490
587488
|
});
|
|
587491
587489
|
tx.inputs.forEach((input) => {
|
|
587492
|
-
|
|
587493
|
-
|
|
587494
|
-
|
|
587490
|
+
const inputAddress = input.address;
|
|
587491
|
+
this.spentUtxos[inputAddress] = this.spentUtxos[inputAddress] || [];
|
|
587492
|
+
this.unspentUtxos[inputAddress] = this.unspentUtxos[inputAddress] || [];
|
|
587493
|
+
this.spentUtxos[inputAddress].push(input);
|
|
587495
587494
|
});
|
|
587496
|
-
this.
|
|
587497
|
-
|
|
587498
|
-
|
|
587499
|
-
|
|
587500
|
-
|
|
587495
|
+
this.updateAllUtxoStates();
|
|
587496
|
+
});
|
|
587497
|
+
return this.txs.length - lastLength;
|
|
587498
|
+
}
|
|
587499
|
+
updateAllUtxoStates() {
|
|
587500
|
+
Object.keys(this.unspentUtxos).forEach((addressKey) => {
|
|
587501
|
+
if (!this.spentUtxos[addressKey])
|
|
587502
|
+
return;
|
|
587503
|
+
this.unspentUtxos[addressKey] = this.unspentUtxos[addressKey].filter((output5) => {
|
|
587504
|
+
const isSpent = this.spentUtxos[addressKey].some((input) => input.output_hash === output5.output_hash && input.output_index === output5.output_index);
|
|
587505
|
+
if (isSpent) {
|
|
587506
|
+
const spentIndex = this.spentUtxos[addressKey].findIndex((input) => input.output_hash === output5.output_hash && input.output_index === output5.output_index);
|
|
587507
|
+
if (spentIndex > -1) {
|
|
587508
|
+
this.spentUtxos[addressKey].splice(spentIndex, 1);
|
|
587509
|
+
}
|
|
587501
587510
|
}
|
|
587502
|
-
return
|
|
587511
|
+
return !isSpent;
|
|
587503
587512
|
});
|
|
587504
587513
|
});
|
|
587505
|
-
return this.txs.length - lastLength;
|
|
587506
587514
|
}
|
|
587507
587515
|
getUniquesAddresses(addressesFilter) {
|
|
587508
587516
|
return (0, import_uniqBy.default)((0, import_filter.default)(this.txs, (t65) => (typeof addressesFilter.account === "undefined" || addressesFilter.account === t65.account) && (typeof addressesFilter.index === "undefined" || addressesFilter.index === t65.index)).map((tx) => ({
|
|
@@ -610238,9 +610246,9 @@ var getFeeData = async (currency24, transaction) => {
|
|
|
610238
610246
|
/**
|
|
610239
610247
|
* ⚠️ We don't know the type of the transaction for sure at this stage since
|
|
610240
610248
|
* `getFeeData` is called before `getTypedTransaction` in prepareTransaction
|
|
610241
|
-
* libs/coin-
|
|
610249
|
+
* libs/coin-evm/src/prepareTransaction.ts:201
|
|
610242
610250
|
* It's most probably always 2 since it's the default type value for a new transaction
|
|
610243
|
-
* cf. libs/coin-
|
|
610251
|
+
* cf. libs/coin-evm/src/createTransaction.ts:23
|
|
610244
610252
|
*/
|
|
610245
610253
|
options: {
|
|
610246
610254
|
useEIP1559: getEnv("EVM_FORCE_LEGACY_TRANSACTIONS") ? false : transaction.type === 2,
|
|
@@ -700895,7 +700903,7 @@ var PolkadotValidatorsRequired = createCustomErrorClass("PolkadotValidatorsRequi
|
|
|
700895
700903
|
var PolkadotDoMaxSendInstead = createCustomErrorClass("PolkadotDoMaxSendInstead");
|
|
700896
700904
|
|
|
700897
700905
|
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/preload.js
|
|
700898
|
-
var
|
|
700906
|
+
var import_bignumber228 = require("bignumber.js");
|
|
700899
700907
|
init_lib_es2();
|
|
700900
700908
|
|
|
700901
700909
|
// ../../libs/coin-modules/coin-polkadot/lib-es/network/bisontrails.js
|
|
@@ -705337,12 +705345,124 @@ var getOperations3 = async (accountId2, addr, startAt = 0, limit = LIMIT3) => {
|
|
|
705337
705345
|
};
|
|
705338
705346
|
|
|
705339
705347
|
// ../../libs/coin-modules/coin-polkadot/lib-es/network/sidecar.js
|
|
705340
|
-
var
|
|
705348
|
+
var import_bignumber227 = require("bignumber.js");
|
|
705341
705349
|
|
|
705342
705350
|
// ../../libs/coin-modules/coin-polkadot/lib-es/config.js
|
|
705343
705351
|
var coinConfig8 = config_default();
|
|
705344
705352
|
var config_default4 = coinConfig8;
|
|
705345
705353
|
|
|
705354
|
+
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/utils.js
|
|
705355
|
+
var import_bignumber226 = require("bignumber.js");
|
|
705356
|
+
|
|
705357
|
+
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/state.js
|
|
705358
|
+
var import_rxjs44 = require("rxjs");
|
|
705359
|
+
var currentPolkadotPreloadedData = {
|
|
705360
|
+
validators: [],
|
|
705361
|
+
staking: void 0,
|
|
705362
|
+
minimumBondBalance: "0"
|
|
705363
|
+
};
|
|
705364
|
+
var updates5 = new import_rxjs44.Subject();
|
|
705365
|
+
function getCurrentPolkadotPreloadData() {
|
|
705366
|
+
return currentPolkadotPreloadedData;
|
|
705367
|
+
}
|
|
705368
|
+
function setPolkadotPreloadData(data6) {
|
|
705369
|
+
if (data6 === currentPolkadotPreloadedData)
|
|
705370
|
+
return;
|
|
705371
|
+
currentPolkadotPreloadedData = data6;
|
|
705372
|
+
updates5.next(data6);
|
|
705373
|
+
}
|
|
705374
|
+
|
|
705375
|
+
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/utils.js
|
|
705376
|
+
var EXISTENTIAL_DEPOSIT2 = new import_bignumber226.BigNumber(1e10);
|
|
705377
|
+
var EXISTENTIAL_DEPOSIT_RECOMMENDED_MARGIN2 = new import_bignumber226.BigNumber(1e9);
|
|
705378
|
+
var MAX_UNLOCKINGS = 32;
|
|
705379
|
+
var MAX_AMOUNT_INPUT = 18446744073709552e3;
|
|
705380
|
+
var FEES_SAFETY_BUFFER3 = new import_bignumber226.BigNumber(1e9);
|
|
705381
|
+
var isStash = (a72) => {
|
|
705382
|
+
return !!a72.polkadotResources?.controller;
|
|
705383
|
+
};
|
|
705384
|
+
var isController = (account3) => {
|
|
705385
|
+
return !!account3.polkadotResources?.stash;
|
|
705386
|
+
};
|
|
705387
|
+
var canBond = (a72) => {
|
|
705388
|
+
const { balance } = a72;
|
|
705389
|
+
return EXISTENTIAL_DEPOSIT2.lte(balance);
|
|
705390
|
+
};
|
|
705391
|
+
var getMinimumAmountToBond = (a72, minimumBondBalance) => {
|
|
705392
|
+
const currentlyBondedBalance = calculateMaxUnbond(a72);
|
|
705393
|
+
if (minimumBondBalance && currentlyBondedBalance.lt(minimumBondBalance)) {
|
|
705394
|
+
return minimumBondBalance.minus(currentlyBondedBalance);
|
|
705395
|
+
}
|
|
705396
|
+
return new import_bignumber226.BigNumber(0);
|
|
705397
|
+
};
|
|
705398
|
+
var hasMinimumBondBalance = (account3) => {
|
|
705399
|
+
const { minimumBondBalance } = getCurrentPolkadotPreloadData();
|
|
705400
|
+
return !account3.polkadotResources || account3.polkadotResources.lockedBalance.gte(new import_bignumber226.BigNumber(minimumBondBalance));
|
|
705401
|
+
};
|
|
705402
|
+
var hasMaxUnlockings = (a72) => {
|
|
705403
|
+
const { unlockings = [] } = a72.polkadotResources || {};
|
|
705404
|
+
return (unlockings?.length || 0) >= MAX_UNLOCKINGS;
|
|
705405
|
+
};
|
|
705406
|
+
var hasLockedBalance = (a72) => {
|
|
705407
|
+
const { lockedBalance = new import_bignumber226.BigNumber(0), unlockingBalance = new import_bignumber226.BigNumber(0) } = a72.polkadotResources || {};
|
|
705408
|
+
return lockedBalance.minus(unlockingBalance).gt(0);
|
|
705409
|
+
};
|
|
705410
|
+
var canUnbond = (a72) => {
|
|
705411
|
+
return hasLockedBalance(a72) && !hasMaxUnlockings(a72);
|
|
705412
|
+
};
|
|
705413
|
+
var canNominate = (account3) => {
|
|
705414
|
+
return isController(account3) && hasMinimumBondBalance(account3);
|
|
705415
|
+
};
|
|
705416
|
+
var isFirstBond = (a72) => !isStash(a72);
|
|
705417
|
+
var getNonce2 = (a72) => {
|
|
705418
|
+
const lastPendingOp = a72.pendingOperations[0];
|
|
705419
|
+
const nonce = Math.max(a72.polkadotResources?.nonce || 0, lastPendingOp && typeof lastPendingOp.transactionSequenceNumber === "number" ? lastPendingOp.transactionSequenceNumber + 1 : 0);
|
|
705420
|
+
return nonce;
|
|
705421
|
+
};
|
|
705422
|
+
var calculateMaxBond = (a72, t65) => {
|
|
705423
|
+
const amount = a72.spendableBalance.minus(t65.fees || 0).minus(FEES_SAFETY_BUFFER3);
|
|
705424
|
+
return amount.lt(0) ? new import_bignumber226.BigNumber(0) : amount;
|
|
705425
|
+
};
|
|
705426
|
+
var calculateMaxUnbond = (a72) => {
|
|
705427
|
+
return a72.polkadotResources?.lockedBalance.minus(a72.polkadotResources.unlockingBalance) ?? new import_bignumber226.BigNumber(0);
|
|
705428
|
+
};
|
|
705429
|
+
var calculateMaxRebond = (a72) => {
|
|
705430
|
+
return a72.polkadotResources?.unlockingBalance ?? new import_bignumber226.BigNumber(0);
|
|
705431
|
+
};
|
|
705432
|
+
var calculateMaxSend2 = (a72, t65) => {
|
|
705433
|
+
const amount = a72.spendableBalance.minus(t65.fees || 0);
|
|
705434
|
+
return amount.lt(0) ? new import_bignumber226.BigNumber(0) : amount;
|
|
705435
|
+
};
|
|
705436
|
+
var calculateAmount4 = ({ account: account3, transaction }) => {
|
|
705437
|
+
let amount = transaction.amount;
|
|
705438
|
+
if (transaction.useAllAmount) {
|
|
705439
|
+
switch (transaction.mode) {
|
|
705440
|
+
case "send":
|
|
705441
|
+
amount = calculateMaxSend2(account3, transaction);
|
|
705442
|
+
break;
|
|
705443
|
+
case "bond":
|
|
705444
|
+
amount = calculateMaxBond(account3, transaction);
|
|
705445
|
+
break;
|
|
705446
|
+
case "unbond":
|
|
705447
|
+
amount = calculateMaxUnbond(account3);
|
|
705448
|
+
break;
|
|
705449
|
+
case "rebond":
|
|
705450
|
+
amount = calculateMaxRebond(account3);
|
|
705451
|
+
break;
|
|
705452
|
+
default:
|
|
705453
|
+
amount = account3.spendableBalance.minus(transaction.fees || 0);
|
|
705454
|
+
break;
|
|
705455
|
+
}
|
|
705456
|
+
} else if (transaction.amount.gt(MAX_AMOUNT_INPUT)) {
|
|
705457
|
+
return new import_bignumber226.BigNumber(MAX_AMOUNT_INPUT);
|
|
705458
|
+
}
|
|
705459
|
+
return amount.lt(0) ? new import_bignumber226.BigNumber(0) : amount;
|
|
705460
|
+
};
|
|
705461
|
+
var getMinimumBalance2 = (a72) => {
|
|
705462
|
+
const lockedBalance = a72.balance.minus(a72.spendableBalance);
|
|
705463
|
+
return lockedBalance.lte(EXISTENTIAL_DEPOSIT2) ? EXISTENTIAL_DEPOSIT2.minus(lockedBalance) : new import_bignumber226.BigNumber(0);
|
|
705464
|
+
};
|
|
705465
|
+
|
|
705346
705466
|
// ../../node_modules/.pnpm/@polkadot+types@11.2.1/node_modules/@polkadot/types/interfaces/definitions.js
|
|
705347
705467
|
var definitions_exports = {};
|
|
705348
705468
|
__export(definitions_exports, {
|
|
@@ -740477,7 +740597,7 @@ var WsProvider = class _WsProvider {
|
|
|
740477
740597
|
};
|
|
740478
740598
|
|
|
740479
740599
|
// ../../node_modules/.pnpm/@polkadot+api@11.2.1/node_modules/@polkadot/api/submittable/createClass.js
|
|
740480
|
-
var
|
|
740600
|
+
var import_rxjs131 = require("rxjs");
|
|
740481
740601
|
|
|
740482
740602
|
// ../../node_modules/.pnpm/@polkadot+api@11.2.1/node_modules/@polkadot/api/util/logging.js
|
|
740483
740603
|
var l64 = /* @__PURE__ */ logger48("api/util");
|
|
@@ -740506,17 +740626,17 @@ function isKeyringPair(account3) {
|
|
|
740506
740626
|
}
|
|
740507
740627
|
|
|
740508
740628
|
// ../../node_modules/.pnpm/@polkadot+rpc-core@11.2.1/node_modules/@polkadot/rpc-core/bundle.js
|
|
740509
|
-
var
|
|
740629
|
+
var import_rxjs48 = require("rxjs");
|
|
740510
740630
|
|
|
740511
740631
|
// ../../node_modules/.pnpm/@polkadot+rpc-core@11.2.1/node_modules/@polkadot/rpc-core/util/drr.js
|
|
740512
|
-
var
|
|
740632
|
+
var import_rxjs46 = require("rxjs");
|
|
740513
740633
|
|
|
740514
740634
|
// ../../node_modules/.pnpm/@polkadot+rpc-core@11.2.1/node_modules/@polkadot/rpc-core/util/refCountDelay.js
|
|
740515
|
-
var
|
|
740635
|
+
var import_rxjs45 = require("rxjs");
|
|
740516
740636
|
function refCountDelay(delay12 = 1750) {
|
|
740517
740637
|
return (source) => {
|
|
740518
|
-
let [state, refCount4, connection, scheduler] = [0, 0,
|
|
740519
|
-
return new
|
|
740638
|
+
let [state, refCount4, connection, scheduler] = [0, 0, import_rxjs45.Subscription.EMPTY, import_rxjs45.Subscription.EMPTY];
|
|
740639
|
+
return new import_rxjs45.Observable((ob) => {
|
|
740520
740640
|
source.subscribe(ob);
|
|
740521
740641
|
if (refCount4++ === 0) {
|
|
740522
740642
|
if (state === 1) {
|
|
@@ -740533,7 +740653,7 @@ function refCountDelay(delay12 = 1750) {
|
|
|
740533
740653
|
scheduler.unsubscribe();
|
|
740534
740654
|
} else {
|
|
740535
740655
|
state = 1;
|
|
740536
|
-
scheduler =
|
|
740656
|
+
scheduler = import_rxjs45.asapScheduler.schedule(() => {
|
|
740537
740657
|
state = 0;
|
|
740538
740658
|
connection.unsubscribe();
|
|
740539
740659
|
}, delay12);
|
|
@@ -740555,19 +740675,19 @@ function NOOP() {
|
|
|
740555
740675
|
}
|
|
740556
740676
|
function drr({ delay: delay12, skipChange = false, skipTimeout = false } = {}) {
|
|
740557
740677
|
return (source$) => source$.pipe(
|
|
740558
|
-
(0,
|
|
740559
|
-
skipChange ? (0,
|
|
740678
|
+
(0, import_rxjs46.catchError)(ERR),
|
|
740679
|
+
skipChange ? (0, import_rxjs46.tap)(NOOP) : (0, import_rxjs46.distinctUntilChanged)(CMP),
|
|
740560
740680
|
// eslint-disable-next-line deprecation/deprecation
|
|
740561
|
-
(0,
|
|
740562
|
-
skipTimeout ? (0,
|
|
740681
|
+
(0, import_rxjs46.publishReplay)(1),
|
|
740682
|
+
skipTimeout ? (0, import_rxjs46.refCount)() : refCountDelay(delay12)
|
|
740563
740683
|
);
|
|
740564
740684
|
}
|
|
740565
740685
|
|
|
740566
740686
|
// ../../node_modules/.pnpm/@polkadot+rpc-core@11.2.1/node_modules/@polkadot/rpc-core/util/memo.js
|
|
740567
|
-
var
|
|
740687
|
+
var import_rxjs47 = require("rxjs");
|
|
740568
740688
|
function memo2(instanceId, inner) {
|
|
740569
740689
|
const options22 = { getInstanceId: () => instanceId };
|
|
740570
|
-
const cached2 = memoize2((...params) => new
|
|
740690
|
+
const cached2 = memoize2((...params) => new import_rxjs47.Observable((observer) => {
|
|
740571
740691
|
const subscription = inner(...params).subscribe(observer);
|
|
740572
740692
|
return () => {
|
|
740573
740693
|
cached2.unmemoize(...params);
|
|
@@ -740717,7 +740837,7 @@ var RpcCore = class {
|
|
|
740717
740837
|
};
|
|
740718
740838
|
const creator = (isScale) => (...values) => {
|
|
740719
740839
|
const isDelayed = isScale && hashIndex !== -1 && !!values[hashIndex];
|
|
740720
|
-
return new
|
|
740840
|
+
return new import_rxjs48.Observable((observer) => {
|
|
740721
740841
|
callWithRegistry(isScale, values).then((value5) => {
|
|
740722
740842
|
observer.next(value5);
|
|
740723
740843
|
observer.complete();
|
|
@@ -740735,9 +740855,9 @@ var RpcCore = class {
|
|
|
740735
740855
|
};
|
|
740736
740856
|
}).pipe(
|
|
740737
740857
|
// eslint-disable-next-line deprecation/deprecation
|
|
740738
|
-
(0,
|
|
740858
|
+
(0, import_rxjs48.publishReplay)(1),
|
|
740739
740859
|
// create a Replay(1)
|
|
740740
|
-
isDelayed ? refCountDelay() : (0,
|
|
740860
|
+
isDelayed ? refCountDelay() : (0, import_rxjs48.refCount)()
|
|
740741
740861
|
);
|
|
740742
740862
|
};
|
|
740743
740863
|
memoized3 = this._memomize(creator, def);
|
|
@@ -740759,7 +740879,7 @@ var RpcCore = class {
|
|
|
740759
740879
|
const subType = `${section2}_${updateType}`;
|
|
740760
740880
|
let memoized3 = null;
|
|
740761
740881
|
const creator = (isScale) => (...values) => {
|
|
740762
|
-
return new
|
|
740882
|
+
return new import_rxjs48.Observable((observer) => {
|
|
740763
740883
|
let subscriptionPromise = Promise.resolve(null);
|
|
740764
740884
|
const registry = this.__internal__registryDefault;
|
|
740765
740885
|
const errorHandler = (error) => {
|
|
@@ -740929,9 +741049,9 @@ function setDeriveCache(prefix3 = "", cache9) {
|
|
|
740929
741049
|
setDeriveCache();
|
|
740930
741050
|
|
|
740931
741051
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/util/first.js
|
|
740932
|
-
var
|
|
741052
|
+
var import_rxjs49 = require("rxjs");
|
|
740933
741053
|
function firstObservable(obs) {
|
|
740934
|
-
return obs.pipe((0,
|
|
741054
|
+
return obs.pipe((0, import_rxjs49.map)(([a72]) => a72));
|
|
740935
741055
|
}
|
|
740936
741056
|
function firstMemo(fn3) {
|
|
740937
741057
|
return (instanceId, api7) => memo2(instanceId, (...args3) => firstObservable(fn3(api7, ...args3)));
|
|
@@ -740960,20 +741080,20 @@ __export(accounts_exports, {
|
|
|
740960
741080
|
});
|
|
740961
741081
|
|
|
740962
741082
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/accounts/accountId.js
|
|
740963
|
-
var
|
|
741083
|
+
var import_rxjs50 = require("rxjs");
|
|
740964
741084
|
function accountId(instanceId, api7) {
|
|
740965
741085
|
return memo2(instanceId, (address4) => {
|
|
740966
741086
|
const decoded = isU8a(address4) ? address4 : decodeAddress2((address4 || "").toString());
|
|
740967
741087
|
if (decoded.length > 8) {
|
|
740968
|
-
return (0,
|
|
741088
|
+
return (0, import_rxjs50.of)(api7.registry.createType("AccountId", decoded));
|
|
740969
741089
|
}
|
|
740970
741090
|
const accountIndex = api7.registry.createType("AccountIndex", decoded);
|
|
740971
|
-
return api7.derive.accounts.indexToId(accountIndex.toString()).pipe((0,
|
|
741091
|
+
return api7.derive.accounts.indexToId(accountIndex.toString()).pipe((0, import_rxjs50.map)((a72) => assertReturn(a72, "Unable to retrieve accountId")));
|
|
740972
741092
|
});
|
|
740973
741093
|
}
|
|
740974
741094
|
|
|
740975
741095
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/accounts/flags.js
|
|
740976
|
-
var
|
|
741096
|
+
var import_rxjs51 = require("rxjs");
|
|
740977
741097
|
function parseFlags(address4, [electionsMembers, councilMembers, technicalCommitteeMembers, societyMembers, sudoKey]) {
|
|
740978
741098
|
const addrStr = address4?.toString();
|
|
740979
741099
|
const isIncluded = (id5) => id5.toString() === addrStr;
|
|
@@ -740996,9 +741116,9 @@ function _flags(instanceId, api7) {
|
|
|
740996
741116
|
];
|
|
740997
741117
|
const filtered = calls.filter((c63) => c63);
|
|
740998
741118
|
if (!filtered.length) {
|
|
740999
|
-
return (0,
|
|
741119
|
+
return (0, import_rxjs51.of)(results2);
|
|
741000
741120
|
}
|
|
741001
|
-
return api7.queryMulti(filtered).pipe((0,
|
|
741121
|
+
return api7.queryMulti(filtered).pipe((0, import_rxjs51.map)((values) => {
|
|
741002
741122
|
let resultIndex = -1;
|
|
741003
741123
|
for (let i87 = 0, count = calls.length; i87 < count; i87++) {
|
|
741004
741124
|
if (isFunction3(calls[i87])) {
|
|
@@ -741010,29 +741130,29 @@ function _flags(instanceId, api7) {
|
|
|
741010
741130
|
});
|
|
741011
741131
|
}
|
|
741012
741132
|
function flags(instanceId, api7) {
|
|
741013
|
-
return memo2(instanceId, (address4) => api7.derive.accounts._flags().pipe((0,
|
|
741133
|
+
return memo2(instanceId, (address4) => api7.derive.accounts._flags().pipe((0, import_rxjs51.map)((r37) => parseFlags(address4, r37))));
|
|
741014
741134
|
}
|
|
741015
741135
|
|
|
741016
741136
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/accounts/idAndIndex.js
|
|
741017
|
-
var
|
|
741137
|
+
var import_rxjs52 = require("rxjs");
|
|
741018
741138
|
function idAndIndex(instanceId, api7) {
|
|
741019
741139
|
return memo2(instanceId, (address4) => {
|
|
741020
741140
|
try {
|
|
741021
741141
|
const decoded = isU8a(address4) ? address4 : decodeAddress2((address4 || "").toString());
|
|
741022
741142
|
if (decoded.length > 8) {
|
|
741023
741143
|
const accountId2 = api7.registry.createType("AccountId", decoded);
|
|
741024
|
-
return api7.derive.accounts.idToIndex(accountId2).pipe((0,
|
|
741144
|
+
return api7.derive.accounts.idToIndex(accountId2).pipe((0, import_rxjs52.map)((accountIndex2) => [accountId2, accountIndex2]));
|
|
741025
741145
|
}
|
|
741026
741146
|
const accountIndex = api7.registry.createType("AccountIndex", decoded);
|
|
741027
|
-
return api7.derive.accounts.indexToId(accountIndex.toString()).pipe((0,
|
|
741147
|
+
return api7.derive.accounts.indexToId(accountIndex.toString()).pipe((0, import_rxjs52.map)((accountId2) => [accountId2, accountIndex]));
|
|
741028
741148
|
} catch {
|
|
741029
|
-
return (0,
|
|
741149
|
+
return (0, import_rxjs52.of)([void 0, void 0]);
|
|
741030
741150
|
}
|
|
741031
741151
|
});
|
|
741032
741152
|
}
|
|
741033
741153
|
|
|
741034
741154
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/accounts/identity.js
|
|
741035
|
-
var
|
|
741155
|
+
var import_rxjs53 = require("rxjs");
|
|
741036
741156
|
var UNDEF_HEX = { toHex: () => void 0 };
|
|
741037
741157
|
function dataAsString(data6) {
|
|
741038
741158
|
if (!data6) {
|
|
@@ -741080,31 +741200,31 @@ function extractIdentity(identityOfOpt, superOf) {
|
|
|
741080
741200
|
}
|
|
741081
741201
|
function getParent(api7, identityOfOpt, superOfOpt) {
|
|
741082
741202
|
if (identityOfOpt?.isSome) {
|
|
741083
|
-
return (0,
|
|
741203
|
+
return (0, import_rxjs53.of)([identityOfOpt, void 0]);
|
|
741084
741204
|
} else if (superOfOpt?.isSome) {
|
|
741085
741205
|
const superOf = superOfOpt.unwrap();
|
|
741086
|
-
return (0,
|
|
741087
|
-
api7.derive.accounts._identity(superOf[0]).pipe((0,
|
|
741088
|
-
(0,
|
|
741206
|
+
return (0, import_rxjs53.combineLatest)([
|
|
741207
|
+
api7.derive.accounts._identity(superOf[0]).pipe((0, import_rxjs53.map)(([info6]) => info6)),
|
|
741208
|
+
(0, import_rxjs53.of)(superOf)
|
|
741089
741209
|
]);
|
|
741090
741210
|
}
|
|
741091
|
-
return (0,
|
|
741211
|
+
return (0, import_rxjs53.of)([void 0, void 0]);
|
|
741092
741212
|
}
|
|
741093
741213
|
function _identity(instanceId, api7) {
|
|
741094
|
-
return memo2(instanceId, (accountId2) => accountId2 && api7.query.identity?.identityOf ? (0,
|
|
741214
|
+
return memo2(instanceId, (accountId2) => accountId2 && api7.query.identity?.identityOf ? (0, import_rxjs53.combineLatest)([
|
|
741095
741215
|
api7.query.identity.identityOf(accountId2),
|
|
741096
741216
|
api7.query.identity.superOf(accountId2)
|
|
741097
|
-
]) : (0,
|
|
741217
|
+
]) : (0, import_rxjs53.of)([void 0, void 0]));
|
|
741098
741218
|
}
|
|
741099
741219
|
function identity5(instanceId, api7) {
|
|
741100
|
-
return memo2(instanceId, (accountId2) => api7.derive.accounts._identity(accountId2).pipe((0,
|
|
741220
|
+
return memo2(instanceId, (accountId2) => api7.derive.accounts._identity(accountId2).pipe((0, import_rxjs53.switchMap)(([identityOfOpt, superOfOpt]) => getParent(api7, identityOfOpt, superOfOpt)), (0, import_rxjs53.map)(([identityOfOpt, superOf]) => extractIdentity(identityOfOpt, superOf))));
|
|
741101
741221
|
}
|
|
741102
741222
|
var hasIdentity = /* @__PURE__ */ firstMemo((api7, accountId2) => api7.derive.accounts.hasIdentityMulti([accountId2]));
|
|
741103
741223
|
function hasIdentityMulti(instanceId, api7) {
|
|
741104
|
-
return memo2(instanceId, (accountIds) => api7.query.identity?.identityOf ? (0,
|
|
741224
|
+
return memo2(instanceId, (accountIds) => api7.query.identity?.identityOf ? (0, import_rxjs53.combineLatest)([
|
|
741105
741225
|
api7.query.identity.identityOf.multi(accountIds),
|
|
741106
741226
|
api7.query.identity.superOf.multi(accountIds)
|
|
741107
|
-
]).pipe((0,
|
|
741227
|
+
]).pipe((0, import_rxjs53.map)(([identities, supers]) => identities.map((identityOfOpt, index) => {
|
|
741108
741228
|
const superOfOpt = supers[index];
|
|
741109
741229
|
const parentId = superOfOpt && superOfOpt.isSome ? superOfOpt.unwrap()[0].toString() : void 0;
|
|
741110
741230
|
let display;
|
|
@@ -741115,20 +741235,20 @@ function hasIdentityMulti(instanceId, api7) {
|
|
|
741115
741235
|
}
|
|
741116
741236
|
}
|
|
741117
741237
|
return { display, hasIdentity: !!(display || parentId), parentId };
|
|
741118
|
-
}))) : (0,
|
|
741238
|
+
}))) : (0, import_rxjs53.of)(accountIds.map(() => ({ hasIdentity: false }))));
|
|
741119
741239
|
}
|
|
741120
741240
|
|
|
741121
741241
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/accounts/idToIndex.js
|
|
741122
|
-
var
|
|
741242
|
+
var import_rxjs54 = require("rxjs");
|
|
741123
741243
|
function idToIndex(instanceId, api7) {
|
|
741124
|
-
return memo2(instanceId, (accountId2) => api7.derive.accounts.indexes().pipe((0,
|
|
741244
|
+
return memo2(instanceId, (accountId2) => api7.derive.accounts.indexes().pipe((0, import_rxjs54.map)((indexes3) => indexes3[accountId2.toString()])));
|
|
741125
741245
|
}
|
|
741126
741246
|
|
|
741127
741247
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/accounts/indexes.js
|
|
741128
|
-
var
|
|
741248
|
+
var import_rxjs55 = require("rxjs");
|
|
741129
741249
|
var indicesCache = null;
|
|
741130
741250
|
function queryAccounts(api7) {
|
|
741131
|
-
return api7.query.indices.accounts.entries().pipe((0,
|
|
741251
|
+
return api7.query.indices.accounts.entries().pipe((0, import_rxjs55.map)((entries) => entries.reduce((indexes3, [key2, idOpt]) => {
|
|
741132
741252
|
if (idOpt.isSome) {
|
|
741133
741253
|
indexes3[idOpt.unwrap()[0].toString()] = api7.registry.createType("AccountIndex", key2.args[0]);
|
|
741134
741254
|
}
|
|
@@ -741136,29 +741256,29 @@ function queryAccounts(api7) {
|
|
|
741136
741256
|
}, {})));
|
|
741137
741257
|
}
|
|
741138
741258
|
function indexes(instanceId, api7) {
|
|
741139
|
-
return memo2(instanceId, () => indicesCache ? (0,
|
|
741259
|
+
return memo2(instanceId, () => indicesCache ? (0, import_rxjs55.of)(indicesCache) : (api7.query.indices ? queryAccounts(api7).pipe((0, import_rxjs55.startWith)({})) : (0, import_rxjs55.of)({})).pipe((0, import_rxjs55.map)((indices) => {
|
|
741140
741260
|
indicesCache = indices;
|
|
741141
741261
|
return indices;
|
|
741142
741262
|
})));
|
|
741143
741263
|
}
|
|
741144
741264
|
|
|
741145
741265
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/accounts/indexToId.js
|
|
741146
|
-
var
|
|
741266
|
+
var import_rxjs56 = require("rxjs");
|
|
741147
741267
|
function indexToId(instanceId, api7) {
|
|
741148
|
-
return memo2(instanceId, (accountIndex) => api7.query.indices ? api7.query.indices.accounts(accountIndex).pipe((0,
|
|
741268
|
+
return memo2(instanceId, (accountIndex) => api7.query.indices ? api7.query.indices.accounts(accountIndex).pipe((0, import_rxjs56.map)((optResult) => optResult.unwrapOr([])[0])) : (0, import_rxjs56.of)(void 0));
|
|
741149
741269
|
}
|
|
741150
741270
|
|
|
741151
741271
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/accounts/info.js
|
|
741152
|
-
var
|
|
741272
|
+
var import_rxjs57 = require("rxjs");
|
|
741153
741273
|
function retrieveNick(api7, accountId2) {
|
|
741154
|
-
return (accountId2 && api7.query["nicks"]?.["nameOf"] ? api7.query["nicks"]["nameOf"](accountId2) : (0,
|
|
741274
|
+
return (accountId2 && api7.query["nicks"]?.["nameOf"] ? api7.query["nicks"]["nameOf"](accountId2) : (0, import_rxjs57.of)(void 0)).pipe((0, import_rxjs57.map)((nameOf) => nameOf?.isSome ? u8aToString(nameOf.unwrap()[0]).substring(0, api7.consts["nicks"]["maxLength"].toNumber()) : void 0));
|
|
741155
741275
|
}
|
|
741156
741276
|
function info(instanceId, api7) {
|
|
741157
|
-
return memo2(instanceId, (address4) => api7.derive.accounts.idAndIndex(address4).pipe((0,
|
|
741158
|
-
(0,
|
|
741277
|
+
return memo2(instanceId, (address4) => api7.derive.accounts.idAndIndex(address4).pipe((0, import_rxjs57.switchMap)(([accountId2, accountIndex]) => (0, import_rxjs57.combineLatest)([
|
|
741278
|
+
(0, import_rxjs57.of)({ accountId: accountId2, accountIndex }),
|
|
741159
741279
|
api7.derive.accounts.identity(accountId2),
|
|
741160
741280
|
retrieveNick(api7, accountId2)
|
|
741161
|
-
])), (0,
|
|
741281
|
+
])), (0, import_rxjs57.map)(([{ accountId: accountId2, accountIndex }, identity6, nickname]) => ({
|
|
741162
741282
|
accountId: accountId2,
|
|
741163
741283
|
accountIndex,
|
|
741164
741284
|
identity: identity6,
|
|
@@ -741179,7 +741299,7 @@ __export(alliance_exports, {
|
|
|
741179
741299
|
});
|
|
741180
741300
|
|
|
741181
741301
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/collective/helpers.js
|
|
741182
|
-
var
|
|
741302
|
+
var import_rxjs58 = require("rxjs");
|
|
741183
741303
|
function getInstance(api7, section2) {
|
|
741184
741304
|
const instances = api7.registry.getModuleInstances(api7.runtimeVersion.specName, section2);
|
|
741185
741305
|
const name3 = instances?.length ? instances[0] : section2;
|
|
@@ -741189,20 +741309,20 @@ function withSection(section2, fn3) {
|
|
|
741189
741309
|
return (instanceId, api7) => memo2(instanceId, fn3(getInstance(api7, section2), api7, instanceId));
|
|
741190
741310
|
}
|
|
741191
741311
|
function callMethod(method2, empty5) {
|
|
741192
|
-
return (section2) => withSection(section2, (query3) => () => isFunction3(query3?.[method2]) ? query3[method2]() : (0,
|
|
741312
|
+
return (section2) => withSection(section2, (query3) => () => isFunction3(query3?.[method2]) ? query3[method2]() : (0, import_rxjs58.of)(empty5));
|
|
741193
741313
|
}
|
|
741194
741314
|
|
|
741195
741315
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/collective/members.js
|
|
741196
741316
|
var members = /* @__PURE__ */ callMethod("members", []);
|
|
741197
741317
|
|
|
741198
741318
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/collective/prime.js
|
|
741199
|
-
var
|
|
741319
|
+
var import_rxjs59 = require("rxjs");
|
|
741200
741320
|
function prime(section2) {
|
|
741201
|
-
return withSection(section2, (query3) => () => isFunction3(query3?.prime) ? query3.prime().pipe((0,
|
|
741321
|
+
return withSection(section2, (query3) => () => isFunction3(query3?.prime) ? query3.prime().pipe((0, import_rxjs59.map)((o51) => o51.unwrapOr(null))) : (0, import_rxjs59.of)(null));
|
|
741202
741322
|
}
|
|
741203
741323
|
|
|
741204
741324
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/collective/proposals.js
|
|
741205
|
-
var
|
|
741325
|
+
var import_rxjs60 = require("rxjs");
|
|
741206
741326
|
function parse6(api7, [hashes2, proposals8, votes2]) {
|
|
741207
741327
|
return proposals8.map((o51, index) => ({
|
|
741208
741328
|
hash: api7.registry.createType("Hash", hashes2[index]),
|
|
@@ -741211,23 +741331,23 @@ function parse6(api7, [hashes2, proposals8, votes2]) {
|
|
|
741211
741331
|
}));
|
|
741212
741332
|
}
|
|
741213
741333
|
function _proposalsFrom(api7, query3, hashes2) {
|
|
741214
|
-
return (isFunction3(query3?.proposals) && hashes2.length ? (0,
|
|
741215
|
-
(0,
|
|
741334
|
+
return (isFunction3(query3?.proposals) && hashes2.length ? (0, import_rxjs60.combineLatest)([
|
|
741335
|
+
(0, import_rxjs60.of)(hashes2),
|
|
741216
741336
|
// this should simply be api.query[section].proposalOf.multi<Option<Proposal>>(hashes),
|
|
741217
741337
|
// however we have had cases on Edgeware where the indices have moved around after an
|
|
741218
741338
|
// upgrade, which results in invalid on-chain data
|
|
741219
|
-
query3.proposalOf.multi(hashes2).pipe((0,
|
|
741339
|
+
query3.proposalOf.multi(hashes2).pipe((0, import_rxjs60.catchError)(() => (0, import_rxjs60.of)(hashes2.map(() => null)))),
|
|
741220
741340
|
query3.voting.multi(hashes2)
|
|
741221
|
-
]) : (0,
|
|
741341
|
+
]) : (0, import_rxjs60.of)([[], [], []])).pipe((0, import_rxjs60.map)((r37) => parse6(api7, r37)));
|
|
741222
741342
|
}
|
|
741223
741343
|
function hasProposals(section2) {
|
|
741224
|
-
return withSection(section2, (query3) => () => (0,
|
|
741344
|
+
return withSection(section2, (query3) => () => (0, import_rxjs60.of)(isFunction3(query3?.proposals)));
|
|
741225
741345
|
}
|
|
741226
741346
|
function proposals(section2) {
|
|
741227
|
-
return withSection(section2, (query3, api7) => () => api7.derive[section2].proposalHashes().pipe((0,
|
|
741347
|
+
return withSection(section2, (query3, api7) => () => api7.derive[section2].proposalHashes().pipe((0, import_rxjs60.switchMap)((all8) => _proposalsFrom(api7, query3, all8))));
|
|
741228
741348
|
}
|
|
741229
741349
|
function proposal(section2) {
|
|
741230
|
-
return withSection(section2, (query3, api7) => (hash12) => isFunction3(query3?.proposals) ? firstObservable(_proposalsFrom(api7, query3, [hash12])) : (0,
|
|
741350
|
+
return withSection(section2, (query3, api7) => (hash12) => isFunction3(query3?.proposals) ? firstObservable(_proposalsFrom(api7, query3, [hash12])) : (0, import_rxjs60.of)(null));
|
|
741231
741351
|
}
|
|
741232
741352
|
var proposalCount = /* @__PURE__ */ callMethod("proposalCount", null);
|
|
741233
741353
|
var proposalHashes = /* @__PURE__ */ callMethod("proposals", []);
|
|
@@ -741253,7 +741373,7 @@ __export(bagsList_exports, {
|
|
|
741253
741373
|
});
|
|
741254
741374
|
|
|
741255
741375
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/bagsList/get.js
|
|
741256
|
-
var
|
|
741376
|
+
var import_rxjs61 = require("rxjs");
|
|
741257
741377
|
|
|
741258
741378
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/bagsList/util.js
|
|
741259
741379
|
function getQueryInterface(api7) {
|
|
@@ -741282,45 +741402,45 @@ function _getIds(instanceId, api7) {
|
|
|
741282
741402
|
const query3 = getQueryInterface(api7);
|
|
741283
741403
|
return memo2(instanceId, (_ids) => {
|
|
741284
741404
|
const ids = _ids.map((id5) => bnToBn(id5));
|
|
741285
|
-
return ids.length ? query3.listBags.multi(ids).pipe((0,
|
|
741405
|
+
return ids.length ? query3.listBags.multi(ids).pipe((0, import_rxjs61.map)((bags) => orderBags(ids, bags))) : (0, import_rxjs61.of)([]);
|
|
741286
741406
|
});
|
|
741287
741407
|
}
|
|
741288
741408
|
function all6(instanceId, api7) {
|
|
741289
741409
|
const query3 = getQueryInterface(api7);
|
|
741290
|
-
return memo2(instanceId, () => query3.listBags.keys().pipe((0,
|
|
741410
|
+
return memo2(instanceId, () => query3.listBags.keys().pipe((0, import_rxjs61.switchMap)((keys2) => api7.derive.bagsList._getIds(keys2.map(({ args: [id5] }) => id5))), (0, import_rxjs61.map)((list2) => list2.filter(({ bag }) => bag))));
|
|
741291
741411
|
}
|
|
741292
741412
|
function get5(instanceId, api7) {
|
|
741293
|
-
return memo2(instanceId, (id5) => api7.derive.bagsList._getIds([bnToBn(id5)]).pipe((0,
|
|
741413
|
+
return memo2(instanceId, (id5) => api7.derive.bagsList._getIds([bnToBn(id5)]).pipe((0, import_rxjs61.map)((bags) => bags[0])));
|
|
741294
741414
|
}
|
|
741295
741415
|
|
|
741296
741416
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/bagsList/getExpanded.js
|
|
741297
|
-
var
|
|
741417
|
+
var import_rxjs62 = require("rxjs");
|
|
741298
741418
|
function expand(instanceId, api7) {
|
|
741299
|
-
return memo2(instanceId, (bag) => api7.derive.bagsList.listNodes(bag.bag).pipe((0,
|
|
741419
|
+
return memo2(instanceId, (bag) => api7.derive.bagsList.listNodes(bag.bag).pipe((0, import_rxjs62.map)((nodes) => objectSpread({ nodes }, bag))));
|
|
741300
741420
|
}
|
|
741301
741421
|
function getExpanded(instanceId, api7) {
|
|
741302
|
-
return memo2(instanceId, (id5) => api7.derive.bagsList.get(id5).pipe((0,
|
|
741422
|
+
return memo2(instanceId, (id5) => api7.derive.bagsList.get(id5).pipe((0, import_rxjs62.switchMap)((bag) => api7.derive.bagsList.expand(bag))));
|
|
741303
741423
|
}
|
|
741304
741424
|
|
|
741305
741425
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/bagsList/listNodes.js
|
|
741306
|
-
var
|
|
741426
|
+
var import_rxjs63 = require("rxjs");
|
|
741307
741427
|
function traverseLinks(api7, head2) {
|
|
741308
|
-
const subject = new
|
|
741428
|
+
const subject = new import_rxjs63.BehaviorSubject(head2);
|
|
741309
741429
|
const query3 = getQueryInterface(api7);
|
|
741310
741430
|
return subject.pipe(
|
|
741311
|
-
(0,
|
|
741312
|
-
(0,
|
|
741431
|
+
(0, import_rxjs63.switchMap)((account3) => query3.listNodes(account3)),
|
|
741432
|
+
(0, import_rxjs63.tap)((node3) => {
|
|
741313
741433
|
nextTick2(() => {
|
|
741314
741434
|
node3.isSome && node3.value.next.isSome ? subject.next(node3.unwrap().next.unwrap()) : subject.complete();
|
|
741315
741435
|
});
|
|
741316
741436
|
}),
|
|
741317
|
-
(0,
|
|
741437
|
+
(0, import_rxjs63.toArray)(),
|
|
741318
741438
|
// toArray since we want to startSubject to be completed
|
|
741319
|
-
(0,
|
|
741439
|
+
(0, import_rxjs63.map)((all8) => all8.map((o51) => o51.unwrap()))
|
|
741320
741440
|
);
|
|
741321
741441
|
}
|
|
741322
741442
|
function listNodes(instanceId, api7) {
|
|
741323
|
-
return memo2(instanceId, (bag) => bag && bag.head.isSome ? traverseLinks(api7, bag.head.unwrap()) : (0,
|
|
741443
|
+
return memo2(instanceId, (bag) => bag && bag.head.isSome ? traverseLinks(api7, bag.head.unwrap()) : (0, import_rxjs63.of)([]));
|
|
741324
741444
|
}
|
|
741325
741445
|
|
|
741326
741446
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/balances/index.js
|
|
@@ -741333,7 +741453,7 @@ __export(balances_exports, {
|
|
|
741333
741453
|
});
|
|
741334
741454
|
|
|
741335
741455
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/balances/all.js
|
|
741336
|
-
var
|
|
741456
|
+
var import_rxjs64 = require("rxjs");
|
|
741337
741457
|
var VESTING_ID = "0x76657374696e6720";
|
|
741338
741458
|
function calcLocked(api7, bestNumber2, locks2) {
|
|
741339
741459
|
let lockedBalance = api7.registry.createType("Balance");
|
|
@@ -741391,10 +741511,10 @@ function calcBalances(api7, result2) {
|
|
|
741391
741511
|
});
|
|
741392
741512
|
}
|
|
741393
741513
|
function queryOld(api7, accountId2) {
|
|
741394
|
-
return (0,
|
|
741514
|
+
return (0, import_rxjs64.combineLatest)([
|
|
741395
741515
|
api7.query.balances.locks(accountId2),
|
|
741396
741516
|
api7.query.balances["vesting"](accountId2)
|
|
741397
|
-
]).pipe((0,
|
|
741517
|
+
]).pipe((0, import_rxjs64.map)(([locks2, optVesting]) => {
|
|
741398
741518
|
let vestingNew = null;
|
|
741399
741519
|
if (optVesting.isSome) {
|
|
741400
741520
|
const { offset: locked7, perBlock, startingBlock } = optVesting.unwrap();
|
|
@@ -741417,11 +741537,11 @@ function createCalls(calls) {
|
|
|
741417
741537
|
function queryCurrent(api7, accountId2, balanceInstances = ["balances"]) {
|
|
741418
741538
|
const [lockEmpty, lockQueries] = createCalls(balanceInstances.map((m57) => api7.derive[m57]?.customLocks || api7.query[m57]?.locks));
|
|
741419
741539
|
const [reserveEmpty, reserveQueries] = createCalls(balanceInstances.map((m57) => api7.query[m57]?.reserves));
|
|
741420
|
-
return (0,
|
|
741421
|
-
api7.query.vesting?.vesting ? api7.query.vesting.vesting(accountId2) : (0,
|
|
741422
|
-
lockQueries.length ? (0,
|
|
741423
|
-
reserveQueries.length ? (0,
|
|
741424
|
-
]).pipe((0,
|
|
741540
|
+
return (0, import_rxjs64.combineLatest)([
|
|
741541
|
+
api7.query.vesting?.vesting ? api7.query.vesting.vesting(accountId2) : (0, import_rxjs64.of)(api7.registry.createType("Option<VestingInfo>")),
|
|
741542
|
+
lockQueries.length ? (0, import_rxjs64.combineLatest)(lockQueries.map((c63) => c63(accountId2))) : (0, import_rxjs64.of)([]),
|
|
741543
|
+
reserveQueries.length ? (0, import_rxjs64.combineLatest)(reserveQueries.map((c63) => c63(accountId2))) : (0, import_rxjs64.of)([])
|
|
741544
|
+
]).pipe((0, import_rxjs64.map)(([opt, locks2, reserves]) => {
|
|
741425
741545
|
let offsetLock = -1;
|
|
741426
741546
|
let offsetReserve = -1;
|
|
741427
741547
|
const vesting = opt.unwrapOr(null);
|
|
@@ -741434,18 +741554,18 @@ function queryCurrent(api7, accountId2, balanceInstances = ["balances"]) {
|
|
|
741434
741554
|
}
|
|
741435
741555
|
function all7(instanceId, api7) {
|
|
741436
741556
|
const balanceInstances = api7.registry.getModuleInstances(api7.runtimeVersion.specName, "balances");
|
|
741437
|
-
return memo2(instanceId, (address4) => (0,
|
|
741557
|
+
return memo2(instanceId, (address4) => (0, import_rxjs64.combineLatest)([
|
|
741438
741558
|
api7.derive.balances.account(address4),
|
|
741439
741559
|
isFunction3(api7.query.system?.account) || isFunction3(api7.query.balances?.account) ? queryCurrent(api7, address4, balanceInstances) : queryOld(api7, address4)
|
|
741440
|
-
]).pipe((0,
|
|
741441
|
-
(0,
|
|
741442
|
-
(0,
|
|
741560
|
+
]).pipe((0, import_rxjs64.switchMap)(([account3, locks2]) => (0, import_rxjs64.combineLatest)([
|
|
741561
|
+
(0, import_rxjs64.of)(account3),
|
|
741562
|
+
(0, import_rxjs64.of)(locks2),
|
|
741443
741563
|
api7.derive.chain.bestNumber()
|
|
741444
|
-
])), (0,
|
|
741564
|
+
])), (0, import_rxjs64.map)((result2) => calcBalances(api7, result2))));
|
|
741445
741565
|
}
|
|
741446
741566
|
|
|
741447
741567
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/balances/account.js
|
|
741448
|
-
var
|
|
741568
|
+
var import_rxjs65 = require("rxjs");
|
|
741449
741569
|
function zeroBalance(api7) {
|
|
741450
741570
|
return api7.registry.createType("Balance");
|
|
741451
741571
|
}
|
|
@@ -741467,11 +741587,11 @@ function calcBalances2(api7, [accountId2, [accountNonce, [primary, ...additional
|
|
|
741467
741587
|
}, getBalance(api7, primary));
|
|
741468
741588
|
}
|
|
741469
741589
|
function queryBalancesFree(api7, accountId2) {
|
|
741470
|
-
return (0,
|
|
741590
|
+
return (0, import_rxjs65.combineLatest)([
|
|
741471
741591
|
api7.query.balances["freeBalance"](accountId2),
|
|
741472
741592
|
api7.query.balances["reservedBalance"](accountId2),
|
|
741473
741593
|
api7.query.system["accountNonce"](accountId2)
|
|
741474
|
-
]).pipe((0,
|
|
741594
|
+
]).pipe((0, import_rxjs65.map)(([freeBalance, reservedBalance, accountNonce]) => [
|
|
741475
741595
|
accountNonce,
|
|
741476
741596
|
[[freeBalance, reservedBalance, zeroBalance(api7), zeroBalance(api7)]]
|
|
741477
741597
|
]));
|
|
@@ -741481,7 +741601,7 @@ function queryNonceOnly(api7, accountId2) {
|
|
|
741481
741601
|
nonce,
|
|
741482
741602
|
[[zeroBalance(api7), zeroBalance(api7), zeroBalance(api7), zeroBalance(api7)]]
|
|
741483
741603
|
];
|
|
741484
|
-
return isFunction3(api7.query.system.account) ? api7.query.system.account(accountId2).pipe((0,
|
|
741604
|
+
return isFunction3(api7.query.system.account) ? api7.query.system.account(accountId2).pipe((0, import_rxjs65.map)(({ nonce }) => fill(nonce))) : isFunction3(api7.query.system["accountNonce"]) ? api7.query.system["accountNonce"](accountId2).pipe((0, import_rxjs65.map)((nonce) => fill(nonce))) : (0, import_rxjs65.of)(fill(api7.registry.createType("Index")));
|
|
741485
741605
|
}
|
|
741486
741606
|
function queryBalancesAccount(api7, accountId2, modules3 = ["balances"]) {
|
|
741487
741607
|
const balances = modules3.map((m57) => api7.derive[m57]?.customAccount || api7.query[m57]?.account).filter((q8) => isFunction3(q8));
|
|
@@ -741489,16 +741609,16 @@ function queryBalancesAccount(api7, accountId2, modules3 = ["balances"]) {
|
|
|
741489
741609
|
nonce,
|
|
741490
741610
|
data6.map(({ feeFrozen, free, miscFrozen, reserved }) => [free, reserved, feeFrozen, miscFrozen])
|
|
741491
741611
|
];
|
|
741492
|
-
return balances.length ? isFunction3(api7.query.system.account) ? (0,
|
|
741612
|
+
return balances.length ? isFunction3(api7.query.system.account) ? (0, import_rxjs65.combineLatest)([
|
|
741493
741613
|
api7.query.system.account(accountId2),
|
|
741494
741614
|
...balances.map((c63) => c63(accountId2))
|
|
741495
|
-
]).pipe((0,
|
|
741615
|
+
]).pipe((0, import_rxjs65.map)(([{ nonce }, ...balances2]) => extract2(nonce, balances2))) : (0, import_rxjs65.combineLatest)([
|
|
741496
741616
|
api7.query.system["accountNonce"](accountId2),
|
|
741497
741617
|
...balances.map((c63) => c63(accountId2))
|
|
741498
|
-
]).pipe((0,
|
|
741618
|
+
]).pipe((0, import_rxjs65.map)(([nonce, ...balances2]) => extract2(nonce, balances2))) : queryNonceOnly(api7, accountId2);
|
|
741499
741619
|
}
|
|
741500
741620
|
function querySystemAccount(api7, accountId2) {
|
|
741501
|
-
return api7.query.system.account(accountId2).pipe((0,
|
|
741621
|
+
return api7.query.system.account(accountId2).pipe((0, import_rxjs65.map)((infoOrTuple) => {
|
|
741502
741622
|
const data6 = infoOrTuple.nonce ? infoOrTuple.data : infoOrTuple[1];
|
|
741503
741623
|
const nonce = infoOrTuple.nonce || infoOrTuple[0];
|
|
741504
741624
|
if (!data6 || data6.isEmpty) {
|
|
@@ -741517,19 +741637,19 @@ function querySystemAccount(api7, accountId2) {
|
|
|
741517
741637
|
function account(instanceId, api7) {
|
|
741518
741638
|
const balanceInstances = api7.registry.getModuleInstances(api7.runtimeVersion.specName, "balances");
|
|
741519
741639
|
const nonDefaultBalances = balanceInstances && balanceInstances[0] !== "balances";
|
|
741520
|
-
return memo2(instanceId, (address4) => api7.derive.accounts.accountId(address4).pipe((0,
|
|
741521
|
-
(0,
|
|
741640
|
+
return memo2(instanceId, (address4) => api7.derive.accounts.accountId(address4).pipe((0, import_rxjs65.switchMap)((accountId2) => accountId2 ? (0, import_rxjs65.combineLatest)([
|
|
741641
|
+
(0, import_rxjs65.of)(accountId2),
|
|
741522
741642
|
nonDefaultBalances ? queryBalancesAccount(api7, accountId2, balanceInstances) : isFunction3(api7.query.system?.account) ? querySystemAccount(api7, accountId2) : isFunction3(api7.query.balances?.account) ? queryBalancesAccount(api7, accountId2) : isFunction3(api7.query.balances?.["freeBalance"]) ? queryBalancesFree(api7, accountId2) : queryNonceOnly(api7, accountId2)
|
|
741523
|
-
]) : (0,
|
|
741643
|
+
]) : (0, import_rxjs65.of)([api7.registry.createType("AccountId"), [
|
|
741524
741644
|
api7.registry.createType("Index"),
|
|
741525
741645
|
[[zeroBalance(api7), zeroBalance(api7), zeroBalance(api7), zeroBalance(api7)]]
|
|
741526
|
-
]])), (0,
|
|
741646
|
+
]])), (0, import_rxjs65.map)((result2) => calcBalances2(api7, result2))));
|
|
741527
741647
|
}
|
|
741528
741648
|
|
|
741529
741649
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/balances/votingBalances.js
|
|
741530
|
-
var
|
|
741650
|
+
var import_rxjs66 = require("rxjs");
|
|
741531
741651
|
function votingBalances(instanceId, api7) {
|
|
741532
|
-
return memo2(instanceId, (addresses) => !addresses?.length ? (0,
|
|
741652
|
+
return memo2(instanceId, (addresses) => !addresses?.length ? (0, import_rxjs66.of)([]) : (0, import_rxjs66.combineLatest)(addresses.map((accountId2) => api7.derive.balances.account(accountId2))));
|
|
741533
741653
|
}
|
|
741534
741654
|
|
|
741535
741655
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/balances/index.js
|
|
@@ -741542,7 +741662,7 @@ __export(bounties_exports, {
|
|
|
741542
741662
|
});
|
|
741543
741663
|
|
|
741544
741664
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/bounties/bounties.js
|
|
741545
|
-
var
|
|
741665
|
+
var import_rxjs67 = require("rxjs");
|
|
741546
741666
|
|
|
741547
741667
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/bounties/helpers/filterBountyProposals.js
|
|
741548
741668
|
function filterBountiesProposals(api7, allProposals) {
|
|
@@ -741568,21 +741688,21 @@ function parseResult([maybeBounties, maybeDescriptions, ids, bountyProposals]) {
|
|
|
741568
741688
|
}
|
|
741569
741689
|
function bounties(instanceId, api7) {
|
|
741570
741690
|
const bountyBase = api7.query.bounties || api7.query.treasury;
|
|
741571
|
-
return memo2(instanceId, () => bountyBase.bounties ? (0,
|
|
741691
|
+
return memo2(instanceId, () => bountyBase.bounties ? (0, import_rxjs67.combineLatest)([
|
|
741572
741692
|
bountyBase.bountyCount(),
|
|
741573
|
-
api7.query.council ? api7.query.council.proposalCount() : (0,
|
|
741574
|
-
]).pipe((0,
|
|
741693
|
+
api7.query.council ? api7.query.council.proposalCount() : (0, import_rxjs67.of)(0)
|
|
741694
|
+
]).pipe((0, import_rxjs67.switchMap)(() => (0, import_rxjs67.combineLatest)([
|
|
741575
741695
|
bountyBase.bounties.keys(),
|
|
741576
|
-
api7.derive.council ? api7.derive.council.proposals() : (0,
|
|
741577
|
-
])), (0,
|
|
741696
|
+
api7.derive.council ? api7.derive.council.proposals() : (0, import_rxjs67.of)([])
|
|
741697
|
+
])), (0, import_rxjs67.switchMap)(([keys2, proposals8]) => {
|
|
741578
741698
|
const ids = keys2.map(({ args: [id5] }) => id5);
|
|
741579
|
-
return (0,
|
|
741699
|
+
return (0, import_rxjs67.combineLatest)([
|
|
741580
741700
|
bountyBase.bounties.multi(ids),
|
|
741581
741701
|
bountyBase.bountyDescriptions.multi(ids),
|
|
741582
|
-
(0,
|
|
741583
|
-
(0,
|
|
741702
|
+
(0, import_rxjs67.of)(ids),
|
|
741703
|
+
(0, import_rxjs67.of)(filterBountiesProposals(api7, proposals8))
|
|
741584
741704
|
]);
|
|
741585
|
-
}), (0,
|
|
741705
|
+
}), (0, import_rxjs67.map)(parseResult)) : (0, import_rxjs67.of)(parseResult([[], [], [], []])));
|
|
741586
741706
|
}
|
|
741587
741707
|
|
|
741588
741708
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/index.js
|
|
@@ -741602,42 +741722,42 @@ __export(chain_exports, {
|
|
|
741602
741722
|
});
|
|
741603
741723
|
|
|
741604
741724
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/util.js
|
|
741605
|
-
var
|
|
741725
|
+
var import_rxjs68 = require("rxjs");
|
|
741606
741726
|
function createBlockNumberDerive(fn3) {
|
|
741607
|
-
return (instanceId, api7) => memo2(instanceId, () => fn3(api7).pipe((0,
|
|
741727
|
+
return (instanceId, api7) => memo2(instanceId, () => fn3(api7).pipe((0, import_rxjs68.map)(unwrapBlockNumber)));
|
|
741608
741728
|
}
|
|
741609
741729
|
function getAuthorDetailsWithAt(header, queryAt) {
|
|
741610
|
-
const validators7 = queryAt.session?.validators ? queryAt.session.validators() : (0,
|
|
741730
|
+
const validators7 = queryAt.session?.validators ? queryAt.session.validators() : (0, import_rxjs68.of)(null);
|
|
741611
741731
|
const { logs: [log5] } = header.digest;
|
|
741612
741732
|
const loggedAuthor = log5 && (log5.isConsensus && log5.asConsensus[0].isNimbus && log5.asConsensus[1] || log5.isPreRuntime && log5.asPreRuntime[0].isNimbus && log5.asPreRuntime[1]);
|
|
741613
741733
|
if (loggedAuthor) {
|
|
741614
741734
|
if (queryAt["authorMapping"]?.["mappingWithDeposit"]) {
|
|
741615
|
-
return (0,
|
|
741616
|
-
(0,
|
|
741735
|
+
return (0, import_rxjs68.combineLatest)([
|
|
741736
|
+
(0, import_rxjs68.of)(header),
|
|
741617
741737
|
validators7,
|
|
741618
|
-
queryAt["authorMapping"]["mappingWithDeposit"](loggedAuthor).pipe((0,
|
|
741738
|
+
queryAt["authorMapping"]["mappingWithDeposit"](loggedAuthor).pipe((0, import_rxjs68.map)((o51) => o51.unwrapOr({ account: null }).account))
|
|
741619
741739
|
]);
|
|
741620
741740
|
}
|
|
741621
741741
|
if (queryAt["parachainStaking"]?.["selectedCandidates"] && queryAt.session?.nextKeys) {
|
|
741622
741742
|
const loggedHex = loggedAuthor.toHex();
|
|
741623
|
-
return (0,
|
|
741624
|
-
(0,
|
|
741743
|
+
return (0, import_rxjs68.combineLatest)([
|
|
741744
|
+
(0, import_rxjs68.of)(header),
|
|
741625
741745
|
validators7,
|
|
741626
|
-
queryAt["parachainStaking"]["selectedCandidates"]().pipe((0,
|
|
741627
|
-
(0,
|
|
741628
|
-
queryAt.session.nextKeys.multi(selectedCandidates).pipe((0,
|
|
741629
|
-
])), (0,
|
|
741746
|
+
queryAt["parachainStaking"]["selectedCandidates"]().pipe((0, import_rxjs68.mergeMap)((selectedCandidates) => (0, import_rxjs68.combineLatest)([
|
|
741747
|
+
(0, import_rxjs68.of)(selectedCandidates),
|
|
741748
|
+
queryAt.session.nextKeys.multi(selectedCandidates).pipe((0, import_rxjs68.map)((nextKeys) => nextKeys.findIndex((o51) => o51.unwrapOrDefault().nimbus.toHex() === loggedHex)))
|
|
741749
|
+
])), (0, import_rxjs68.map)(([selectedCandidates, index]) => index === -1 ? null : selectedCandidates[index]))
|
|
741630
741750
|
]);
|
|
741631
741751
|
}
|
|
741632
741752
|
}
|
|
741633
|
-
return (0,
|
|
741634
|
-
(0,
|
|
741753
|
+
return (0, import_rxjs68.combineLatest)([
|
|
741754
|
+
(0, import_rxjs68.of)(header),
|
|
741635
741755
|
validators7,
|
|
741636
|
-
(0,
|
|
741756
|
+
(0, import_rxjs68.of)(null)
|
|
741637
741757
|
]);
|
|
741638
741758
|
}
|
|
741639
741759
|
function getAuthorDetails(api7, header, blockHash) {
|
|
741640
|
-
return api7.queryAt(header.parentHash.isEmpty ? blockHash || header.hash : header.parentHash).pipe((0,
|
|
741760
|
+
return api7.queryAt(header.parentHash.isEmpty ? blockHash || header.hash : header.parentHash).pipe((0, import_rxjs68.switchMap)((queryAt) => getAuthorDetailsWithAt(header, queryAt)));
|
|
741641
741761
|
}
|
|
741642
741762
|
|
|
741643
741763
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/bestNumber.js
|
|
@@ -741647,16 +741767,16 @@ var bestNumber = /* @__PURE__ */ createBlockNumberDerive((api7) => api7.rpc.chai
|
|
|
741647
741767
|
var bestNumberFinalized = /* @__PURE__ */ createBlockNumberDerive((api7) => api7.rpc.chain.subscribeFinalizedHeads());
|
|
741648
741768
|
|
|
741649
741769
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/bestNumberLag.js
|
|
741650
|
-
var
|
|
741770
|
+
var import_rxjs69 = require("rxjs");
|
|
741651
741771
|
function bestNumberLag(instanceId, api7) {
|
|
741652
|
-
return memo2(instanceId, () => (0,
|
|
741772
|
+
return memo2(instanceId, () => (0, import_rxjs69.combineLatest)([
|
|
741653
741773
|
api7.derive.chain.bestNumber(),
|
|
741654
741774
|
api7.derive.chain.bestNumberFinalized()
|
|
741655
|
-
]).pipe((0,
|
|
741775
|
+
]).pipe((0, import_rxjs69.map)(([bestNumber2, bestNumberFinalized2]) => api7.registry.createType("BlockNumber", bestNumber2.sub(bestNumberFinalized2)))));
|
|
741656
741776
|
}
|
|
741657
741777
|
|
|
741658
741778
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/getBlock.js
|
|
741659
|
-
var
|
|
741779
|
+
var import_rxjs70 = require("rxjs");
|
|
741660
741780
|
|
|
741661
741781
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/type/util.js
|
|
741662
741782
|
function extractAuthor(digest3, sessionValidators) {
|
|
@@ -741758,61 +741878,61 @@ function createSignedBlockExtended(registry, block2, events2, validators7, autho
|
|
|
741758
741878
|
|
|
741759
741879
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/getBlock.js
|
|
741760
741880
|
function getBlock(instanceId, api7) {
|
|
741761
|
-
return memo2(instanceId, (blockHash) => (0,
|
|
741881
|
+
return memo2(instanceId, (blockHash) => (0, import_rxjs70.combineLatest)([
|
|
741762
741882
|
api7.rpc.chain.getBlock(blockHash),
|
|
741763
741883
|
api7.queryAt(blockHash)
|
|
741764
|
-
]).pipe((0,
|
|
741765
|
-
(0,
|
|
741884
|
+
]).pipe((0, import_rxjs70.switchMap)(([signedBlock, queryAt]) => (0, import_rxjs70.combineLatest)([
|
|
741885
|
+
(0, import_rxjs70.of)(signedBlock),
|
|
741766
741886
|
queryAt.system.events(),
|
|
741767
741887
|
getAuthorDetails(api7, signedBlock.block.header, blockHash)
|
|
741768
|
-
])), (0,
|
|
741888
|
+
])), (0, import_rxjs70.map)(([signedBlock, events2, [, validators7, author]]) => createSignedBlockExtended(events2.registry, signedBlock, events2, validators7, author))));
|
|
741769
741889
|
}
|
|
741770
741890
|
|
|
741771
741891
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/getBlockByNumber.js
|
|
741772
|
-
var
|
|
741892
|
+
var import_rxjs71 = require("rxjs");
|
|
741773
741893
|
function getBlockByNumber(instanceId, api7) {
|
|
741774
|
-
return memo2(instanceId, (blockNumber) => api7.rpc.chain.getBlockHash(blockNumber).pipe((0,
|
|
741894
|
+
return memo2(instanceId, (blockNumber) => api7.rpc.chain.getBlockHash(blockNumber).pipe((0, import_rxjs71.switchMap)((h36) => api7.derive.chain.getBlock(h36))));
|
|
741775
741895
|
}
|
|
741776
741896
|
|
|
741777
741897
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/getHeader.js
|
|
741778
|
-
var
|
|
741898
|
+
var import_rxjs72 = require("rxjs");
|
|
741779
741899
|
function getHeader(instanceId, api7) {
|
|
741780
|
-
return memo2(instanceId, (blockHash) => api7.rpc.chain.getHeader(blockHash).pipe((0,
|
|
741900
|
+
return memo2(instanceId, (blockHash) => api7.rpc.chain.getHeader(blockHash).pipe((0, import_rxjs72.switchMap)((header) => getAuthorDetails(api7, header, blockHash)), (0, import_rxjs72.map)(([header, validators7, author]) => createHeaderExtended((validators7 || header).registry, header, validators7, author))));
|
|
741781
741901
|
}
|
|
741782
741902
|
|
|
741783
741903
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/subscribeFinalizedBlocks.js
|
|
741784
|
-
var
|
|
741904
|
+
var import_rxjs73 = require("rxjs");
|
|
741785
741905
|
function subscribeFinalizedBlocks(instanceId, api7) {
|
|
741786
|
-
return memo2(instanceId, () => api7.derive.chain.subscribeFinalizedHeads().pipe((0,
|
|
741906
|
+
return memo2(instanceId, () => api7.derive.chain.subscribeFinalizedHeads().pipe((0, import_rxjs73.switchMap)((header) => api7.derive.chain.getBlock(header.createdAtHash || header.hash))));
|
|
741787
741907
|
}
|
|
741788
741908
|
|
|
741789
741909
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/subscribeFinalizedHeads.js
|
|
741790
|
-
var
|
|
741910
|
+
var import_rxjs74 = require("rxjs");
|
|
741791
741911
|
function _getHeaderRange(instanceId, api7) {
|
|
741792
|
-
return memo2(instanceId, (startHash, endHash, prev = []) => api7.rpc.chain.getHeader(startHash).pipe((0,
|
|
741912
|
+
return memo2(instanceId, (startHash, endHash, prev = []) => api7.rpc.chain.getHeader(startHash).pipe((0, import_rxjs74.switchMap)((header) => header.parentHash.eq(endHash) ? (0, import_rxjs74.of)([header, ...prev]) : api7.derive.chain._getHeaderRange(header.parentHash, endHash, [header, ...prev]))));
|
|
741793
741913
|
}
|
|
741794
741914
|
function subscribeFinalizedHeads(instanceId, api7) {
|
|
741795
741915
|
return memo2(instanceId, () => {
|
|
741796
741916
|
let prevHash = null;
|
|
741797
|
-
return api7.rpc.chain.subscribeFinalizedHeads().pipe((0,
|
|
741917
|
+
return api7.rpc.chain.subscribeFinalizedHeads().pipe((0, import_rxjs74.switchMap)((header) => {
|
|
741798
741918
|
const endHash = prevHash;
|
|
741799
741919
|
const startHash = header.parentHash;
|
|
741800
741920
|
prevHash = header.createdAtHash = header.hash;
|
|
741801
|
-
return endHash === null || startHash.eq(endHash) ? (0,
|
|
741921
|
+
return endHash === null || startHash.eq(endHash) ? (0, import_rxjs74.of)(header) : api7.derive.chain._getHeaderRange(startHash, endHash, [header]).pipe((0, import_rxjs74.switchMap)((headers) => (0, import_rxjs74.from)(headers)));
|
|
741802
741922
|
}));
|
|
741803
741923
|
});
|
|
741804
741924
|
}
|
|
741805
741925
|
|
|
741806
741926
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/subscribeNewBlocks.js
|
|
741807
|
-
var
|
|
741927
|
+
var import_rxjs75 = require("rxjs");
|
|
741808
741928
|
function subscribeNewBlocks(instanceId, api7) {
|
|
741809
|
-
return memo2(instanceId, () => api7.derive.chain.subscribeNewHeads().pipe((0,
|
|
741929
|
+
return memo2(instanceId, () => api7.derive.chain.subscribeNewHeads().pipe((0, import_rxjs75.switchMap)((header) => api7.derive.chain.getBlock(header.createdAtHash || header.hash))));
|
|
741810
741930
|
}
|
|
741811
741931
|
|
|
741812
741932
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/chain/subscribeNewHeads.js
|
|
741813
|
-
var
|
|
741933
|
+
var import_rxjs76 = require("rxjs");
|
|
741814
741934
|
function subscribeNewHeads(instanceId, api7) {
|
|
741815
|
-
return memo2(instanceId, () => api7.rpc.chain.subscribeNewHeads().pipe((0,
|
|
741935
|
+
return memo2(instanceId, () => api7.rpc.chain.subscribeNewHeads().pipe((0, import_rxjs76.switchMap)((header) => getAuthorDetails(api7, header)), (0, import_rxjs76.map)(([header, validators7, author]) => {
|
|
741816
741936
|
header.createdAtHash = header.hash;
|
|
741817
741937
|
return createHeaderExtended(header.registry, header, validators7, author);
|
|
741818
741938
|
})));
|
|
@@ -741825,9 +741945,9 @@ __export(contracts_exports, {
|
|
|
741825
741945
|
});
|
|
741826
741946
|
|
|
741827
741947
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/contracts/fees.js
|
|
741828
|
-
var
|
|
741948
|
+
var import_rxjs77 = require("rxjs");
|
|
741829
741949
|
function queryConstants(api7) {
|
|
741830
|
-
return (0,
|
|
741950
|
+
return (0, import_rxjs77.of)([
|
|
741831
741951
|
// deprecated
|
|
741832
741952
|
api7.consts.contracts["callBaseFee"] || api7.registry.createType("Balance"),
|
|
741833
741953
|
api7.consts.contracts["contractFee"] || api7.registry.createType("Balance"),
|
|
@@ -741844,7 +741964,7 @@ function queryConstants(api7) {
|
|
|
741844
741964
|
}
|
|
741845
741965
|
function fees(instanceId, api7) {
|
|
741846
741966
|
return memo2(instanceId, () => {
|
|
741847
|
-
return queryConstants(api7).pipe((0,
|
|
741967
|
+
return queryConstants(api7).pipe((0, import_rxjs77.map)(([callBaseFee, contractFee, creationFee, transactionBaseFee, transactionByteFee, transferFee, rentByteFee, rentDepositOffset, surchargeReward, tombstoneDeposit]) => ({
|
|
741848
741968
|
callBaseFee,
|
|
741849
741969
|
contractFee,
|
|
741850
741970
|
creationFee,
|
|
@@ -741874,21 +741994,21 @@ __export(council_exports, {
|
|
|
741874
741994
|
});
|
|
741875
741995
|
|
|
741876
741996
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/council/votes.js
|
|
741877
|
-
var
|
|
741997
|
+
var import_rxjs78 = require("rxjs");
|
|
741878
741998
|
function isVoter(value5) {
|
|
741879
741999
|
return !Array.isArray(value5);
|
|
741880
742000
|
}
|
|
741881
742001
|
function retrieveStakeOf(elections) {
|
|
741882
|
-
return elections["stakeOf"].entries().pipe((0,
|
|
742002
|
+
return elections["stakeOf"].entries().pipe((0, import_rxjs78.map)((entries) => entries.map(([{ args: [accountId2] }, stake]) => [accountId2, stake])));
|
|
741883
742003
|
}
|
|
741884
742004
|
function retrieveVoteOf(elections) {
|
|
741885
|
-
return elections["votesOf"].entries().pipe((0,
|
|
742005
|
+
return elections["votesOf"].entries().pipe((0, import_rxjs78.map)((entries) => entries.map(([{ args: [accountId2] }, votes2]) => [accountId2, votes2])));
|
|
741886
742006
|
}
|
|
741887
742007
|
function retrievePrev(api7, elections) {
|
|
741888
|
-
return (0,
|
|
742008
|
+
return (0, import_rxjs78.combineLatest)([
|
|
741889
742009
|
retrieveStakeOf(elections),
|
|
741890
742010
|
retrieveVoteOf(elections)
|
|
741891
|
-
]).pipe((0,
|
|
742011
|
+
]).pipe((0, import_rxjs78.map)(([stakes, votes2]) => {
|
|
741892
742012
|
const result2 = [];
|
|
741893
742013
|
votes2.forEach(([voter, votes3]) => {
|
|
741894
742014
|
result2.push([voter, { stake: api7.registry.createType("Balance"), votes: votes3 }]);
|
|
@@ -741905,20 +742025,20 @@ function retrievePrev(api7, elections) {
|
|
|
741905
742025
|
}));
|
|
741906
742026
|
}
|
|
741907
742027
|
function retrieveCurrent(elections) {
|
|
741908
|
-
return elections.voting.entries().pipe((0,
|
|
742028
|
+
return elections.voting.entries().pipe((0, import_rxjs78.map)((entries) => entries.map(([{ args: [accountId2] }, value5]) => [
|
|
741909
742029
|
accountId2,
|
|
741910
742030
|
isVoter(value5) ? { stake: value5.stake, votes: value5.votes } : { stake: value5[0], votes: value5[1] }
|
|
741911
742031
|
])));
|
|
741912
742032
|
}
|
|
741913
742033
|
function votes(instanceId, api7) {
|
|
741914
742034
|
const elections = api7.query.elections || api7.query["phragmenElection"] || api7.query["electionsPhragmen"];
|
|
741915
|
-
return memo2(instanceId, () => elections ? elections["stakeOf"] ? retrievePrev(api7, elections) : retrieveCurrent(elections) : (0,
|
|
742035
|
+
return memo2(instanceId, () => elections ? elections["stakeOf"] ? retrievePrev(api7, elections) : retrieveCurrent(elections) : (0, import_rxjs78.of)([]));
|
|
741916
742036
|
}
|
|
741917
742037
|
|
|
741918
742038
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/council/votesOf.js
|
|
741919
|
-
var
|
|
742039
|
+
var import_rxjs79 = require("rxjs");
|
|
741920
742040
|
function votesOf(instanceId, api7) {
|
|
741921
|
-
return memo2(instanceId, (accountId2) => api7.derive.council.votes().pipe((0,
|
|
742041
|
+
return memo2(instanceId, (accountId2) => api7.derive.council.votes().pipe((0, import_rxjs79.map)((votes2) => (votes2.find(([from91]) => from91.eq(accountId2)) || [null, { stake: api7.registry.createType("Balance"), votes: [] }])[1])));
|
|
741922
742042
|
}
|
|
741923
742043
|
|
|
741924
742044
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/council/index.js
|
|
@@ -741939,16 +742059,16 @@ __export(crowdloan_exports, {
|
|
|
741939
742059
|
});
|
|
741940
742060
|
|
|
741941
742061
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/crowdloan/childKey.js
|
|
741942
|
-
var
|
|
742062
|
+
var import_rxjs80 = require("rxjs");
|
|
741943
742063
|
function createChildKey(info6) {
|
|
741944
742064
|
return u8aToHex(u8aConcat(":child_storage:default:", blake2AsU8a(u8aConcat("crowdloan", (info6.fundIndex || info6.trieIndex).toU8a()))));
|
|
741945
742065
|
}
|
|
741946
742066
|
function childKey(instanceId, api7) {
|
|
741947
|
-
return memo2(instanceId, (paraId) => api7.query["crowdloan"]["funds"](paraId).pipe((0,
|
|
742067
|
+
return memo2(instanceId, (paraId) => api7.query["crowdloan"]["funds"](paraId).pipe((0, import_rxjs80.map)((optInfo) => optInfo.isSome ? createChildKey(optInfo.unwrap()) : null)));
|
|
741948
742068
|
}
|
|
741949
742069
|
|
|
741950
742070
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/crowdloan/contributions.js
|
|
741951
|
-
var
|
|
742071
|
+
var import_rxjs81 = require("rxjs");
|
|
741952
742072
|
|
|
741953
742073
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/crowdloan/util.js
|
|
741954
742074
|
function extractContributed(paraId, events2) {
|
|
@@ -741969,44 +742089,44 @@ var PAGE_SIZE_K = 1e3;
|
|
|
741969
742089
|
function _getUpdates(api7, paraId) {
|
|
741970
742090
|
let added = [];
|
|
741971
742091
|
let removed = [];
|
|
741972
|
-
return api7.query.system.events().pipe((0,
|
|
742092
|
+
return api7.query.system.events().pipe((0, import_rxjs81.switchMap)((events2) => {
|
|
741973
742093
|
const changes2 = extractContributed(paraId, events2);
|
|
741974
742094
|
if (changes2.added.length || changes2.removed.length) {
|
|
741975
742095
|
added = added.concat(...changes2.added);
|
|
741976
742096
|
removed = removed.concat(...changes2.removed);
|
|
741977
|
-
return (0,
|
|
742097
|
+
return (0, import_rxjs81.of)({ added, addedDelta: changes2.added, blockHash: events2.createdAtHash?.toHex() || "-", removed, removedDelta: changes2.removed });
|
|
741978
742098
|
}
|
|
741979
|
-
return
|
|
741980
|
-
}), (0,
|
|
742099
|
+
return import_rxjs81.EMPTY;
|
|
742100
|
+
}), (0, import_rxjs81.startWith)({ added, addedDelta: [], blockHash: "-", removed, removedDelta: [] }));
|
|
741981
742101
|
}
|
|
741982
742102
|
function _eventTriggerAll(api7, paraId) {
|
|
741983
|
-
return api7.query.system.events().pipe((0,
|
|
742103
|
+
return api7.query.system.events().pipe((0, import_rxjs81.switchMap)((events2) => {
|
|
741984
742104
|
const items = events2.filter(({ event: { data: [eventParaId], method: method2, section: section2 } }) => section2 === "crowdloan" && ["AllRefunded", "Dissolved", "PartiallyRefunded"].includes(method2) && eventParaId.eq(paraId));
|
|
741985
|
-
return items.length ? (0,
|
|
741986
|
-
}), (0,
|
|
742105
|
+
return items.length ? (0, import_rxjs81.of)(events2.createdAtHash?.toHex() || "-") : import_rxjs81.EMPTY;
|
|
742106
|
+
}), (0, import_rxjs81.startWith)("-"));
|
|
741987
742107
|
}
|
|
741988
742108
|
function _getKeysPaged(api7, childKey2) {
|
|
741989
|
-
const subject = new
|
|
742109
|
+
const subject = new import_rxjs81.BehaviorSubject(void 0);
|
|
741990
742110
|
return subject.pipe(
|
|
741991
|
-
(0,
|
|
741992
|
-
(0,
|
|
742111
|
+
(0, import_rxjs81.switchMap)((startKey) => api7.rpc.childstate.getKeysPaged(childKey2, "0x", PAGE_SIZE_K, startKey)),
|
|
742112
|
+
(0, import_rxjs81.tap)((keys2) => {
|
|
741993
742113
|
nextTick2(() => {
|
|
741994
742114
|
keys2.length === PAGE_SIZE_K ? subject.next(keys2[PAGE_SIZE_K - 1].toHex()) : subject.complete();
|
|
741995
742115
|
});
|
|
741996
742116
|
}),
|
|
741997
|
-
(0,
|
|
742117
|
+
(0, import_rxjs81.toArray)(),
|
|
741998
742118
|
// toArray since we want to startSubject to be completed
|
|
741999
|
-
(0,
|
|
742119
|
+
(0, import_rxjs81.map)((keyArr) => arrayFlatten(keyArr))
|
|
742000
742120
|
);
|
|
742001
742121
|
}
|
|
742002
742122
|
function _getAll(api7, paraId, childKey2) {
|
|
742003
|
-
return _eventTriggerAll(api7, paraId).pipe((0,
|
|
742123
|
+
return _eventTriggerAll(api7, paraId).pipe((0, import_rxjs81.switchMap)(() => isFunction3(api7.rpc.childstate.getKeysPaged) ? _getKeysPaged(api7, childKey2) : api7.rpc.childstate.getKeys(childKey2, "0x")), (0, import_rxjs81.map)((keys2) => keys2.map((k17) => k17.toHex())));
|
|
742004
742124
|
}
|
|
742005
742125
|
function _contributions(api7, paraId, childKey2) {
|
|
742006
|
-
return (0,
|
|
742126
|
+
return (0, import_rxjs81.combineLatest)([
|
|
742007
742127
|
_getAll(api7, paraId, childKey2),
|
|
742008
742128
|
_getUpdates(api7, paraId)
|
|
742009
|
-
]).pipe((0,
|
|
742129
|
+
]).pipe((0, import_rxjs81.map)(([keys2, { added, blockHash, removed }]) => {
|
|
742010
742130
|
const contributorsMap = {};
|
|
742011
742131
|
keys2.forEach((k17) => {
|
|
742012
742132
|
contributorsMap[k17] = true;
|
|
@@ -742024,29 +742144,29 @@ function _contributions(api7, paraId, childKey2) {
|
|
|
742024
742144
|
}));
|
|
742025
742145
|
}
|
|
742026
742146
|
function contributions(instanceId, api7) {
|
|
742027
|
-
return memo2(instanceId, (paraId) => api7.derive.crowdloan.childKey(paraId).pipe((0,
|
|
742147
|
+
return memo2(instanceId, (paraId) => api7.derive.crowdloan.childKey(paraId).pipe((0, import_rxjs81.switchMap)((childKey2) => childKey2 ? _contributions(api7, paraId, childKey2) : (0, import_rxjs81.of)({ blockHash: "-", contributorsHex: [] }))));
|
|
742028
742148
|
}
|
|
742029
742149
|
|
|
742030
742150
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/crowdloan/ownContributions.js
|
|
742031
|
-
var
|
|
742151
|
+
var import_rxjs82 = require("rxjs");
|
|
742032
742152
|
function _getValues(api7, childKey2, keys2) {
|
|
742033
|
-
return (0,
|
|
742153
|
+
return (0, import_rxjs82.combineLatest)(keys2.map((k17) => api7.rpc.childstate.getStorage(childKey2, k17))).pipe((0, import_rxjs82.map)((values) => values.map((v39) => api7.registry.createType("Option<StorageData>", v39)).map((o51) => o51.isSome ? api7.registry.createType("Balance", o51.unwrap()) : api7.registry.createType("Balance")).reduce((all8, b21, index) => objectSpread(all8, { [keys2[index]]: b21 }), {})));
|
|
742034
742154
|
}
|
|
742035
742155
|
function _watchOwnChanges(api7, paraId, childkey, keys2) {
|
|
742036
|
-
return api7.query.system.events().pipe((0,
|
|
742156
|
+
return api7.query.system.events().pipe((0, import_rxjs82.switchMap)((events2) => {
|
|
742037
742157
|
const changes2 = extractContributed(paraId, events2);
|
|
742038
742158
|
const filtered = keys2.filter((k17) => changes2.added.includes(k17) || changes2.removed.includes(k17));
|
|
742039
|
-
return filtered.length ? _getValues(api7, childkey, filtered) :
|
|
742040
|
-
}), (0,
|
|
742159
|
+
return filtered.length ? _getValues(api7, childkey, filtered) : import_rxjs82.EMPTY;
|
|
742160
|
+
}), (0, import_rxjs82.startWith)({}));
|
|
742041
742161
|
}
|
|
742042
742162
|
function _contributions2(api7, paraId, childKey2, keys2) {
|
|
742043
|
-
return (0,
|
|
742163
|
+
return (0, import_rxjs82.combineLatest)([
|
|
742044
742164
|
_getValues(api7, childKey2, keys2),
|
|
742045
742165
|
_watchOwnChanges(api7, paraId, childKey2, keys2)
|
|
742046
|
-
]).pipe((0,
|
|
742166
|
+
]).pipe((0, import_rxjs82.map)(([all8, latest2]) => objectSpread({}, all8, latest2)));
|
|
742047
742167
|
}
|
|
742048
742168
|
function ownContributions(instanceId, api7) {
|
|
742049
|
-
return memo2(instanceId, (paraId, keys2) => api7.derive.crowdloan.childKey(paraId).pipe((0,
|
|
742169
|
+
return memo2(instanceId, (paraId, keys2) => api7.derive.crowdloan.childKey(paraId).pipe((0, import_rxjs82.switchMap)((childKey2) => childKey2 && keys2.length ? _contributions2(api7, paraId, childKey2, keys2) : (0, import_rxjs82.of)({}))));
|
|
742050
742170
|
}
|
|
742051
742171
|
|
|
742052
742172
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/index.js
|
|
@@ -742070,7 +742190,7 @@ __export(democracy_exports, {
|
|
|
742070
742190
|
});
|
|
742071
742191
|
|
|
742072
742192
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/dispatchQueue.js
|
|
742073
|
-
var
|
|
742193
|
+
var import_rxjs83 = require("rxjs");
|
|
742074
742194
|
|
|
742075
742195
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/util.js
|
|
742076
742196
|
function isOldInfo(info6) {
|
|
@@ -742178,10 +742298,10 @@ function isBounded(call) {
|
|
|
742178
742298
|
return call.isInline || call.isLegacy || call.isLookup;
|
|
742179
742299
|
}
|
|
742180
742300
|
function queryQueue(api7) {
|
|
742181
|
-
return api7.query.democracy["dispatchQueue"]().pipe((0,
|
|
742182
|
-
(0,
|
|
742301
|
+
return api7.query.democracy["dispatchQueue"]().pipe((0, import_rxjs83.switchMap)((dispatches) => (0, import_rxjs83.combineLatest)([
|
|
742302
|
+
(0, import_rxjs83.of)(dispatches),
|
|
742183
742303
|
api7.derive.democracy.preimages(dispatches.map(([, hash12]) => hash12))
|
|
742184
|
-
])), (0,
|
|
742304
|
+
])), (0, import_rxjs83.map)(([dispatches, images]) => dispatches.map(([at2, imageHash, index], dispatchIndex) => ({
|
|
742185
742305
|
at: at2,
|
|
742186
742306
|
image: images[dispatchIndex],
|
|
742187
742307
|
imageHash: getImageHashBounded(imageHash),
|
|
@@ -742189,19 +742309,19 @@ function queryQueue(api7) {
|
|
|
742189
742309
|
}))));
|
|
742190
742310
|
}
|
|
742191
742311
|
function schedulerEntries(api7) {
|
|
742192
|
-
return api7.derive.democracy.referendumsFinished().pipe((0,
|
|
742312
|
+
return api7.derive.democracy.referendumsFinished().pipe((0, import_rxjs83.switchMap)(() => api7.query.scheduler.agenda.keys()), (0, import_rxjs83.switchMap)((keys2) => {
|
|
742193
742313
|
const blockNumbers = keys2.map(({ args: [blockNumber] }) => blockNumber);
|
|
742194
|
-
return blockNumbers.length ? (0,
|
|
742195
|
-
(0,
|
|
742314
|
+
return blockNumbers.length ? (0, import_rxjs83.combineLatest)([
|
|
742315
|
+
(0, import_rxjs83.of)(blockNumbers),
|
|
742196
742316
|
// this should simply be api.query.scheduler.agenda.multi,
|
|
742197
742317
|
// however we have had cases on Darwinia where the indices have moved around after an
|
|
742198
742318
|
// upgrade, which results in invalid on-chain data
|
|
742199
|
-
api7.query.scheduler.agenda.multi(blockNumbers).pipe((0,
|
|
742200
|
-
]) : (0,
|
|
742319
|
+
api7.query.scheduler.agenda.multi(blockNumbers).pipe((0, import_rxjs83.catchError)(() => (0, import_rxjs83.of)(blockNumbers.map(() => []))))
|
|
742320
|
+
]) : (0, import_rxjs83.of)([[], []]);
|
|
742201
742321
|
}));
|
|
742202
742322
|
}
|
|
742203
742323
|
function queryScheduler(api7) {
|
|
742204
|
-
return schedulerEntries(api7).pipe((0,
|
|
742324
|
+
return schedulerEntries(api7).pipe((0, import_rxjs83.switchMap)(([blockNumbers, agendas]) => {
|
|
742205
742325
|
const result2 = [];
|
|
742206
742326
|
blockNumbers.forEach((at2, index) => {
|
|
742207
742327
|
(agendas[index] || []).filter((o51) => o51.isSome).forEach((o51) => {
|
|
@@ -742215,18 +742335,18 @@ function queryScheduler(api7) {
|
|
|
742215
742335
|
}
|
|
742216
742336
|
});
|
|
742217
742337
|
});
|
|
742218
|
-
return (0,
|
|
742219
|
-
(0,
|
|
742220
|
-
result2.length ? api7.derive.democracy.preimages(result2.map(({ imageHash }) => imageHash)) : (0,
|
|
742338
|
+
return (0, import_rxjs83.combineLatest)([
|
|
742339
|
+
(0, import_rxjs83.of)(result2),
|
|
742340
|
+
result2.length ? api7.derive.democracy.preimages(result2.map(({ imageHash }) => imageHash)) : (0, import_rxjs83.of)([])
|
|
742221
742341
|
]);
|
|
742222
|
-
}), (0,
|
|
742342
|
+
}), (0, import_rxjs83.map)(([infos, images]) => infos.map((info6, index) => objectSpread({ image: images[index] }, info6))));
|
|
742223
742343
|
}
|
|
742224
742344
|
function dispatchQueue(instanceId, api7) {
|
|
742225
|
-
return memo2(instanceId, () => isFunction3(api7.query.scheduler?.agenda) ? queryScheduler(api7) : api7.query.democracy["dispatchQueue"] ? queryQueue(api7) : (0,
|
|
742345
|
+
return memo2(instanceId, () => isFunction3(api7.query.scheduler?.agenda) ? queryScheduler(api7) : api7.query.democracy["dispatchQueue"] ? queryQueue(api7) : (0, import_rxjs83.of)([]));
|
|
742226
742346
|
}
|
|
742227
742347
|
|
|
742228
742348
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/locks.js
|
|
742229
|
-
var
|
|
742349
|
+
var import_rxjs84 = require("rxjs");
|
|
742230
742350
|
var LOCKUPS = [0, 1, 2, 4, 8, 16, 32];
|
|
742231
742351
|
function parseEnd(api7, vote, { approved, end }) {
|
|
742232
742352
|
return [
|
|
@@ -742240,7 +742360,7 @@ function parseLock(api7, [referendumId, accountVote], referendum) {
|
|
|
742240
742360
|
return { balance, isDelegated: false, isFinished: referendum.isFinished, referendumEnd, referendumId, unlockAt, vote };
|
|
742241
742361
|
}
|
|
742242
742362
|
function delegateLocks(api7, { balance, conviction, target }) {
|
|
742243
|
-
return api7.derive.democracy.locks(target).pipe((0,
|
|
742363
|
+
return api7.derive.democracy.locks(target).pipe((0, import_rxjs84.map)((available) => available.map(({ isFinished, referendumEnd, referendumId, unlockAt, vote }) => ({
|
|
742244
742364
|
balance,
|
|
742245
742365
|
isDelegated: true,
|
|
742246
742366
|
isFinished,
|
|
@@ -742252,33 +742372,33 @@ function delegateLocks(api7, { balance, conviction, target }) {
|
|
|
742252
742372
|
}
|
|
742253
742373
|
function directLocks(api7, { votes: votes2 }) {
|
|
742254
742374
|
if (!votes2.length) {
|
|
742255
|
-
return (0,
|
|
742375
|
+
return (0, import_rxjs84.of)([]);
|
|
742256
742376
|
}
|
|
742257
|
-
return api7.query.democracy.referendumInfoOf.multi(votes2.map(([referendumId]) => referendumId)).pipe((0,
|
|
742377
|
+
return api7.query.democracy.referendumInfoOf.multi(votes2.map(([referendumId]) => referendumId)).pipe((0, import_rxjs84.map)((referendums2) => votes2.map((vote, index) => [vote, referendums2[index].unwrapOr(null)]).filter((item) => !!item[1] && isUndefined4(item[1].end) && item[0][1].isStandard).map(([directVote, referendum]) => parseLock(api7, directVote, referendum))));
|
|
742258
742378
|
}
|
|
742259
742379
|
function locks(instanceId, api7) {
|
|
742260
|
-
return memo2(instanceId, (accountId2) => api7.query.democracy.votingOf ? api7.query.democracy.votingOf(accountId2).pipe((0,
|
|
742380
|
+
return memo2(instanceId, (accountId2) => api7.query.democracy.votingOf ? api7.query.democracy.votingOf(accountId2).pipe((0, import_rxjs84.switchMap)((voting) => voting.isDirect ? directLocks(api7, voting.asDirect) : voting.isDelegating ? delegateLocks(api7, voting.asDelegating) : (0, import_rxjs84.of)([]))) : (0, import_rxjs84.of)([]));
|
|
742261
742381
|
}
|
|
742262
742382
|
|
|
742263
742383
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/nextExternal.js
|
|
742264
|
-
var
|
|
742384
|
+
var import_rxjs85 = require("rxjs");
|
|
742265
742385
|
function withImage(api7, nextOpt) {
|
|
742266
742386
|
if (nextOpt.isNone) {
|
|
742267
|
-
return (0,
|
|
742387
|
+
return (0, import_rxjs85.of)(null);
|
|
742268
742388
|
}
|
|
742269
742389
|
const [hash12, threshold] = nextOpt.unwrap();
|
|
742270
|
-
return api7.derive.democracy.preimage(hash12).pipe((0,
|
|
742390
|
+
return api7.derive.democracy.preimage(hash12).pipe((0, import_rxjs85.map)((image) => ({
|
|
742271
742391
|
image,
|
|
742272
742392
|
imageHash: getImageHashBounded(hash12),
|
|
742273
742393
|
threshold
|
|
742274
742394
|
})));
|
|
742275
742395
|
}
|
|
742276
742396
|
function nextExternal(instanceId, api7) {
|
|
742277
|
-
return memo2(instanceId, () => api7.query.democracy?.nextExternal ? api7.query.democracy.nextExternal().pipe((0,
|
|
742397
|
+
return memo2(instanceId, () => api7.query.democracy?.nextExternal ? api7.query.democracy.nextExternal().pipe((0, import_rxjs85.switchMap)((nextOpt) => withImage(api7, nextOpt))) : (0, import_rxjs85.of)(null));
|
|
742278
742398
|
}
|
|
742279
742399
|
|
|
742280
742400
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/preimages.js
|
|
742281
|
-
var
|
|
742401
|
+
var import_rxjs86 = require("rxjs");
|
|
742282
742402
|
function getUnrequestedTicket(status) {
|
|
742283
742403
|
return status.ticket || status.deposit;
|
|
742284
742404
|
}
|
|
@@ -742328,27 +742448,27 @@ function parseImage(api7, [proposalHash, status, bytes7]) {
|
|
|
742328
742448
|
}
|
|
742329
742449
|
function getDemocracyImages(api7, bounded) {
|
|
742330
742450
|
const hashes2 = bounded.map((b21) => getImageHashBounded(b21));
|
|
742331
|
-
return api7.query.democracy["preimages"].multi(hashes2).pipe((0,
|
|
742451
|
+
return api7.query.democracy["preimages"].multi(hashes2).pipe((0, import_rxjs86.map)((images) => images.map((imageOpt) => parseDemocracy(api7, imageOpt))));
|
|
742332
742452
|
}
|
|
742333
742453
|
function getImages(api7, bounded) {
|
|
742334
742454
|
const hashes2 = bounded.map((b21) => getImageHashBounded(b21));
|
|
742335
742455
|
const bytesType = api7.registry.lookup.getTypeDef(api7.query.preimage.preimageFor.creator.meta.type.asMap.key).type;
|
|
742336
|
-
return api7.query.preimage.statusFor.multi(hashes2).pipe((0,
|
|
742456
|
+
return api7.query.preimage.statusFor.multi(hashes2).pipe((0, import_rxjs86.switchMap)((optStatus) => {
|
|
742337
742457
|
const statuses = optStatus.map((o51) => o51.unwrapOr(null));
|
|
742338
742458
|
const keys2 = statuses.map((s58, i87) => s58 ? bytesType === "H256" ? hashes2[i87] : s58.isRequested ? [hashes2[i87], s58.asRequested.len.unwrapOr(0)] : [hashes2[i87], s58.asUnrequested.len] : null).filter((p69) => !!p69);
|
|
742339
|
-
return api7.query.preimage.preimageFor.multi(keys2).pipe((0,
|
|
742459
|
+
return api7.query.preimage.preimageFor.multi(keys2).pipe((0, import_rxjs86.map)((optBytes) => {
|
|
742340
742460
|
let ptr = -1;
|
|
742341
742461
|
return statuses.map((s58, i87) => s58 ? [hashes2[i87], s58, optBytes[++ptr].unwrapOr(null)] : [hashes2[i87], null, null]).map((v39) => parseImage(api7, v39));
|
|
742342
742462
|
}));
|
|
742343
742463
|
}));
|
|
742344
742464
|
}
|
|
742345
742465
|
function preimages(instanceId, api7) {
|
|
742346
|
-
return memo2(instanceId, (hashes2) => hashes2.length ? isFunction3(api7.query.democracy["preimages"]) ? getDemocracyImages(api7, hashes2) : isFunction3(api7.query.preimage.preimageFor) ? getImages(api7, hashes2) : (0,
|
|
742466
|
+
return memo2(instanceId, (hashes2) => hashes2.length ? isFunction3(api7.query.democracy["preimages"]) ? getDemocracyImages(api7, hashes2) : isFunction3(api7.query.preimage.preimageFor) ? getImages(api7, hashes2) : (0, import_rxjs86.of)([]) : (0, import_rxjs86.of)([]));
|
|
742347
742467
|
}
|
|
742348
742468
|
var preimage = /* @__PURE__ */ firstMemo((api7, hash12) => api7.derive.democracy.preimages([hash12]));
|
|
742349
742469
|
|
|
742350
742470
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/proposals.js
|
|
742351
|
-
var
|
|
742471
|
+
var import_rxjs87 = require("rxjs");
|
|
742352
742472
|
function isNewDepositors(depositors) {
|
|
742353
742473
|
return isFunction3(depositors[1].mul);
|
|
742354
742474
|
}
|
|
@@ -742364,51 +742484,51 @@ function parse7([proposals8, images, optDepositors]) {
|
|
|
742364
742484
|
});
|
|
742365
742485
|
}
|
|
742366
742486
|
function proposals4(instanceId, api7) {
|
|
742367
|
-
return memo2(instanceId, () => isFunction3(api7.query.democracy?.publicProps) ? api7.query.democracy.publicProps().pipe((0,
|
|
742368
|
-
(0,
|
|
742487
|
+
return memo2(instanceId, () => isFunction3(api7.query.democracy?.publicProps) ? api7.query.democracy.publicProps().pipe((0, import_rxjs87.switchMap)((proposals8) => proposals8.length ? (0, import_rxjs87.combineLatest)([
|
|
742488
|
+
(0, import_rxjs87.of)(proposals8),
|
|
742369
742489
|
api7.derive.democracy.preimages(proposals8.map(([, hash12]) => hash12)),
|
|
742370
742490
|
api7.query.democracy.depositOf.multi(proposals8.map(([index]) => index))
|
|
742371
|
-
]) : (0,
|
|
742491
|
+
]) : (0, import_rxjs87.of)([[], [], []])), (0, import_rxjs87.map)(parse7)) : (0, import_rxjs87.of)([]));
|
|
742372
742492
|
}
|
|
742373
742493
|
|
|
742374
742494
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/referendumIds.js
|
|
742375
|
-
var
|
|
742495
|
+
var import_rxjs88 = require("rxjs");
|
|
742376
742496
|
function referendumIds(instanceId, api7) {
|
|
742377
742497
|
return memo2(instanceId, () => api7.query.democracy?.lowestUnbaked ? api7.queryMulti([
|
|
742378
742498
|
api7.query.democracy.lowestUnbaked,
|
|
742379
742499
|
api7.query.democracy.referendumCount
|
|
742380
|
-
]).pipe((0,
|
|
742500
|
+
]).pipe((0, import_rxjs88.map)(([first9, total]) => total.gt(first9) ? [...Array(total.sub(first9).toNumber())].map((_15, i87) => first9.addn(i87)) : [])) : (0, import_rxjs88.of)([]));
|
|
742381
742501
|
}
|
|
742382
742502
|
|
|
742383
742503
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/referendums.js
|
|
742384
|
-
var
|
|
742504
|
+
var import_rxjs89 = require("rxjs");
|
|
742385
742505
|
function referendums(instanceId, api7) {
|
|
742386
|
-
return memo2(instanceId, () => api7.derive.democracy.referendumsActive().pipe((0,
|
|
742387
|
-
(0,
|
|
742506
|
+
return memo2(instanceId, () => api7.derive.democracy.referendumsActive().pipe((0, import_rxjs89.switchMap)((referendums2) => referendums2.length ? (0, import_rxjs89.combineLatest)([
|
|
742507
|
+
(0, import_rxjs89.of)(referendums2),
|
|
742388
742508
|
api7.derive.democracy._referendumsVotes(referendums2)
|
|
742389
|
-
]) : (0,
|
|
742509
|
+
]) : (0, import_rxjs89.of)([[], []])), (0, import_rxjs89.map)(([referendums2, votes2]) => referendums2.map((referendum, index) => objectSpread({}, referendum, votes2[index])))));
|
|
742390
742510
|
}
|
|
742391
742511
|
|
|
742392
742512
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/referendumsActive.js
|
|
742393
|
-
var
|
|
742513
|
+
var import_rxjs90 = require("rxjs");
|
|
742394
742514
|
function referendumsActive(instanceId, api7) {
|
|
742395
|
-
return memo2(instanceId, () => api7.derive.democracy.referendumIds().pipe((0,
|
|
742515
|
+
return memo2(instanceId, () => api7.derive.democracy.referendumIds().pipe((0, import_rxjs90.switchMap)((ids) => ids.length ? api7.derive.democracy.referendumsInfo(ids) : (0, import_rxjs90.of)([]))));
|
|
742396
742516
|
}
|
|
742397
742517
|
|
|
742398
742518
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/referendumsFinished.js
|
|
742399
|
-
var
|
|
742519
|
+
var import_rxjs91 = require("rxjs");
|
|
742400
742520
|
function referendumsFinished(instanceId, api7) {
|
|
742401
|
-
return memo2(instanceId, () => api7.derive.democracy.referendumIds().pipe((0,
|
|
742521
|
+
return memo2(instanceId, () => api7.derive.democracy.referendumIds().pipe((0, import_rxjs91.switchMap)((ids) => api7.query.democracy.referendumInfoOf.multi(ids)), (0, import_rxjs91.map)((infos) => infos.map((o51) => o51.unwrapOr(null)).filter((info6) => !!info6 && info6.isFinished).map((info6) => info6.asFinished))));
|
|
742402
742522
|
}
|
|
742403
742523
|
|
|
742404
742524
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/referendumsInfo.js
|
|
742405
|
-
var
|
|
742525
|
+
var import_rxjs92 = require("rxjs");
|
|
742406
742526
|
function votesPrev(api7, referendumId) {
|
|
742407
|
-
return api7.query.democracy["votersFor"](referendumId).pipe((0,
|
|
742408
|
-
(0,
|
|
742409
|
-
votersFor.length ? api7.query.democracy["voteOf"].multi(votersFor.map((accountId2) => [referendumId, accountId2])) : (0,
|
|
742527
|
+
return api7.query.democracy["votersFor"](referendumId).pipe((0, import_rxjs92.switchMap)((votersFor) => (0, import_rxjs92.combineLatest)([
|
|
742528
|
+
(0, import_rxjs92.of)(votersFor),
|
|
742529
|
+
votersFor.length ? api7.query.democracy["voteOf"].multi(votersFor.map((accountId2) => [referendumId, accountId2])) : (0, import_rxjs92.of)([]),
|
|
742410
742530
|
api7.derive.balances.votingBalances(votersFor)
|
|
742411
|
-
])), (0,
|
|
742531
|
+
])), (0, import_rxjs92.map)(([votersFor, votes2, balances]) => votersFor.map((accountId2, index) => ({
|
|
742412
742532
|
accountId: accountId2,
|
|
742413
742533
|
balance: balances[index].votingBalance || api7.registry.createType("Balance"),
|
|
742414
742534
|
isDelegating: false,
|
|
@@ -742433,7 +742553,7 @@ function extractVotes(mapped, referendumId) {
|
|
|
742433
742553
|
), []);
|
|
742434
742554
|
}
|
|
742435
742555
|
function votesCurr(api7, referendumId) {
|
|
742436
|
-
return api7.query.democracy.votingOf.entries().pipe((0,
|
|
742556
|
+
return api7.query.democracy.votingOf.entries().pipe((0, import_rxjs92.map)((allVoting) => {
|
|
742437
742557
|
const mapped = allVoting.map(([{ args: [accountId2] }, voting]) => [accountId2, voting]);
|
|
742438
742558
|
const votes2 = extractVotes(mapped, referendumId);
|
|
742439
742559
|
const delegations = mapped.filter(([, voting]) => voting.isDelegating).map(([accountId2, voting]) => [accountId2, voting.asDelegating]);
|
|
@@ -742453,33 +742573,33 @@ function votesCurr(api7, referendumId) {
|
|
|
742453
742573
|
}));
|
|
742454
742574
|
}
|
|
742455
742575
|
function _referendumVotes(instanceId, api7) {
|
|
742456
|
-
return memo2(instanceId, (referendum) => (0,
|
|
742576
|
+
return memo2(instanceId, (referendum) => (0, import_rxjs92.combineLatest)([
|
|
742457
742577
|
api7.derive.democracy.sqrtElectorate(),
|
|
742458
742578
|
isFunction3(api7.query.democracy.votingOf) ? votesCurr(api7, referendum.index) : votesPrev(api7, referendum.index)
|
|
742459
|
-
]).pipe((0,
|
|
742579
|
+
]).pipe((0, import_rxjs92.map)(([sqrtElectorate2, votes2]) => calcVotes(sqrtElectorate2, referendum, votes2))));
|
|
742460
742580
|
}
|
|
742461
742581
|
function _referendumsVotes(instanceId, api7) {
|
|
742462
|
-
return memo2(instanceId, (referendums2) => referendums2.length ? (0,
|
|
742582
|
+
return memo2(instanceId, (referendums2) => referendums2.length ? (0, import_rxjs92.combineLatest)(referendums2.map((referendum) => api7.derive.democracy._referendumVotes(referendum))) : (0, import_rxjs92.of)([]));
|
|
742463
742583
|
}
|
|
742464
742584
|
function _referendumInfo(instanceId, api7) {
|
|
742465
742585
|
return memo2(instanceId, (index, info6) => {
|
|
742466
742586
|
const status = getStatus(info6);
|
|
742467
|
-
return status ? api7.derive.democracy.preimage(status.proposal || status.proposalHash).pipe((0,
|
|
742587
|
+
return status ? api7.derive.democracy.preimage(status.proposal || status.proposalHash).pipe((0, import_rxjs92.map)((image) => ({
|
|
742468
742588
|
image,
|
|
742469
742589
|
imageHash: getImageHash(status),
|
|
742470
742590
|
index: api7.registry.createType("ReferendumIndex", index),
|
|
742471
742591
|
status
|
|
742472
|
-
}))) : (0,
|
|
742592
|
+
}))) : (0, import_rxjs92.of)(null);
|
|
742473
742593
|
});
|
|
742474
742594
|
}
|
|
742475
742595
|
function referendumsInfo(instanceId, api7) {
|
|
742476
|
-
return memo2(instanceId, (ids) => ids.length ? api7.query.democracy.referendumInfoOf.multi(ids).pipe((0,
|
|
742596
|
+
return memo2(instanceId, (ids) => ids.length ? api7.query.democracy.referendumInfoOf.multi(ids).pipe((0, import_rxjs92.switchMap)((infos) => (0, import_rxjs92.combineLatest)(ids.map((id5, index) => api7.derive.democracy._referendumInfo(id5, infos[index])))), (0, import_rxjs92.map)((infos) => infos.filter((r37) => !!r37))) : (0, import_rxjs92.of)([]));
|
|
742477
742597
|
}
|
|
742478
742598
|
|
|
742479
742599
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/democracy/sqrtElectorate.js
|
|
742480
|
-
var
|
|
742600
|
+
var import_rxjs93 = require("rxjs");
|
|
742481
742601
|
function sqrtElectorate(instanceId, api7) {
|
|
742482
|
-
return memo2(instanceId, () => api7.query.balances.totalIssuance().pipe((0,
|
|
742602
|
+
return memo2(instanceId, () => api7.query.balances.totalIssuance().pipe((0, import_rxjs93.map)(bnSqrt)));
|
|
742483
742603
|
}
|
|
742484
742604
|
|
|
742485
742605
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/elections/index.js
|
|
@@ -742489,7 +742609,7 @@ __export(elections_exports, {
|
|
|
742489
742609
|
});
|
|
742490
742610
|
|
|
742491
742611
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/elections/info.js
|
|
742492
|
-
var
|
|
742612
|
+
var import_rxjs94 = require("rxjs");
|
|
742493
742613
|
function isSeatHolder(value5) {
|
|
742494
742614
|
return !Array.isArray(value5);
|
|
742495
742615
|
}
|
|
@@ -742531,17 +742651,17 @@ function queryAll(api7, council, elections) {
|
|
|
742531
742651
|
]);
|
|
742532
742652
|
}
|
|
742533
742653
|
function queryCouncil(api7, council) {
|
|
742534
|
-
return (0,
|
|
742654
|
+
return (0, import_rxjs94.combineLatest)([
|
|
742535
742655
|
api7.query[council].members(),
|
|
742536
|
-
(0,
|
|
742537
|
-
(0,
|
|
742538
|
-
(0,
|
|
742656
|
+
(0, import_rxjs94.of)([]),
|
|
742657
|
+
(0, import_rxjs94.of)([]),
|
|
742658
|
+
(0, import_rxjs94.of)([])
|
|
742539
742659
|
]);
|
|
742540
742660
|
}
|
|
742541
742661
|
function info2(instanceId, api7) {
|
|
742542
742662
|
return memo2(instanceId, () => {
|
|
742543
742663
|
const [council, elections] = getModules(api7);
|
|
742544
|
-
return (elections ? queryAll(api7, council, elections) : queryCouncil(api7, council)).pipe((0,
|
|
742664
|
+
return (elections ? queryAll(api7, council, elections) : queryCouncil(api7, council)).pipe((0, import_rxjs94.map)(([councilMembers, candidates2, members7, runnersUp]) => objectSpread({}, getConstants(api7, elections), {
|
|
742545
742665
|
candidateCount: api7.registry.createType("u32", candidates2.length),
|
|
742546
742666
|
candidates: candidates2.map(getCandidate),
|
|
742547
742667
|
members: members7.length ? members7.map(getAccountTuple).sort(sortAccounts) : councilMembers.map((a72) => [a72, api7.registry.createType("Balance")]),
|
|
@@ -742557,7 +742677,7 @@ __export(imOnline_exports, {
|
|
|
742557
742677
|
});
|
|
742558
742678
|
|
|
742559
742679
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/imOnline/receivedHeartbeats.js
|
|
742560
|
-
var
|
|
742680
|
+
var import_rxjs95 = require("rxjs");
|
|
742561
742681
|
function mapResult([result2, validators7, heartbeats, numBlocks]) {
|
|
742562
742682
|
validators7.forEach((validator2, index) => {
|
|
742563
742683
|
const validatorId = validator2.toString();
|
|
@@ -742575,12 +742695,12 @@ function mapResult([result2, validators7, heartbeats, numBlocks]) {
|
|
|
742575
742695
|
return result2;
|
|
742576
742696
|
}
|
|
742577
742697
|
function receivedHeartbeats(instanceId, api7) {
|
|
742578
|
-
return memo2(instanceId, () => api7.query.imOnline?.receivedHeartbeats ? api7.derive.staking.overview().pipe((0,
|
|
742579
|
-
(0,
|
|
742580
|
-
(0,
|
|
742698
|
+
return memo2(instanceId, () => api7.query.imOnline?.receivedHeartbeats ? api7.derive.staking.overview().pipe((0, import_rxjs95.switchMap)(({ currentIndex, validators: validators7 }) => (0, import_rxjs95.combineLatest)([
|
|
742699
|
+
(0, import_rxjs95.of)({}),
|
|
742700
|
+
(0, import_rxjs95.of)(validators7),
|
|
742581
742701
|
api7.query.imOnline.receivedHeartbeats.multi(validators7.map((_address, index) => [currentIndex, index])),
|
|
742582
742702
|
api7.query.imOnline.authoredBlocks.multi(validators7.map((address4) => [currentIndex, address4]))
|
|
742583
|
-
])), (0,
|
|
742703
|
+
])), (0, import_rxjs95.map)(mapResult)) : (0, import_rxjs95.of)({}));
|
|
742584
742704
|
}
|
|
742585
742705
|
|
|
742586
742706
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/membership/index.js
|
|
@@ -742610,7 +742730,7 @@ __export(parachains_exports, {
|
|
|
742610
742730
|
});
|
|
742611
742731
|
|
|
742612
742732
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/parachains/info.js
|
|
742613
|
-
var
|
|
742733
|
+
var import_rxjs96 = require("rxjs");
|
|
742614
742734
|
|
|
742615
742735
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/parachains/util.js
|
|
742616
742736
|
function didUpdateToBool(didUpdate, id5) {
|
|
@@ -742664,11 +742784,11 @@ function info3(instanceId, api7) {
|
|
|
742664
742784
|
[api7.query["registrar"]["pendingSwap"], id5],
|
|
742665
742785
|
[api7.query["parachains"]["heads"], id5],
|
|
742666
742786
|
[api7.query["parachains"]["relayDispatchQueue"], id5]
|
|
742667
|
-
]).pipe((0,
|
|
742787
|
+
]).pipe((0, import_rxjs96.map)((result2) => parse8(api7.registry.createType("ParaId", id5), result2))) : (0, import_rxjs96.of)(null));
|
|
742668
742788
|
}
|
|
742669
742789
|
|
|
742670
742790
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/parachains/overview.js
|
|
742671
|
-
var
|
|
742791
|
+
var import_rxjs97 = require("rxjs");
|
|
742672
742792
|
function parse9([ids, didUpdate, relayDispatchQueueSizes, infos, pendingSwaps]) {
|
|
742673
742793
|
return ids.map((id5, index) => ({
|
|
742674
742794
|
didUpdate: didUpdateToBool(didUpdate, id5),
|
|
@@ -742679,13 +742799,13 @@ function parse9([ids, didUpdate, relayDispatchQueueSizes, infos, pendingSwaps])
|
|
|
742679
742799
|
}));
|
|
742680
742800
|
}
|
|
742681
742801
|
function overview(instanceId, api7) {
|
|
742682
|
-
return memo2(instanceId, () => api7.query["registrar"]?.["parachains"] && api7.query["parachains"] ? api7.query["registrar"]["parachains"]().pipe((0,
|
|
742683
|
-
(0,
|
|
742802
|
+
return memo2(instanceId, () => api7.query["registrar"]?.["parachains"] && api7.query["parachains"] ? api7.query["registrar"]["parachains"]().pipe((0, import_rxjs97.switchMap)((paraIds) => (0, import_rxjs97.combineLatest)([
|
|
742803
|
+
(0, import_rxjs97.of)(paraIds),
|
|
742684
742804
|
api7.query["parachains"]["didUpdate"](),
|
|
742685
742805
|
api7.query["parachains"]["relayDispatchQueueSize"].multi(paraIds),
|
|
742686
742806
|
api7.query["registrar"]["paras"].multi(paraIds),
|
|
742687
742807
|
api7.query["registrar"]["pendingSwap"].multi(paraIds)
|
|
742688
|
-
])), (0,
|
|
742808
|
+
])), (0, import_rxjs97.map)(parse9)) : (0, import_rxjs97.of)([]));
|
|
742689
742809
|
}
|
|
742690
742810
|
|
|
742691
742811
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/session/index.js
|
|
@@ -742700,7 +742820,7 @@ __export(session_exports, {
|
|
|
742700
742820
|
});
|
|
742701
742821
|
|
|
742702
742822
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/session/indexes.js
|
|
742703
|
-
var
|
|
742823
|
+
var import_rxjs98 = require("rxjs");
|
|
742704
742824
|
function parse10([currentIndex, activeEra, activeEraStart, currentEra, validatorCount]) {
|
|
742705
742825
|
return {
|
|
742706
742826
|
activeEra,
|
|
@@ -742716,7 +742836,7 @@ function queryStaking(api7) {
|
|
|
742716
742836
|
api7.query.staking.activeEra,
|
|
742717
742837
|
api7.query.staking.currentEra,
|
|
742718
742838
|
api7.query.staking.validatorCount
|
|
742719
|
-
]).pipe((0,
|
|
742839
|
+
]).pipe((0, import_rxjs98.map)(([currentIndex, activeOpt, currentEra, validatorCount]) => {
|
|
742720
742840
|
const { index, start } = activeOpt.unwrapOrDefault();
|
|
742721
742841
|
return parse10([
|
|
742722
742842
|
currentIndex,
|
|
@@ -742728,7 +742848,7 @@ function queryStaking(api7) {
|
|
|
742728
742848
|
}));
|
|
742729
742849
|
}
|
|
742730
742850
|
function querySession(api7) {
|
|
742731
|
-
return api7.query.session.currentIndex().pipe((0,
|
|
742851
|
+
return api7.query.session.currentIndex().pipe((0, import_rxjs98.map)((currentIndex) => parse10([
|
|
742732
742852
|
currentIndex,
|
|
742733
742853
|
api7.registry.createType("EraIndex"),
|
|
742734
742854
|
api7.registry.createType("Option<Moment>"),
|
|
@@ -742737,7 +742857,7 @@ function querySession(api7) {
|
|
|
742737
742857
|
])));
|
|
742738
742858
|
}
|
|
742739
742859
|
function empty4(api7) {
|
|
742740
|
-
return (0,
|
|
742860
|
+
return (0, import_rxjs98.of)(parse10([
|
|
742741
742861
|
api7.registry.createType("SessionIndex", 1),
|
|
742742
742862
|
api7.registry.createType("EraIndex"),
|
|
742743
742863
|
api7.registry.createType("Option<Moment>"),
|
|
@@ -742750,9 +742870,9 @@ function indexes2(instanceId, api7) {
|
|
|
742750
742870
|
}
|
|
742751
742871
|
|
|
742752
742872
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/session/info.js
|
|
742753
|
-
var
|
|
742873
|
+
var import_rxjs99 = require("rxjs");
|
|
742754
742874
|
function info4(instanceId, api7) {
|
|
742755
|
-
return memo2(instanceId, () => api7.derive.session.indexes().pipe((0,
|
|
742875
|
+
return memo2(instanceId, () => api7.derive.session.indexes().pipe((0, import_rxjs99.map)((indexes3) => {
|
|
742756
742876
|
const sessionLength = api7.consts?.babe?.epochDuration || api7.registry.createType("u64", 1);
|
|
742757
742877
|
const sessionsPerEra = api7.consts?.staking?.sessionsPerEra || api7.registry.createType("SessionIndex", 1);
|
|
742758
742878
|
return objectSpread({
|
|
@@ -742765,9 +742885,9 @@ function info4(instanceId, api7) {
|
|
|
742765
742885
|
}
|
|
742766
742886
|
|
|
742767
742887
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/session/progress.js
|
|
742768
|
-
var
|
|
742888
|
+
var import_rxjs100 = require("rxjs");
|
|
742769
742889
|
function withProgressField(field) {
|
|
742770
|
-
return (instanceId, api7) => memo2(instanceId, () => api7.derive.session.progress().pipe((0,
|
|
742890
|
+
return (instanceId, api7) => memo2(instanceId, () => api7.derive.session.progress().pipe((0, import_rxjs100.map)((info6) => info6[field])));
|
|
742771
742891
|
}
|
|
742772
742892
|
function createDerive(api7, info6, [currentSlot, epochIndex, epochOrGenesisStartSlot, activeEraStartSessionIndex]) {
|
|
742773
742893
|
const epochStartSlot = epochIndex.mul(info6.sessionLength).iadd(epochOrGenesisStartSlot);
|
|
@@ -742779,14 +742899,14 @@ function createDerive(api7, info6, [currentSlot, epochIndex, epochOrGenesisStart
|
|
|
742779
742899
|
}, info6);
|
|
742780
742900
|
}
|
|
742781
742901
|
function queryAura(api7) {
|
|
742782
|
-
return api7.derive.session.info().pipe((0,
|
|
742902
|
+
return api7.derive.session.info().pipe((0, import_rxjs100.map)((info6) => objectSpread({
|
|
742783
742903
|
eraProgress: api7.registry.createType("BlockNumber"),
|
|
742784
742904
|
sessionProgress: api7.registry.createType("BlockNumber")
|
|
742785
742905
|
}, info6)));
|
|
742786
742906
|
}
|
|
742787
742907
|
function queryBabe(api7) {
|
|
742788
|
-
return api7.derive.session.info().pipe((0,
|
|
742789
|
-
(0,
|
|
742908
|
+
return api7.derive.session.info().pipe((0, import_rxjs100.switchMap)((info6) => (0, import_rxjs100.combineLatest)([
|
|
742909
|
+
(0, import_rxjs100.of)(info6),
|
|
742790
742910
|
// we may have no staking, but have babe (permissioned)
|
|
742791
742911
|
api7.query.staking?.erasStartSessionIndex ? api7.queryMulti([
|
|
742792
742912
|
api7.query.babe.currentSlot,
|
|
@@ -742798,13 +742918,13 @@ function queryBabe(api7) {
|
|
|
742798
742918
|
api7.query.babe.epochIndex,
|
|
742799
742919
|
api7.query.babe.genesisSlot
|
|
742800
742920
|
])
|
|
742801
|
-
])), (0,
|
|
742921
|
+
])), (0, import_rxjs100.map)(([info6, [currentSlot, epochIndex, genesisSlot, optStartIndex]]) => [
|
|
742802
742922
|
info6,
|
|
742803
742923
|
[currentSlot, epochIndex, genesisSlot, optStartIndex && optStartIndex.isSome ? optStartIndex.unwrap() : api7.registry.createType("SessionIndex", 1)]
|
|
742804
742924
|
]));
|
|
742805
742925
|
}
|
|
742806
742926
|
function progress(instanceId, api7) {
|
|
742807
|
-
return memo2(instanceId, () => api7.query.babe ? queryBabe(api7).pipe((0,
|
|
742927
|
+
return memo2(instanceId, () => api7.query.babe ? queryBabe(api7).pipe((0, import_rxjs100.map)(([info6, slots]) => createDerive(api7, info6, slots))) : queryAura(api7));
|
|
742808
742928
|
}
|
|
742809
742929
|
var eraLength = /* @__PURE__ */ withProgressField("eraLength");
|
|
742810
742930
|
var eraProgress = /* @__PURE__ */ withProgressField("eraProgress");
|
|
@@ -742821,12 +742941,12 @@ __export(society_exports, {
|
|
|
742821
742941
|
});
|
|
742822
742942
|
|
|
742823
742943
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/society/candidates.js
|
|
742824
|
-
var
|
|
742944
|
+
var import_rxjs101 = require("rxjs");
|
|
742825
742945
|
function getPrev(api7) {
|
|
742826
|
-
return api7.query.society.candidates().pipe((0,
|
|
742827
|
-
(0,
|
|
742946
|
+
return api7.query.society.candidates().pipe((0, import_rxjs101.switchMap)((candidates2) => (0, import_rxjs101.combineLatest)([
|
|
742947
|
+
(0, import_rxjs101.of)(candidates2),
|
|
742828
742948
|
api7.query.society["suspendedCandidates"].multi(candidates2.map(({ who }) => who))
|
|
742829
|
-
])), (0,
|
|
742949
|
+
])), (0, import_rxjs101.map)(([candidates2, suspended]) => candidates2.map(({ kind, value: value5, who }, index) => ({
|
|
742830
742950
|
accountId: who,
|
|
742831
742951
|
isSuspended: suspended[index].isSome,
|
|
742832
742952
|
kind,
|
|
@@ -742834,7 +742954,7 @@ function getPrev(api7) {
|
|
|
742834
742954
|
}))));
|
|
742835
742955
|
}
|
|
742836
742956
|
function getCurr(api7) {
|
|
742837
|
-
return api7.query.society.candidates.entries().pipe((0,
|
|
742957
|
+
return api7.query.society.candidates.entries().pipe((0, import_rxjs101.map)((entries) => entries.filter(([, opt]) => opt.isSome).map(([{ args: [accountId2] }, opt]) => [accountId2, opt.unwrap()]).map(([accountId2, { bid, kind }]) => ({
|
|
742838
742958
|
accountId: accountId2,
|
|
742839
742959
|
isSuspended: false,
|
|
742840
742960
|
kind,
|
|
@@ -742846,16 +742966,16 @@ function candidates(instanceId, api7) {
|
|
|
742846
742966
|
}
|
|
742847
742967
|
|
|
742848
742968
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/society/info.js
|
|
742849
|
-
var
|
|
742969
|
+
var import_rxjs102 = require("rxjs");
|
|
742850
742970
|
function info5(instanceId, api7) {
|
|
742851
|
-
return memo2(instanceId, () => (0,
|
|
742971
|
+
return memo2(instanceId, () => (0, import_rxjs102.combineLatest)([
|
|
742852
742972
|
api7.query.society.bids(),
|
|
742853
|
-
api7.query.society["defender"] ? api7.query.society["defender"]() : (0,
|
|
742973
|
+
api7.query.society["defender"] ? api7.query.society["defender"]() : (0, import_rxjs102.of)(void 0),
|
|
742854
742974
|
api7.query.society.founder(),
|
|
742855
742975
|
api7.query.society.head(),
|
|
742856
|
-
api7.query.society["maxMembers"] ? api7.query.society["maxMembers"]() : (0,
|
|
742976
|
+
api7.query.society["maxMembers"] ? api7.query.society["maxMembers"]() : (0, import_rxjs102.of)(void 0),
|
|
742857
742977
|
api7.query.society.pot()
|
|
742858
|
-
]).pipe((0,
|
|
742978
|
+
]).pipe((0, import_rxjs102.map)(([bids, defender, founder, head2, maxMembers, pot]) => ({
|
|
742859
742979
|
bids,
|
|
742860
742980
|
defender: defender?.unwrapOr(void 0),
|
|
742861
742981
|
founder: founder.unwrapOr(void 0),
|
|
@@ -742867,22 +742987,22 @@ function info5(instanceId, api7) {
|
|
|
742867
742987
|
}
|
|
742868
742988
|
|
|
742869
742989
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/society/member.js
|
|
742870
|
-
var
|
|
742990
|
+
var import_rxjs103 = require("rxjs");
|
|
742871
742991
|
function member(instanceId, api7) {
|
|
742872
|
-
return memo2(instanceId, (accountId2) => api7.derive.society._members([accountId2]).pipe((0,
|
|
742992
|
+
return memo2(instanceId, (accountId2) => api7.derive.society._members([accountId2]).pipe((0, import_rxjs103.map)(([result2]) => result2)));
|
|
742873
742993
|
}
|
|
742874
742994
|
|
|
742875
742995
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/society/members.js
|
|
742876
|
-
var
|
|
742996
|
+
var import_rxjs104 = require("rxjs");
|
|
742877
742997
|
function _membersPrev(api7, accountIds) {
|
|
742878
|
-
return (0,
|
|
742879
|
-
(0,
|
|
742998
|
+
return (0, import_rxjs104.combineLatest)([
|
|
742999
|
+
(0, import_rxjs104.of)(accountIds),
|
|
742880
743000
|
api7.query.society.payouts.multi(accountIds),
|
|
742881
743001
|
api7.query.society["strikes"].multi(accountIds),
|
|
742882
743002
|
api7.query.society.defenderVotes.multi(accountIds),
|
|
742883
743003
|
api7.query.society.suspendedMembers.multi(accountIds),
|
|
742884
743004
|
api7.query.society["vouching"].multi(accountIds)
|
|
742885
|
-
]).pipe((0,
|
|
743005
|
+
]).pipe((0, import_rxjs104.map)(([accountIds2, payouts, strikes, defenderVotes, suspended, vouching]) => accountIds2.map((accountId2, index) => ({
|
|
742886
743006
|
accountId: accountId2,
|
|
742887
743007
|
isDefenderVoter: defenderVotes[index].isSome,
|
|
742888
743008
|
isSuspended: suspended[index].isTrue,
|
|
@@ -742893,13 +743013,13 @@ function _membersPrev(api7, accountIds) {
|
|
|
742893
743013
|
}))));
|
|
742894
743014
|
}
|
|
742895
743015
|
function _membersCurr(api7, accountIds) {
|
|
742896
|
-
return (0,
|
|
742897
|
-
(0,
|
|
743016
|
+
return (0, import_rxjs104.combineLatest)([
|
|
743017
|
+
(0, import_rxjs104.of)(accountIds),
|
|
742898
743018
|
api7.query.society.members.multi(accountIds),
|
|
742899
743019
|
api7.query.society.payouts.multi(accountIds),
|
|
742900
|
-
api7.query.society.challengeRoundCount().pipe((0,
|
|
743020
|
+
api7.query.society.challengeRoundCount().pipe((0, import_rxjs104.switchMap)((round) => api7.query.society.defenderVotes.multi(accountIds.map((accountId2) => [round, accountId2])))),
|
|
742901
743021
|
api7.query.society.suspendedMembers.multi(accountIds)
|
|
742902
|
-
]).pipe((0,
|
|
743022
|
+
]).pipe((0, import_rxjs104.map)(([accountIds2, members7, payouts, defenderVotes, suspendedMembers]) => accountIds2.map((accountId2, index) => members7[index].isSome ? {
|
|
742903
743023
|
accountId: accountId2,
|
|
742904
743024
|
isDefenderVoter: defenderVotes[index].isSome,
|
|
742905
743025
|
isSuspended: suspendedMembers[index].isSome,
|
|
@@ -742918,7 +743038,7 @@ function _members(instanceId, api7) {
|
|
|
742918
743038
|
return memo2(instanceId, (accountIds) => api7.query.society.members.creator.meta.type.isMap ? _membersCurr(api7, accountIds) : _membersPrev(api7, accountIds));
|
|
742919
743039
|
}
|
|
742920
743040
|
function members5(instanceId, api7) {
|
|
742921
|
-
return memo2(instanceId, () => api7.query.society.members.creator.meta.type.isMap ? api7.query.society.members.keys().pipe((0,
|
|
743041
|
+
return memo2(instanceId, () => api7.query.society.members.creator.meta.type.isMap ? api7.query.society.members.keys().pipe((0, import_rxjs104.switchMap)((keys2) => api7.derive.society._members(keys2.map(({ args: [accountId2] }) => accountId2)))) : api7.query.society.members().pipe((0, import_rxjs104.switchMap)((members7) => api7.derive.society._members(members7))));
|
|
742922
743042
|
}
|
|
742923
743043
|
|
|
742924
743044
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/index.js
|
|
@@ -742977,7 +743097,7 @@ __export(staking_exports, {
|
|
|
742977
743097
|
});
|
|
742978
743098
|
|
|
742979
743099
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/account.js
|
|
742980
|
-
var
|
|
743100
|
+
var import_rxjs105 = require("rxjs");
|
|
742981
743101
|
var QUERY_OPTS = {
|
|
742982
743102
|
withDestination: true,
|
|
742983
743103
|
withLedger: true,
|
|
@@ -743010,27 +743130,27 @@ function parseResult2(api7, sessionInfo, keys2, query3) {
|
|
|
743010
743130
|
});
|
|
743011
743131
|
}
|
|
743012
743132
|
function accounts(instanceId, api7) {
|
|
743013
|
-
return memo2(instanceId, (accountIds, opts = QUERY_OPTS) => api7.derive.session.info().pipe((0,
|
|
743133
|
+
return memo2(instanceId, (accountIds, opts = QUERY_OPTS) => api7.derive.session.info().pipe((0, import_rxjs105.switchMap)((sessionInfo) => (0, import_rxjs105.combineLatest)([
|
|
743014
743134
|
api7.derive.staking.keysMulti(accountIds),
|
|
743015
743135
|
api7.derive.staking.queryMulti(accountIds, opts)
|
|
743016
|
-
]).pipe((0,
|
|
743136
|
+
]).pipe((0, import_rxjs105.map)(([keys2, queries]) => queries.map((q8, index) => parseResult2(api7, sessionInfo, keys2[index], q8)))))));
|
|
743017
743137
|
}
|
|
743018
743138
|
var account2 = /* @__PURE__ */ firstMemo((api7, accountId2, opts) => api7.derive.staking.accounts([accountId2], opts));
|
|
743019
743139
|
|
|
743020
743140
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/currentPoints.js
|
|
743021
|
-
var
|
|
743141
|
+
var import_rxjs106 = require("rxjs");
|
|
743022
743142
|
function currentPoints(instanceId, api7) {
|
|
743023
|
-
return memo2(instanceId, () => api7.derive.session.indexes().pipe((0,
|
|
743143
|
+
return memo2(instanceId, () => api7.derive.session.indexes().pipe((0, import_rxjs106.switchMap)(({ activeEra }) => api7.query.staking.erasRewardPoints(activeEra))));
|
|
743024
743144
|
}
|
|
743025
743145
|
|
|
743026
743146
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/electedInfo.js
|
|
743027
|
-
var
|
|
743147
|
+
var import_rxjs107 = require("rxjs");
|
|
743028
743148
|
var DEFAULT_FLAGS = { withController: true, withExposure: true, withPrefs: true };
|
|
743029
743149
|
function combineAccounts(nextElected2, validators7) {
|
|
743030
743150
|
return arrayFlatten([nextElected2, validators7.filter((v39) => !nextElected2.find((n44) => n44.eq(v39)))]);
|
|
743031
743151
|
}
|
|
743032
743152
|
function electedInfo(instanceId, api7) {
|
|
743033
|
-
return memo2(instanceId, (flags2 = DEFAULT_FLAGS, page = 0) => api7.derive.staking.validators().pipe((0,
|
|
743153
|
+
return memo2(instanceId, (flags2 = DEFAULT_FLAGS, page = 0) => api7.derive.staking.validators().pipe((0, import_rxjs107.switchMap)(({ nextElected: nextElected2, validators: validators7 }) => api7.derive.staking.queryMulti(combineAccounts(nextElected2, validators7), flags2, page).pipe((0, import_rxjs107.map)((info6) => ({
|
|
743034
743154
|
info: info6,
|
|
743035
743155
|
nextElected: nextElected2,
|
|
743036
743156
|
validators: validators7
|
|
@@ -743038,7 +743158,7 @@ function electedInfo(instanceId, api7) {
|
|
|
743038
743158
|
}
|
|
743039
743159
|
|
|
743040
743160
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/erasExposure.js
|
|
743041
|
-
var
|
|
743161
|
+
var import_rxjs109 = require("rxjs");
|
|
743042
743162
|
|
|
743043
743163
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/cache.js
|
|
743044
743164
|
function getEraCache(CACHE_KEY6, era, withActive) {
|
|
@@ -743065,18 +743185,18 @@ function filterCachedEras(eras, cached2, query3) {
|
|
|
743065
743185
|
}
|
|
743066
743186
|
|
|
743067
743187
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/util.js
|
|
743068
|
-
var
|
|
743188
|
+
var import_rxjs108 = require("rxjs");
|
|
743069
743189
|
var ERA_CHUNK_SIZE = 14;
|
|
743070
743190
|
function chunkEras(eras, fn3) {
|
|
743071
743191
|
const chunked = arrayChunk(eras, ERA_CHUNK_SIZE);
|
|
743072
743192
|
let index = 0;
|
|
743073
|
-
const subject = new
|
|
743074
|
-
return subject.pipe((0,
|
|
743193
|
+
const subject = new import_rxjs108.BehaviorSubject(chunked[index]);
|
|
743194
|
+
return subject.pipe((0, import_rxjs108.switchMap)(fn3), (0, import_rxjs108.tap)(() => {
|
|
743075
743195
|
nextTick2(() => {
|
|
743076
743196
|
index++;
|
|
743077
743197
|
index === chunked.length ? subject.complete() : subject.next(chunked[index]);
|
|
743078
743198
|
});
|
|
743079
|
-
}), (0,
|
|
743199
|
+
}), (0, import_rxjs108.toArray)(), (0, import_rxjs108.map)(arrayFlatten));
|
|
743080
743200
|
}
|
|
743081
743201
|
function filterEras(eras, list2) {
|
|
743082
743202
|
return eras.filter((e34) => !list2.some(({ era }) => e34.eq(era)));
|
|
@@ -743085,14 +743205,14 @@ function erasHistoricApply(fn3) {
|
|
|
743085
743205
|
return (instanceId, api7) => (
|
|
743086
743206
|
// Cannot quite get the typing right, but it is right in the code
|
|
743087
743207
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
743088
|
-
memo2(instanceId, (withActive = false) => api7.derive.staking.erasHistoric(withActive).pipe((0,
|
|
743208
|
+
memo2(instanceId, (withActive = false) => api7.derive.staking.erasHistoric(withActive).pipe((0, import_rxjs108.switchMap)((e34) => api7.derive.staking[fn3](e34, withActive))))
|
|
743089
743209
|
);
|
|
743090
743210
|
}
|
|
743091
743211
|
function erasHistoricApplyAccount(fn3) {
|
|
743092
743212
|
return (instanceId, api7) => (
|
|
743093
743213
|
// Cannot quite get the typing right, but it is right in the code
|
|
743094
743214
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
743095
|
-
memo2(instanceId, (accountId2, withActive = false, page) => api7.derive.staking.erasHistoric(withActive).pipe((0,
|
|
743215
|
+
memo2(instanceId, (accountId2, withActive = false, page) => api7.derive.staking.erasHistoric(withActive).pipe((0, import_rxjs108.switchMap)((e34) => api7.derive.staking[fn3](accountId2, e34, withActive, page || 0))))
|
|
743096
743216
|
);
|
|
743097
743217
|
}
|
|
743098
743218
|
function singleEra(fn3) {
|
|
@@ -743106,7 +743226,7 @@ function combineEras(fn3) {
|
|
|
743106
743226
|
return (instanceId, api7) => (
|
|
743107
743227
|
// Cannot quite get the typing right, but it is right in the code
|
|
743108
743228
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
743109
|
-
memo2(instanceId, (eras, withActive) => !eras.length ? (0,
|
|
743229
|
+
memo2(instanceId, (eras, withActive) => !eras.length ? (0, import_rxjs108.of)([]) : chunkEras(eras, (eras2) => (0, import_rxjs108.combineLatest)(eras2.map((e34) => api7.derive.staking[fn3](e34, withActive)))))
|
|
743110
743230
|
);
|
|
743111
743231
|
}
|
|
743112
743232
|
|
|
@@ -743146,7 +743266,7 @@ function mapStakersPaged(era, stakers) {
|
|
|
743146
743266
|
function _eraExposure(instanceId, api7) {
|
|
743147
743267
|
return memo2(instanceId, (era, withActive = false) => {
|
|
743148
743268
|
const [cacheKey, cached2] = getEraCache(CACHE_KEY, era, withActive);
|
|
743149
|
-
return cached2 ? (0,
|
|
743269
|
+
return cached2 ? (0, import_rxjs109.of)(cached2) : api7.query.staking.erasStakersPaged ? api7.query.staking.erasStakersPaged.entries(era).pipe((0, import_rxjs109.map)((r37) => setEraCache(cacheKey, withActive, mapStakersPaged(era, r37)))) : api7.query.staking.erasStakersClipped.entries(era).pipe((0, import_rxjs109.map)((r37) => setEraCache(cacheKey, withActive, mapStakersClipped(era, r37))));
|
|
743150
743270
|
});
|
|
743151
743271
|
}
|
|
743152
743272
|
var eraExposure = /* @__PURE__ */ singleEra("_eraExposure");
|
|
@@ -743154,12 +743274,12 @@ var _erasExposure = /* @__PURE__ */ combineEras("_eraExposure");
|
|
|
743154
743274
|
var erasExposure = /* @__PURE__ */ erasHistoricApply("_erasExposure");
|
|
743155
743275
|
|
|
743156
743276
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/erasHistoric.js
|
|
743157
|
-
var
|
|
743277
|
+
var import_rxjs110 = require("rxjs");
|
|
743158
743278
|
function erasHistoric(instanceId, api7) {
|
|
743159
|
-
return memo2(instanceId, (withActive) => (0,
|
|
743279
|
+
return memo2(instanceId, (withActive) => (0, import_rxjs110.combineLatest)([
|
|
743160
743280
|
api7.query.staking.activeEra(),
|
|
743161
|
-
api7.consts.staking.historyDepth ? (0,
|
|
743162
|
-
]).pipe((0,
|
|
743281
|
+
api7.consts.staking.historyDepth ? (0, import_rxjs110.of)(api7.consts.staking.historyDepth) : api7.query.staking["historyDepth"]()
|
|
743282
|
+
]).pipe((0, import_rxjs110.map)(([activeEraOpt, historyDepth]) => {
|
|
743163
743283
|
const result2 = [];
|
|
743164
743284
|
const max2 = historyDepth.toNumber();
|
|
743165
743285
|
const activeEra = activeEraOpt.unwrapOrDefault().index;
|
|
@@ -743175,7 +743295,7 @@ function erasHistoric(instanceId, api7) {
|
|
|
743175
743295
|
}
|
|
743176
743296
|
|
|
743177
743297
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/erasPoints.js
|
|
743178
|
-
var
|
|
743298
|
+
var import_rxjs111 = require("rxjs");
|
|
743179
743299
|
var CACHE_KEY2 = "eraPoints";
|
|
743180
743300
|
function mapValidators({ individual }) {
|
|
743181
743301
|
return [...individual.entries()].filter(([, points]) => points.gt(BN_ZERO)).reduce((result2, [validatorId, points]) => {
|
|
@@ -743193,17 +743313,17 @@ function mapPoints(eras, points) {
|
|
|
743193
743313
|
function _erasPoints(instanceId, api7) {
|
|
743194
743314
|
return memo2(instanceId, (eras, withActive) => {
|
|
743195
743315
|
if (!eras.length) {
|
|
743196
|
-
return (0,
|
|
743316
|
+
return (0, import_rxjs111.of)([]);
|
|
743197
743317
|
}
|
|
743198
743318
|
const cached2 = getEraMultiCache(CACHE_KEY2, eras, withActive);
|
|
743199
743319
|
const remaining = filterEras(eras, cached2);
|
|
743200
|
-
return !remaining.length ? (0,
|
|
743320
|
+
return !remaining.length ? (0, import_rxjs111.of)(cached2) : api7.query.staking.erasRewardPoints.multi(remaining).pipe((0, import_rxjs111.map)((p69) => filterCachedEras(eras, cached2, setEraMultiCache(CACHE_KEY2, withActive, mapPoints(remaining, p69)))));
|
|
743201
743321
|
});
|
|
743202
743322
|
}
|
|
743203
743323
|
var erasPoints = /* @__PURE__ */ erasHistoricApply("_erasPoints");
|
|
743204
743324
|
|
|
743205
743325
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/erasPrefs.js
|
|
743206
|
-
var
|
|
743326
|
+
var import_rxjs112 = require("rxjs");
|
|
743207
743327
|
var CACHE_KEY3 = "eraPrefs";
|
|
743208
743328
|
function mapPrefs(era, all8) {
|
|
743209
743329
|
const validators7 = {};
|
|
@@ -743215,7 +743335,7 @@ function mapPrefs(era, all8) {
|
|
|
743215
743335
|
function _eraPrefs(instanceId, api7) {
|
|
743216
743336
|
return memo2(instanceId, (era, withActive) => {
|
|
743217
743337
|
const [cacheKey, cached2] = getEraCache(CACHE_KEY3, era, withActive);
|
|
743218
|
-
return cached2 ? (0,
|
|
743338
|
+
return cached2 ? (0, import_rxjs112.of)(cached2) : api7.query.staking.erasValidatorPrefs.entries(era).pipe((0, import_rxjs112.map)((r37) => setEraCache(cacheKey, withActive, mapPrefs(era, r37))));
|
|
743219
743339
|
});
|
|
743220
743340
|
}
|
|
743221
743341
|
var eraPrefs = /* @__PURE__ */ singleEra("_eraPrefs");
|
|
@@ -743223,7 +743343,7 @@ var _erasPrefs = /* @__PURE__ */ combineEras("_eraPrefs");
|
|
|
743223
743343
|
var erasPrefs = /* @__PURE__ */ erasHistoricApply("_erasPrefs");
|
|
743224
743344
|
|
|
743225
743345
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/erasRewards.js
|
|
743226
|
-
var
|
|
743346
|
+
var import_rxjs113 = require("rxjs");
|
|
743227
743347
|
var CACHE_KEY4 = "eraRewards";
|
|
743228
743348
|
function mapRewards(eras, optRewards) {
|
|
743229
743349
|
return eras.map((era, index) => ({
|
|
@@ -743234,20 +743354,20 @@ function mapRewards(eras, optRewards) {
|
|
|
743234
743354
|
function _erasRewards(instanceId, api7) {
|
|
743235
743355
|
return memo2(instanceId, (eras, withActive) => {
|
|
743236
743356
|
if (!eras.length) {
|
|
743237
|
-
return (0,
|
|
743357
|
+
return (0, import_rxjs113.of)([]);
|
|
743238
743358
|
}
|
|
743239
743359
|
const cached2 = getEraMultiCache(CACHE_KEY4, eras, withActive);
|
|
743240
743360
|
const remaining = filterEras(eras, cached2);
|
|
743241
743361
|
if (!remaining.length) {
|
|
743242
|
-
return (0,
|
|
743362
|
+
return (0, import_rxjs113.of)(cached2);
|
|
743243
743363
|
}
|
|
743244
|
-
return api7.query.staking.erasValidatorReward.multi(remaining).pipe((0,
|
|
743364
|
+
return api7.query.staking.erasValidatorReward.multi(remaining).pipe((0, import_rxjs113.map)((r37) => filterCachedEras(eras, cached2, setEraMultiCache(CACHE_KEY4, withActive, mapRewards(remaining, r37)))));
|
|
743245
743365
|
});
|
|
743246
743366
|
}
|
|
743247
743367
|
var erasRewards = /* @__PURE__ */ erasHistoricApply("_erasRewards");
|
|
743248
743368
|
|
|
743249
743369
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/erasSlashes.js
|
|
743250
|
-
var
|
|
743370
|
+
var import_rxjs114 = require("rxjs");
|
|
743251
743371
|
var CACHE_KEY5 = "eraSlashes";
|
|
743252
743372
|
function mapSlashes(era, noms, vals) {
|
|
743253
743373
|
const nominators = {};
|
|
@@ -743263,10 +743383,10 @@ function mapSlashes(era, noms, vals) {
|
|
|
743263
743383
|
function _eraSlashes(instanceId, api7) {
|
|
743264
743384
|
return memo2(instanceId, (era, withActive) => {
|
|
743265
743385
|
const [cacheKey, cached2] = getEraCache(CACHE_KEY5, era, withActive);
|
|
743266
|
-
return cached2 ? (0,
|
|
743386
|
+
return cached2 ? (0, import_rxjs114.of)(cached2) : (0, import_rxjs114.combineLatest)([
|
|
743267
743387
|
api7.query.staking.nominatorSlashInEra.entries(era),
|
|
743268
743388
|
api7.query.staking.validatorSlashInEra.entries(era)
|
|
743269
|
-
]).pipe((0,
|
|
743389
|
+
]).pipe((0, import_rxjs114.map)(([n44, v39]) => setEraCache(cacheKey, withActive, mapSlashes(era, n44, v39))));
|
|
743270
743390
|
});
|
|
743271
743391
|
}
|
|
743272
743392
|
var eraSlashes = /* @__PURE__ */ singleEra("_eraSlashes");
|
|
@@ -743274,7 +743394,7 @@ var _erasSlashes = /* @__PURE__ */ combineEras("_eraSlashes");
|
|
|
743274
743394
|
var erasSlashes = /* @__PURE__ */ erasHistoricApply("_erasSlashes");
|
|
743275
743395
|
|
|
743276
743396
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/keys.js
|
|
743277
|
-
var
|
|
743397
|
+
var import_rxjs115 = require("rxjs");
|
|
743278
743398
|
function extractsIds(stashId, queuedKeys, nextKeys) {
|
|
743279
743399
|
const sessionIds = (queuedKeys.find(([currentId]) => currentId.eq(stashId)) || [void 0, []])[1];
|
|
743280
743400
|
const nextSessionIds = nextKeys.unwrapOr([]);
|
|
@@ -743285,59 +743405,59 @@ function extractsIds(stashId, queuedKeys, nextKeys) {
|
|
|
743285
743405
|
}
|
|
743286
743406
|
var keys = /* @__PURE__ */ firstMemo((api7, stashId) => api7.derive.staking.keysMulti([stashId]));
|
|
743287
743407
|
function keysMulti(instanceId, api7) {
|
|
743288
|
-
return memo2(instanceId, (stashIds) => stashIds.length ? api7.query.session.queuedKeys().pipe((0,
|
|
743289
|
-
(0,
|
|
743290
|
-
api7.consts["session"]?.["dedupKeyPrefix"] ? api7.query.session.nextKeys.multi(stashIds.map((s58) => [api7.consts["session"]["dedupKeyPrefix"], s58])) : (0,
|
|
743291
|
-
])), (0,
|
|
743408
|
+
return memo2(instanceId, (stashIds) => stashIds.length ? api7.query.session.queuedKeys().pipe((0, import_rxjs115.switchMap)((queuedKeys) => (0, import_rxjs115.combineLatest)([
|
|
743409
|
+
(0, import_rxjs115.of)(queuedKeys),
|
|
743410
|
+
api7.consts["session"]?.["dedupKeyPrefix"] ? api7.query.session.nextKeys.multi(stashIds.map((s58) => [api7.consts["session"]["dedupKeyPrefix"], s58])) : (0, import_rxjs115.combineLatest)(stashIds.map((s58) => api7.query.session.nextKeys(s58)))
|
|
743411
|
+
])), (0, import_rxjs115.map)(([queuedKeys, nextKeys]) => stashIds.map((stashId, index) => extractsIds(stashId, queuedKeys, nextKeys[index])))) : (0, import_rxjs115.of)([]));
|
|
743292
743412
|
}
|
|
743293
743413
|
|
|
743294
743414
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/overview.js
|
|
743295
|
-
var
|
|
743415
|
+
var import_rxjs116 = require("rxjs");
|
|
743296
743416
|
function overview2(instanceId, api7) {
|
|
743297
|
-
return memo2(instanceId, () => (0,
|
|
743417
|
+
return memo2(instanceId, () => (0, import_rxjs116.combineLatest)([
|
|
743298
743418
|
api7.derive.session.indexes(),
|
|
743299
743419
|
api7.derive.staking.validators()
|
|
743300
|
-
]).pipe((0,
|
|
743420
|
+
]).pipe((0, import_rxjs116.map)(([indexes3, { nextElected: nextElected2, validators: validators7 }]) => objectSpread({}, indexes3, {
|
|
743301
743421
|
nextElected: nextElected2,
|
|
743302
743422
|
validators: validators7
|
|
743303
743423
|
}))));
|
|
743304
743424
|
}
|
|
743305
743425
|
|
|
743306
743426
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/ownExposure.js
|
|
743307
|
-
var
|
|
743427
|
+
var import_rxjs117 = require("rxjs");
|
|
743308
743428
|
function _ownExposures(instanceId, api7) {
|
|
743309
743429
|
return memo2(instanceId, (accountId2, eras, _withActive, page) => {
|
|
743310
743430
|
const emptyStakingExposure = api7.registry.createType("Exposure");
|
|
743311
743431
|
const emptyOptionPage = api7.registry.createType("Option<Null>");
|
|
743312
743432
|
const emptyOptionMeta = api7.registry.createType("Option<Null>");
|
|
743313
|
-
return eras.length ? (0,
|
|
743433
|
+
return eras.length ? (0, import_rxjs117.combineLatest)([
|
|
743314
743434
|
// Backwards and forward compat for historical integrity when using `erasHistoricApplyAccount`
|
|
743315
|
-
api7.query.staking.erasStakersClipped ? (0,
|
|
743316
|
-
api7.query.staking.erasStakers ? (0,
|
|
743317
|
-
api7.query.staking.erasStakersPaged ? (0,
|
|
743318
|
-
api7.query.staking.erasStakersOverview ? (0,
|
|
743319
|
-
]).pipe((0,
|
|
743435
|
+
api7.query.staking.erasStakersClipped ? (0, import_rxjs117.combineLatest)(eras.map((e34) => api7.query.staking.erasStakersClipped(e34, accountId2))) : (0, import_rxjs117.of)(eras.map((_15) => emptyStakingExposure)),
|
|
743436
|
+
api7.query.staking.erasStakers ? (0, import_rxjs117.combineLatest)(eras.map((e34) => api7.query.staking.erasStakers(e34, accountId2))) : (0, import_rxjs117.of)(eras.map((_15) => emptyStakingExposure)),
|
|
743437
|
+
api7.query.staking.erasStakersPaged ? (0, import_rxjs117.combineLatest)(eras.map((e34) => api7.query.staking.erasStakersPaged(e34, accountId2, page))) : (0, import_rxjs117.of)(eras.map((_15) => emptyOptionPage)),
|
|
743438
|
+
api7.query.staking.erasStakersOverview ? (0, import_rxjs117.combineLatest)(eras.map((e34) => api7.query.staking.erasStakersOverview(e34, accountId2))) : (0, import_rxjs117.of)(eras.map((_15) => emptyOptionMeta))
|
|
743439
|
+
]).pipe((0, import_rxjs117.map)(([clp, exp, paged, expMeta]) => eras.map((era, index) => ({ clipped: clp[index], era, exposure: exp[index], exposureMeta: expMeta[index], exposurePaged: paged[index] })))) : (0, import_rxjs117.of)([]);
|
|
743320
743440
|
});
|
|
743321
743441
|
}
|
|
743322
743442
|
var ownExposure = /* @__PURE__ */ firstMemo((api7, accountId2, era, page) => api7.derive.staking._ownExposures(accountId2, [era], true, page || 0));
|
|
743323
743443
|
var ownExposures = /* @__PURE__ */ erasHistoricApplyAccount("_ownExposures");
|
|
743324
743444
|
|
|
743325
743445
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/ownSlashes.js
|
|
743326
|
-
var
|
|
743446
|
+
var import_rxjs118 = require("rxjs");
|
|
743327
743447
|
function _ownSlashes(instanceId, api7) {
|
|
743328
|
-
return memo2(instanceId, (accountId2, eras, _withActive) => eras.length ? (0,
|
|
743329
|
-
(0,
|
|
743330
|
-
(0,
|
|
743331
|
-
]).pipe((0,
|
|
743448
|
+
return memo2(instanceId, (accountId2, eras, _withActive) => eras.length ? (0, import_rxjs118.combineLatest)([
|
|
743449
|
+
(0, import_rxjs118.combineLatest)(eras.map((e34) => api7.query.staking.validatorSlashInEra(e34, accountId2))),
|
|
743450
|
+
(0, import_rxjs118.combineLatest)(eras.map((e34) => api7.query.staking.nominatorSlashInEra(e34, accountId2)))
|
|
743451
|
+
]).pipe((0, import_rxjs118.map)(([vals, noms]) => eras.map((era, index) => ({
|
|
743332
743452
|
era,
|
|
743333
743453
|
total: vals[index].isSome ? vals[index].unwrap()[1] : noms[index].unwrapOrDefault()
|
|
743334
|
-
})))) : (0,
|
|
743454
|
+
})))) : (0, import_rxjs118.of)([]));
|
|
743335
743455
|
}
|
|
743336
743456
|
var ownSlash = /* @__PURE__ */ firstMemo((api7, accountId2, era) => api7.derive.staking._ownSlashes(accountId2, [era], true));
|
|
743337
743457
|
var ownSlashes = /* @__PURE__ */ erasHistoricApplyAccount("_ownSlashes");
|
|
743338
743458
|
|
|
743339
743459
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/query.js
|
|
743340
|
-
var
|
|
743460
|
+
var import_rxjs119 = require("rxjs");
|
|
743341
743461
|
function rewardDestinationCompat(rewardDestination) {
|
|
743342
743462
|
return typeof rewardDestination.isSome === "boolean" ? rewardDestination.unwrapOr(null) : rewardDestination;
|
|
743343
743463
|
}
|
|
@@ -743403,7 +743523,7 @@ function parseDetails(api7, stashId, controllerIdOpt, nominatorsOpt, rewardDesti
|
|
|
743403
743523
|
function getLedgers(api7, optIds, { withLedger = false }) {
|
|
743404
743524
|
const ids = optIds.filter((o51) => withLedger && !!o51 && o51.isSome).map((o51) => o51.unwrap());
|
|
743405
743525
|
const emptyLed = api7.registry.createType("Option<StakingLedger>");
|
|
743406
|
-
return (ids.length ? (0,
|
|
743526
|
+
return (ids.length ? (0, import_rxjs119.combineLatest)(ids.map((s58) => api7.query.staking.ledger(s58))) : (0, import_rxjs119.of)([])).pipe((0, import_rxjs119.map)((optLedgers) => {
|
|
743407
743527
|
let offset2 = -1;
|
|
743408
743528
|
return optIds.map((o51) => o51 && o51.isSome ? optLedgers[++offset2] || emptyLed : emptyLed);
|
|
743409
743529
|
}));
|
|
@@ -743423,38 +743543,38 @@ function getStashInfo(api7, stashIds, activeEra, { withClaimedRewardsEras, withC
|
|
|
743423
743543
|
}
|
|
743424
743544
|
return activeEra.toNumber() - idx - 1;
|
|
743425
743545
|
});
|
|
743426
|
-
return (0,
|
|
743427
|
-
withController || withLedger ? (0,
|
|
743428
|
-
withNominations ? (0,
|
|
743429
|
-
withDestination ? (0,
|
|
743430
|
-
withPrefs ? (0,
|
|
743431
|
-
withExposure && api7.query.staking.erasStakersPaged ? (0,
|
|
743432
|
-
withExposureMeta && api7.query.staking.erasStakersOverview ? (0,
|
|
743433
|
-
withClaimedRewardsEras && api7.query.staking.claimedRewards ? (0,
|
|
743546
|
+
return (0, import_rxjs119.combineLatest)([
|
|
743547
|
+
withController || withLedger ? (0, import_rxjs119.combineLatest)(stashIds.map((s58) => api7.query.staking.bonded(s58))) : (0, import_rxjs119.of)(stashIds.map(() => null)),
|
|
743548
|
+
withNominations ? (0, import_rxjs119.combineLatest)(stashIds.map((s58) => api7.query.staking.nominators(s58))) : (0, import_rxjs119.of)(stashIds.map(() => emptyNoms)),
|
|
743549
|
+
withDestination ? (0, import_rxjs119.combineLatest)(stashIds.map((s58) => api7.query.staking.payee(s58))) : (0, import_rxjs119.of)(stashIds.map(() => emptyRewa)),
|
|
743550
|
+
withPrefs ? (0, import_rxjs119.combineLatest)(stashIds.map((s58) => api7.query.staking.validators(s58))) : (0, import_rxjs119.of)(stashIds.map(() => emptyPrefs)),
|
|
743551
|
+
withExposure && api7.query.staking.erasStakersPaged ? (0, import_rxjs119.combineLatest)(stashIds.map((s58) => api7.query.staking.erasStakersPaged(activeEra, s58, page))) : (0, import_rxjs119.of)(stashIds.map(() => emptyExpo)),
|
|
743552
|
+
withExposureMeta && api7.query.staking.erasStakersOverview ? (0, import_rxjs119.combineLatest)(stashIds.map((s58) => api7.query.staking.erasStakersOverview(activeEra, s58))) : (0, import_rxjs119.of)(stashIds.map(() => emptyExpoMeta)),
|
|
743553
|
+
withClaimedRewardsEras && api7.query.staking.claimedRewards ? (0, import_rxjs119.combineLatest)([
|
|
743434
743554
|
api7.query.staking.claimedRewards.entries(),
|
|
743435
743555
|
api7.query.staking.erasStakersOverview.entries()
|
|
743436
|
-
]).pipe((0,
|
|
743437
|
-
withExposureErasStakersLegacy && api7.query.staking.erasStakers ? (0,
|
|
743556
|
+
]).pipe((0, import_rxjs119.map)(([rewardsStorageVec, overviewStorageVec]) => filterRewards(stashIds, eras, rewardsStorageVec, overviewStorageVec))) : (0, import_rxjs119.of)(stashIds.map(() => emptyClaimedRewards)),
|
|
743557
|
+
withExposureErasStakersLegacy && api7.query.staking.erasStakers ? (0, import_rxjs119.combineLatest)(stashIds.map((s58) => api7.query.staking.erasStakers(activeEra, s58))) : (0, import_rxjs119.of)(stashIds.map(() => emptyExpoEraStakers))
|
|
743438
743558
|
]);
|
|
743439
743559
|
}
|
|
743440
743560
|
function getBatch(api7, activeEra, stashIds, flags2, page) {
|
|
743441
|
-
return getStashInfo(api7, stashIds, activeEra, flags2, page).pipe((0,
|
|
743561
|
+
return getStashInfo(api7, stashIds, activeEra, flags2, page).pipe((0, import_rxjs119.switchMap)(([controllerIdOpt, nominatorsOpt, rewardDestination, validatorPrefs, exposure, exposureMeta, claimedRewardsEras, exposureEraStakers]) => getLedgers(api7, controllerIdOpt, flags2).pipe((0, import_rxjs119.map)((stakingLedgerOpts) => stashIds.map((stashId, index) => parseDetails(api7, stashId, controllerIdOpt[index], nominatorsOpt[index], rewardDestination[index], validatorPrefs[index], exposure[index], stakingLedgerOpts[index], exposureMeta[index], claimedRewardsEras[index], exposureEraStakers[index]))))));
|
|
743442
743562
|
}
|
|
743443
743563
|
var query = /* @__PURE__ */ firstMemo((api7, accountId2, flags2, page) => api7.derive.staking.queryMulti([accountId2], flags2, page));
|
|
743444
743564
|
function queryMulti(instanceId, api7) {
|
|
743445
|
-
return memo2(instanceId, (accountIds, flags2, page) => api7.derive.session.indexes().pipe((0,
|
|
743565
|
+
return memo2(instanceId, (accountIds, flags2, page) => api7.derive.session.indexes().pipe((0, import_rxjs119.switchMap)(({ activeEra }) => {
|
|
743446
743566
|
const stashIds = accountIds.map((a72) => api7.registry.createType("AccountId", a72));
|
|
743447
743567
|
const p69 = page || 0;
|
|
743448
|
-
return stashIds.length ? getBatch(api7, activeEra, stashIds, flags2, p69) : (0,
|
|
743568
|
+
return stashIds.length ? getBatch(api7, activeEra, stashIds, flags2, p69) : (0, import_rxjs119.of)([]);
|
|
743449
743569
|
})));
|
|
743450
743570
|
}
|
|
743451
743571
|
|
|
743452
743572
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/stakerExposure.js
|
|
743453
|
-
var
|
|
743573
|
+
var import_rxjs120 = require("rxjs");
|
|
743454
743574
|
function _stakerExposures(instanceId, api7) {
|
|
743455
743575
|
return memo2(instanceId, (accountIds, eras, withActive = false) => {
|
|
743456
743576
|
const stakerIds = accountIds.map((a72) => api7.registry.createType("AccountId", a72).toString());
|
|
743457
|
-
return api7.derive.staking._erasExposure(eras, withActive).pipe((0,
|
|
743577
|
+
return api7.derive.staking._erasExposure(eras, withActive).pipe((0, import_rxjs120.map)((exposures) => stakerIds.map((stakerId) => exposures.map(({ era, nominators: allNominators, validators: allValidators }) => {
|
|
743458
743578
|
const isValidator = !!allValidators[stakerId];
|
|
743459
743579
|
const validators7 = {};
|
|
743460
743580
|
const nominating = allNominators[stakerId] || [];
|
|
@@ -743470,16 +743590,16 @@ function _stakerExposures(instanceId, api7) {
|
|
|
743470
743590
|
});
|
|
743471
743591
|
}
|
|
743472
743592
|
function stakerExposures(instanceId, api7) {
|
|
743473
|
-
return memo2(instanceId, (accountIds, withActive = false) => api7.derive.staking.erasHistoric(withActive).pipe((0,
|
|
743593
|
+
return memo2(instanceId, (accountIds, withActive = false) => api7.derive.staking.erasHistoric(withActive).pipe((0, import_rxjs120.switchMap)((eras) => api7.derive.staking._stakerExposures(accountIds, eras, withActive))));
|
|
743474
743594
|
}
|
|
743475
743595
|
var stakerExposure = /* @__PURE__ */ firstMemo((api7, accountId2, withActive) => api7.derive.staking.stakerExposures([accountId2], withActive));
|
|
743476
743596
|
|
|
743477
743597
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/stakerPoints.js
|
|
743478
|
-
var
|
|
743598
|
+
var import_rxjs121 = require("rxjs");
|
|
743479
743599
|
function _stakerPoints(instanceId, api7) {
|
|
743480
743600
|
return memo2(instanceId, (accountId2, eras, withActive) => {
|
|
743481
743601
|
const stakerId = api7.registry.createType("AccountId", accountId2).toString();
|
|
743482
|
-
return api7.derive.staking._erasPoints(eras, withActive).pipe((0,
|
|
743602
|
+
return api7.derive.staking._erasPoints(eras, withActive).pipe((0, import_rxjs121.map)((points) => points.map(({ era, eraPoints, validators: validators7 }) => ({
|
|
743483
743603
|
era,
|
|
743484
743604
|
eraPoints,
|
|
743485
743605
|
points: validators7[stakerId] || api7.registry.createType("RewardPoint")
|
|
@@ -743489,9 +743609,9 @@ function _stakerPoints(instanceId, api7) {
|
|
|
743489
743609
|
var stakerPoints = /* @__PURE__ */ erasHistoricApplyAccount("_stakerPoints");
|
|
743490
743610
|
|
|
743491
743611
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/stakerPrefs.js
|
|
743492
|
-
var
|
|
743612
|
+
var import_rxjs122 = require("rxjs");
|
|
743493
743613
|
function _stakerPrefs(instanceId, api7) {
|
|
743494
|
-
return memo2(instanceId, (accountId2, eras, _withActive) => api7.query.staking.erasValidatorPrefs.multi(eras.map((e34) => [e34, accountId2])).pipe((0,
|
|
743614
|
+
return memo2(instanceId, (accountId2, eras, _withActive) => api7.query.staking.erasValidatorPrefs.multi(eras.map((e34) => [e34, accountId2])).pipe((0, import_rxjs122.map)((all8) => all8.map((validatorPrefs, index) => ({
|
|
743495
743615
|
era: eras[index],
|
|
743496
743616
|
validatorPrefs
|
|
743497
743617
|
})))));
|
|
@@ -743499,7 +743619,7 @@ function _stakerPrefs(instanceId, api7) {
|
|
|
743499
743619
|
var stakerPrefs = /* @__PURE__ */ erasHistoricApplyAccount("_stakerPrefs");
|
|
743500
743620
|
|
|
743501
743621
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/stakerRewards.js
|
|
743502
|
-
var
|
|
743622
|
+
var import_rxjs123 = require("rxjs");
|
|
743503
743623
|
function extractCompatRewards(claimedRewardsEras, ledger) {
|
|
743504
743624
|
const l69 = ledger ? (ledger.legacyClaimedRewards || ledger.claimedRewards).toArray() : [];
|
|
743505
743625
|
return claimedRewardsEras.toArray().concat(l69);
|
|
@@ -743594,24 +743714,24 @@ function filterRewards2(eras, valInfo, { claimedRewardsEras, rewards, stakingLed
|
|
|
743594
743714
|
}));
|
|
743595
743715
|
}
|
|
743596
743716
|
function _stakerRewardsEras(instanceId, api7) {
|
|
743597
|
-
return memo2(instanceId, (eras, withActive = false) => (0,
|
|
743717
|
+
return memo2(instanceId, (eras, withActive = false) => (0, import_rxjs123.combineLatest)([
|
|
743598
743718
|
api7.derive.staking._erasPoints(eras, withActive),
|
|
743599
743719
|
api7.derive.staking._erasPrefs(eras, withActive),
|
|
743600
743720
|
api7.derive.staking._erasRewards(eras, withActive)
|
|
743601
743721
|
]));
|
|
743602
743722
|
}
|
|
743603
743723
|
function _stakerRewards(instanceId, api7) {
|
|
743604
|
-
return memo2(instanceId, (accountIds, eras, withActive = false) => (0,
|
|
743724
|
+
return memo2(instanceId, (accountIds, eras, withActive = false) => (0, import_rxjs123.combineLatest)([
|
|
743605
743725
|
api7.derive.staking.queryMulti(accountIds, { withClaimedRewardsEras: true, withLedger: true }),
|
|
743606
743726
|
api7.derive.staking._stakerExposures(accountIds, eras, withActive),
|
|
743607
743727
|
api7.derive.staking._stakerRewardsEras(eras, withActive)
|
|
743608
|
-
]).pipe((0,
|
|
743728
|
+
]).pipe((0, import_rxjs123.switchMap)(([queries, exposures, erasResult]) => {
|
|
743609
743729
|
const allRewards = queries.map(({ claimedRewardsEras, stakingLedger, stashId }, index) => !stashId || !stakingLedger && !claimedRewardsEras ? [] : parseRewards(api7, stashId, erasResult, exposures[index]));
|
|
743610
743730
|
if (withActive) {
|
|
743611
|
-
return (0,
|
|
743731
|
+
return (0, import_rxjs123.of)(allRewards);
|
|
743612
743732
|
}
|
|
743613
743733
|
const [allValidators, stashValidators] = allUniqValidators(allRewards);
|
|
743614
|
-
return api7.derive.staking.queryMulti(allValidators, { withClaimedRewardsEras: true, withLedger: true }).pipe((0,
|
|
743734
|
+
return api7.derive.staking.queryMulti(allValidators, { withClaimedRewardsEras: true, withLedger: true }).pipe((0, import_rxjs123.map)((queriedVals) => queries.map(({ claimedRewardsEras, stakingLedger }, index) => filterRewards2(eras, stashValidators[index].map((validatorId) => [
|
|
743615
743735
|
validatorId,
|
|
743616
743736
|
queriedVals.find((q8) => q8.accountId.eq(validatorId))
|
|
743617
743737
|
]).filter((v39) => !!v39[1]), {
|
|
@@ -743621,20 +743741,20 @@ function _stakerRewards(instanceId, api7) {
|
|
|
743621
743741
|
}))));
|
|
743622
743742
|
})));
|
|
743623
743743
|
}
|
|
743624
|
-
var stakerRewards = /* @__PURE__ */ firstMemo((api7, accountId2, withActive) => api7.derive.staking.erasHistoric(withActive).pipe((0,
|
|
743744
|
+
var stakerRewards = /* @__PURE__ */ firstMemo((api7, accountId2, withActive) => api7.derive.staking.erasHistoric(withActive).pipe((0, import_rxjs123.switchMap)((eras) => api7.derive.staking._stakerRewards([accountId2], eras, withActive))));
|
|
743625
743745
|
function stakerRewardsMultiEras(instanceId, api7) {
|
|
743626
|
-
return memo2(instanceId, (accountIds, eras) => accountIds.length && eras.length ? api7.derive.staking._stakerRewards(accountIds, eras, false) : (0,
|
|
743746
|
+
return memo2(instanceId, (accountIds, eras) => accountIds.length && eras.length ? api7.derive.staking._stakerRewards(accountIds, eras, false) : (0, import_rxjs123.of)([]));
|
|
743627
743747
|
}
|
|
743628
743748
|
function stakerRewardsMulti(instanceId, api7) {
|
|
743629
|
-
return memo2(instanceId, (accountIds, withActive = false) => api7.derive.staking.erasHistoric(withActive).pipe((0,
|
|
743749
|
+
return memo2(instanceId, (accountIds, withActive = false) => api7.derive.staking.erasHistoric(withActive).pipe((0, import_rxjs123.switchMap)((eras) => api7.derive.staking.stakerRewardsMultiEras(accountIds, eras))));
|
|
743630
743750
|
}
|
|
743631
743751
|
|
|
743632
743752
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/stakerSlashes.js
|
|
743633
|
-
var
|
|
743753
|
+
var import_rxjs124 = require("rxjs");
|
|
743634
743754
|
function _stakerSlashes(instanceId, api7) {
|
|
743635
743755
|
return memo2(instanceId, (accountId2, eras, withActive) => {
|
|
743636
743756
|
const stakerId = api7.registry.createType("AccountId", accountId2).toString();
|
|
743637
|
-
return api7.derive.staking._erasSlashes(eras, withActive).pipe((0,
|
|
743757
|
+
return api7.derive.staking._erasSlashes(eras, withActive).pipe((0, import_rxjs124.map)((slashes) => slashes.map(({ era, nominators, validators: validators7 }) => ({
|
|
743638
743758
|
era,
|
|
743639
743759
|
total: nominators[stakerId] || validators7[stakerId] || api7.registry.createType("Balance")
|
|
743640
743760
|
}))));
|
|
@@ -743643,10 +743763,10 @@ function _stakerSlashes(instanceId, api7) {
|
|
|
743643
743763
|
var stakerSlashes = /* @__PURE__ */ erasHistoricApplyAccount("_stakerSlashes");
|
|
743644
743764
|
|
|
743645
743765
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/stashes.js
|
|
743646
|
-
var
|
|
743766
|
+
var import_rxjs125 = require("rxjs");
|
|
743647
743767
|
function onBondedEvent(api7) {
|
|
743648
743768
|
let current = Date.now();
|
|
743649
|
-
return api7.query.system.events().pipe((0,
|
|
743769
|
+
return api7.query.system.events().pipe((0, import_rxjs125.map)((events2) => {
|
|
743650
743770
|
current = events2.filter(({ event, phase }) => {
|
|
743651
743771
|
try {
|
|
743652
743772
|
return phase.isApplyExtrinsic && event.section === "staking" && event.method === "Bonded";
|
|
@@ -743655,29 +743775,29 @@ function onBondedEvent(api7) {
|
|
|
743655
743775
|
}
|
|
743656
743776
|
}) ? Date.now() : current;
|
|
743657
743777
|
return current;
|
|
743658
|
-
}), (0,
|
|
743778
|
+
}), (0, import_rxjs125.startWith)(current), drr({ skipTimeout: true }));
|
|
743659
743779
|
}
|
|
743660
743780
|
function stashes(instanceId, api7) {
|
|
743661
|
-
return memo2(instanceId, () => onBondedEvent(api7).pipe((0,
|
|
743781
|
+
return memo2(instanceId, () => onBondedEvent(api7).pipe((0, import_rxjs125.switchMap)(() => api7.query.staking.validators.keys()), (0, import_rxjs125.map)((keys2) => keys2.map(({ args: [v39] }) => v39).filter((a72) => a72))));
|
|
743662
743782
|
}
|
|
743663
743783
|
|
|
743664
743784
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/validators.js
|
|
743665
|
-
var
|
|
743785
|
+
var import_rxjs126 = require("rxjs");
|
|
743666
743786
|
function nextElected(instanceId, api7) {
|
|
743667
743787
|
return memo2(instanceId, () => (
|
|
743668
743788
|
// Compatibility for future generation changes in staking.
|
|
743669
743789
|
api7.query.staking.erasStakersPaged ? api7.derive.session.indexes().pipe(
|
|
743670
743790
|
// only populate for next era in the last session, so track both here - entries are not
|
|
743671
743791
|
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
|
|
743672
|
-
(0,
|
|
743792
|
+
(0, import_rxjs126.switchMap)(({ currentEra }) => api7.query.staking.erasStakersPaged.keys(currentEra)),
|
|
743673
743793
|
// Dedupe any duplicates
|
|
743674
|
-
(0,
|
|
743794
|
+
(0, import_rxjs126.map)((keys2) => [...new Set(keys2.map(({ args: [, accountId2] }) => accountId2.toString()))].map((a72) => api7.registry.createType("AccountId", a72)))
|
|
743675
743795
|
) : api7.query.staking.erasStakers ? api7.derive.session.indexes().pipe(
|
|
743676
743796
|
// only populate for next era in the last session, so track both here - entries are not
|
|
743677
743797
|
// subscriptions, so we need a trigger - currentIndex acts as that trigger to refresh
|
|
743678
|
-
(0,
|
|
743798
|
+
(0, import_rxjs126.switchMap)(({ currentEra }) => api7.query.staking.erasStakers.keys(currentEra)),
|
|
743679
743799
|
// Dedupe any duplicates
|
|
743680
|
-
(0,
|
|
743800
|
+
(0, import_rxjs126.map)((keys2) => [...new Set(keys2.map(({ args: [, accountId2] }) => accountId2.toString()))].map((a72) => api7.registry.createType("AccountId", a72)))
|
|
743681
743801
|
) : api7.query.staking["currentElected"]()
|
|
743682
743802
|
));
|
|
743683
743803
|
}
|
|
@@ -743685,10 +743805,10 @@ function validators5(instanceId, api7) {
|
|
|
743685
743805
|
return memo2(instanceId, () => (
|
|
743686
743806
|
// Sadly the node-template is (for some obscure reason) not comprehensive, so while the derive works
|
|
743687
743807
|
// in all actual real-world deployed chains, it does create some confusion for limited template chains
|
|
743688
|
-
(0,
|
|
743689
|
-
api7.query.session ? api7.query.session.validators() : (0,
|
|
743690
|
-
api7.query.staking ? api7.derive.staking.nextElected() : (0,
|
|
743691
|
-
]).pipe((0,
|
|
743808
|
+
(0, import_rxjs126.combineLatest)([
|
|
743809
|
+
api7.query.session ? api7.query.session.validators() : (0, import_rxjs126.of)([]),
|
|
743810
|
+
api7.query.staking ? api7.derive.staking.nextElected() : (0, import_rxjs126.of)([])
|
|
743811
|
+
]).pipe((0, import_rxjs126.map)(([validators7, nextElected2]) => ({
|
|
743692
743812
|
nextElected: nextElected2.length ? nextElected2 : validators7,
|
|
743693
743813
|
validators: validators7
|
|
743694
743814
|
})))
|
|
@@ -743696,16 +743816,16 @@ function validators5(instanceId, api7) {
|
|
|
743696
743816
|
}
|
|
743697
743817
|
|
|
743698
743818
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/staking/waitingInfo.js
|
|
743699
|
-
var
|
|
743819
|
+
var import_rxjs127 = require("rxjs");
|
|
743700
743820
|
var DEFAULT_FLAGS2 = { withController: true, withPrefs: true };
|
|
743701
743821
|
function waitingInfo(instanceId, api7) {
|
|
743702
|
-
return memo2(instanceId, (flags2 = DEFAULT_FLAGS2) => (0,
|
|
743822
|
+
return memo2(instanceId, (flags2 = DEFAULT_FLAGS2) => (0, import_rxjs127.combineLatest)([
|
|
743703
743823
|
api7.derive.staking.validators(),
|
|
743704
743824
|
api7.derive.staking.stashes()
|
|
743705
|
-
]).pipe((0,
|
|
743825
|
+
]).pipe((0, import_rxjs127.switchMap)(([{ nextElected: nextElected2 }, stashes2]) => {
|
|
743706
743826
|
const elected = nextElected2.map((a72) => a72.toString());
|
|
743707
743827
|
const waiting = stashes2.filter((v39) => !elected.includes(v39.toString()));
|
|
743708
|
-
return api7.derive.staking.queryMulti(waiting, flags2).pipe((0,
|
|
743828
|
+
return api7.derive.staking.queryMulti(waiting, flags2).pipe((0, import_rxjs127.map)((info6) => ({
|
|
743709
743829
|
info: info6,
|
|
743710
743830
|
waiting
|
|
743711
743831
|
})));
|
|
@@ -743738,7 +743858,7 @@ __export(treasury_exports, {
|
|
|
743738
743858
|
});
|
|
743739
743859
|
|
|
743740
743860
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/treasury/proposals.js
|
|
743741
|
-
var
|
|
743861
|
+
var import_rxjs128 = require("rxjs");
|
|
743742
743862
|
function parseResult3(api7, { allIds, allProposals, approvalIds, councilProposals, proposalCount: proposalCount6 }) {
|
|
743743
743863
|
const approvals = [];
|
|
743744
743864
|
const proposals8 = [];
|
|
@@ -743766,16 +743886,16 @@ function retrieveProposals(api7, proposalCount6, approvalIds) {
|
|
|
743766
743886
|
}
|
|
743767
743887
|
}
|
|
743768
743888
|
const allIds = [...proposalIds, ...approvalIds];
|
|
743769
|
-
return (0,
|
|
743889
|
+
return (0, import_rxjs128.combineLatest)([
|
|
743770
743890
|
api7.query.treasury.proposals.multi(allIds),
|
|
743771
|
-
api7.derive.council ? api7.derive.council.proposals() : (0,
|
|
743772
|
-
]).pipe((0,
|
|
743891
|
+
api7.derive.council ? api7.derive.council.proposals() : (0, import_rxjs128.of)([])
|
|
743892
|
+
]).pipe((0, import_rxjs128.map)(([allProposals, councilProposals]) => parseResult3(api7, { allIds, allProposals, approvalIds, councilProposals, proposalCount: proposalCount6 })));
|
|
743773
743893
|
}
|
|
743774
743894
|
function proposals7(instanceId, api7) {
|
|
743775
|
-
return memo2(instanceId, () => api7.query.treasury ? (0,
|
|
743895
|
+
return memo2(instanceId, () => api7.query.treasury ? (0, import_rxjs128.combineLatest)([
|
|
743776
743896
|
api7.query.treasury.proposalCount(),
|
|
743777
743897
|
api7.query.treasury.approvals()
|
|
743778
|
-
]).pipe((0,
|
|
743898
|
+
]).pipe((0, import_rxjs128.switchMap)(([proposalCount6, approvalIds]) => retrieveProposals(api7, proposalCount6, approvalIds))) : (0, import_rxjs128.of)({
|
|
743779
743899
|
approvals: [],
|
|
743780
743900
|
proposalCount: api7.registry.createType("ProposalIndex"),
|
|
743781
743901
|
proposals: []
|
|
@@ -743790,16 +743910,16 @@ __export(tx_exports, {
|
|
|
743790
743910
|
});
|
|
743791
743911
|
|
|
743792
743912
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/tx/events.js
|
|
743793
|
-
var
|
|
743913
|
+
var import_rxjs129 = require("rxjs");
|
|
743794
743914
|
function events(instanceId, api7) {
|
|
743795
|
-
return memo2(instanceId, (blockHash) => (0,
|
|
743915
|
+
return memo2(instanceId, (blockHash) => (0, import_rxjs129.combineLatest)([
|
|
743796
743916
|
api7.rpc.chain.getBlock(blockHash),
|
|
743797
|
-
api7.queryAt(blockHash).pipe((0,
|
|
743798
|
-
]).pipe((0,
|
|
743917
|
+
api7.queryAt(blockHash).pipe((0, import_rxjs129.switchMap)((queryAt) => queryAt.system.events()))
|
|
743918
|
+
]).pipe((0, import_rxjs129.map)(([block2, events2]) => ({ block: block2, events: events2 }))));
|
|
743799
743919
|
}
|
|
743800
743920
|
|
|
743801
743921
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/tx/signingInfo.js
|
|
743802
|
-
var
|
|
743922
|
+
var import_rxjs130 = require("rxjs");
|
|
743803
743923
|
|
|
743804
743924
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/tx/constants.js
|
|
743805
743925
|
var FALLBACK_MAX_HASH_COUNT = 250;
|
|
@@ -743809,20 +743929,20 @@ var MORTAL_PERIOD = new import_bn3.default(5 * 60 * 1e3);
|
|
|
743809
743929
|
|
|
743810
743930
|
// ../../node_modules/.pnpm/@polkadot+api-derive@11.2.1/node_modules/@polkadot/api-derive/tx/signingInfo.js
|
|
743811
743931
|
function latestNonce(api7, address4) {
|
|
743812
|
-
return api7.derive.balances.account(address4).pipe((0,
|
|
743932
|
+
return api7.derive.balances.account(address4).pipe((0, import_rxjs130.map)(({ accountNonce }) => accountNonce));
|
|
743813
743933
|
}
|
|
743814
743934
|
function nextNonce(api7, address4) {
|
|
743815
743935
|
return api7.rpc.system?.accountNextIndex ? api7.rpc.system.accountNextIndex(address4) : latestNonce(api7, address4);
|
|
743816
743936
|
}
|
|
743817
743937
|
function signingHeader(api7) {
|
|
743818
|
-
return (0,
|
|
743819
|
-
api7.rpc.chain.getHeader().pipe((0,
|
|
743938
|
+
return (0, import_rxjs130.combineLatest)([
|
|
743939
|
+
api7.rpc.chain.getHeader().pipe((0, import_rxjs130.switchMap)((header) => (
|
|
743820
743940
|
// check for chains at genesis (until block 1 is produced, e.g. 6s), since
|
|
743821
743941
|
// we do need to allow transactions at chain start (also dev/seal chains)
|
|
743822
|
-
header.parentHash.isEmpty ? (0,
|
|
743942
|
+
header.parentHash.isEmpty ? (0, import_rxjs130.of)(header) : api7.rpc.chain.getHeader(header.parentHash).pipe((0, import_rxjs130.catchError)(() => (0, import_rxjs130.of)(header)))
|
|
743823
743943
|
))),
|
|
743824
|
-
api7.rpc.chain.getFinalizedHead().pipe((0,
|
|
743825
|
-
]).pipe((0,
|
|
743944
|
+
api7.rpc.chain.getFinalizedHead().pipe((0, import_rxjs130.switchMap)((hash12) => api7.rpc.chain.getHeader(hash12).pipe((0, import_rxjs130.catchError)(() => (0, import_rxjs130.of)(null)))))
|
|
743945
|
+
]).pipe((0, import_rxjs130.map)(([current, finalized]) => (
|
|
743826
743946
|
// determine the hash to use, current when lag > max, else finalized
|
|
743827
743947
|
!finalized || unwrapBlockNumber(current).sub(unwrapBlockNumber(finalized)).gt(MAX_FINALITY_LAG) ? current : finalized
|
|
743828
743948
|
)));
|
|
@@ -743833,12 +743953,12 @@ function babeOrAuraPeriod(api7) {
|
|
|
743833
743953
|
return !period.isZero() ? period : void 0;
|
|
743834
743954
|
}
|
|
743835
743955
|
function signingInfo(_instanceId, api7) {
|
|
743836
|
-
return (address4, nonce, era) => (0,
|
|
743956
|
+
return (address4, nonce, era) => (0, import_rxjs130.combineLatest)([
|
|
743837
743957
|
// retrieve nonce if none was specified
|
|
743838
|
-
isUndefined4(nonce) ? latestNonce(api7, address4) : nonce === -1 ? nextNonce(api7, address4) : (0,
|
|
743958
|
+
isUndefined4(nonce) ? latestNonce(api7, address4) : nonce === -1 ? nextNonce(api7, address4) : (0, import_rxjs130.of)(api7.registry.createType("Index", nonce)),
|
|
743839
743959
|
// if no era (create) or era > 0 (mortal), do block retrieval
|
|
743840
|
-
isUndefined4(era) || isNumber4(era) && era > 0 ? signingHeader(api7) : (0,
|
|
743841
|
-
]).pipe((0,
|
|
743960
|
+
isUndefined4(era) || isNumber4(era) && era > 0 ? signingHeader(api7) : (0, import_rxjs130.of)(null)
|
|
743961
|
+
]).pipe((0, import_rxjs130.map)(([nonce2, header]) => ({
|
|
743842
743962
|
header,
|
|
743843
743963
|
mortalLength: Math.min(api7.consts.system?.blockHashCount?.toNumber() || FALLBACK_MAX_HASH_COUNT, MORTAL_PERIOD.div(babeOrAuraPeriod(api7) || FALLBACK_PERIOD).iadd(MAX_FINALITY_LAG).toNumber()),
|
|
743844
743964
|
nonce: nonce2
|
|
@@ -744090,7 +744210,7 @@ function createClass({ api: api7, apiType, blockHash, decorateMethod }) {
|
|
|
744090
744210
|
if (blockHash || isString4(optionsOrHash) || isU8a(optionsOrHash)) {
|
|
744091
744211
|
return decorateMethod(() => api7.rpc.system.dryRun(this.toHex(), blockHash || optionsOrHash));
|
|
744092
744212
|
}
|
|
744093
|
-
return decorateMethod(() => this.__internal__observeSign(account3, optionsOrHash).pipe((0,
|
|
744213
|
+
return decorateMethod(() => this.__internal__observeSign(account3, optionsOrHash).pipe((0, import_rxjs131.switchMap)(() => api7.rpc.system.dryRun(this.toHex()))))();
|
|
744094
744214
|
}
|
|
744095
744215
|
// calculate the payment info for this transaction (if signed and submitted)
|
|
744096
744216
|
paymentInfo(account3, optionsOrHash) {
|
|
@@ -744098,14 +744218,14 @@ function createClass({ api: api7, apiType, blockHash, decorateMethod }) {
|
|
|
744098
744218
|
throw new Error("The transactionPaymentApi.queryInfo runtime call is not available in your environment");
|
|
744099
744219
|
}
|
|
744100
744220
|
if (blockHash || isString4(optionsOrHash) || isU8a(optionsOrHash)) {
|
|
744101
|
-
return decorateMethod(() => api7.callAt(blockHash || optionsOrHash).pipe((0,
|
|
744221
|
+
return decorateMethod(() => api7.callAt(blockHash || optionsOrHash).pipe((0, import_rxjs131.switchMap)((callAt) => {
|
|
744102
744222
|
const u8a3 = this.toU8a();
|
|
744103
744223
|
return callAt.transactionPaymentApi.queryInfo(u8a3, u8a3.length);
|
|
744104
744224
|
})));
|
|
744105
744225
|
}
|
|
744106
744226
|
const [allOptions] = makeSignAndSendOptions(optionsOrHash);
|
|
744107
744227
|
const address4 = isKeyringPair(account3) ? account3.address : account3.toString();
|
|
744108
|
-
return decorateMethod(() => api7.derive.tx.signingInfo(address4, allOptions.nonce, allOptions.era).pipe((0,
|
|
744228
|
+
return decorateMethod(() => api7.derive.tx.signingInfo(address4, allOptions.nonce, allOptions.era).pipe((0, import_rxjs131.first)(), (0, import_rxjs131.switchMap)((signingInfo2) => {
|
|
744109
744229
|
const eraOptions = makeEraOptions(api7, this.registry, allOptions, signingInfo2);
|
|
744110
744230
|
const signOptions = makeSignOptions(api7, eraOptions, {});
|
|
744111
744231
|
const u8a3 = api7.tx(this.toU8a()).signFake(address4, signOptions).toU8a();
|
|
@@ -744121,14 +744241,14 @@ function createClass({ api: api7, apiType, blockHash, decorateMethod }) {
|
|
|
744121
744241
|
* @description Signs a transaction, returning `this` to allow chaining. E.g.: `signAsync(...).send()`. Like `.signAndSend` this will retrieve the nonce and blockHash to send the tx with.
|
|
744122
744242
|
*/
|
|
744123
744243
|
signAsync(account3, partialOptions) {
|
|
744124
|
-
return decorateMethod(() => this.__internal__observeSign(account3, partialOptions).pipe((0,
|
|
744244
|
+
return decorateMethod(() => this.__internal__observeSign(account3, partialOptions).pipe((0, import_rxjs131.map)(() => this)))();
|
|
744125
744245
|
}
|
|
744126
744246
|
// signAndSend implementation for all 3 cases above
|
|
744127
744247
|
signAndSend(account3, partialOptions, optionalStatusCb) {
|
|
744128
744248
|
const [options22, statusCb] = makeSignAndSendOptions(partialOptions, optionalStatusCb);
|
|
744129
744249
|
const isSubscription = api7.hasSubscriptions && (this.__internal__ignoreStatusCb || !!statusCb);
|
|
744130
744250
|
return decorateMethod(
|
|
744131
|
-
() => this.__internal__observeSign(account3, options22).pipe((0,
|
|
744251
|
+
() => this.__internal__observeSign(account3, options22).pipe((0, import_rxjs131.switchMap)((info6) => isSubscription ? this.__internal__observeSubscribe(info6) : this.__internal__observeSend(info6)))
|
|
744132
744252
|
// FIXME This is wrong, SubmittableResult is _not_ a codec
|
|
744133
744253
|
)(statusCb);
|
|
744134
744254
|
}
|
|
@@ -744140,7 +744260,7 @@ function createClass({ api: api7, apiType, blockHash, decorateMethod }) {
|
|
|
744140
744260
|
__internal__observeSign = (account3, partialOptions) => {
|
|
744141
744261
|
const address4 = isKeyringPair(account3) ? account3.address : account3.toString();
|
|
744142
744262
|
const options22 = optionsOrNonce(partialOptions);
|
|
744143
|
-
return api7.derive.tx.signingInfo(address4, options22.nonce, options22.era).pipe((0,
|
|
744263
|
+
return api7.derive.tx.signingInfo(address4, options22.nonce, options22.era).pipe((0, import_rxjs131.first)(), (0, import_rxjs131.mergeMap)(async (signingInfo2) => {
|
|
744144
744264
|
const eraOptions = makeEraOptions(api7, this.registry, options22, signingInfo2);
|
|
744145
744265
|
let updateId = -1;
|
|
744146
744266
|
if (isKeyringPair(account3)) {
|
|
@@ -744153,30 +744273,30 @@ function createClass({ api: api7, apiType, blockHash, decorateMethod }) {
|
|
|
744153
744273
|
};
|
|
744154
744274
|
__internal__observeStatus = (txHash, status) => {
|
|
744155
744275
|
if (!status.isFinalized && !status.isInBlock) {
|
|
744156
|
-
return (0,
|
|
744276
|
+
return (0, import_rxjs131.of)(this.__internal__transformResult(new SubmittableResult({
|
|
744157
744277
|
status,
|
|
744158
744278
|
txHash
|
|
744159
744279
|
})));
|
|
744160
744280
|
}
|
|
744161
744281
|
const blockHash2 = status.isInBlock ? status.asInBlock : status.asFinalized;
|
|
744162
|
-
return api7.derive.tx.events(blockHash2).pipe((0,
|
|
744282
|
+
return api7.derive.tx.events(blockHash2).pipe((0, import_rxjs131.map)(({ block: block2, events: events2 }) => this.__internal__transformResult(new SubmittableResult({
|
|
744163
744283
|
...filterEvents(txHash, block2, events2, status),
|
|
744164
744284
|
status,
|
|
744165
744285
|
txHash
|
|
744166
|
-
}))), (0,
|
|
744286
|
+
}))), (0, import_rxjs131.catchError)((internalError) => (0, import_rxjs131.of)(this.__internal__transformResult(new SubmittableResult({
|
|
744167
744287
|
internalError,
|
|
744168
744288
|
status,
|
|
744169
744289
|
txHash
|
|
744170
744290
|
})))));
|
|
744171
744291
|
};
|
|
744172
744292
|
__internal__observeSend = (info6) => {
|
|
744173
|
-
return api7.rpc.author.submitExtrinsic(this).pipe((0,
|
|
744293
|
+
return api7.rpc.author.submitExtrinsic(this).pipe((0, import_rxjs131.tap)((hash12) => {
|
|
744174
744294
|
this.__internal__updateSigner(hash12, info6);
|
|
744175
744295
|
}));
|
|
744176
744296
|
};
|
|
744177
744297
|
__internal__observeSubscribe = (info6) => {
|
|
744178
744298
|
const txHash = this.hash;
|
|
744179
|
-
return api7.rpc.author.submitAndWatchExtrinsic(this).pipe((0,
|
|
744299
|
+
return api7.rpc.author.submitAndWatchExtrinsic(this).pipe((0, import_rxjs131.switchMap)((status) => this.__internal__observeStatus(txHash, status)), (0, import_rxjs131.tap)((status) => {
|
|
744180
744300
|
this.__internal__updateSigner(status, info6);
|
|
744181
744301
|
}));
|
|
744182
744302
|
};
|
|
@@ -744229,10 +744349,10 @@ function findError(registry, errorIndex) {
|
|
|
744229
744349
|
}
|
|
744230
744350
|
|
|
744231
744351
|
// ../../node_modules/.pnpm/@polkadot+api@11.2.1/node_modules/@polkadot/api/base/Init.js
|
|
744232
|
-
var
|
|
744352
|
+
var import_rxjs133 = require("rxjs");
|
|
744233
744353
|
|
|
744234
744354
|
// ../../node_modules/.pnpm/@polkadot+api@11.2.1/node_modules/@polkadot/api/base/Decorate.js
|
|
744235
|
-
var
|
|
744355
|
+
var import_rxjs132 = require("rxjs");
|
|
744236
744356
|
|
|
744237
744357
|
// ../../node_modules/.pnpm/@polkadot+api@11.2.1/node_modules/@polkadot/api/util/augmentObject.js
|
|
744238
744358
|
var l66 = logger48("api/augment");
|
|
@@ -744479,8 +744599,8 @@ var Decorate = class extends Events {
|
|
|
744479
744599
|
super();
|
|
744480
744600
|
this.__internal__instanceId = `${++instanceCounter}`;
|
|
744481
744601
|
this.__internal__registry = options22.source?.registry || options22.registry || new TypeRegistry();
|
|
744482
|
-
this._rx.callAt = (blockHash, knownVersion) => (0,
|
|
744483
|
-
this._rx.queryAt = (blockHash, knownVersion) => (0,
|
|
744602
|
+
this._rx.callAt = (blockHash, knownVersion) => (0, import_rxjs132.from)(this.at(blockHash, knownVersion)).pipe((0, import_rxjs132.map)((a72) => a72.rx.call));
|
|
744603
|
+
this._rx.queryAt = (blockHash, knownVersion) => (0, import_rxjs132.from)(this.at(blockHash, knownVersion)).pipe((0, import_rxjs132.map)((a72) => a72.rx.query));
|
|
744484
744604
|
this._rx.registry = this.__internal__registry;
|
|
744485
744605
|
this._decorateMethod = decorateMethod;
|
|
744486
744606
|
this._options = options22;
|
|
@@ -744491,7 +744611,7 @@ var Decorate = class extends Events {
|
|
|
744491
744611
|
provider,
|
|
744492
744612
|
userRpc: this._options.rpc
|
|
744493
744613
|
});
|
|
744494
|
-
this._isConnected = new
|
|
744614
|
+
this._isConnected = new import_rxjs132.BehaviorSubject(this._rpcCore.provider.isConnected);
|
|
744495
744615
|
this._rx.hasSubscriptions = this._rpcCore.provider.hasSubscriptions;
|
|
744496
744616
|
}
|
|
744497
744617
|
/**
|
|
@@ -744667,7 +744787,7 @@ var Decorate = class extends Events {
|
|
|
744667
744787
|
}
|
|
744668
744788
|
_rpcSubmitter(decorateMethod) {
|
|
744669
744789
|
const method2 = (method3, ...params) => {
|
|
744670
|
-
return (0,
|
|
744790
|
+
return (0, import_rxjs132.from)(this._rpcCore.provider.send(method3, params));
|
|
744671
744791
|
};
|
|
744672
744792
|
return decorateMethod(method2);
|
|
744673
744793
|
}
|
|
@@ -744791,14 +744911,14 @@ var Decorate = class extends Events {
|
|
|
744791
744911
|
throw new Error(`${def.name}:: Expected ${def.params.length} arguments, found ${args3.length}`);
|
|
744792
744912
|
}
|
|
744793
744913
|
const bytes7 = registry.createType("Raw", u8aConcatStrict(args3.map((a72, i87) => registry.createTypeUnsafe(def.params[i87].type, [a72]).toU8a())));
|
|
744794
|
-
return stateCall(def.name, bytes7).pipe((0,
|
|
744914
|
+
return stateCall(def.name, bytes7).pipe((0, import_rxjs132.map)((r37) => registry.createTypeUnsafe(def.type, [r37])));
|
|
744795
744915
|
});
|
|
744796
744916
|
decorated.meta = def;
|
|
744797
744917
|
return decorated;
|
|
744798
744918
|
}
|
|
744799
744919
|
// only be called if supportMulti is true
|
|
744800
744920
|
_decorateMulti(decorateMethod) {
|
|
744801
|
-
return decorateMethod((keys2) => keys2.length ? (this.hasSubscriptions ? this._rpcCore.state.subscribeStorage : this._rpcCore.state.queryStorageAt)(keys2.map((args3) => Array.isArray(args3) ? args3[0].creator.meta.type.isPlain ? [args3[0].creator] : args3[0].creator.meta.type.asMap.hashers.length === 1 ? [args3[0].creator, args3.slice(1)] : [args3[0].creator, ...args3.slice(1)] : [args3.creator])) : (0,
|
|
744921
|
+
return decorateMethod((keys2) => keys2.length ? (this.hasSubscriptions ? this._rpcCore.state.subscribeStorage : this._rpcCore.state.queryStorageAt)(keys2.map((args3) => Array.isArray(args3) ? args3[0].creator.meta.type.isPlain ? [args3[0].creator] : args3[0].creator.meta.type.asMap.hashers.length === 1 ? [args3[0].creator, args3.slice(1)] : [args3[0].creator, ...args3.slice(1)] : [args3.creator])) : (0, import_rxjs132.of)([]));
|
|
744802
744922
|
}
|
|
744803
744923
|
_decorateMultiAt(atApi, decorateMethod, blockHash) {
|
|
744804
744924
|
return decorateMethod((calls) => calls.length ? this._rpcCore.state.queryStorageAt(calls.map((args3) => {
|
|
@@ -744807,7 +744927,7 @@ var Decorate = class extends Events {
|
|
|
744807
744927
|
return creator.meta.type.isPlain ? [creator] : creator.meta.type.asMap.hashers.length === 1 ? [creator, args3.slice(1)] : [creator, ...args3.slice(1)];
|
|
744808
744928
|
}
|
|
744809
744929
|
return [getAtQueryFn(atApi, args3.creator).creator];
|
|
744810
|
-
}), blockHash) : (0,
|
|
744930
|
+
}), blockHash) : (0, import_rxjs132.of)([]));
|
|
744811
744931
|
}
|
|
744812
744932
|
_decorateExtrinsics({ tx }, decorateMethod) {
|
|
744813
744933
|
const result2 = createSubmittable(this._type, this._rx, decorateMethod);
|
|
@@ -744834,22 +744954,22 @@ var Decorate = class extends Events {
|
|
|
744834
744954
|
}
|
|
744835
744955
|
_decorateStorageEntry(creator, decorateMethod) {
|
|
744836
744956
|
const getArgs = (args3, registry) => extractStorageArgs(registry || this.__internal__registry, creator, args3);
|
|
744837
|
-
const getQueryAt = (blockHash) => (0,
|
|
744957
|
+
const getQueryAt = (blockHash) => (0, import_rxjs132.from)(this.at(blockHash)).pipe((0, import_rxjs132.map)((api7) => getAtQueryFn(api7, creator)));
|
|
744838
744958
|
const decorated = this._decorateStorageCall(creator, decorateMethod);
|
|
744839
744959
|
decorated.creator = creator;
|
|
744840
|
-
decorated.at = decorateMethod((blockHash, ...args3) => getQueryAt(blockHash).pipe((0,
|
|
744960
|
+
decorated.at = decorateMethod((blockHash, ...args3) => getQueryAt(blockHash).pipe((0, import_rxjs132.switchMap)((q8) => q8(...args3))));
|
|
744841
744961
|
decorated.hash = decorateMethod((...args3) => this._rpcCore.state.getStorageHash(getArgs(args3)));
|
|
744842
744962
|
decorated.is = (key2) => key2.section === creator.section && key2.method === creator.method;
|
|
744843
744963
|
decorated.key = (...args3) => u8aToHex(compactStripLength(creator(...args3))[1]);
|
|
744844
744964
|
decorated.keyPrefix = (...args3) => u8aToHex(creator.keyPrefix(...args3));
|
|
744845
744965
|
decorated.size = decorateMethod((...args3) => this._rpcCore.state.getStorageSize(getArgs(args3)));
|
|
744846
|
-
decorated.sizeAt = decorateMethod((blockHash, ...args3) => getQueryAt(blockHash).pipe((0,
|
|
744966
|
+
decorated.sizeAt = decorateMethod((blockHash, ...args3) => getQueryAt(blockHash).pipe((0, import_rxjs132.switchMap)((q8) => this._rpcCore.state.getStorageSize(getArgs(args3, q8.creator.meta.registry), blockHash))));
|
|
744847
744967
|
if (creator.iterKey && creator.meta.type.isMap) {
|
|
744848
744968
|
decorated.entries = decorateMethod(memo2(this.__internal__instanceId, (...args3) => this._retrieveMapEntries(creator, null, args3)));
|
|
744849
|
-
decorated.entriesAt = decorateMethod(memo2(this.__internal__instanceId, (blockHash, ...args3) => getQueryAt(blockHash).pipe((0,
|
|
744969
|
+
decorated.entriesAt = decorateMethod(memo2(this.__internal__instanceId, (blockHash, ...args3) => getQueryAt(blockHash).pipe((0, import_rxjs132.switchMap)((q8) => this._retrieveMapEntries(q8.creator, blockHash, args3)))));
|
|
744850
744970
|
decorated.entriesPaged = decorateMethod(memo2(this.__internal__instanceId, (opts) => this._retrieveMapEntriesPaged(creator, void 0, opts)));
|
|
744851
744971
|
decorated.keys = decorateMethod(memo2(this.__internal__instanceId, (...args3) => this._retrieveMapKeys(creator, null, args3)));
|
|
744852
|
-
decorated.keysAt = decorateMethod(memo2(this.__internal__instanceId, (blockHash, ...args3) => getQueryAt(blockHash).pipe((0,
|
|
744972
|
+
decorated.keysAt = decorateMethod(memo2(this.__internal__instanceId, (blockHash, ...args3) => getQueryAt(blockHash).pipe((0, import_rxjs132.switchMap)((q8) => this._retrieveMapKeys(q8.creator, blockHash, args3)))));
|
|
744853
744973
|
decorated.keysPaged = decorateMethod(memo2(this.__internal__instanceId, (opts) => this._retrieveMapKeysPaged(creator, void 0, opts)));
|
|
744854
744974
|
}
|
|
744855
744975
|
if (this.supportMulti && creator.meta.type.isMap) {
|
|
@@ -744884,7 +745004,7 @@ var Decorate = class extends Events {
|
|
|
744884
745004
|
let valueObs;
|
|
744885
745005
|
if (queueIdx === -1 || !queue[queueIdx] || queue[queueIdx][1].length === PAGE_SIZE_Q) {
|
|
744886
745006
|
queueIdx++;
|
|
744887
|
-
valueObs = (0,
|
|
745007
|
+
valueObs = (0, import_rxjs132.from)(
|
|
744888
745008
|
// we delay the execution until the next tick, this allows
|
|
744889
745009
|
// any queries made in this timeframe to be added to the same
|
|
744890
745010
|
// queue for a single query
|
|
@@ -744895,7 +745015,7 @@ var Decorate = class extends Events {
|
|
|
744895
745015
|
resolve(calls);
|
|
744896
745016
|
});
|
|
744897
745017
|
})
|
|
744898
|
-
).pipe((0,
|
|
745018
|
+
).pipe((0, import_rxjs132.switchMap)((calls) => query3(calls)));
|
|
744899
745019
|
queue.push([valueObs, [call]]);
|
|
744900
745020
|
} else {
|
|
744901
745021
|
valueObs = queue[queueIdx][0];
|
|
@@ -744904,7 +745024,7 @@ var Decorate = class extends Events {
|
|
|
744904
745024
|
}
|
|
744905
745025
|
return valueObs.pipe(
|
|
744906
745026
|
// return the single value at this index
|
|
744907
|
-
(0,
|
|
745027
|
+
(0, import_rxjs132.map)((values) => values[valueIdx])
|
|
744908
745028
|
);
|
|
744909
745029
|
}
|
|
744910
745030
|
// Decorate the base storage call. In the case or rxjs or promise-without-callback (await)
|
|
@@ -744925,31 +745045,31 @@ var Decorate = class extends Events {
|
|
|
744925
745045
|
// retrieve a set of values for a specific set of keys - here we chunk the keys into PAGE_SIZE sizes
|
|
744926
745046
|
_retrieveMulti(keys2, blockHash) {
|
|
744927
745047
|
if (!keys2.length) {
|
|
744928
|
-
return (0,
|
|
745048
|
+
return (0, import_rxjs132.of)([]);
|
|
744929
745049
|
}
|
|
744930
745050
|
const query3 = this.hasSubscriptions && !blockHash ? this._rpcCore.state.subscribeStorage : this._rpcCore.state.queryStorageAt;
|
|
744931
745051
|
if (keys2.length <= PAGE_SIZE_V) {
|
|
744932
745052
|
return blockHash ? query3(keys2, blockHash) : query3(keys2);
|
|
744933
745053
|
}
|
|
744934
|
-
return (0,
|
|
745054
|
+
return (0, import_rxjs132.combineLatest)(arrayChunk(keys2, PAGE_SIZE_V).map((k17) => blockHash ? query3(k17, blockHash) : query3(k17))).pipe((0, import_rxjs132.map)(arrayFlatten));
|
|
744935
745055
|
}
|
|
744936
745056
|
_retrieveMapKeys({ iterKey, meta, method: method2, section: section2 }, at2, args3) {
|
|
744937
745057
|
if (!iterKey || !meta.type.isMap) {
|
|
744938
745058
|
throw new Error("keys can only be retrieved on maps");
|
|
744939
745059
|
}
|
|
744940
745060
|
const headKey = iterKey(...args3).toHex();
|
|
744941
|
-
const startSubject = new
|
|
745061
|
+
const startSubject = new import_rxjs132.BehaviorSubject(headKey);
|
|
744942
745062
|
const query3 = at2 ? (startKey) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K2, startKey, at2) : (startKey) => this._rpcCore.state.getKeysPaged(headKey, PAGE_SIZE_K2, startKey);
|
|
744943
745063
|
const setMeta = (key2) => key2.setMeta(meta, section2, method2);
|
|
744944
745064
|
return startSubject.pipe(
|
|
744945
|
-
(0,
|
|
744946
|
-
(0,
|
|
744947
|
-
(0,
|
|
745065
|
+
(0, import_rxjs132.switchMap)(query3),
|
|
745066
|
+
(0, import_rxjs132.map)((keys2) => keys2.map(setMeta)),
|
|
745067
|
+
(0, import_rxjs132.tap)((keys2) => nextTick2(() => {
|
|
744948
745068
|
keys2.length === PAGE_SIZE_K2 ? startSubject.next(keys2[PAGE_SIZE_K2 - 1].toHex()) : startSubject.complete();
|
|
744949
745069
|
})),
|
|
744950
|
-
(0,
|
|
745070
|
+
(0, import_rxjs132.toArray)(),
|
|
744951
745071
|
// toArray since we want to startSubject to be completed
|
|
744952
|
-
(0,
|
|
745072
|
+
(0, import_rxjs132.map)(arrayFlatten)
|
|
744953
745073
|
);
|
|
744954
745074
|
}
|
|
744955
745075
|
_retrieveMapKeysPaged({ iterKey, meta, method: method2, section: section2 }, at2, opts) {
|
|
@@ -744958,15 +745078,15 @@ var Decorate = class extends Events {
|
|
|
744958
745078
|
}
|
|
744959
745079
|
const setMeta = (key2) => key2.setMeta(meta, section2, method2);
|
|
744960
745080
|
const query3 = at2 ? (headKey) => this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey, at2) : (headKey) => this._rpcCore.state.getKeysPaged(headKey, opts.pageSize, opts.startKey || headKey);
|
|
744961
|
-
return query3(iterKey(...opts.args).toHex()).pipe((0,
|
|
745081
|
+
return query3(iterKey(...opts.args).toHex()).pipe((0, import_rxjs132.map)((keys2) => keys2.map(setMeta)));
|
|
744962
745082
|
}
|
|
744963
745083
|
_retrieveMapEntries(entry, at2, args3) {
|
|
744964
745084
|
const query3 = at2 ? (keys2) => this._rpcCore.state.queryStorageAt(keys2, at2) : (keys2) => this._rpcCore.state.queryStorageAt(keys2);
|
|
744965
|
-
return this._retrieveMapKeys(entry, at2, args3).pipe((0,
|
|
745085
|
+
return this._retrieveMapKeys(entry, at2, args3).pipe((0, import_rxjs132.switchMap)((keys2) => keys2.length ? (0, import_rxjs132.combineLatest)(arrayChunk(keys2, PAGE_SIZE_V).map(query3)).pipe((0, import_rxjs132.map)((valsArr) => arrayFlatten(valsArr).map((value5, index) => [keys2[index], value5]))) : (0, import_rxjs132.of)([])));
|
|
744966
745086
|
}
|
|
744967
745087
|
_retrieveMapEntriesPaged(entry, at2, opts) {
|
|
744968
745088
|
const query3 = at2 ? (keys2) => this._rpcCore.state.queryStorageAt(keys2, at2) : (keys2) => this._rpcCore.state.queryStorageAt(keys2);
|
|
744969
|
-
return this._retrieveMapKeysPaged(entry, at2, opts).pipe((0,
|
|
745089
|
+
return this._retrieveMapKeysPaged(entry, at2, opts).pipe((0, import_rxjs132.switchMap)((keys2) => keys2.length ? query3(keys2).pipe((0, import_rxjs132.map)((valsArr) => valsArr.map((value5, index) => [keys2[index], value5]))) : (0, import_rxjs132.of)([])));
|
|
744970
745090
|
}
|
|
744971
745091
|
_decorateDeriveRx(decorateMethod) {
|
|
744972
745092
|
const specName = this._runtimeVersion?.specName.toString();
|
|
@@ -745014,7 +745134,7 @@ var Init = class extends Decorate {
|
|
|
745014
745134
|
}
|
|
745015
745135
|
this._rx.signer = options22.signer;
|
|
745016
745136
|
this._rpcCore.setRegistrySwap((blockHash) => this.getBlockRegistry(blockHash));
|
|
745017
|
-
this._rpcCore.setResolveBlockHash((blockNumber) => (0,
|
|
745137
|
+
this._rpcCore.setResolveBlockHash((blockNumber) => (0, import_rxjs133.firstValueFrom)(this._rpcCore.chain.getBlockHash(blockNumber)));
|
|
745018
745138
|
if (this.hasSubscriptions) {
|
|
745019
745139
|
this._rpcCore.provider.on("disconnected", () => this.__internal__onProviderDisconnect());
|
|
745020
745140
|
this._rpcCore.provider.on("error", (e34) => this.__internal__onProviderError(e34));
|
|
@@ -745060,7 +745180,7 @@ var Init = class extends Decorate {
|
|
|
745060
745180
|
}
|
|
745061
745181
|
async _createBlockRegistry(blockHash, header, version33) {
|
|
745062
745182
|
const registry = new TypeRegistry(blockHash);
|
|
745063
|
-
const metadata = new Metadata(registry, await (0,
|
|
745183
|
+
const metadata = new Metadata(registry, await (0, import_rxjs133.firstValueFrom)(this._rpcCore.state.getMetadata.raw(header.parentHash)));
|
|
745064
745184
|
const runtimeChain = this._runtimeChain;
|
|
745065
745185
|
if (!runtimeChain) {
|
|
745066
745186
|
throw new Error("Invalid initializion order, runtimeChain is not available");
|
|
@@ -745100,12 +745220,12 @@ var Init = class extends Decorate {
|
|
|
745100
745220
|
if (!this._genesisHash || !this._runtimeVersion) {
|
|
745101
745221
|
throw new Error("Cannot retrieve data on an uninitialized chain");
|
|
745102
745222
|
}
|
|
745103
|
-
const header = this.registry.createType("HeaderPartial", this._genesisHash.eq(blockHash) ? { number: BN_ZERO, parentHash: this._genesisHash } : await (0,
|
|
745223
|
+
const header = this.registry.createType("HeaderPartial", this._genesisHash.eq(blockHash) ? { number: BN_ZERO, parentHash: this._genesisHash } : await (0, import_rxjs133.firstValueFrom)(this._rpcCore.chain.getHeader.raw(blockHash)));
|
|
745104
745224
|
if (header.parentHash.isEmpty) {
|
|
745105
745225
|
throw new Error("Unable to retrieve header and parent from supplied hash");
|
|
745106
745226
|
}
|
|
745107
745227
|
const [firstVersion, lastVersion] = getUpgradeVersion(this._genesisHash, header.number);
|
|
745108
|
-
const version33 = this.registry.createType("RuntimeVersionPartial", WITH_VERSION_SHORTCUT && (firstVersion && (lastVersion || firstVersion.specVersion.eq(this._runtimeVersion.specVersion))) ? { apis: firstVersion.apis, specName: this._runtimeVersion.specName, specVersion: firstVersion.specVersion } : await (0,
|
|
745228
|
+
const version33 = this.registry.createType("RuntimeVersionPartial", WITH_VERSION_SHORTCUT && (firstVersion && (lastVersion || firstVersion.specVersion.eq(this._runtimeVersion.specVersion))) ? { apis: firstVersion.apis, specName: this._runtimeVersion.specName, specVersion: firstVersion.specVersion } : await (0, import_rxjs133.firstValueFrom)(this._rpcCore.state.getRuntimeVersion.raw(header.parentHash)));
|
|
745109
745229
|
return (
|
|
745110
745230
|
// try to find via version
|
|
745111
745231
|
this._getBlockRegistryViaVersion(blockHash, version33) || // return new or in-flight result
|
|
@@ -745156,9 +745276,9 @@ var Init = class extends Decorate {
|
|
|
745156
745276
|
if (this.__internal__updateSub || !this.hasSubscriptions) {
|
|
745157
745277
|
return;
|
|
745158
745278
|
}
|
|
745159
|
-
this.__internal__updateSub = this._rpcCore.state.subscribeRuntimeVersion().pipe((0,
|
|
745279
|
+
this.__internal__updateSub = this._rpcCore.state.subscribeRuntimeVersion().pipe((0, import_rxjs133.switchMap)((version33) => (
|
|
745160
745280
|
// only retrieve the metadata when the on-chain version has been changed
|
|
745161
|
-
this._runtimeVersion?.specVersion.eq(version33.specVersion) ? (0,
|
|
745281
|
+
this._runtimeVersion?.specVersion.eq(version33.specVersion) ? (0, import_rxjs133.of)(false) : this._rpcCore.state.getMetadata().pipe((0, import_rxjs133.map)((metadata) => {
|
|
745162
745282
|
l68.log(`Runtime version updated to spec=${version33.specVersion.toString()}, tx=${version33.transactionVersion.toString()}`);
|
|
745163
745283
|
this._runtimeMetadata = metadata;
|
|
745164
745284
|
this._runtimeVersion = version33;
|
|
@@ -745178,18 +745298,18 @@ var Init = class extends Decorate {
|
|
|
745178
745298
|
}
|
|
745179
745299
|
async _metaFromChain(optMetadata) {
|
|
745180
745300
|
const [genesisHash, runtimeVersion, chain5, chainProps, rpcMethods, chainMetadata] = await Promise.all([
|
|
745181
|
-
(0,
|
|
745182
|
-
(0,
|
|
745183
|
-
(0,
|
|
745184
|
-
(0,
|
|
745185
|
-
(0,
|
|
745186
|
-
optMetadata ? Promise.resolve(null) : (0,
|
|
745301
|
+
(0, import_rxjs133.firstValueFrom)(this._rpcCore.chain.getBlockHash(0)),
|
|
745302
|
+
(0, import_rxjs133.firstValueFrom)(this._rpcCore.state.getRuntimeVersion()),
|
|
745303
|
+
(0, import_rxjs133.firstValueFrom)(this._rpcCore.system.chain()),
|
|
745304
|
+
(0, import_rxjs133.firstValueFrom)(this._rpcCore.system.properties()),
|
|
745305
|
+
(0, import_rxjs133.firstValueFrom)(this._rpcCore.rpc.methods()),
|
|
745306
|
+
optMetadata ? Promise.resolve(null) : (0, import_rxjs133.firstValueFrom)(this._rpcCore.state.getMetadata())
|
|
745187
745307
|
]);
|
|
745188
745308
|
this._runtimeChain = chain5;
|
|
745189
745309
|
this._runtimeVersion = runtimeVersion;
|
|
745190
745310
|
this._rx.runtimeVersion = runtimeVersion;
|
|
745191
745311
|
const metadataKey = `${genesisHash.toHex() || "0x"}-${runtimeVersion.specVersion.toString()}`;
|
|
745192
|
-
const metadata = chainMetadata || (optMetadata?.[metadataKey] ? new Metadata(this.registry, optMetadata[metadataKey]) : await (0,
|
|
745312
|
+
const metadata = chainMetadata || (optMetadata?.[metadataKey] ? new Metadata(this.registry, optMetadata[metadataKey]) : await (0, import_rxjs133.firstValueFrom)(this._rpcCore.state.getMetadata()));
|
|
745193
745313
|
this._initRegistry(this.registry, chain5, runtimeVersion, metadata, chainProps);
|
|
745194
745314
|
this._filterRpc(rpcMethods.methods.map(textToString), getSpecRpc(this.registry, chain5, runtimeVersion.specName));
|
|
745195
745315
|
this._subscribeUpdates();
|
|
@@ -745216,7 +745336,7 @@ var Init = class extends Decorate {
|
|
|
745216
745336
|
_subscribeHealth() {
|
|
745217
745337
|
this._unsubscribeHealth();
|
|
745218
745338
|
this.__internal__healthTimer = this.hasSubscriptions ? setInterval(() => {
|
|
745219
|
-
(0,
|
|
745339
|
+
(0, import_rxjs133.firstValueFrom)(this._rpcCore.system.health.raw()).catch(noop4);
|
|
745220
745340
|
}, KEEPALIVE_INTERVAL) : null;
|
|
745221
745341
|
}
|
|
745222
745342
|
_unsubscribeHealth() {
|
|
@@ -745582,7 +745702,7 @@ var Combinator = class {
|
|
|
745582
745702
|
};
|
|
745583
745703
|
|
|
745584
745704
|
// ../../node_modules/.pnpm/@polkadot+api@11.2.1/node_modules/@polkadot/api/promise/decorateMethod.js
|
|
745585
|
-
var
|
|
745705
|
+
var import_rxjs134 = require("rxjs");
|
|
745586
745706
|
function promiseTracker(resolve, reject) {
|
|
745587
745707
|
let isCompleted = false;
|
|
745588
745708
|
return {
|
|
@@ -745591,7 +745711,7 @@ function promiseTracker(resolve, reject) {
|
|
|
745591
745711
|
isCompleted = true;
|
|
745592
745712
|
reject(error);
|
|
745593
745713
|
}
|
|
745594
|
-
return
|
|
745714
|
+
return import_rxjs134.EMPTY;
|
|
745595
745715
|
},
|
|
745596
745716
|
resolve: (value5) => {
|
|
745597
745717
|
if (!isCompleted) {
|
|
@@ -745612,7 +745732,7 @@ function extractArgs(args3, needsCallback) {
|
|
|
745612
745732
|
function decorateCall(method2, args3) {
|
|
745613
745733
|
return new Promise((resolve, reject) => {
|
|
745614
745734
|
const tracker = promiseTracker(resolve, reject);
|
|
745615
|
-
const subscription = method2(...args3).pipe((0,
|
|
745735
|
+
const subscription = method2(...args3).pipe((0, import_rxjs134.catchError)((error) => tracker.reject(error))).subscribe((result2) => {
|
|
745616
745736
|
tracker.resolve(result2);
|
|
745617
745737
|
nextTick2(() => subscription.unsubscribe());
|
|
745618
745738
|
});
|
|
@@ -745621,7 +745741,7 @@ function decorateCall(method2, args3) {
|
|
|
745621
745741
|
function decorateSubscribe(method2, args3, resultCb) {
|
|
745622
745742
|
return new Promise((resolve, reject) => {
|
|
745623
745743
|
const tracker = promiseTracker(resolve, reject);
|
|
745624
|
-
const subscription = method2(...args3).pipe((0,
|
|
745744
|
+
const subscription = method2(...args3).pipe((0, import_rxjs134.catchError)((error) => tracker.reject(error)), (0, import_rxjs134.tap)(() => tracker.resolve(() => subscription.unsubscribe()))).subscribe((result2) => {
|
|
745625
745745
|
nextTick2(() => resultCb(result2));
|
|
745626
745746
|
});
|
|
745627
745747
|
});
|
|
@@ -745994,7 +746114,7 @@ var fetchActiveEra = async () => {
|
|
|
745994
746114
|
};
|
|
745995
746115
|
var getMinimumBondBalance = async () => {
|
|
745996
746116
|
const { data: data6 } = await callSidecar(`/pallets/staking/storage/minNominatorBond`);
|
|
745997
|
-
return data6.value && new
|
|
746117
|
+
return data6.value && new import_bignumber227.BigNumber(data6.value) || new import_bignumber227.BigNumber(0);
|
|
745998
746118
|
};
|
|
745999
746119
|
var fetchValidators2 = async (status = "all", addresses) => {
|
|
746000
746120
|
return await node_default3.fetchValidators(status, addresses);
|
|
@@ -746018,7 +746138,7 @@ var isElectionClosed = async () => {
|
|
|
746018
746138
|
};
|
|
746019
746139
|
var isNewAccount = async (addr) => {
|
|
746020
746140
|
const { nonce, free } = await fetchBalanceInfo(addr);
|
|
746021
|
-
return new
|
|
746141
|
+
return new import_bignumber227.BigNumber(0).isEqualTo(nonce) && new import_bignumber227.BigNumber(0).isEqualTo(free);
|
|
746022
746142
|
};
|
|
746023
746143
|
var isControllerAddress = async (addr) => {
|
|
746024
746144
|
const stash = await fetchStashAddr(addr);
|
|
@@ -746037,21 +746157,17 @@ var getAccount6 = async (addr) => {
|
|
|
746037
746157
|
};
|
|
746038
746158
|
var getBalances = async (addr) => {
|
|
746039
746159
|
const balanceInfo = await fetchBalanceInfo(addr);
|
|
746040
|
-
const
|
|
746041
|
-
|
|
746042
|
-
|
|
746043
|
-
|
|
746044
|
-
|
|
746045
|
-
return total;
|
|
746046
|
-
}, new import_bignumber226.BigNumber(0));
|
|
746047
|
-
const balance = new import_bignumber226.BigNumber(balanceInfo.free);
|
|
746048
|
-
const spendableBalance = totalLocked.gt(balance) ? new import_bignumber226.BigNumber(0) : balance.minus(totalLocked);
|
|
746160
|
+
const balance = new import_bignumber227.BigNumber(balanceInfo.free);
|
|
746161
|
+
const reservedBalance = new import_bignumber227.BigNumber(balanceInfo.reserved || "0");
|
|
746162
|
+
const frozenBalance = new import_bignumber227.BigNumber(balanceInfo.frozen || "0");
|
|
746163
|
+
const frozenMinusReserved = frozenBalance.minus(reservedBalance);
|
|
746164
|
+
const spendableBalance = import_bignumber227.BigNumber.max(balance.minus(import_bignumber227.BigNumber.max(frozenMinusReserved, EXISTENTIAL_DEPOSIT2)), new import_bignumber227.BigNumber(0));
|
|
746049
746165
|
return {
|
|
746050
746166
|
blockHeight: Number(balanceInfo.at.height),
|
|
746051
746167
|
balance,
|
|
746052
746168
|
spendableBalance,
|
|
746053
746169
|
nonce: Number(balanceInfo.nonce),
|
|
746054
|
-
lockedBalance:
|
|
746170
|
+
lockedBalance: reservedBalance
|
|
746055
746171
|
};
|
|
746056
746172
|
};
|
|
746057
746173
|
var getStakingInfo = async (addr) => {
|
|
@@ -746060,8 +746176,8 @@ var getStakingInfo = async (addr) => {
|
|
|
746060
746176
|
return {
|
|
746061
746177
|
controller: null,
|
|
746062
746178
|
stash: stash || null,
|
|
746063
|
-
unlockedBalance: new
|
|
746064
|
-
unlockingBalance: new
|
|
746179
|
+
unlockedBalance: new import_bignumber227.BigNumber(0),
|
|
746180
|
+
unlockingBalance: new import_bignumber227.BigNumber(0),
|
|
746065
746181
|
unlockings: []
|
|
746066
746182
|
};
|
|
746067
746183
|
}
|
|
@@ -746072,21 +746188,21 @@ var getStakingInfo = async (addr) => {
|
|
|
746072
746188
|
]);
|
|
746073
746189
|
const activeEraIndex = Number(activeEra.value?.index || 0);
|
|
746074
746190
|
const activeEraStart = Number(activeEra.value?.start || 0);
|
|
746075
|
-
const blockTime = new
|
|
746076
|
-
const epochDuration = new
|
|
746077
|
-
const sessionsPerEra = new
|
|
746191
|
+
const blockTime = new import_bignumber227.BigNumber(consts?.babe?.expectedBlockTime || 6e3);
|
|
746192
|
+
const epochDuration = new import_bignumber227.BigNumber(consts?.babe?.epochDuration || 2400);
|
|
746193
|
+
const sessionsPerEra = new import_bignumber227.BigNumber(consts?.staking?.sessionsPerEra || 6);
|
|
746078
746194
|
const eraLength2 = sessionsPerEra.multipliedBy(epochDuration).multipliedBy(blockTime).toNumber();
|
|
746079
746195
|
const unlockings = stakingInfo?.staking.unlocking ? stakingInfo?.staking?.unlocking.map((lock2) => {
|
|
746080
746196
|
return {
|
|
746081
|
-
amount: new
|
|
746197
|
+
amount: new import_bignumber227.BigNumber(lock2.value),
|
|
746082
746198
|
// This is an estimation of the date of completion, since it depends on block validation speed
|
|
746083
746199
|
completionDate: new Date(activeEraStart + (Number(lock2.era) - activeEraIndex) * eraLength2)
|
|
746084
746200
|
};
|
|
746085
746201
|
}) : [];
|
|
746086
746202
|
const now3 = /* @__PURE__ */ new Date();
|
|
746087
746203
|
const unlocked = unlockings.filter((lock2) => lock2.completionDate <= now3);
|
|
746088
|
-
const unlockingBalance = unlockings.reduce((sum2, lock2) => sum2.plus(lock2.amount), new
|
|
746089
|
-
const unlockedBalance = unlocked.reduce((sum2, lock2) => sum2.plus(lock2.amount), new
|
|
746204
|
+
const unlockingBalance = unlockings.reduce((sum2, lock2) => sum2.plus(lock2.amount), new import_bignumber227.BigNumber(0));
|
|
746205
|
+
const unlockedBalance = unlocked.reduce((sum2, lock2) => sum2.plus(lock2.amount), new import_bignumber227.BigNumber(0));
|
|
746090
746206
|
const numSlashingSpans = Number(stakingInfo?.numSlashingSpans || 0);
|
|
746091
746207
|
return {
|
|
746092
746208
|
controller: controller || null,
|
|
@@ -746105,7 +746221,7 @@ var getNominations = async (addr) => {
|
|
|
746105
746221
|
}
|
|
746106
746222
|
return nominations.targets.map((nomination) => ({
|
|
746107
746223
|
address: nomination.address,
|
|
746108
|
-
value: new
|
|
746224
|
+
value: new import_bignumber227.BigNumber(nomination.value || 0),
|
|
746109
746225
|
status: nomination.status
|
|
746110
746226
|
}));
|
|
746111
746227
|
} catch (error) {
|
|
@@ -746150,10 +746266,10 @@ var getValidators3 = async (stashes2 = "elected") => {
|
|
|
746150
746266
|
address: v39.accountId,
|
|
746151
746267
|
identity: v39.identity ? [v39.identity.displayParent, v39.identity.display].filter(Boolean).join(" - ").trim() : "",
|
|
746152
746268
|
nominatorsCount: Number(v39.nominatorsCount),
|
|
746153
|
-
rewardPoints: v39.rewardsPoints ? new
|
|
746154
|
-
commission: new
|
|
746155
|
-
totalBonded: new
|
|
746156
|
-
selfBonded: new
|
|
746269
|
+
rewardPoints: v39.rewardsPoints ? new import_bignumber227.BigNumber(v39.rewardsPoints) : null,
|
|
746270
|
+
commission: new import_bignumber227.BigNumber(v39.commission).dividedBy(VALIDATOR_COMISSION_RATIO),
|
|
746271
|
+
totalBonded: new import_bignumber227.BigNumber(v39.total),
|
|
746272
|
+
selfBonded: new import_bignumber227.BigNumber(v39.own),
|
|
746157
746273
|
isElected: v39.isElected,
|
|
746158
746274
|
isOversubscribed: v39.isOversubscribed
|
|
746159
746275
|
}));
|
|
@@ -746281,24 +746397,6 @@ function loadPolkadotCrypto() {
|
|
|
746281
746397
|
return p69;
|
|
746282
746398
|
}
|
|
746283
746399
|
|
|
746284
|
-
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/state.js
|
|
746285
|
-
var import_rxjs134 = require("rxjs");
|
|
746286
|
-
var currentPolkadotPreloadedData = {
|
|
746287
|
-
validators: [],
|
|
746288
|
-
staking: void 0,
|
|
746289
|
-
minimumBondBalance: "0"
|
|
746290
|
-
};
|
|
746291
|
-
var updates5 = new import_rxjs134.Subject();
|
|
746292
|
-
function getCurrentPolkadotPreloadData() {
|
|
746293
|
-
return currentPolkadotPreloadedData;
|
|
746294
|
-
}
|
|
746295
|
-
function setPolkadotPreloadData(data6) {
|
|
746296
|
-
if (data6 === currentPolkadotPreloadedData)
|
|
746297
|
-
return;
|
|
746298
|
-
currentPolkadotPreloadedData = data6;
|
|
746299
|
-
updates5.next(data6);
|
|
746300
|
-
}
|
|
746301
|
-
|
|
746302
746400
|
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/preload.js
|
|
746303
746401
|
var PRELOAD_MAX_AGE5 = 60 * 1e3;
|
|
746304
746402
|
function fromHydrateValidator3(validatorRaw) {
|
|
@@ -746306,10 +746404,10 @@ function fromHydrateValidator3(validatorRaw) {
|
|
|
746306
746404
|
address: validatorRaw.address,
|
|
746307
746405
|
identity: validatorRaw.identity,
|
|
746308
746406
|
nominatorsCount: Number(validatorRaw.nominatorsCount),
|
|
746309
|
-
rewardPoints: validatorRaw.rewardPoints === null ? null : new
|
|
746310
|
-
commission: new
|
|
746311
|
-
totalBonded: new
|
|
746312
|
-
selfBonded: new
|
|
746407
|
+
rewardPoints: validatorRaw.rewardPoints === null ? null : new import_bignumber228.BigNumber(validatorRaw.rewardPoints),
|
|
746408
|
+
commission: new import_bignumber228.BigNumber(validatorRaw.commission),
|
|
746409
|
+
totalBonded: new import_bignumber228.BigNumber(validatorRaw.totalBonded),
|
|
746410
|
+
selfBonded: new import_bignumber228.BigNumber(validatorRaw.selfBonded),
|
|
746313
746411
|
isElected: !!validatorRaw.isElected,
|
|
746314
746412
|
isOversubscribed: !!validatorRaw.isOversubscribed
|
|
746315
746413
|
};
|
|
@@ -746379,98 +746477,6 @@ var hydrate7 = (data6) => {
|
|
|
746379
746477
|
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/getFeesForTransaction.js
|
|
746380
746478
|
var import_bignumber230 = require("bignumber.js");
|
|
746381
746479
|
|
|
746382
|
-
// ../../libs/coin-modules/coin-polkadot/lib-es/bridge/utils.js
|
|
746383
|
-
var import_bignumber228 = require("bignumber.js");
|
|
746384
|
-
var EXISTENTIAL_DEPOSIT2 = new import_bignumber228.BigNumber(1e10);
|
|
746385
|
-
var EXISTENTIAL_DEPOSIT_RECOMMENDED_MARGIN2 = new import_bignumber228.BigNumber(1e9);
|
|
746386
|
-
var MAX_UNLOCKINGS = 32;
|
|
746387
|
-
var MAX_AMOUNT_INPUT = 18446744073709552e3;
|
|
746388
|
-
var FEES_SAFETY_BUFFER3 = new import_bignumber228.BigNumber(1e9);
|
|
746389
|
-
var isStash = (a72) => {
|
|
746390
|
-
return !!a72.polkadotResources?.controller;
|
|
746391
|
-
};
|
|
746392
|
-
var isController = (account3) => {
|
|
746393
|
-
return !!account3.polkadotResources?.stash;
|
|
746394
|
-
};
|
|
746395
|
-
var canBond = (a72) => {
|
|
746396
|
-
const { balance } = a72;
|
|
746397
|
-
return EXISTENTIAL_DEPOSIT2.lte(balance);
|
|
746398
|
-
};
|
|
746399
|
-
var getMinimumAmountToBond = (a72, minimumBondBalance) => {
|
|
746400
|
-
const currentlyBondedBalance = calculateMaxUnbond(a72);
|
|
746401
|
-
if (minimumBondBalance && currentlyBondedBalance.lt(minimumBondBalance)) {
|
|
746402
|
-
return minimumBondBalance.minus(currentlyBondedBalance);
|
|
746403
|
-
}
|
|
746404
|
-
return new import_bignumber228.BigNumber(0);
|
|
746405
|
-
};
|
|
746406
|
-
var hasMinimumBondBalance = (account3) => {
|
|
746407
|
-
const { minimumBondBalance } = getCurrentPolkadotPreloadData();
|
|
746408
|
-
return !account3.polkadotResources || account3.polkadotResources.lockedBalance.gte(new import_bignumber228.BigNumber(minimumBondBalance));
|
|
746409
|
-
};
|
|
746410
|
-
var hasMaxUnlockings = (a72) => {
|
|
746411
|
-
const { unlockings = [] } = a72.polkadotResources || {};
|
|
746412
|
-
return (unlockings?.length || 0) >= MAX_UNLOCKINGS;
|
|
746413
|
-
};
|
|
746414
|
-
var hasLockedBalance = (a72) => {
|
|
746415
|
-
const { lockedBalance = new import_bignumber228.BigNumber(0), unlockingBalance = new import_bignumber228.BigNumber(0) } = a72.polkadotResources || {};
|
|
746416
|
-
return lockedBalance.minus(unlockingBalance).gt(0);
|
|
746417
|
-
};
|
|
746418
|
-
var canUnbond = (a72) => {
|
|
746419
|
-
return hasLockedBalance(a72) && !hasMaxUnlockings(a72);
|
|
746420
|
-
};
|
|
746421
|
-
var canNominate = (account3) => {
|
|
746422
|
-
return isController(account3) && hasMinimumBondBalance(account3);
|
|
746423
|
-
};
|
|
746424
|
-
var isFirstBond = (a72) => !isStash(a72);
|
|
746425
|
-
var getNonce2 = (a72) => {
|
|
746426
|
-
const lastPendingOp = a72.pendingOperations[0];
|
|
746427
|
-
const nonce = Math.max(a72.polkadotResources?.nonce || 0, lastPendingOp && typeof lastPendingOp.transactionSequenceNumber === "number" ? lastPendingOp.transactionSequenceNumber + 1 : 0);
|
|
746428
|
-
return nonce;
|
|
746429
|
-
};
|
|
746430
|
-
var calculateMaxBond = (a72, t65) => {
|
|
746431
|
-
const amount = a72.spendableBalance.minus(t65.fees || 0).minus(FEES_SAFETY_BUFFER3);
|
|
746432
|
-
return amount.lt(0) ? new import_bignumber228.BigNumber(0) : amount;
|
|
746433
|
-
};
|
|
746434
|
-
var calculateMaxUnbond = (a72) => {
|
|
746435
|
-
return a72.polkadotResources?.lockedBalance.minus(a72.polkadotResources.unlockingBalance) ?? new import_bignumber228.BigNumber(0);
|
|
746436
|
-
};
|
|
746437
|
-
var calculateMaxRebond = (a72) => {
|
|
746438
|
-
return a72.polkadotResources?.unlockingBalance ?? new import_bignumber228.BigNumber(0);
|
|
746439
|
-
};
|
|
746440
|
-
var calculateMaxSend2 = (a72, t65) => {
|
|
746441
|
-
const amount = a72.spendableBalance.minus(t65.fees || 0);
|
|
746442
|
-
return amount.lt(0) ? new import_bignumber228.BigNumber(0) : amount;
|
|
746443
|
-
};
|
|
746444
|
-
var calculateAmount4 = ({ account: account3, transaction }) => {
|
|
746445
|
-
let amount = transaction.amount;
|
|
746446
|
-
if (transaction.useAllAmount) {
|
|
746447
|
-
switch (transaction.mode) {
|
|
746448
|
-
case "send":
|
|
746449
|
-
amount = calculateMaxSend2(account3, transaction);
|
|
746450
|
-
break;
|
|
746451
|
-
case "bond":
|
|
746452
|
-
amount = calculateMaxBond(account3, transaction);
|
|
746453
|
-
break;
|
|
746454
|
-
case "unbond":
|
|
746455
|
-
amount = calculateMaxUnbond(account3);
|
|
746456
|
-
break;
|
|
746457
|
-
case "rebond":
|
|
746458
|
-
amount = calculateMaxRebond(account3);
|
|
746459
|
-
break;
|
|
746460
|
-
default:
|
|
746461
|
-
amount = account3.spendableBalance.minus(transaction.fees || 0);
|
|
746462
|
-
break;
|
|
746463
|
-
}
|
|
746464
|
-
} else if (transaction.amount.gt(MAX_AMOUNT_INPUT)) {
|
|
746465
|
-
return new import_bignumber228.BigNumber(MAX_AMOUNT_INPUT);
|
|
746466
|
-
}
|
|
746467
|
-
return amount.lt(0) ? new import_bignumber228.BigNumber(0) : amount;
|
|
746468
|
-
};
|
|
746469
|
-
var getMinimumBalance2 = (a72) => {
|
|
746470
|
-
const lockedBalance = a72.balance.minus(a72.spendableBalance);
|
|
746471
|
-
return lockedBalance.lte(EXISTENTIAL_DEPOSIT2) ? EXISTENTIAL_DEPOSIT2.minus(lockedBalance) : new import_bignumber228.BigNumber(0);
|
|
746472
|
-
};
|
|
746473
|
-
|
|
746474
746480
|
// ../../libs/coin-modules/coin-polkadot/lib-es/logic/craftTransaction.js
|
|
746475
746481
|
var import_bignumber229 = __toESM(require("bignumber.js"));
|
|
746476
746482
|
var EXTRINSIC_VERSION2 = 4;
|
|
@@ -793503,10 +793509,10 @@ async function rawEncode2(contents) {
|
|
|
793503
793509
|
}
|
|
793504
793510
|
|
|
793505
793511
|
// ../../libs/coin-modules/coin-tezos/lib-es/logic/estimateFees.js
|
|
793506
|
-
var
|
|
793512
|
+
var import_utils304 = __toESM(require_utils44());
|
|
793507
793513
|
init_lib_es2();
|
|
793508
793514
|
async function estimateFees3({ account: account3, transaction }) {
|
|
793509
|
-
const encodedPubKey = b58cencode((0,
|
|
793515
|
+
const encodedPubKey = b58cencode((0, import_utils304.compressPublicKey)(Buffer.from(account3.xpub || "", "hex"), DerivationType.ED25519), prefix2[Prefix.EDPK]);
|
|
793510
793516
|
const tezosToolkit = getTezosToolkit();
|
|
793511
793517
|
tezosToolkit.setProvider({
|
|
793512
793518
|
signer: {
|