@swapkit/core 1.0.0-rc.12 → 1.0.0-rc.14

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.5",
5
- "@swapkit/helpers": "1.0.0-rc.7"
4
+ "@swapkit/types": "1.0.0-rc.6",
5
+ "@swapkit/helpers": "1.0.0-rc.9"
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-internal.0",
16
- "@swapkit/api": "1.0.0-rc.5",
17
- "@swapkit/tokens": "1.0.0-rc.5",
18
- "@swapkit/toolbox-cosmos": "1.0.0-rc.9",
19
- "@swapkit/toolbox-evm": "1.0.0-rc.8",
20
- "@swapkit/toolbox-utxo": "1.0.0-rc.8"
16
+ "@swapkit/api": "1.0.0-rc.6",
17
+ "@swapkit/tokens": "1.0.0-rc.6",
18
+ "@swapkit/toolbox-cosmos": "1.0.0-rc.11",
19
+ "@swapkit/toolbox-evm": "1.0.0-rc.10",
20
+ "@swapkit/toolbox-utxo": "1.0.0-rc.10"
21
21
  },
22
22
  "peerDependencies": {
23
- "@swapkit/api": "1.0.0-rc.5",
24
- "@swapkit/tokens": "1.0.0-rc.5",
25
- "@swapkit/toolbox-cosmos": "1.0.0-rc.9",
26
- "@swapkit/toolbox-evm": "1.0.0-rc.8",
27
- "@swapkit/toolbox-utxo": "1.0.0-rc.8"
23
+ "@swapkit/api": "1.0.0-rc.6",
24
+ "@swapkit/tokens": "1.0.0-rc.6",
25
+ "@swapkit/toolbox-cosmos": "1.0.0-rc.11",
26
+ "@swapkit/toolbox-evm": "1.0.0-rc.10",
27
+ "@swapkit/toolbox-utxo": "1.0.0-rc.10"
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.12",
55
+ "version": "1.0.0-rc.14",
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",
@@ -120,13 +120,20 @@ export class SwapKitCore<T = ''> {
120
120
  const { address: recipient } = await this.#getInboundDataByChain(asset.chain);
121
121
  const {
122
122
  contract: router,
123
- calldata: { amountIn, memo, memoStreamingSwap },
123
+ calldata: { expiration, amountIn, memo, memoStreamingSwap },
124
124
  } = route;
125
125
 
126
126
  const assetValue = asset.add(SwapKitNumber.fromBigInt(BigInt(amountIn), asset.decimal));
127
127
  const swapMemo = (streamSwap ? memoStreamingSwap || memo : memo) as string;
128
128
 
129
- return this.deposit({ assetValue, memo: swapMemo, feeOptionKey, router, recipient });
129
+ return this.deposit({
130
+ expiration,
131
+ assetValue,
132
+ memo: swapMemo,
133
+ feeOptionKey,
134
+ router,
135
+ recipient,
136
+ });
130
137
  }
131
138
 
132
139
  if (SWAP_IN.includes(quoteMode)) {
@@ -147,9 +154,7 @@ export class SwapKitCore<T = ''> {
147
154
 
148
155
  const contract = await walletMethods.createContract?.(contractAddress, abi, provider);
149
156
 
150
- // TODO: (@Towan) Contract evm methods should be generic
151
- // @ts-expect-error
152
- const tx = await contract.populateTransaction.swapIn?.(
157
+ const tx = await contract.getFunction('swapIn').populateTransaction(
153
158
  ...getSwapInParams({
154
159
  streamSwap,
155
160
  toChecksumAddress,
@@ -237,7 +242,7 @@ export class SwapKitCore<T = ''> {
237
242
  ? TCBscDepositABI
238
243
  : TCEthereumVaultAbi;
239
244
 
240
- return (await (
245
+ const response = await (
241
246
  walletInstance as EVMWallet<typeof AVAXToolbox | typeof ETHToolbox | typeof BSCToolbox>
242
247
  ).call({
243
248
  abi,
@@ -248,12 +253,17 @@ export class SwapKitCore<T = ''> {
248
253
  recipient,
249
254
  getChecksumAddressFromAsset({ chain, symbol, ticker }, chain),
250
255
  // TODO: (@Towan) Re-Check on that conversion 🙏
251
- assetValue.baseValueBigInt.toString(),
256
+ assetValue.getBaseValue('bigint').toString(),
252
257
  params.memo,
253
258
  rest.expiration,
254
259
  ],
255
- txOverrides: { from: params.from, value: assetValue.baseValueBigInt },
256
- })) as Promise<string>;
260
+ txOverrides: {
261
+ from: params.from,
262
+ value: assetValue.isGasAsset ? assetValue.getBaseValue('bigint') : undefined,
263
+ },
264
+ });
265
+
266
+ return response as string;
257
267
  }
258
268
 
259
269
  default: {
@@ -1,4 +1,4 @@
1
- import { getRequest } from '@swapkit/helpers';
1
+ import { RequestClient } from '@swapkit/helpers';
2
2
  import type { Chain } from '@swapkit/types';
3
3
  import { ApiUrl } from '@swapkit/types';
4
4
 
@@ -21,11 +21,11 @@ type InboundAddressData = {
21
21
  export const getInboundData = (stagenet: boolean) => {
22
22
  const baseUrl = stagenet ? ApiUrl.ThornodeStagenet : ApiUrl.ThornodeMainnet;
23
23
 
24
- return getRequest<InboundAddressData>(`${baseUrl}/thorchain/inbound_addresses`);
24
+ return RequestClient.get<InboundAddressData>(`${baseUrl}/thorchain/inbound_addresses`);
25
25
  };
26
26
 
27
27
  export const getMimirData = (stagenet: boolean) => {
28
28
  const baseUrl = stagenet ? ApiUrl.ThornodeStagenet : ApiUrl.ThornodeMainnet;
29
29
 
30
- return getRequest<Record<string, number>>(`${baseUrl}/thorchain/mimir`);
30
+ return RequestClient.get<Record<string, number>>(`${baseUrl}/thorchain/mimir`);
31
31
  };