@subwallet/extension-base 1.3.3-0 → 1.3.5-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 +14 -1
- package/background/KoniTypes.js +1 -0
- package/cjs/background/KoniTypes.js +1 -0
- package/cjs/constants/blocked-actions-list.js +1 -2
- package/cjs/constants/index.js +16 -1
- package/cjs/constants/remind-notification-time.js +14 -0
- package/cjs/core/logic-validation/transfer.js +12 -6
- package/cjs/core/substrate/xcm-parser.js +13 -1
- package/cjs/koni/api/contract-handler/utils/index.js +20 -1
- package/cjs/koni/api/nft/config.js +1 -1
- package/cjs/koni/api/nft/index.js +9 -0
- package/cjs/koni/api/nft/rari/index.js +87 -0
- package/cjs/koni/api/yield/helper/utils.js +1 -1
- package/cjs/koni/background/handlers/Extension.js +110 -23
- package/cjs/koni/background/handlers/State.js +5 -2
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/helpers/process.js +2 -1
- package/cjs/services/balance-service/helpers/subscribe/index.js +5 -0
- package/cjs/services/balance-service/index.js +1 -1
- package/cjs/services/balance-service/transfer/xcm/availBridge.js +198 -0
- package/cjs/services/balance-service/transfer/xcm/index.js +50 -5
- package/cjs/services/chain-service/constants.js +2 -1
- package/cjs/services/chain-service/handler/EvmApi.js +12 -21
- package/cjs/services/chain-service/handler/EvmChainHandler.js +0 -2
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +73 -40
- package/cjs/services/chain-service/index.js +44 -13
- package/cjs/services/chain-service/utils/index.js +20 -0
- package/cjs/services/earning-service/handlers/base.js +12 -3
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +11 -3
- package/cjs/services/earning-service/handlers/native-staking/astar.js +1 -1
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +3 -1
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +3 -1
- package/cjs/services/earning-service/handlers/native-staking/tao.js +11 -3
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +14 -12
- package/cjs/services/earning-service/service.js +5 -0
- package/cjs/services/inapp-notification-service/consts.js +31 -0
- package/cjs/services/inapp-notification-service/index.js +260 -0
- package/cjs/services/inapp-notification-service/interfaces.js +32 -0
- package/cjs/services/inapp-notification-service/utils.js +197 -0
- package/cjs/services/keyring-service/context/account-context.js +9 -0
- package/cjs/services/keyring-service/context/state.js +4 -0
- package/cjs/services/setting-service/SettingService.js +9 -1
- package/cjs/services/setting-service/constants.js +16 -1
- package/cjs/services/storage-service/DatabaseService.js +42 -3
- package/cjs/services/storage-service/databases/index.js +3 -0
- package/cjs/services/storage-service/db-stores/InappNotification.js +81 -0
- package/cjs/services/transaction-service/index.js +18 -4
- package/cjs/types/avail-bridge/index.js +1 -0
- package/cjs/types/notification/index.js +1 -0
- package/cjs/utils/account/transform.js +9 -5
- package/cjs/utils/staticData/index.js +7 -2
- package/constants/blocked-actions-list.js +1 -2
- package/constants/index.d.ts +2 -0
- package/constants/index.js +3 -1
- package/constants/remind-notification-time.d.ts +2 -0
- package/constants/remind-notification-time.js +7 -0
- package/core/logic-validation/transfer.js +12 -6
- package/core/substrate/xcm-parser.d.ts +1 -0
- package/core/substrate/xcm-parser.js +12 -1
- package/koni/api/contract-handler/utils/avail_bridge_abi.json +1659 -0
- package/koni/api/contract-handler/utils/avail_test_bridge_abi.json +1692 -0
- package/koni/api/contract-handler/utils/index.d.ts +7 -2
- package/koni/api/contract-handler/utils/index.js +15 -0
- package/koni/api/nft/config.js +1 -1
- package/koni/api/nft/index.js +9 -0
- package/koni/api/nft/rari/index.d.ts +7 -0
- package/koni/api/nft/rari/index.js +80 -0
- package/koni/api/yield/helper/utils.js +1 -1
- package/koni/background/handlers/Extension.d.ts +7 -0
- package/koni/background/handlers/Extension.js +112 -25
- package/koni/background/handlers/State.d.ts +2 -0
- package/koni/background/handlers/State.js +5 -2
- package/package.json +59 -6
- package/packageInfo.js +1 -1
- package/services/balance-service/helpers/process.js +2 -1
- package/services/balance-service/helpers/subscribe/index.js +5 -0
- package/services/balance-service/index.js +2 -2
- package/services/balance-service/transfer/xcm/availBridge.d.ts +45 -0
- package/services/balance-service/transfer/xcm/availBridge.js +186 -0
- package/services/balance-service/transfer/xcm/index.d.ts +8 -8
- package/services/balance-service/transfer/xcm/index.js +46 -5
- package/services/chain-service/constants.d.ts +1 -0
- package/services/chain-service/constants.js +2 -1
- package/services/chain-service/handler/EvmApi.js +12 -21
- package/services/chain-service/handler/EvmChainHandler.js +0 -2
- package/services/chain-service/handler/SubstrateChainHandler.d.ts +3 -2
- package/services/chain-service/handler/SubstrateChainHandler.js +73 -40
- package/services/chain-service/index.d.ts +2 -0
- package/services/chain-service/index.js +45 -14
- package/services/chain-service/types.d.ts +2 -1
- package/services/chain-service/utils/index.d.ts +3 -0
- package/services/chain-service/utils/index.js +14 -0
- package/services/earning-service/handlers/base.d.ts +2 -0
- package/services/earning-service/handlers/base.js +9 -0
- package/services/earning-service/handlers/native-staking/amplitude.js +11 -3
- package/services/earning-service/handlers/native-staking/astar.js +1 -1
- package/services/earning-service/handlers/native-staking/para-chain.js +3 -1
- package/services/earning-service/handlers/native-staking/relay-chain.js +3 -1
- package/services/earning-service/handlers/native-staking/tao.d.ts +4 -0
- package/services/earning-service/handlers/native-staking/tao.js +6 -2
- package/services/earning-service/handlers/nomination-pool/index.d.ts +1 -1
- package/services/earning-service/handlers/nomination-pool/index.js +14 -12
- package/services/earning-service/service.d.ts +2 -0
- package/services/earning-service/service.js +5 -0
- package/services/inapp-notification-service/consts.d.ts +18 -0
- package/services/inapp-notification-service/consts.js +22 -0
- package/services/inapp-notification-service/index.d.ts +37 -0
- package/services/inapp-notification-service/index.js +252 -0
- package/services/inapp-notification-service/interfaces.d.ts +77 -0
- package/services/inapp-notification-service/interfaces.js +24 -0
- package/services/inapp-notification-service/utils.d.ts +55 -0
- package/services/inapp-notification-service/utils.js +173 -0
- package/services/keyring-service/context/account-context.d.ts +3 -0
- package/services/keyring-service/context/account-context.js +9 -0
- package/services/keyring-service/context/state.d.ts +1 -0
- package/services/keyring-service/context/state.js +4 -0
- package/services/setting-service/SettingService.js +9 -1
- package/services/setting-service/constants.d.ts +2 -0
- package/services/setting-service/constants.js +15 -0
- package/services/storage-service/DatabaseService.d.ts +15 -0
- package/services/storage-service/DatabaseService.js +42 -3
- package/services/storage-service/databases/index.d.ts +2 -0
- package/services/storage-service/databases/index.js +3 -0
- package/services/storage-service/db-stores/InappNotification.d.ts +14 -0
- package/services/storage-service/db-stores/InappNotification.js +73 -0
- package/services/transaction-service/index.js +18 -4
- package/types/avail-bridge/index.d.ts +6 -0
- package/types/avail-bridge/index.js +1 -0
- package/types/notification/index.d.ts +9 -0
- package/types/notification/index.js +1 -0
- package/utils/account/transform.js +9 -5
- package/utils/staticData/index.d.ts +5 -1
- package/utils/staticData/index.js +5 -2
- package/utils/staticData/remindNotificationTime.json +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { _Address } from '@subwallet/extension-base/background/KoniTypes';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
2
|
+
import { AbiItem } from 'web3-utils';
|
|
3
|
+
export declare const _ERC20_ABI: AbiItem[] | AbiItem;
|
|
4
|
+
export declare const _ERC721_ABI: AbiItem[] | AbiItem;
|
|
4
5
|
export declare const _TEST_ERC721_ABI: any;
|
|
5
6
|
export declare const _PSP22_ABI: Record<string, any>;
|
|
6
7
|
export declare const _PSP34_ABI: Record<string, any>;
|
|
@@ -8,5 +9,9 @@ export declare const _PINK_PSP34_ABI: Record<string, any>;
|
|
|
8
9
|
export declare const _NEUROGUNS_PSP34_ABI: Record<string, any>;
|
|
9
10
|
export declare const _AZERO_DOMAIN_REGISTRY_ABI: Record<string, any>;
|
|
10
11
|
export declare const _SNOWBRIDGE_GATEWAY_ABI: Record<string, any>;
|
|
12
|
+
export declare const _AVAIL_BRIDGE_GATEWAY_ABI: Record<string, any>;
|
|
13
|
+
export declare const _AVAIL_TEST_BRIDGE_GATEWAY_ABI: Record<string, any>;
|
|
11
14
|
export declare function getSnowBridgeGatewayContract(chain: string): "0x27ca963C279c93801941e1eB8799c23f407d68e7" | "0x5B4909cE6Ca82d2CE23BD46738953c7959E710Cd";
|
|
12
15
|
export declare function isSnowBridgeGatewayContract(contractAddress: _Address): boolean;
|
|
16
|
+
export declare function getAvailBridgeGatewayContract(chain: string): "0x054fd961708D8E2B9c10a63F6157c74458889F0a" | "0x967F7DdC4ec508462231849AE81eeaa68Ad01389";
|
|
17
|
+
export declare function isAvailBridgeGatewayContract(contractAddress: _Address): boolean;
|
|
@@ -20,6 +20,10 @@ export const _NEUROGUNS_PSP34_ABI = require("./neuroguns_psp34_abi.json");
|
|
|
20
20
|
export const _AZERO_DOMAIN_REGISTRY_ABI = require("./azero_domain_registry_abi.json");
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
22
22
|
export const _SNOWBRIDGE_GATEWAY_ABI = require("./snowbridge_gateway_abi.json");
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
24
|
+
export const _AVAIL_BRIDGE_GATEWAY_ABI = require("./avail_bridge_abi.json");
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
26
|
+
export const _AVAIL_TEST_BRIDGE_GATEWAY_ABI = require("./avail_test_bridge_abi.json");
|
|
23
27
|
const SNOWBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS = '0x27ca963C279c93801941e1eB8799c23f407d68e7';
|
|
24
28
|
const SNOWBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS = '0x5B4909cE6Ca82d2CE23BD46738953c7959E710Cd';
|
|
25
29
|
export function getSnowBridgeGatewayContract(chain) {
|
|
@@ -30,4 +34,15 @@ export function getSnowBridgeGatewayContract(chain) {
|
|
|
30
34
|
}
|
|
31
35
|
export function isSnowBridgeGatewayContract(contractAddress) {
|
|
32
36
|
return [SNOWBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS, SNOWBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS].includes(contractAddress);
|
|
37
|
+
}
|
|
38
|
+
const AVAILBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS = '0x054fd961708D8E2B9c10a63F6157c74458889F0a';
|
|
39
|
+
const AVAILBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS = '0x967F7DdC4ec508462231849AE81eeaa68Ad01389';
|
|
40
|
+
export function getAvailBridgeGatewayContract(chain) {
|
|
41
|
+
if (chain === COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA) {
|
|
42
|
+
return AVAILBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS;
|
|
43
|
+
}
|
|
44
|
+
return AVAILBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS;
|
|
45
|
+
}
|
|
46
|
+
export function isAvailBridgeGatewayContract(contractAddress) {
|
|
47
|
+
return [AVAILBRIDGE_GATEWAY_ETHEREUM_CONTRACT_ADDRESS, AVAILBRIDGE_GATEWAY_SEPOLIA_CONTRACT_ADDRESS].includes(contractAddress);
|
|
33
48
|
}
|
package/koni/api/nft/config.js
CHANGED
|
@@ -82,7 +82,7 @@ export let SUPPORTED_TRANSFER_EVM_CHAIN_NAME;
|
|
|
82
82
|
SUPPORTED_TRANSFER_EVM_CHAIN_NAME["shibuya"] = "shibuya";
|
|
83
83
|
})(SUPPORTED_TRANSFER_EVM_CHAIN_NAME || (SUPPORTED_TRANSFER_EVM_CHAIN_NAME = {}));
|
|
84
84
|
export const SUPPORTED_TRANSFER_EVM_CHAIN = [SUPPORTED_TRANSFER_EVM_CHAIN_NAME.moonbase, SUPPORTED_TRANSFER_EVM_CHAIN_NAME.moonbeam, SUPPORTED_TRANSFER_EVM_CHAIN_NAME.moonriver, SUPPORTED_TRANSFER_EVM_CHAIN_NAME.astarEvm, SUPPORTED_TRANSFER_EVM_CHAIN_NAME.shiden, SUPPORTED_TRANSFER_EVM_CHAIN_NAME.shibuya];
|
|
85
|
-
export const UNSUPPORTED_TRANSFER_EVM_CHAIN_NAME = ['unique_evm'];
|
|
85
|
+
export const UNSUPPORTED_TRANSFER_EVM_CHAIN_NAME = ['unique_evm', 'rari'];
|
|
86
86
|
export const TRANSFER_CHAIN_ID = {
|
|
87
87
|
[SUPPORTED_TRANSFER_EVM_CHAIN_NAME.moonbase]: 1287,
|
|
88
88
|
[SUPPORTED_TRANSFER_EVM_CHAIN_NAME.moonbeam]: 1284,
|
package/koni/api/nft/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { _NFT_CHAIN_GROUP } from '@subwallet/extension-base/services/chain-servi
|
|
|
17
17
|
import { _isChainSupportEvmNft, _isChainSupportNativeNft, _isChainSupportWasmNft, _isSupportOrdinal } from '@subwallet/extension-base/services/chain-service/utils';
|
|
18
18
|
import { categoryAddresses, targetIsWeb } from '@subwallet/extension-base/utils';
|
|
19
19
|
import AssetHubNftsPalletApi from "./assethub_nft/index.js";
|
|
20
|
+
import { RariNftApi } from "./rari/index.js";
|
|
20
21
|
import { TernoaNftApi } from "./ternoa_nft/index.js";
|
|
21
22
|
function createSubstrateNftApi(chain, substrateApi, addresses) {
|
|
22
23
|
const {
|
|
@@ -45,6 +46,8 @@ function createSubstrateNftApi(chain, substrateApi, addresses) {
|
|
|
45
46
|
return [new BlobInscriptionApi(chain, substrateAddresses)];
|
|
46
47
|
} else if (_NFT_CHAIN_GROUP.ternoa.includes(chain)) {
|
|
47
48
|
return [new TernoaNftApi(substrateApi, substrateAddresses, chain)];
|
|
49
|
+
} else if (_NFT_CHAIN_GROUP.rari.includes(chain)) {
|
|
50
|
+
return [new RariNftApi(chain, evmAddresses)];
|
|
48
51
|
}
|
|
49
52
|
return null;
|
|
50
53
|
}
|
|
@@ -142,6 +145,12 @@ export class NftHandler {
|
|
|
142
145
|
this.handlers.push(...handlers);
|
|
143
146
|
}
|
|
144
147
|
}
|
|
148
|
+
if (chain === 'rari') {
|
|
149
|
+
const handlers = createSubstrateNftApi(chain, null, evmAddresses);
|
|
150
|
+
if (handlers && !!handlers.length) {
|
|
151
|
+
this.handlers.push(...handlers);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
145
154
|
if (chain === 'ternoa') {
|
|
146
155
|
const handlers = createSubstrateNftApi(chain, this.substrateApiMap[chain], substrateAddresses);
|
|
147
156
|
if (handlers && !!handlers.length) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseNftApi, HandleNftParams } from '../nft';
|
|
2
|
+
export declare class RariNftApi extends BaseNftApi {
|
|
3
|
+
constructor(chain: string, addresses: string[]);
|
|
4
|
+
private wait;
|
|
5
|
+
handleNfts(params: HandleNftParams): Promise<void>;
|
|
6
|
+
fetchNfts(params: HandleNftParams): Promise<number>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { BaseNftApi } from "../nft.js";
|
|
5
|
+
const options = {
|
|
6
|
+
method: 'GET',
|
|
7
|
+
headers: {
|
|
8
|
+
accept: 'application/json',
|
|
9
|
+
'X-API-KEY': 'ed9df6bf-7eba-4ca2-8a42-9006706be064'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export class RariNftApi extends BaseNftApi {
|
|
13
|
+
constructor(chain, addresses) {
|
|
14
|
+
super(chain, undefined, addresses);
|
|
15
|
+
}
|
|
16
|
+
wait(ms) {
|
|
17
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
18
|
+
}
|
|
19
|
+
async handleNfts(params) {
|
|
20
|
+
const collectionMap = new Map();
|
|
21
|
+
const size = 4;
|
|
22
|
+
const waitTime = 1000;
|
|
23
|
+
for (let i = 0; i < this.addresses.length; i += size) {
|
|
24
|
+
const group = this.addresses.slice(i, i + size);
|
|
25
|
+
await Promise.all(group.map(async address => {
|
|
26
|
+
const nftResponse = await fetch(`https://api.rarible.org/v0.1/items/byOwner?blockchains=RARI&owner=ETHEREUM%3A${address}&size=5000`, options).then(response => response.json()).catch(err => {
|
|
27
|
+
console.error(err);
|
|
28
|
+
return null;
|
|
29
|
+
});
|
|
30
|
+
if (!nftResponse || !nftResponse.items) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const nftItems = nftResponse.items;
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
36
|
+
await Promise.all(nftItems.map(async nft => {
|
|
37
|
+
var _NftMetadata$content$;
|
|
38
|
+
const collectionId = nft.collection;
|
|
39
|
+
const collectionName = nft.itemCollection.name;
|
|
40
|
+
const NftMetadata = nft.meta;
|
|
41
|
+
const NFTimageUrl = ((_NftMetadata$content$ = NftMetadata.content[0]) === null || _NftMetadata$content$ === void 0 ? void 0 : _NftMetadata$content$.url) || '';
|
|
42
|
+
const formatCollectionId = collectionId.replace(/^RARI:/, '');
|
|
43
|
+
const parsedNft = {
|
|
44
|
+
id: nft.tokenId,
|
|
45
|
+
name: NftMetadata.name,
|
|
46
|
+
description: NftMetadata.description || '',
|
|
47
|
+
image: NFTimageUrl,
|
|
48
|
+
collectionId: formatCollectionId,
|
|
49
|
+
chain: this.chain,
|
|
50
|
+
owner: address
|
|
51
|
+
};
|
|
52
|
+
params.updateItem(this.chain, parsedNft, address);
|
|
53
|
+
if (!collectionMap.has(formatCollectionId)) {
|
|
54
|
+
collectionMap.set(formatCollectionId, collectionName);
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}));
|
|
58
|
+
if (i + size < this.addresses.length) {
|
|
59
|
+
await this.wait(waitTime);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
for (const [formatCollectionId, collectionName] of collectionMap.entries()) {
|
|
63
|
+
const parsedCollection = {
|
|
64
|
+
collectionId: formatCollectionId,
|
|
65
|
+
chain: this.chain,
|
|
66
|
+
collectionName,
|
|
67
|
+
image: ''
|
|
68
|
+
};
|
|
69
|
+
params.updateCollection(this.chain, parsedCollection);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async fetchNfts(params) {
|
|
73
|
+
try {
|
|
74
|
+
await this.handleNfts(params);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -5,7 +5,7 @@ import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
|
5
5
|
import { _getAssetDecimals } from '@subwallet/extension-base/services/chain-service/utils';
|
|
6
6
|
import { BN_TEN } from '@subwallet/extension-base/utils';
|
|
7
7
|
import BigN from 'bignumber.js';
|
|
8
|
-
export const YIELD_EXTRINSIC_TYPES = [ExtrinsicType.MINT_VDOT, ExtrinsicType.MINT_LDOT, ExtrinsicType.MINT_SDOT, ExtrinsicType.MINT_QDOT, ExtrinsicType.MINT_STDOT, ExtrinsicType.REDEEM_QDOT, ExtrinsicType.REDEEM_SDOT, ExtrinsicType.REDEEM_VDOT, ExtrinsicType.REDEEM_LDOT, ExtrinsicType.REDEEM_STDOT, ExtrinsicType.
|
|
8
|
+
export const YIELD_EXTRINSIC_TYPES = [ExtrinsicType.MINT_VDOT, ExtrinsicType.MINT_LDOT, ExtrinsicType.MINT_SDOT, ExtrinsicType.MINT_QDOT, ExtrinsicType.MINT_STDOT, ExtrinsicType.REDEEM_QDOT, ExtrinsicType.REDEEM_SDOT, ExtrinsicType.REDEEM_VDOT, ExtrinsicType.REDEEM_LDOT, ExtrinsicType.REDEEM_STDOT, ExtrinsicType.JOIN_YIELD_POOL, ExtrinsicType.STAKING_CLAIM_REWARD, ExtrinsicType.STAKING_LEAVE_POOL];
|
|
9
9
|
export const YIELD_POOL_STAT_REFRESH_INTERVAL = 90000;
|
|
10
10
|
export function convertDerivativeToOriginToken(amount, poolInfo, derivativeTokenInfo, originTokenInfo) {
|
|
11
11
|
var _poolInfo$statistic, _poolInfo$statistic$a;
|
|
@@ -76,6 +76,7 @@ export default class KoniExtension {
|
|
|
76
76
|
private setUnlockType;
|
|
77
77
|
private subscribeSettings;
|
|
78
78
|
private setEnableChainPatrol;
|
|
79
|
+
private saveNotificationSetup;
|
|
79
80
|
private setShowZeroBalance;
|
|
80
81
|
private setLanguage;
|
|
81
82
|
private setShowBalance;
|
|
@@ -247,6 +248,12 @@ export default class KoniExtension {
|
|
|
247
248
|
private getLatestSwapQuote;
|
|
248
249
|
private validateSwapProcess;
|
|
249
250
|
private handleSwapStep;
|
|
251
|
+
private subscribeUnreadNotificationCountMap;
|
|
252
|
+
private markAllReadNotification;
|
|
253
|
+
private switchReadNotificationStatus;
|
|
254
|
+
private fetchInappNotifications;
|
|
255
|
+
private getInappNotification;
|
|
256
|
+
private submitClaimAvailBridge;
|
|
250
257
|
private subscribeLedgerGenericAllowChains;
|
|
251
258
|
handle<TMessageType extends MessageTypes>(id: string, type: TMessageType, request: RequestTypes[TMessageType], port: chrome.runtime.Port): Promise<ResponseType<TMessageType>>;
|
|
252
259
|
}
|
|
@@ -13,7 +13,7 @@ import { additionalValidateTransfer, additionalValidateXcmTransfer, validateTran
|
|
|
13
13
|
import { _isSnowBridgeXcm } from '@subwallet/extension-base/core/substrate/xcm-parser';
|
|
14
14
|
import { ALLOWED_PATH } from '@subwallet/extension-base/defaults';
|
|
15
15
|
import { getERC20SpendingApprovalTx } from '@subwallet/extension-base/koni/api/contract-handler/evm/web3';
|
|
16
|
-
import { _ERC721_ABI, isSnowBridgeGatewayContract } from '@subwallet/extension-base/koni/api/contract-handler/utils';
|
|
16
|
+
import { _ERC721_ABI, isAvailBridgeGatewayContract, isSnowBridgeGatewayContract } from '@subwallet/extension-base/koni/api/contract-handler/utils';
|
|
17
17
|
import { resolveAzeroAddressToDomain, resolveAzeroDomainToAddress } from '@subwallet/extension-base/koni/api/dotsama/domain';
|
|
18
18
|
import { parseSubstrateTransaction } from '@subwallet/extension-base/koni/api/dotsama/parseTransaction';
|
|
19
19
|
import { UNSUPPORTED_TRANSFER_EVM_CHAIN_NAME } from '@subwallet/extension-base/koni/api/nft/config';
|
|
@@ -26,7 +26,8 @@ import { isBounceableAddress } from '@subwallet/extension-base/services/balance-
|
|
|
26
26
|
import { getERC20TransactionObject, getERC721Transaction, getEVMTransactionObject, getPSP34TransferExtrinsic } from '@subwallet/extension-base/services/balance-service/transfer/smart-contract';
|
|
27
27
|
import { createTransferExtrinsic, getTransferMockTxFee } from '@subwallet/extension-base/services/balance-service/transfer/token';
|
|
28
28
|
import { createTonTransaction } from '@subwallet/extension-base/services/balance-service/transfer/ton-transfer';
|
|
29
|
-
import { createSnowBridgeExtrinsic, createXcmExtrinsic, getXcmMockTxFee } from '@subwallet/extension-base/services/balance-service/transfer/xcm';
|
|
29
|
+
import { createAvailBridgeExtrinsicFromAvail, createAvailBridgeTxFromEth, createSnowBridgeExtrinsic, createXcmExtrinsic, getXcmMockTxFee } from '@subwallet/extension-base/services/balance-service/transfer/xcm';
|
|
30
|
+
import { getClaimTxOnAvail, getClaimTxOnEthereum, isAvailChainBridge } from '@subwallet/extension-base/services/balance-service/transfer/xcm/availBridge';
|
|
30
31
|
import { _API_OPTIONS_CHAIN_GROUP, _DEFAULT_MANTA_ZK_CHAIN, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX } from '@subwallet/extension-base/services/chain-service/constants';
|
|
31
32
|
import { _ChainConnectionStatus } from '@subwallet/extension-base/services/chain-service/types';
|
|
32
33
|
import { _getAssetDecimals, _getAssetSymbol, _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getEvmChainId, _isAssetSmartContractNft, _isChainEvmCompatible, _isChainTonCompatible, _isCustomAsset, _isLocalToken, _isMantaZkAsset, _isNativeToken, _isPureEvmChain, _isTokenEvmSmartContract, _isTokenTransferredByEvm, _isTokenTransferredByTon } from '@subwallet/extension-base/services/chain-service/utils';
|
|
@@ -772,6 +773,10 @@ export default class KoniExtension {
|
|
|
772
773
|
this.#koniState.updateSetting('enableChainPatrol', enable);
|
|
773
774
|
return true;
|
|
774
775
|
}
|
|
776
|
+
saveNotificationSetup(request) {
|
|
777
|
+
this.#koniState.updateSetting('notificationSetup', request);
|
|
778
|
+
return true;
|
|
779
|
+
}
|
|
775
780
|
setShowZeroBalance({
|
|
776
781
|
show
|
|
777
782
|
}) {
|
|
@@ -1071,8 +1076,8 @@ export default class KoniExtension {
|
|
|
1071
1076
|
owner,
|
|
1072
1077
|
spenderAddress
|
|
1073
1078
|
} = params;
|
|
1074
|
-
if (!isSnowBridgeGatewayContract(spenderAddress)) {
|
|
1075
|
-
throw new Error('Only SnowBridge is supported'); // todo: support all ERC20 spending approval
|
|
1079
|
+
if (!isSnowBridgeGatewayContract(spenderAddress) && !isAvailBridgeGatewayContract(spenderAddress)) {
|
|
1080
|
+
throw new Error('Only SnowBridge and AvailBridge is supported'); // todo: support all ERC20 spending approval
|
|
1076
1081
|
}
|
|
1077
1082
|
|
|
1078
1083
|
const evmApi = this.#koniState.getEvmApi(chain);
|
|
@@ -1247,32 +1252,35 @@ export default class KoniExtension {
|
|
|
1247
1252
|
return this.#koniState.transactionService.generateBeforeHandleResponseErrors(errors);
|
|
1248
1253
|
}
|
|
1249
1254
|
const chainInfoMap = this.#koniState.getChainInfoMap();
|
|
1250
|
-
const
|
|
1255
|
+
const isAvailBridgeFromEvm = _isPureEvmChain(chainInfoMap[originNetworkKey]) && isAvailChainBridge(destinationNetworkKey);
|
|
1256
|
+
const isAvailBridgeFromAvail = isAvailChainBridge(originNetworkKey) && _isPureEvmChain(chainInfoMap[destinationNetworkKey]);
|
|
1257
|
+
const isSnowBridgeEvmTransfer = _isPureEvmChain(chainInfoMap[originNetworkKey]) && _isSnowBridgeXcm(chainInfoMap[originNetworkKey], chainInfoMap[destinationNetworkKey]) && !isAvailBridgeFromEvm;
|
|
1251
1258
|
let additionalValidator;
|
|
1252
1259
|
let eventsHandler;
|
|
1253
1260
|
if (fromKeyPair && destinationTokenInfo) {
|
|
1261
|
+
const evmApi = this.#koniState.getEvmApi(originNetworkKey);
|
|
1262
|
+
const substrateApi = this.#koniState.getSubstrateApi(originNetworkKey);
|
|
1263
|
+
const params = {
|
|
1264
|
+
destinationTokenInfo,
|
|
1265
|
+
originTokenInfo,
|
|
1266
|
+
sendingValue: value,
|
|
1267
|
+
sender: from,
|
|
1268
|
+
recipient: to,
|
|
1269
|
+
chainInfoMap,
|
|
1270
|
+
substrateApi,
|
|
1271
|
+
evmApi
|
|
1272
|
+
};
|
|
1273
|
+
let funcCreateExtrinsic;
|
|
1254
1274
|
if (isSnowBridgeEvmTransfer) {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
sender: from,
|
|
1261
|
-
recipient: to,
|
|
1262
|
-
chainInfoMap,
|
|
1263
|
-
evmApi
|
|
1264
|
-
});
|
|
1275
|
+
funcCreateExtrinsic = createSnowBridgeExtrinsic;
|
|
1276
|
+
} else if (isAvailBridgeFromEvm) {
|
|
1277
|
+
funcCreateExtrinsic = createAvailBridgeTxFromEth;
|
|
1278
|
+
} else if (isAvailBridgeFromAvail) {
|
|
1279
|
+
funcCreateExtrinsic = createAvailBridgeExtrinsicFromAvail;
|
|
1265
1280
|
} else {
|
|
1266
|
-
|
|
1267
|
-
extrinsic = await createXcmExtrinsic({
|
|
1268
|
-
destinationTokenInfo,
|
|
1269
|
-
originTokenInfo,
|
|
1270
|
-
sendingValue: value,
|
|
1271
|
-
recipient: to,
|
|
1272
|
-
chainInfoMap,
|
|
1273
|
-
substrateApi
|
|
1274
|
-
});
|
|
1281
|
+
funcCreateExtrinsic = createXcmExtrinsic;
|
|
1275
1282
|
}
|
|
1283
|
+
extrinsic = await funcCreateExtrinsic(params);
|
|
1276
1284
|
additionalValidator = async inputTransaction => {
|
|
1277
1285
|
const {
|
|
1278
1286
|
value: senderTransferable
|
|
@@ -1328,7 +1336,7 @@ export default class KoniExtension {
|
|
|
1328
1336
|
transaction: extrinsic,
|
|
1329
1337
|
data: inputData,
|
|
1330
1338
|
extrinsicType: ExtrinsicType.TRANSFER_XCM,
|
|
1331
|
-
chainType: !isSnowBridgeEvmTransfer ? ChainType.SUBSTRATE : ChainType.EVM,
|
|
1339
|
+
chainType: !isSnowBridgeEvmTransfer && !isAvailBridgeFromEvm ? ChainType.SUBSTRATE : ChainType.EVM,
|
|
1332
1340
|
transferNativeAmount: _isNativeToken(originTokenInfo) ? value : '0',
|
|
1333
1341
|
ignoreWarnings,
|
|
1334
1342
|
isTransferAll: transferAll,
|
|
@@ -3317,6 +3325,65 @@ export default class KoniExtension {
|
|
|
3317
3325
|
}
|
|
3318
3326
|
/* Swap service */
|
|
3319
3327
|
|
|
3328
|
+
/* Notification service */
|
|
3329
|
+
async subscribeUnreadNotificationCountMap(id, port) {
|
|
3330
|
+
const cb = createSubscription(id, port);
|
|
3331
|
+
const callback = rs => {
|
|
3332
|
+
cb(rs);
|
|
3333
|
+
};
|
|
3334
|
+
const subscription = this.#koniState.inappNotificationService.subscribeUnreadNotificationsCountMap(callback);
|
|
3335
|
+
this.createUnsubscriptionHandle(id, subscription.unsubscribe);
|
|
3336
|
+
port.onDisconnect.addListener(() => {
|
|
3337
|
+
this.cancelSubscription(id);
|
|
3338
|
+
});
|
|
3339
|
+
return await this.#koniState.inappNotificationService.getUnreadNotificationsCountMap();
|
|
3340
|
+
}
|
|
3341
|
+
markAllReadNotification(proxyId) {
|
|
3342
|
+
return this.#koniState.inappNotificationService.markAllRead(proxyId);
|
|
3343
|
+
}
|
|
3344
|
+
switchReadNotificationStatus(params) {
|
|
3345
|
+
return this.#koniState.inappNotificationService.switchReadStatus(params);
|
|
3346
|
+
}
|
|
3347
|
+
async fetchInappNotifications(params) {
|
|
3348
|
+
return this.#koniState.inappNotificationService.fetchNotificationsByParams(params);
|
|
3349
|
+
}
|
|
3350
|
+
async getInappNotification(id) {
|
|
3351
|
+
const result = await this.#koniState.inappNotificationService.getNotificationById(id);
|
|
3352
|
+
if (!result) {
|
|
3353
|
+
throw new Error('Notification not found');
|
|
3354
|
+
}
|
|
3355
|
+
return result;
|
|
3356
|
+
}
|
|
3357
|
+
/* Notification service */
|
|
3358
|
+
|
|
3359
|
+
async submitClaimAvailBridge(data) {
|
|
3360
|
+
const {
|
|
3361
|
+
address,
|
|
3362
|
+
chain,
|
|
3363
|
+
notification
|
|
3364
|
+
} = data;
|
|
3365
|
+
const extrinsicType = ExtrinsicType.CLAIM_AVAIL_BRIDGE;
|
|
3366
|
+
let transaction = null;
|
|
3367
|
+
let chainType;
|
|
3368
|
+
if (isSubstrateAddress(address)) {
|
|
3369
|
+
const substrateApi = this.#koniState.getSubstrateApi(chain);
|
|
3370
|
+
transaction = await getClaimTxOnAvail(notification, substrateApi);
|
|
3371
|
+
chainType = ChainType.SUBSTRATE;
|
|
3372
|
+
} else {
|
|
3373
|
+
const evmApi = this.#koniState.getEvmApi(chain);
|
|
3374
|
+
transaction = await getClaimTxOnEthereum(chain, notification, evmApi);
|
|
3375
|
+
chainType = ChainType.EVM;
|
|
3376
|
+
}
|
|
3377
|
+
return await this.#koniState.transactionService.handleTransaction({
|
|
3378
|
+
address,
|
|
3379
|
+
chain,
|
|
3380
|
+
transaction,
|
|
3381
|
+
data,
|
|
3382
|
+
extrinsicType,
|
|
3383
|
+
chainType
|
|
3384
|
+
});
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3320
3387
|
/* Ledger */
|
|
3321
3388
|
|
|
3322
3389
|
async subscribeLedgerGenericAllowChains(id, port) {
|
|
@@ -3415,6 +3482,8 @@ export default class KoniExtension {
|
|
|
3415
3482
|
return this.setUnlockType(request);
|
|
3416
3483
|
case 'pri(settings.saveEnableChainPatrol)':
|
|
3417
3484
|
return this.setEnableChainPatrol(request);
|
|
3485
|
+
case 'pri(settings.saveNotificationSetup)':
|
|
3486
|
+
return this.saveNotificationSetup(request);
|
|
3418
3487
|
case 'pri(settings.saveShowZeroBalance)':
|
|
3419
3488
|
return this.setShowZeroBalance(request);
|
|
3420
3489
|
case 'pri(settings.saveLanguage)':
|
|
@@ -3882,6 +3951,24 @@ export default class KoniExtension {
|
|
|
3882
3951
|
return this.handleSwapStep(request);
|
|
3883
3952
|
/* Swap service */
|
|
3884
3953
|
|
|
3954
|
+
/* Notification service */
|
|
3955
|
+
case 'pri(inappNotification.subscribeUnreadNotificationCountMap)':
|
|
3956
|
+
return await this.subscribeUnreadNotificationCountMap(id, port);
|
|
3957
|
+
case 'pri(inappNotification.markAllReadNotification)':
|
|
3958
|
+
return this.markAllReadNotification(request);
|
|
3959
|
+
case 'pri(inappNotification.switchReadNotificationStatus)':
|
|
3960
|
+
return this.switchReadNotificationStatus(request);
|
|
3961
|
+
case 'pri(inappNotification.fetch)':
|
|
3962
|
+
return this.fetchInappNotifications(request);
|
|
3963
|
+
case 'pri(inappNotification.get)':
|
|
3964
|
+
return this.getInappNotification(request);
|
|
3965
|
+
/* Notification service */
|
|
3966
|
+
|
|
3967
|
+
/* Avail Bridge */
|
|
3968
|
+
case 'pri(availBridge.submitClaimAvailBridgeOnAvail)':
|
|
3969
|
+
return this.submitClaimAvailBridge(request);
|
|
3970
|
+
/* Avail Bridge */
|
|
3971
|
+
|
|
3885
3972
|
/* Ledger */
|
|
3886
3973
|
case 'pri(ledger.generic.allow)':
|
|
3887
3974
|
return this.subscribeLedgerGenericAllowChains(id, port);
|
|
@@ -11,6 +11,7 @@ import EarningService from '@subwallet/extension-base/services/earning-service/s
|
|
|
11
11
|
import { EventService } from '@subwallet/extension-base/services/event-service';
|
|
12
12
|
import FeeService from '@subwallet/extension-base/services/fee-service/service';
|
|
13
13
|
import { HistoryService } from '@subwallet/extension-base/services/history-service';
|
|
14
|
+
import { InappNotificationService } from '@subwallet/extension-base/services/inapp-notification-service';
|
|
14
15
|
import { KeyringService } from '@subwallet/extension-base/services/keyring-service';
|
|
15
16
|
import MigrationService from '@subwallet/extension-base/services/migration-service';
|
|
16
17
|
import MintCampaignService from '@subwallet/extension-base/services/mint-campaign-service';
|
|
@@ -73,6 +74,7 @@ export default class KoniState {
|
|
|
73
74
|
readonly earningService: EarningService;
|
|
74
75
|
readonly feeService: FeeService;
|
|
75
76
|
readonly swapService: SwapService;
|
|
77
|
+
readonly inappNotificationService: InappNotificationService;
|
|
76
78
|
private generalStatus;
|
|
77
79
|
private waitSleeping;
|
|
78
80
|
private waitStarting;
|
|
@@ -19,6 +19,7 @@ import { EventService } from '@subwallet/extension-base/services/event-service';
|
|
|
19
19
|
import FeeService from '@subwallet/extension-base/services/fee-service/service';
|
|
20
20
|
import { calculateGasFeeParams } from '@subwallet/extension-base/services/fee-service/utils';
|
|
21
21
|
import { HistoryService } from '@subwallet/extension-base/services/history-service';
|
|
22
|
+
import { InappNotificationService } from '@subwallet/extension-base/services/inapp-notification-service';
|
|
22
23
|
import { KeyringService } from '@subwallet/extension-base/services/keyring-service';
|
|
23
24
|
import MigrationService from '@subwallet/extension-base/services/migration-service';
|
|
24
25
|
import MintCampaignService from '@subwallet/extension-base/services/mint-campaign-service';
|
|
@@ -103,6 +104,7 @@ export default class KoniState {
|
|
|
103
104
|
this.earningService = new EarningService(this);
|
|
104
105
|
this.feeService = new FeeService(this);
|
|
105
106
|
this.swapService = new SwapService(this);
|
|
107
|
+
this.inappNotificationService = new InappNotificationService(this.dbService, this.keyringService, this.eventService, this.chainService);
|
|
106
108
|
this.subscription = new KoniSubscription(this, this.dbService);
|
|
107
109
|
this.cron = new KoniCron(this, this.subscription, this.dbService);
|
|
108
110
|
this.logger = createLogger('State');
|
|
@@ -204,6 +206,7 @@ export default class KoniState {
|
|
|
204
206
|
await this.balanceService.init();
|
|
205
207
|
await this.earningService.init();
|
|
206
208
|
await this.swapService.init();
|
|
209
|
+
await this.inappNotificationService.init();
|
|
207
210
|
this.onReady();
|
|
208
211
|
this.onAccountAdd();
|
|
209
212
|
this.onAccountRemove();
|
|
@@ -1180,7 +1183,7 @@ export default class KoniState {
|
|
|
1180
1183
|
this.campaignService.stop();
|
|
1181
1184
|
await Promise.all([this.cron.stop(), this.subscription.stop()]);
|
|
1182
1185
|
await this.pauseAllNetworks(undefined, 'IDLE mode');
|
|
1183
|
-
await Promise.all([this.historyService.stop(), this.priceService.stop(), this.balanceService.stop(), this.earningService.stop(), this.swapService.stop()]);
|
|
1186
|
+
await Promise.all([this.historyService.stop(), this.priceService.stop(), this.balanceService.stop(), this.earningService.stop(), this.swapService.stop(), this.inappNotificationService.stop()]);
|
|
1184
1187
|
|
|
1185
1188
|
// Complete sleeping
|
|
1186
1189
|
sleeping.resolve();
|
|
@@ -1213,7 +1216,7 @@ export default class KoniState {
|
|
|
1213
1216
|
}
|
|
1214
1217
|
|
|
1215
1218
|
// Start services
|
|
1216
|
-
await Promise.all([this.cron.start(), this.subscription.start(), this.historyService.start(), this.priceService.start(), this.balanceService.start(), this.earningService.start(), this.swapService.start()]);
|
|
1219
|
+
await Promise.all([this.cron.start(), this.subscription.start(), this.historyService.start(), this.priceService.start(), this.balanceService.start(), this.earningService.start(), this.swapService.start(), this.inappNotificationService.start()]);
|
|
1217
1220
|
|
|
1218
1221
|
// Complete starting
|
|
1219
1222
|
starting.resolve();
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.3.
|
|
20
|
+
"version": "1.3.5-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -129,6 +129,11 @@
|
|
|
129
129
|
"require": "./cjs/constants/i18n.js",
|
|
130
130
|
"default": "./constants/i18n.js"
|
|
131
131
|
},
|
|
132
|
+
"./constants/remind-notification-time": {
|
|
133
|
+
"types": "./constants/remind-notification-time.d.ts",
|
|
134
|
+
"require": "./cjs/constants/remind-notification-time.js",
|
|
135
|
+
"default": "./constants/remind-notification-time.js"
|
|
136
|
+
},
|
|
132
137
|
"./constants/signing": {
|
|
133
138
|
"types": "./constants/signing.d.ts",
|
|
134
139
|
"require": "./cjs/constants/signing.js",
|
|
@@ -259,6 +264,8 @@
|
|
|
259
264
|
"require": "./cjs/koni/api/contract-handler/utils/index.js",
|
|
260
265
|
"default": "./koni/api/contract-handler/utils/index.js"
|
|
261
266
|
},
|
|
267
|
+
"./koni/api/contract-handler/utils/avail_bridge_abi.json": "./koni/api/contract-handler/utils/avail_bridge_abi.json",
|
|
268
|
+
"./koni/api/contract-handler/utils/avail_test_bridge_abi.json": "./koni/api/contract-handler/utils/avail_test_bridge_abi.json",
|
|
262
269
|
"./koni/api/contract-handler/utils/azero_domain_registry_abi.json": "./koni/api/contract-handler/utils/azero_domain_registry_abi.json",
|
|
263
270
|
"./koni/api/contract-handler/utils/erc20_abi.json": "./koni/api/contract-handler/utils/erc20_abi.json",
|
|
264
271
|
"./koni/api/contract-handler/utils/erc721_abi.json": "./koni/api/contract-handler/utils/erc721_abi.json",
|
|
@@ -383,6 +390,11 @@
|
|
|
383
390
|
"require": "./cjs/koni/api/nft/quartz_nft/protobuf.js",
|
|
384
391
|
"default": "./koni/api/nft/quartz_nft/protobuf.js"
|
|
385
392
|
},
|
|
393
|
+
"./koni/api/nft/rari": {
|
|
394
|
+
"types": "./koni/api/nft/rari/index.d.ts",
|
|
395
|
+
"require": "./cjs/koni/api/nft/rari/index.js",
|
|
396
|
+
"default": "./koni/api/nft/rari/index.js"
|
|
397
|
+
},
|
|
386
398
|
"./koni/api/nft/rmrk_nft": {
|
|
387
399
|
"types": "./koni/api/nft/rmrk_nft/index.d.ts",
|
|
388
400
|
"require": "./cjs/koni/api/nft/rmrk_nft/index.js",
|
|
@@ -689,6 +701,11 @@
|
|
|
689
701
|
"require": "./cjs/services/balance-service/transfer/xcm/index.js",
|
|
690
702
|
"default": "./services/balance-service/transfer/xcm/index.js"
|
|
691
703
|
},
|
|
704
|
+
"./services/balance-service/transfer/xcm/availBridge": {
|
|
705
|
+
"types": "./services/balance-service/transfer/xcm/availBridge.d.ts",
|
|
706
|
+
"require": "./cjs/services/balance-service/transfer/xcm/availBridge.js",
|
|
707
|
+
"default": "./services/balance-service/transfer/xcm/availBridge.js"
|
|
708
|
+
},
|
|
692
709
|
"./services/balance-service/transfer/xcm/polkadotXcm": {
|
|
693
710
|
"types": "./services/balance-service/transfer/xcm/polkadotXcm.d.ts",
|
|
694
711
|
"require": "./cjs/services/balance-service/transfer/xcm/polkadotXcm.js",
|
|
@@ -1081,6 +1098,26 @@
|
|
|
1081
1098
|
"require": "./cjs/services/history-service/testChainMap.js",
|
|
1082
1099
|
"default": "./services/history-service/testChainMap.js"
|
|
1083
1100
|
},
|
|
1101
|
+
"./services/inapp-notification-service": {
|
|
1102
|
+
"types": "./services/inapp-notification-service/index.d.ts",
|
|
1103
|
+
"require": "./cjs/services/inapp-notification-service/index.js",
|
|
1104
|
+
"default": "./services/inapp-notification-service/index.js"
|
|
1105
|
+
},
|
|
1106
|
+
"./services/inapp-notification-service/consts": {
|
|
1107
|
+
"types": "./services/inapp-notification-service/consts.d.ts",
|
|
1108
|
+
"require": "./cjs/services/inapp-notification-service/consts.js",
|
|
1109
|
+
"default": "./services/inapp-notification-service/consts.js"
|
|
1110
|
+
},
|
|
1111
|
+
"./services/inapp-notification-service/interfaces": {
|
|
1112
|
+
"types": "./services/inapp-notification-service/interfaces.d.ts",
|
|
1113
|
+
"require": "./cjs/services/inapp-notification-service/interfaces.js",
|
|
1114
|
+
"default": "./services/inapp-notification-service/interfaces.js"
|
|
1115
|
+
},
|
|
1116
|
+
"./services/inapp-notification-service/utils": {
|
|
1117
|
+
"types": "./services/inapp-notification-service/utils.d.ts",
|
|
1118
|
+
"require": "./cjs/services/inapp-notification-service/utils.js",
|
|
1119
|
+
"default": "./services/inapp-notification-service/utils.js"
|
|
1120
|
+
},
|
|
1084
1121
|
"./services/keyring-service": {
|
|
1085
1122
|
"types": "./services/keyring-service/index.d.ts",
|
|
1086
1123
|
"require": "./cjs/services/keyring-service/index.js",
|
|
@@ -1571,6 +1608,11 @@
|
|
|
1571
1608
|
"require": "./cjs/services/storage-service/db-stores/Crowdloan.js",
|
|
1572
1609
|
"default": "./services/storage-service/db-stores/Crowdloan.js"
|
|
1573
1610
|
},
|
|
1611
|
+
"./services/storage-service/db-stores/InappNotification": {
|
|
1612
|
+
"types": "./services/storage-service/db-stores/InappNotification.d.ts",
|
|
1613
|
+
"require": "./cjs/services/storage-service/db-stores/InappNotification.js",
|
|
1614
|
+
"default": "./services/storage-service/db-stores/InappNotification.js"
|
|
1615
|
+
},
|
|
1574
1616
|
"./services/storage-service/db-stores/KeyValue": {
|
|
1575
1617
|
"types": "./services/storage-service/db-stores/KeyValue.d.ts",
|
|
1576
1618
|
"require": "./cjs/services/storage-service/db-stores/KeyValue.js",
|
|
@@ -1951,6 +1993,11 @@
|
|
|
1951
1993
|
"require": "./cjs/types/account/info/proxy.js",
|
|
1952
1994
|
"default": "./types/account/info/proxy.js"
|
|
1953
1995
|
},
|
|
1996
|
+
"./types/avail-bridge": {
|
|
1997
|
+
"types": "./types/avail-bridge/index.d.ts",
|
|
1998
|
+
"require": "./cjs/types/avail-bridge/index.js",
|
|
1999
|
+
"default": "./types/avail-bridge/index.js"
|
|
2000
|
+
},
|
|
1954
2001
|
"./types/balance": {
|
|
1955
2002
|
"types": "./types/balance/index.d.ts",
|
|
1956
2003
|
"require": "./cjs/types/balance/index.js",
|
|
@@ -2006,6 +2053,11 @@
|
|
|
2006
2053
|
"require": "./cjs/types/metadata.js",
|
|
2007
2054
|
"default": "./types/metadata.js"
|
|
2008
2055
|
},
|
|
2056
|
+
"./types/notification": {
|
|
2057
|
+
"types": "./types/notification/index.d.ts",
|
|
2058
|
+
"require": "./cjs/types/notification/index.js",
|
|
2059
|
+
"default": "./types/notification/index.js"
|
|
2060
|
+
},
|
|
2009
2061
|
"./types/ordinal": {
|
|
2010
2062
|
"types": "./types/ordinal.d.ts",
|
|
2011
2063
|
"require": "./cjs/types/ordinal.js",
|
|
@@ -2333,6 +2385,7 @@
|
|
|
2333
2385
|
"./utils/staticData/crowdloanFunds.json": "./utils/staticData/crowdloanFunds.json",
|
|
2334
2386
|
"./utils/staticData/currencySymbol.json": "./utils/staticData/currencySymbol.json",
|
|
2335
2387
|
"./utils/staticData/marketingCampaigns.json": "./utils/staticData/marketingCampaigns.json",
|
|
2388
|
+
"./utils/staticData/remindNotificationTime.json": "./utils/staticData/remindNotificationTime.json",
|
|
2336
2389
|
"./utils/staticData/termAndCondition.json": "./utils/staticData/termAndCondition.json",
|
|
2337
2390
|
"./utils/swap": {
|
|
2338
2391
|
"types": "./utils/swap.d.ts",
|
|
@@ -2381,11 +2434,11 @@
|
|
|
2381
2434
|
"@reduxjs/toolkit": "^1.9.1",
|
|
2382
2435
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
2383
2436
|
"@substrate/connect": "^0.8.9",
|
|
2384
|
-
"@subwallet/chain-list": "0.2.
|
|
2385
|
-
"@subwallet/extension-base": "^1.3.
|
|
2386
|
-
"@subwallet/extension-chains": "^1.3.
|
|
2387
|
-
"@subwallet/extension-dapp": "^1.3.
|
|
2388
|
-
"@subwallet/extension-inject": "^1.3.
|
|
2437
|
+
"@subwallet/chain-list": "0.2.92",
|
|
2438
|
+
"@subwallet/extension-base": "^1.3.5-0",
|
|
2439
|
+
"@subwallet/extension-chains": "^1.3.5-0",
|
|
2440
|
+
"@subwallet/extension-dapp": "^1.3.5-0",
|
|
2441
|
+
"@subwallet/extension-inject": "^1.3.5-0",
|
|
2389
2442
|
"@subwallet/keyring": "^0.1.8-beta.0",
|
|
2390
2443
|
"@subwallet/ui-keyring": "^0.1.8-beta.0",
|
|
2391
2444
|
"@ton/core": "^0.56.3",
|
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.3.
|
|
10
|
+
version: '1.3.5-0'
|
|
11
11
|
};
|
|
@@ -14,8 +14,9 @@ export function getDefaultTransferProcess() {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export async function getSnowbridgeTransferProcessFromEvm(address, evmApi, tokenInfo, amount) {
|
|
17
|
+
// todo: refactor, AvailBridge also go into this function
|
|
17
18
|
if (![COMMON_CHAIN_SLUGS.ETHEREUM, COMMON_CHAIN_SLUGS.ETHEREUM_SEPOLIA].includes(tokenInfo.originChain)) {
|
|
18
|
-
throw new Error('Snowbridge only has support for Ethereum');
|
|
19
|
+
throw new Error('Snowbridge or AvailBridge only has support for Ethereum');
|
|
19
20
|
}
|
|
20
21
|
const result = {
|
|
21
22
|
totalFee: [MOCK_STEP_FEE],
|
|
@@ -124,6 +124,11 @@ export function subscribeBalance(addresses, chains, tokens, _chainAssetMap, _cha
|
|
|
124
124
|
tonApi
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
+
|
|
128
|
+
// If the chain is not ready, return pending state
|
|
129
|
+
if (!substrateApiMap[chainSlug].isApiReady) {
|
|
130
|
+
handleUnsupportedOrPendingAddresses(useAddresses, chainSlug, chainAssetMap, APIItemState.PENDING, callback);
|
|
131
|
+
}
|
|
127
132
|
const substrateApi = await substrateApiMap[chainSlug].isReady;
|
|
128
133
|
return subscribeSubstrateBalance(useAddresses, chainInfo, chainAssetMap, substrateApi, evmApi, callback, extrinsicType);
|
|
129
134
|
});
|