@hinkal/common 0.0.97 → 0.0.99

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,6 +1,8 @@
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
4
  ### Installation
5
+
4
6
  Using npm:
5
7
  ```sh
6
8
  npm install @hinkal/common
@@ -11,35 +13,39 @@ yarn add @hinkal/common
11
13
  ```
12
14
  ### Usage
13
15
 
16
+
14
17
  1. Step: import hinkal from @hinkal/common package and initiate a Hinkal instance:
15
18
  ```sh
16
- import {Hinkal} from '@hinkal/common';
19
+ import {Hinkal} from '@hinkal/common';
17
20
 
18
- const hinkal = new Hinkal<Connector>();
21
+ const hinkal = new Hinkal<Connector>();
19
22
  ```
20
23
 
21
24
  2. Initiate ProviderAdapter object, where connector should be 'wagmi' Connector instance
22
- ```sh
23
- const providerAdapter = new ProviderAdapter(connector);
24
- await hinkal.initProviderAdapter(connector, providerAdapter);
25
+ ```typescript
26
+ const providerAdapter = new ProviderAdapter(connector);
27
+ await hinkal.initProviderAdapter(connector, providerAdapter);
25
28
  ```
29
+
26
30
  3. Ask user to generate his shielded address and fetch state from smart contract
27
- ```sh
28
- await hinkal.initUserKeys();
29
- await hinkal.resetMerkle();
31
+ ```typescript
32
+ await hinkal.initUserKeys();
33
+ await hinkal.resetMerkle();
30
34
  ```
35
+
31
36
  4. Once user generated shielded address, shielded balances are available that can be displayed in front-end:
32
- ```sh
33
- const balances = await hinkal.getBalances();
37
+ ```typescript
38
+ const balances = await hinkal.getBalances();
34
39
  ```
40
+
35
41
  5. A user can deposit to his shielded account using:
36
- ```sh
37
- hinkal.deposit(erc20addresses:string[], amountChanges:bigint[]);
42
+ ```typescript
43
+ hinkal.deposit(erc20addresses:string[],amountChanges:bigint[]);
38
44
  ```
39
45
  where erc20Addresses is array of token addresses and amountChanges - token amounts for the deposit.
46
+
40
47
  6. A user, once his balance is updated, can do any smart contract interaction:
41
- ```sh
42
- hinkal.actionPrivateWallet(erc20Addresses:string[], amountChanges:bigint[],
43
- onChainCreation:boolean[], ops:string[]);
48
+ ```typescript
49
+ hinkal.actionPrivateWallet( erc20Addresses:string[], amountChanges:bigint[], onChainCreation:boolean[], ops:string[]);
44
50
  ```
45
- Where onChainCreation indicates amounts of tokens which are uncertain before the transaction is executed onchain. And, ops array is encoded array of user ops.
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.