@subwallet/extension-base 1.3.49-0 → 1.3.50-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.
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-base',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.3.49-0'
16
+ version: '1.3.50-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -72,16 +72,15 @@ class ChainflipSwapHandler {
72
72
  } = params;
73
73
  const pair = quote.pair;
74
74
  const fromAsset = this.chainService.getAssetBySlug(pair.from);
75
- const toAsset = this.chainService.getAssetBySlug(pair.to);
76
75
  const chainInfo = this.chainService.getChainInfoByKey(fromAsset.originChain);
77
76
  const toChainInfo = this.chainService.getChainInfoByKey(fromAsset.originChain);
78
77
  const chainType = (0, _utils._isChainSubstrateCompatible)(chainInfo) ? _KoniTypes.ChainType.SUBSTRATE : _KoniTypes.ChainType.EVM;
79
78
  const receiver = (0, _utils2._reformatAddressWithChain)(recipient !== null && recipient !== void 0 ? recipient : address, toChainInfo);
80
- const fromAssetId = (0, _utils._getAssetSymbol)(fromAsset);
81
- const toAssetId = (0, _utils._getAssetSymbol)(toAsset);
82
79
  const minReceive = new _bignumber.default(quote.rate).times(1 - slippage).toString();
83
80
  const processMetadata = params.process.steps[params.currentStep].metadata;
84
81
  const quoteMetadata = processMetadata;
82
+ const fromAssetId = quoteMetadata.fromAssetId;
83
+ const toAssetId = quoteMetadata.toAssetId;
85
84
  if (!processMetadata || !quoteMetadata) {
86
85
  throw new Error('Metadata for Chainflip not found');
87
86
  }
@@ -114,6 +113,7 @@ class ChainflipSwapHandler {
114
113
  method: 'GET'
115
114
  }, this.isTestnet);
116
115
  const data = await response.json();
116
+ console.log('Chainflip channel info:', data);
117
117
  if (!data.id || !data.address || data.address === '' || !data.issuedBlock || !data.network || !data.channelId) {
118
118
  throw new Error('Error get Chainflip data');
119
119
  }
@@ -223,6 +223,8 @@ class ChainflipSwapHandler {
223
223
  receiver: (0, _utils2._reformatAddressWithChain)(params.request.recipient || params.request.address, destinationChain),
224
224
  srcChain: metadata.srcChain,
225
225
  destChain: metadata.destChain,
226
+ fromAssetId: metadata.fromAssetId,
227
+ toAssetId: metadata.toAssetId,
226
228
  version: 2
227
229
  }
228
230
  };
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.3.49-0",
20
+ "version": "1.3.50-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -2866,12 +2866,12 @@
2866
2866
  "@sora-substrate/type-definitions": "^1.17.7",
2867
2867
  "@substrate/connect": "^0.8.9",
2868
2868
  "@subwallet/chain-list": "0.2.110",
2869
- "@subwallet/extension-base": "^1.3.49-0",
2870
- "@subwallet/extension-chains": "^1.3.49-0",
2871
- "@subwallet/extension-dapp": "^1.3.49-0",
2872
- "@subwallet/extension-inject": "^1.3.49-0",
2869
+ "@subwallet/extension-base": "^1.3.50-0",
2870
+ "@subwallet/extension-chains": "^1.3.50-0",
2871
+ "@subwallet/extension-dapp": "^1.3.50-0",
2872
+ "@subwallet/extension-inject": "^1.3.50-0",
2873
2873
  "@subwallet/keyring": "^0.1.12",
2874
- "@subwallet/subwallet-api-sdk": "^1.3.49-0",
2874
+ "@subwallet/subwallet-api-sdk": "^1.3.50-0",
2875
2875
  "@subwallet/ui-keyring": "^0.1.12",
2876
2876
  "@ton/core": "^0.56.3",
