@subwallet/extension-base 1.0.2-1b → 1.0.2-2
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 +34 -16
- package/background/KoniTypes.js +7 -6
- package/background/errors/TransactionError.js +1 -21
- package/cjs/background/KoniTypes.js +7 -6
- package/cjs/background/errors/TransactionError.js +0 -20
- package/cjs/constants/index.js +26 -8
- package/cjs/koni/api/dotsama/balance.js +224 -49
- package/cjs/koni/api/dotsama/transfer.js +29 -30
- package/cjs/koni/api/nft/acala_nft/index.js +1 -4
- package/cjs/koni/api/nft/bit.country/index.js +1 -4
- package/cjs/koni/api/nft/evm_nft/index.js +3 -7
- package/cjs/koni/api/nft/index.js +6 -3
- package/cjs/koni/api/nft/karura_nft/index.js +1 -4
- package/cjs/koni/api/nft/rmrk_nft/index.js +1 -8
- package/cjs/koni/api/nft/statemine_nft/index.js +1 -4
- package/cjs/koni/api/nft/unique_nft/index.js +1 -6
- package/cjs/koni/api/nft/wasm_nft/index.js +111 -169
- package/cjs/koni/api/nft/wasm_nft/utils.js +7 -11
- package/cjs/koni/api/staking/bonding/amplitude.js +9 -13
- package/cjs/koni/api/staking/bonding/astar.js +13 -15
- package/cjs/koni/api/staking/bonding/index.js +10 -22
- package/cjs/koni/api/staking/bonding/paraChain.js +2 -85
- package/cjs/koni/api/staking/bonding/relayChain.js +16 -119
- package/cjs/koni/api/staking/bonding/utils.js +8 -27
- package/cjs/koni/api/tokens/wasm/index.js +4 -5
- package/cjs/koni/api/xcm/polkadotXcm.js +1 -1
- package/cjs/koni/api/xcm/utils.js +13 -18
- package/cjs/koni/api/xcm/xTokens.js +1 -1
- package/cjs/koni/api/xcm/xcmPallet.js +6 -9
- package/cjs/koni/background/cron.js +47 -150
- package/cjs/koni/background/handlers/Extension.js +64 -106
- package/cjs/koni/background/handlers/State.js +21 -19
- package/cjs/koni/background/handlers/Tabs.js +1 -8
- package/cjs/koni/background/subscription.js +29 -32
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/handler/SubstrateChainHandler.js +8 -13
- package/cjs/services/chain-service/handler/light-client/index.js +0 -2
- package/cjs/services/chain-service/index.js +7 -6
- package/cjs/services/event-service/index.js +1 -5
- package/cjs/services/event-service/types.js +1 -11
- package/cjs/services/history-service/index.js +10 -16
- package/cjs/services/history-service/subsquid-multi-chain-history.js +9 -12
- package/cjs/services/price-service/coingecko.js +1 -0
- package/cjs/services/price-service/index.js +3 -2
- package/cjs/services/request-service/handler/AuthRequestHandler.js +2 -6
- package/cjs/services/storage-service/DatabaseService.js +33 -52
- package/cjs/services/storage-service/db-stores/Nft.js +17 -4
- package/cjs/services/transaction-service/event-parser/index.js +48 -20
- package/cjs/services/transaction-service/index.js +14 -23
- package/cjs/utils/index.js +14 -7
- package/constants/index.d.ts +13 -7
- package/constants/index.js +13 -7
- package/koni/api/dotsama/balance.d.ts +1 -0
- package/koni/api/dotsama/balance.js +197 -22
- package/koni/api/dotsama/transfer.js +4 -5
- package/koni/api/nft/acala_nft/index.js +1 -3
- package/koni/api/nft/bit.country/index.js +1 -3
- package/koni/api/nft/evm_nft/index.js +3 -6
- package/koni/api/nft/index.d.ts +2 -1
- package/koni/api/nft/index.js +6 -3
- package/koni/api/nft/karura_nft/index.js +1 -3
- package/koni/api/nft/nft.d.ts +0 -1
- package/koni/api/nft/rmrk_nft/index.js +1 -8
- package/koni/api/nft/statemine_nft/index.js +1 -3
- package/koni/api/nft/unique_nft/index.js +1 -5
- package/koni/api/nft/wasm_nft/index.d.ts +2 -0
- package/koni/api/nft/wasm_nft/index.js +109 -167
- package/koni/api/nft/wasm_nft/utils.d.ts +5 -7
- package/koni/api/nft/wasm_nft/utils.js +5 -7
- package/koni/api/staking/bonding/amplitude.d.ts +1 -0
- package/koni/api/staking/bonding/amplitude.js +10 -15
- package/koni/api/staking/bonding/astar.js +6 -8
- package/koni/api/staking/bonding/index.d.ts +1 -4
- package/koni/api/staking/bonding/index.js +13 -23
- package/koni/api/staking/bonding/paraChain.d.ts +0 -3
- package/koni/api/staking/bonding/paraChain.js +5 -86
- package/koni/api/staking/bonding/relayChain.d.ts +1 -5
- package/koni/api/staking/bonding/relayChain.js +18 -118
- package/koni/api/staking/bonding/utils.d.ts +2 -3
- package/koni/api/staking/bonding/utils.js +9 -27
- package/koni/api/tokens/wasm/index.js +4 -5
- package/koni/api/xcm/polkadotXcm.js +2 -2
- package/koni/api/xcm/utils.d.ts +6 -5
- package/koni/api/xcm/utils.js +10 -15
- package/koni/api/xcm/xTokens.js +2 -2
- package/koni/api/xcm/xcmPallet.js +9 -10
- package/koni/background/cron.d.ts +1 -6
- package/koni/background/cron.js +48 -151
- package/koni/background/handlers/Extension.d.ts +2 -2
- package/koni/background/handlers/Extension.js +67 -108
- package/koni/background/handlers/State.d.ts +6 -5
- package/koni/background/handlers/State.js +21 -19
- package/koni/background/handlers/Tabs.js +1 -8
- package/koni/background/subscription.js +30 -31
- package/package.json +8 -13
- package/packageInfo.js +1 -1
- package/services/chain-service/handler/SubstrateChainHandler.js +9 -14
- package/services/chain-service/handler/light-client/index.d.ts +1 -17
- package/services/chain-service/handler/light-client/index.js +1 -1
- package/services/chain-service/helper/psp22_abi.json +881 -1041
- package/services/chain-service/helper/psp34_abi.json +1808 -2964
- package/services/chain-service/index.js +7 -6
- package/services/event-service/index.js +1 -5
- package/services/event-service/types.d.ts +9 -5
- package/services/event-service/types.js +1 -4
- package/services/history-service/index.d.ts +1 -1
- package/services/history-service/index.js +10 -16
- package/services/history-service/subsquid-multi-chain-history.js +11 -15
- package/services/price-service/coingecko.js +1 -0
- package/services/price-service/index.js +3 -2
- package/services/request-service/handler/AuthRequestHandler.js +2 -6
- package/services/storage-service/DatabaseService.d.ts +0 -1
- package/services/storage-service/DatabaseService.js +33 -52
- package/services/storage-service/db-stores/Nft.d.ts +2 -1
- package/services/storage-service/db-stores/Nft.js +16 -4
- package/services/transaction-service/event-parser/index.js +49 -21
- package/services/transaction-service/index.js +14 -23
- package/utils/index.d.ts +1 -1
- package/utils/index.js +12 -6
- package/cjs/koni/api/tokens/wasm/utils.js +0 -63
- package/koni/api/tokens/wasm/utils.d.ts +0 -6
- package/koni/api/tokens/wasm/utils.js +0 -54
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.0.2-
|
|
20
|
+
"version": "1.0.2-2",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -369,11 +369,6 @@
|
|
|
369
369
|
"require": "./cjs/koni/api/tokens/wasm/index.js",
|
|
370
370
|
"default": "./koni/api/tokens/wasm/index.js"
|
|
371
371
|
},
|
|
372
|
-
"./koni/api/tokens/wasm/utils": {
|
|
373
|
-
"types": "./koni/api/tokens/wasm/utils.d.ts",
|
|
374
|
-
"require": "./cjs/koni/api/tokens/wasm/utils.js",
|
|
375
|
-
"default": "./koni/api/tokens/wasm/utils.js"
|
|
376
|
-
},
|
|
377
372
|
"./koni/api/xcm": {
|
|
378
373
|
"types": "./koni/api/xcm/index.d.ts",
|
|
379
374
|
"require": "./cjs/koni/api/xcm/index.js",
|
|
@@ -1656,12 +1651,12 @@
|
|
|
1656
1651
|
"@sora-substrate/type-definitions": "^1.12.4",
|
|
1657
1652
|
"@subsocial/types": "^0.6.8",
|
|
1658
1653
|
"@substrate/connect": "^0.7.18",
|
|
1659
|
-
"@subwallet/chain-list": "^0.0.
|
|
1660
|
-
"@subwallet/extension-base": "^1.0.2-
|
|
1661
|
-
"@subwallet/extension-chains": "^1.0.2-
|
|
1662
|
-
"@subwallet/extension-dapp": "^1.0.2-
|
|
1663
|
-
"@subwallet/extension-inject": "^1.0.2-
|
|
1664
|
-
"@subwallet/keyring": "^0.0.
|
|
1654
|
+
"@subwallet/chain-list": "^0.0.27",
|
|
1655
|
+
"@subwallet/extension-base": "^1.0.2-2",
|
|
1656
|
+
"@subwallet/extension-chains": "^1.0.2-2",
|
|
1657
|
+
"@subwallet/extension-dapp": "^1.0.2-2",
|
|
1658
|
+
"@subwallet/extension-inject": "^1.0.2-2",
|
|
1659
|
+
"@subwallet/keyring": "^0.0.4",
|
|
1665
1660
|
"@subwallet/ui-keyring": "^0.0.3",
|
|
1666
1661
|
"@unique-nft/types": "^0.6.0-4",
|
|
1667
1662
|
"@zeitgeistpm/type-defs": "^0.10.0",
|
|
@@ -1698,4 +1693,4 @@
|
|
|
1698
1693
|
"web3-eth-contract": "^1.8.1",
|
|
1699
1694
|
"web3-utils": "^1.8.1"
|
|
1700
1695
|
}
|
|
1701
|
-
}
|
|
1696
|
+
}
|
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.0.2-
|
|
10
|
+
version: '1.0.2-2'
|
|
11
11
|
};
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
import { options as acalaOptions } from '@acala-network/api';
|
|
5
5
|
import { rpc as oakRpc, types as oakTypes } from '@oak-foundation/types';
|
|
6
6
|
import { _AssetType } from '@subwallet/chain-list/types';
|
|
7
|
-
import { getDefaultWeightV2 } from '@subwallet/extension-base/koni/api/tokens/wasm/utils';
|
|
8
7
|
import { getSubstrateConnectProvider } from '@subwallet/extension-base/services/chain-service/handler/light-client';
|
|
9
8
|
import { ApiPromise, WsProvider } from '@polkadot/api';
|
|
10
9
|
import { ContractPromise } from '@polkadot/api-contract';
|
|
11
10
|
import { TypeRegistry } from '@polkadot/types/create';
|
|
12
|
-
import {
|
|
11
|
+
import { formatBalance, isTestChain, objectSpread, stringify } from '@polkadot/util';
|
|
13
12
|
import { logger as createLogger } from '@polkadot/util/logger';
|
|
14
13
|
import { defaults as addressDefaults } from '@polkadot/util-crypto/address/defaults';
|
|
15
14
|
import { _API_OPTIONS_CHAIN_GROUP, API_AUTO_CONNECT_MS, API_MAX_RETRY } from "../constants.js";
|
|
@@ -88,13 +87,13 @@ export class SubstrateChainHandler {
|
|
|
88
87
|
if (tokenType === _AssetType.PSP22) {
|
|
89
88
|
tokenContract = new ContractPromise(substrateApi.api, _PSP22_ABI, contractAddress);
|
|
90
89
|
const [nameResp, symbolResp, decimalsResp] = await Promise.all([tokenContract.query['psp22Metadata::tokenName'](contractCaller || contractAddress, {
|
|
91
|
-
gasLimit:
|
|
90
|
+
gasLimit: -1
|
|
92
91
|
}),
|
|
93
92
|
// read-only operation so no gas limit
|
|
94
93
|
tokenContract.query['psp22Metadata::tokenSymbol'](contractCaller || contractAddress, {
|
|
95
|
-
gasLimit:
|
|
94
|
+
gasLimit: -1
|
|
96
95
|
}), tokenContract.query['psp22Metadata::tokenDecimals'](contractCaller || contractAddress, {
|
|
97
|
-
gasLimit:
|
|
96
|
+
gasLimit: -1
|
|
98
97
|
})]);
|
|
99
98
|
if (!(nameResp.result.isOk && symbolResp.result.isOk && decimalsResp.result.isOk) || !nameResp.output || !decimalsResp.output || !symbolResp.output) {
|
|
100
99
|
this.logger.error('Error response while validating WASM contract');
|
|
@@ -105,22 +104,18 @@ export class SubstrateChainHandler {
|
|
|
105
104
|
contractError: true
|
|
106
105
|
};
|
|
107
106
|
} else {
|
|
108
|
-
var _symbolResp$output, _decimalsResp$output,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
name = nameResp.output ? nameObj.Ok || nameObj.ok : '';
|
|
113
|
-
decimals = decimalsResp.output ? new BN(decimalsObj.Ok || decimalsObj.ok).toNumber() : 0;
|
|
114
|
-
symbol = decimalsResp.output ? symbolObj.Ok || symbolObj.ok : '';
|
|
107
|
+
var _symbolResp$output, _decimalsResp$output, _symbolResp$output2;
|
|
108
|
+
name = (_symbolResp$output = symbolResp.output) === null || _symbolResp$output === void 0 ? void 0 : _symbolResp$output.toHuman();
|
|
109
|
+
decimals = parseInt((_decimalsResp$output = decimalsResp.output) === null || _decimalsResp$output === void 0 ? void 0 : _decimalsResp$output.toHuman());
|
|
110
|
+
symbol = (_symbolResp$output2 = symbolResp.output) === null || _symbolResp$output2 === void 0 ? void 0 : _symbolResp$output2.toHuman();
|
|
115
111
|
if (name === '' || symbol === '') {
|
|
116
112
|
contractError = true;
|
|
117
113
|
}
|
|
118
|
-
console.log('validate PSP22', name, symbol, decimals);
|
|
119
114
|
}
|
|
120
115
|
} else {
|
|
121
116
|
tokenContract = new ContractPromise(substrateApi.api, _PSP34_ABI, contractAddress);
|
|
122
117
|
const collectionIdResp = await tokenContract.query['psp34::collectionId'](contractCaller || contractAddress, {
|
|
123
|
-
gasLimit:
|
|
118
|
+
gasLimit: -1
|
|
124
119
|
}); // read-only operation so no gas limit
|
|
125
120
|
|
|
126
121
|
if (!collectionIdResp.result.isOk || !collectionIdResp.output) {
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
|
|
1
|
+
import { ProviderInterface } from '@polkadot/rpc-provider/types';
|
|
3
2
|
export declare const relayChainSpecs: Record<string, string>;
|
|
4
3
|
export declare const paraChainSpecs: Record<string, string>;
|
|
5
|
-
export declare class ProviderPlaceholder implements ProviderInterface {
|
|
6
|
-
private readonly providerPromise;
|
|
7
|
-
private provider?;
|
|
8
|
-
constructor(providerPromise: Promise<ScProvider>);
|
|
9
|
-
get hasSubscriptions(): boolean;
|
|
10
|
-
get isClonable(): boolean;
|
|
11
|
-
get isConnected(): boolean;
|
|
12
|
-
clone(): ProviderInterface;
|
|
13
|
-
connect(): Promise<void>;
|
|
14
|
-
disconnect(): Promise<void>;
|
|
15
|
-
on(type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb): () => void;
|
|
16
|
-
send<T = any>(method: string, params: unknown[], isCacheable?: boolean): Promise<T>;
|
|
17
|
-
subscribe(type: string, method: string, params: unknown[], cb: ProviderInterfaceCallback): Promise<number | string>;
|
|
18
|
-
unsubscribe(type: string, method: string, id: number | string): Promise<boolean>;
|
|
19
|
-
}
|
|
20
4
|
export declare function getSubstrateConnectProvider(specLink: string): ProviderInterface;
|
|
@@ -16,7 +16,7 @@ export const paraChainSpecs = {
|
|
|
16
16
|
'kusama/tinkernet': `${sourceFolderUrl}kusama/tinkernet.json`,
|
|
17
17
|
'polkadot/astar': `${sourceFolderUrl}polkadot/astar.json`
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
class ProviderPlaceholder {
|
|
20
20
|
constructor(providerPromise) {
|
|
21
21
|
this.providerPromise = providerPromise;
|
|
22
22
|
providerPromise.then(provider => {
|