@hinkal/common 0.1.3 → 0.1.5
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/README.md +0 -56
- package/functions/protocols/pendle.helpers.cjs +1 -1
- package/functions/protocols/pendle.helpers.mjs +11 -10
- package/functions/utils/cacheFunctions.cjs +1 -1
- package/functions/utils/cacheFunctions.mjs +1 -1
- package/package.json +2 -1
- package/providers/prepareEthersHinkal.cjs +1 -1
- package/providers/prepareEthersHinkal.mjs +3 -2
- package/providers/prepareWagmiv1Hinkal.cjs +1 -1
- package/providers/prepareWagmiv1Hinkal.mjs +3 -2
- package/webworker/viteWorkerURL.constant.cjs +21 -1
- package/webworker/viteWorkerURL.constant.mjs +1 -3
- package/assets/snarkjsWorkerLauncher-T9sCESzH.js +0 -1202
- package/assets/snarkjsWorkerLogic-CrBQ1Sdm.js +0 -17970
- package/assets/utxoWorkerLauncher-Bu-W3EAj.js +0 -1204
- package/assets/utxoWorkerLogic-CBkU2odl.js +0 -51883
- package/assets/zkProofWorkerLauncher-BwaZD8dV.js +0 -1204
- package/assets/zkProofWorkerLogic-BwY5sE7i.js +0 -51399
package/README.md
CHANGED
|
@@ -18,62 +18,6 @@ Or, yarn:
|
|
|
18
18
|
yarn add @hinkal/common
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
## Vite-based React App
|
|
23
|
-
#### Step 1: Create a Vite App
|
|
24
|
-
If you don't have a Vite app set up, create one using the following command:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npm create vite@latest my-vite-app --template react
|
|
28
|
-
cd my-vite-app
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Next.js-based App
|
|
32
|
-
#### Step 1: Create a Next.js App
|
|
33
|
-
If you don't have a Next.js app set up, create one using the following command:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npx create-next-app@latest my-next-app
|
|
37
|
-
cd my-next-app
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
#### Step 2: Install Required Packages
|
|
41
|
-
For correct operation in Next.js, you should install copy-webpack-plugin:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npm install copy-webpack-plugin node-polyfill-webpack-plugin
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
#### Step 3: Configure Next.js
|
|
48
|
-
Create or update the next.config.js file in the root of your Next.js project and add the following configuration:
|
|
49
|
-
|
|
50
|
-
```javascript
|
|
51
|
-
// next.config.js
|
|
52
|
-
const CopyPlugin = require("copy-webpack-plugin");
|
|
53
|
-
|
|
54
|
-
module.exports = {
|
|
55
|
-
webpack: (config) => {
|
|
56
|
-
config.plugins.push(
|
|
57
|
-
new NodePolyfillPlugin({
|
|
58
|
-
additionalAliases: ['fs'],
|
|
59
|
-
excludeAliases: ['constants']
|
|
60
|
-
}),
|
|
61
|
-
// TODO: research better solution
|
|
62
|
-
new ReplaceInFileWebpackPlugin([{
|
|
63
|
-
dir: 'node_modules/fastfile/src',
|
|
64
|
-
files: ['fastfile.js'],
|
|
65
|
-
rules: [{
|
|
66
|
-
search: 'import { O_TRUNC, O_CREAT, O_RDWR, O_EXCL, O_RDONLY } from "constants";',
|
|
67
|
-
replace: 'import t from "constants"; const { O_TRUNC, O_CREAT, O_RDWR, O_EXCL, O_RDONLY } = t;'
|
|
68
|
-
}],
|
|
69
|
-
}]),
|
|
70
|
-
);
|
|
71
|
-
return config;
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
```
|
|
75
|
-
The CopyPlugin in the Next.js configuration is required to ensure that the necessary worker scripts are correctly loaded into your application. By copying the worker-related assets to the appropriate directory, you enable seamless access to these resources. This setup is crucial for the proper functioning of your library, which relies on Web Workers.
|
|
76
|
-
|
|
77
21
|
### Usage
|
|
78
22
|
|
|
79
23
|
1. Import hinkal from @hinkal/common package and initiate a Hinkal instance:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");const o=require("../../constants/server.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const i=require("../utils/caseInsensitive.utils.cjs");require("../../types/circom-data.types.cjs");const s=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");const n=require("../../types/pendle.types.cjs");require("../../types/curve.types.cjs");require("ethers");require("circomlibjs");require("../../data-structures/crypto-keys/keys.cjs");require("../utils/external-action.utils.cjs");const c=require("../utils/erc20tokenFunctions.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("axios");require("../utils/userAgent.cjs");require("../../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../../data-structures/volatile-helper/VolatileHelper.cjs");const T=require("../utils/enum.utils.cjs");function P(e){if(!e)return;const r=c.getERC20Token(e.address,e.chainId);if(!r?.isVolatile)return r?.symbol.toLowerCase()==="weth"&&console.log("token:",r),r}function w(e,r){if(!e||!r)return;let t;switch(r){case n.PendleAssetType.YT:t=e?.yt;break;case n.PendleAssetType.PT:t=e?.pt;break;case n.PendleAssetType.PENDLE_LP:t=e?.lp;break;case n.PendleAssetType.SY:t=e?.sy;break;default:t=void 0;break}return t}const F=(e,r,t)=>{if(i.caseInsensitiveEqual(e.yt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForYt;if(i.caseInsensitiveEqual(e.pt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForPt;if(i.caseInsensitiveEqual(e.yt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactYtForToken;if(i.caseInsensitiveEqual(e.pt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactPtForToken},k=e=>{let r;switch(e){case n.PendleSwapType.SwapExactTokenForYt:r=o.API_CONFIG.ROUTES.pendleSwapExactTokenForYT;break;case n.PendleSwapType.SwapExactTokenForPt:r=o.API_CONFIG.ROUTES.pendleSwapExactTokenForPt;break;case n.PendleSwapType.SwapExactYtForToken:r=o.API_CONFIG.ROUTES.pendleSwapExactYtForToken;break;case n.PendleSwapType.SwapExactPtForToken:r=o.API_CONFIG.ROUTES.pendleSwapExactPtForToken;break;default:throw new Error("Cant determine Pendle Swap Type Api Route")}return r},q=(e,r,t,a)=>{if(!T.isInEnum(s.PendleAction,e))throw new Error("getTokenIndexForPendleFlatFee: Invalid Pendle Action");if(a)return t.findIndex(d=>d.toLowerCase()===a?.toLowerCase());const l=r.findIndex(d=>d>0n),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../../constants/chains.constants.cjs");require("../../constants/vite.constants.cjs");require("../../constants/contracts.constants.cjs");require("../../constants/kyc.constants.cjs");const o=require("../../constants/server.constants.cjs");require("../../constants/coingecko.constants.cjs");require("../../constants/axelar.constants.cjs");require("../../constants/rewards.constants.cjs");require("../../constants/reorg-depths.constants.cjs");const i=require("../utils/caseInsensitive.utils.cjs");require("../../types/circom-data.types.cjs");const s=require("../../types/hinkal.types.cjs");require("../../types/transactions.types.cjs");const n=require("../../types/pendle.types.cjs");require("../../types/curve.types.cjs");require("ethers");require("circomlibjs");require("../../data-structures/crypto-keys/keys.cjs");require("idb-keyval");require("../utils/external-action.utils.cjs");const c=require("../utils/erc20tokenFunctions.cjs");require("../utils/convertIntegrationProviderToExternalActionId.cjs");require("axios");require("../utils/userAgent.cjs");require("../../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../../data-structures/volatile-helper/VolatileHelper.cjs");const T=require("../utils/enum.utils.cjs");function P(e){if(!e)return;const r=c.getERC20Token(e.address,e.chainId);if(!r?.isVolatile)return r?.symbol.toLowerCase()==="weth"&&console.log("token:",r),r}function w(e,r){if(!e||!r)return;let t;switch(r){case n.PendleAssetType.YT:t=e?.yt;break;case n.PendleAssetType.PT:t=e?.pt;break;case n.PendleAssetType.PENDLE_LP:t=e?.lp;break;case n.PendleAssetType.SY:t=e?.sy;break;default:t=void 0;break}return t}const F=(e,r,t)=>{if(i.caseInsensitiveEqual(e.yt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForYt;if(i.caseInsensitiveEqual(e.pt.address,t.erc20TokenAddress))return n.PendleSwapType.SwapExactTokenForPt;if(i.caseInsensitiveEqual(e.yt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactYtForToken;if(i.caseInsensitiveEqual(e.pt.address,r.erc20TokenAddress))return n.PendleSwapType.SwapExactPtForToken},k=e=>{let r;switch(e){case n.PendleSwapType.SwapExactTokenForYt:r=o.API_CONFIG.ROUTES.pendleSwapExactTokenForYT;break;case n.PendleSwapType.SwapExactTokenForPt:r=o.API_CONFIG.ROUTES.pendleSwapExactTokenForPt;break;case n.PendleSwapType.SwapExactYtForToken:r=o.API_CONFIG.ROUTES.pendleSwapExactYtForToken;break;case n.PendleSwapType.SwapExactPtForToken:r=o.API_CONFIG.ROUTES.pendleSwapExactPtForToken;break;default:throw new Error("Cant determine Pendle Swap Type Api Route")}return r},q=(e,r,t,a)=>{if(!T.isInEnum(s.PendleAction,e))throw new Error("getTokenIndexForPendleFlatFee: Invalid Pendle Action");if(a)return t.findIndex(d=>d.toLowerCase()===a?.toLowerCase());const l=r.findIndex(d=>d>0n),p=r.length-1;if(r[p]<=0n)throw new Error("getTokenIndexForPendleFlatFee: Last token in amountChange is not > 0");let u=l;return(e===s.PendleAction.Mint||e===s.PendleAction.Redeem||e===s.PendleAction.PoolRemove)&&(u=l),u};exports.determinePendleSwapType=F;exports.determinePendleSwapTypeApiRoute=k;exports.erc20TokenFromPendleAsset=P;exports.getAssetTypeFromPendleMarket=w;exports.getTokenIndexForPendleFlatFee=q;
|
|
@@ -16,6 +16,7 @@ import "../../types/curve.types.mjs";
|
|
|
16
16
|
import "ethers";
|
|
17
17
|
import "circomlibjs";
|
|
18
18
|
import "../../data-structures/crypto-keys/keys.mjs";
|
|
19
|
+
import "idb-keyval";
|
|
19
20
|
import "../utils/external-action.utils.mjs";
|
|
20
21
|
import { getERC20Token as T } from "../utils/erc20tokenFunctions.mjs";
|
|
21
22
|
import "../utils/convertIntegrationProviderToExternalActionId.mjs";
|
|
@@ -24,14 +25,14 @@ import "../utils/userAgent.mjs";
|
|
|
24
25
|
import "../../data-structures/custom-token-registry/CustomTokenRegistry.mjs";
|
|
25
26
|
import "../../data-structures/volatile-helper/VolatileHelper.mjs";
|
|
26
27
|
import { isInEnum as w } from "../utils/enum.utils.mjs";
|
|
27
|
-
function
|
|
28
|
+
function V(e) {
|
|
28
29
|
if (!e)
|
|
29
30
|
return;
|
|
30
31
|
const r = T(e.address, e.chainId);
|
|
31
32
|
if (!r?.isVolatile)
|
|
32
33
|
return r?.symbol.toLowerCase() === "weth" && console.log("token:", r), r;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function j(e, r) {
|
|
35
36
|
if (!e || !r)
|
|
36
37
|
return;
|
|
37
38
|
let o;
|
|
@@ -54,7 +55,7 @@ function V(e, r) {
|
|
|
54
55
|
}
|
|
55
56
|
return o;
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
+
const z = (e, r, o) => {
|
|
58
59
|
if (i(e.yt.address, o.erc20TokenAddress))
|
|
59
60
|
return t.SwapExactTokenForYt;
|
|
60
61
|
if (i(e.pt.address, o.erc20TokenAddress))
|
|
@@ -63,7 +64,7 @@ const j = (e, r, o) => {
|
|
|
63
64
|
return t.SwapExactYtForToken;
|
|
64
65
|
if (i(e.pt.address, r.erc20TokenAddress))
|
|
65
66
|
return t.SwapExactPtForToken;
|
|
66
|
-
},
|
|
67
|
+
}, H = (e) => {
|
|
67
68
|
let r;
|
|
68
69
|
switch (e) {
|
|
69
70
|
case t.SwapExactTokenForYt:
|
|
@@ -82,7 +83,7 @@ const j = (e, r, o) => {
|
|
|
82
83
|
throw new Error("Cant determine Pendle Swap Type Api Route");
|
|
83
84
|
}
|
|
84
85
|
return r;
|
|
85
|
-
},
|
|
86
|
+
}, J = (e, r, o, s) => {
|
|
86
87
|
if (!w(p, e))
|
|
87
88
|
throw new Error("getTokenIndexForPendleFlatFee: Invalid Pendle Action");
|
|
88
89
|
if (s)
|
|
@@ -96,9 +97,9 @@ const j = (e, r, o) => {
|
|
|
96
97
|
return (e === p.Mint || e === p.Redeem || e === p.PoolRemove) && (c = l), c;
|
|
97
98
|
};
|
|
98
99
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
z as determinePendleSwapType,
|
|
101
|
+
H as determinePendleSwapTypeApiRoute,
|
|
102
|
+
V as erc20TokenFromPendleAsset,
|
|
103
|
+
j as getAssetTypeFromPendleMarket,
|
|
104
|
+
J as getTokenIndexForPendleFlatFee
|
|
104
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../../error-handling/logError.cjs"),C=require("./getDataFromTransaction.cjs"),S=require("idb-keyval"),u={encryptedOutputs:[],lastOutput:""},h=(e,t)=>{const r=e.substring(0,25),s=t.substring(0,25);return{shortPublicKey:r,shortHinkalAddress:s}},d=new Map,T=(e,t,r)=>{if(!e||!t||!r)throw Error("GetHinkalCache: incorrect arguments");const{shortPublicKey:s,shortHinkalAddress:a}=h(t,r);return JSON.parse(typeof localStorage<"u"?localStorage.getItem(`hinkalCache-${e}-${s}-${a}`)??JSON.stringify(u):d.get(`hinkalCache-${e}-${s}-${a}`)??JSON.stringify(u))},f=(e,t,r,s)=>{if(!t||!r||!s)throw Error("SetHinkalCache: incorrect arguments");const{shortPublicKey:a,shortHinkalAddress:o}=h(r,s);typeof localStorage<"u"?localStorage.setItem(`hinkalCache-${t}-${a}-${o}`,JSON.stringify(e)):d.set(`hinkalCache-${t}-${a}-${o}`,JSON.stringify(e))},H=(e,t,r)=>{f(u,e,t,r)},x=(e,t,r)=>`txsCache-${e}-${t}-${r}`,m=async(e,t,r,s,a)=>{if(!t||!r||!s)throw Error("saveTxsCache: incorrect arguments");const{shortPublicKey:o,shortHinkalAddress:c}=h(r,s),l=C.serializeDecodedTxs(e);y.logError("saveTxsCache before saving",{serializedTxs:l});const n=x(t,o,c),i=JSON.stringify({serializedTxs:l,lastHash:a});try{await S.set(n,i)}catch{localStorage.setItem(n,i)}},$={serializedTxs:[],lastHash:""},k=async(e,t,r)=>{if(!e||!t||!r)throw Error("loadTxsCache: incorrect arguments");const{shortPublicKey:s,shortHinkalAddress:a}=h(t,r),o=x(e,s,a);let c;try{const g=await S.get(o);if(!g)throw new Error("Empty indexedDB cache");c=g}catch{c=localStorage.getItem(o)}const{serializedTxs:l,lastHash:n}=JSON.parse(c??JSON.stringify($)),i=l.map(g=>C.deserializeDecodedTxs(g));return y.logError("loadTxsCache ",{decodedTxs:i,lastHash:n}),{decodedTxs:i,lastHash:n===""?void 0:n}};exports.getHinkalCache=T;exports.loadTxsCache=k;exports.resetCache=H;exports.saveTxsCache=m;exports.setHinkalCache=f;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { logError as f } from "../../error-handling/logError.mjs";
|
|
2
2
|
import { serializeDecodedTxs as m, deserializeDecodedTxs as S } from "./getDataFromTransaction.mjs";
|
|
3
|
-
import { set as p, get as x } from "
|
|
3
|
+
import { set as p, get as x } from "idb-keyval";
|
|
4
4
|
const y = {
|
|
5
5
|
encryptedOutputs: [],
|
|
6
6
|
lastOutput: ""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hinkal/common",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"homepage": "hinkal.pro",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hinkal Protocol"
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"circomlibjs": "^0.1.7",
|
|
54
54
|
"dotenv": "^16.4.5",
|
|
55
55
|
"ethers": "5.5.1",
|
|
56
|
+
"idb-keyval": "6.2.1",
|
|
56
57
|
"snarkjs": "0.7.5",
|
|
57
58
|
"libsodium-wrappers": "^0.7.10",
|
|
58
59
|
"ua-parser-js": "^1.0.37",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs");require("../data-structures/crypto-keys/keys.cjs");require("../data-structures/crypto-keys/encryptDecryptUtxo.cjs");const t=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../constants/vite.constants.cjs");require("axios");require("../constants/coingecko.constants.cjs");require("../constants/contracts.constants.cjs");require("../constants/kyc.constants.cjs");require("../constants/axelar.constants.cjs");require("../constants/rewards.constants.cjs");require("../constants/reorg-depths.constants.cjs");const u=require("../crypto/preProcessing.cjs");require("../functions/utils/external-action.utils.cjs");require("../functions/web3/events/getShieldedBalance.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");const r=require("./EthersProviderAdapter.cjs"),q=async i=>{await u.preProcessing();const e=new t.Hinkal;return r.ethersProvierAdapter.initSigner?.(i),await e.initProviderAdapter(void 0,r.ethersProvierAdapter),await e.initUserKeys(),await e.resetMerkle(),e};exports.prepareEthersHinkal=q;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs");require("../data-structures/crypto-keys/keys.cjs");require("../data-structures/crypto-keys/encryptDecryptUtxo.cjs");const t=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../constants/vite.constants.cjs");require("axios");require("../constants/coingecko.constants.cjs");require("../constants/contracts.constants.cjs");require("../constants/kyc.constants.cjs");require("../constants/axelar.constants.cjs");require("../constants/rewards.constants.cjs");require("../constants/reorg-depths.constants.cjs");const u=require("../crypto/preProcessing.cjs");require("../functions/utils/external-action.utils.cjs");require("../functions/web3/events/getShieldedBalance.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");require("idb-keyval");const r=require("./EthersProviderAdapter.cjs"),q=async i=>{await u.preProcessing();const e=new t.Hinkal;return r.ethersProvierAdapter.initSigner?.(i),await e.initProviderAdapter(void 0,r.ethersProvierAdapter),await e.initUserKeys(),await e.resetMerkle(),e};exports.prepareEthersHinkal=q;
|
|
@@ -20,12 +20,13 @@ import { preProcessing as p } from "../crypto/preProcessing.mjs";
|
|
|
20
20
|
import "../functions/utils/external-action.utils.mjs";
|
|
21
21
|
import "../functions/web3/events/getShieldedBalance.mjs";
|
|
22
22
|
import "../data-structures/volatile-helper/VolatileHelper.mjs";
|
|
23
|
+
import "idb-keyval";
|
|
23
24
|
import { ethersProvierAdapter as i } from "./EthersProviderAdapter.mjs";
|
|
24
|
-
const
|
|
25
|
+
const U = async (t) => {
|
|
25
26
|
await p();
|
|
26
27
|
const r = new o();
|
|
27
28
|
return i.initSigner?.(t), await r.initProviderAdapter(void 0, i), await r.initUserKeys(), await r.resetMerkle(), r;
|
|
28
29
|
};
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
U as prepareEthersHinkal
|
|
31
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs");require("../data-structures/crypto-keys/keys.cjs");require("../data-structures/crypto-keys/encryptDecryptUtxo.cjs");const i=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../constants/vite.constants.cjs");require("axios");require("../constants/coingecko.constants.cjs");require("../constants/contracts.constants.cjs");require("../constants/kyc.constants.cjs");require("../constants/axelar.constants.cjs");require("../constants/rewards.constants.cjs");require("../constants/reorg-depths.constants.cjs");const u=require("../crypto/preProcessing.cjs");require("../functions/utils/external-action.utils.cjs");require("../functions/web3/events/getShieldedBalance.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");const a=require("./Wagmiv1ProviderAdapter.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ethers");require("circomlibjs");require("../data-structures/crypto-keys/keys.cjs");require("../data-structures/crypto-keys/encryptDecryptUtxo.cjs");const i=require("../data-structures/Hinkal/Hinkal.cjs");require("../constants/chains.constants.cjs");require("../types/circom-data.types.cjs");require("../types/transactions.types.cjs");require("../types/curve.types.cjs");require("../data-structures/custom-token-registry/CustomTokenRegistry.cjs");require("../constants/vite.constants.cjs");require("axios");require("../constants/coingecko.constants.cjs");require("../constants/contracts.constants.cjs");require("../constants/kyc.constants.cjs");require("../constants/axelar.constants.cjs");require("../constants/rewards.constants.cjs");require("../constants/reorg-depths.constants.cjs");const u=require("../crypto/preProcessing.cjs");require("../functions/utils/external-action.utils.cjs");require("../functions/web3/events/getShieldedBalance.cjs");require("../data-structures/volatile-helper/VolatileHelper.cjs");require("idb-keyval");const a=require("./Wagmiv1ProviderAdapter.cjs"),q=async r=>{await u.preProcessing();const e=new i.Hinkal;return await e.initProviderAdapter(r,a.wagmiv1ProvierAdapter),await e.initUserKeys(),await e.resetMerkle(),e};exports.prepareWagmiv1EthersHinkal=q;
|
|
@@ -20,12 +20,13 @@ import { preProcessing as o } from "../crypto/preProcessing.mjs";
|
|
|
20
20
|
import "../functions/utils/external-action.utils.mjs";
|
|
21
21
|
import "../functions/web3/events/getShieldedBalance.mjs";
|
|
22
22
|
import "../data-structures/volatile-helper/VolatileHelper.mjs";
|
|
23
|
+
import "idb-keyval";
|
|
23
24
|
import { wagmiv1ProvierAdapter as p } from "./Wagmiv1ProviderAdapter.mjs";
|
|
24
|
-
const
|
|
25
|
+
const W = async (i) => {
|
|
25
26
|
await o();
|
|
26
27
|
const r = new t();
|
|
27
28
|
return await r.initProviderAdapter(i, p), await r.initUserKeys(), await r.resetMerkle(), r;
|
|
28
29
|
};
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
W as prepareWagmiv1EthersHinkal
|
|
31
32
|
};
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
const domain = 'https://d13x2m0ev3hbsi.cloudfront.net';
|
|
3
|
+
|
|
4
|
+
// Returns a blob:// URL which points
|
|
5
|
+
// to a javascript file which will call
|
|
6
|
+
// importScripts with the given URL
|
|
7
|
+
async function getWorkerURL(url) {
|
|
8
|
+
const contentRes = await fetch(url);
|
|
9
|
+
const content = await contentRes.text()
|
|
10
|
+
|
|
11
|
+
return URL.createObjectURL(new Blob([content], { type: "application/javascript" }));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
|
+
|
|
16
|
+
const n = async () => ({
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.1.1/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.1.1/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.1.1/' + 'utxoWorkerLauncher.js'),
|
|
20
|
+
});
|
|
21
|
+
exports.getWorkerViteURL = n;
|