@subwallet/extension-base 1.1.43-0 → 1.1.45-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/cjs/koni/api/dotsama/transfer.js +9 -9
- package/cjs/koni/api/nft/index.js +1 -1
- package/cjs/koni/api/nft/ordinal_nft/constants.js +1 -5
- package/cjs/koni/api/nft/ordinal_nft/index.js +3 -8
- package/cjs/koni/api/nft/transfer.js +22 -12
- package/cjs/koni/api/nft/unique_network_nft/index.js +10 -9
- package/cjs/koni/background/handlers/Extension.js +1 -1
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +9 -6
- package/cjs/services/chain-service/index.js +5 -5
- package/cjs/services/earning-service/constants/chains.js +1 -1
- package/cjs/services/earning-service/service.js +1 -1
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +67 -0
- package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting.js +22 -19
- package/cjs/services/migration-service/scripts/index.js +6 -4
- package/cjs/services/subscan-service/index.js +80 -18
- package/cjs/services/subscan-service/subscan-chain-map.js +3 -1
- package/cjs/services/transaction-service/utils.js +3 -0
- package/koni/api/dotsama/transfer.js +9 -9
- package/koni/api/nft/index.js +2 -2
- package/koni/api/nft/ordinal_nft/constants.d.ts +0 -2
- package/koni/api/nft/ordinal_nft/constants.js +0 -2
- package/koni/api/nft/ordinal_nft/index.d.ts +1 -1
- package/koni/api/nft/ordinal_nft/index.js +3 -8
- package/koni/api/nft/transfer.d.ts +2 -2
- package/koni/api/nft/transfer.js +22 -12
- package/koni/api/nft/unique_network_nft/index.js +10 -9
- package/koni/background/handlers/Extension.js +1 -1
- package/package.json +11 -11
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.d.ts +0 -1
- package/services/chain-service/constants.js +9 -6
- package/services/chain-service/index.js +5 -5
- package/services/earning-service/constants/chains.js +1 -1
- package/services/earning-service/service.js +1 -1
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js +58 -0
- package/services/migration-service/scripts/databases/MigrateAssetSetting.js +22 -19
- package/services/migration-service/scripts/index.js +6 -3
- package/services/subscan-service/index.d.ts +8 -1
- package/services/subscan-service/index.js +79 -18
- package/services/subscan-service/subscan-chain-map.js +3 -1
- package/services/subscan-service/types.d.ts +7 -0
- package/services/transaction-service/utils.js +3 -0
- package/cjs/koni/api/nft/ordinal_nft/utils.js +0 -41
- package/koni/api/nft/ordinal_nft/utils.d.ts +0 -2
- package/koni/api/nft/ordinal_nft/utils.js +0 -33
|
@@ -138,7 +138,9 @@ const SUBSCAN_BALANCE_CHAIN_MAP = {
|
|
|
138
138
|
vara_network: 'vara',
|
|
139
139
|
bifrost: 'bifrost',
|
|
140
140
|
creditcoin: 'creditcoin',
|
|
141
|
-
joystream: 'joystream'
|
|
141
|
+
joystream: 'joystream',
|
|
142
|
+
manta_network: 'manta',
|
|
143
|
+
continuum_network: 'continuum'
|
|
142
144
|
};
|
|
143
145
|
exports.SUBSCAN_BALANCE_CHAIN_MAP = SUBSCAN_BALANCE_CHAIN_MAP;
|
|
144
146
|
const SUBSCAN_BALANCE_CHAIN_MAP_REVERSE = Object.fromEntries(Object.entries(SUBSCAN_BALANCE_CHAIN_MAP).map(_ref => {
|
|
@@ -28,6 +28,9 @@ function getBlockExplorerAccountRoute(explorerLink) {
|
|
|
28
28
|
if (explorerLink.includes('3dpscan.io')) {
|
|
29
29
|
return 'account';
|
|
30
30
|
}
|
|
31
|
+
if (explorerLink.includes('explorer.polimec.org')) {
|
|
32
|
+
return 'account';
|
|
33
|
+
}
|
|
31
34
|
return 'address';
|
|
32
35
|
}
|
|
33
36
|
function getBlockExplorerTxRoute(chainInfo) {
|
|
@@ -78,9 +78,9 @@ export async function checkSupportTransfer(networkKey, tokenInfo, substrateApiMa
|
|
|
78
78
|
) {
|
|
79
79
|
result.supportTransfer = false;
|
|
80
80
|
result.supportTransferAll = false;
|
|
81
|
-
|
|
82
|
-
result.supportTransfer = true;
|
|
83
|
-
result.supportTransferAll = true;
|
|
81
|
+
// } else if (_TRANSFER_CHAIN_GROUP.crab.includes(networkKey) && _BALANCE_TOKEN_GROUP.crab.includes(tokenInfo.symbol)) {
|
|
82
|
+
// result.supportTransfer = true;
|
|
83
|
+
// result.supportTransferAll = true;
|
|
84
84
|
} else if (isTxBalancesSupported && _isNativeToken(tokenInfo)) {
|
|
85
85
|
result.supportTransfer = true;
|
|
86
86
|
result.supportTransferAll = true;
|
|
@@ -164,12 +164,12 @@ export const createTransferExtrinsic = async ({
|
|
|
164
164
|
) {
|
|
165
165
|
// transfer = api.tx.eqBalances.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
|
|
166
166
|
/* empty */
|
|
167
|
-
|
|
168
|
-
if (transferAll) {
|
|
169
|
-
|
|
170
|
-
} else if (value) {
|
|
171
|
-
|
|
172
|
-
}
|
|
167
|
+
// } else if (!_isNativeToken(tokenInfo) && (_TRANSFER_CHAIN_GROUP.crab.includes(networkKey) || _BALANCE_TOKEN_GROUP.crab.includes(tokenInfo.symbol))) {
|
|
168
|
+
// if (transferAll) {
|
|
169
|
+
// transfer = api.tx.kton.transferAll(to, false);
|
|
170
|
+
// } else if (value) {
|
|
171
|
+
// transfer = api.tx.kton.transfer(to, new BN(value));
|
|
172
|
+
// }
|
|
173
173
|
} else if (_TRANSFER_CHAIN_GROUP.bitcountry.includes(networkKey) && !_isNativeToken(tokenInfo)) {
|
|
174
174
|
transfer = api.tx.currencies.transfer(to, _getTokenOnChainInfo(tokenInfo), value);
|
|
175
175
|
} else if (_TRANSFER_CHAIN_GROUP.statemine.includes(networkKey) && !_isNativeToken(tokenInfo)) {
|
package/koni/api/nft/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { VaraNftApi } from '@subwallet/extension-base/koni/api/nft/vara_nft';
|
|
|
14
14
|
import { WasmNftApi } from '@subwallet/extension-base/koni/api/nft/wasm_nft';
|
|
15
15
|
import { _NFT_CHAIN_GROUP } from '@subwallet/extension-base/services/chain-service/constants';
|
|
16
16
|
import { _isChainSupportEvmNft, _isChainSupportNativeNft, _isChainSupportWasmNft, _isSupportOrdinal } from '@subwallet/extension-base/services/chain-service/utils';
|
|
17
|
-
import { categoryAddresses } from '@subwallet/extension-base/utils';
|
|
17
|
+
import { categoryAddresses, targetIsWeb } from '@subwallet/extension-base/utils';
|
|
18
18
|
import StatemintNftApi from "./statemint_nft/index.js";
|
|
19
19
|
function createSubstrateNftApi(chain, substrateApi, addresses) {
|
|
20
20
|
const [substrateAddresses] = categoryAddresses(addresses);
|
|
@@ -127,7 +127,7 @@ export class NftHandler {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
if (_isSupportOrdinal(chain)) {
|
|
130
|
+
if (_isSupportOrdinal(chain) && targetIsWeb) {
|
|
131
131
|
var _chainInfo$extraInfo;
|
|
132
132
|
const subscanChain = (_chainInfo$extraInfo = chainInfo.extraInfo) === null || _chainInfo$extraInfo === void 0 ? void 0 : _chainInfo$extraInfo.subscanSlug;
|
|
133
133
|
if (subscanChain) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export declare const GET_EVENT_LIST_API = "https://{{chain}}.api.subscan.io/api/v2/scan/events";
|
|
2
|
-
export declare const GET_EXTRINSIC_PARAMS_API = "https://{{chain}}.api.subscan.io/api/scan/extrinsic/params";
|
|
3
1
|
export declare const BASE_FETCH_ORDINAL_EVENT_DATA: {
|
|
4
2
|
event_id: string;
|
|
5
3
|
module: string;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
export const GET_EVENT_LIST_API = 'https://{{chain}}.api.subscan.io/api/v2/scan/events';
|
|
5
|
-
export const GET_EXTRINSIC_PARAMS_API = 'https://{{chain}}.api.subscan.io/api/scan/extrinsic/params';
|
|
6
4
|
export const BASE_FETCH_ORDINAL_EVENT_DATA = {
|
|
7
5
|
event_id: 'Remarked',
|
|
8
6
|
module: 'system',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseNftApi, HandleNftParams } from '
|
|
1
|
+
import { BaseNftApi, HandleNftParams } from '../nft';
|
|
2
2
|
export default class OrdinalNftApi extends BaseNftApi {
|
|
3
3
|
subscanChain: string;
|
|
4
4
|
constructor(addresses: string[], chain: string, subscanChain: string);
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { ORDINAL_COLLECTION } from '@subwallet/extension-base/constants';
|
|
5
|
-
import { BaseNftApi } from '@subwallet/extension-base/koni/api/nft/nft';
|
|
6
|
-
import { fetchExtrinsicParams, fetchRemarkEvent } from '@subwallet/extension-base/koni/api/nft/ordinal_nft/utils';
|
|
7
5
|
import { state } from '@subwallet/extension-base/koni/background/handlers';
|
|
6
|
+
import { BaseNftApi } from "../nft.js";
|
|
8
7
|
const parseParamData = (param, event, chain, address) => {
|
|
9
8
|
const ordinalData = JSON.parse(param.value);
|
|
10
9
|
if ('p' in ordinalData) {
|
|
@@ -46,14 +45,10 @@ export default class OrdinalNftApi extends BaseNftApi {
|
|
|
46
45
|
this.subscanChain = subscanChain;
|
|
47
46
|
}
|
|
48
47
|
async handleNft(address, handleNftParams) {
|
|
49
|
-
const events = await state.subscanService.
|
|
50
|
-
return await fetchRemarkEvent(this.subscanChain, address);
|
|
51
|
-
});
|
|
48
|
+
const events = await state.subscanService.getAccountRemarkEvents(this.subscanChain, address);
|
|
52
49
|
if (events && events.length) {
|
|
53
50
|
const extrinsicIds = events.map(data => data.extrinsic_index);
|
|
54
|
-
const extrinsicParams = await state.subscanService.
|
|
55
|
-
return await fetchExtrinsicParams(this.subscanChain, extrinsicIds);
|
|
56
|
-
});
|
|
51
|
+
const extrinsicParams = await state.subscanService.getExtrinsicParams(this.subscanChain, extrinsicIds);
|
|
57
52
|
const items = [];
|
|
58
53
|
for (const data of extrinsicParams) {
|
|
59
54
|
const {
|
|
@@ -2,7 +2,7 @@ import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/
|
|
|
2
2
|
export declare function isRecipientSelf(currentAddress: string, recipientAddress: string): boolean;
|
|
3
3
|
export declare function acalaGetExtrinsic(substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null;
|
|
4
4
|
export declare function rmrkGetExtrinsic(substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null;
|
|
5
|
-
export declare function uniqueGetExtrinsic(substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null
|
|
5
|
+
export declare function uniqueGetExtrinsic(substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): Promise<import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null>;
|
|
6
6
|
export declare function statemineGetExtrinsic(substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null;
|
|
7
7
|
export declare function statemintGetExtrinsic(substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null;
|
|
8
|
-
export declare function getNftTransferExtrinsic(networkKey: string, substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null
|
|
8
|
+
export declare function getNftTransferExtrinsic(networkKey: string, substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): Promise<import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null>;
|
package/koni/api/nft/transfer.js
CHANGED
|
@@ -29,13 +29,24 @@ export function rmrkGetExtrinsic(substrateApi, senderAddress, recipientAddress,
|
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
export function uniqueGetExtrinsic(substrateApi, senderAddress, recipientAddress, params) {
|
|
32
|
+
export async function uniqueGetExtrinsic(substrateApi, senderAddress, recipientAddress, params) {
|
|
33
33
|
try {
|
|
34
34
|
const itemId = params.itemId;
|
|
35
35
|
const collectionId = params.collectionId;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
39
|
+
const collectionInfo = (await substrateApi.api.rpc.unique.collectionById(collectionId)).toHuman();
|
|
40
|
+
const isTransfersEnabled = collectionInfo.limits.transfersEnabled;
|
|
41
|
+
|
|
42
|
+
// isTransfersEnabled equal to null mean that it's set as default (enable transfer)
|
|
43
|
+
if (isTransfersEnabled || isTransfersEnabled === null) {
|
|
44
|
+
return substrateApi.api.tx.unique.transfer({
|
|
45
|
+
Substrate: recipientAddress
|
|
46
|
+
}, collectionId, itemId, 1);
|
|
47
|
+
} else {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
39
50
|
} catch (e) {
|
|
40
51
|
console.error(e);
|
|
41
52
|
return null;
|
|
@@ -61,7 +72,7 @@ export function statemintGetExtrinsic(substrateApi, senderAddress, recipientAddr
|
|
|
61
72
|
return null;
|
|
62
73
|
}
|
|
63
74
|
}
|
|
64
|
-
export function getNftTransferExtrinsic(networkKey, substrateApi, senderAddress, recipientAddress, params) {
|
|
75
|
+
export async function getNftTransferExtrinsic(networkKey, substrateApi, senderAddress, recipientAddress, params) {
|
|
65
76
|
switch (networkKey) {
|
|
66
77
|
case SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.acala:
|
|
67
78
|
return acalaGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
@@ -69,13 +80,12 @@ export function getNftTransferExtrinsic(networkKey, substrateApi, senderAddress,
|
|
|
69
80
|
return acalaGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
70
81
|
case SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.kusama:
|
|
71
82
|
return rmrkGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// return uniqueGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
83
|
+
case SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.uniqueNft:
|
|
84
|
+
return await uniqueGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
85
|
+
case SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.quartz:
|
|
86
|
+
return await uniqueGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
87
|
+
case SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.opal:
|
|
88
|
+
return await uniqueGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
79
89
|
case SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.statemine:
|
|
80
90
|
return statemineGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
81
91
|
case SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.statemint:
|
|
@@ -18,18 +18,19 @@ export class UniqueNftApi extends BaseNftApi {
|
|
|
18
18
|
const attRecord = nft.attributes;
|
|
19
19
|
if (attRecord) {
|
|
20
20
|
for (const item in attRecord) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const attName = attRecord[item].name._;
|
|
22
|
+
const attInfo = attRecord[item].value;
|
|
23
|
+
if (Array.isArray(attInfo)) {
|
|
24
|
+
const attList = [];
|
|
25
|
+
for (const trait of attInfo) {
|
|
26
|
+
attList.push(trait._);
|
|
26
27
|
}
|
|
27
|
-
propertiesMap
|
|
28
|
-
value:
|
|
28
|
+
propertiesMap[attName] = {
|
|
29
|
+
value: attList
|
|
29
30
|
};
|
|
30
31
|
} else {
|
|
31
|
-
propertiesMap[
|
|
32
|
-
value:
|
|
32
|
+
propertiesMap[attName] = {
|
|
33
|
+
value: attInfo._
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -2005,7 +2005,7 @@ export default class KoniExtension {
|
|
|
2005
2005
|
const isPSP34 = params === null || params === void 0 ? void 0 : params.isPsp34;
|
|
2006
2006
|
const networkKey = params === null || params === void 0 ? void 0 : params.networkKey;
|
|
2007
2007
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
2008
|
-
const extrinsic = !isPSP34 ? getNftTransferExtrinsic(networkKey, apiProps, senderAddress, recipientAddress, params || {}) : await getPSP34TransferExtrinsic(networkKey, apiProps, senderAddress, recipientAddress, params || {});
|
|
2008
|
+
const extrinsic = !isPSP34 ? await getNftTransferExtrinsic(networkKey, apiProps, senderAddress, recipientAddress, params || {}) : await getPSP34TransferExtrinsic(networkKey, apiProps, senderAddress, recipientAddress, params || {});
|
|
2009
2009
|
|
|
2010
2010
|
// this.addContact(recipientAddress);
|
|
2011
2011
|
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.1.
|
|
20
|
+
"version": "1.1.45-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -234,11 +234,6 @@
|
|
|
234
234
|
"require": "./cjs/koni/api/nft/ordinal_nft/constants.js",
|
|
235
235
|
"default": "./koni/api/nft/ordinal_nft/constants.js"
|
|
236
236
|
},
|
|
237
|
-
"./koni/api/nft/ordinal_nft/utils": {
|
|
238
|
-
"types": "./koni/api/nft/ordinal_nft/utils.d.ts",
|
|
239
|
-
"require": "./cjs/koni/api/nft/ordinal_nft/utils.js",
|
|
240
|
-
"default": "./koni/api/nft/ordinal_nft/utils.js"
|
|
241
|
-
},
|
|
242
237
|
"./koni/api/nft/quartz_nft": {
|
|
243
238
|
"types": "./koni/api/nft/quartz_nft/index.d.ts",
|
|
244
239
|
"require": "./cjs/koni/api/nft/quartz_nft/index.js",
|
|
@@ -1030,6 +1025,11 @@
|
|
|
1030
1025
|
"require": "./cjs/services/migration-service/scripts/MigrateTransactionHistory.js",
|
|
1031
1026
|
"default": "./services/migration-service/scripts/MigrateTransactionHistory.js"
|
|
1032
1027
|
},
|
|
1028
|
+
"./services/migration-service/scripts/MigrateTransactionHistoryBySymbol": {
|
|
1029
|
+
"types": "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol.d.ts",
|
|
1030
|
+
"require": "./cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js",
|
|
1031
|
+
"default": "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol.js"
|
|
1032
|
+
},
|
|
1033
1033
|
"./services/migration-service/scripts/MigrateWalletReference": {
|
|
1034
1034
|
"types": "./services/migration-service/scripts/MigrateWalletReference.d.ts",
|
|
1035
1035
|
"require": "./cjs/services/migration-service/scripts/MigrateWalletReference.js",
|
|
@@ -1791,11 +1791,11 @@
|
|
|
1791
1791
|
"@reduxjs/toolkit": "^1.9.1",
|
|
1792
1792
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1793
1793
|
"@substrate/connect": "^0.7.26",
|
|
1794
|
-
"@subwallet/chain-list": "0.2.
|
|
1795
|
-
"@subwallet/extension-base": "^1.1.
|
|
1796
|
-
"@subwallet/extension-chains": "^1.1.
|
|
1797
|
-
"@subwallet/extension-dapp": "^1.1.
|
|
1798
|
-
"@subwallet/extension-inject": "^1.1.
|
|
1794
|
+
"@subwallet/chain-list": "0.2.47",
|
|
1795
|
+
"@subwallet/extension-base": "^1.1.45-0",
|
|
1796
|
+
"@subwallet/extension-chains": "^1.1.45-0",
|
|
1797
|
+
"@subwallet/extension-dapp": "^1.1.45-0",
|
|
1798
|
+
"@subwallet/extension-inject": "^1.1.45-0",
|
|
1799
1799
|
"@subwallet/keyring": "^0.1.3",
|
|
1800
1800
|
"@subwallet/ui-keyring": "^0.1.3",
|
|
1801
1801
|
"@walletconnect/sign-client": "^2.8.4",
|
package/packageInfo.js
CHANGED
|
@@ -7,5 +7,5 @@ export const packageInfo = {
|
|
|
7
7
|
name: '@subwallet/extension-base',
|
|
8
8
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
9
9
|
type: 'esm',
|
|
10
|
-
version: '1.1.
|
|
10
|
+
version: '1.1.45-0'
|
|
11
11
|
};
|
|
@@ -29,7 +29,7 @@ export const _BALANCE_CHAIN_GROUP = {
|
|
|
29
29
|
genshiro: ['genshiro_testnet', 'genshiro'],
|
|
30
30
|
equilibrium_parachain: ['equilibrium_parachain'],
|
|
31
31
|
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude', 'continuum_network'],
|
|
32
|
-
statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet'],
|
|
32
|
+
statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari', 'manta_network', 'rococo_assethub', 'liberlandTest', 'liberland', 'dentnet', 'pangolin'],
|
|
33
33
|
kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'],
|
|
34
34
|
// perhaps there are some runtime updates
|
|
35
35
|
centrifuge: ['centrifuge'],
|
|
@@ -87,7 +87,8 @@ export const _STAKING_ERA_LENGTH_MAP = {
|
|
|
87
87
|
vara_network: 12,
|
|
88
88
|
goldberg_testnet: 24,
|
|
89
89
|
manta_network: 6,
|
|
90
|
-
krest_network: 4
|
|
90
|
+
krest_network: 4,
|
|
91
|
+
polimec: 6
|
|
91
92
|
};
|
|
92
93
|
export const _EXPECTED_BLOCK_TIME = {
|
|
93
94
|
// in seconds
|
|
@@ -103,7 +104,8 @@ export const _EXPECTED_BLOCK_TIME = {
|
|
|
103
104
|
edgeware: 6,
|
|
104
105
|
creditcoin: 12,
|
|
105
106
|
vara_network: 3,
|
|
106
|
-
goldberg_testnet: 20
|
|
107
|
+
goldberg_testnet: 20,
|
|
108
|
+
polimec: 12
|
|
107
109
|
};
|
|
108
110
|
export const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
109
111
|
moonbeam: {
|
|
@@ -201,7 +203,7 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
201
203
|
acala: ['karura', 'acala', 'acala_testnet'],
|
|
202
204
|
kintsugi: ['kintsugi', 'kintsugi_test', 'interlay', 'mangatax_para'],
|
|
203
205
|
genshiro: ['genshiro_testnet', 'genshiro', 'equilibrium_parachain'],
|
|
204
|
-
crab: ['crab', 'pangolin'],
|
|
206
|
+
// crab: ['crab', 'pangolin'],
|
|
205
207
|
bitcountry: ['pioneer', 'bitcountry', 'bifrost', 'bifrost_dot'],
|
|
206
208
|
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel', 'liberland', 'liberlandTest', 'dentnet'],
|
|
207
209
|
riochain: ['riochain'],
|
|
@@ -209,7 +211,7 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
209
211
|
avail: ['kate', 'goldberg_testnet'],
|
|
210
212
|
pendulum: ['pendulum', 'amplitude', 'amplitude_test', 'hydradx_main'],
|
|
211
213
|
centrifuge: ['centrifuge'],
|
|
212
|
-
disable_transfer: ['invarch']
|
|
214
|
+
disable_transfer: ['invarch', 'crab', 'pangolin']
|
|
213
215
|
};
|
|
214
216
|
export const _BALANCE_PARSING_CHAIN_GROUP = {
|
|
215
217
|
bobabeam: ['bobabeam', 'bobabase']
|
|
@@ -237,7 +239,8 @@ export const _XCM_TYPE = {
|
|
|
237
239
|
export const _DEFAULT_ACTIVE_CHAINS = [..._DEFAULT_CHAINS, 'vara_network'];
|
|
238
240
|
export const EVM_PASS_CONNECT_STATUS = {
|
|
239
241
|
arbitrum_one: ['*'],
|
|
240
|
-
okxTest: ['*']
|
|
242
|
+
okxTest: ['*'],
|
|
243
|
+
astarZkEvm: ['*']
|
|
241
244
|
};
|
|
242
245
|
export const EVM_REFORMAT_DECIMALS = {
|
|
243
246
|
acala: ['acala_evm', 'karura_evm']
|
|
@@ -1497,15 +1497,15 @@ export class ChainService {
|
|
|
1497
1497
|
const chainInfoMap = this.getChainInfoMap();
|
|
1498
1498
|
Object.values(chainInfoMap).forEach(i => {
|
|
1499
1499
|
var _i$extraInfo;
|
|
1500
|
-
|
|
1500
|
+
const subscanSlug = i.slug === 'goldberg_testnet' ? 'avail-testnet' : (_i$extraInfo = i.extraInfo) === null || _i$extraInfo === void 0 ? void 0 : _i$extraInfo.subscanSlug; // Hotfix for Goldberg testnet
|
|
1501
|
+
|
|
1502
|
+
if (!subscanSlug) {
|
|
1501
1503
|
return;
|
|
1502
1504
|
}
|
|
1503
1505
|
if (!reverse) {
|
|
1504
|
-
|
|
1505
|
-
result[i.slug] = (_i$extraInfo2 = i.extraInfo) === null || _i$extraInfo2 === void 0 ? void 0 : _i$extraInfo2.subscanSlug;
|
|
1506
|
+
result[i.slug] = subscanSlug;
|
|
1506
1507
|
} else {
|
|
1507
|
-
|
|
1508
|
-
result[(_i$extraInfo3 = i.extraInfo) === null || _i$extraInfo3 === void 0 ? void 0 : _i$extraInfo3.subscanSlug] = i.slug;
|
|
1508
|
+
result[subscanSlug] = i.slug;
|
|
1509
1509
|
}
|
|
1510
1510
|
});
|
|
1511
1511
|
return result;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
export const _STAKING_CHAIN_GROUP = {
|
|
5
5
|
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network', 'goldberg_testnet'],
|
|
6
|
-
para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari', 'manta_network'],
|
|
6
|
+
para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari', 'manta_network', 'polimec'],
|
|
7
7
|
astar: ['astar', 'shiden', 'shibuya'],
|
|
8
8
|
amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine', 'pendulum', 'krest_network'],
|
|
9
9
|
// amplitude and kilt only share some common logic
|
|
@@ -270,7 +270,7 @@ export default class EarningService {
|
|
|
270
270
|
const unsubList = [];
|
|
271
271
|
for (const handler of Object.values(this.handlers)) {
|
|
272
272
|
// Force subscribe onchain data
|
|
273
|
-
const forceSubscribe = handler.type === YieldPoolType.LIQUID_STAKING || handler.type === YieldPoolType.LENDING;
|
|
273
|
+
const forceSubscribe = handler.type === YieldPoolType.LIQUID_STAKING || handler.type === YieldPoolType.LENDING || !onlineData[handler.slug];
|
|
274
274
|
if (!this.useOnlineCacheOnly || forceSubscribe) {
|
|
275
275
|
handler.subscribePoolInfo(callback).then(unsub => {
|
|
276
276
|
if (!cancel) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import BaseMigrationJob from '@subwallet/extension-base/services/migration-service/Base';
|
|
5
|
+
export default class MigrateTransactionHistoryBySymbol extends BaseMigrationJob {
|
|
6
|
+
async run() {
|
|
7
|
+
const state = this.state;
|
|
8
|
+
try {
|
|
9
|
+
const changeSlugsMap = {
|
|
10
|
+
'ethereum-ERC20-WFTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870': 'ethereum-ERC20-FTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870',
|
|
11
|
+
'moonbeam-ERC20-CSG-0x2Dfc76901bB2ac2A5fA5fc479590A490BBB10a5F': 'moonbeam-ERC20-CGS-0x2Dfc76901bB2ac2A5fA5fc479590A490BBB10a5F',
|
|
12
|
+
'astar-LOCAL-aUSD': 'astar-LOCAL-aSEED',
|
|
13
|
+
'astarEvm-ERC20-aUSD-0xfFFFFfFF00000000000000010000000000000001': 'astarEvm-ERC20-aSEED-0xfFFFFfFF00000000000000010000000000000001',
|
|
14
|
+
'moonriver-LOCAL-xcaUSD': 'moonriver-LOCAL-xcaSeed',
|
|
15
|
+
'moonriver-LOCAL-xckBTC': 'moonriver-LOCAL-xcKBTC',
|
|
16
|
+
'bifrost-LOCAL-aUSD': 'bifrost-LOCAL-KUSD',
|
|
17
|
+
'calamari-LOCAL-aUSD': 'calamari-LOCAL-AUSD',
|
|
18
|
+
'shiden-LOCAL-aUSD': 'shiden-LOCAL-aSEED',
|
|
19
|
+
'shidenEvm-ERC20-aUSD-0xfFFfFFfF00000000000000010000000000000000': 'shidenEvm-ERC20-aSEED-0xfFFfFFfF00000000000000010000000000000000',
|
|
20
|
+
'ethereum_goerli-NATIVE-GoerliETH': 'ethereum_goerli-NATIVE-ETH',
|
|
21
|
+
'binance_test-NATIVE-BNB': 'binance_test-NATIVE-tBNB',
|
|
22
|
+
'pangolin-LOCAL-CKTON': 'pangolin-LOCAL-PKTON',
|
|
23
|
+
'zeta_test-NATIVE-aZETA': 'zeta_test-NATIVE-ZETA',
|
|
24
|
+
'origintrail-NATIVE-OTP': 'origintrail-NATIVE-NEURO',
|
|
25
|
+
'moonbeam-LOCAL-xciBTC': 'moonbeam-LOCAL-xcIBTC',
|
|
26
|
+
'tomochain-NATIVE-TOMO': 'tomochain-NATIVE-VIC'
|
|
27
|
+
};
|
|
28
|
+
const allTxs = [];
|
|
29
|
+
await Promise.all(Object.entries(changeSlugsMap).map(async ([oldSlug, newSlug], i) => {
|
|
30
|
+
const oldSlugSplit = oldSlug.split('-');
|
|
31
|
+
const oldChainSlug = oldSlugSplit[0];
|
|
32
|
+
const oldSymbolSlug = oldSlugSplit[2];
|
|
33
|
+
const newSlugSplit = newSlug.split('-');
|
|
34
|
+
const newSymbolSlug = newSlugSplit[2];
|
|
35
|
+
const filterTransactions = await state.dbService.stores.transaction.table.where({
|
|
36
|
+
chain: oldChainSlug
|
|
37
|
+
}).and(tx => {
|
|
38
|
+
var _tx$amount;
|
|
39
|
+
return ((_tx$amount = tx.amount) === null || _tx$amount === void 0 ? void 0 : _tx$amount.symbol) === oldSymbolSlug;
|
|
40
|
+
}).toArray();
|
|
41
|
+
if (filterTransactions.length > 0) {
|
|
42
|
+
for (const transaction of filterTransactions) {
|
|
43
|
+
if (transaction.amount && transaction.amount.symbol === oldSymbolSlug) {
|
|
44
|
+
transaction.amount.symbol = newSymbolSlug;
|
|
45
|
+
}
|
|
46
|
+
if (transaction.fee && transaction.fee.symbol === oldSymbolSlug) {
|
|
47
|
+
transaction.fee.symbol = newSymbolSlug;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
allTxs.push(...filterTransactions);
|
|
52
|
+
}));
|
|
53
|
+
await state.dbService.stores.transaction.table.bulkPut(allTxs);
|
|
54
|
+
} catch (e) {
|
|
55
|
+
this.logger.error(e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -5,27 +5,30 @@ import BaseMigrationJob from '@subwallet/extension-base/services/migration-servi
|
|
|
5
5
|
export default class MigrateAssetSetting extends BaseMigrationJob {
|
|
6
6
|
async run() {
|
|
7
7
|
try {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
const changeSlugsMap = {
|
|
9
|
+
'ethereum-ERC20-WFTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870': 'ethereum-ERC20-FTM-0x4E15361FD6b4BB609Fa63C81A2be19d873717870',
|
|
10
|
+
'moonbeam-ERC20-CSG-0x2Dfc76901bB2ac2A5fA5fc479590A490BBB10a5F': 'moonbeam-ERC20-CGS-0x2Dfc76901bB2ac2A5fA5fc479590A490BBB10a5F',
|
|
11
|
+
'astar-LOCAL-aUSD': 'astar-LOCAL-aSEED',
|
|
12
|
+
'astarEvm-ERC20-aUSD-0xfFFFFfFF00000000000000010000000000000001': 'astarEvm-ERC20-aSEED-0xfFFFFfFF00000000000000010000000000000001',
|
|
13
|
+
'moonriver-LOCAL-xcaUSD': 'moonriver-LOCAL-xcaSeed',
|
|
14
|
+
'moonriver-LOCAL-xckBTC': 'moonriver-LOCAL-xcKBTC',
|
|
15
|
+
'bifrost-LOCAL-aUSD': 'bifrost-LOCAL-KUSD',
|
|
16
|
+
'calamari-LOCAL-aUSD': 'calamari-LOCAL-AUSD',
|
|
17
|
+
'shiden-LOCAL-aUSD': 'shiden-LOCAL-aSEED',
|
|
18
|
+
'shidenEvm-ERC20-aUSD-0xfFFfFFfF00000000000000010000000000000000': 'shidenEvm-ERC20-aSEED-0xfFFfFFfF00000000000000010000000000000000',
|
|
19
|
+
'ethereum_goerli-NATIVE-GoerliETH': 'ethereum_goerli-NATIVE-ETH',
|
|
20
|
+
'binance_test-NATIVE-BNB': 'binance_test-NATIVE-tBNB',
|
|
21
|
+
'pangolin-LOCAL-CKTON': 'pangolin-LOCAL-PKTON',
|
|
22
|
+
'zeta_test-NATIVE-aZETA': 'zeta_test-NATIVE-ZETA',
|
|
23
|
+
'origintrail-NATIVE-OTP': 'origintrail-NATIVE-NEURO',
|
|
24
|
+
'moonbeam-LOCAL-xciBTC': 'moonbeam-LOCAL-xcIBTC',
|
|
25
|
+
'tomochain-NATIVE-TOMO': 'tomochain-NATIVE-VIC'
|
|
26
|
+
};
|
|
22
27
|
const assetSetting = await this.state.chainService.getAssetSettings();
|
|
23
28
|
const migratedAssetSetting = {};
|
|
24
|
-
for (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const isVisible = assetSetting[slug].visible;
|
|
28
|
-
const newSlug = newSlugs[i];
|
|
29
|
+
for (const [oldSlug, newSlug] of Object.entries(changeSlugsMap)) {
|
|
30
|
+
if (Object.keys(assetSetting).includes(oldSlug)) {
|
|
31
|
+
const isVisible = assetSetting[oldSlug].visible;
|
|
29
32
|
migratedAssetSetting[newSlug] = {
|
|
30
33
|
visible: isVisible
|
|
31
34
|
};
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import DeleteEarningData from '@subwallet/extension-base/services/migration-service/scripts/DeleteEarningData';
|
|
5
|
-
|
|
5
|
+
import MigrateTransactionHistoryBySymbol from '@subwallet/extension-base/services/migration-service/scripts/MigrateTransactionHistoryBySymbol';
|
|
6
|
+
import MigrateAssetSetting from "./databases/MigrateAssetSetting.js";
|
|
6
7
|
import MigrateEarningVersion from "./databases/MigrateEarningVersion.js";
|
|
7
8
|
import MigrateEthProvider from "./providers/MigrateEthProvider.js";
|
|
8
9
|
import MigratePioneerProvider from "./providers/MigratePioneerProvider.js";
|
|
@@ -44,7 +45,9 @@ export default {
|
|
|
44
45
|
'1.1.24-01': MigrateProvidersV1M1P24,
|
|
45
46
|
'1.1.26-01': MigratePolygonUSDCProvider,
|
|
46
47
|
'1.1.28-01': MigrateEarningVersion,
|
|
47
|
-
'1.1.41-01': DeleteChainStaking
|
|
48
|
-
|
|
48
|
+
'1.1.41-01': DeleteChainStaking,
|
|
49
|
+
'1.1.44-01': MigrateAssetSetting,
|
|
50
|
+
'1.1.45-01': MigrateTransactionHistoryBySymbol
|
|
51
|
+
// [`${EVERYTIME}-1.1.42-02`]: MigrateTransactionHistoryBySymbol
|
|
49
52
|
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
|
|
50
53
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { CrowdloanContributionsResponse, ExtrinsicItem, ExtrinsicsListResponse, IMultiChainBalance, RequestBlockRange, RewardHistoryListResponse, SubscanRequest, TransferItem, TransfersListResponse } from '@subwallet/extension-base/services/subscan-service/types';
|
|
2
|
+
import { SubscanEventBaseItemData, SubscanExtrinsicParam } from '@subwallet/extension-base/types';
|
|
2
3
|
export declare class SubscanService {
|
|
3
4
|
private subscanChainMap;
|
|
5
|
+
private callRate;
|
|
4
6
|
private limitRate;
|
|
5
7
|
private intervalCheck;
|
|
6
8
|
private maxRetry;
|
|
9
|
+
private rollbackRateTime;
|
|
10
|
+
private timeoutRollbackRate;
|
|
7
11
|
private requestMap;
|
|
8
12
|
private nextId;
|
|
9
13
|
private isRunning;
|
|
@@ -13,9 +17,10 @@ export declare class SubscanService {
|
|
|
13
17
|
intervalCheck?: number;
|
|
14
18
|
maxRetry?: number;
|
|
15
19
|
});
|
|
20
|
+
private reduceLimitRate;
|
|
16
21
|
private getApiUrl;
|
|
17
22
|
private postRequest;
|
|
18
|
-
addRequest<T>(run: SubscanRequest<T>['run']): Promise<T>;
|
|
23
|
+
addRequest<T>(run: SubscanRequest<T>['run'], ordinal: number): Promise<T>;
|
|
19
24
|
private process;
|
|
20
25
|
checkSupportedSubscanChain(chain: string): boolean;
|
|
21
26
|
setSubscanChainMap(subscanChainMap: Record<string, string>): void;
|
|
@@ -32,4 +37,6 @@ export declare class SubscanService {
|
|
|
32
37
|
record: number;
|
|
33
38
|
}): Promise<Record<string, TransferItem[]>>;
|
|
34
39
|
getRewardHistoryList(chain: string, address: string, page?: number): Promise<RewardHistoryListResponse>;
|
|
40
|
+
getAccountRemarkEvents(chain: string, address: string): Promise<SubscanEventBaseItemData[]>;
|
|
41
|
+
getExtrinsicParams(chain: string, extrinsicIndexes: string[], ordinal?: number): Promise<SubscanExtrinsicParam[]>;
|
|
35
42
|
}
|