@subwallet/extension-base 0.6.7-2wr → 0.6.8-1
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 +51 -67
- package/background/KoniTypes.js +13 -23
- package/background/RequestBytesSign.js +1 -2
- package/background/RequestExtrinsicSign.js +1 -2
- package/background/handlers/Extension.js +28 -122
- package/background/handlers/State.js +28 -71
- package/background/handlers/Tabs.js +9 -45
- package/background/handlers/helpers.js +1 -1
- package/background/handlers/index.js +4 -2
- package/background/handlers/subscriptions.js +5 -2
- package/bundle.js +1 -0
- package/cjs/background/KoniTypes.js +15 -24
- package/cjs/background/RequestBytesSign.js +1 -6
- package/cjs/background/RequestExtrinsicSign.js +1 -4
- package/cjs/background/handlers/Extension.js +27 -174
- package/cjs/background/handlers/State.js +28 -82
- package/cjs/background/handlers/Tabs.js +9 -60
- package/cjs/background/handlers/helpers.js +1 -2
- package/cjs/background/handlers/index.js +4 -10
- package/cjs/background/handlers/subscriptions.js +5 -4
- package/cjs/bundle.js +0 -1
- package/cjs/defaults.js +2 -3
- package/cjs/detectOther.js +0 -4
- package/cjs/detectPackage.js +2 -4
- package/cjs/errors/SubWalletProviderError.js +1 -3
- package/cjs/index.js +0 -2
- package/cjs/packageInfo.js +3 -1
- package/cjs/page/Accounts.js +3 -6
- package/cjs/page/Injected.js +1 -8
- package/cjs/page/Metadata.js +1 -5
- package/cjs/page/PostMessageProvider.js +22 -38
- package/cjs/page/Signer.js +11 -11
- package/cjs/page/index.js +6 -13
- package/cjs/signers/substrates/LedgerSigner.js +1 -7
- package/cjs/signers/substrates/QrSigner.js +1 -10
- package/cjs/signers/web3/QrSigner.js +1 -12
- package/cjs/stores/Accounts.js +1 -8
- package/cjs/stores/Base.js +1 -15
- package/cjs/stores/Metadata.js +1 -6
- package/cjs/stores/index.js +0 -3
- package/cjs/utils/canDerive.js +1 -1
- package/cjs/utils/getId.js +1 -3
- package/cjs/utils/index.js +0 -1
- package/defaults.d.ts +1 -2
- package/defaults.js +2 -2
- package/detectOther.js +1 -0
- package/detectPackage.js +2 -0
- package/errors/SubWalletProviderError.js +1 -1
- package/index.js +2 -0
- package/package.json +5 -5
- package/packageInfo.js +3 -1
- package/page/Accounts.js +3 -4
- package/page/Injected.js +1 -1
- package/page/Metadata.js +1 -3
- package/page/PostMessageProvider.js +22 -33
- package/page/Signer.js +11 -9
- package/page/index.js +8 -6
- package/signers/substrates/LedgerSigner.js +1 -3
- package/signers/substrates/QrSigner.js +1 -5
- package/signers/web3/QrSigner.js +1 -5
- package/stores/Accounts.js +1 -3
- package/stores/Base.js +1 -13
- package/stores/Metadata.js +1 -1
- package/stores/index.js +1 -0
- package/utils/canDerive.js +1 -0
- package/utils/getId.js +1 -0
- package/utils/index.js +1 -0
|
@@ -21,7 +21,7 @@ export interface ServiceInfo {
|
|
|
21
21
|
isLock?: boolean;
|
|
22
22
|
currentAccountInfo: CurrentAccountInfo;
|
|
23
23
|
chainRegistry: Record<string, ChainRegistry>;
|
|
24
|
-
|
|
24
|
+
customNftRegistry: CustomToken[];
|
|
25
25
|
}
|
|
26
26
|
export declare enum ApiInitStatus {
|
|
27
27
|
SUCCESS = 0,
|
|
@@ -139,8 +139,10 @@ export interface NftItem {
|
|
|
139
139
|
description?: string;
|
|
140
140
|
properties?: Record<any, any> | null;
|
|
141
141
|
chain?: string;
|
|
142
|
+
type?: CustomTokenType.erc721 | CustomTokenType.psp34 | RMRK_VER;
|
|
142
143
|
rmrk_ver?: RMRK_VER;
|
|
143
144
|
owner?: string;
|
|
145
|
+
onChainOption?: any;
|
|
144
146
|
}
|
|
145
147
|
export interface NftCollection {
|
|
146
148
|
collectionId: string;
|
|
@@ -248,6 +250,10 @@ export interface NetWorkInfo {
|
|
|
248
250
|
crowdloanUrl?: string;
|
|
249
251
|
decimals?: number;
|
|
250
252
|
}
|
|
253
|
+
export declare enum ContractType {
|
|
254
|
+
wasm = "wasm",
|
|
255
|
+
evm = "evm"
|
|
256
|
+
}
|
|
251
257
|
export interface NetworkJson {
|
|
252
258
|
key: string;
|
|
253
259
|
chain: string;
|
|
@@ -275,6 +281,7 @@ export interface NetworkJson {
|
|
|
275
281
|
dependencies?: string[];
|
|
276
282
|
getStakingOnChain?: boolean;
|
|
277
283
|
supportBonding?: boolean;
|
|
284
|
+
supportSmartContract?: ContractType[];
|
|
278
285
|
apiStatus?: NETWORK_STATUS;
|
|
279
286
|
requestId?: string;
|
|
280
287
|
}
|
|
@@ -318,13 +325,14 @@ export declare type TokenInfo = {
|
|
|
318
325
|
isMainToken: boolean;
|
|
319
326
|
symbol: string;
|
|
320
327
|
symbolAlt?: string;
|
|
321
|
-
|
|
322
|
-
|
|
328
|
+
contractAddress?: string;
|
|
329
|
+
type?: CustomTokenType;
|
|
323
330
|
decimals: number;
|
|
324
331
|
name: string;
|
|
325
332
|
coinGeckoKey?: string;
|
|
326
333
|
specialOption?: object;
|
|
327
334
|
assetId?: string;
|
|
335
|
+
assetIndex?: number | string;
|
|
328
336
|
};
|
|
329
337
|
export interface AccountsWithCurrentAddress {
|
|
330
338
|
accounts: AccountJson[];
|
|
@@ -403,6 +411,7 @@ export interface RequestCheckPublicAndSecretKey {
|
|
|
403
411
|
export interface ResponseCheckPublicAndSecretKey {
|
|
404
412
|
address: string;
|
|
405
413
|
isValid: boolean;
|
|
414
|
+
isEthereum: boolean;
|
|
406
415
|
}
|
|
407
416
|
export interface RequestSeedCreateV2 {
|
|
408
417
|
length?: SeedLengths;
|
|
@@ -605,7 +614,7 @@ export interface ResponseTransferQr extends ResponseTransferExternal {
|
|
|
605
614
|
export interface ResponseTransferLedger extends ResponseTransferExternal {
|
|
606
615
|
ledgerState?: LedgerState;
|
|
607
616
|
}
|
|
608
|
-
export interface
|
|
617
|
+
export interface NftTransactionRequest {
|
|
609
618
|
networkKey: string;
|
|
610
619
|
senderAddress: string;
|
|
611
620
|
recipientAddress: string;
|
|
@@ -650,36 +659,46 @@ export interface DisableNetworkResponse {
|
|
|
650
659
|
success: boolean;
|
|
651
660
|
activeNetworkCount?: number;
|
|
652
661
|
}
|
|
653
|
-
export
|
|
654
|
-
|
|
662
|
+
export declare enum CustomTokenType {
|
|
663
|
+
erc20 = "erc20",
|
|
664
|
+
erc721 = "erc721",
|
|
665
|
+
psp22 = "psp22",
|
|
666
|
+
psp34 = "psp34"
|
|
667
|
+
}
|
|
668
|
+
export interface CustomToken {
|
|
655
669
|
smartContract: string;
|
|
670
|
+
chain: string;
|
|
671
|
+
type: CustomTokenType;
|
|
672
|
+
name?: string;
|
|
656
673
|
symbol?: string;
|
|
657
674
|
decimals?: number;
|
|
658
|
-
chain: string;
|
|
659
|
-
type: 'erc20' | 'erc721';
|
|
660
675
|
isCustom?: boolean;
|
|
661
676
|
isDeleted?: boolean;
|
|
662
677
|
image?: string;
|
|
663
678
|
}
|
|
664
|
-
export interface
|
|
665
|
-
erc20:
|
|
666
|
-
erc721:
|
|
679
|
+
export interface CustomTokenJson {
|
|
680
|
+
[CustomTokenType.erc20]: CustomToken[];
|
|
681
|
+
[CustomTokenType.erc721]: CustomToken[];
|
|
682
|
+
[CustomTokenType.psp22]: CustomToken[];
|
|
683
|
+
[CustomTokenType.psp34]: CustomToken[];
|
|
667
684
|
}
|
|
668
|
-
export interface
|
|
685
|
+
export interface DeleteCustomTokenParams {
|
|
669
686
|
smartContract: string;
|
|
670
687
|
chain: string;
|
|
671
|
-
type:
|
|
688
|
+
type: CustomTokenType;
|
|
672
689
|
}
|
|
673
|
-
export interface
|
|
690
|
+
export interface ValidateCustomTokenRequest {
|
|
674
691
|
smartContract: string;
|
|
675
692
|
chain: string;
|
|
676
|
-
type:
|
|
693
|
+
type: CustomTokenType;
|
|
694
|
+
contractCaller?: string;
|
|
677
695
|
}
|
|
678
|
-
export interface
|
|
696
|
+
export interface ValidateCustomTokenResponse {
|
|
679
697
|
name: string;
|
|
680
698
|
symbol: string;
|
|
681
699
|
decimals?: number;
|
|
682
700
|
isExist: boolean;
|
|
701
|
+
contractError: boolean;
|
|
683
702
|
}
|
|
684
703
|
export interface SupportTransferResponse {
|
|
685
704
|
supportTransfer: boolean;
|
|
@@ -705,12 +724,6 @@ export interface RequestTransferExistentialDeposit {
|
|
|
705
724
|
export interface RequestSaveRecentAccount {
|
|
706
725
|
accountId: string;
|
|
707
726
|
}
|
|
708
|
-
export interface SubstrateNftTransactionRequest {
|
|
709
|
-
params: Record<string, any>;
|
|
710
|
-
senderAddress: string;
|
|
711
|
-
recipientAddress: string;
|
|
712
|
-
networkKey: string;
|
|
713
|
-
}
|
|
714
727
|
export interface SubstrateNftTransaction {
|
|
715
728
|
error: boolean;
|
|
716
729
|
estimatedFee?: string;
|
|
@@ -785,6 +798,7 @@ export interface RequestAccountCreateWithSecretKey {
|
|
|
785
798
|
password: string;
|
|
786
799
|
name: string;
|
|
787
800
|
isAllow: boolean;
|
|
801
|
+
isEthereum: boolean;
|
|
788
802
|
}
|
|
789
803
|
export interface ResponseAccountCreateWithSecretKey {
|
|
790
804
|
errors: AccountExternalError[];
|
|
@@ -876,7 +890,7 @@ export interface EvmSignatureRequestQr extends EvmSignatureRequest, EvmRequestQr
|
|
|
876
890
|
}
|
|
877
891
|
export interface ConfirmationDefinitions {
|
|
878
892
|
addNetworkRequest: [ConfirmationsQueueItem<NetworkJson>, ConfirmationResult<NetworkJson>];
|
|
879
|
-
addTokenRequest: [ConfirmationsQueueItem<
|
|
893
|
+
addTokenRequest: [ConfirmationsQueueItem<CustomToken>, ConfirmationResult<boolean>];
|
|
880
894
|
switchNetworkRequest: [ConfirmationsQueueItem<SwitchNetworkRequest>, ConfirmationResult<boolean>];
|
|
881
895
|
evmSignatureRequest: [ConfirmationsQueueItem<EvmSignatureRequest>, ConfirmationResult<string>];
|
|
882
896
|
evmSignatureRequestQr: [ConfirmationsQueueItem<EvmSignatureRequestQr>, ConfirmationResultQr<string>];
|
|
@@ -1118,7 +1132,7 @@ export interface TuringStakeCompoundResp {
|
|
|
1118
1132
|
}
|
|
1119
1133
|
export interface TransakNetwork {
|
|
1120
1134
|
networks: string[];
|
|
1121
|
-
tokens
|
|
1135
|
+
tokens?: string[];
|
|
1122
1136
|
}
|
|
1123
1137
|
export interface CheckExistingTuringCompoundParams {
|
|
1124
1138
|
address: string;
|
|
@@ -1137,26 +1151,6 @@ export interface TuringCancelStakeCompoundParams {
|
|
|
1137
1151
|
address: string;
|
|
1138
1152
|
password?: string;
|
|
1139
1153
|
}
|
|
1140
|
-
export declare type SubscriptionServiceType = 'chainRegistry' | 'balance' | 'crowdloan' | 'staking';
|
|
1141
|
-
export declare type CronServiceType = 'price' | 'nft' | 'staking' | 'history' | 'recoverApi' | 'checkApiStatus';
|
|
1142
|
-
export declare type CronType = 'recoverApiMap' | 'checkApiMapStatus' | 'refreshHistory' | 'refreshNft' | 'refreshPrice' | 'refreshStakeUnlockingInfo' | 'refreshStakingReward';
|
|
1143
|
-
export interface RequestInitCronAndSubscription {
|
|
1144
|
-
subscription: {
|
|
1145
|
-
activeServices: SubscriptionServiceType[];
|
|
1146
|
-
};
|
|
1147
|
-
cron: {
|
|
1148
|
-
intervalMap: Partial<Record<CronType, number>>;
|
|
1149
|
-
activeServices: CronServiceType[];
|
|
1150
|
-
};
|
|
1151
|
-
}
|
|
1152
|
-
export interface RequestCronAndSubscriptionAction {
|
|
1153
|
-
subscriptionServices: SubscriptionServiceType[];
|
|
1154
|
-
cronServices: CronServiceType[];
|
|
1155
|
-
}
|
|
1156
|
-
export interface ActiveCronAndSubscriptionMap {
|
|
1157
|
-
subscription: Record<SubscriptionServiceType, boolean>;
|
|
1158
|
-
cron: Record<CronServiceType, boolean>;
|
|
1159
|
-
}
|
|
1160
1154
|
export interface KoniRequestSignatures {
|
|
1161
1155
|
'pri(staking.submitTuringCancelCompound)': [TuringCancelStakeCompoundParams, BasicTxResponse, BasicTxResponse];
|
|
1162
1156
|
'pri(staking.turingCancelCompound)': [TuringCancelStakeCompoundParams, BasicTxInfo];
|
|
@@ -1176,8 +1170,6 @@ export interface KoniRequestSignatures {
|
|
|
1176
1170
|
'pri(bonding.getChainBondingBasics)': [NetworkJson[], Record<string, ChainBondingBasics>, Record<string, ChainBondingBasics>];
|
|
1177
1171
|
'pri(bonding.getBondingOptions)': [BondingOptionParams, BondingOptionInfo];
|
|
1178
1172
|
'pri(networkMap.recoverDotSama)': [string, boolean];
|
|
1179
|
-
'pri(substrateNft.submitTransaction)': [SubstrateNftSubmitTransaction, NftTransactionResponse, NftTransactionResponse];
|
|
1180
|
-
'pri(substrateNft.getTransaction)': [SubstrateNftTransactionRequest, SubstrateNftTransaction];
|
|
1181
1173
|
'pri(networkMap.disableAll)': [null, boolean];
|
|
1182
1174
|
'pri(networkMap.enableAll)': [null, boolean];
|
|
1183
1175
|
'pri(networkMap.resetDefault)': [null, boolean];
|
|
@@ -1190,25 +1182,28 @@ export interface KoniRequestSignatures {
|
|
|
1190
1182
|
'pri(networkMap.upsert)': [NetworkJson, boolean];
|
|
1191
1183
|
'pri(networkMap.getNetworkMap)': [null, Record<string, NetworkJson>];
|
|
1192
1184
|
'pri(networkMap.getSubscription)': [null, Record<string, NetworkJson>, Record<string, NetworkJson>];
|
|
1193
|
-
'pri(
|
|
1194
|
-
'pri(
|
|
1195
|
-
'pri(
|
|
1196
|
-
'pri(
|
|
1197
|
-
'pri(
|
|
1185
|
+
'pri(customTokenState.validateCustomToken)': [ValidateCustomTokenRequest, ValidateCustomTokenResponse];
|
|
1186
|
+
'pri(customTokenState.deleteMany)': [DeleteCustomTokenParams[], boolean];
|
|
1187
|
+
'pri(customTokenState.upsertCustomTokenState)': [CustomToken, boolean];
|
|
1188
|
+
'pri(customTokenState.getCustomTokenState)': [null, CustomTokenJson];
|
|
1189
|
+
'pri(customTokenState.getSubscription)': [null, CustomTokenJson, CustomTokenJson];
|
|
1198
1190
|
'pri(evmNft.submitTransaction)': [EvmNftSubmitTransaction, NftTransactionResponse, NftTransactionResponse];
|
|
1199
|
-
'pri(evmNft.getTransaction)': [
|
|
1191
|
+
'pri(evmNft.getTransaction)': [NftTransactionRequest, EvmNftTransaction];
|
|
1192
|
+
'pri(substrateNft.submitTransaction)': [SubstrateNftSubmitTransaction, NftTransactionResponse, NftTransactionResponse];
|
|
1193
|
+
'pri(substrateNft.getTransaction)': [NftTransactionRequest, SubstrateNftTransaction];
|
|
1200
1194
|
'pri(nftTransfer.setNftTransfer)': [NftTransferExtra, boolean];
|
|
1201
1195
|
'pri(nftTransfer.getNftTransfer)': [null, NftTransferExtra];
|
|
1202
1196
|
'pri(nftTransfer.getSubscription)': [null, NftTransferExtra, NftTransferExtra];
|
|
1203
1197
|
'pri(nft.forceUpdate)': [RequestNftForceUpdate, boolean];
|
|
1204
|
-
'pri(staking.getStaking)': [null, StakingJson];
|
|
1205
|
-
'pri(staking.getSubscription)': [RequestSubscribeStaking, StakingJson, StakingJson];
|
|
1206
|
-
'pri(stakingReward.getStakingReward)': [null, StakingRewardJson];
|
|
1207
|
-
'pri(stakingReward.getSubscription)': [RequestSubscribeStakingReward, StakingRewardJson, StakingRewardJson];
|
|
1208
1198
|
'pri(nft.getNft)': [null, NftJson];
|
|
1209
1199
|
'pri(nft.getSubscription)': [RequestSubscribeNft, NftJson, NftJson];
|
|
1210
1200
|
'pri(nftCollection.getNftCollection)': [null, NftCollectionJson];
|
|
1211
1201
|
'pri(nftCollection.getSubscription)': [null, NftCollection[], NftCollection[]];
|
|
1202
|
+
'pri(wasmNft.getTransaction)': [NftTransactionRequest, SubstrateNftTransaction];
|
|
1203
|
+
'pri(staking.getStaking)': [null, StakingJson];
|
|
1204
|
+
'pri(staking.getSubscription)': [RequestSubscribeStaking, StakingJson, StakingJson];
|
|
1205
|
+
'pri(stakingReward.getStakingReward)': [null, StakingRewardJson];
|
|
1206
|
+
'pri(stakingReward.getSubscription)': [RequestSubscribeStakingReward, StakingRewardJson, StakingRewardJson];
|
|
1212
1207
|
'pri(price.getPrice)': [RequestPrice, PriceJson];
|
|
1213
1208
|
'pri(price.getSubscription)': [RequestSubscribePrice, PriceJson, PriceJson];
|
|
1214
1209
|
'pri(balance.getBalance)': [RequestBalance, BalanceJson];
|
|
@@ -1291,17 +1286,6 @@ export interface KoniRequestSignatures {
|
|
|
1291
1286
|
'pri(unStake.ledger.create)': [RequestUnStakeExternal, Array<BaseTxError>, ResponseUnStakeLedger];
|
|
1292
1287
|
'pri(withdrawStake.ledger.create)': [RequestWithdrawStakeExternal, Array<BaseTxError>, ResponseWithdrawStakeLedger];
|
|
1293
1288
|
'pri(authorize.subscribe)': [null, AuthUrls, AuthUrls];
|
|
1294
|
-
'mobile(cronAndSubscription.init)': [RequestInitCronAndSubscription, ActiveCronAndSubscriptionMap];
|
|
1295
|
-
'mobile(cronAndSubscription.activeService.subscribe)': [null, ActiveCronAndSubscriptionMap, ActiveCronAndSubscriptionMap];
|
|
1296
|
-
'mobile(cronAndSubscription.start)': [RequestCronAndSubscriptionAction[], void];
|
|
1297
|
-
'mobile(cronAndSubscription.stop)': [RequestCronAndSubscriptionAction[], void];
|
|
1298
|
-
'mobile(cronAndSubscription.restart)': [RequestCronAndSubscriptionAction[], void];
|
|
1299
|
-
'mobile(cron.start)': [CronServiceType[], void];
|
|
1300
|
-
'mobile(cron.stop)': [CronServiceType[], void];
|
|
1301
|
-
'mobile(cron.restart)': [CronServiceType[], void];
|
|
1302
|
-
'mobile(subscription.start)': [SubscriptionServiceType[], void];
|
|
1303
|
-
'mobile(subscription.stop)': [SubscriptionServiceType[], void];
|
|
1304
|
-
'mobile(subscription.restart)': [SubscriptionServiceType[], void];
|
|
1305
1289
|
}
|
|
1306
1290
|
export interface ApplicationMetadataType {
|
|
1307
1291
|
version: string;
|
package/background/KoniTypes.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
// Copyright 2019-2022 @polkadot/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
export let ApiInitStatus;
|
|
4
3
|
|
|
4
|
+
export let ApiInitStatus;
|
|
5
5
|
(function (ApiInitStatus) {
|
|
6
6
|
ApiInitStatus[ApiInitStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
7
7
|
ApiInitStatus[ApiInitStatus["ALREADY_EXIST"] = 1] = "ALREADY_EXIST";
|
|
8
8
|
ApiInitStatus[ApiInitStatus["NOT_SUPPORT"] = 2] = "NOT_SUPPORT";
|
|
9
9
|
ApiInitStatus[ApiInitStatus["NOT_EXIST"] = 3] = "NOT_EXIST";
|
|
10
10
|
})(ApiInitStatus || (ApiInitStatus = {}));
|
|
11
|
-
|
|
12
11
|
export let APIItemState;
|
|
13
|
-
|
|
14
12
|
(function (APIItemState) {
|
|
15
13
|
APIItemState["PENDING"] = "pending";
|
|
16
14
|
APIItemState["READY"] = "ready";
|
|
@@ -18,24 +16,23 @@ export let APIItemState;
|
|
|
18
16
|
APIItemState["ERROR"] = "error";
|
|
19
17
|
APIItemState["NOT_SUPPORT"] = "not_support";
|
|
20
18
|
})(APIItemState || (APIItemState = {}));
|
|
21
|
-
|
|
22
19
|
export let RMRK_VER;
|
|
23
|
-
|
|
24
20
|
(function (RMRK_VER) {
|
|
25
21
|
RMRK_VER["VER_1"] = "1.0.0";
|
|
26
22
|
RMRK_VER["VER_2"] = "2.0.0";
|
|
27
23
|
})(RMRK_VER || (RMRK_VER = {}));
|
|
28
|
-
|
|
29
24
|
export let CrowdloanParaState;
|
|
30
|
-
|
|
31
25
|
(function (CrowdloanParaState) {
|
|
32
26
|
CrowdloanParaState["ONGOING"] = "ongoing";
|
|
33
27
|
CrowdloanParaState["COMPLETED"] = "completed";
|
|
34
28
|
CrowdloanParaState["FAILED"] = "failed";
|
|
35
29
|
})(CrowdloanParaState || (CrowdloanParaState = {}));
|
|
36
|
-
|
|
30
|
+
export let ContractType;
|
|
31
|
+
(function (ContractType) {
|
|
32
|
+
ContractType["wasm"] = "wasm";
|
|
33
|
+
ContractType["evm"] = "evm";
|
|
34
|
+
})(ContractType || (ContractType = {}));
|
|
37
35
|
export let NETWORK_ERROR;
|
|
38
|
-
|
|
39
36
|
(function (NETWORK_ERROR) {
|
|
40
37
|
NETWORK_ERROR["INVALID_INFO_TYPE"] = "invalidInfoType";
|
|
41
38
|
NETWORK_ERROR["INJECT_SCRIPT_DETECTED"] = "injectScriptDetected";
|
|
@@ -46,18 +43,14 @@ export let NETWORK_ERROR;
|
|
|
46
43
|
NETWORK_ERROR["CONNECTION_FAILURE"] = "connectionFailure";
|
|
47
44
|
NETWORK_ERROR["PROVIDER_NOT_SAME_NETWORK"] = "providerNotSameNetwork";
|
|
48
45
|
})(NETWORK_ERROR || (NETWORK_ERROR = {}));
|
|
49
|
-
|
|
50
46
|
export let NETWORK_STATUS;
|
|
51
|
-
|
|
52
47
|
(function (NETWORK_STATUS) {
|
|
53
48
|
NETWORK_STATUS["CONNECTED"] = "connected";
|
|
54
49
|
NETWORK_STATUS["CONNECTING"] = "connecting";
|
|
55
50
|
NETWORK_STATUS["DISCONNECTED"] = "disconnected";
|
|
56
51
|
NETWORK_STATUS["PENDING"] = "pending";
|
|
57
52
|
})(NETWORK_STATUS || (NETWORK_STATUS = {}));
|
|
58
|
-
|
|
59
53
|
export let TransferErrorCode;
|
|
60
|
-
|
|
61
54
|
(function (TransferErrorCode) {
|
|
62
55
|
TransferErrorCode["INVALID_FROM_ADDRESS"] = "invalidFromAccount";
|
|
63
56
|
TransferErrorCode["INVALID_TO_ADDRESS"] = "invalidToAccount";
|
|
@@ -70,9 +63,7 @@ export let TransferErrorCode;
|
|
|
70
63
|
TransferErrorCode["TIMEOUT"] = "timeout";
|
|
71
64
|
TransferErrorCode["UNSUPPORTED"] = "unsupported";
|
|
72
65
|
})(TransferErrorCode || (TransferErrorCode = {}));
|
|
73
|
-
|
|
74
66
|
export let BasicTxErrorCode;
|
|
75
|
-
|
|
76
67
|
(function (BasicTxErrorCode) {
|
|
77
68
|
BasicTxErrorCode["INVALID_FROM_ADDRESS"] = "invalidFromAccount";
|
|
78
69
|
BasicTxErrorCode["INVALID_TO_ADDRESS"] = "invalidToAccount";
|
|
@@ -88,9 +79,7 @@ export let BasicTxErrorCode;
|
|
|
88
79
|
BasicTxErrorCode["TIMEOUT"] = "timeout";
|
|
89
80
|
BasicTxErrorCode["UNSUPPORTED"] = "unsupported";
|
|
90
81
|
})(BasicTxErrorCode || (BasicTxErrorCode = {}));
|
|
91
|
-
|
|
92
82
|
export let TransferStep;
|
|
93
|
-
|
|
94
83
|
(function (TransferStep) {
|
|
95
84
|
TransferStep["READY"] = "ready";
|
|
96
85
|
TransferStep["SIGNING"] = "signing";
|
|
@@ -99,26 +88,27 @@ export let TransferStep;
|
|
|
99
88
|
TransferStep["SUCCESS"] = "success";
|
|
100
89
|
TransferStep["ERROR"] = "error";
|
|
101
90
|
})(TransferStep || (TransferStep = {}));
|
|
102
|
-
|
|
91
|
+
export let CustomTokenType;
|
|
92
|
+
(function (CustomTokenType) {
|
|
93
|
+
CustomTokenType["erc20"] = "erc20";
|
|
94
|
+
CustomTokenType["erc721"] = "erc721";
|
|
95
|
+
CustomTokenType["psp22"] = "psp22";
|
|
96
|
+
CustomTokenType["psp34"] = "psp34";
|
|
97
|
+
})(CustomTokenType || (CustomTokenType = {}));
|
|
103
98
|
export let ExternalRequestPromiseStatus;
|
|
104
|
-
|
|
105
99
|
(function (ExternalRequestPromiseStatus) {
|
|
106
100
|
ExternalRequestPromiseStatus[ExternalRequestPromiseStatus["PENDING"] = 0] = "PENDING";
|
|
107
101
|
ExternalRequestPromiseStatus[ExternalRequestPromiseStatus["REJECTED"] = 1] = "REJECTED";
|
|
108
102
|
ExternalRequestPromiseStatus[ExternalRequestPromiseStatus["FAILED"] = 2] = "FAILED";
|
|
109
103
|
ExternalRequestPromiseStatus[ExternalRequestPromiseStatus["COMPLETED"] = 3] = "COMPLETED";
|
|
110
104
|
})(ExternalRequestPromiseStatus || (ExternalRequestPromiseStatus = {}));
|
|
111
|
-
|
|
112
105
|
export let AccountExternalErrorCode;
|
|
113
|
-
|
|
114
106
|
(function (AccountExternalErrorCode) {
|
|
115
107
|
AccountExternalErrorCode["INVALID_ADDRESS"] = "invalidToAccount";
|
|
116
108
|
AccountExternalErrorCode["KEYRING_ERROR"] = "keyringError";
|
|
117
109
|
AccountExternalErrorCode["UNKNOWN_ERROR"] = "unknownError";
|
|
118
110
|
})(AccountExternalErrorCode || (AccountExternalErrorCode = {}));
|
|
119
|
-
|
|
120
111
|
export let BasicTxError;
|
|
121
|
-
|
|
122
112
|
(function (BasicTxError) {
|
|
123
113
|
BasicTxError["BalanceTooLow"] = "BalanceTooLow";
|
|
124
114
|
})(BasicTxError || (BasicTxError = {}));
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
3
4
|
import { wrapBytes } from '@subwallet/extension-dapp/wrapBytes';
|
|
4
5
|
import { u8aToHex } from '@polkadot/util';
|
|
5
6
|
export default class RequestBytesSign {
|
|
6
7
|
constructor(payload) {
|
|
7
8
|
this.payload = payload;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
10
|
sign(_registry, pair) {
|
|
11
11
|
return {
|
|
12
12
|
signature: u8aToHex(pair.sign(wrapBytes(this.payload.data)))
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
3
4
|
export default class RequestExtrinsicSign {
|
|
4
5
|
constructor(payload) {
|
|
5
6
|
this.payload = payload;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
8
|
sign(registry, pair) {
|
|
9
9
|
return registry.createType('ExtrinsicPayload', this.payload, {
|
|
10
10
|
version: this.payload.version
|
|
11
11
|
}).sign(pair);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
13
|
}
|