@subwallet/extension-base 1.0.2-2 → 1.0.2-3
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 +46 -38
- package/background/KoniTypes.js +8 -8
- package/background/errors/TransactionError.js +25 -1
- package/background/types.d.ts +10 -5
- package/cjs/background/KoniTypes.js +8 -8
- package/cjs/background/errors/TransactionError.js +24 -0
- package/cjs/constants/index.js +8 -26
- package/cjs/koni/api/dotsama/balance.js +49 -224
- package/cjs/koni/api/dotsama/transfer.js +34 -39
- package/cjs/koni/api/nft/acala_nft/index.js +7 -7
- package/cjs/koni/api/nft/bit.country/index.js +7 -6
- package/cjs/koni/api/nft/evm_nft/index.js +8 -3
- package/cjs/koni/api/nft/index.js +3 -6
- package/cjs/koni/api/nft/karura_nft/index.js +7 -6
- package/cjs/koni/api/nft/rmrk_nft/index.js +11 -1
- package/cjs/koni/api/nft/statemine_nft/index.js +7 -6
- package/cjs/koni/api/nft/unique_nft/index.js +5 -1
- package/cjs/koni/api/nft/wasm_nft/index.js +170 -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 +122 -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 +171 -61
- package/cjs/koni/background/handlers/Extension.js +382 -207
- package/cjs/koni/background/handlers/State.js +41 -33
- package/cjs/koni/background/handlers/Tabs.js +50 -17
- package/cjs/koni/background/subscription.js +32 -29
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +13 -8
- package/cjs/services/chain-service/index.js +59 -45
- 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 +19 -13
- package/cjs/services/history-service/subsquid-multi-chain-history.js +13 -10
- package/cjs/services/keyring-service/index.js +11 -13
- 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 +13 -7
- package/cjs/services/request-service/handler/EvmRequestHandler.js +8 -12
- package/cjs/services/request-service/index.js +14 -5
- package/cjs/services/storage-service/DatabaseService.js +56 -34
- package/cjs/services/storage-service/db-stores/Nft.js +7 -15
- package/cjs/services/transaction-service/event-parser/index.js +20 -48
- package/cjs/services/transaction-service/index.js +26 -15
- package/cjs/utils/address.js +10 -1
- package/cjs/utils/index.js +9 -15
- 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 +11 -16
- package/koni/api/nft/acala_nft/index.js +7 -7
- package/koni/api/nft/bit.country/index.js +7 -6
- package/koni/api/nft/evm_nft/index.js +7 -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 +7 -6
- package/koni/api/nft/nft.d.ts +1 -0
- package/koni/api/nft/rmrk_nft/index.js +11 -1
- package/koni/api/nft/statemine_nft/index.js +7 -6
- 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 +168 -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 +121 -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 +172 -62
- package/koni/background/handlers/Extension.d.ts +8 -3
- package/koni/background/handlers/Extension.js +297 -126
- package/koni/background/handlers/State.d.ts +5 -6
- package/koni/background/handlers/State.js +43 -33
- package/koni/background/handlers/Tabs.js +50 -17
- package/koni/background/subscription.js +31 -30
- package/package.json +18 -13
- package/packageInfo.js +1 -1
- package/services/chain-service/handler/SubstrateChainHandler.js +14 -9
- 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.d.ts +3 -2
- package/services/chain-service/index.js +53 -40
- package/services/chain-service/types.d.ts +1 -0
- 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 +4 -2
- package/services/history-service/index.js +19 -13
- package/services/history-service/subsquid-multi-chain-history.js +16 -12
- package/services/keyring-service/index.d.ts +4 -2
- package/services/keyring-service/index.js +11 -13
- package/services/price-service/coingecko.js +0 -1
- package/services/price-service/index.js +2 -3
- package/services/request-service/handler/AuthRequestHandler.d.ts +3 -1
- package/services/request-service/handler/AuthRequestHandler.js +13 -7
- package/services/request-service/handler/EvmRequestHandler.js +8 -12
- package/services/request-service/index.d.ts +3 -1
- package/services/request-service/index.js +14 -5
- package/services/storage-service/DatabaseService.d.ts +1 -0
- package/services/storage-service/DatabaseService.js +56 -34
- package/services/storage-service/db-stores/Nft.d.ts +2 -2
- package/services/storage-service/db-stores/Nft.js +7 -14
- package/services/transaction-service/event-parser/index.js +21 -49
- package/services/transaction-service/index.js +26 -15
- package/utils/address.d.ts +3 -0
- package/utils/address.js +8 -1
- package/utils/index.d.ts +2 -2
- package/utils/index.js +7 -13
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
import { _AssetRef, _AssetType, _ChainAsset, _ChainInfo, _MultiChainAsset } from '@subwallet/chain-list/types';
|
|
3
3
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
4
4
|
import { AuthUrls, Resolver } from '@subwallet/extension-base/background/handlers/State';
|
|
5
|
-
import { AccountAuthType, AccountJson, AuthorizeRequest, ConfirmationRequestBase, RequestAccountList, RequestAccountSubscribe, RequestAuthorizeCancel, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestCurrentAccountAddress, ResponseAuthorizeList, ResponseJsonGetAccountInfo, SeedLengths } from '@subwallet/extension-base/background/types';
|
|
5
|
+
import { AccountAuthType, AccountJson, AddressJson, AuthorizeRequest, ConfirmationRequestBase, RequestAccountList, RequestAccountSubscribe, RequestAuthorizeCancel, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestCurrentAccountAddress, ResponseAuthorizeList, ResponseJsonGetAccountInfo, SeedLengths } from '@subwallet/extension-base/background/types';
|
|
6
6
|
import { _CHAIN_VALIDATION_ERROR } from '@subwallet/extension-base/services/chain-service/handler/types';
|
|
7
7
|
import { _ChainState, _EvmApi, _NetworkUpsertParams, _SubstrateApi, _ValidateCustomAssetRequest, _ValidateCustomAssetResponse } from '@subwallet/extension-base/services/chain-service/types';
|
|
8
8
|
import { SWTransactionResponse, SWTransactionResult } from '@subwallet/extension-base/services/transaction-service/types';
|
|
9
9
|
import { InjectedAccount, MetadataDefBase } from '@subwallet/extension-inject/types';
|
|
10
10
|
import { KeyringPair$Json, KeyringPair$Meta } from '@subwallet/keyring/types';
|
|
11
|
-
import { SingleAddress } from '@subwallet/ui-keyring/observable/types';
|
|
12
11
|
import { KeyringOptions } from '@subwallet/ui-keyring/options/types';
|
|
13
|
-
import { KeyringPairs$Json } from '@subwallet/ui-keyring/types';
|
|
12
|
+
import { KeyringAddress, KeyringPairs$Json } from '@subwallet/ui-keyring/types';
|
|
14
13
|
import Web3 from 'web3';
|
|
15
14
|
import { RequestArguments, TransactionConfig } from 'web3-core';
|
|
16
15
|
import { JsonRpcPayload, JsonRpcResponse } from 'web3-core-helpers';
|
|
@@ -422,7 +421,6 @@ export interface SWWarning {
|
|
|
422
421
|
data?: unknown;
|
|
423
422
|
}
|
|
424
423
|
export declare enum BasicTxErrorType {
|
|
425
|
-
NOT_ENOUGH_FEE = "NOT_ENOUGH_FEE",
|
|
426
424
|
NOT_ENOUGH_BALANCE = "NOT_ENOUGH_BALANCE",
|
|
427
425
|
CHAIN_DISCONNECTED = "CHAIN_DISCONNECTED",
|
|
428
426
|
INVALID_PARAMS = "INVALID_PARAMS",
|
|
@@ -436,12 +434,12 @@ export declare enum BasicTxErrorType {
|
|
|
436
434
|
NOT_ENOUGH_EXISTENTIAL_DEPOSIT = "NOT_ENOUGH_EXISTENTIAL_DEPOSIT"
|
|
437
435
|
}
|
|
438
436
|
export declare enum StakingTxErrorType {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
437
|
+
NOT_ENOUGH_MIN_STAKE = "NOT_ENOUGH_MIN_STAKE",
|
|
438
|
+
EXCEED_MAX_NOMINATIONS = "EXCEED_MAX_NOMINATIONS",
|
|
439
|
+
EXIST_UNSTAKING_REQUEST = "EXIST_UNSTAKING_REQUEST",
|
|
440
|
+
INVALID_ACTIVE_STAKE = "INVALID_ACTIVE_STAKE",
|
|
441
|
+
EXCEED_MAX_UNSTAKING = "EXCEED_MAX_UNSTAKING",
|
|
442
|
+
INACTIVE_NOMINATION_POOL = "INACTIVE_NOMINATION_POOL"
|
|
445
443
|
}
|
|
446
444
|
export declare enum TransferTxErrorType {
|
|
447
445
|
NOT_ENOUGH_VALUE = "NOT_ENOUGH_VALUE",
|
|
@@ -630,6 +628,16 @@ export interface ResponseAccountCreateWithSecretKey {
|
|
|
630
628
|
errors: AccountExternalError[];
|
|
631
629
|
success: boolean;
|
|
632
630
|
}
|
|
631
|
+
export interface AddressBookInfo {
|
|
632
|
+
addresses: AddressJson[];
|
|
633
|
+
}
|
|
634
|
+
export interface RequestEditContactAccount {
|
|
635
|
+
address: string;
|
|
636
|
+
meta: KeyringPair$Meta;
|
|
637
|
+
}
|
|
638
|
+
export interface RequestDeleteContactAccount {
|
|
639
|
+
address: string;
|
|
640
|
+
}
|
|
633
641
|
export declare enum ExternalRequestPromiseStatus {
|
|
634
642
|
PENDING = 0,
|
|
635
643
|
REJECTED = 1,
|
|
@@ -751,6 +759,13 @@ export interface RequestFreeBalance {
|
|
|
751
759
|
networkKey: string;
|
|
752
760
|
token?: string;
|
|
753
761
|
}
|
|
762
|
+
export interface RequestMaxTransferable {
|
|
763
|
+
address: string;
|
|
764
|
+
networkKey: string;
|
|
765
|
+
token?: string;
|
|
766
|
+
isXcmTransfer?: boolean;
|
|
767
|
+
destChain: string;
|
|
768
|
+
}
|
|
754
769
|
export interface RequestTransferCheckReferenceCount {
|
|
755
770
|
address: string;
|
|
756
771
|
networkKey: string;
|
|
@@ -882,6 +897,7 @@ export interface AddNetworkExternalRequest {
|
|
|
882
897
|
requestId: string;
|
|
883
898
|
}
|
|
884
899
|
export interface AddTokenRequestExternal {
|
|
900
|
+
slug?: string;
|
|
885
901
|
contractAddress: string;
|
|
886
902
|
originChain: string;
|
|
887
903
|
type: _AssetType;
|
|
@@ -1044,6 +1060,8 @@ export interface ChainStakingMetadata {
|
|
|
1044
1060
|
inflation?: number;
|
|
1045
1061
|
minJoinNominationPool?: string;
|
|
1046
1062
|
minStake: string;
|
|
1063
|
+
nominatorCount?: number;
|
|
1064
|
+
minPoolBonding?: string;
|
|
1047
1065
|
maxValidatorPerNominator: number;
|
|
1048
1066
|
maxWithdrawalRequestPerValidator: number;
|
|
1049
1067
|
allowCancelUnstaking: boolean;
|
|
@@ -1060,7 +1078,7 @@ export interface NominationInfo {
|
|
|
1060
1078
|
}
|
|
1061
1079
|
export interface PalletNominationPoolsBondedPoolInner {
|
|
1062
1080
|
points: number;
|
|
1063
|
-
state: 'Open' | 'Destroying';
|
|
1081
|
+
state: 'Open' | 'Destroying' | 'Locked';
|
|
1064
1082
|
memberCounter: number;
|
|
1065
1083
|
roles: {
|
|
1066
1084
|
depositor: string;
|
|
@@ -1089,7 +1107,8 @@ export interface UnstakingInfo {
|
|
|
1089
1107
|
export declare enum StakingStatus {
|
|
1090
1108
|
EARNING_REWARD = "EARNING_REWARD",
|
|
1091
1109
|
PARTIALLY_EARNING = "PARTIALLY_EARNING",
|
|
1092
|
-
NOT_EARNING = "NOT_EARNING"
|
|
1110
|
+
NOT_EARNING = "NOT_EARNING",
|
|
1111
|
+
WAITING = "WAITING"
|
|
1093
1112
|
}
|
|
1094
1113
|
export interface NominatorMetadata {
|
|
1095
1114
|
chain: string;
|
|
@@ -1117,28 +1136,6 @@ export interface ValidatorInfo {
|
|
|
1117
1136
|
icon?: string;
|
|
1118
1137
|
isCrowded: boolean;
|
|
1119
1138
|
}
|
|
1120
|
-
export interface NominationPoolMetadata {
|
|
1121
|
-
id: string;
|
|
1122
|
-
identity?: string;
|
|
1123
|
-
address: string;
|
|
1124
|
-
memberCount: number;
|
|
1125
|
-
bondedAmount: string;
|
|
1126
|
-
}
|
|
1127
|
-
export interface NominatorInfo {
|
|
1128
|
-
chain: string;
|
|
1129
|
-
address: string;
|
|
1130
|
-
isBondedBefore: boolean;
|
|
1131
|
-
bondedValidators: string[];
|
|
1132
|
-
bondedPool: string[];
|
|
1133
|
-
}
|
|
1134
|
-
export interface ChainBondingInfo {
|
|
1135
|
-
chain: string;
|
|
1136
|
-
estimatedReturn: number;
|
|
1137
|
-
activeNominatorCount: number;
|
|
1138
|
-
totalNominatorCount: number;
|
|
1139
|
-
unbondingPeriod: number;
|
|
1140
|
-
totalStake: string;
|
|
1141
|
-
}
|
|
1142
1139
|
export interface BondingSubmitParams extends BaseRequestSign {
|
|
1143
1140
|
chain: string;
|
|
1144
1141
|
type: StakingType;
|
|
@@ -1250,6 +1247,10 @@ export interface KeyringState {
|
|
|
1250
1247
|
hasMasterPassword: boolean;
|
|
1251
1248
|
isLocked: boolean;
|
|
1252
1249
|
}
|
|
1250
|
+
export interface AddressBookState {
|
|
1251
|
+
contacts: AddressJson[];
|
|
1252
|
+
recent: AddressJson[];
|
|
1253
|
+
}
|
|
1253
1254
|
export interface RequestChangeMasterPassword {
|
|
1254
1255
|
oldPassword?: string;
|
|
1255
1256
|
newPassword: string;
|
|
@@ -1353,6 +1354,9 @@ export interface Notification {
|
|
|
1353
1354
|
};
|
|
1354
1355
|
}
|
|
1355
1356
|
export declare type NotificationParams = Omit<Notification, 'id'>;
|
|
1357
|
+
export interface CronReloadRequest {
|
|
1358
|
+
data: 'nft' | 'staking';
|
|
1359
|
+
}
|
|
1356
1360
|
export interface KoniRequestSignatures {
|
|
1357
1361
|
'pri(staking.submitTuringCancelCompound)': [RequestTuringCancelStakeCompound, SWTransactionResponse];
|
|
1358
1362
|
'pri(staking.submitTuringCompound)': [RequestTuringStakeCompound, SWTransactionResponse];
|
|
@@ -1390,7 +1394,7 @@ export interface KoniRequestSignatures {
|
|
|
1390
1394
|
'pri(assetSetting.update)': [AssetSettingUpdateReq, boolean];
|
|
1391
1395
|
'pri(evmNft.submitTransaction)': [NftTransactionRequest, SWTransactionResponse];
|
|
1392
1396
|
'pri(evmNft.getTransaction)': [NftTransactionRequest, EvmNftTransaction];
|
|
1393
|
-
'pri(substrateNft.submitTransaction)': [
|
|
1397
|
+
'pri(substrateNft.submitTransaction)': [NftTransactionRequest, SWTransactionResponse];
|
|
1394
1398
|
'pri(substrateNft.getTransaction)': [NftTransactionRequest, SubstrateNftTransaction];
|
|
1395
1399
|
'pri(nft.getNft)': [null, NftJson];
|
|
1396
1400
|
'pri(nft.getSubscription)': [RequestSubscribeNft, NftJson, NftJson];
|
|
@@ -1433,11 +1437,13 @@ export interface KoniRequestSignatures {
|
|
|
1433
1437
|
'pri(accounts.checkPublicAndSecretKey)': [RequestCheckPublicAndSecretKey, ResponseCheckPublicAndSecretKey];
|
|
1434
1438
|
'pri(accounts.subscribeWithCurrentAddress)': [RequestAccountSubscribe, AccountsWithCurrentAddress, AccountsWithCurrentAddress];
|
|
1435
1439
|
'pri(accounts.subscribeAccountsInputAddress)': [RequestAccountSubscribe, string, OptionInputAddress];
|
|
1436
|
-
'pri(accounts.saveRecent)': [RequestSaveRecentAccount,
|
|
1437
|
-
'pri(accounts.triggerSubscription)': [null, boolean];
|
|
1440
|
+
'pri(accounts.saveRecent)': [RequestSaveRecentAccount, KeyringAddress];
|
|
1438
1441
|
'pri(accounts.get.meta)': [RequestAccountMeta, ResponseAccountMeta];
|
|
1439
1442
|
'pri(accounts.updateCurrentAddress)': [string, boolean];
|
|
1440
|
-
'pri(currentAccount.saveAddress)': [RequestCurrentAccountAddress,
|
|
1443
|
+
'pri(currentAccount.saveAddress)': [RequestCurrentAccountAddress, CurrentAccountInfo];
|
|
1444
|
+
'pri(accounts.subscribeAddresses)': [null, AddressBookInfo, AddressBookInfo];
|
|
1445
|
+
'pri(accounts.editContact)': [RequestEditContactAccount, boolean];
|
|
1446
|
+
'pri(accounts.deleteContact)': [RequestDeleteContactAccount, boolean];
|
|
1441
1447
|
'pri(settings.changeBalancesVisibility)': [null, boolean, UiSettings];
|
|
1442
1448
|
'pri(settings.subscribe)': [null, UiSettings, UiSettings];
|
|
1443
1449
|
'pri(settings.saveAccountAllLogo)': [string, boolean, UiSettings];
|
|
@@ -1448,6 +1454,7 @@ export interface KoniRequestSignatures {
|
|
|
1448
1454
|
'pri(transfer.checkReferenceCount)': [RequestTransferCheckReferenceCount, boolean];
|
|
1449
1455
|
'pri(transfer.checkSupporting)': [RequestTransferCheckSupporting, SupportTransferResponse];
|
|
1450
1456
|
'pri(transfer.getExistentialDeposit)': [RequestTransferExistentialDeposit, string];
|
|
1457
|
+
'pri(transfer.getMaxTransferable)': [RequestMaxTransferable, AmountData];
|
|
1451
1458
|
'pri(subscription.cancel)': [string, boolean];
|
|
1452
1459
|
'pri(freeBalance.get)': [RequestFreeBalance, AmountData];
|
|
1453
1460
|
'pri(freeBalance.subscribe)': [RequestFreeBalance, AmountData, AmountData];
|
|
@@ -1486,6 +1493,7 @@ export interface KoniRequestSignatures {
|
|
|
1486
1493
|
'pri(transactions.getOne)': [RequestGetTransaction, SWTransactionResult];
|
|
1487
1494
|
'pri(transactions.subscribe)': [null, Record<string, SWTransactionResult>, Record<string, SWTransactionResult>];
|
|
1488
1495
|
'pri(notifications.subscribe)': [null, Notification[], Notification[]];
|
|
1496
|
+
'pri(cron.reload)': [CronReloadRequest, boolean];
|
|
1489
1497
|
'mobile(ping)': [null, string];
|
|
1490
1498
|
'mobile(cronAndSubscription.init)': [RequestInitCronAndSubscription, ActiveCronAndSubscriptionMap];
|
|
1491
1499
|
'mobile(cronAndSubscription.activeService.subscribe)': [null, ActiveCronAndSubscriptionMap, ActiveCronAndSubscriptionMap];
|
package/background/KoniTypes.js
CHANGED
|
@@ -90,7 +90,6 @@ export let ExtrinsicStatus;
|
|
|
90
90
|
})(ExtrinsicStatus || (ExtrinsicStatus = {}));
|
|
91
91
|
export let BasicTxErrorType;
|
|
92
92
|
(function (BasicTxErrorType) {
|
|
93
|
-
BasicTxErrorType["NOT_ENOUGH_FEE"] = "NOT_ENOUGH_FEE";
|
|
94
93
|
BasicTxErrorType["NOT_ENOUGH_BALANCE"] = "NOT_ENOUGH_BALANCE";
|
|
95
94
|
BasicTxErrorType["CHAIN_DISCONNECTED"] = "CHAIN_DISCONNECTED";
|
|
96
95
|
BasicTxErrorType["INVALID_PARAMS"] = "INVALID_PARAMS";
|
|
@@ -105,12 +104,12 @@ export let BasicTxErrorType;
|
|
|
105
104
|
})(BasicTxErrorType || (BasicTxErrorType = {}));
|
|
106
105
|
export let StakingTxErrorType;
|
|
107
106
|
(function (StakingTxErrorType) {
|
|
108
|
-
StakingTxErrorType["
|
|
109
|
-
StakingTxErrorType["
|
|
110
|
-
StakingTxErrorType["
|
|
111
|
-
StakingTxErrorType["
|
|
112
|
-
StakingTxErrorType["
|
|
113
|
-
StakingTxErrorType["
|
|
107
|
+
StakingTxErrorType["NOT_ENOUGH_MIN_STAKE"] = "NOT_ENOUGH_MIN_STAKE";
|
|
108
|
+
StakingTxErrorType["EXCEED_MAX_NOMINATIONS"] = "EXCEED_MAX_NOMINATIONS";
|
|
109
|
+
StakingTxErrorType["EXIST_UNSTAKING_REQUEST"] = "EXIST_UNSTAKING_REQUEST";
|
|
110
|
+
StakingTxErrorType["INVALID_ACTIVE_STAKE"] = "INVALID_ACTIVE_STAKE";
|
|
111
|
+
StakingTxErrorType["EXCEED_MAX_UNSTAKING"] = "EXCEED_MAX_UNSTAKING";
|
|
112
|
+
StakingTxErrorType["INACTIVE_NOMINATION_POOL"] = "INACTIVE_NOMINATION_POOL";
|
|
114
113
|
})(StakingTxErrorType || (StakingTxErrorType = {}));
|
|
115
114
|
export let TransferTxErrorType;
|
|
116
115
|
(function (TransferTxErrorType) {
|
|
@@ -132,7 +131,7 @@ export let BalanceErrorType;
|
|
|
132
131
|
})(BalanceErrorType || (BalanceErrorType = {}));
|
|
133
132
|
export let ProviderErrorType;
|
|
134
133
|
|
|
135
|
-
|
|
134
|
+
/// Manage account
|
|
136
135
|
// Export private key
|
|
137
136
|
(function (ProviderErrorType) {
|
|
138
137
|
ProviderErrorType["CHAIN_DISCONNECTED"] = "CHAIN_DISCONNECTED";
|
|
@@ -209,6 +208,7 @@ export let StakingStatus;
|
|
|
209
208
|
StakingStatus["EARNING_REWARD"] = "EARNING_REWARD";
|
|
210
209
|
StakingStatus["PARTIALLY_EARNING"] = "PARTIALLY_EARNING";
|
|
211
210
|
StakingStatus["NOT_EARNING"] = "NOT_EARNING";
|
|
211
|
+
StakingStatus["WAITING"] = "WAITING";
|
|
212
212
|
})(StakingStatus || (StakingStatus = {}));
|
|
213
213
|
export let ChainEditStandard;
|
|
214
214
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { SWError } from '@subwallet/extension-base/background/errors/SWError';
|
|
5
|
-
import { BasicTxErrorType } from '@subwallet/extension-base/background/KoniTypes';
|
|
5
|
+
import { BasicTxErrorType, StakingTxErrorType } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
6
|
|
|
7
7
|
// Todo: finish this map in the future
|
|
8
8
|
const defaultErrorMap = {
|
|
@@ -49,6 +49,30 @@ const defaultErrorMap = {
|
|
|
49
49
|
[BasicTxErrorType.UNSUPPORTED]: {
|
|
50
50
|
message: 'This transaction is not supported',
|
|
51
51
|
code: undefined
|
|
52
|
+
},
|
|
53
|
+
[StakingTxErrorType.NOT_ENOUGH_MIN_STAKE]: {
|
|
54
|
+
message: 'Not enough min stake',
|
|
55
|
+
code: undefined
|
|
56
|
+
},
|
|
57
|
+
[StakingTxErrorType.EXCEED_MAX_NOMINATIONS]: {
|
|
58
|
+
message: 'Exceed max nominations',
|
|
59
|
+
code: undefined
|
|
60
|
+
},
|
|
61
|
+
[StakingTxErrorType.EXIST_UNSTAKING_REQUEST]: {
|
|
62
|
+
message: 'Exist unstaking request',
|
|
63
|
+
code: undefined
|
|
64
|
+
},
|
|
65
|
+
[StakingTxErrorType.INVALID_ACTIVE_STAKE]: {
|
|
66
|
+
message: 'Invalid active stake',
|
|
67
|
+
code: undefined
|
|
68
|
+
},
|
|
69
|
+
[StakingTxErrorType.EXCEED_MAX_UNSTAKING]: {
|
|
70
|
+
message: 'Exceed max unstaking',
|
|
71
|
+
code: undefined
|
|
72
|
+
},
|
|
73
|
+
[StakingTxErrorType.INACTIVE_NOMINATION_POOL]: {
|
|
74
|
+
message: 'This nomination pool is not active',
|
|
75
|
+
code: undefined
|
|
52
76
|
}
|
|
53
77
|
};
|
|
54
78
|
export class TransactionError extends SWError {
|
package/background/types.d.ts
CHANGED
|
@@ -22,8 +22,14 @@ declare type NullKeys<T> = {
|
|
|
22
22
|
[K in keyof T]: IsNull<T, K>;
|
|
23
23
|
}[keyof T];
|
|
24
24
|
export declare type SeedLengths = 12 | 24;
|
|
25
|
-
export interface
|
|
25
|
+
export interface AbstractAddressJson extends KeyringPair$Meta {
|
|
26
26
|
address: string;
|
|
27
|
+
type?: KeypairType;
|
|
28
|
+
whenCreated?: number;
|
|
29
|
+
name?: string;
|
|
30
|
+
originGenesisHash?: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface AccountJson extends AbstractAddressJson {
|
|
27
33
|
accountIndex?: number;
|
|
28
34
|
addressOffset?: number;
|
|
29
35
|
genesisHash?: string | null;
|
|
@@ -33,12 +39,11 @@ export interface AccountJson extends KeyringPair$Meta {
|
|
|
33
39
|
isMasterAccount?: boolean;
|
|
34
40
|
isMasterPassword?: boolean;
|
|
35
41
|
isReadOnly?: boolean;
|
|
36
|
-
name?: string;
|
|
37
|
-
originGenesisHash?: string | null;
|
|
38
42
|
parentAddress?: string;
|
|
39
43
|
suri?: string;
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
}
|
|
45
|
+
export interface AddressJson extends AbstractAddressJson {
|
|
46
|
+
isRecent?: boolean;
|
|
42
47
|
}
|
|
43
48
|
export interface AccountsWithCurrentAddress {
|
|
44
49
|
accounts: AccountJson[];
|
|
@@ -95,7 +95,6 @@ exports.ExtrinsicStatus = ExtrinsicStatus;
|
|
|
95
95
|
let BasicTxErrorType;
|
|
96
96
|
exports.BasicTxErrorType = BasicTxErrorType;
|
|
97
97
|
(function (BasicTxErrorType) {
|
|
98
|
-
BasicTxErrorType["NOT_ENOUGH_FEE"] = "NOT_ENOUGH_FEE";
|
|
99
98
|
BasicTxErrorType["NOT_ENOUGH_BALANCE"] = "NOT_ENOUGH_BALANCE";
|
|
100
99
|
BasicTxErrorType["CHAIN_DISCONNECTED"] = "CHAIN_DISCONNECTED";
|
|
101
100
|
BasicTxErrorType["INVALID_PARAMS"] = "INVALID_PARAMS";
|
|
@@ -111,12 +110,12 @@ exports.BasicTxErrorType = BasicTxErrorType;
|
|
|
111
110
|
let StakingTxErrorType;
|
|
112
111
|
exports.StakingTxErrorType = StakingTxErrorType;
|
|
113
112
|
(function (StakingTxErrorType) {
|
|
114
|
-
StakingTxErrorType["
|
|
115
|
-
StakingTxErrorType["
|
|
116
|
-
StakingTxErrorType["
|
|
117
|
-
StakingTxErrorType["
|
|
118
|
-
StakingTxErrorType["
|
|
119
|
-
StakingTxErrorType["
|
|
113
|
+
StakingTxErrorType["NOT_ENOUGH_MIN_STAKE"] = "NOT_ENOUGH_MIN_STAKE";
|
|
114
|
+
StakingTxErrorType["EXCEED_MAX_NOMINATIONS"] = "EXCEED_MAX_NOMINATIONS";
|
|
115
|
+
StakingTxErrorType["EXIST_UNSTAKING_REQUEST"] = "EXIST_UNSTAKING_REQUEST";
|
|
116
|
+
StakingTxErrorType["INVALID_ACTIVE_STAKE"] = "INVALID_ACTIVE_STAKE";
|
|
117
|
+
StakingTxErrorType["EXCEED_MAX_UNSTAKING"] = "EXCEED_MAX_UNSTAKING";
|
|
118
|
+
StakingTxErrorType["INACTIVE_NOMINATION_POOL"] = "INACTIVE_NOMINATION_POOL";
|
|
120
119
|
})(StakingTxErrorType || (exports.StakingTxErrorType = StakingTxErrorType = {}));
|
|
121
120
|
let TransferTxErrorType;
|
|
122
121
|
exports.TransferTxErrorType = TransferTxErrorType;
|
|
@@ -139,7 +138,7 @@ exports.BalanceErrorType = BalanceErrorType;
|
|
|
139
138
|
BalanceErrorType["TIMEOUT"] = "TIMEOUT";
|
|
140
139
|
BalanceErrorType["GET_BALANCE_ERROR"] = "GET_BALANCE_ERROR";
|
|
141
140
|
})(BalanceErrorType || (exports.BalanceErrorType = BalanceErrorType = {}));
|
|
142
|
-
let ProviderErrorType;
|
|
141
|
+
let ProviderErrorType; /// Manage account
|
|
143
142
|
// Export private key
|
|
144
143
|
exports.ProviderErrorType = ProviderErrorType;
|
|
145
144
|
(function (ProviderErrorType) {
|
|
@@ -217,6 +216,7 @@ exports.StakingStatus = StakingStatus;
|
|
|
217
216
|
StakingStatus["EARNING_REWARD"] = "EARNING_REWARD";
|
|
218
217
|
StakingStatus["PARTIALLY_EARNING"] = "PARTIALLY_EARNING";
|
|
219
218
|
StakingStatus["NOT_EARNING"] = "NOT_EARNING";
|
|
219
|
+
StakingStatus["WAITING"] = "WAITING";
|
|
220
220
|
})(StakingStatus || (exports.StakingStatus = StakingStatus = {}));
|
|
221
221
|
let ChainEditStandard; // ChainService
|
|
222
222
|
// for custom network
|
|
@@ -54,6 +54,30 @@ const defaultErrorMap = {
|
|
|
54
54
|
[_KoniTypes.BasicTxErrorType.UNSUPPORTED]: {
|
|
55
55
|
message: 'This transaction is not supported',
|
|
56
56
|
code: undefined
|
|
57
|
+
},
|
|
58
|
+
[_KoniTypes.StakingTxErrorType.NOT_ENOUGH_MIN_STAKE]: {
|
|
59
|
+
message: 'Not enough min stake',
|
|
60
|
+
code: undefined
|
|
61
|
+
},
|
|
62
|
+
[_KoniTypes.StakingTxErrorType.EXCEED_MAX_NOMINATIONS]: {
|
|
63
|
+
message: 'Exceed max nominations',
|
|
64
|
+
code: undefined
|
|
65
|
+
},
|
|
66
|
+
[_KoniTypes.StakingTxErrorType.EXIST_UNSTAKING_REQUEST]: {
|
|
67
|
+
message: 'Exist unstaking request',
|
|
68
|
+
code: undefined
|
|
69
|
+
},
|
|
70
|
+
[_KoniTypes.StakingTxErrorType.INVALID_ACTIVE_STAKE]: {
|
|
71
|
+
message: 'Invalid active stake',
|
|
72
|
+
code: undefined
|
|
73
|
+
},
|
|
74
|
+
[_KoniTypes.StakingTxErrorType.EXCEED_MAX_UNSTAKING]: {
|
|
75
|
+
message: 'Exceed max unstaking',
|
|
76
|
+
code: undefined
|
|
77
|
+
},
|
|
78
|
+
[_KoniTypes.StakingTxErrorType.INACTIVE_NOMINATION_POOL]: {
|
|
79
|
+
message: 'This nomination pool is not active',
|
|
80
|
+
code: undefined
|
|
57
81
|
}
|
|
58
82
|
};
|
|
59
83
|
class TransactionError extends _SWError.SWError {
|
package/cjs/constants/index.js
CHANGED
|
@@ -5,22 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
CRON_REFRESH_PRICE_INTERVAL: true,
|
|
8
|
-
DOTSAMA_API_TIMEOUT: true,
|
|
9
|
-
DOTSAMA_AUTO_CONNECT_MS: true,
|
|
10
|
-
DOTSAMA_MAX_CONTINUE_RETRY: true,
|
|
11
8
|
CRON_AUTO_RECOVER_DOTSAMA_INTERVAL: true,
|
|
12
9
|
CRON_AUTO_RECOVER_WEB3_INTERVAL: true,
|
|
13
10
|
ACALA_REFRESH_CROWDLOAN_INTERVAL: true,
|
|
14
|
-
ACALA_REFRESH_BALANCE_INTERVAL: true,
|
|
15
11
|
ASTAR_REFRESH_BALANCE_INTERVAL: true,
|
|
16
12
|
SUB_TOKEN_REFRESH_BALANCE_INTERVAL: true,
|
|
17
|
-
SUBSCRIBE_BALANCE_FAST_INTERVAL: true,
|
|
18
13
|
CRON_REFRESH_NFT_INTERVAL: true,
|
|
19
14
|
CRON_REFRESH_STAKING_REWARD_INTERVAL: true,
|
|
20
15
|
CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL: true,
|
|
21
16
|
CRON_REFRESH_HISTORY_INTERVAL: true,
|
|
22
17
|
CRON_GET_API_MAP_STATUS: true,
|
|
23
|
-
CRON_REFRESH_STAKING_DATA: true,
|
|
24
18
|
CRON_REFRESH_CHAIN_STAKING_METADATA: true,
|
|
25
19
|
CRON_REFRESH_CHAIN_NOMINATOR_METADATA: true,
|
|
26
20
|
ALL_ACCOUNT_KEY: true,
|
|
@@ -30,7 +24,7 @@ var _exportNames = {
|
|
|
30
24
|
IGNORE_QR_SIGNER: true,
|
|
31
25
|
DEFAULT_TIME_AUTO_LOCK: true
|
|
32
26
|
};
|
|
33
|
-
exports.SUB_TOKEN_REFRESH_BALANCE_INTERVAL = exports.
|
|
27
|
+
exports.SUB_TOKEN_REFRESH_BALANCE_INTERVAL = exports.IGNORE_QR_SIGNER = exports.IGNORE_GET_SUBSTRATE_FEATURES_LIST = exports.DEFAULT_TIME_AUTO_LOCK = exports.CRON_REFRESH_STAKING_REWARD_INTERVAL = exports.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = exports.CRON_REFRESH_PRICE_INTERVAL = exports.CRON_REFRESH_NFT_INTERVAL = exports.CRON_REFRESH_HISTORY_INTERVAL = exports.CRON_REFRESH_CHAIN_STAKING_METADATA = exports.CRON_REFRESH_CHAIN_NOMINATOR_METADATA = exports.CRON_GET_API_MAP_STATUS = exports.CRON_AUTO_RECOVER_WEB3_INTERVAL = exports.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = exports.ASTAR_REFRESH_BALANCE_INTERVAL = exports.ALL_NETWORK_KEY = exports.ALL_GENESIS_HASH = exports.ALL_ACCOUNT_KEY = exports.ACALA_REFRESH_CROWDLOAN_INTERVAL = void 0;
|
|
34
28
|
var _staking = require("./staking");
|
|
35
29
|
Object.keys(_staking).forEach(function (key) {
|
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -48,41 +42,29 @@ Object.keys(_staking).forEach(function (key) {
|
|
|
48
42
|
|
|
49
43
|
const CRON_REFRESH_PRICE_INTERVAL = 30000;
|
|
50
44
|
exports.CRON_REFRESH_PRICE_INTERVAL = CRON_REFRESH_PRICE_INTERVAL;
|
|
51
|
-
const DOTSAMA_API_TIMEOUT = 30000;
|
|
52
|
-
exports.DOTSAMA_API_TIMEOUT = DOTSAMA_API_TIMEOUT;
|
|
53
|
-
const DOTSAMA_AUTO_CONNECT_MS = 3000;
|
|
54
|
-
exports.DOTSAMA_AUTO_CONNECT_MS = DOTSAMA_AUTO_CONNECT_MS;
|
|
55
|
-
const DOTSAMA_MAX_CONTINUE_RETRY = 2;
|
|
56
|
-
exports.DOTSAMA_MAX_CONTINUE_RETRY = DOTSAMA_MAX_CONTINUE_RETRY;
|
|
57
45
|
const CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = 60000;
|
|
58
46
|
exports.CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = CRON_AUTO_RECOVER_DOTSAMA_INTERVAL;
|
|
59
47
|
const CRON_AUTO_RECOVER_WEB3_INTERVAL = 90000;
|
|
60
48
|
exports.CRON_AUTO_RECOVER_WEB3_INTERVAL = CRON_AUTO_RECOVER_WEB3_INTERVAL;
|
|
61
49
|
const ACALA_REFRESH_CROWDLOAN_INTERVAL = 300000;
|
|
62
50
|
exports.ACALA_REFRESH_CROWDLOAN_INTERVAL = ACALA_REFRESH_CROWDLOAN_INTERVAL;
|
|
63
|
-
const
|
|
64
|
-
exports.ACALA_REFRESH_BALANCE_INTERVAL = ACALA_REFRESH_BALANCE_INTERVAL;
|
|
65
|
-
const ASTAR_REFRESH_BALANCE_INTERVAL = 30000;
|
|
51
|
+
const ASTAR_REFRESH_BALANCE_INTERVAL = 60000;
|
|
66
52
|
exports.ASTAR_REFRESH_BALANCE_INTERVAL = ASTAR_REFRESH_BALANCE_INTERVAL;
|
|
67
|
-
const SUB_TOKEN_REFRESH_BALANCE_INTERVAL =
|
|
53
|
+
const SUB_TOKEN_REFRESH_BALANCE_INTERVAL = 60000;
|
|
68
54
|
exports.SUB_TOKEN_REFRESH_BALANCE_INTERVAL = SUB_TOKEN_REFRESH_BALANCE_INTERVAL;
|
|
69
|
-
const
|
|
70
|
-
exports.SUBSCRIBE_BALANCE_FAST_INTERVAL = SUBSCRIBE_BALANCE_FAST_INTERVAL;
|
|
71
|
-
const CRON_REFRESH_NFT_INTERVAL = 900000;
|
|
55
|
+
const CRON_REFRESH_NFT_INTERVAL = 7200000;
|
|
72
56
|
exports.CRON_REFRESH_NFT_INTERVAL = CRON_REFRESH_NFT_INTERVAL;
|
|
73
57
|
const CRON_REFRESH_STAKING_REWARD_INTERVAL = 900000;
|
|
74
58
|
exports.CRON_REFRESH_STAKING_REWARD_INTERVAL = CRON_REFRESH_STAKING_REWARD_INTERVAL;
|
|
75
|
-
const CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL =
|
|
59
|
+
const CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = 300000;
|
|
76
60
|
exports.CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL;
|
|
77
|
-
const CRON_REFRESH_HISTORY_INTERVAL =
|
|
61
|
+
const CRON_REFRESH_HISTORY_INTERVAL = 900000;
|
|
78
62
|
exports.CRON_REFRESH_HISTORY_INTERVAL = CRON_REFRESH_HISTORY_INTERVAL;
|
|
79
|
-
const CRON_GET_API_MAP_STATUS =
|
|
63
|
+
const CRON_GET_API_MAP_STATUS = 10000;
|
|
80
64
|
exports.CRON_GET_API_MAP_STATUS = CRON_GET_API_MAP_STATUS;
|
|
81
|
-
const CRON_REFRESH_STAKING_DATA = 30000;
|
|
82
|
-
exports.CRON_REFRESH_STAKING_DATA = CRON_REFRESH_STAKING_DATA;
|
|
83
65
|
const CRON_REFRESH_CHAIN_STAKING_METADATA = 900000;
|
|
84
66
|
exports.CRON_REFRESH_CHAIN_STAKING_METADATA = CRON_REFRESH_CHAIN_STAKING_METADATA;
|
|
85
|
-
const CRON_REFRESH_CHAIN_NOMINATOR_METADATA =
|
|
67
|
+
const CRON_REFRESH_CHAIN_NOMINATOR_METADATA = 1800000;
|
|
86
68
|
exports.CRON_REFRESH_CHAIN_NOMINATOR_METADATA = CRON_REFRESH_CHAIN_NOMINATOR_METADATA;
|
|
87
69
|
const ALL_ACCOUNT_KEY = 'ALL';
|
|
88
70
|
exports.ALL_ACCOUNT_KEY = ALL_ACCOUNT_KEY;
|