@hinkal/common 0.0.100 → 0.0.102

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,8 +1,8 @@
1
1
  # Hinkal SDK
2
2
 
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.
3
+ Hinkal is a middleware and a set of smart contracts on EVM chains that use 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
4
 
5
- This SDK allows to do arbitrary Smart Contract interactions privately.
5
+ This SDK allows users to perform arbitrary smart contract interactions privately.
6
6
 
7
7
  ### Installation
8
8
 
@@ -20,7 +20,7 @@ yarn add @hinkal/common
20
20
 
21
21
  ### Usage
22
22
 
23
- 1. Step: import hinkal from @hinkal/common package and initiate a Hinkal instance:
23
+ 1. Import hinkal from @hinkal/common package and initiate a Hinkal instance:
24
24
 
25
25
  ```sh
26
26
  import {Hinkal} from '@hinkal/common';
@@ -28,38 +28,59 @@ yarn add @hinkal/common
28
28
  const hinkal = new Hinkal<Connector>();
29
29
  ```
30
30
 
31
- 2. Initiate ProviderAdapter object, where connector should be 'wagmi' Connector instance
31
+ 2. Initialize a ProviderAdapter object, where the connector should be an instance of the wagmi Connector.
32
32
 
33
33
  ```typescript
34
34
  const providerAdapter = new ProviderAdapter(connector);
35
35
  await hinkal.initProviderAdapter(connector, providerAdapter);
36
36
  ```
37
37
 
38
- 3. Ask user to generate his shielded address and fetch state from smart contract
38
+ 3. Prompt a user to generate their shielded address and fetch the state from the smart contract.
39
39
 
40
40
  ```typescript
41
41
  await hinkal.initUserKeys();
42
42
  await hinkal.resetMerkle();
43
43
  ```
44
44
 
45
- 4. Once user generated shielded address, shielded balances are available that can be displayed in front-end:
45
+ 4. Once a user has generated a shielded address, the shielded balances become available and can be displayed on the front end:
46
46
 
47
47
  ```typescript
48
48
  const balances = await hinkal.getBalances();
49
49
  ```
50
50
 
51
- 5. A user can deposit to his shielded account using:
51
+ 5. A user can deposit to their shielded account using:
52
52
 
53
53
  ```typescript
54
- hinkal.deposit(erc20addresses:string[],amountChanges:bigint[]);
54
+ hinkal.deposit(erc20addresses:string[],amountChanges:bigint[]): Promise<TransactionObject>;
55
55
  ```
56
56
 
57
- where erc20Addresses is array of token addresses and amountChanges - token amounts for the deposit.
57
+ where erc20Addresses is an array of token addresses, and amountChanges represents the token amounts for the deposit.
58
+
59
+ 6. Once a user’s balance is updated, they can perform any smart contract interaction:
58
60
 
59
- 6. A user, once his balance is updated, can do any smart contract interaction:
60
61
 
61
62
  ```typescript
62
- hinkal.actionPrivateWallet( erc20Addresses:string[], amountChanges:bigint[], onChainCreation:boolean[], ops:string[]);
63
+ hinkal.actionPrivateWallet( erc20Addresses:string[], amountChanges:bigint[], onChainCreation:boolean[], ops:string[]): Promise<TransactionObject>;
63
64
  ```
64
65
 
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.
66
+ where onChainCreation indicates the amounts of tokens that are uncertain before the transaction is executed on-chain. The ops array is an encoded array of user operations.
67
+
68
+ ### Access Tokens
69
+
70
+ Before interacting with Hinkal smart contracts, a user needs to mint an access token after passing compliance checks.
71
+
72
+ To check whether the user already has an access token, one can use the checkAccessToken function:
73
+
74
+ ```typescript
75
+ function checkAccessToken(): Promise<boolean>;
76
+ ```
77
+ If the user does not have an access token, one of the compliance providers should be used to pass the check. To view the available providers:
78
+ ```typescript
79
+ function getSupportedPassportLinks(): string[];
80
+ ```
81
+
82
+ Once the user has passed the check, they can mint an access token using:
83
+ ```typescript
84
+ const { signatureData } = await hinkal.getAPI().getAccessTokenSignature(chainId, ethereumAddress, accessKey);
85
+ await mintAccessToken(this, signatureData);
86
+ ```
@@ -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-CLpRqNRx.js";
2
+ import "./zkProofWorkerLauncher-C-pvCm0b.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-CLpRqNRx.js";
2
+ import "./zkProofWorkerLauncher-C-pvCm0b.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-CLpRqNRx.js";
2
+ import "./zkProofWorkerLauncher-C-pvCm0b.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-CLpRqNRx.js").then(function(f) {
1194
1194
  return f.z;
1195
1195
  });
1196
1196
  addEventListener("message", async (f) => {