2877
2877
  "@ton/crypto": "^3.2.0",
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.49-0'
10
+ version: '1.3.50-0'
11
11
  };
@@ -6,7 +6,7 @@ import { TransactionError } from '@subwallet/extension-base/background/errors/Tr
6
6
  import { ChainType, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
7
7
  import { getERC20TransactionObject, getEVMTransactionObject } from '@subwallet/extension-base/services/balance-service/transfer/smart-contract';
8
8
  import { createSubstrateExtrinsic } from '@subwallet/extension-base/services/balance-service/transfer/token';
9
- import { _getAssetSymbol, _getContractAddressOfToken, _isChainSubstrateCompatible, _isNativeToken } from '@subwallet/extension-base/services/chain-service/utils';
9
+ import { _getContractAddressOfToken, _isChainSubstrateCompatible, _isNativeToken } from '@subwallet/extension-base/services/chain-service/utils';
10
10
  import { SwapBaseHandler } from '@subwallet/extension-base/services/swap-service/handler/base-handler';
11
11
  import { BasicTxErrorType, CommonStepType, DynamicSwapType, SwapProviderId, SwapStepType } from '@subwallet/extension-base/types';
12
12
  import { ProxyServiceRoute } from '@subwallet/extension-base/types/environment';
@@ -64,16 +64,15 @@ export class ChainflipSwapHandler {
64
64
  } = params;
65
65
  const pair = quote.pair;
66
66
  const fromAsset = this.chainService.getAssetBySlug(pair.from);
67
- const toAsset = this.chainService.getAssetBySlug(pair.to);
68
67
  const chainInfo = this.chainService.getChainInfoByKey(fromAsset.originChain);
69
68
  const toChainInfo = this.chainService.getChainInfoByKey(fromAsset.originChain);
70
69
  const chainType = _isChainSubstrateCompatible(chainInfo) ? ChainType.SUBSTRATE : ChainType.EVM;
71
70
  const receiver = _reformatAddressWithChain(recipient !== null && recipient !== void 0 ? recipient : address, toChainInfo);
72
- const fromAssetId = _getAssetSymbol(fromAsset);
73
- const toAssetId = _getAssetSymbol(toAsset);
74
71
  const minReceive = new BigNumber(quote.rate).times(1 - slippage).toString();
75
72
  const processMetadata = params.process.steps[params.currentStep].metadata;
76
73
  const quoteMetadata = processMetadata;
74
+ const fromAssetId = quoteMetadata.fromAssetId;
75
+ const toAssetId = quoteMetadata.toAssetId;
77
76
  if (!processMetadata || !quoteMetadata) {
78
77
  throw new Error('Metadata for Chainflip not found');
79
78
  }
@@ -106,6 +105,7 @@ export class ChainflipSwapHandler {
106
105
  method: 'GET'
107
106
  }, this.isTestnet);
108
107
  const data = await response.json();
108
+ console.log('Chainflip channel info:', data);
109
109
  if (!data.id || !data.address || data.address === '' || !data.issuedBlock || !data.network || !data.channelId) {
110
110
  throw new Error('Error get Chainflip data');
111
111
  }
@@ -215,6 +215,8 @@ export class ChainflipSwapHandler {
215
215
  receiver: _reformatAddressWithChain(params.request.recipient || params.request.address, destinationChain),
216
216
  srcChain: metadata.srcChain,
217
217
  destChain: metadata.destChain,
218
+ fromAssetId: metadata.fromAssetId,
219
+ toAssetId: metadata.toAssetId,
218
220
  version: 2
219
221
  }
220
222
  };
@@ -226,4 +226,6 @@ export interface HydrationSwapStepMetadata extends BaseSwapStepMetadata {
226
226
  export interface ChainFlipSwapStepMetadata extends BaseSwapStepMetadata {
227
227
  srcChain: string;
228
228
  destChain: string;
229
+ fromAssetId: string;
230
+ toAssetId: string;
229
231
  }