@subwallet/extension-base 1.3.71-0 → 1.3.73-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/background/KoniTypes.d.ts +13 -2
- package/background/KoniTypes.js +3 -1
- package/cjs/background/KoniTypes.js +3 -1
- package/cjs/core/logic-validation/recipientAddress.js +1 -1
- package/cjs/core/logic-validation/transfer.js +33 -10
- package/cjs/core/types.js +1 -0
- package/cjs/koni/background/handlers/Extension.js +81 -10
- package/cjs/koni/background/handlers/State.js +2 -4
- package/cjs/koni/background/subscription.js +2 -22
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +46 -2
- package/cjs/services/balance-service/transfer/token.js +13 -35
- package/cjs/services/balance-service/transfer/xcm/index.js +3 -8
- package/cjs/services/balance-service/transfer/xcm/utils.js +1 -1
- package/cjs/services/chain-service/constants.js +6 -5
- package/cjs/services/chain-service/index.js +1 -0
- package/cjs/services/chain-service/utils/patch.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +17 -2
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +55 -0
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +41 -0
- package/cjs/services/migration-service/scripts/index.js +17 -13
- package/cjs/services/substrate-proxy-service/constant.js +26 -0
- package/cjs/services/substrate-proxy-service/index.js +170 -0
- package/cjs/services/transaction-service/index.js +78 -10
- package/cjs/services/transaction-service/utils.js +8 -5
- package/cjs/types/index.js +11 -0
- package/cjs/types/substrateProxyAccount/actions/index.js +1 -0
- package/cjs/types/substrateProxyAccount/index.js +16 -0
- package/cjs/utils/account/transform.js +5 -4
- package/cjs/utils/fee/transfer.js +4 -2
- package/core/logic-validation/recipientAddress.js +1 -1
- package/core/logic-validation/transfer.d.ts +3 -3
- package/core/logic-validation/transfer.js +34 -11
- package/core/types.d.ts +2 -1
- package/core/types.js +1 -0
- package/koni/background/handlers/Extension.d.ts +3 -0
- package/koni/background/handlers/Extension.js +81 -10
- package/koni/background/handlers/State.d.ts +2 -1
- package/koni/background/handlers/State.js +2 -4
- package/koni/background/subscription.js +2 -22
- package/package.json +37 -7
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/subscribe/substrate/index.js +47 -3
- package/services/balance-service/transfer/token.d.ts +0 -4
- package/services/balance-service/transfer/token.js +12 -33
- package/services/balance-service/transfer/xcm/index.js +3 -8
- package/services/balance-service/transfer/xcm/utils.d.ts +0 -2
- package/services/balance-service/transfer/xcm/utils.js +1 -1
- package/services/chain-service/constants.d.ts +1 -1
- package/services/chain-service/constants.js +4 -4
- package/services/chain-service/index.js +1 -0
- package/services/chain-service/utils/patch.d.ts +1 -1
- package/services/chain-service/utils/patch.js +1 -1
- package/services/earning-service/handlers/native-staking/para-chain.js +17 -2
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +46 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +33 -0
- package/services/migration-service/scripts/index.js +8 -4
- package/services/open-gov/interface.d.ts +4 -3
- package/services/substrate-proxy-service/constant.d.ts +3 -0
- package/services/substrate-proxy-service/constant.js +19 -0
- package/services/substrate-proxy-service/index.d.ts +13 -0
- package/services/substrate-proxy-service/index.js +159 -0
- package/services/transaction-service/index.js +79 -11
- package/services/transaction-service/types.d.ts +2 -2
- package/services/transaction-service/utils.js +8 -5
- package/types/balance/transfer.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/substrateProxyAccount/actions/index.d.ts +17 -0
- package/types/substrateProxyAccount/actions/index.js +1 -0
- package/types/substrateProxyAccount/index.d.ts +23 -0
- package/types/substrateProxyAccount/index.js +8 -0
- package/types/transaction/request.d.ts +1 -0
- package/types/yield/actions/join/submit.d.ts +1 -1
- package/types/yield/info/pallet.d.ts +1 -1
- package/utils/account/transform.js +5 -4
- package/utils/fee/transfer.js +4 -2
|
@@ -35,6 +35,7 @@ import { SignerResult } from '@polkadot/types/types/extrinsic';
|
|
|
35
35
|
import { HexString } from '@polkadot/util/types';
|
|
36
36
|
import { EarningImpactResult } from '../services/earning-service/handlers/native-staking/dtao';
|
|
37
37
|
import { GovVoteRequest, GovVotingInfo, RemoveVoteRequest, UnlockVoteRequest } from '../services/open-gov/interface';
|
|
38
|
+
import { RequestAddSubstrateProxyAccount, RequestGetSubstrateProxyAccountGroup, RequestRemoveSubstrateProxyAccount, SubstrateProxyAccountGroup } from '../types/substrateProxyAccount';
|
|
38
39
|
import { TransactionWarning } from './warnings/TransactionWarning';
|
|
39
40
|
export declare enum RuntimeEnvironment {
|
|
40
41
|
Web = "Web",
|
|
@@ -450,8 +451,10 @@ export declare enum ExtrinsicType {
|
|
|
450
451
|
CLAIM_BRIDGE = "claim.claim_bridge",
|
|
451
452
|
GOV_VOTE = "gov.vote",
|
|
452
453
|
GOV_UNVOTE = "gov.unvote",
|
|
453
|
-
GOV_UNLOCK_VOTE = "gov.
|
|
454
|
+
GOV_UNLOCK_VOTE = "gov.unlock_vote",
|
|
454
455
|
EVM_EXECUTE = "evm.execute",
|
|
456
|
+
ADD_SUBSTRATE_PROXY_ACCOUNT = "substrateProxyAccount.add",
|
|
457
|
+
REMOVE_SUBSTRATE_PROXY_ACCOUNT = "substrateProxyAccount.remove",
|
|
455
458
|
UNKNOWN = "unknown"
|
|
456
459
|
}
|
|
457
460
|
export interface ExtrinsicDataTypeMap {
|
|
@@ -494,9 +497,12 @@ export interface ExtrinsicDataTypeMap {
|
|
|
494
497
|
[ExtrinsicType.CLAIM_BRIDGE]: RequestClaimBridge;
|
|
495
498
|
[ExtrinsicType.EVM_EXECUTE]: TransactionConfig;
|
|
496
499
|
[ExtrinsicType.CROWDLOAN]: any;
|
|
500
|
+
[ExtrinsicType.SWAP]: SwapTxData;
|
|
497
501
|
[ExtrinsicType.GOV_VOTE]: GovVoteRequest;
|
|
498
502
|
[ExtrinsicType.GOV_UNVOTE]: RemoveVoteRequest;
|
|
499
503
|
[ExtrinsicType.GOV_UNLOCK_VOTE]: UnlockVoteRequest;
|
|
504
|
+
[ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT]: RequestAddSubstrateProxyAccount;
|
|
505
|
+
[ExtrinsicType.REMOVE_SUBSTRATE_PROXY_ACCOUNT]: RequestRemoveSubstrateProxyAccount;
|
|
500
506
|
[ExtrinsicType.SWAP]: SwapTxData;
|
|
501
507
|
[ExtrinsicType.UNKNOWN]: any;
|
|
502
508
|
}
|
|
@@ -607,6 +613,7 @@ export interface TransactionHistoryItem<ET extends ExtrinsicType = ExtrinsicType
|
|
|
607
613
|
addressPrefix?: number;
|
|
608
614
|
processId?: string;
|
|
609
615
|
apiTxIndex?: number;
|
|
616
|
+
substrateProxyAddresses?: string[];
|
|
610
617
|
}
|
|
611
618
|
export interface SWWarning {
|
|
612
619
|
errorType: string;
|
|
@@ -766,7 +773,7 @@ export declare type TxResultType = {
|
|
|
766
773
|
fee?: string;
|
|
767
774
|
feeSymbol?: string;
|
|
768
775
|
};
|
|
769
|
-
export interface NftTransactionRequest {
|
|
776
|
+
export interface NftTransactionRequest extends BaseRequestSign {
|
|
770
777
|
networkKey: string;
|
|
771
778
|
senderAddress: string;
|
|
772
779
|
recipientAddress: string;
|
|
@@ -834,6 +841,7 @@ export interface SubstrateNftSubmitTransaction extends BaseRequestSign {
|
|
|
834
841
|
senderAddress: string;
|
|
835
842
|
nftItemName?: string;
|
|
836
843
|
recipientAddress: string;
|
|
844
|
+
nftItem: NftItem;
|
|
837
845
|
}
|
|
838
846
|
export declare type RequestSubstrateNftSubmitTransaction = InternalRequestSign<SubstrateNftSubmitTransaction>;
|
|
839
847
|
export interface RequestAccountMeta {
|
|
@@ -2095,6 +2103,9 @@ export interface KoniRequestSignatures {
|
|
|
2095
2103
|
'pri(openGov.unvote)': [RemoveVoteRequest, SWTransactionResponse];
|
|
2096
2104
|
'pri(openGov.subscribeGovLockedInfo)': [null, GovVotingInfo[], GovVotingInfo[]];
|
|
2097
2105
|
'pri(openGov.unlockVote)': [UnlockVoteRequest, SWTransactionResponse];
|
|
2106
|
+
'pri(substrateProxyAccount.getGroupInfo)': [RequestGetSubstrateProxyAccountGroup, SubstrateProxyAccountGroup];
|
|
2107
|
+
'pri(substrateProxyAccount.add)': [RequestAddSubstrateProxyAccount, SWTransactionResponse];
|
|
2108
|
+
'pri(substrateProxyAccount.remove)': [RequestRemoveSubstrateProxyAccount, SWTransactionResponse];
|
|
2098
2109
|
}
|
|
2099
2110
|
export interface ApplicationMetadataType {
|
|
2100
2111
|
version: string;
|
package/background/KoniTypes.js
CHANGED
|
@@ -117,8 +117,10 @@ export let ExtrinsicType;
|
|
|
117
117
|
ExtrinsicType["CLAIM_BRIDGE"] = "claim.claim_bridge";
|
|
118
118
|
ExtrinsicType["GOV_VOTE"] = "gov.vote";
|
|
119
119
|
ExtrinsicType["GOV_UNVOTE"] = "gov.unvote";
|
|
120
|
-
ExtrinsicType["GOV_UNLOCK_VOTE"] = "gov.
|
|
120
|
+
ExtrinsicType["GOV_UNLOCK_VOTE"] = "gov.unlock_vote";
|
|
121
121
|
ExtrinsicType["EVM_EXECUTE"] = "evm.execute";
|
|
122
|
+
ExtrinsicType["ADD_SUBSTRATE_PROXY_ACCOUNT"] = "substrateProxyAccount.add";
|
|
123
|
+
ExtrinsicType["REMOVE_SUBSTRATE_PROXY_ACCOUNT"] = "substrateProxyAccount.remove";
|
|
122
124
|
ExtrinsicType["UNKNOWN"] = "unknown";
|
|
123
125
|
})(ExtrinsicType || (ExtrinsicType = {}));
|
|
124
126
|
export let ExtrinsicStatus;
|
|
@@ -132,8 +132,10 @@ exports.ExtrinsicType = ExtrinsicType;
|
|
|
132
132
|
ExtrinsicType["CLAIM_BRIDGE"] = "claim.claim_bridge";
|
|
133
133
|
ExtrinsicType["GOV_VOTE"] = "gov.vote";
|
|
134
134
|
ExtrinsicType["GOV_UNVOTE"] = "gov.unvote";
|
|
135
|
-
ExtrinsicType["GOV_UNLOCK_VOTE"] = "gov.
|
|
135
|
+
ExtrinsicType["GOV_UNLOCK_VOTE"] = "gov.unlock_vote";
|
|
136
136
|
ExtrinsicType["EVM_EXECUTE"] = "evm.execute";
|
|
137
|
+
ExtrinsicType["ADD_SUBSTRATE_PROXY_ACCOUNT"] = "substrateProxyAccount.add";
|
|
138
|
+
ExtrinsicType["REMOVE_SUBSTRATE_PROXY_ACCOUNT"] = "substrateProxyAccount.remove";
|
|
137
139
|
ExtrinsicType["UNKNOWN"] = "unknown";
|
|
138
140
|
})(ExtrinsicType || (exports.ExtrinsicType = ExtrinsicType = {}));
|
|
139
141
|
let ExtrinsicStatus;
|
|
@@ -23,7 +23,7 @@ function getConditions(validateRecipientParams) {
|
|
|
23
23
|
toAddress
|
|
24
24
|
} = validateRecipientParams;
|
|
25
25
|
const conditions = [];
|
|
26
|
-
const isSendAction = [_types.ActionType.SEND_FUND, _types.ActionType.SEND_NFT].includes(actionType);
|
|
26
|
+
const isSendAction = [_types.ActionType.SEND_FUND, _types.ActionType.SEND_NFT, _types.ActionType.MANAGE_SUBSTRATE_PROXY_ACCOUNT].includes(actionType);
|
|
27
27
|
conditions.push(_types.ValidationCondition.IS_NOT_NULL);
|
|
28
28
|
conditions.push(_types.ValidationCondition.IS_ADDRESS);
|
|
29
29
|
conditions.push(_types.ValidationCondition.IS_VALID_ADDRESS_FOR_ECOSYSTEM);
|
|
@@ -326,7 +326,7 @@ function checkSupportForTransaction(validationResponse, transaction) {
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
async function estimateFeeForTransaction(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, isTransferLocalTokenAndPayThatTokenAsFee) {
|
|
329
|
+
async function estimateFeeForTransaction(validationResponse, transaction, chainInfo, evmApi, substrateApi, priceMap, feeInfo, nativeTokenInfo, nonNativeTokenPayFeeInfo, isTransferLocalTokenAndPayThatTokenAsFee, signerSubstrateProxyAddress) {
|
|
330
330
|
const estimateFee = {
|
|
331
331
|
symbol: '',
|
|
332
332
|
decimals: 0,
|
|
@@ -347,8 +347,14 @@ async function estimateFeeForTransaction(validationResponse, transaction, chainI
|
|
|
347
347
|
if (transaction) {
|
|
348
348
|
try {
|
|
349
349
|
if ((0, _helpers.isSubstrateTransaction)(transaction)) {
|
|
350
|
-
|
|
351
|
-
|
|
350
|
+
if (signerSubstrateProxyAddress && !(0, _utils5.isSameAddress)(signerSubstrateProxyAddress, address)) {
|
|
351
|
+
await substrateApi.isReady;
|
|
352
|
+
const estimateExtrinsic = substrateApi.api.tx.proxy.proxy(address, null, transaction);
|
|
353
|
+
estimateFee.value = (await estimateExtrinsic.paymentInfo(signerSubstrateProxyAddress)).partialFee.toString();
|
|
354
|
+
} else {
|
|
355
|
+
var _validationResponse$x;
|
|
356
|
+
estimateFee.value = (_validationResponse$x = validationResponse.xcmFeeDryRun) !== null && _validationResponse$x !== void 0 ? _validationResponse$x : (await transaction.paymentInfo(validationResponse.address)).partialFee.toString();
|
|
357
|
+
}
|
|
352
358
|
} else if ((0, _helpers.isTonTransaction)(transaction)) {
|
|
353
359
|
estimateFee.value = transaction.estimateFee; // todo: might need to update logic estimate fee inside for future actions excluding normal transfer Ton and Jetton
|
|
354
360
|
} else if ((0, _helpers.isCardanoTransaction)(transaction)) {
|
|
@@ -415,14 +421,13 @@ async function estimateFeeForTransaction(validationResponse, transaction, chainI
|
|
|
415
421
|
}
|
|
416
422
|
return estimateFee;
|
|
417
423
|
}
|
|
418
|
-
function checkSigningAccountForTransaction(validationResponse, chainInfoMap) {
|
|
424
|
+
function checkSigningAccountForTransaction(validationResponse, chainInfoMap, signer) {
|
|
419
425
|
const {
|
|
420
|
-
address,
|
|
421
426
|
chain,
|
|
422
427
|
chainType,
|
|
423
428
|
extrinsicType
|
|
424
429
|
} = validationResponse;
|
|
425
|
-
const pair = _uiKeyring.keyring.getPair(
|
|
430
|
+
const pair = _uiKeyring.keyring.getPair(signer);
|
|
426
431
|
if (!pair) {
|
|
427
432
|
validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.INTERNAL_ERROR, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.unableToFindAccount')));
|
|
428
433
|
} else {
|
|
@@ -442,7 +447,7 @@ function checkSigningAccountForTransaction(validationResponse, chainInfoMap) {
|
|
|
442
447
|
}
|
|
443
448
|
}
|
|
444
449
|
}
|
|
445
|
-
function checkBalanceWithTransactionFee(validationResponse, transactionInput, nativeTokenInfo, nativeTokenAvailable) {
|
|
450
|
+
function checkBalanceWithTransactionFee(validationResponse, transactionInput, nativeTokenInfo, nativeTokenAvailable, substrateProxyAccountNativeTokenAvailable) {
|
|
446
451
|
if (!validationResponse.estimateFee) {
|
|
447
452
|
// todo: estimateFee should be must-have, need to refactor interface
|
|
448
453
|
return;
|
|
@@ -451,6 +456,7 @@ function checkBalanceWithTransactionFee(validationResponse, transactionInput, na
|
|
|
451
456
|
edAsWarning,
|
|
452
457
|
extrinsicType,
|
|
453
458
|
isTransferAll,
|
|
459
|
+
signerSubstrateProxyAddress,
|
|
454
460
|
skipFeeValidation,
|
|
455
461
|
tokenPayFeeSlug
|
|
456
462
|
} = transactionInput;
|
|
@@ -461,12 +467,29 @@ function checkBalanceWithTransactionFee(validationResponse, transactionInput, na
|
|
|
461
467
|
const bnFee = new _bignumber.default(validationResponse.estimateFee.value);
|
|
462
468
|
const bnNativeTokenAvailable = new _bignumber.default(nativeTokenAvailable.value);
|
|
463
469
|
const bnNativeTokenTransferAmount = new _bignumber.default(validationResponse.transferNativeAmount || '0');
|
|
464
|
-
if (!bnNativeTokenAvailable.gt(0)) {
|
|
470
|
+
if (!bnNativeTokenAvailable.gt(0) && !substrateProxyAccountNativeTokenAvailable) {
|
|
465
471
|
validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
466
472
|
}
|
|
467
473
|
const isChainNotSupportTransferAll = [..._constants2._TRANSFER_CHAIN_GROUP.acala, ..._constants2._TRANSFER_CHAIN_GROUP.genshiro, ..._constants2._TRANSFER_CHAIN_GROUP.bitcountry, ..._constants2._TRANSFER_CHAIN_GROUP.statemine].includes(nativeTokenInfo.originChain);
|
|
468
|
-
if (
|
|
469
|
-
|
|
474
|
+
if (!substrateProxyAccountNativeTokenAvailable) {
|
|
475
|
+
if (bnNativeTokenTransferAmount.plus(bnFee).gt(bnNativeTokenAvailable) && (!isTransferAll || isChainNotSupportTransferAll)) {
|
|
476
|
+
validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE)); // todo: should be generalized and reused in all features
|
|
477
|
+
}
|
|
478
|
+
} else {
|
|
479
|
+
const bnSubstrateProxyAccountNativeTokenAvailable = new _bignumber.default(substrateProxyAccountNativeTokenAvailable.value);
|
|
480
|
+
if (bnNativeTokenTransferAmount.gt(bnNativeTokenAvailable) && (!isTransferAll || isChainNotSupportTransferAll) || bnFee.gt(bnSubstrateProxyAccountNativeTokenAvailable)) {
|
|
481
|
+
if (signerSubstrateProxyAddress) {
|
|
482
|
+
const account = (0, _utils5.getAccountJsonByAddress)(signerSubstrateProxyAddress);
|
|
483
|
+
const accountName = account === null || account === void 0 ? void 0 : account.name;
|
|
484
|
+
validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE, (0, _i18next.t)('bg.TRANSACTION.core.validation.transfer.proxyAccountNotEnoughBalance', {
|
|
485
|
+
replace: {
|
|
486
|
+
accountName: accountName || signerSubstrateProxyAddress
|
|
487
|
+
}
|
|
488
|
+
})));
|
|
489
|
+
} else {
|
|
490
|
+
validationResponse.errors.push(new _TransactionError.TransactionError(_types.BasicTxErrorType.NOT_ENOUGH_BALANCE));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
470
493
|
}
|
|
471
494
|
|
|
472
495
|
// todo: only system.pallet has metadata, we should add for other pallets and mechanisms as well
|
package/cjs/core/types.js
CHANGED
|
@@ -25,4 +25,5 @@ exports.ActionType = ActionType;
|
|
|
25
25
|
ActionType["SEND_FUND"] = "SEND_FUND";
|
|
26
26
|
ActionType["SEND_NFT"] = "SEND_NFT";
|
|
27
27
|
ActionType["SWAP"] = "SWAP";
|
|
28
|
+
ActionType["MANAGE_SUBSTRATE_PROXY_ACCOUNT"] = "MANAGE_SUBSTRATE_PROXY_ACCOUNT";
|
|
28
29
|
})(ActionType || (exports.ActionType = ActionType = {}));
|
|
@@ -1304,6 +1304,7 @@ class KoniExtension {
|
|
|
1304
1304
|
feeCustom,
|
|
1305
1305
|
feeOption,
|
|
1306
1306
|
from,
|
|
1307
|
+
signerSubstrateProxyAddress,
|
|
1307
1308
|
to,
|
|
1308
1309
|
tokenPayFeeSlug,
|
|
1309
1310
|
tokenSlug,
|
|
@@ -1537,6 +1538,7 @@ class KoniExtension {
|
|
|
1537
1538
|
isTransferAll: isTransferNativeToken ? transferAll : false,
|
|
1538
1539
|
isTransferLocalTokenAndPayThatTokenAsFee,
|
|
1539
1540
|
edAsWarning: isTransferNativeToken,
|
|
1541
|
+
signerSubstrateProxyAddress,
|
|
1540
1542
|
additionalValidator: additionalValidator
|
|
1541
1543
|
});
|
|
1542
1544
|
}
|
|
@@ -1548,6 +1550,7 @@ class KoniExtension {
|
|
|
1548
1550
|
from,
|
|
1549
1551
|
isPassConfirmation,
|
|
1550
1552
|
originNetworkKey,
|
|
1553
|
+
signerSubstrateProxyAddress,
|
|
1551
1554
|
to,
|
|
1552
1555
|
tokenPayFeeSlug,
|
|
1553
1556
|
tokenSlug,
|
|
@@ -1743,7 +1746,8 @@ class KoniExtension {
|
|
|
1743
1746
|
xcmFeeDryRun,
|
|
1744
1747
|
errors,
|
|
1745
1748
|
additionalValidator: additionalValidator,
|
|
1746
|
-
eventsHandler: eventsHandler
|
|
1749
|
+
eventsHandler: eventsHandler,
|
|
1750
|
+
signerSubstrateProxyAddress
|
|
1747
1751
|
});
|
|
1748
1752
|
}
|
|
1749
1753
|
async makeBitcoinDappTransferConfirmation(inputData) {
|
|
@@ -2393,7 +2397,8 @@ class KoniExtension {
|
|
|
2393
2397
|
feeOptions: feeOptions,
|
|
2394
2398
|
feeType,
|
|
2395
2399
|
error,
|
|
2396
|
-
id
|
|
2400
|
+
id,
|
|
2401
|
+
maxTransferableWithoutFee: freeBalance.value
|
|
2397
2402
|
};
|
|
2398
2403
|
};
|
|
2399
2404
|
const subscription = (0, _rxjs.combineLatest)({
|
|
@@ -2480,7 +2485,8 @@ class KoniExtension {
|
|
|
2480
2485
|
const {
|
|
2481
2486
|
params,
|
|
2482
2487
|
recipientAddress,
|
|
2483
|
-
senderAddress
|
|
2488
|
+
senderAddress,
|
|
2489
|
+
signerSubstrateProxyAddress
|
|
2484
2490
|
} = inputData;
|
|
2485
2491
|
const isSendingSelf = (0, _transfer2.isRecipientSelf)(senderAddress, recipientAddress);
|
|
2486
2492
|
|
|
@@ -2501,7 +2507,8 @@ class KoniExtension {
|
|
|
2501
2507
|
isSendingSelf
|
|
2502
2508
|
},
|
|
2503
2509
|
extrinsicType: _KoniTypes.ExtrinsicType.SEND_NFT,
|
|
2504
|
-
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
2510
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
2511
|
+
signerSubstrateProxyAddress
|
|
2505
2512
|
});
|
|
2506
2513
|
return {
|
|
2507
2514
|
...rs,
|
|
@@ -3390,8 +3397,6 @@ class KoniExtension {
|
|
|
3390
3397
|
return await this.#koniState.reloadStaking();
|
|
3391
3398
|
} else if (data === 'balance') {
|
|
3392
3399
|
return await this.#koniState.reloadBalance();
|
|
3393
|
-
} else if (data === 'crowdloan') {
|
|
3394
|
-
return await this.#koniState.reloadCrowdloan();
|
|
3395
3400
|
}
|
|
3396
3401
|
return Promise.resolve(false);
|
|
3397
3402
|
}
|
|
@@ -3834,7 +3839,8 @@ class KoniExtension {
|
|
|
3834
3839
|
isPassConfirmation,
|
|
3835
3840
|
onSend,
|
|
3836
3841
|
path,
|
|
3837
|
-
processId
|
|
3842
|
+
processId,
|
|
3843
|
+
signerSubstrateProxyAddress
|
|
3838
3844
|
} = inputData;
|
|
3839
3845
|
const {
|
|
3840
3846
|
address
|
|
@@ -3965,6 +3971,7 @@ class KoniExtension {
|
|
|
3965
3971
|
// change this depends on step
|
|
3966
3972
|
chainType,
|
|
3967
3973
|
resolveOnDone: !isLastStep,
|
|
3974
|
+
signerSubstrateProxyAddress,
|
|
3968
3975
|
transferNativeAmount,
|
|
3969
3976
|
balanceType: balanceTypeForPool,
|
|
3970
3977
|
skipFeeValidation: isMintingStep && isPoolSupportAlternativeFee,
|
|
@@ -3977,6 +3984,7 @@ class KoniExtension {
|
|
|
3977
3984
|
async handleYieldLeave(params) {
|
|
3978
3985
|
const {
|
|
3979
3986
|
address,
|
|
3987
|
+
signerSubstrateProxyAddress,
|
|
3980
3988
|
slug
|
|
3981
3989
|
} = params;
|
|
3982
3990
|
const leaveValidation = await this.#koniState.earningService.validateYieldLeave(params);
|
|
@@ -3992,6 +4000,7 @@ class KoniExtension {
|
|
|
3992
4000
|
data: params,
|
|
3993
4001
|
// TODO
|
|
3994
4002
|
extrinsicType,
|
|
4003
|
+
signerSubstrateProxyAddress,
|
|
3995
4004
|
chainType: (handler === null || handler === void 0 ? void 0 : handler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
3996
4005
|
});
|
|
3997
4006
|
}
|
|
@@ -4068,6 +4077,7 @@ class KoniExtension {
|
|
|
4068
4077
|
async yieldSubmitWithdrawal(params) {
|
|
4069
4078
|
const {
|
|
4070
4079
|
address,
|
|
4080
|
+
signerSubstrateProxyAddress,
|
|
4071
4081
|
slug
|
|
4072
4082
|
} = params;
|
|
4073
4083
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4081,6 +4091,7 @@ class KoniExtension {
|
|
|
4081
4091
|
transaction: extrinsic,
|
|
4082
4092
|
data: params,
|
|
4083
4093
|
extrinsicType: _KoniTypes.ExtrinsicType.STAKING_WITHDRAW,
|
|
4094
|
+
signerSubstrateProxyAddress,
|
|
4084
4095
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
4085
4096
|
});
|
|
4086
4097
|
}
|
|
@@ -4088,6 +4099,7 @@ class KoniExtension {
|
|
|
4088
4099
|
const {
|
|
4089
4100
|
address,
|
|
4090
4101
|
selectedUnstaking,
|
|
4102
|
+
signerSubstrateProxyAddress,
|
|
4091
4103
|
slug
|
|
4092
4104
|
} = params;
|
|
4093
4105
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4102,12 +4114,14 @@ class KoniExtension {
|
|
|
4102
4114
|
transaction: extrinsic,
|
|
4103
4115
|
data: params,
|
|
4104
4116
|
extrinsicType: _KoniTypes.ExtrinsicType.STAKING_CANCEL_UNSTAKE,
|
|
4117
|
+
signerSubstrateProxyAddress,
|
|
4105
4118
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
4106
4119
|
});
|
|
4107
4120
|
}
|
|
4108
4121
|
async yieldSubmitClaimReward(params) {
|
|
4109
4122
|
const {
|
|
4110
4123
|
address,
|
|
4124
|
+
signerSubstrateProxyAddress,
|
|
4111
4125
|
slug
|
|
4112
4126
|
} = params;
|
|
4113
4127
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4120,6 +4134,7 @@ class KoniExtension {
|
|
|
4120
4134
|
chain: poolHandler.chain,
|
|
4121
4135
|
transaction: extrinsic,
|
|
4122
4136
|
data: params,
|
|
4137
|
+
signerSubstrateProxyAddress,
|
|
4123
4138
|
extrinsicType: _KoniTypes.ExtrinsicType.STAKING_CLAIM_REWARD,
|
|
4124
4139
|
chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || _KoniTypes.ChainType.SUBSTRATE
|
|
4125
4140
|
});
|
|
@@ -4138,6 +4153,7 @@ class KoniExtension {
|
|
|
4138
4153
|
async handleYieldChangeValidator(params) {
|
|
4139
4154
|
const {
|
|
4140
4155
|
address,
|
|
4156
|
+
signerSubstrateProxyAddress,
|
|
4141
4157
|
slug
|
|
4142
4158
|
} = params;
|
|
4143
4159
|
const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
|
|
@@ -4150,6 +4166,7 @@ class KoniExtension {
|
|
|
4150
4166
|
chain: poolHandler.chain,
|
|
4151
4167
|
transaction: extrinsic,
|
|
4152
4168
|
data: params,
|
|
4169
|
+
signerSubstrateProxyAddress,
|
|
4153
4170
|
extrinsicType: _KoniTypes.ExtrinsicType.CHANGE_EARNING_VALIDATOR,
|
|
4154
4171
|
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4155
4172
|
});
|
|
@@ -4836,6 +4853,48 @@ class KoniExtension {
|
|
|
4836
4853
|
pingSession(request) {
|
|
4837
4854
|
return this.#koniState.keyringService.context.pingSession(request);
|
|
4838
4855
|
}
|
|
4856
|
+
getSubstrateProxyAccountGroup(request) {
|
|
4857
|
+
return this.#koniState.substrateProxyAccountService.getSubstrateProxyAccountGroup(request);
|
|
4858
|
+
}
|
|
4859
|
+
async handleAddSubstrateProxyAccount(params) {
|
|
4860
|
+
const {
|
|
4861
|
+
address,
|
|
4862
|
+
chain,
|
|
4863
|
+
signerSubstrateProxyAddress
|
|
4864
|
+
} = params;
|
|
4865
|
+
const validationErrors = await this.#koniState.substrateProxyAccountService.validateAddSubstrateProxyAccount(params, signerSubstrateProxyAddress);
|
|
4866
|
+
if (validationErrors.length > 0) {
|
|
4867
|
+
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(validationErrors);
|
|
4868
|
+
}
|
|
4869
|
+
const extrinsic = await this.#koniState.substrateProxyAccountService.addSubstrateProxyAccounts(params);
|
|
4870
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4871
|
+
address,
|
|
4872
|
+
chain,
|
|
4873
|
+
transaction: extrinsic,
|
|
4874
|
+
data: params,
|
|
4875
|
+
extrinsicType: _KoniTypes.ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT,
|
|
4876
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4877
|
+
signerSubstrateProxyAddress
|
|
4878
|
+
});
|
|
4879
|
+
}
|
|
4880
|
+
async handleRemoveSubstrateProxyAccount(params) {
|
|
4881
|
+
const {
|
|
4882
|
+
address,
|
|
4883
|
+
chain,
|
|
4884
|
+
signerSubstrateProxyAddress
|
|
4885
|
+
} = params;
|
|
4886
|
+
const extrinsic = await this.#koniState.substrateProxyAccountService.removeSubstrateProxyAccounts(params);
|
|
4887
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
4888
|
+
address,
|
|
4889
|
+
chain,
|
|
4890
|
+
transaction: extrinsic,
|
|
4891
|
+
data: params,
|
|
4892
|
+
extrinsicType: _KoniTypes.ExtrinsicType.REMOVE_SUBSTRATE_PROXY_ACCOUNT,
|
|
4893
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4894
|
+
signerSubstrateProxyAddress
|
|
4895
|
+
});
|
|
4896
|
+
}
|
|
4897
|
+
|
|
4839
4898
|
/* Migrate Unified Account */
|
|
4840
4899
|
|
|
4841
4900
|
/* Open Gov */
|
|
@@ -4848,7 +4907,8 @@ class KoniExtension {
|
|
|
4848
4907
|
transaction: extrinsic,
|
|
4849
4908
|
data: request,
|
|
4850
4909
|
extrinsicType: _KoniTypes.ExtrinsicType.GOV_VOTE,
|
|
4851
|
-
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4910
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4911
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4852
4912
|
});
|
|
4853
4913
|
}
|
|
4854
4914
|
async handleRemoveVote(request) {
|
|
@@ -4859,7 +4919,8 @@ class KoniExtension {
|
|
|
4859
4919
|
transaction: extrinsic,
|
|
4860
4920
|
data: request,
|
|
4861
4921
|
extrinsicType: _KoniTypes.ExtrinsicType.GOV_UNVOTE,
|
|
4862
|
-
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4922
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4923
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4863
4924
|
});
|
|
4864
4925
|
}
|
|
4865
4926
|
async handleUnlockVote(request) {
|
|
@@ -4870,7 +4931,8 @@ class KoniExtension {
|
|
|
4870
4931
|
transaction: extrinsic,
|
|
4871
4932
|
data: request,
|
|
4872
4933
|
extrinsicType: _KoniTypes.ExtrinsicType.GOV_UNLOCK_VOTE,
|
|
4873
|
-
chainType: _KoniTypes.ChainType.SUBSTRATE
|
|
4934
|
+
chainType: _KoniTypes.ChainType.SUBSTRATE,
|
|
4935
|
+
signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
|
|
4874
4936
|
});
|
|
4875
4937
|
}
|
|
4876
4938
|
async subscribeGovLockedInfo(id, port) {
|
|
@@ -5558,6 +5620,15 @@ class KoniExtension {
|
|
|
5558
5620
|
return this.handleUnlockVote(request);
|
|
5559
5621
|
case 'pri(openGov.subscribeGovLockedInfo)':
|
|
5560
5622
|
return this.subscribeGovLockedInfo(id, port);
|
|
5623
|
+
|
|
5624
|
+
// Proxy
|
|
5625
|
+
case 'pri(substrateProxyAccount.getGroupInfo)':
|
|
5626
|
+
return this.getSubstrateProxyAccountGroup(request);
|
|
5627
|
+
case 'pri(substrateProxyAccount.add)':
|
|
5628
|
+
return this.handleAddSubstrateProxyAccount(request);
|
|
5629
|
+
case 'pri(substrateProxyAccount.remove)':
|
|
5630
|
+
return this.handleRemoveSubstrateProxyAccount(request);
|
|
5631
|
+
|
|
5561
5632
|
// Default
|
|
5562
5633
|
default:
|
|
5563
5634
|
throw new Error(`Unable to handle message of type ${type}`);
|
|
@@ -42,6 +42,7 @@ var _helper = require("@subwallet/extension-base/services/request-service/helper
|
|
|
42
42
|
var _SettingService = _interopRequireDefault(require("@subwallet/extension-base/services/setting-service/SettingService"));
|
|
43
43
|
var _DatabaseService = _interopRequireDefault(require("@subwallet/extension-base/services/storage-service/DatabaseService"));
|
|
44
44
|
var _subscanService = require("@subwallet/extension-base/services/subscan-service");
|
|
45
|
+
var _substrateProxyService = _interopRequireDefault(require("@subwallet/extension-base/services/substrate-proxy-service"));
|
|
45
46
|
var _swapService = require("@subwallet/extension-base/services/swap-service");
|
|
46
47
|
var _transactionService = _interopRequireDefault(require("@subwallet/extension-base/services/transaction-service"));
|
|
47
48
|
var _walletConnectService = _interopRequireDefault(require("@subwallet/extension-base/services/wallet-connect-service"));
|
|
@@ -132,6 +133,7 @@ class KoniState {
|
|
|
132
133
|
this.inappNotificationService = new _inappNotificationService.InappNotificationService(this.dbService, this.keyringService, this.eventService, this.chainService);
|
|
133
134
|
this.chainOnlineService = new _chainOnlineService.ChainOnlineService(this.chainService, this.settingService, this.eventService, this.dbService);
|
|
134
135
|
this.openGovService = new _openGov.default(this);
|
|
136
|
+
this.substrateProxyAccountService = new _substrateProxyService.default(this);
|
|
135
137
|
this.subscription = new _subscription.KoniSubscription(this, this.dbService);
|
|
136
138
|
this.cron = new _cron.KoniCron(this, this.subscription, this.dbService);
|
|
137
139
|
this.logger = (0, _util.logger)('State');
|
|
@@ -1822,10 +1824,6 @@ class KoniState {
|
|
|
1822
1824
|
await this.balanceService.reloadBalance();
|
|
1823
1825
|
return true;
|
|
1824
1826
|
}
|
|
1825
|
-
async reloadCrowdloan() {
|
|
1826
|
-
await this.subscription.reloadCrowdloan();
|
|
1827
|
-
return true;
|
|
1828
|
-
}
|
|
1829
1827
|
async approvePassPhishingPage(_url) {
|
|
1830
1828
|
return new Promise(resolve => {
|
|
1831
1829
|
this.settingService.getPassPhishingList(value => {
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.KoniSubscription = void 0;
|
|
7
7
|
var _crowdloan = require("@subwallet/extension-base/koni/api/dotsama/crowdloan");
|
|
8
8
|
var _nft = require("@subwallet/extension-base/koni/api/nft");
|
|
9
|
-
var _types = require("@subwallet/extension-base/services/event-service/types");
|
|
10
9
|
var _utils = require("@subwallet/extension-base/utils");
|
|
11
10
|
var _util = require("@polkadot/util");
|
|
12
11
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
@@ -47,26 +46,7 @@ class KoniSubscription {
|
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
async start() {
|
|
50
|
-
var _this$state$keyringSe;
|
|
51
49
|
await Promise.all([this.state.eventService.waitCryptoReady, this.state.eventService.waitKeyringReady, this.state.eventService.waitAssetReady]);
|
|
52
|
-
const currentAddress = (_this$state$keyringSe = this.state.keyringService.context.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.proxyId;
|
|
53
|
-
if (currentAddress) {
|
|
54
|
-
this.subscribeCrowdloans(currentAddress, this.state.getSubstrateApiMap());
|
|
55
|
-
}
|
|
56
|
-
this.eventHandler = (events, eventTypes) => {
|
|
57
|
-
var _serviceInfo$currentA;
|
|
58
|
-
const serviceInfo = this.state.getServiceInfo();
|
|
59
|
-
const needReload = eventTypes.some(eventType => _types.COMMON_RELOAD_EVENTS.includes(eventType));
|
|
60
|
-
if (!needReload) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.proxyId;
|
|
64
|
-
if (!address) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this.subscribeCrowdloans(address, serviceInfo.chainApiMap.substrate);
|
|
68
|
-
};
|
|
69
|
-
this.state.eventService.onLazy(this.eventHandler.bind(this));
|
|
70
50
|
}
|
|
71
51
|
async stop() {
|
|
72
52
|
if (this.eventHandler) {
|
|
@@ -117,8 +97,8 @@ class KoniSubscription {
|
|
|
117
97
|
}).catch(this.logger.log);
|
|
118
98
|
}
|
|
119
99
|
async reloadCrowdloan() {
|
|
120
|
-
var _this$state$
|
|
121
|
-
const currentAddress = (_this$state$
|
|
100
|
+
var _this$state$keyringSe;
|
|
101
|
+
const currentAddress = (_this$state$keyringSe = this.state.keyringService.context.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.proxyId;
|
|
122
102
|
this.subscribeCrowdloans(currentAddress, this.state.getSubstrateApiMap());
|
|
123
103
|
await (0, _utils.waitTimeout)(1800);
|
|
124
104
|
}
|
package/cjs/packageInfo.js
CHANGED
|
@@ -437,16 +437,27 @@ const subscribeAssetsAccountPallet = async _ref7 => {
|
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
const unsubList = await Promise.all(Object.values(tokenMap).map(tokenInfo => {
|
|
440
|
+
if (tokenInfo.slug === 'energy_web_x-LOCAL-stEWT') {
|
|
441
|
+
return (0, _rxjs.timer)(0, _constants.CRON_REFRESH_PRICE_INTERVAL).subscribe(() => {
|
|
442
|
+
const getEwtFrozenBalance = async () => {
|
|
443
|
+
const ewtTokenBalances = await queryEwtFrozenBalance(substrateApi, addresses, assetMap[tokenInfo.slug], extrinsicType);
|
|
444
|
+
callback(ewtTokenBalances);
|
|
445
|
+
};
|
|
446
|
+
getEwtFrozenBalance().catch(console.error);
|
|
447
|
+
});
|
|
448
|
+
}
|
|
440
449
|
try {
|
|
441
450
|
const assetIndex = (0, _utils2._getTokenOnChainAssetId)(tokenInfo);
|
|
442
|
-
if (assetIndex === '-1') {
|
|
451
|
+
if (assetIndex === '-1' && !_constants2.USE_MULTILOCATION_INDEX.includes(chainInfo.slug)) {
|
|
443
452
|
return undefined;
|
|
444
453
|
}
|
|
454
|
+
const version = ['statemint', 'statemine', 'westend_assethub'].includes(chainInfo.slug) ? 4 : 3;
|
|
455
|
+
const index = _constants2.USE_MULTILOCATION_INDEX.includes(chainInfo.slug) ? (0, _xcmParser._adaptX1Interior)((0, _utils2._getXcmAssetMultilocation)(tokenInfo), version) : assetIndex;
|
|
445
456
|
const params = [{
|
|
446
457
|
section: 'query',
|
|
447
458
|
module: assetsAccountKey.split('_')[1],
|
|
448
459
|
method: assetsAccountKey.split('_')[2],
|
|
449
|
-
args: addresses.map(address => [
|
|
460
|
+
args: addresses.map(address => [index, address])
|
|
450
461
|
}];
|
|
451
462
|
|
|
452
463
|
// Get Token Balance
|
|
@@ -610,4 +621,37 @@ async function queryGigaTokenBalance(substrateApi, addresses, tokenInfo, extrins
|
|
|
610
621
|
locked: totalLockedFromTransfer.toString()
|
|
611
622
|
};
|
|
612
623
|
}));
|
|
624
|
+
}
|
|
625
|
+
async function queryEwtFrozenBalance(substrateApi, addresses, tokenInfo, extrinsicType) {
|
|
626
|
+
const multilocation = (0, _utils2._getXcmAssetMultilocation)(tokenInfo);
|
|
627
|
+
return await Promise.all(addresses.map(async address => {
|
|
628
|
+
const [_frozenBalance, _balanceInfo] = await Promise.all([substrateApi.api.query.assetsFreezer.frozenBalances(multilocation, address), substrateApi.api.query.assets.account(multilocation, address)]);
|
|
629
|
+
const balanceInfo = _balanceInfo.toPrimitive();
|
|
630
|
+
if (!balanceInfo) {
|
|
631
|
+
// no balance info response
|
|
632
|
+
return {
|
|
633
|
+
address: address,
|
|
634
|
+
tokenSlug: tokenInfo.slug,
|
|
635
|
+
free: '0',
|
|
636
|
+
locked: '0',
|
|
637
|
+
state: _KoniTypes.APIItemState.READY
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
const transferableBalance = (0, _assetsPallet._getAssetsPalletTransferable)(balanceInfo, (0, _utils2._getAssetExistentialDeposit)(tokenInfo), extrinsicType);
|
|
641
|
+
const totalLockedFromTransfer = (0, _assetsPallet._getAssetsPalletLocked)(balanceInfo);
|
|
642
|
+
let freeBalance = transferableBalance;
|
|
643
|
+
let lockedBalance = totalLockedFromTransfer;
|
|
644
|
+
const frozenBalance = _frozenBalance.toPrimitive();
|
|
645
|
+
if (frozenBalance) {
|
|
646
|
+
freeBalance = transferableBalance - BigInt(frozenBalance);
|
|
647
|
+
lockedBalance = totalLockedFromTransfer + BigInt(frozenBalance);
|
|
648
|
+
}
|
|
649
|
+
return {
|
|
650
|
+
address: address,
|
|
651
|
+
tokenSlug: tokenInfo.slug,
|
|
652
|
+
free: freeBalance.toString(),
|
|
653
|
+
locked: lockedBalance.toString(),
|
|
654
|
+
state: _KoniTypes.APIItemState.READY
|
|
655
|
+
};
|
|
656
|
+
}));
|
|
613
657
|
}
|