@swapkit/core 1.0.0-rc.35 → 1.0.0-rc.36

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/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "author": "swapkit-oss-team",
3
3
  "dependencies": {
4
- "@swapkit/types": "1.0.0-rc.10",
5
- "@swapkit/helpers": "1.0.0-rc.28"
4
+ "@swapkit/types": "1.0.0-rc.11",
5
+ "@swapkit/helpers": "1.0.0-rc.29"
6
6
  },
7
7
  "description": "SwapKit Lib core",
8
8
  "devDependencies": {
@@ -13,18 +13,18 @@
13
13
  "vite-plugin-wasm": "3.2.2",
14
14
  "vitest": "0.34.4",
15
15
  "@internal/config": "0.0.0-rc.1",
16
- "@swapkit/api": "1.0.0-rc.10",
17
- "@swapkit/tokens": "1.0.0-rc.10",
18
- "@swapkit/toolbox-cosmos": "1.0.0-rc.30",
19
- "@swapkit/toolbox-evm": "1.0.0-rc.30",
20
- "@swapkit/toolbox-utxo": "1.0.0-rc.30"
16
+ "@swapkit/api": "1.0.0-rc.11",
17
+ "@swapkit/tokens": "1.0.0-rc.11",
18
+ "@swapkit/toolbox-cosmos": "1.0.0-rc.31",
19
+ "@swapkit/toolbox-evm": "1.0.0-rc.31",
20
+ "@swapkit/toolbox-utxo": "1.0.0-rc.31"
21
21
  },
22
22
  "peerDependencies": {
23
- "@swapkit/api": "1.0.0-rc.10",
24
- "@swapkit/tokens": "1.0.0-rc.10",
25
- "@swapkit/toolbox-cosmos": "1.0.0-rc.30",
26
- "@swapkit/toolbox-evm": "1.0.0-rc.30",
27
- "@swapkit/toolbox-utxo": "1.0.0-rc.30"
23
+ "@swapkit/api": "1.0.0-rc.11",
24
+ "@swapkit/tokens": "1.0.0-rc.11",
25
+ "@swapkit/toolbox-cosmos": "1.0.0-rc.31",
26
+ "@swapkit/toolbox-evm": "1.0.0-rc.31",
27
+ "@swapkit/toolbox-utxo": "1.0.0-rc.31"
28
28
  },
29
29
  "eslintConfig": {
30
30
  "extends": "../../../internal/eslint-config"
@@ -52,7 +52,7 @@
52
52
  "repository": "https://github.com/thorswap/SwapKit.git",
53
53
  "type": "module",
54
54
  "types": "./dist/index.d.ts",
55
- "version": "1.0.0-rc.35",
55
+ "version": "1.0.0-rc.36",
56
56
  "scripts": {
57
57
  "build": "NODE_OPTIONS=--max_old_space_size=16384 vite build",
58
58
  "clean": "rm -rf dist vite.config.ts.* .turbo node_modules",
@@ -332,7 +332,6 @@ export class SwapKitCore<T = ''> {
332
332
  };
333
333
 
334
334
  addLiquidity = async ({
335
- poolIdentifier,
336
335
  runeAssetValue,
337
336
  assetValue,
338
337
  runeAddr,
@@ -340,7 +339,6 @@ export class SwapKitCore<T = ''> {
340
339
  isPendingSymmAsset,
341
340
  mode = 'sym',
342
341
  }: {
343
- poolIdentifier: string;
344
342
  runeAssetValue: AssetValue;
345
343
  assetValue: AssetValue;
346
344
  isPendingSymmAsset?: boolean;
@@ -348,7 +346,7 @@ export class SwapKitCore<T = ''> {
348
346
  assetAddr?: string;
349
347
  mode?: 'sym' | 'rune' | 'asset';
350
348
  }) => {
351
- const [chain, ...symbolPath] = poolIdentifier.split('.') as [Chain, string];
349
+ const { chain, symbol } = assetValue;
352
350
  const isSym = mode === 'sym';
353
351
  const runeTransfer = runeAssetValue?.gt(0) && (isSym || mode === 'rune');
354
352
  const assetTransfer = assetValue?.gt(0) && (isSym || mode === 'asset');
@@ -364,13 +362,12 @@ export class SwapKitCore<T = ''> {
364
362
  }
365
363
 
366
364
  let runeTx, assetTx;
367
- const sharedParams = { chain, symbol: symbolPath.join('.') };
368
365
 
369
366
  if (runeTransfer && runeAssetValue) {
370
367
  try {
371
368
  runeTx = await this.#depositToPool({
372
369
  assetValue: runeAssetValue,
373
- memo: getMemoFor(MemoType.DEPOSIT, { ...sharedParams, address: assetAddress }),
370
+ memo: getMemoFor(MemoType.DEPOSIT, { chain, symbol, address: assetAddress }),
374
371
  });
375
372
  } catch (error) {
376
373
  throw new SwapKitError('core_transaction_add_liquidity_rune_error', error);
@@ -381,7 +378,7 @@ export class SwapKitCore<T = ''> {
381
378
  try {
382
379
  assetTx = await this.#depositToPool({
383
380
  assetValue,
384
- memo: getMemoFor(MemoType.DEPOSIT, { ...sharedParams, address: runeAddress }),
381
+ memo: getMemoFor(MemoType.DEPOSIT, { chain, symbol, address: runeAddress }),
385
382
  });
386
383
  } catch (error) {
387
384
  throw new SwapKitError('core_transaction_add_liquidity_asset_error', error);
@@ -391,6 +388,24 @@ export class SwapKitCore<T = ''> {
391
388
  return { runeTx, assetTx };
392
389
  };
393
390
 
391
+ addLiquidityPart = ({
392
+ assetValue,
393
+ poolAddress,
394
+ address,
395
+ symmetric,
396
+ }: {
397
+ assetValue: AssetValue;
398
+ address?: string;
399
+ poolAddress: string;
400
+ symmetric: boolean;
401
+ }) => {
402
+ if (symmetric && !address) {
403
+ throw new SwapKitError('core_transaction_add_liquidity_invalid_params');
404
+ }
405
+
406
+ return this.#depositToPool({ assetValue, memo: `+:${poolAddress}:${address || ''}:t:0` });
407
+ };
408
+
394
409
  withdraw = async ({
395
410
  memo,
396
411
  assetValue,