@subwallet/extension-base 0.6.7-1 → 0.6.7-2
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 +64 -22
- 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 +1 -0
- 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.js +1 -0
- package/detectOther.js +1 -0
- package/detectPackage.js +2 -0
- package/errors/SubWalletProviderError.js +1 -1
- package/index.js +2 -0
- package/package.json +4 -4
- 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,6 +139,7 @@ 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;
|
|
144
145
|
}
|
|
@@ -226,6 +227,7 @@ export interface ApiProps extends ApiState {
|
|
|
226
227
|
isApiReadyOnce: boolean;
|
|
227
228
|
isApiConnected: boolean;
|
|
228
229
|
isEthereum: boolean;
|
|
230
|
+
isEthereumOnly: boolean;
|
|
229
231
|
isApiInitialized: boolean;
|
|
230
232
|
isReady: Promise<ApiProps>;
|
|
231
233
|
apiRetry?: number;
|
|
@@ -247,6 +249,10 @@ export interface NetWorkInfo {
|
|
|
247
249
|
crowdloanUrl?: string;
|
|
248
250
|
decimals?: number;
|
|
249
251
|
}
|
|
252
|
+
export declare enum ContractType {
|
|
253
|
+
wasm = "wasm",
|
|
254
|
+
evm = "evm"
|
|
255
|
+
}
|
|
250
256
|
export interface NetworkJson {
|
|
251
257
|
key: string;
|
|
252
258
|
chain: string;
|
|
@@ -274,6 +280,7 @@ export interface NetworkJson {
|
|
|
274
280
|
dependencies?: string[];
|
|
275
281
|
getStakingOnChain?: boolean;
|
|
276
282
|
supportBonding?: boolean;
|
|
283
|
+
supportSmartContract?: ContractType[];
|
|
277
284
|
apiStatus?: NETWORK_STATUS;
|
|
278
285
|
requestId?: string;
|
|
279
286
|
}
|
|
@@ -317,13 +324,14 @@ export declare type TokenInfo = {
|
|
|
317
324
|
isMainToken: boolean;
|
|
318
325
|
symbol: string;
|
|
319
326
|
symbolAlt?: string;
|
|
320
|
-
|
|
321
|
-
|
|
327
|
+
contractAddress?: string;
|
|
328
|
+
type?: CustomTokenType;
|
|
322
329
|
decimals: number;
|
|
323
330
|
name: string;
|
|
324
331
|
coinGeckoKey?: string;
|
|
325
332
|
specialOption?: object;
|
|
326
333
|
assetId?: string;
|
|
334
|
+
assetIndex?: number | string;
|
|
327
335
|
};
|
|
328
336
|
export interface AccountsWithCurrentAddress {
|
|
329
337
|
accounts: AccountJson[];
|
|
@@ -393,6 +401,16 @@ export interface RequestAccountExportPrivateKey {
|
|
|
393
401
|
}
|
|
394
402
|
export interface ResponseAccountExportPrivateKey {
|
|
395
403
|
privateKey: string;
|
|
404
|
+
publicKey: string;
|
|
405
|
+
}
|
|
406
|
+
export interface RequestCheckPublicAndSecretKey {
|
|
407
|
+
secretKey: string;
|
|
408
|
+
publicKey: string;
|
|
409
|
+
}
|
|
410
|
+
export interface ResponseCheckPublicAndSecretKey {
|
|
411
|
+
address: string;
|
|
412
|
+
isValid: boolean;
|
|
413
|
+
isEthereum: boolean;
|
|
396
414
|
}
|
|
397
415
|
export interface RequestSeedCreateV2 {
|
|
398
416
|
length?: SeedLengths;
|
|
@@ -640,36 +658,46 @@ export interface DisableNetworkResponse {
|
|
|
640
658
|
success: boolean;
|
|
641
659
|
activeNetworkCount?: number;
|
|
642
660
|
}
|
|
643
|
-
export
|
|
644
|
-
|
|
661
|
+
export declare enum CustomTokenType {
|
|
662
|
+
erc20 = "erc20",
|
|
663
|
+
erc721 = "erc721",
|
|
664
|
+
psp22 = "psp22",
|
|
665
|
+
psp34 = "psp34"
|
|
666
|
+
}
|
|
667
|
+
export interface CustomToken {
|
|
645
668
|
smartContract: string;
|
|
669
|
+
chain: string;
|
|
670
|
+
type: CustomTokenType;
|
|
671
|
+
name?: string;
|
|
646
672
|
symbol?: string;
|
|
647
673
|
decimals?: number;
|
|
648
|
-
chain: string;
|
|
649
|
-
type: 'erc20' | 'erc721';
|
|
650
674
|
isCustom?: boolean;
|
|
651
675
|
isDeleted?: boolean;
|
|
652
676
|
image?: string;
|
|
653
677
|
}
|
|
654
|
-
export interface
|
|
655
|
-
erc20:
|
|
656
|
-
erc721:
|
|
678
|
+
export interface CustomTokenJson {
|
|
679
|
+
[CustomTokenType.erc20]: CustomToken[];
|
|
680
|
+
[CustomTokenType.erc721]: CustomToken[];
|
|
681
|
+
[CustomTokenType.psp22]: CustomToken[];
|
|
682
|
+
[CustomTokenType.psp34]: CustomToken[];
|
|
657
683
|
}
|
|
658
|
-
export interface
|
|
684
|
+
export interface DeleteCustomTokenParams {
|
|
659
685
|
smartContract: string;
|
|
660
686
|
chain: string;
|
|
661
|
-
type:
|
|
687
|
+
type: CustomTokenType;
|
|
662
688
|
}
|
|
663
|
-
export interface
|
|
689
|
+
export interface ValidateCustomTokenRequest {
|
|
664
690
|
smartContract: string;
|
|
665
691
|
chain: string;
|
|
666
|
-
type:
|
|
692
|
+
type: CustomTokenType;
|
|
693
|
+
contractCaller?: string;
|
|
667
694
|
}
|
|
668
|
-
export interface
|
|
695
|
+
export interface ValidateCustomTokenResponse {
|
|
669
696
|
name: string;
|
|
670
697
|
symbol: string;
|
|
671
698
|
decimals?: number;
|
|
672
699
|
isExist: boolean;
|
|
700
|
+
contractError: boolean;
|
|
673
701
|
}
|
|
674
702
|
export interface SupportTransferResponse {
|
|
675
703
|
supportTransfer: boolean;
|
|
@@ -769,6 +797,18 @@ export interface AccountExternalError {
|
|
|
769
797
|
code: AccountExternalErrorCode;
|
|
770
798
|
message: string;
|
|
771
799
|
}
|
|
800
|
+
export interface RequestAccountCreateWithSecretKey {
|
|
801
|
+
publicKey: string;
|
|
802
|
+
secretKey: string;
|
|
803
|
+
password: string;
|
|
804
|
+
name: string;
|
|
805
|
+
isAllow: boolean;
|
|
806
|
+
isEthereum: boolean;
|
|
807
|
+
}
|
|
808
|
+
export interface ResponseAccountCreateWithSecretKey {
|
|
809
|
+
errors: AccountExternalError[];
|
|
810
|
+
success: boolean;
|
|
811
|
+
}
|
|
772
812
|
export declare type RequestEvmEvents = null;
|
|
773
813
|
export declare type EvmEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'chainChanged' | 'message' | 'data' | 'reconnect' | 'error';
|
|
774
814
|
export declare type EvmAccountsChangedPayload = string[];
|
|
@@ -855,7 +895,7 @@ export interface EvmSignatureRequestQr extends EvmSignatureRequest, EvmRequestQr
|
|
|
855
895
|
}
|
|
856
896
|
export interface ConfirmationDefinitions {
|
|
857
897
|
addNetworkRequest: [ConfirmationsQueueItem<NetworkJson>, ConfirmationResult<NetworkJson>];
|
|
858
|
-
addTokenRequest: [ConfirmationsQueueItem<
|
|
898
|
+
addTokenRequest: [ConfirmationsQueueItem<CustomToken>, ConfirmationResult<boolean>];
|
|
859
899
|
switchNetworkRequest: [ConfirmationsQueueItem<SwitchNetworkRequest>, ConfirmationResult<boolean>];
|
|
860
900
|
evmSignatureRequest: [ConfirmationsQueueItem<EvmSignatureRequest>, ConfirmationResult<string>];
|
|
861
901
|
evmSignatureRequestQr: [ConfirmationsQueueItem<EvmSignatureRequestQr>, ConfirmationResultQr<string>];
|
|
@@ -1097,7 +1137,7 @@ export interface TuringStakeCompoundResp {
|
|
|
1097
1137
|
}
|
|
1098
1138
|
export interface TransakNetwork {
|
|
1099
1139
|
networks: string[];
|
|
1100
|
-
tokens
|
|
1140
|
+
tokens?: string[];
|
|
1101
1141
|
}
|
|
1102
1142
|
export interface CheckExistingTuringCompoundParams {
|
|
1103
1143
|
address: string;
|
|
@@ -1149,11 +1189,11 @@ export interface KoniRequestSignatures {
|
|
|
1149
1189
|
'pri(networkMap.upsert)': [NetworkJson, boolean];
|
|
1150
1190
|
'pri(networkMap.getNetworkMap)': [null, Record<string, NetworkJson>];
|
|
1151
1191
|
'pri(networkMap.getSubscription)': [null, Record<string, NetworkJson>, Record<string, NetworkJson>];
|
|
1152
|
-
'pri(
|
|
1153
|
-
'pri(
|
|
1154
|
-
'pri(
|
|
1155
|
-
'pri(
|
|
1156
|
-
'pri(
|
|
1192
|
+
'pri(customTokenState.validateCustomToken)': [ValidateCustomTokenRequest, ValidateCustomTokenResponse];
|
|
1193
|
+
'pri(customTokenState.deleteMany)': [DeleteCustomTokenParams[], boolean];
|
|
1194
|
+
'pri(customTokenState.upsertCustomTokenState)': [CustomToken, boolean];
|
|
1195
|
+
'pri(customTokenState.getCustomTokenState)': [null, CustomTokenJson];
|
|
1196
|
+
'pri(customTokenState.getSubscription)': [null, CustomTokenJson, CustomTokenJson];
|
|
1157
1197
|
'pri(evmNft.submitTransaction)': [EvmNftSubmitTransaction, NftTransactionResponse, NftTransactionResponse];
|
|
1158
1198
|
'pri(evmNft.getTransaction)': [EvmNftTransactionRequest, EvmNftTransaction];
|
|
1159
1199
|
'pri(nftTransfer.setNftTransfer)': [NftTransferExtra, boolean];
|
|
@@ -1192,6 +1232,7 @@ export interface KoniRequestSignatures {
|
|
|
1192
1232
|
'pri(accounts.create.suriV2)': [RequestAccountCreateSuriV2, ResponseAccountCreateSuriV2];
|
|
1193
1233
|
'pri(accounts.create.externalV2)': [RequestAccountCreateExternalV2, AccountExternalError[]];
|
|
1194
1234
|
'pri(accounts.create.hardwareV2)': [RequestAccountCreateHardwareV2, boolean];
|
|
1235
|
+
'pri(accounts.create.withSecret)': [RequestAccountCreateWithSecretKey, ResponseAccountCreateWithSecretKey];
|
|
1195
1236
|
'pri(accounts.checkTransfer)': [RequestCheckTransfer, ResponseCheckTransfer];
|
|
1196
1237
|
'pri(accounts.checkCrossChainTransfer)': [RequestCheckCrossChainTransfer, ResponseCheckCrossChainTransfer];
|
|
1197
1238
|
'pri(accounts.transfer)': [RequestTransfer, Array<TransferError>, ResponseTransfer];
|
|
@@ -1200,6 +1241,7 @@ export interface KoniRequestSignatures {
|
|
|
1200
1241
|
'pri(json.restoreV2)': [RequestJsonRestoreV2, void];
|
|
1201
1242
|
'pri(json.batchRestoreV2)': [RequestBatchRestoreV2, void];
|
|
1202
1243
|
'pri(accounts.exportPrivateKey)': [RequestAccountExportPrivateKey, ResponseAccountExportPrivateKey];
|
|
1244
|
+
'pri(accounts.checkPublicAndSecretKey)': [RequestCheckPublicAndSecretKey, ResponseCheckPublicAndSecretKey];
|
|
1203
1245
|
'pri(accounts.subscribeWithCurrentAddress)': [RequestAccountSubscribe, boolean, AccountsWithCurrentAddress];
|
|
1204
1246
|
'pri(accounts.subscribeAccountsInputAddress)': [RequestAccountSubscribe, string, OptionInputAddress];
|
|
1205
1247
|
'pri(accounts.saveRecent)': [RequestSaveRecentAccount, SingleAddress];
|
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
|
}
|