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