@hinkal/common 0.0.99 → 0.0.101

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 CHANGED
@@ -1,51 +1,65 @@
1
1
  # Hinkal SDK
2
2
 
3
- SDK allows to call hinkal functions. You will be able to do arbitrary Smart Contract interactions using SDK.
3
+ Hinkal is a middleware and set of smart contracts on EVM chains that uses ZK-proofs and stealth addresses to enable compliant and private transactions on major dApps. Users can privately store assets and transact on major dApps such as Uniswap, Pendle, Lido, Curve, and others.
4
+
5
+ This SDK allows to do arbitrary Smart Contract interactions privately.
6
+
4
7
  ### Installation
5
8
 
6
9
  Using npm:
10
+
7
11
  ```sh
8
12
  npm install @hinkal/common
9
13
  ```
14
+
10
15
  Or, yarn:
16
+
11
17
  ```sh
12
18
  yarn add @hinkal/common
13
19
  ```
14
- ### Usage
15
20
 
21
+ ### Usage
16
22
 
17
23
  1. Step: import hinkal from @hinkal/common package and initiate a Hinkal instance:
18
- ```sh
19
- import {Hinkal} from '@hinkal/common';
20
24
 
21
- const hinkal = new Hinkal<Connector>();
25
+ ```sh
26
+ import {Hinkal} from '@hinkal/common';
27
+
28
+ const hinkal = new Hinkal<Connector>();
22
29
  ```
23
30
 
24
31
  2. Initiate ProviderAdapter object, where connector should be 'wagmi' Connector instance
25
- ```typescript
26
- const providerAdapter = new ProviderAdapter(connector);
27
- await hinkal.initProviderAdapter(connector, providerAdapter);
32
+
33
+ ```typescript
34
+ const providerAdapter = new ProviderAdapter(connector);
35
+ await hinkal.initProviderAdapter(connector, providerAdapter);
28
36
  ```
29
37
 
30
38
  3. Ask user to generate his shielded address and fetch state from smart contract
31
- ```typescript
32
- await hinkal.initUserKeys();
33
- await hinkal.resetMerkle();
39
+
40
+ ```typescript
41
+ await hinkal.initUserKeys();
42
+ await hinkal.resetMerkle();
34
43
  ```
35
44
 
36
- 4. Once user generated shielded address, shielded balances are available that can be displayed in front-end:
45
+ 4. Once user generated shielded address, shielded balances are available that can be displayed in front-end:
46
+
37
47
  ```typescript
38
- const balances = await hinkal.getBalances();
48
+ const balances = await hinkal.getBalances();
39
49
  ```
40
50
 
41
51
  5. A user can deposit to his shielded account using:
52
+
42
53
  ```typescript
43
54
  hinkal.deposit(erc20addresses:string[],amountChanges:bigint[]);
44
55
  ```
56
+
45
57
  where erc20Addresses is array of token addresses and amountChanges - token amounts for the deposit.
46
58
 
47
59
  6. A user, once his balance is updated, can do any smart contract interaction:
60
+
48
61
  ```typescript
49
62
  hinkal.actionPrivateWallet( erc20Addresses:string[], amountChanges:bigint[], onChainCreation:boolean[], ops:string[]);
50
63
  ```
51
- where onChainCreation indicates amounts of tokens which are uncertain before the transaction is executed onchain. And, ops array is encoded array of user ops.
64
+
65
+ where onChainCreation indicates amounts of tokens which are uncertain before the transaction is executed onchain. And, ops array is encoded array of user ops.
@@ -1,5 +1,5 @@
1
- import { a as Qi } from "./zkProofWorkerLogic-Doz4ARB3.js";
2
- import "./zkProofWorkerLauncher-D86Xs1_B.js";
1
+ import { a as Qi } from "./zkProofWorkerLogic-GDTtbG7h.js";
2
+ import "./zkProofWorkerLauncher-C-lf5pHC.js";
3
3
  const Pi = [0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4];
4
4
  function Xn(c, t) {
5
5
  if (!t || t == 10)
@@ -1,5 +1,5 @@
1
- import { U as l, d as p, a as T, b as f, c as I, e as y, l as h, p as m } from "./zkProofWorkerLogic-Doz4ARB3.js";
2
- import "./zkProofWorkerLauncher-D86Xs1_B.js";
1
+ import { U as l, d as p, a as T, b as f, c as I, e as y, l as h, p as m } from "./zkProofWorkerLogic-GDTtbG7h.js";
2
+ import "./zkProofWorkerLauncher-C-lf5pHC.js";
3
3
  const U = (e) => {
4
4
  const t = p.decode(
5
5
  ["uint256", "address", "tuple(uint256, uint256, uint256, uint256)", "uint256", "uint256"],
@@ -1,5 +1,5 @@
1
- import { W as r } from "./zkProofWorkerLogic-Doz4ARB3.js";
2
- import "./zkProofWorkerLauncher-D86Xs1_B.js";
1
+ import { W as r } from "./zkProofWorkerLogic-GDTtbG7h.js";
2
+ import "./zkProofWorkerLauncher-C-lf5pHC.js";
3
3
  var o = self.location.href, e = "" + new URL("snarkjsWorkerLauncher-fuD5h_j0.js", import.meta.url).href, a = "" + new URL("utxoWorkerLauncher-TRT6Cdzd.js", import.meta.url).href;
4
4
  const n = {
5
5
  [r.ZKProof]: o,
@@ -1190,7 +1190,7 @@ const et = () => {
1190
1190
  };
1191
1191
  globalThis.process = tt;
1192
1192
  globalThis.Buffer = xr.Buffer;
1193
- const nt = import("./zkProofWorkerLogic-Doz4ARB3.js").then(function(f) {
1193
+ const nt = import("./zkProofWorkerLogic-GDTtbG7h.js").then(function(f) {
1194
1194
  return f.z;
1195
1195
  });
1196
1196
  addEventListener("message", async (f) => {