@kapa123456789/sdk 0.0.81 → 0.0.83

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapa123456789/sdk",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "homepage": "hinkal.io",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
@@ -63,7 +63,8 @@
63
63
  "prebuild": "nx prebuild:workers",
64
64
  "build": "nx build",
65
65
  "lint": "nx lint",
66
- "test": "nx test"
66
+ "test": "nx test",
67
+ "postinstall": "node ./scripts/strip-blake-hash-native.cjs"
67
68
  },
68
69
  "devDependencies": {
69
70
  "nx": "22.6.4",
@@ -1 +1 @@
1
- const e=require(`../../common/src/functions/utils/erc20tokenFunctions.cjs`),t=require(`../../common/src/functions/utils/process.utils.cjs`),n=require(`../../common/src/functions/web3/uniswapAPI.cjs`),r=require(`../../common/src/functions/web3/odosAPI.cjs`),i=require(`../../common/src/functions/web3/oneInchAPI.cjs`),a=require(`../../common/src/functions/web3/okxAPI.cjs`);require(`../../common/src/functions/index.cjs`);var o=async(t,r,i,a,o)=>{let s=t.hinkalCommon,[c,l]=await e.resolveErc20Tokens(r,[a,o]);return n.getUniswapPrice(s,r,i,c,l)},s=async(n,a,s,c,l)=>{console.log(`getEvmSwapPrices`,a,s,c,l);let[u,d]=await e.resolveErc20Tokens(a,[c,l]);console.log(`getEvmSwapPrices`,u,d);let[f,p,m]=await Promise.allSettled([t.withTimeout(o(n,a,s,c,l)),t.withTimeout(r.getOdosPrice(a,u,d,s)),t.withTimeout(i.getOneInchPrice(a,u,d,s))]);return console.log(`getEvmSwapPrices`,f,p,m),{uniswap:f.status===`fulfilled`?f.value:null,odos:p.status===`fulfilled`?p.value:null,oneInch:m.status===`fulfilled`?m.value:null}},c=async(n,r,i,o)=>{console.log(`getSolanaSwapPrices`,n,r,i,o);let[s,c]=await e.resolveErc20Tokens(n,[i,o]);console.log(`getSolanaSwapPrices`,s,c);try{return{okx:await t.withTimeout(a.getOKXPrice(n,s,c,r))}}catch(e){return console.log(`getSolanaSwapPrices error`,e),{okx:null}}};exports.getEvmSwapPrices=s,exports.getSolanaSwapPrices=c;
1
+ const e=require(`../../common/src/functions/utils/erc20tokenFunctions.cjs`),t=require(`../../common/src/functions/utils/process.utils.cjs`),n=require(`../../common/src/functions/web3/uniswapAPI.cjs`),r=require(`../../common/src/functions/web3/odosAPI.cjs`),i=require(`../../common/src/functions/web3/oneInchAPI.cjs`),a=require(`../../common/src/functions/web3/okxAPI.cjs`);require(`../../common/src/functions/index.cjs`);var o=async(t,r,i,a,o)=>{let s=t.hinkalCommon,[c,l]=await e.resolveErc20Tokens(r,[a,o]);return n.getUniswapPrice(s,r,i,c,l)},s=async(n,a,s,c,l)=>{let[u,d]=await e.resolveErc20Tokens(a,[c,l]),[f,p,m]=await Promise.allSettled([t.withTimeout(o(n,a,s,c,l)),t.withTimeout(r.getOdosPrice(a,u,d,s)),t.withTimeout(i.getOneInchPrice(a,u,d,s))]);return{uniswap:f.status===`fulfilled`?f.value:null,odos:p.status===`fulfilled`?p.value:null,oneInch:m.status===`fulfilled`?m.value:null}},c=async(n,r,i,o)=>{let[s,c]=await e.resolveErc20Tokens(n,[i,o]);try{return{okx:await t.withTimeout(a.getOKXPrice(n,s,c,r))}}catch{return{okx:null}}};exports.getEvmSwapPrices=s,exports.getSolanaSwapPrices=c;
@@ -10,27 +10,22 @@ var o = async (t, r, i, a, o) => {
10
10
  let s = t.hinkalCommon, [c, l] = await e(r, [a, o]);
11
11
  return n(s, r, i, c, l);
12
12
  }, s = async (n, a, s, c, l) => {
13
- console.log("getEvmSwapPrices", a, s, c, l);
14
- let [u, d] = await e(a, [c, l]);
15
- console.log("getEvmSwapPrices", u, d);
16
- let [f, p, m] = await Promise.allSettled([
13
+ let [u, d] = await e(a, [c, l]), [f, p, m] = await Promise.allSettled([
17
14
  t(o(n, a, s, c, l)),
18
15
  t(r(a, u, d, s)),
19
16
  t(i(a, u, d, s))
20
17
  ]);
21
- return console.log("getEvmSwapPrices", f, p, m), {
18
+ return {
22
19
  uniswap: f.status === "fulfilled" ? f.value : null,
23
20
  odos: p.status === "fulfilled" ? p.value : null,
24
21
  oneInch: m.status === "fulfilled" ? m.value : null
25
22
  };
26
23
  }, c = async (n, r, i, o) => {
27
- console.log("getSolanaSwapPrices", n, r, i, o);
28
24
  let [s, c] = await e(n, [i, o]);
29
- console.log("getSolanaSwapPrices", s, c);
30
25
  try {
31
26
  return { okx: await t(a(n, s, c, r)) };
32
- } catch (e) {
33
- return console.log("getSolanaSwapPrices error", e), { okx: null };
27
+ } catch {
28
+ return { okx: null };
34
29
  }
35
30
  };
36
31
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapa123456789/sdk",
3
- "version": "0.0.81",
3
+ "version": "0.0.83",
4
4
  "homepage": "hinkal.io",
5
5
  "author": {
6
6
  "name": "Hinkal Protocol"
@@ -63,7 +63,8 @@
63
63
  "prebuild": "nx prebuild:workers",
64
64
  "build": "nx build",
65
65
  "lint": "nx lint",
66
- "test": "nx test"
66
+ "test": "nx test",
67
+ "postinstall": "node ./scripts/strip-blake-hash-native.cjs"
67
68
  },
68
69
  "devDependencies": {
69
70
  "nx": "22.6.4",
@@ -0,0 +1,35 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const stripPrebuildsDir = (blakeHashDir) => {
5
+ const prebuildsDir = path.join(blakeHashDir, 'prebuilds');
6
+ console.log({ prebuildsDir });
7
+ if (!fs.existsSync(prebuildsDir)) return;
8
+
9
+ // eslint-disable-next-line no-restricted-syntax
10
+ for (const platform of fs.readdirSync(prebuildsDir)) {
11
+ console.log({ platform });
12
+ const nativeBinary = path.join(prebuildsDir, platform, 'node.napi.node');
13
+ console.log({ nativeBinary });
14
+ if (fs.existsSync(nativeBinary)) {
15
+ fs.unlinkSync(nativeBinary);
16
+ }
17
+ }
18
+ };
19
+
20
+ let dir = __dirname;
21
+ for (let depth = 0; depth < 10; depth += 1) {
22
+ const candidate = path.join(dir, 'node_modules', 'blake-hash');
23
+ console.log({ candidate });
24
+ if (fs.existsSync(candidate)) {
25
+ console.log('stripping blake hash native');
26
+ stripPrebuildsDir(candidate);
27
+ }
28
+
29
+ const parent = path.dirname(dir);
30
+ console.log({ parent });
31
+ console.log('dir', dir);
32
+ console.log('parent === dir', parent === dir);
33
+ if (parent === dir) break;
34
+ dir = parent;
35
+ }