@subwallet/extension-base 1.0.2-1 → 1.0.2-1b
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/background/KoniTypes.d.ts +16 -34
- package/background/KoniTypes.js +6 -7
- package/background/errors/TransactionError.js +21 -1
- package/cjs/background/KoniTypes.js +6 -7
- package/cjs/background/errors/TransactionError.js +20 -0
- package/cjs/constants/index.js +8 -26
- package/cjs/koni/api/dotsama/balance.js +49 -224
- package/cjs/koni/api/dotsama/transfer.js +30 -29
- package/cjs/koni/api/nft/acala_nft/index.js +4 -1
- package/cjs/koni/api/nft/bit.country/index.js +4 -1
- package/cjs/koni/api/nft/evm_nft/index.js +7 -3
- package/cjs/koni/api/nft/index.js +3 -6
- package/cjs/koni/api/nft/karura_nft/index.js +4 -1
- package/cjs/koni/api/nft/rmrk_nft/index.js +8 -1
- package/cjs/koni/api/nft/statemine_nft/index.js +4 -1
- package/cjs/koni/api/nft/unique_nft/index.js +6 -1
- package/cjs/koni/api/nft/wasm_nft/index.js +169 -111
- package/cjs/koni/api/nft/wasm_nft/utils.js +11 -7
- package/cjs/koni/api/staking/bonding/amplitude.js +13 -9
- package/cjs/koni/api/staking/bonding/astar.js +15 -13
- package/cjs/koni/api/staking/bonding/index.js +22 -10
- package/cjs/koni/api/staking/bonding/paraChain.js +85 -2
- package/cjs/koni/api/staking/bonding/relayChain.js +119 -16
- package/cjs/koni/api/staking/bonding/utils.js +27 -8
- package/cjs/koni/api/tokens/wasm/index.js +5 -4
- package/cjs/koni/api/tokens/wasm/utils.js +63 -0
- package/cjs/koni/api/xcm/polkadotXcm.js +1 -1
- package/cjs/koni/api/xcm/utils.js +18 -13
- package/cjs/koni/api/xcm/xTokens.js +1 -1
- package/cjs/koni/api/xcm/xcmPallet.js +9 -6
- package/cjs/koni/background/cron.js +150 -47
- package/cjs/koni/background/handlers/Extension.js +106 -64
- package/cjs/koni/background/handlers/State.js +19 -21
- package/cjs/koni/background/handlers/Tabs.js +8 -1
- package/cjs/koni/background/subscription.js +32 -29
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +13 -8
- package/cjs/services/chain-service/handler/light-client/index.js +2 -0
- package/cjs/services/chain-service/index.js +6 -7
- package/cjs/services/event-service/index.js +5 -1
- package/cjs/services/event-service/types.js +11 -1
- package/cjs/services/history-service/index.js +16 -10
- package/cjs/services/history-service/subsquid-multi-chain-history.js +12 -9
- package/cjs/services/price-service/coingecko.js +0 -1
- package/cjs/services/price-service/index.js +2 -3
- package/cjs/services/request-service/handler/AuthRequestHandler.js +6 -2
- package/cjs/services/storage-service/DatabaseService.js +52 -33
- package/cjs/services/storage-service/db-stores/Nft.js +4 -17
- package/cjs/services/transaction-service/event-parser/index.js +20 -48
- package/cjs/services/transaction-service/index.js +23 -14
- package/cjs/utils/index.js +7 -14
- package/constants/index.d.ts +7 -13
- package/constants/index.js +7 -13
- package/koni/api/dotsama/balance.d.ts +0 -1
- package/koni/api/dotsama/balance.js +22 -197
- package/koni/api/dotsama/transfer.js +5 -4
- package/koni/api/nft/acala_nft/index.js +3 -1
- package/koni/api/nft/bit.country/index.js +3 -1
- package/koni/api/nft/evm_nft/index.js +6 -3
- package/koni/api/nft/index.d.ts +1 -2
- package/koni/api/nft/index.js +3 -6
- package/koni/api/nft/karura_nft/index.js +3 -1
- package/koni/api/nft/nft.d.ts +1 -0
- package/koni/api/nft/rmrk_nft/index.js +8 -1
- package/koni/api/nft/statemine_nft/index.js +3 -1
- package/koni/api/nft/unique_nft/index.js +5 -1
- package/koni/api/nft/wasm_nft/index.d.ts +0 -2
- package/koni/api/nft/wasm_nft/index.js +167 -109
- package/koni/api/nft/wasm_nft/utils.d.ts +7 -5
- package/koni/api/nft/wasm_nft/utils.js +7 -5
- package/koni/api/staking/bonding/amplitude.d.ts +0 -1
- package/koni/api/staking/bonding/amplitude.js +15 -10
- package/koni/api/staking/bonding/astar.js +8 -6
- package/koni/api/staking/bonding/index.d.ts +4 -1
- package/koni/api/staking/bonding/index.js +23 -13
- package/koni/api/staking/bonding/paraChain.d.ts +3 -0
- package/koni/api/staking/bonding/paraChain.js +86 -5
- package/koni/api/staking/bonding/relayChain.d.ts +5 -1
- package/koni/api/staking/bonding/relayChain.js +118 -18
- package/koni/api/staking/bonding/utils.d.ts +3 -2
- package/koni/api/staking/bonding/utils.js +27 -9
- package/koni/api/tokens/wasm/index.js +5 -4
- package/koni/api/tokens/wasm/utils.d.ts +6 -0
- package/koni/api/tokens/wasm/utils.js +54 -0
- package/koni/api/xcm/polkadotXcm.js +2 -2
- package/koni/api/xcm/utils.d.ts +5 -6
- package/koni/api/xcm/utils.js +15 -10
- package/koni/api/xcm/xTokens.js +2 -2
- package/koni/api/xcm/xcmPallet.js +10 -9
- package/koni/background/cron.d.ts +6 -1
- package/koni/background/cron.js +151 -48
- package/koni/background/handlers/Extension.d.ts +2 -2
- package/koni/background/handlers/Extension.js +108 -67
- package/koni/background/handlers/State.d.ts +5 -6
- package/koni/background/handlers/State.js +19 -21
- package/koni/background/handlers/Tabs.js +8 -1
- package/koni/background/subscription.js +31 -30
- package/package.json +9 -4
- package/services/chain-service/handler/SubstrateChainHandler.js +14 -9
- package/services/chain-service/handler/light-client/index.d.ts +17 -1
- package/services/chain-service/handler/light-client/index.js +1 -1
- package/services/chain-service/helper/psp22_abi.json +1041 -881
- package/services/chain-service/helper/psp34_abi.json +2963 -1807
- package/services/chain-service/index.js +6 -7
- package/services/event-service/index.js +5 -1
- package/services/event-service/types.d.ts +5 -9
- package/services/event-service/types.js +4 -1
- package/services/history-service/index.d.ts +1 -1
- package/services/history-service/index.js +16 -10
- package/services/history-service/subsquid-multi-chain-history.js +15 -11
- package/services/price-service/coingecko.js +0 -1
- package/services/price-service/index.js +2 -3
- package/services/request-service/handler/AuthRequestHandler.js +6 -2
- package/services/storage-service/DatabaseService.d.ts +1 -0
- package/services/storage-service/DatabaseService.js +52 -33
- package/services/storage-service/db-stores/Nft.d.ts +1 -2
- package/services/storage-service/db-stores/Nft.js +4 -16
- package/services/transaction-service/event-parser/index.js +21 -49
- package/services/transaction-service/index.js +23 -14
- package/utils/index.d.ts +1 -1
- package/utils/index.js +6 -12
|
@@ -430,35 +430,38 @@ class KoniExtension {
|
|
|
430
430
|
}
|
|
431
431
|
async accountsGetAllWithCurrentAddress(id, port) {
|
|
432
432
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
433
|
+
const keyringService = this.#koniState.keyringService;
|
|
434
|
+
await this.#koniState.eventService.waitAccountReady;
|
|
435
|
+
const currentAccount = keyringService.currentAccount;
|
|
436
|
+
const accountsSubject = _uiKeyring.keyring.accounts.subject;
|
|
437
|
+
const transformedAccounts = transformAccounts(accountsSubject.value);
|
|
438
|
+
const responseData = {
|
|
439
|
+
accounts: transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [{
|
|
440
|
+
...ACCOUNT_ALL_JSON
|
|
441
|
+
}, ...transformedAccounts] : [],
|
|
442
|
+
currentAddress: currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.address,
|
|
443
|
+
currentGenesisHash: currentAccount === null || currentAccount === void 0 ? void 0 : currentAccount.currentGenesisHash
|
|
444
|
+
};
|
|
445
|
+
const subscriptionAccounts = accountsSubject.subscribe(storedAccounts => {
|
|
446
|
+
const transformedAccounts = transformAccounts(storedAccounts);
|
|
447
|
+
responseData.accounts = transformedAccounts !== null && transformedAccounts !== void 0 && transformedAccounts.length ? [{
|
|
448
|
+
...ACCOUNT_ALL_JSON
|
|
449
|
+
}, ...transformedAccounts] : [];
|
|
450
|
+
cb(responseData);
|
|
451
|
+
});
|
|
452
|
+
const subscriptionCurrentAccount = keyringService.currentAccountSubject.subscribe(currentAccountData => {
|
|
453
|
+
responseData.currentAddress = currentAccountData.address;
|
|
454
|
+
responseData.currentGenesisHash = currentAccountData.currentGenesisHash;
|
|
455
|
+
cb(responseData);
|
|
456
|
+
});
|
|
457
|
+
this.createUnsubscriptionHandle(id, () => {
|
|
458
|
+
subscriptionAccounts.unsubscribe();
|
|
459
|
+
subscriptionCurrentAccount.unsubscribe();
|
|
460
|
+
});
|
|
461
|
+
port.onDisconnect.addListener(() => {
|
|
462
|
+
this.cancelSubscription(id);
|
|
461
463
|
});
|
|
464
|
+
return responseData;
|
|
462
465
|
}
|
|
463
466
|
accountsGetAll(id, port) {
|
|
464
467
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
@@ -480,11 +483,15 @@ class KoniExtension {
|
|
|
480
483
|
} = _ref21;
|
|
481
484
|
return _uiKeyring.keyring.saveRecent(accountId);
|
|
482
485
|
}
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
|
|
487
|
+
// private triggerAccountsSubscription (): boolean {
|
|
488
|
+
// const accountsSubject = accountsObservable.subject;
|
|
489
|
+
//
|
|
490
|
+
// accountsSubject.next(accountsSubject.getValue());
|
|
491
|
+
//
|
|
492
|
+
// return true;
|
|
493
|
+
// }
|
|
494
|
+
|
|
488
495
|
_getAuthListV2() {
|
|
489
496
|
return new Promise((resolve, reject) => {
|
|
490
497
|
this.#koniState.getAuthorize(rs => {
|
|
@@ -840,8 +847,12 @@ class KoniExtension {
|
|
|
840
847
|
} else {
|
|
841
848
|
accountInfo.address = address;
|
|
842
849
|
if (address !== _constants.ALL_ACCOUNT_KEY) {
|
|
843
|
-
|
|
844
|
-
|
|
850
|
+
try {
|
|
851
|
+
const currentKeyPair = _uiKeyring.keyring.getPair(address);
|
|
852
|
+
accountInfo.currentGenesisHash = (currentKeyPair === null || currentKeyPair === void 0 ? void 0 : currentKeyPair.meta.genesisHash) || _constants.ALL_GENESIS_HASH;
|
|
853
|
+
} catch {
|
|
854
|
+
accountInfo.currentGenesisHash = _constants.ALL_GENESIS_HASH;
|
|
855
|
+
}
|
|
845
856
|
} else {
|
|
846
857
|
accountInfo.currentGenesisHash = accountInfo.allGenesisHash || _constants.ALL_GENESIS_HASH;
|
|
847
858
|
}
|
|
@@ -851,18 +862,15 @@ class KoniExtension {
|
|
|
851
862
|
});
|
|
852
863
|
}
|
|
853
864
|
updateCurrentAccountAddress(address) {
|
|
854
|
-
this._saveCurrentAccountAddress(address
|
|
855
|
-
this.triggerAccountsSubscription();
|
|
856
|
-
});
|
|
865
|
+
this._saveCurrentAccountAddress(address);
|
|
857
866
|
return true;
|
|
858
867
|
}
|
|
859
|
-
saveCurrentAccountAddress(data
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
868
|
+
async saveCurrentAccountAddress(data) {
|
|
869
|
+
return new Promise(resolve => {
|
|
870
|
+
this._saveCurrentAccountAddress(data.address, currentInfo => {
|
|
871
|
+
resolve(currentInfo);
|
|
872
|
+
});
|
|
864
873
|
});
|
|
865
|
-
return true;
|
|
866
874
|
}
|
|
867
875
|
async getAssetSetting() {
|
|
868
876
|
return this.#koniState.chainService.getAssetSettings();
|
|
@@ -879,6 +887,7 @@ class KoniExtension {
|
|
|
879
887
|
async updateAssetSetting(params) {
|
|
880
888
|
try {
|
|
881
889
|
await this.#koniState.chainService.updateAssetSetting(params.tokenSlug, params.assetSetting);
|
|
890
|
+
this.#koniState.eventService.emit('asset.updateState', params.tokenSlug);
|
|
882
891
|
return true;
|
|
883
892
|
} catch (e) {
|
|
884
893
|
console.error('Error updating asset setting', e);
|
|
@@ -1366,7 +1375,6 @@ class KoniExtension {
|
|
|
1366
1375
|
|
|
1367
1376
|
// Get native token amount
|
|
1368
1377
|
const freeBalance = await this.#koniState.balanceService.getTokenFreeBalance(from, networkKey, tokenSlug);
|
|
1369
|
-
let edAsWarning = false;
|
|
1370
1378
|
if ((0, _utilCrypto.isEthereumAddress)(from) && (0, _utilCrypto.isEthereumAddress)(to)) {
|
|
1371
1379
|
chainType = _KoniTypes.ChainType.EVM;
|
|
1372
1380
|
const txVal = transferAll ? freeBalance.value : value || '0';
|
|
@@ -1376,7 +1384,6 @@ class KoniExtension {
|
|
|
1376
1384
|
[transaction, transferAmount.value] = await (0, _transfer3.getERC20TransactionObject)((0, _utils._getContractAddressOfToken)(tokenInfo), chainInfo, from, to, txVal, !!transferAll, evmApiMap);
|
|
1377
1385
|
} else {
|
|
1378
1386
|
[transaction, transferAmount.value] = await (0, _transfer3.getEVMTransactionObject)(chainInfo, to, txVal, !!transferAll, evmApiMap);
|
|
1379
|
-
edAsWarning = true;
|
|
1380
1387
|
}
|
|
1381
1388
|
} else {
|
|
1382
1389
|
const substrateApi = this.#koniState.getSubstrateApi(networkKey);
|
|
@@ -1389,7 +1396,6 @@ class KoniExtension {
|
|
|
1389
1396
|
to: to,
|
|
1390
1397
|
substrateApi
|
|
1391
1398
|
});
|
|
1392
|
-
edAsWarning = true;
|
|
1393
1399
|
}
|
|
1394
1400
|
const transferNativeAmount = isTransferNativeToken ? transferAmount.value : '0';
|
|
1395
1401
|
return this.#koniState.transactionService.handleTransaction({
|
|
@@ -1404,7 +1410,7 @@ class KoniExtension {
|
|
|
1404
1410
|
extrinsicType: isTransferNativeToken ? _KoniTypes.ExtrinsicType.TRANSFER_BALANCE : _KoniTypes.ExtrinsicType.TRANSFER_TOKEN,
|
|
1405
1411
|
ignoreWarnings: transferAll,
|
|
1406
1412
|
isTransferAll: transferAll,
|
|
1407
|
-
edAsWarning:
|
|
1413
|
+
edAsWarning: isTransferNativeToken
|
|
1408
1414
|
});
|
|
1409
1415
|
}
|
|
1410
1416
|
validateCrossChainTransfer(destinationNetworkKey, sendingTokenSlug, sender, sendingValue) {
|
|
@@ -2099,6 +2105,7 @@ class KoniExtension {
|
|
|
2099
2105
|
}
|
|
2100
2106
|
async getNominationPoolOptions(chain) {
|
|
2101
2107
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2108
|
+
console.log('chain', chain);
|
|
2102
2109
|
return await (0, _bonding.getNominationPoolsInfo)(chain, substrateApi);
|
|
2103
2110
|
}
|
|
2104
2111
|
async submitBonding(inputData) {
|
|
@@ -2109,12 +2116,15 @@ class KoniExtension {
|
|
|
2109
2116
|
nominatorMetadata,
|
|
2110
2117
|
selectedValidators
|
|
2111
2118
|
} = inputData;
|
|
2112
|
-
if (!amount || !selectedValidators) {
|
|
2113
|
-
// Todo: Check and return error here
|
|
2114
|
-
|
|
2115
|
-
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INVALID_PARAMS)]);
|
|
2116
|
-
}
|
|
2117
2119
|
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2120
|
+
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, _KoniTypes.StakingType.NOMINATED);
|
|
2121
|
+
if (!chainStakingMetadata) {
|
|
2122
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR)]);
|
|
2123
|
+
}
|
|
2124
|
+
const bondingValidation = (0, _bonding.validateBondingCondition)(chainInfo, amount, selectedValidators, address, chainStakingMetadata, nominatorMetadata);
|
|
2125
|
+
if (!amount || !selectedValidators || bondingValidation.length > 0) {
|
|
2126
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(bondingValidation);
|
|
2127
|
+
}
|
|
2118
2128
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2119
2129
|
const extrinsic = await (0, _bonding.getBondingExtrinsic)(chainInfo, amount, selectedValidators, substrateApi, address, nominatorMetadata);
|
|
2120
2130
|
console.log('Bonding extrinsic: ', chain, extrinsic.toHex());
|
|
@@ -2125,7 +2135,8 @@ class KoniExtension {
|
|
|
2125
2135
|
data: inputData,
|
|
2126
2136
|
extrinsicType: _KoniTypes.ExtrinsicType.STAKING_BOND,
|
|
2127
2137
|
transaction: extrinsic,
|
|
2128
|
-
url: _constants2.EXTENSION_REQUEST_URL
|
|
2138
|
+
url: _constants2.EXTENSION_REQUEST_URL,
|
|
2139
|
+
transferNativeAmount: amount
|
|
2129
2140
|
});
|
|
2130
2141
|
}
|
|
2131
2142
|
async submitUnbonding(inputData) {
|
|
@@ -2135,12 +2146,17 @@ class KoniExtension {
|
|
|
2135
2146
|
nominatorMetadata,
|
|
2136
2147
|
validatorAddress
|
|
2137
2148
|
} = inputData;
|
|
2138
|
-
|
|
2139
|
-
|
|
2149
|
+
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, _KoniTypes.StakingType.NOMINATED);
|
|
2150
|
+
if (!chainStakingMetadata || !nominatorMetadata) {
|
|
2151
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR)]);
|
|
2152
|
+
}
|
|
2153
|
+
const unbondingValidation = (0, _bonding.validateUnbondingCondition)(nominatorMetadata, amount, chain, chainStakingMetadata, validatorAddress);
|
|
2154
|
+
if (!amount || unbondingValidation.length > 0) {
|
|
2155
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(unbondingValidation);
|
|
2140
2156
|
}
|
|
2141
2157
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2142
2158
|
const extrinsic = await (0, _bonding.getUnbondingExtrinsic)(nominatorMetadata, amount, chain, substrateApi, validatorAddress);
|
|
2143
|
-
console.log('
|
|
2159
|
+
console.log('Unbonding extrinsic: ', extrinsic.toHex());
|
|
2144
2160
|
return await this.#koniState.transactionService.handleTransaction({
|
|
2145
2161
|
address: nominatorMetadata.address,
|
|
2146
2162
|
chain: chain,
|
|
@@ -2214,7 +2230,7 @@ class KoniExtension {
|
|
|
2214
2230
|
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
2215
2231
|
});
|
|
2216
2232
|
}
|
|
2217
|
-
async
|
|
2233
|
+
async submitPoolBonding(inputData) {
|
|
2218
2234
|
const {
|
|
2219
2235
|
address,
|
|
2220
2236
|
amount,
|
|
@@ -2222,8 +2238,15 @@ class KoniExtension {
|
|
|
2222
2238
|
nominatorMetadata,
|
|
2223
2239
|
selectedPool
|
|
2224
2240
|
} = inputData;
|
|
2225
|
-
|
|
2226
|
-
|
|
2241
|
+
const chainInfo = this.#koniState.getChainInfo(chain);
|
|
2242
|
+
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, _KoniTypes.StakingType.NOMINATED);
|
|
2243
|
+
if (!chainStakingMetadata) {
|
|
2244
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR)]);
|
|
2245
|
+
}
|
|
2246
|
+
const bondingValidation = (0, _relayChain.validatePoolBondingCondition)(chainInfo, amount, selectedPool, address, chainStakingMetadata, nominatorMetadata);
|
|
2247
|
+
if (!amount || bondingValidation.length > 0) {
|
|
2248
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(bondingValidation);
|
|
2249
|
+
}
|
|
2227
2250
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2228
2251
|
const extrinsic = await (0, _relayChain.getPoolingBondingExtrinsic)(substrateApi, amount, selectedPool.id, nominatorMetadata);
|
|
2229
2252
|
console.log('Join nomination pool extrinsic', extrinsic.toHex());
|
|
@@ -2242,6 +2265,14 @@ class KoniExtension {
|
|
|
2242
2265
|
chain,
|
|
2243
2266
|
nominatorMetadata
|
|
2244
2267
|
} = inputData;
|
|
2268
|
+
const chainStakingMetadata = await this.#koniState.getStakingMetadataByChain(chain, _KoniTypes.StakingType.NOMINATED);
|
|
2269
|
+
if (!chainStakingMetadata || !nominatorMetadata) {
|
|
2270
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors([new _TransactionError.TransactionError(_KoniTypes.BasicTxErrorType.INTERNAL_ERROR)]);
|
|
2271
|
+
}
|
|
2272
|
+
const unbondingValidation = (0, _relayChain.validateRelayUnbondingCondition)(amount, chainStakingMetadata, nominatorMetadata);
|
|
2273
|
+
if (!amount || unbondingValidation.length > 0) {
|
|
2274
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(unbondingValidation);
|
|
2275
|
+
}
|
|
2245
2276
|
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
2246
2277
|
const extrinsic = await (0, _relayChain.getPoolingUnbondingExtrinsic)(substrateApi, amount, nominatorMetadata);
|
|
2247
2278
|
console.log('Nomination pool unbond extrinsic', extrinsic.toHex());
|
|
@@ -2744,6 +2775,17 @@ class KoniExtension {
|
|
|
2744
2775
|
});
|
|
2745
2776
|
return notificationSubject.value;
|
|
2746
2777
|
}
|
|
2778
|
+
async reloadCron(_ref65) {
|
|
2779
|
+
let {
|
|
2780
|
+
data
|
|
2781
|
+
} = _ref65;
|
|
2782
|
+
if (data === 'nft') {
|
|
2783
|
+
return await this.#koniState.reloadNft();
|
|
2784
|
+
} else if (data === 'staking') {
|
|
2785
|
+
return await this.#koniState.reloadStaking();
|
|
2786
|
+
}
|
|
2787
|
+
return Promise.resolve(false);
|
|
2788
|
+
}
|
|
2747
2789
|
|
|
2748
2790
|
// --------------------------------------------------------------
|
|
2749
2791
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
@@ -2860,10 +2902,8 @@ class KoniExtension {
|
|
|
2860
2902
|
return this.accountsGetAll(id, port);
|
|
2861
2903
|
case 'pri(accounts.saveRecent)':
|
|
2862
2904
|
return this.saveRecentAccountId(request);
|
|
2863
|
-
case 'pri(accounts.triggerSubscription)':
|
|
2864
|
-
return this.triggerAccountsSubscription();
|
|
2865
2905
|
case 'pri(currentAccount.saveAddress)':
|
|
2866
|
-
return this.saveCurrentAccountAddress(request
|
|
2906
|
+
return await this.saveCurrentAccountAddress(request);
|
|
2867
2907
|
case 'pri(accounts.updateCurrentAddress)':
|
|
2868
2908
|
return this.updateCurrentAccountAddress(request);
|
|
2869
2909
|
case 'pri(settings.changeBalancesVisibility)':
|
|
@@ -3027,7 +3067,7 @@ class KoniExtension {
|
|
|
3027
3067
|
case 'pri(staking.submitTuringCancelCompound)':
|
|
3028
3068
|
return await this.submitTuringCancelStakeCompound(request);
|
|
3029
3069
|
case 'pri(bonding.nominationPool.submitBonding)':
|
|
3030
|
-
return await this.
|
|
3070
|
+
return await this.submitPoolBonding(request);
|
|
3031
3071
|
case 'pri(bonding.nominationPool.submitUnbonding)':
|
|
3032
3072
|
return await this.submitPoolingUnbonding(request);
|
|
3033
3073
|
|
|
@@ -3076,6 +3116,8 @@ class KoniExtension {
|
|
|
3076
3116
|
// Notification
|
|
3077
3117
|
case 'pri(notifications.subscribe)':
|
|
3078
3118
|
return this.subscribeNotifications(id, port);
|
|
3119
|
+
case 'pri(cron.reload)':
|
|
3120
|
+
return await this.reloadCron(request);
|
|
3079
3121
|
|
|
3080
3122
|
// Default
|
|
3081
3123
|
default:
|
|
@@ -67,7 +67,6 @@ class KoniState {
|
|
|
67
67
|
unsubscriptionMap = {};
|
|
68
68
|
accountRefStore = new _AccountRef.default();
|
|
69
69
|
externalRequest = {};
|
|
70
|
-
serviceInfoSubject = new _rxjs.Subject();
|
|
71
70
|
balanceMap = {};
|
|
72
71
|
balanceSubject = new _rxjs.Subject();
|
|
73
72
|
crowdloanMap = generateDefaultCrowdloanMap();
|
|
@@ -309,7 +308,7 @@ class KoniState {
|
|
|
309
308
|
return addresses;
|
|
310
309
|
}
|
|
311
310
|
async getPooledStakingRecordsByAddress(addresses) {
|
|
312
|
-
return
|
|
311
|
+
return this.dbService.getPooledStakings(addresses, this.activeChainSlugs);
|
|
313
312
|
}
|
|
314
313
|
|
|
315
314
|
// TODO: delete later
|
|
@@ -367,12 +366,12 @@ class KoniState {
|
|
|
367
366
|
this.dbService.addNft(address, nftData).catch(e => this.logger.warn(e));
|
|
368
367
|
callback && callback(nftData);
|
|
369
368
|
}
|
|
370
|
-
removeNfts(chain, address, collectionId, nftIds) {
|
|
371
|
-
return this.dbService.removeNfts(chain, address, collectionId, nftIds);
|
|
372
|
-
}
|
|
373
369
|
deleteNftCollection(chain, collectionId) {
|
|
374
370
|
return this.dbService.deleteNftCollection(chain, collectionId);
|
|
375
371
|
}
|
|
372
|
+
cleanUpNfts(chain, owner, collectionId, nftIds) {
|
|
373
|
+
this.dbService.cleanUpNft(chain, owner, collectionId, nftIds).catch(e => this.logger.warn(e));
|
|
374
|
+
}
|
|
376
375
|
async getNft() {
|
|
377
376
|
const addresses = this.getDecodedAddresses();
|
|
378
377
|
if (!addresses.length) {
|
|
@@ -459,7 +458,7 @@ class KoniState {
|
|
|
459
458
|
if (address === _constants.ALL_ACCOUNT_KEY) {
|
|
460
459
|
const pairs = _uiKeyring.keyring.getAccounts();
|
|
461
460
|
const pair = pairs[0];
|
|
462
|
-
const pairGenesisHash = pair.meta.genesisHash;
|
|
461
|
+
const pairGenesisHash = (pair === null || pair === void 0 ? void 0 : pair.meta.genesisHash) || '';
|
|
463
462
|
if (pairs.length > 1 || !pair) {
|
|
464
463
|
result.allGenesisHash = currentGenesisHash || undefined;
|
|
465
464
|
} else {
|
|
@@ -673,7 +672,7 @@ class KoniState {
|
|
|
673
672
|
const items = await this.dbService.stores.balance.getBalanceMapByAddress(address);
|
|
674
673
|
return items || {};
|
|
675
674
|
}
|
|
676
|
-
async
|
|
675
|
+
async handleSwitchAccount(newAddress) {
|
|
677
676
|
await Promise.all([this.resetBalanceMap(newAddress), this.resetCrowdloanMap(newAddress)]);
|
|
678
677
|
}
|
|
679
678
|
async resetBalanceMap(newAddress) {
|
|
@@ -754,9 +753,6 @@ class KoniState {
|
|
|
754
753
|
subscribeCrowdloan() {
|
|
755
754
|
return this.crowdloanSubject;
|
|
756
755
|
}
|
|
757
|
-
getAllPriceIds() {
|
|
758
|
-
return this.chainService.getAllPriceIds();
|
|
759
|
-
}
|
|
760
756
|
getSmartContractNfts() {
|
|
761
757
|
return this.chainService.getSmartContractNfts();
|
|
762
758
|
}
|
|
@@ -814,7 +810,9 @@ class KoniState {
|
|
|
814
810
|
await this.chainService.updateAssetSetting(tokenSlug, {
|
|
815
811
|
visible: true
|
|
816
812
|
});
|
|
817
|
-
this.eventService.emit('asset.
|
|
813
|
+
this.eventService.emit('asset.updateState', tokenSlug);
|
|
814
|
+
} else {
|
|
815
|
+
this.eventService.emit('asset.updateState', tokenSlug);
|
|
818
816
|
}
|
|
819
817
|
}
|
|
820
818
|
deleteCustomAssets(targetTokens) {
|
|
@@ -841,6 +839,7 @@ class KoniState {
|
|
|
841
839
|
await this.chainService.updateAssetSetting(newNativeTokenSlug, {
|
|
842
840
|
visible: true
|
|
843
841
|
});
|
|
842
|
+
this.eventService.emit('asset.updateState', newNativeTokenSlug);
|
|
844
843
|
}
|
|
845
844
|
return true;
|
|
846
845
|
}
|
|
@@ -884,13 +883,6 @@ class KoniState {
|
|
|
884
883
|
const defaultChains = this.getDefaultNetworkKeys();
|
|
885
884
|
return this.chainService.resetChainInfoMap(defaultChains);
|
|
886
885
|
}
|
|
887
|
-
updateNetworkStatus(networkKey, status) {
|
|
888
|
-
const chainState = this.chainService.getChainStateByKey(networkKey);
|
|
889
|
-
if (chainState.connectionStatus === status) {
|
|
890
|
-
return;
|
|
891
|
-
}
|
|
892
|
-
this.chainService.setChainConnectionStatus(networkKey, status);
|
|
893
|
-
}
|
|
894
886
|
getSubstrateApiMap() {
|
|
895
887
|
return this.chainService.getSubstrateApiMap();
|
|
896
888
|
}
|
|
@@ -916,9 +908,6 @@ class KoniState {
|
|
|
916
908
|
refreshWeb3Api(key) {
|
|
917
909
|
this.chainService.refreshEvmApi(key);
|
|
918
910
|
}
|
|
919
|
-
subscribeServiceInfo() {
|
|
920
|
-
return this.serviceInfoSubject;
|
|
921
|
-
}
|
|
922
911
|
getServiceInfo() {
|
|
923
912
|
return {
|
|
924
913
|
chainInfoMap: this.chainService.getChainInfoMap(),
|
|
@@ -1368,6 +1357,9 @@ class KoniState {
|
|
|
1368
1357
|
createUnsubscriptionHandle(id, unsubscribe) {
|
|
1369
1358
|
this.unsubscriptionMap[id] = unsubscribe;
|
|
1370
1359
|
}
|
|
1360
|
+
updateChainConnectionStatus(chain, status) {
|
|
1361
|
+
this.chainService.setChainConnectionStatus(chain, status);
|
|
1362
|
+
}
|
|
1371
1363
|
async autoEnableChains(addresses) {
|
|
1372
1364
|
const assetMap = this.chainService.getAssetRegistry();
|
|
1373
1365
|
const promiseList = addresses.map(address => {
|
|
@@ -1439,5 +1431,11 @@ class KoniState {
|
|
|
1439
1431
|
stores.staking.removeAllByAddress(address).catch(console.error);
|
|
1440
1432
|
});
|
|
1441
1433
|
}
|
|
1434
|
+
async reloadNft() {
|
|
1435
|
+
return await this.cron.reloadNft();
|
|
1436
|
+
}
|
|
1437
|
+
async reloadStaking() {
|
|
1438
|
+
return await this.cron.reloadStaking();
|
|
1439
|
+
}
|
|
1442
1440
|
}
|
|
1443
1441
|
exports.default = KoniState;
|
|
@@ -295,13 +295,20 @@ class KoniTabs {
|
|
|
295
295
|
if (!web3.currentProvider.connected) {
|
|
296
296
|
console.log(`[Web3] ${slug} is disconnected, trying to connect...`);
|
|
297
297
|
this.#koniState.refreshWeb3Api(slug);
|
|
298
|
+
let checkingNum = 0;
|
|
298
299
|
const poll = resolve => {
|
|
300
|
+
checkingNum += 1;
|
|
299
301
|
if (web3.currentProvider.connected) {
|
|
300
302
|
console.log(`Network [${slug}] is connected.`);
|
|
301
303
|
resolve(true);
|
|
302
304
|
} else {
|
|
303
305
|
console.log(`Connecting to network [${slug}]`);
|
|
304
|
-
|
|
306
|
+
if (checkingNum < 10) {
|
|
307
|
+
setTimeout(() => poll(resolve), 900);
|
|
308
|
+
} else {
|
|
309
|
+
console.log(`Max retry, stop checking [${slug}]`);
|
|
310
|
+
resolve(false);
|
|
311
|
+
}
|
|
305
312
|
}
|
|
306
313
|
};
|
|
307
314
|
await new Promise(poll);
|
|
@@ -14,6 +14,7 @@ var _paraChain = require("@subwallet/extension-base/koni/api/staking/paraChain")
|
|
|
14
14
|
var _handlers = require("@subwallet/extension-base/koni/background/handlers");
|
|
15
15
|
var _constants2 = require("@subwallet/extension-base/services/chain-service/constants");
|
|
16
16
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
17
|
+
var _types = require("@subwallet/extension-base/services/event-service/types");
|
|
17
18
|
var _util = require("@polkadot/util");
|
|
18
19
|
var _utilCrypto = require("@polkadot/util-crypto");
|
|
19
20
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
@@ -64,30 +65,28 @@ class KoniSubscription {
|
|
|
64
65
|
this.subscribeBalancesAndCrowdloans(currentAddress, this.state.getChainInfoMap(), this.state.getChainStateMap(), this.state.getSubstrateApiMap(), this.state.getEvmApiMap());
|
|
65
66
|
this.subscribeStakingOnChain(currentAddress, this.state.getSubstrateApiMap());
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
this.state.eventService.onLazy(this.eventHandler);
|
|
85
|
-
}
|
|
68
|
+
this.eventHandler = (events, eventTypes) => {
|
|
69
|
+
var _serviceInfo$currentA;
|
|
70
|
+
const serviceInfo = this.state.getServiceInfo();
|
|
71
|
+
const needReload = eventTypes.some(eventType => _types.COMMON_RELOAD_EVENTS.includes(eventType));
|
|
72
|
+
if (!needReload) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.logger.log('ServiceInfo updated, restarting...');
|
|
76
|
+
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.address;
|
|
77
|
+
if (!address) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.subscribeBalancesAndCrowdloans(address, serviceInfo.chainInfoMap, serviceInfo.chainStateMap, serviceInfo.chainApiMap.substrate, serviceInfo.chainApiMap.evm);
|
|
81
|
+
this.subscribeStakingOnChain(address, serviceInfo.chainApiMap.substrate);
|
|
82
|
+
};
|
|
83
|
+
this.state.eventService.onLazy(this.eventHandler);
|
|
86
84
|
}
|
|
87
85
|
stop() {
|
|
88
86
|
this.logger.log('Stopping subscription');
|
|
89
87
|
if (this.eventHandler) {
|
|
90
88
|
this.state.eventService.offLazy(this.eventHandler);
|
|
89
|
+
this.eventHandler = undefined;
|
|
91
90
|
}
|
|
92
91
|
this.stopAllSubscription();
|
|
93
92
|
}
|
|
@@ -113,7 +112,7 @@ class KoniSubscription {
|
|
|
113
112
|
});
|
|
114
113
|
}
|
|
115
114
|
subscribeBalancesAndCrowdloans(address, chainInfoMap, chainStateMap, substrateApiMap, web3ApiMap, onlyRunOnFirstTime) {
|
|
116
|
-
this.state.
|
|
115
|
+
this.state.handleSwitchAccount(address).then(() => {
|
|
117
116
|
const addresses = this.state.getDecodedAddresses(address);
|
|
118
117
|
if (!addresses.length) {
|
|
119
118
|
return;
|
|
@@ -189,8 +188,8 @@ class KoniSubscription {
|
|
|
189
188
|
return _this.state.updateNftData(...arguments);
|
|
190
189
|
}, function () {
|
|
191
190
|
return _this.state.setNftCollection(...arguments);
|
|
192
|
-
}
|
|
193
|
-
|
|
191
|
+
}, function () {
|
|
192
|
+
return _this.state.cleanUpNfts(...arguments);
|
|
194
193
|
}).catch(this.logger.log);
|
|
195
194
|
}
|
|
196
195
|
async subscribeStakingReward(address) {
|
|
@@ -209,7 +208,6 @@ class KoniSubscription {
|
|
|
209
208
|
});
|
|
210
209
|
const result = await (0, _staking.getNominationStakingRewardData)(addresses, targetNetworkMap);
|
|
211
210
|
this.state.updateStakingReward(result, 'slowInterval');
|
|
212
|
-
this.logger.log('Set staking reward state done', result);
|
|
213
211
|
}
|
|
214
212
|
async subscribeStakingRewardFastInterval(address) {
|
|
215
213
|
const addresses = this.state.getDecodedAddresses(address);
|
|
@@ -239,15 +237,21 @@ class KoniSubscription {
|
|
|
239
237
|
const [poolingStakingRewards, amplitudeUnclaimedStakingRewards] = await Promise.all([(0, _staking.getPoolingStakingRewardData)(pooledAddresses, targetChainMap, this.state.getSubstrateApiMap()), (0, _paraChain.getAmplitudeUnclaimedStakingReward)(this.state.getSubstrateApiMap(), addresses, chainInfoMap, activeNetworks)]);
|
|
240
238
|
const result = [...poolingStakingRewards, ...amplitudeUnclaimedStakingRewards];
|
|
241
239
|
this.state.updateStakingReward(result, 'fastInterval');
|
|
242
|
-
this.logger.log('Set staking reward state with fast interval done', result);
|
|
243
240
|
}
|
|
244
241
|
async fetchChainStakingMetadata(chainInfoMap, chainStateMap, substrateApiMap) {
|
|
245
|
-
|
|
242
|
+
const filteredChainInfoMap = {};
|
|
243
|
+
Object.values(chainInfoMap).forEach(chainInfo => {
|
|
246
244
|
const chainState = chainStateMap[chainInfo.slug];
|
|
247
245
|
if (chainState !== null && chainState !== void 0 && chainState.active && (0, _utils._isChainSupportSubstrateStaking)(chainInfo)) {
|
|
248
|
-
|
|
249
|
-
this.state.updateChainStakingMetadata(chainStakingMetadata);
|
|
246
|
+
filteredChainInfoMap[chainInfo.slug] = chainInfo;
|
|
250
247
|
}
|
|
248
|
+
});
|
|
249
|
+
if (Object.values(filteredChainInfoMap).length === 0) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
await Promise.all(Object.values(filteredChainInfoMap).map(async chainInfo => {
|
|
253
|
+
const chainStakingMetadata = await (0, _bonding.getChainStakingMetadata)(chainInfo, substrateApiMap[chainInfo.slug]);
|
|
254
|
+
this.state.updateChainStakingMetadata(chainStakingMetadata);
|
|
251
255
|
}));
|
|
252
256
|
}
|
|
253
257
|
async fetchNominatorMetadata(currentAddress, chainInfoMap, chainStateMap, substrateApiMap) {
|
|
@@ -262,8 +266,7 @@ class KoniSubscription {
|
|
|
262
266
|
if (currentAddress === _constants.ALL_ACCOUNT_KEY) {
|
|
263
267
|
addresses = await this.state.getStakingOwnersByChains(Object.keys(filteredChainInfoMap));
|
|
264
268
|
}
|
|
265
|
-
|
|
266
|
-
await Promise.all(validAddresses.map(async address => {
|
|
269
|
+
await Promise.all(addresses.map(async address => {
|
|
267
270
|
const isEvmAddress = (0, _utilCrypto.isEthereumAddress)(address);
|
|
268
271
|
await Promise.all(Object.values(filteredChainInfoMap).map(async chainInfo => {
|
|
269
272
|
if (isEvmAddress && !(0, _utils._isChainEvmCompatible)(chainInfo)) {
|
|
@@ -7,6 +7,7 @@ exports.SubstrateChainHandler = exports.DEFAULT_AUX = void 0;
|
|
|
7
7
|
var _api = require("@acala-network/api");
|
|
8
8
|
var _types = require("@oak-foundation/types");
|
|
9
9
|
var _types2 = require("@subwallet/chain-list/types");
|
|
10
|
+
var _utils = require("@subwallet/extension-base/koni/api/tokens/wasm/utils");
|
|
10
11
|
var _lightClient = require("@subwallet/extension-base/services/chain-service/handler/light-client");
|
|
11
12
|
var _api2 = require("@polkadot/api");
|
|
12
13
|
var _apiContract = require("@polkadot/api-contract");
|
|
@@ -94,13 +95,13 @@ class SubstrateChainHandler {
|
|
|
94
95
|
if (tokenType === _types2._AssetType.PSP22) {
|
|
95
96
|
tokenContract = new _apiContract.ContractPromise(substrateApi.api, _helper._PSP22_ABI, contractAddress);
|
|
96
97
|
const [nameResp, symbolResp, decimalsResp] = await Promise.all([tokenContract.query['psp22Metadata::tokenName'](contractCaller || contractAddress, {
|
|
97
|
-
gasLimit:
|
|
98
|
+
gasLimit: (0, _utils.getDefaultWeightV2)(substrateApi.api)
|
|
98
99
|
}),
|
|
99
100
|
// read-only operation so no gas limit
|
|
100
101
|
tokenContract.query['psp22Metadata::tokenSymbol'](contractCaller || contractAddress, {
|
|
101
|
-
gasLimit:
|
|
102
|
+
gasLimit: (0, _utils.getDefaultWeightV2)(substrateApi.api)
|
|
102
103
|
}), tokenContract.query['psp22Metadata::tokenDecimals'](contractCaller || contractAddress, {
|
|
103
|
-
gasLimit:
|
|
104
|
+
gasLimit: (0, _utils.getDefaultWeightV2)(substrateApi.api)
|
|
104
105
|
})]);
|
|
105
106
|
if (!(nameResp.result.isOk && symbolResp.result.isOk && decimalsResp.result.isOk) || !nameResp.output || !decimalsResp.output || !symbolResp.output) {
|
|
106
107
|
this.logger.error('Error response while validating WASM contract');
|
|
@@ -111,18 +112,22 @@ class SubstrateChainHandler {
|
|
|
111
112
|
contractError: true
|
|
112
113
|
};
|
|
113
114
|
} else {
|
|
114
|
-
var _symbolResp$output, _decimalsResp$output,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
var _symbolResp$output, _decimalsResp$output, _nameResp$output;
|
|
116
|
+
const symbolObj = (_symbolResp$output = symbolResp.output) === null || _symbolResp$output === void 0 ? void 0 : _symbolResp$output.toHuman();
|
|
117
|
+
const decimalsObj = (_decimalsResp$output = decimalsResp.output) === null || _decimalsResp$output === void 0 ? void 0 : _decimalsResp$output.toHuman();
|
|
118
|
+
const nameObj = (_nameResp$output = nameResp.output) === null || _nameResp$output === void 0 ? void 0 : _nameResp$output.toHuman();
|
|
119
|
+
name = nameResp.output ? nameObj.Ok || nameObj.ok : '';
|
|
120
|
+
decimals = decimalsResp.output ? new _util.BN(decimalsObj.Ok || decimalsObj.ok).toNumber() : 0;
|
|
121
|
+
symbol = decimalsResp.output ? symbolObj.Ok || symbolObj.ok : '';
|
|
118
122
|
if (name === '' || symbol === '') {
|
|
119
123
|
contractError = true;
|
|
120
124
|
}
|
|
125
|
+
console.log('validate PSP22', name, symbol, decimals);
|
|
121
126
|
}
|
|
122
127
|
} else {
|
|
123
128
|
tokenContract = new _apiContract.ContractPromise(substrateApi.api, _helper._PSP34_ABI, contractAddress);
|
|
124
129
|
const collectionIdResp = await tokenContract.query['psp34::collectionId'](contractCaller || contractAddress, {
|
|
125
|
-
gasLimit:
|
|
130
|
+
gasLimit: (0, _utils.getDefaultWeightV2)(substrateApi.api)
|
|
126
131
|
}); // read-only operation so no gas limit
|
|
127
132
|
|
|
128
133
|
if (!collectionIdResp.result.isOk || !collectionIdResp.output) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.ProviderPlaceholder = void 0;
|
|
6
7
|
exports.getSubstrateConnectProvider = getSubstrateConnectProvider;
|
|
7
8
|
exports.relayChainSpecs = exports.paraChainSpecs = void 0;
|
|
8
9
|
var _rpcProvider = require("@polkadot/rpc-provider");
|
|
@@ -103,6 +104,7 @@ class ProviderPlaceholder {
|
|
|
103
104
|
});
|
|
104
105
|
}
|
|
105
106
|
}
|
|
107
|
+
exports.ProviderPlaceholder = ProviderPlaceholder;
|
|
106
108
|
function getSubstrateConnectProvider(specLink) {
|
|
107
109
|
const [relayName, paraName] = specLink.split('/');
|
|
108
110
|
const relaySpec = relayChainSpecs[relayName];
|