@subwallet/extension-base 0.4.6-0 → 0.4.8-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 +86 -1
- package/background/handlers/State.d.ts +1 -0
- package/background/handlers/State.js +24 -4
- package/background/types.d.ts +3 -0
- package/cjs/background/handlers/State.js +24 -4
- package/cjs/packageInfo.js +1 -1
- package/package.json +4 -4
- package/packageInfo.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthUrls, Resolver } from '@subwallet/extension-base/background/handlers/State';
|
|
2
|
-
import { AccountAuthType, AccountJson, AuthorizeRequest, RequestAccountList, RequestAccountSubscribe, 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, ResponseAuthorizeList, ResponseJsonGetAccountInfo, SeedLengths } from '@subwallet/extension-base/background/types';
|
|
3
3
|
import { InjectedAccount, MetadataDefBase } from '@subwallet/extension-inject/types';
|
|
4
4
|
import Web3 from 'web3';
|
|
5
5
|
import { RequestArguments, TransactionConfig } from 'web3-core';
|
|
@@ -75,6 +75,8 @@ export interface StakingItem {
|
|
|
75
75
|
name: string;
|
|
76
76
|
chainId: string;
|
|
77
77
|
balance?: string;
|
|
78
|
+
activeBalance?: string;
|
|
79
|
+
unlockingBalance?: string;
|
|
78
80
|
nativeToken: string;
|
|
79
81
|
unit?: string;
|
|
80
82
|
state: APIItemState;
|
|
@@ -246,6 +248,7 @@ export interface NetworkJson {
|
|
|
246
248
|
blockExplorer?: string;
|
|
247
249
|
dependencies?: string[];
|
|
248
250
|
getStakingOnChain?: boolean;
|
|
251
|
+
supportBonding?: boolean;
|
|
249
252
|
apiStatus?: NETWORK_STATUS;
|
|
250
253
|
requestId?: string;
|
|
251
254
|
}
|
|
@@ -576,6 +579,7 @@ export interface CustomEvmToken {
|
|
|
576
579
|
type: 'erc20' | 'erc721';
|
|
577
580
|
isCustom?: boolean;
|
|
578
581
|
isDeleted?: boolean;
|
|
582
|
+
image?: string;
|
|
579
583
|
}
|
|
580
584
|
export interface EvmTokenJson {
|
|
581
585
|
erc20: CustomEvmToken[];
|
|
@@ -719,6 +723,7 @@ export interface EvmSendTransactionRequest extends TransactionConfig {
|
|
|
719
723
|
}
|
|
720
724
|
export interface ConfirmationDefinitions {
|
|
721
725
|
addNetworkRequest: [ConfirmationsQueueItem<NetworkJson>, ConfirmationResult<NetworkJson>];
|
|
726
|
+
addTokenRequest: [ConfirmationsQueueItem<CustomEvmToken>, ConfirmationResult<boolean>];
|
|
722
727
|
switchNetworkRequest: [ConfirmationsQueueItem<SwitchNetworkRequest>, ConfirmationResult<boolean>];
|
|
723
728
|
evmSignatureRequest: [ConfirmationsQueueItem<EvmSignatureRequest>, ConfirmationResult<string>];
|
|
724
729
|
evmSendTransactionRequest: [ConfirmationsQueueItem<EvmSendTransactionRequest>, ConfirmationResult<boolean>];
|
|
@@ -731,7 +736,86 @@ export declare type RequestConfirmationsSubscribe = null;
|
|
|
731
736
|
export declare type RequestConfirmationComplete = {
|
|
732
737
|
[ConfirmationType in keyof ConfirmationDefinitions]?: ConfirmationDefinitions[ConfirmationType][1];
|
|
733
738
|
};
|
|
739
|
+
export interface ValidatorInfo {
|
|
740
|
+
address: string;
|
|
741
|
+
totalStake: number;
|
|
742
|
+
ownStake: number;
|
|
743
|
+
otherStake: number;
|
|
744
|
+
nominatorCount: number;
|
|
745
|
+
commission: number;
|
|
746
|
+
expectedReturn: number;
|
|
747
|
+
blocked: boolean;
|
|
748
|
+
identity?: string;
|
|
749
|
+
isVerified: boolean;
|
|
750
|
+
minBond: number;
|
|
751
|
+
isNominated: boolean;
|
|
752
|
+
}
|
|
753
|
+
export interface BondingOptionInfo {
|
|
754
|
+
isBondedBefore: boolean;
|
|
755
|
+
era: number;
|
|
756
|
+
maxNominations: number;
|
|
757
|
+
maxNominatorPerValidator: number;
|
|
758
|
+
validators: ValidatorInfo[];
|
|
759
|
+
bondedValidators: string[];
|
|
760
|
+
}
|
|
761
|
+
export interface ChainBondingBasics {
|
|
762
|
+
stakedReturn: number;
|
|
763
|
+
isMaxNominators: boolean;
|
|
764
|
+
}
|
|
765
|
+
export interface BasicTxInfo {
|
|
766
|
+
fee: string;
|
|
767
|
+
balanceError: boolean;
|
|
768
|
+
}
|
|
769
|
+
export interface BondingSubmitParams {
|
|
770
|
+
networkKey: string;
|
|
771
|
+
nominatorAddress: string;
|
|
772
|
+
amount: number;
|
|
773
|
+
validatorInfo: ValidatorInfo;
|
|
774
|
+
password?: string;
|
|
775
|
+
isBondedBefore: boolean;
|
|
776
|
+
bondedValidators: string[];
|
|
777
|
+
}
|
|
778
|
+
export interface BasicTxResponse {
|
|
779
|
+
passwordError?: string | null;
|
|
780
|
+
callHash?: string;
|
|
781
|
+
status?: boolean;
|
|
782
|
+
transactionHash?: string;
|
|
783
|
+
txError?: boolean;
|
|
784
|
+
}
|
|
785
|
+
export interface BondingOptionParams {
|
|
786
|
+
networkKey: string;
|
|
787
|
+
address: string;
|
|
788
|
+
}
|
|
789
|
+
export interface UnbondingSubmitParams {
|
|
790
|
+
amount: number;
|
|
791
|
+
networkKey: string;
|
|
792
|
+
address: string;
|
|
793
|
+
password?: string;
|
|
794
|
+
}
|
|
795
|
+
export interface UnlockingStakeParams {
|
|
796
|
+
address: string;
|
|
797
|
+
networkKey: string;
|
|
798
|
+
}
|
|
799
|
+
export interface UnlockingStakeInfo {
|
|
800
|
+
nextWithdrawal: number;
|
|
801
|
+
redeemable: number;
|
|
802
|
+
nextWithdrawalAmount: number;
|
|
803
|
+
}
|
|
804
|
+
export interface StakeWithdrawalParams {
|
|
805
|
+
address: string;
|
|
806
|
+
networkKey: string;
|
|
807
|
+
password?: string;
|
|
808
|
+
}
|
|
734
809
|
export interface KoniRequestSignatures {
|
|
810
|
+
'pri(unbonding.submitWithdrawal)': [StakeWithdrawalParams, BasicTxResponse, BasicTxResponse];
|
|
811
|
+
'pri(unbonding.withdrawalTxInfo)': [StakeWithdrawalParams, BasicTxInfo];
|
|
812
|
+
'pri(unbonding.unlockingInfo)': [UnlockingStakeParams, UnlockingStakeInfo];
|
|
813
|
+
'pri(unbonding.submitTransaction)': [UnbondingSubmitParams, BasicTxResponse, BasicTxResponse];
|
|
814
|
+
'pri(unbonding.txInfo)': [UnbondingSubmitParams, BasicTxInfo];
|
|
815
|
+
'pri(bonding.txInfo)': [BondingSubmitParams, BasicTxInfo];
|
|
816
|
+
'pri(bonding.submitTransaction)': [BondingSubmitParams, BasicTxResponse, BasicTxResponse];
|
|
817
|
+
'pri(bonding.getChainBondingBasics)': [NetworkJson[], Record<string, ChainBondingBasics>];
|
|
818
|
+
'pri(bonding.getBondingOptions)': [BondingOptionParams, BondingOptionInfo];
|
|
735
819
|
'pri(networkMap.recoverDotSama)': [string, boolean];
|
|
736
820
|
'pri(substrateNft.submitTransaction)': [SubstrateNftSubmitTransaction, NftTransactionResponse, NftTransactionResponse];
|
|
737
821
|
'pri(substrateNft.getTransaction)': [SubstrateNftTransactionRequest, SubstrateNftTransaction];
|
|
@@ -780,6 +864,7 @@ export interface KoniRequestSignatures {
|
|
|
780
864
|
'pri(authorize.forgetSite)': [RequestForgetSite, boolean, AuthUrls];
|
|
781
865
|
'pri(authorize.forgetAllSite)': [null, boolean, AuthUrls];
|
|
782
866
|
'pri(authorize.rejectV2)': [RequestAuthorizeReject, boolean];
|
|
867
|
+
'pri(authorize.cancelV2)': [RequestAuthorizeCancel, boolean];
|
|
783
868
|
'pri(seed.createV2)': [RequestSeedCreateV2, ResponseSeedCreateV2];
|
|
784
869
|
'pri(seed.validateV2)': [RequestSeedValidateV2, ResponseSeedValidateV2];
|
|
785
870
|
'pri(privateKey.validateV2)': [RequestSeedValidateV2, ResponsePrivateKeyValidateV2];
|
|
@@ -165,11 +165,31 @@ export default class State {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
popupOpen() {
|
|
168
|
-
this.#notification !== 'extension'
|
|
169
|
-
if (window) {
|
|
170
|
-
|
|
168
|
+
if (this.#notification !== 'extension') {
|
|
169
|
+
if (this.#notification === 'window') {
|
|
170
|
+
chrome.windows.create(NORMAL_WINDOW_OPTS, window => {
|
|
171
|
+
if (window) {
|
|
172
|
+
this.#windows.push(window.id || 0);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
171
175
|
}
|
|
172
|
-
|
|
176
|
+
|
|
177
|
+
chrome.windows.getCurrent(win => {
|
|
178
|
+
const popupOptions = { ...POPUP_WINDOW_OPTS
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
if (win) {
|
|
182
|
+
popupOptions.left = (win.left || 0) + (win.width || 0) - (POPUP_WINDOW_OPTS.width || 0) - 20;
|
|
183
|
+
popupOptions.top = (win.top || 0) + 80;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
chrome.windows.create(popupOptions, window => {
|
|
187
|
+
if (window) {
|
|
188
|
+
this.#windows.push(window.id || 0);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
173
193
|
}
|
|
174
194
|
|
|
175
195
|
authComplete = (id, resolve, reject) => {
|
package/background/types.d.ts
CHANGED
|
@@ -148,6 +148,9 @@ export interface RequestAuthorizeApprove {
|
|
|
148
148
|
export interface RequestAuthorizeReject {
|
|
149
149
|
id: string;
|
|
150
150
|
}
|
|
151
|
+
export interface RequestAuthorizeCancel {
|
|
152
|
+
id: string;
|
|
153
|
+
}
|
|
151
154
|
export declare type RequestAuthorizeSubscribe = null;
|
|
152
155
|
export interface RequestMetadataApprove {
|
|
153
156
|
id: string;
|
|
@@ -200,11 +200,31 @@ class State {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
popupOpen() {
|
|
203
|
-
this.#notification !== 'extension'
|
|
204
|
-
if (window) {
|
|
205
|
-
|
|
203
|
+
if (this.#notification !== 'extension') {
|
|
204
|
+
if (this.#notification === 'window') {
|
|
205
|
+
chrome.windows.create(NORMAL_WINDOW_OPTS, window => {
|
|
206
|
+
if (window) {
|
|
207
|
+
this.#windows.push(window.id || 0);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
206
210
|
}
|
|
207
|
-
|
|
211
|
+
|
|
212
|
+
chrome.windows.getCurrent(win => {
|
|
213
|
+
const popupOptions = { ...POPUP_WINDOW_OPTS
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
if (win) {
|
|
217
|
+
popupOptions.left = (win.left || 0) + (win.width || 0) - (POPUP_WINDOW_OPTS.width || 0) - 20;
|
|
218
|
+
popupOptions.top = (win.top || 0) + 80;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
chrome.windows.create(popupOptions, window => {
|
|
222
|
+
if (window) {
|
|
223
|
+
this.#windows.push(window.id || 0);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
}
|
|
208
228
|
}
|
|
209
229
|
|
|
210
230
|
authComplete = (id, resolve, reject) => {
|
package/cjs/packageInfo.js
CHANGED
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "0.4.
|
|
20
|
+
"version": "0.4.8-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -199,9 +199,9 @@
|
|
|
199
199
|
"@polkadot/ui-settings": "^0.89.1",
|
|
200
200
|
"@polkadot/util": "^8.3.1",
|
|
201
201
|
"@polkadot/util-crypto": "^8.3.1",
|
|
202
|
-
"@subwallet/extension-chains": "^0.4.
|
|
203
|
-
"@subwallet/extension-dapp": "^0.4.
|
|
204
|
-
"@subwallet/extension-inject": "^0.4.
|
|
202
|
+
"@subwallet/extension-chains": "^0.4.8-0",
|
|
203
|
+
"@subwallet/extension-dapp": "^0.4.8-0",
|
|
204
|
+
"@subwallet/extension-inject": "^0.4.8-0",
|
|
205
205
|
"ethereumjs-tx": "^2.1.2",
|
|
206
206
|
"eventemitter3": "^4.0.7",
|
|
207
207
|
"rxjs": "^7.5.1",
|
package/packageInfo.js
CHANGED
|
@@ -5,5 +5,5 @@ export const packageInfo = {
|
|
|
5
5
|
name: '@subwallet/extension-base',
|
|
6
6
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
7
7
|
type: 'esm',
|
|
8
|
-
version: '0.4.
|
|
8
|
+
version: '0.4.8-0'
|
|
9
9
|
};
|