@subwallet/extension-base 0.5.1 → 0.5.4-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 +288 -24
- package/background/KoniTypes.js +38 -1
- package/background/handlers/Extension.d.ts +2 -0
- package/background/handlers/Extension.js +54 -1
- package/background/types.d.ts +53 -1
- package/cjs/background/KoniTypes.js +42 -2
- package/cjs/background/handlers/Extension.js +63 -4
- package/cjs/defaults.js +1 -1
- package/cjs/errors/SubWalletProviderError.js +19 -0
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/index.js +3 -1
- package/cjs/signers/substrates/LedgerSigner.js +50 -0
- package/cjs/signers/substrates/QrSigner.js +72 -0
- package/cjs/signers/types.js +1 -0
- package/cjs/signers/web3/QrSigner.js +68 -0
- package/defaults.d.ts +1 -1
- package/defaults.js +1 -1
- package/errors/SubWalletProviderError.d.ts +6 -0
- package/errors/SubWalletProviderError.js +10 -0
- package/package.json +30 -4
- package/packageInfo.js +1 -1
- package/page/index.js +2 -1
- package/signers/substrates/LedgerSigner.d.ts +13 -0
- package/signers/substrates/LedgerSigner.js +39 -0
- package/signers/substrates/QrSigner.d.ts +20 -0
- package/signers/substrates/QrSigner.js +59 -0
- package/signers/types.d.ts +26 -0
- package/signers/types.js +1 -0
- package/signers/web3/QrSigner.d.ts +18 -0
- package/signers/web3/QrSigner.js +52 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { AuthUrls, Resolver } from '@subwallet/extension-base/background/handlers/State';
|
|
2
|
-
import { AccountAuthType, AccountJson, AuthorizeRequest, RequestAccountList, RequestAccountSubscribe, RequestAuthorizeCancel, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestCurrentAccountAddress, ResponseAuthorizeList, ResponseJsonGetAccountInfo, SeedLengths } from '@subwallet/extension-base/background/types';
|
|
2
|
+
import { AccountAuthType, AccountJson, AuthorizeRequest, RequestAccountList, RequestAccountSubscribe, RequestAuthorizeCancel, RequestAuthorizeReject, RequestAuthorizeSubscribe, RequestAuthorizeTab, RequestCurrentAccountAddress, RequestParseTransactionSubstrate, RequestQRIsLocked, RequestQrSignSubstrate, ResponseAuthorizeList, ResponseJsonGetAccountInfo, ResponseParseTransactionSubstrate, ResponseQRIsLocked, ResponseQrSignSubstrate, SeedLengths } from '@subwallet/extension-base/background/types';
|
|
3
|
+
import { ExternalState, LedgerState, QrState } from '@subwallet/extension-base/signers/types';
|
|
3
4
|
import { InjectedAccount, MetadataDefBase } from '@subwallet/extension-inject/types';
|
|
4
5
|
import Web3 from 'web3';
|
|
5
6
|
import { RequestArguments, TransactionConfig } from 'web3-core';
|
|
6
7
|
import { JsonRpcPayload, JsonRpcResponse } from 'web3-core-helpers';
|
|
7
8
|
import { ApiPromise } from '@polkadot/api';
|
|
8
9
|
import { SubmittableExtrinsicFunction } from '@polkadot/api/promise/types';
|
|
9
|
-
import { KeyringPair$Json } from '@polkadot/keyring/types';
|
|
10
|
+
import { KeyringPair$Json, KeyringPair$Meta } from '@polkadot/keyring/types';
|
|
10
11
|
import { Registry } from '@polkadot/types/types';
|
|
12
|
+
import { SignerResult } from '@polkadot/types/types/extrinsic';
|
|
11
13
|
import { SingleAddress } from '@polkadot/ui-keyring/observable/types';
|
|
12
14
|
import { KeyringOptions } from '@polkadot/ui-keyring/options/types';
|
|
13
15
|
import { KeyringPairs$Json } from '@polkadot/ui-keyring/types';
|
|
@@ -47,6 +49,14 @@ export interface RequestAuthorization extends RequestAuthorizationAll {
|
|
|
47
49
|
export interface RequestAuthorizationPerAccount extends RequestAuthorization {
|
|
48
50
|
address: string;
|
|
49
51
|
}
|
|
52
|
+
export interface RequestAuthorizationPerSite {
|
|
53
|
+
id: string;
|
|
54
|
+
values: Record<string, boolean>;
|
|
55
|
+
}
|
|
56
|
+
export interface RequestAuthorizationBlock {
|
|
57
|
+
id: string;
|
|
58
|
+
connectedValue: boolean;
|
|
59
|
+
}
|
|
50
60
|
export interface ResultResolver {
|
|
51
61
|
result: boolean;
|
|
52
62
|
accounts: string[];
|
|
@@ -80,11 +90,17 @@ export interface StakingItem {
|
|
|
80
90
|
nativeToken: string;
|
|
81
91
|
unit?: string;
|
|
82
92
|
state: APIItemState;
|
|
93
|
+
unlockingInfo?: UnlockingStakeInfo;
|
|
83
94
|
}
|
|
84
95
|
export interface StakingJson {
|
|
96
|
+
reset?: boolean;
|
|
85
97
|
ready?: boolean;
|
|
86
98
|
details: Record<string, StakingItem>;
|
|
87
99
|
}
|
|
100
|
+
export interface StakingStoreJson {
|
|
101
|
+
bonded: Record<string, StakingItem>;
|
|
102
|
+
reward: Array<StakingRewardItem>;
|
|
103
|
+
}
|
|
88
104
|
export interface PriceJson {
|
|
89
105
|
ready?: boolean;
|
|
90
106
|
currency: string;
|
|
@@ -140,6 +156,10 @@ export interface NftCollectionJson {
|
|
|
140
156
|
ready: boolean;
|
|
141
157
|
nftCollectionList: Array<NftCollection>;
|
|
142
158
|
}
|
|
159
|
+
export interface NftStoreJson {
|
|
160
|
+
nftList: Array<NftItem>;
|
|
161
|
+
nftCollectionList: Array<NftCollection>;
|
|
162
|
+
}
|
|
143
163
|
export interface TokenBalanceRaw {
|
|
144
164
|
reserved: BN;
|
|
145
165
|
frozen: BN;
|
|
@@ -153,13 +173,15 @@ export interface BalanceChildItem {
|
|
|
153
173
|
}
|
|
154
174
|
export interface BalanceItem {
|
|
155
175
|
state: APIItemState;
|
|
156
|
-
free
|
|
157
|
-
reserved
|
|
158
|
-
miscFrozen
|
|
159
|
-
feeFrozen
|
|
176
|
+
free?: string;
|
|
177
|
+
reserved?: string;
|
|
178
|
+
miscFrozen?: string;
|
|
179
|
+
feeFrozen?: string;
|
|
160
180
|
children?: Record<string, BalanceChildItem>;
|
|
181
|
+
timestamp?: number;
|
|
161
182
|
}
|
|
162
183
|
export interface BalanceJson {
|
|
184
|
+
reset?: boolean;
|
|
163
185
|
details: Record<string, BalanceItem>;
|
|
164
186
|
}
|
|
165
187
|
export interface CrowdloanItem {
|
|
@@ -168,6 +190,7 @@ export interface CrowdloanItem {
|
|
|
168
190
|
contribute: string;
|
|
169
191
|
}
|
|
170
192
|
export interface CrowdloanJson {
|
|
193
|
+
reset?: boolean;
|
|
171
194
|
details: Record<string, CrowdloanItem>;
|
|
172
195
|
}
|
|
173
196
|
export interface ChainRegistry {
|
|
@@ -294,11 +317,12 @@ export declare type TokenInfo = {
|
|
|
294
317
|
symbol: string;
|
|
295
318
|
symbolAlt?: string;
|
|
296
319
|
erc20Address?: string;
|
|
297
|
-
assetIndex?: number;
|
|
320
|
+
assetIndex?: number | string;
|
|
298
321
|
decimals: number;
|
|
299
322
|
name: string;
|
|
300
323
|
coinGeckoKey?: string;
|
|
301
324
|
specialOption?: object;
|
|
325
|
+
assetId?: string;
|
|
302
326
|
};
|
|
303
327
|
export interface AccountsWithCurrentAddress {
|
|
304
328
|
accounts: AccountJson[];
|
|
@@ -339,6 +363,8 @@ export interface TransactionHistoryItemType {
|
|
|
339
363
|
isSuccess: boolean;
|
|
340
364
|
action: 'send' | 'received';
|
|
341
365
|
extrinsicHash: string;
|
|
366
|
+
origin?: 'app' | 'network';
|
|
367
|
+
eventIdx?: number | null;
|
|
342
368
|
}
|
|
343
369
|
export interface RequestTransactionHistoryGet {
|
|
344
370
|
address: string;
|
|
@@ -430,8 +456,18 @@ export interface RequestCrossChainTransfer extends RequestCheckCrossChainTransfe
|
|
|
430
456
|
}
|
|
431
457
|
export interface ResponseCheckCrossChainTransfer {
|
|
432
458
|
errors?: Array<TransferError>;
|
|
433
|
-
|
|
434
|
-
|
|
459
|
+
feeString?: string;
|
|
460
|
+
}
|
|
461
|
+
export declare type RequestTransferExternal = RequestCheckTransfer;
|
|
462
|
+
export declare type RequestCrossChainTransferExternal = RequestCheckCrossChainTransfer;
|
|
463
|
+
export interface RequestRejectExternalRequest {
|
|
464
|
+
id: string;
|
|
465
|
+
message?: string;
|
|
466
|
+
throwError?: boolean;
|
|
467
|
+
}
|
|
468
|
+
export interface RequestResolveExternalRequest {
|
|
469
|
+
id: string;
|
|
470
|
+
data: SignerResult;
|
|
435
471
|
}
|
|
436
472
|
export interface ResponsePrivateKeyValidateV2 {
|
|
437
473
|
addressMap: Record<KeypairType, string>;
|
|
@@ -457,6 +493,8 @@ export declare type RequestNftForceUpdate = {
|
|
|
457
493
|
nft: NftItem;
|
|
458
494
|
isSendingSelf: boolean;
|
|
459
495
|
chain: string;
|
|
496
|
+
senderAddress: string;
|
|
497
|
+
recipientAddress: string;
|
|
460
498
|
};
|
|
461
499
|
export declare enum NETWORK_ERROR {
|
|
462
500
|
INVALID_INFO_TYPE = "invalidInfoType",
|
|
@@ -480,16 +518,36 @@ export declare enum TransferErrorCode {
|
|
|
480
518
|
NOT_ENOUGH_VALUE = "notEnoughValue",
|
|
481
519
|
INVALID_VALUE = "invalidValue",
|
|
482
520
|
INVALID_TOKEN = "invalidToken",
|
|
521
|
+
INVALID_PARAM = "invalidParam",
|
|
483
522
|
KEYRING_ERROR = "keyringError",
|
|
484
523
|
TRANSFER_ERROR = "transferError",
|
|
485
524
|
TIMEOUT = "timeout",
|
|
486
525
|
UNSUPPORTED = "unsupported"
|
|
487
526
|
}
|
|
527
|
+
export declare enum BasicTxErrorCode {
|
|
528
|
+
INVALID_FROM_ADDRESS = "invalidFromAccount",
|
|
529
|
+
INVALID_TO_ADDRESS = "invalidToAccount",
|
|
530
|
+
NOT_ENOUGH_VALUE = "notEnoughValue",
|
|
531
|
+
INVALID_VALUE = "invalidValue",
|
|
532
|
+
INVALID_TOKEN = "invalidToken",
|
|
533
|
+
INVALID_PARAM = "invalidParam",
|
|
534
|
+
KEYRING_ERROR = "keyringError",
|
|
535
|
+
TRANSFER_ERROR = "transferError",
|
|
536
|
+
STAKING_ERROR = "stakingError",
|
|
537
|
+
UN_STAKING_ERROR = "unStakingError",
|
|
538
|
+
WITHDRAW_STAKING_ERROR = "withdrawStakingError",
|
|
539
|
+
TIMEOUT = "timeout",
|
|
540
|
+
UNSUPPORTED = "unsupported"
|
|
541
|
+
}
|
|
488
542
|
export declare type TransferError = {
|
|
489
543
|
code: TransferErrorCode;
|
|
490
544
|
data?: object;
|
|
491
545
|
message: string;
|
|
492
546
|
};
|
|
547
|
+
export interface BaseTxError {
|
|
548
|
+
code: BasicTxErrorCode;
|
|
549
|
+
message: string;
|
|
550
|
+
}
|
|
493
551
|
export interface ResponseCheckTransfer {
|
|
494
552
|
errors?: Array<TransferError>;
|
|
495
553
|
fromAccountFree: string;
|
|
@@ -499,12 +557,13 @@ export interface ResponseCheckTransfer {
|
|
|
499
557
|
}
|
|
500
558
|
export declare enum TransferStep {
|
|
501
559
|
READY = "ready",
|
|
560
|
+
SIGNING = "signing",
|
|
502
561
|
START = "start",
|
|
503
562
|
PROCESSING = "processing",
|
|
504
563
|
SUCCESS = "success",
|
|
505
564
|
ERROR = "error"
|
|
506
565
|
}
|
|
507
|
-
declare type TxResultType = {
|
|
566
|
+
export declare type TxResultType = {
|
|
508
567
|
change: string;
|
|
509
568
|
changeSymbol?: string;
|
|
510
569
|
fee?: string;
|
|
@@ -519,6 +578,16 @@ export interface ResponseTransfer {
|
|
|
519
578
|
txResult?: TxResultType;
|
|
520
579
|
isFinalized?: boolean;
|
|
521
580
|
}
|
|
581
|
+
export interface ResponseTransferExternal extends ResponseTransfer {
|
|
582
|
+
externalState?: ExternalState;
|
|
583
|
+
}
|
|
584
|
+
export interface ResponseTransferQr extends ResponseTransferExternal {
|
|
585
|
+
qrState?: QrState;
|
|
586
|
+
isBusy?: boolean;
|
|
587
|
+
}
|
|
588
|
+
export interface ResponseTransferLedger extends ResponseTransferExternal {
|
|
589
|
+
ledgerState?: LedgerState;
|
|
590
|
+
}
|
|
522
591
|
export interface EvmNftTransactionRequest {
|
|
523
592
|
networkKey: string;
|
|
524
593
|
senderAddress: string;
|
|
@@ -537,14 +606,6 @@ export interface EvmNftSubmitTransaction {
|
|
|
537
606
|
networkKey: string;
|
|
538
607
|
rawTransaction: Record<string, any>;
|
|
539
608
|
}
|
|
540
|
-
export interface NftTransactionResponse {
|
|
541
|
-
passwordError?: string | null;
|
|
542
|
-
callHash?: string;
|
|
543
|
-
status?: boolean;
|
|
544
|
-
transactionHash?: string;
|
|
545
|
-
txError?: boolean;
|
|
546
|
-
isSendingSelf: boolean;
|
|
547
|
-
}
|
|
548
609
|
export interface ValidateNetworkResponse {
|
|
549
610
|
success: boolean;
|
|
550
611
|
key: string;
|
|
@@ -647,12 +708,60 @@ export interface SubstrateNftSubmitTransaction {
|
|
|
647
708
|
export declare type ChainRelationType = 'p' | 'r';
|
|
648
709
|
export interface ChainRelationInfo {
|
|
649
710
|
type: ChainRelationType;
|
|
711
|
+
isEthereum: boolean;
|
|
650
712
|
supportedToken: string[];
|
|
651
713
|
}
|
|
652
714
|
export interface CrossChainRelation {
|
|
653
715
|
type: ChainRelationType;
|
|
716
|
+
isEthereum: boolean;
|
|
654
717
|
relationMap: Record<string, ChainRelationInfo>;
|
|
655
718
|
}
|
|
719
|
+
export interface RequestAccountMeta {
|
|
720
|
+
address: string | Uint8Array;
|
|
721
|
+
}
|
|
722
|
+
export interface ResponseAccountMeta {
|
|
723
|
+
meta: KeyringPair$Meta;
|
|
724
|
+
}
|
|
725
|
+
export declare type ResponseRejectExternalRequest = void;
|
|
726
|
+
export declare type ResponseResolveExternalRequest = void;
|
|
727
|
+
export declare enum ExternalRequestPromiseStatus {
|
|
728
|
+
PENDING = 0,
|
|
729
|
+
REJECTED = 1,
|
|
730
|
+
FAILED = 2,
|
|
731
|
+
COMPLETED = 3
|
|
732
|
+
}
|
|
733
|
+
export interface ExternalRequestPromise {
|
|
734
|
+
resolve?: (result: SignerResult | PromiseLike<SignerResult>) => void;
|
|
735
|
+
reject?: (error?: Error) => void;
|
|
736
|
+
status: ExternalRequestPromiseStatus;
|
|
737
|
+
message?: string;
|
|
738
|
+
createdAt: number;
|
|
739
|
+
}
|
|
740
|
+
export interface RequestAccountCreateExternalV2 {
|
|
741
|
+
address: string;
|
|
742
|
+
genesisHash?: string | null;
|
|
743
|
+
name: string;
|
|
744
|
+
isEthereum: boolean;
|
|
745
|
+
isAllowed: boolean;
|
|
746
|
+
}
|
|
747
|
+
export interface RequestAccountCreateHardwareV2 {
|
|
748
|
+
accountIndex: number;
|
|
749
|
+
address: string;
|
|
750
|
+
addressOffset: number;
|
|
751
|
+
genesisHash: string;
|
|
752
|
+
hardwareType: string;
|
|
753
|
+
name: string;
|
|
754
|
+
isAllowed?: boolean;
|
|
755
|
+
}
|
|
756
|
+
export declare enum AccountExternalErrorCode {
|
|
757
|
+
INVALID_ADDRESS = "invalidToAccount",
|
|
758
|
+
KEYRING_ERROR = "keyringError",
|
|
759
|
+
UNKNOWN_ERROR = "unknownError"
|
|
760
|
+
}
|
|
761
|
+
export interface AccountExternalError {
|
|
762
|
+
code: AccountExternalErrorCode;
|
|
763
|
+
message: string;
|
|
764
|
+
}
|
|
656
765
|
export declare type RequestEvmEvents = null;
|
|
657
766
|
export declare type EvmEventType = 'connect' | 'disconnect' | 'accountsChanged' | 'chainChanged' | 'message' | 'data' | 'reconnect' | 'error';
|
|
658
767
|
export declare type EvmAccountsChangedPayload = string[];
|
|
@@ -677,11 +786,13 @@ export interface ResponseEvmProviderSend {
|
|
|
677
786
|
error: (Error | null);
|
|
678
787
|
result?: JsonRpcResponse;
|
|
679
788
|
}
|
|
680
|
-
export interface
|
|
681
|
-
|
|
682
|
-
code: number;
|
|
789
|
+
export interface SubWalletProviderErrorInterface extends Error {
|
|
790
|
+
code?: number;
|
|
683
791
|
data?: unknown;
|
|
684
792
|
}
|
|
793
|
+
export interface EvmProviderRpcErrorInterface extends SubWalletProviderErrorInterface {
|
|
794
|
+
code: number;
|
|
795
|
+
}
|
|
685
796
|
export declare type EvmRpcErrorHelperMap = Record<'USER_REJECTED_REQUEST' | 'UNAUTHORIZED' | 'UNSUPPORTED_METHOD' | 'DISCONNECTED' | 'CHAIN_DISCONNECTED' | 'INVALID_PARAMS' | 'INTERNAL_ERROR', [number, string]>;
|
|
686
797
|
export interface EvmSendTransactionParams {
|
|
687
798
|
from: string;
|
|
@@ -720,15 +831,51 @@ export interface ConfirmationResult<T> {
|
|
|
720
831
|
payload?: T;
|
|
721
832
|
password?: string;
|
|
722
833
|
}
|
|
834
|
+
export interface ConfirmationResultQr<T> extends ConfirmationResult<T> {
|
|
835
|
+
signature: `0x${string}`;
|
|
836
|
+
}
|
|
723
837
|
export interface EvmSendTransactionRequest extends TransactionConfig {
|
|
724
838
|
estimateGas: string;
|
|
725
839
|
}
|
|
840
|
+
export interface EvmRequestQr {
|
|
841
|
+
qrPayload: string;
|
|
842
|
+
canSign: boolean;
|
|
843
|
+
}
|
|
844
|
+
export interface EvmSendTransactionRequestQr extends TransactionConfig, EvmRequestQr {
|
|
845
|
+
estimateGas: string;
|
|
846
|
+
}
|
|
847
|
+
export interface EvmSignatureRequestQr extends EvmSignatureRequest, EvmRequestQr {
|
|
848
|
+
}
|
|
726
849
|
export interface ConfirmationDefinitions {
|
|
727
850
|
addNetworkRequest: [ConfirmationsQueueItem<NetworkJson>, ConfirmationResult<NetworkJson>];
|
|
728
851
|
addTokenRequest: [ConfirmationsQueueItem<CustomEvmToken>, ConfirmationResult<boolean>];
|
|
729
852
|
switchNetworkRequest: [ConfirmationsQueueItem<SwitchNetworkRequest>, ConfirmationResult<boolean>];
|
|
730
853
|
evmSignatureRequest: [ConfirmationsQueueItem<EvmSignatureRequest>, ConfirmationResult<string>];
|
|
854
|
+
evmSignatureRequestQr: [ConfirmationsQueueItem<EvmSignatureRequestQr>, ConfirmationResultQr<string>];
|
|
731
855
|
evmSendTransactionRequest: [ConfirmationsQueueItem<EvmSendTransactionRequest>, ConfirmationResult<boolean>];
|
|
856
|
+
evmSendTransactionRequestQr: [ConfirmationsQueueItem<EvmSendTransactionRequestQr>, ConfirmationResultQr<boolean>];
|
|
857
|
+
}
|
|
858
|
+
export interface RequestParseTransactionEVM {
|
|
859
|
+
data: string;
|
|
860
|
+
}
|
|
861
|
+
export interface ResponseParseTransactionEVM {
|
|
862
|
+
data: ParseEVMTransactionData | string;
|
|
863
|
+
input: string;
|
|
864
|
+
nonce: number;
|
|
865
|
+
to: string;
|
|
866
|
+
gas: number;
|
|
867
|
+
gasPrice: number;
|
|
868
|
+
value: number;
|
|
869
|
+
}
|
|
870
|
+
export interface RequestQrSignEVM {
|
|
871
|
+
address: string;
|
|
872
|
+
message: string;
|
|
873
|
+
type: 'message' | 'transaction';
|
|
874
|
+
chainId?: number;
|
|
875
|
+
password: string;
|
|
876
|
+
}
|
|
877
|
+
export interface ResponseQrSignEVM {
|
|
878
|
+
signature: string;
|
|
732
879
|
}
|
|
733
880
|
export declare type ConfirmationType = keyof ConfirmationDefinitions;
|
|
734
881
|
export declare type ConfirmationsQueue = {
|
|
@@ -751,6 +898,8 @@ export interface ValidatorInfo {
|
|
|
751
898
|
isVerified: boolean;
|
|
752
899
|
minBond: number;
|
|
753
900
|
isNominated: boolean;
|
|
901
|
+
icon?: string;
|
|
902
|
+
hasScheduledRequest?: boolean;
|
|
754
903
|
}
|
|
755
904
|
export interface BondingOptionInfo {
|
|
756
905
|
isBondedBefore: boolean;
|
|
@@ -776,6 +925,7 @@ export interface BondingSubmitParams {
|
|
|
776
925
|
password?: string;
|
|
777
926
|
isBondedBefore: boolean;
|
|
778
927
|
bondedValidators: string[];
|
|
928
|
+
lockPeriod?: number;
|
|
779
929
|
}
|
|
780
930
|
export interface BasicTxResponse {
|
|
781
931
|
passwordError?: string | null;
|
|
@@ -784,6 +934,9 @@ export interface BasicTxResponse {
|
|
|
784
934
|
transactionHash?: string;
|
|
785
935
|
txError?: boolean;
|
|
786
936
|
}
|
|
937
|
+
export interface NftTransactionResponse extends BasicTxResponse {
|
|
938
|
+
isSendingSelf: boolean;
|
|
939
|
+
}
|
|
787
940
|
export interface BondingOptionParams {
|
|
788
941
|
networkKey: string;
|
|
789
942
|
address: string;
|
|
@@ -793,20 +946,93 @@ export interface UnbondingSubmitParams {
|
|
|
793
946
|
networkKey: string;
|
|
794
947
|
address: string;
|
|
795
948
|
password?: string;
|
|
949
|
+
validatorAddress?: string;
|
|
950
|
+
unstakeAll?: boolean;
|
|
796
951
|
}
|
|
797
952
|
export interface UnlockingStakeParams {
|
|
798
953
|
address: string;
|
|
799
954
|
networkKey: string;
|
|
955
|
+
validatorList?: string[];
|
|
956
|
+
}
|
|
957
|
+
export interface DelegationItem {
|
|
958
|
+
owner: string;
|
|
959
|
+
amount: string;
|
|
960
|
+
identity?: string;
|
|
961
|
+
minBond: string;
|
|
962
|
+
hasScheduledRequest: boolean;
|
|
800
963
|
}
|
|
801
964
|
export interface UnlockingStakeInfo {
|
|
802
965
|
nextWithdrawal: number;
|
|
803
966
|
redeemable: number;
|
|
804
967
|
nextWithdrawalAmount: number;
|
|
968
|
+
nextWithdrawalAction?: string;
|
|
969
|
+
validatorAddress?: string;
|
|
970
|
+
}
|
|
971
|
+
export interface StakeUnlockingJson {
|
|
972
|
+
timestamp: number;
|
|
973
|
+
details: Record<string, UnlockingStakeInfo>;
|
|
805
974
|
}
|
|
806
975
|
export interface StakeWithdrawalParams {
|
|
807
976
|
address: string;
|
|
808
977
|
networkKey: string;
|
|
809
978
|
password?: string;
|
|
979
|
+
validatorAddress?: string;
|
|
980
|
+
action?: string;
|
|
981
|
+
}
|
|
982
|
+
export interface StakeClaimRewardParams {
|
|
983
|
+
address: string;
|
|
984
|
+
networkKey: string;
|
|
985
|
+
validatorAddress?: string;
|
|
986
|
+
password?: string;
|
|
987
|
+
}
|
|
988
|
+
export interface ResponseNftTransferExternal extends NftTransactionResponse {
|
|
989
|
+
externalState?: ExternalState;
|
|
990
|
+
}
|
|
991
|
+
export interface ResponseNftTransferQr extends ResponseNftTransferExternal {
|
|
992
|
+
qrState?: QrState;
|
|
993
|
+
isBusy?: boolean;
|
|
994
|
+
}
|
|
995
|
+
export interface ResponseNftTransferLedger extends ResponseNftTransferExternal {
|
|
996
|
+
ledgerState?: LedgerState;
|
|
997
|
+
}
|
|
998
|
+
export declare type RequestNftTransferExternalSubstrate = Omit<SubstrateNftSubmitTransaction, 'password'>;
|
|
999
|
+
export declare type RequestNftTransferExternalEVM = Omit<EvmNftSubmitTransaction, 'password'>;
|
|
1000
|
+
export declare type RequestStakeExternal = Omit<BondingSubmitParams, 'password'>;
|
|
1001
|
+
export interface ResponseStakeExternal extends BasicTxResponse {
|
|
1002
|
+
externalState?: ExternalState;
|
|
1003
|
+
}
|
|
1004
|
+
export interface ResponseStakeQr extends ResponseStakeExternal {
|
|
1005
|
+
qrState?: QrState;
|
|
1006
|
+
isBusy?: boolean;
|
|
1007
|
+
}
|
|
1008
|
+
export interface ResponseStakeLedger extends ResponseStakeExternal {
|
|
1009
|
+
ledgerState?: LedgerState;
|
|
1010
|
+
}
|
|
1011
|
+
export declare type RequestUnStakeExternal = Omit<UnbondingSubmitParams, 'password'>;
|
|
1012
|
+
export interface ResponseUnStakeExternal extends BasicTxResponse {
|
|
1013
|
+
externalState?: ExternalState;
|
|
1014
|
+
}
|
|
1015
|
+
export interface ResponseUnStakeQr extends ResponseUnStakeExternal {
|
|
1016
|
+
qrState?: QrState;
|
|
1017
|
+
isBusy?: boolean;
|
|
1018
|
+
}
|
|
1019
|
+
export interface ResponseUnStakeLedger extends ResponseUnStakeExternal {
|
|
1020
|
+
ledgerState?: LedgerState;
|
|
1021
|
+
}
|
|
1022
|
+
export declare type RequestWithdrawStakeExternal = Omit<StakeWithdrawalParams, 'password'>;
|
|
1023
|
+
export interface ResponseWithdrawStakeExternal extends BasicTxResponse {
|
|
1024
|
+
externalState?: ExternalState;
|
|
1025
|
+
}
|
|
1026
|
+
export interface ResponseWithdrawStakeQr extends ResponseWithdrawStakeExternal {
|
|
1027
|
+
qrState?: QrState;
|
|
1028
|
+
isBusy?: boolean;
|
|
1029
|
+
}
|
|
1030
|
+
export interface ResponseWithdrawStakeLedger extends ResponseWithdrawStakeExternal {
|
|
1031
|
+
ledgerState?: LedgerState;
|
|
1032
|
+
}
|
|
1033
|
+
export interface StakeDelegationRequest {
|
|
1034
|
+
address: string;
|
|
1035
|
+
networkKey: string;
|
|
810
1036
|
}
|
|
811
1037
|
export interface SingleModeJson {
|
|
812
1038
|
networkKeys: string[];
|
|
@@ -833,15 +1059,25 @@ export interface RequestParseEVMTransactionInput {
|
|
|
833
1059
|
export interface ResponseParseEVMTransactionInput {
|
|
834
1060
|
result: ParseEVMTransactionData | string;
|
|
835
1061
|
}
|
|
1062
|
+
export interface LedgerNetwork {
|
|
1063
|
+
genesisHash: string;
|
|
1064
|
+
displayName: string;
|
|
1065
|
+
network: string;
|
|
1066
|
+
icon: 'substrate' | 'ethereum';
|
|
1067
|
+
isDevMode: boolean;
|
|
1068
|
+
}
|
|
836
1069
|
export interface KoniRequestSignatures {
|
|
1070
|
+
'pri(staking.delegationInfo)': [StakeDelegationRequest, DelegationItem[]];
|
|
1071
|
+
'pri(staking.submitClaimReward)': [StakeClaimRewardParams, BasicTxResponse, BasicTxResponse];
|
|
1072
|
+
'pri(staking.claimRewardTxInfo)': [StakeClaimRewardParams, BasicTxInfo];
|
|
837
1073
|
'pri(unbonding.submitWithdrawal)': [StakeWithdrawalParams, BasicTxResponse, BasicTxResponse];
|
|
838
1074
|
'pri(unbonding.withdrawalTxInfo)': [StakeWithdrawalParams, BasicTxInfo];
|
|
839
|
-
'pri(unbonding.
|
|
1075
|
+
'pri(unbonding.subscribeUnlockingInfo)': [null, StakeUnlockingJson, StakeUnlockingJson];
|
|
840
1076
|
'pri(unbonding.submitTransaction)': [UnbondingSubmitParams, BasicTxResponse, BasicTxResponse];
|
|
841
1077
|
'pri(unbonding.txInfo)': [UnbondingSubmitParams, BasicTxInfo];
|
|
842
1078
|
'pri(bonding.txInfo)': [BondingSubmitParams, BasicTxInfo];
|
|
843
1079
|
'pri(bonding.submitTransaction)': [BondingSubmitParams, BasicTxResponse, BasicTxResponse];
|
|
844
|
-
'pri(bonding.getChainBondingBasics)': [NetworkJson[], Record<string, ChainBondingBasics>];
|
|
1080
|
+
'pri(bonding.getChainBondingBasics)': [NetworkJson[], Record<string, ChainBondingBasics>, Record<string, ChainBondingBasics>];
|
|
845
1081
|
'pri(bonding.getBondingOptions)': [BondingOptionParams, BondingOptionInfo];
|
|
846
1082
|
'pri(networkMap.recoverDotSama)': [string, boolean];
|
|
847
1083
|
'pri(substrateNft.submitTransaction)': [SubstrateNftSubmitTransaction, NftTransactionResponse, NftTransactionResponse];
|
|
@@ -888,6 +1124,8 @@ export interface KoniRequestSignatures {
|
|
|
888
1124
|
'pri(authorize.changeSiteAll)': [RequestAuthorizationAll, boolean, AuthUrls];
|
|
889
1125
|
'pri(authorize.changeSite)': [RequestAuthorization, boolean, AuthUrls];
|
|
890
1126
|
'pri(authorize.changeSitePerAccount)': [RequestAuthorizationPerAccount, boolean, AuthUrls];
|
|
1127
|
+
'pri(authorize.changeSitePerSite)': [RequestAuthorizationPerSite, boolean];
|
|
1128
|
+
'pri(authorize.changeSiteBlock)': [RequestAuthorizationBlock, boolean];
|
|
891
1129
|
'pri(authorize.forgetSite)': [RequestForgetSite, boolean, AuthUrls];
|
|
892
1130
|
'pri(authorize.forgetAllSite)': [null, boolean, AuthUrls];
|
|
893
1131
|
'pri(authorize.rejectV2)': [RequestAuthorizeReject, boolean];
|
|
@@ -896,6 +1134,8 @@ export interface KoniRequestSignatures {
|
|
|
896
1134
|
'pri(seed.validateV2)': [RequestSeedValidateV2, ResponseSeedValidateV2];
|
|
897
1135
|
'pri(privateKey.validateV2)': [RequestSeedValidateV2, ResponsePrivateKeyValidateV2];
|
|
898
1136
|
'pri(accounts.create.suriV2)': [RequestAccountCreateSuriV2, ResponseAccountCreateSuriV2];
|
|
1137
|
+
'pri(accounts.create.externalV2)': [RequestAccountCreateExternalV2, AccountExternalError[]];
|
|
1138
|
+
'pri(accounts.create.hardwareV2)': [RequestAccountCreateHardwareV2, boolean];
|
|
899
1139
|
'pri(accounts.checkTransfer)': [RequestCheckTransfer, ResponseCheckTransfer];
|
|
900
1140
|
'pri(accounts.checkCrossChainTransfer)': [RequestCheckCrossChainTransfer, ResponseCheckCrossChainTransfer];
|
|
901
1141
|
'pri(accounts.transfer)': [RequestTransfer, Array<TransferError>, ResponseTransfer];
|
|
@@ -908,6 +1148,7 @@ export interface KoniRequestSignatures {
|
|
|
908
1148
|
'pri(accounts.subscribeAccountsInputAddress)': [RequestAccountSubscribe, string, OptionInputAddress];
|
|
909
1149
|
'pri(accounts.saveRecent)': [RequestSaveRecentAccount, SingleAddress];
|
|
910
1150
|
'pri(accounts.triggerSubscription)': [null, boolean];
|
|
1151
|
+
'pri(accounts.get.meta)': [RequestAccountMeta, ResponseAccountMeta];
|
|
911
1152
|
'pri(currentAccount.saveAddress)': [RequestCurrentAccountAddress, boolean, CurrentAccountInfo];
|
|
912
1153
|
'pri(settings.changeBalancesVisibility)': [null, boolean, ResponseSettingsType];
|
|
913
1154
|
'pri(settings.subscribe)': [null, ResponseSettingsType, ResponseSettingsType];
|
|
@@ -926,9 +1167,32 @@ export interface KoniRequestSignatures {
|
|
|
926
1167
|
'pub(utils.getRandom)': [RandomTestRequest, number];
|
|
927
1168
|
'pub(accounts.listV2)': [RequestAccountList, InjectedAccount[]];
|
|
928
1169
|
'pub(accounts.subscribeV2)': [RequestAccountSubscribe, boolean, InjectedAccount[]];
|
|
1170
|
+
'pri(qr.transaction.parse.substrate)': [RequestParseTransactionSubstrate, ResponseParseTransactionSubstrate];
|
|
1171
|
+
'pri(qr.transaction.parse.evm)': [RequestParseTransactionEVM, ResponseParseTransactionEVM];
|
|
1172
|
+
'pri(qr.isLocked)': [RequestQRIsLocked, ResponseQRIsLocked];
|
|
1173
|
+
'pri(qr.sign.substrate)': [RequestQrSignSubstrate, ResponseQrSignSubstrate];
|
|
1174
|
+
'pri(qr.sign.evm)': [RequestQrSignEVM, ResponseQrSignEVM];
|
|
1175
|
+
'pri(account.external.reject)': [RequestRejectExternalRequest, ResponseRejectExternalRequest];
|
|
1176
|
+
'pri(account.external.resolve)': [RequestResolveExternalRequest, ResponseResolveExternalRequest];
|
|
929
1177
|
'evm(events.subscribe)': [RequestEvmEvents, boolean, EvmEvent];
|
|
930
1178
|
'evm(request)': [RequestArguments, unknown];
|
|
931
1179
|
'evm(provider.send)': [RequestEvmProviderSend, string | number, ResponseEvmProviderSend];
|
|
932
1180
|
'pri(evm.transaction.parse.input)': [RequestParseEVMTransactionInput, ResponseParseEVMTransactionInput];
|
|
1181
|
+
'pri(accounts.transfer.qr.create)': [RequestTransferExternal, Array<TransferError>, ResponseTransferQr];
|
|
1182
|
+
'pri(accounts.cross.transfer.qr.create)': [RequestCrossChainTransferExternal, Array<TransferError>, ResponseTransferQr];
|
|
1183
|
+
'pri(nft.transfer.qr.create.substrate)': [RequestNftTransferExternalSubstrate, Array<BaseTxError>, ResponseNftTransferQr];
|
|
1184
|
+
'pri(nft.transfer.qr.create.evm)': [RequestNftTransferExternalEVM, Array<BaseTxError>, ResponseNftTransferQr];
|
|
1185
|
+
'pri(stake.qr.create)': [RequestStakeExternal, Array<BaseTxError>, ResponseStakeQr];
|
|
1186
|
+
'pri(unStake.qr.create)': [RequestUnStakeExternal, Array<BaseTxError>, ResponseUnStakeQr];
|
|
1187
|
+
'pri(withdrawStake.qr.create)': [RequestWithdrawStakeExternal, Array<BaseTxError>, ResponseWithdrawStakeQr];
|
|
1188
|
+
'pri(accounts.transfer.ledger.create)': [RequestTransferExternal, Array<TransferError>, ResponseTransferLedger];
|
|
1189
|
+
'pri(accounts.cross.transfer.ledger.create)': [RequestCrossChainTransferExternal, Array<TransferError>, ResponseTransferLedger];
|
|
1190
|
+
'pri(nft.transfer.ledger.create.substrate)': [RequestNftTransferExternalSubstrate, Array<BaseTxError>, ResponseNftTransferQr];
|
|
1191
|
+
'pri(stake.ledger.create)': [RequestStakeExternal, Array<BaseTxError>, ResponseStakeLedger];
|
|
1192
|
+
'pri(unStake.ledger.create)': [RequestUnStakeExternal, Array<BaseTxError>, ResponseUnStakeLedger];
|
|
1193
|
+
'pri(withdrawStake.ledger.create)': [RequestWithdrawStakeExternal, Array<BaseTxError>, ResponseWithdrawStakeLedger];
|
|
1194
|
+
'pri(authorize.subscribe)': [null, AuthUrls, AuthUrls];
|
|
1195
|
+
}
|
|
1196
|
+
export interface ApplicationMetadataType {
|
|
1197
|
+
version: string;
|
|
933
1198
|
}
|
|
934
|
-
export {};
|
package/background/KoniTypes.js
CHANGED
|
@@ -64,18 +64,55 @@ export let TransferErrorCode;
|
|
|
64
64
|
TransferErrorCode["NOT_ENOUGH_VALUE"] = "notEnoughValue";
|
|
65
65
|
TransferErrorCode["INVALID_VALUE"] = "invalidValue";
|
|
66
66
|
TransferErrorCode["INVALID_TOKEN"] = "invalidToken";
|
|
67
|
+
TransferErrorCode["INVALID_PARAM"] = "invalidParam";
|
|
67
68
|
TransferErrorCode["KEYRING_ERROR"] = "keyringError";
|
|
68
69
|
TransferErrorCode["TRANSFER_ERROR"] = "transferError";
|
|
69
70
|
TransferErrorCode["TIMEOUT"] = "timeout";
|
|
70
71
|
TransferErrorCode["UNSUPPORTED"] = "unsupported";
|
|
71
72
|
})(TransferErrorCode || (TransferErrorCode = {}));
|
|
72
73
|
|
|
74
|
+
export let BasicTxErrorCode;
|
|
75
|
+
|
|
76
|
+
(function (BasicTxErrorCode) {
|
|
77
|
+
BasicTxErrorCode["INVALID_FROM_ADDRESS"] = "invalidFromAccount";
|
|
78
|
+
BasicTxErrorCode["INVALID_TO_ADDRESS"] = "invalidToAccount";
|
|
79
|
+
BasicTxErrorCode["NOT_ENOUGH_VALUE"] = "notEnoughValue";
|
|
80
|
+
BasicTxErrorCode["INVALID_VALUE"] = "invalidValue";
|
|
81
|
+
BasicTxErrorCode["INVALID_TOKEN"] = "invalidToken";
|
|
82
|
+
BasicTxErrorCode["INVALID_PARAM"] = "invalidParam";
|
|
83
|
+
BasicTxErrorCode["KEYRING_ERROR"] = "keyringError";
|
|
84
|
+
BasicTxErrorCode["TRANSFER_ERROR"] = "transferError";
|
|
85
|
+
BasicTxErrorCode["STAKING_ERROR"] = "stakingError";
|
|
86
|
+
BasicTxErrorCode["UN_STAKING_ERROR"] = "unStakingError";
|
|
87
|
+
BasicTxErrorCode["WITHDRAW_STAKING_ERROR"] = "withdrawStakingError";
|
|
88
|
+
BasicTxErrorCode["TIMEOUT"] = "timeout";
|
|
89
|
+
BasicTxErrorCode["UNSUPPORTED"] = "unsupported";
|
|
90
|
+
})(BasicTxErrorCode || (BasicTxErrorCode = {}));
|
|
91
|
+
|
|
73
92
|
export let TransferStep;
|
|
74
93
|
|
|
75
94
|
(function (TransferStep) {
|
|
76
95
|
TransferStep["READY"] = "ready";
|
|
96
|
+
TransferStep["SIGNING"] = "signing";
|
|
77
97
|
TransferStep["START"] = "start";
|
|
78
98
|
TransferStep["PROCESSING"] = "processing";
|
|
79
99
|
TransferStep["SUCCESS"] = "success";
|
|
80
100
|
TransferStep["ERROR"] = "error";
|
|
81
|
-
})(TransferStep || (TransferStep = {}));
|
|
101
|
+
})(TransferStep || (TransferStep = {}));
|
|
102
|
+
|
|
103
|
+
export let ExternalRequestPromiseStatus;
|
|
104
|
+
|
|
105
|
+
(function (ExternalRequestPromiseStatus) {
|
|
106
|
+
ExternalRequestPromiseStatus[ExternalRequestPromiseStatus["PENDING"] = 0] = "PENDING";
|
|
107
|
+
ExternalRequestPromiseStatus[ExternalRequestPromiseStatus["REJECTED"] = 1] = "REJECTED";
|
|
108
|
+
ExternalRequestPromiseStatus[ExternalRequestPromiseStatus["FAILED"] = 2] = "FAILED";
|
|
109
|
+
ExternalRequestPromiseStatus[ExternalRequestPromiseStatus["COMPLETED"] = 3] = "COMPLETED";
|
|
110
|
+
})(ExternalRequestPromiseStatus || (ExternalRequestPromiseStatus = {}));
|
|
111
|
+
|
|
112
|
+
export let AccountExternalErrorCode;
|
|
113
|
+
|
|
114
|
+
(function (AccountExternalErrorCode) {
|
|
115
|
+
AccountExternalErrorCode["INVALID_ADDRESS"] = "invalidToAccount";
|
|
116
|
+
AccountExternalErrorCode["KEYRING_ERROR"] = "keyringError";
|
|
117
|
+
AccountExternalErrorCode["UNKNOWN_ERROR"] = "unknownError";
|
|
118
|
+
})(AccountExternalErrorCode || (AccountExternalErrorCode = {}));
|