@subwallet/extension-base 0.4.9-0 → 0.5.3-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 +100 -7
- package/cjs/packageInfo.js +1 -1
- package/cjs/page/index.js +0 -7
- package/package.json +20 -20
- package/packageInfo.js +1 -1
- package/page/index.d.ts +0 -1
- package/page/index.js +0 -5
|
@@ -47,6 +47,14 @@ export interface RequestAuthorization extends RequestAuthorizationAll {
|
|
|
47
47
|
export interface RequestAuthorizationPerAccount extends RequestAuthorization {
|
|
48
48
|
address: string;
|
|
49
49
|
}
|
|
50
|
+
export interface RequestAuthorizationPerSite {
|
|
51
|
+
id: string;
|
|
52
|
+
values: Record<string, boolean>;
|
|
53
|
+
}
|
|
54
|
+
export interface RequestAuthorizationBlock {
|
|
55
|
+
id: string;
|
|
56
|
+
connectedValue: boolean;
|
|
57
|
+
}
|
|
50
58
|
export interface ResultResolver {
|
|
51
59
|
result: boolean;
|
|
52
60
|
accounts: string[];
|
|
@@ -80,11 +88,17 @@ export interface StakingItem {
|
|
|
80
88
|
nativeToken: string;
|
|
81
89
|
unit?: string;
|
|
82
90
|
state: APIItemState;
|
|
91
|
+
unlockingInfo?: UnlockingStakeInfo;
|
|
83
92
|
}
|
|
84
93
|
export interface StakingJson {
|
|
94
|
+
reset?: boolean;
|
|
85
95
|
ready?: boolean;
|
|
86
96
|
details: Record<string, StakingItem>;
|
|
87
97
|
}
|
|
98
|
+
export interface StakingStoreJson {
|
|
99
|
+
bonded: Record<string, StakingItem>;
|
|
100
|
+
reward: Array<StakingRewardItem>;
|
|
101
|
+
}
|
|
88
102
|
export interface PriceJson {
|
|
89
103
|
ready?: boolean;
|
|
90
104
|
currency: string;
|
|
@@ -140,6 +154,10 @@ export interface NftCollectionJson {
|
|
|
140
154
|
ready: boolean;
|
|
141
155
|
nftCollectionList: Array<NftCollection>;
|
|
142
156
|
}
|
|
157
|
+
export interface NftStoreJson {
|
|
158
|
+
nftList: Array<NftItem>;
|
|
159
|
+
nftCollectionList: Array<NftCollection>;
|
|
160
|
+
}
|
|
143
161
|
export interface TokenBalanceRaw {
|
|
144
162
|
reserved: BN;
|
|
145
163
|
frozen: BN;
|
|
@@ -153,13 +171,15 @@ export interface BalanceChildItem {
|
|
|
153
171
|
}
|
|
154
172
|
export interface BalanceItem {
|
|
155
173
|
state: APIItemState;
|
|
156
|
-
free
|
|
157
|
-
reserved
|
|
158
|
-
miscFrozen
|
|
159
|
-
feeFrozen
|
|
174
|
+
free?: string;
|
|
175
|
+
reserved?: string;
|
|
176
|
+
miscFrozen?: string;
|
|
177
|
+
feeFrozen?: string;
|
|
160
178
|
children?: Record<string, BalanceChildItem>;
|
|
179
|
+
timestamp?: number;
|
|
161
180
|
}
|
|
162
181
|
export interface BalanceJson {
|
|
182
|
+
reset?: boolean;
|
|
163
183
|
details: Record<string, BalanceItem>;
|
|
164
184
|
}
|
|
165
185
|
export interface CrowdloanItem {
|
|
@@ -168,6 +188,7 @@ export interface CrowdloanItem {
|
|
|
168
188
|
contribute: string;
|
|
169
189
|
}
|
|
170
190
|
export interface CrowdloanJson {
|
|
191
|
+
reset?: boolean;
|
|
171
192
|
details: Record<string, CrowdloanItem>;
|
|
172
193
|
}
|
|
173
194
|
export interface ChainRegistry {
|
|
@@ -246,6 +267,7 @@ export interface NetworkJson {
|
|
|
246
267
|
decimals?: number;
|
|
247
268
|
coinGeckoKey?: string;
|
|
248
269
|
blockExplorer?: string;
|
|
270
|
+
abiExplorer?: string;
|
|
249
271
|
dependencies?: string[];
|
|
250
272
|
getStakingOnChain?: boolean;
|
|
251
273
|
supportBonding?: boolean;
|
|
@@ -312,6 +334,7 @@ export interface OptionInputAddress {
|
|
|
312
334
|
export interface CurrentAccountInfo {
|
|
313
335
|
address: string;
|
|
314
336
|
currentGenesisHash: string | null;
|
|
337
|
+
allGenesisHash?: string;
|
|
315
338
|
}
|
|
316
339
|
export interface RequestSettingsType {
|
|
317
340
|
isShowBalance: boolean;
|
|
@@ -337,6 +360,8 @@ export interface TransactionHistoryItemType {
|
|
|
337
360
|
isSuccess: boolean;
|
|
338
361
|
action: 'send' | 'received';
|
|
339
362
|
extrinsicHash: string;
|
|
363
|
+
origin?: 'app' | 'network';
|
|
364
|
+
eventIdx?: number | null;
|
|
340
365
|
}
|
|
341
366
|
export interface RequestTransactionHistoryGet {
|
|
342
367
|
address: string;
|
|
@@ -449,12 +474,14 @@ export declare type RequestSubscribeCrowdloan = null;
|
|
|
449
474
|
export declare type RequestSubscribeNft = null;
|
|
450
475
|
export declare type RequestSubscribeStaking = null;
|
|
451
476
|
export declare type RequestSubscribeStakingReward = null;
|
|
452
|
-
export declare type ThemeTypes = 'light' | 'dark';
|
|
477
|
+
export declare type ThemeTypes = 'light' | 'dark' | 'subspace';
|
|
453
478
|
export declare type RequestNftForceUpdate = {
|
|
454
479
|
collectionId: string;
|
|
455
480
|
nft: NftItem;
|
|
456
481
|
isSendingSelf: boolean;
|
|
457
482
|
chain: string;
|
|
483
|
+
senderAddress: string;
|
|
484
|
+
recipientAddress: string;
|
|
458
485
|
};
|
|
459
486
|
export declare enum NETWORK_ERROR {
|
|
460
487
|
INVALID_INFO_TYPE = "invalidInfoType",
|
|
@@ -749,6 +776,8 @@ export interface ValidatorInfo {
|
|
|
749
776
|
isVerified: boolean;
|
|
750
777
|
minBond: number;
|
|
751
778
|
isNominated: boolean;
|
|
779
|
+
icon?: string;
|
|
780
|
+
hasScheduledRequest?: boolean;
|
|
752
781
|
}
|
|
753
782
|
export interface BondingOptionInfo {
|
|
754
783
|
isBondedBefore: boolean;
|
|
@@ -774,6 +803,7 @@ export interface BondingSubmitParams {
|
|
|
774
803
|
password?: string;
|
|
775
804
|
isBondedBefore: boolean;
|
|
776
805
|
bondedValidators: string[];
|
|
806
|
+
lockPeriod?: number;
|
|
777
807
|
}
|
|
778
808
|
export interface BasicTxResponse {
|
|
779
809
|
passwordError?: string | null;
|
|
@@ -791,30 +821,86 @@ export interface UnbondingSubmitParams {
|
|
|
791
821
|
networkKey: string;
|
|
792
822
|
address: string;
|
|
793
823
|
password?: string;
|
|
824
|
+
validatorAddress?: string;
|
|
825
|
+
unstakeAll?: boolean;
|
|
794
826
|
}
|
|
795
827
|
export interface UnlockingStakeParams {
|
|
796
828
|
address: string;
|
|
797
829
|
networkKey: string;
|
|
830
|
+
validatorList?: string[];
|
|
831
|
+
}
|
|
832
|
+
export interface DelegationItem {
|
|
833
|
+
owner: string;
|
|
834
|
+
amount: string;
|
|
835
|
+
identity?: string;
|
|
836
|
+
minBond: string;
|
|
837
|
+
hasScheduledRequest: boolean;
|
|
798
838
|
}
|
|
799
839
|
export interface UnlockingStakeInfo {
|
|
800
840
|
nextWithdrawal: number;
|
|
801
841
|
redeemable: number;
|
|
802
842
|
nextWithdrawalAmount: number;
|
|
843
|
+
nextWithdrawalAction?: string;
|
|
844
|
+
validatorAddress?: string;
|
|
845
|
+
}
|
|
846
|
+
export interface StakeUnlockingJson {
|
|
847
|
+
timestamp: number;
|
|
848
|
+
details: Record<string, UnlockingStakeInfo>;
|
|
803
849
|
}
|
|
804
850
|
export interface StakeWithdrawalParams {
|
|
805
851
|
address: string;
|
|
806
852
|
networkKey: string;
|
|
807
853
|
password?: string;
|
|
854
|
+
validatorAddress?: string;
|
|
855
|
+
action?: string;
|
|
856
|
+
}
|
|
857
|
+
export interface StakeClaimRewardParams {
|
|
858
|
+
address: string;
|
|
859
|
+
networkKey: string;
|
|
860
|
+
validatorAddress?: string;
|
|
861
|
+
password?: string;
|
|
862
|
+
}
|
|
863
|
+
export interface StakeDelegationRequest {
|
|
864
|
+
address: string;
|
|
865
|
+
networkKey: string;
|
|
866
|
+
}
|
|
867
|
+
export interface SingleModeJson {
|
|
868
|
+
networkKeys: string[];
|
|
869
|
+
theme: ThemeTypes;
|
|
870
|
+
autoTriggerDomain: string;
|
|
871
|
+
}
|
|
872
|
+
export declare type NestedArray<T> = T | NestedArray<T>[];
|
|
873
|
+
export interface EVMTransactionArg {
|
|
874
|
+
name: string;
|
|
875
|
+
type: string;
|
|
876
|
+
value: string;
|
|
877
|
+
children?: EVMTransactionArg[];
|
|
878
|
+
}
|
|
879
|
+
export interface ParseEVMTransactionData {
|
|
880
|
+
method: string;
|
|
881
|
+
methodName: string;
|
|
882
|
+
args: EVMTransactionArg[];
|
|
883
|
+
}
|
|
884
|
+
export interface RequestParseEVMTransactionInput {
|
|
885
|
+
data: string;
|
|
886
|
+
contract: string;
|
|
887
|
+
chainId: number;
|
|
888
|
+
}
|
|
889
|
+
export interface ResponseParseEVMTransactionInput {
|
|
890
|
+
result: ParseEVMTransactionData | string;
|
|
808
891
|
}
|
|
809
892
|
export interface KoniRequestSignatures {
|
|
893
|
+
'pri(staking.delegationInfo)': [StakeDelegationRequest, DelegationItem[]];
|
|
894
|
+
'pri(staking.submitClaimReward)': [StakeClaimRewardParams, BasicTxResponse, BasicTxResponse];
|
|
895
|
+
'pri(staking.claimRewardTxInfo)': [StakeClaimRewardParams, BasicTxInfo];
|
|
810
896
|
'pri(unbonding.submitWithdrawal)': [StakeWithdrawalParams, BasicTxResponse, BasicTxResponse];
|
|
811
897
|
'pri(unbonding.withdrawalTxInfo)': [StakeWithdrawalParams, BasicTxInfo];
|
|
812
|
-
'pri(unbonding.
|
|
898
|
+
'pri(unbonding.subscribeUnlockingInfo)': [null, StakeUnlockingJson, StakeUnlockingJson];
|
|
813
899
|
'pri(unbonding.submitTransaction)': [UnbondingSubmitParams, BasicTxResponse, BasicTxResponse];
|
|
814
900
|
'pri(unbonding.txInfo)': [UnbondingSubmitParams, BasicTxInfo];
|
|
815
901
|
'pri(bonding.txInfo)': [BondingSubmitParams, BasicTxInfo];
|
|
816
902
|
'pri(bonding.submitTransaction)': [BondingSubmitParams, BasicTxResponse, BasicTxResponse];
|
|
817
|
-
'pri(bonding.getChainBondingBasics)': [NetworkJson[], Record<string, ChainBondingBasics>];
|
|
903
|
+
'pri(bonding.getChainBondingBasics)': [NetworkJson[], Record<string, ChainBondingBasics>, Record<string, ChainBondingBasics>];
|
|
818
904
|
'pri(bonding.getBondingOptions)': [BondingOptionParams, BondingOptionInfo];
|
|
819
905
|
'pri(networkMap.recoverDotSama)': [string, boolean];
|
|
820
906
|
'pri(substrateNft.submitTransaction)': [SubstrateNftSubmitTransaction, NftTransactionResponse, NftTransactionResponse];
|
|
@@ -861,6 +947,8 @@ export interface KoniRequestSignatures {
|
|
|
861
947
|
'pri(authorize.changeSiteAll)': [RequestAuthorizationAll, boolean, AuthUrls];
|
|
862
948
|
'pri(authorize.changeSite)': [RequestAuthorization, boolean, AuthUrls];
|
|
863
949
|
'pri(authorize.changeSitePerAccount)': [RequestAuthorizationPerAccount, boolean, AuthUrls];
|
|
950
|
+
'pri(authorize.changeSitePerSite)': [RequestAuthorizationPerSite, boolean];
|
|
951
|
+
'pri(authorize.changeSiteBlock)': [RequestAuthorizationBlock, boolean];
|
|
864
952
|
'pri(authorize.forgetSite)': [RequestForgetSite, boolean, AuthUrls];
|
|
865
953
|
'pri(authorize.forgetAllSite)': [null, boolean, AuthUrls];
|
|
866
954
|
'pri(authorize.rejectV2)': [RequestAuthorizeReject, boolean];
|
|
@@ -902,5 +990,10 @@ export interface KoniRequestSignatures {
|
|
|
902
990
|
'evm(events.subscribe)': [RequestEvmEvents, boolean, EvmEvent];
|
|
903
991
|
'evm(request)': [RequestArguments, unknown];
|
|
904
992
|
'evm(provider.send)': [RequestEvmProviderSend, string | number, ResponseEvmProviderSend];
|
|
993
|
+
'pri(evm.transaction.parse.input)': [RequestParseEVMTransactionInput, ResponseParseEVMTransactionInput];
|
|
994
|
+
'pri(authorize.subscribe)': [null, AuthUrls, AuthUrls];
|
|
995
|
+
}
|
|
996
|
+
export interface ApplicationMetadataType {
|
|
997
|
+
version: string;
|
|
905
998
|
}
|
|
906
999
|
export {};
|
package/cjs/packageInfo.js
CHANGED
package/cjs/page/index.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.enable = enable;
|
|
9
9
|
exports.handleResponse = handleResponse;
|
|
10
|
-
exports.redirectIfPhishing = redirectIfPhishing;
|
|
11
10
|
exports.sendMessage = sendMessage;
|
|
12
11
|
|
|
13
12
|
var _defaults = require("../defaults");
|
|
@@ -45,12 +44,6 @@ async function enable(origin) {
|
|
|
45
44
|
origin
|
|
46
45
|
});
|
|
47
46
|
return new _Injected.default(sendMessage);
|
|
48
|
-
} // redirect users if this page is considered as phishing, otherwise return false
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
async function redirectIfPhishing() {
|
|
52
|
-
const res = await sendMessage('pub(phishing.redirectIfDenied)');
|
|
53
|
-
return res;
|
|
54
47
|
}
|
|
55
48
|
|
|
56
49
|
function handleResponse(data) {
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "0.
|
|
20
|
+
"version": "0.5.3-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -187,26 +187,26 @@
|
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
"dependencies": {
|
|
190
|
-
"@babel/runtime": "^7.
|
|
191
|
-
"@ethereumjs/common": "^2.6.
|
|
192
|
-
"@polkadot/api": "^
|
|
193
|
-
"@polkadot/keyring": "^
|
|
194
|
-
"@polkadot/networks": "^
|
|
195
|
-
"@polkadot/phishing": "^0.
|
|
196
|
-
"@polkadot/rpc-provider": "^
|
|
197
|
-
"@polkadot/types": "^
|
|
198
|
-
"@polkadot/ui-keyring": "^
|
|
199
|
-
"@polkadot/ui-settings": "^
|
|
200
|
-
"@polkadot/util": "^
|
|
201
|
-
"@polkadot/util-crypto": "^
|
|
202
|
-
"@subwallet/extension-chains": "^0.
|
|
203
|
-
"@subwallet/extension-dapp": "^0.
|
|
204
|
-
"@subwallet/extension-inject": "^0.
|
|
190
|
+
"@babel/runtime": "^7.18.6",
|
|
191
|
+
"@ethereumjs/common": "^2.6.5",
|
|
192
|
+
"@polkadot/api": "^8.11.3",
|
|
193
|
+
"@polkadot/keyring": "^9.7.2",
|
|
194
|
+
"@polkadot/networks": "^9.7.2",
|
|
195
|
+
"@polkadot/phishing": "^0.16.2",
|
|
196
|
+
"@polkadot/rpc-provider": "^8.11.3",
|
|
197
|
+
"@polkadot/types": "^8.11.3",
|
|
198
|
+
"@polkadot/ui-keyring": "^2.7.2",
|
|
199
|
+
"@polkadot/ui-settings": "^2.7.2",
|
|
200
|
+
"@polkadot/util": "^9.7.2",
|
|
201
|
+
"@polkadot/util-crypto": "^9.7.2",
|
|
202
|
+
"@subwallet/extension-chains": "^0.5.3-0",
|
|
203
|
+
"@subwallet/extension-dapp": "^0.5.3-0",
|
|
204
|
+
"@subwallet/extension-inject": "^0.5.3-0",
|
|
205
205
|
"ethereumjs-tx": "^2.1.2",
|
|
206
206
|
"eventemitter3": "^4.0.7",
|
|
207
|
-
"rxjs": "^7.5.
|
|
208
|
-
"web3": "^1.7.
|
|
209
|
-
"web3-core": "^1.7.
|
|
210
|
-
"web3-core-helpers": "^1.7.
|
|
207
|
+
"rxjs": "^7.5.5",
|
|
208
|
+
"web3": "^1.7.4",
|
|
209
|
+
"web3-core": "^1.7.4",
|
|
210
|
+
"web3-core-helpers": "^1.7.4"
|
|
211
211
|
}
|
|
212
212
|
}
|
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.
|
|
8
|
+
version: '0.5.3-0'
|
|
9
9
|
};
|
package/page/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export declare function sendMessage<TMessageType extends MessageTypesWithNullReq
|
|
|
10
10
|
export declare function sendMessage<TMessageType extends MessageTypesWithNoSubscriptions>(message: TMessageType, request: RequestTypes[TMessageType]): Promise<ResponseTypes[TMessageType]>;
|
|
11
11
|
export declare function sendMessage<TMessageType extends MessageTypesWithSubscriptions>(message: TMessageType, request: RequestTypes[TMessageType], subscriber: (data: SubscriptionMessageTypes[TMessageType]) => void): Promise<ResponseTypes[TMessageType]>;
|
|
12
12
|
export declare function enable(origin: string): Promise<Injected>;
|
|
13
|
-
export declare function redirectIfPhishing(): Promise<boolean>;
|
|
14
13
|
export declare function handleResponse<TMessageType extends MessageTypes>(data: TransportResponseMessage<TMessageType> & {
|
|
15
14
|
subscription?: string;
|
|
16
15
|
}): void;
|
package/page/index.js
CHANGED
|
@@ -35,11 +35,6 @@ export async function enable(origin) {
|
|
|
35
35
|
origin
|
|
36
36
|
});
|
|
37
37
|
return new Injected(sendMessage);
|
|
38
|
-
} // redirect users if this page is considered as phishing, otherwise return false
|
|
39
|
-
|
|
40
|
-
export async function redirectIfPhishing() {
|
|
41
|
-
const res = await sendMessage('pub(phishing.redirectIfDenied)');
|
|
42
|
-
return res;
|
|
43
38
|
}
|
|
44
39
|
export function handleResponse(data) {
|
|
45
40
|
const handler = handlers[data.id];
|