@lightprotocol/compressed-token 0.1.0
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/LICENSE +674 -0
- package/README.md +63 -0
- package/dist/cjs/browser/index.cjs +14786 -0
- package/dist/cjs/browser/index.cjs.map +1 -0
- package/dist/cjs/node/index.cjs +10107 -0
- package/dist/cjs/node/index.cjs.map +1 -0
- package/dist/es/browser/index.js +14765 -0
- package/dist/es/browser/index.js.map +1 -0
- package/dist/es/node/index.js +10086 -0
- package/dist/es/node/index.js.map +1 -0
- package/dist/types/index.d.ts +1270 -0
- package/package.json +94 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
js client to interact with the compressed-token program
|
|
2
|
+
|
|
3
|
+
WIP.
|
|
4
|
+
|
|
5
|
+
### Requirements
|
|
6
|
+
|
|
7
|
+
reproduced on mac m2:
|
|
8
|
+
|
|
9
|
+
- node: v20.9.0
|
|
10
|
+
- rustup 1.26.0, rustc 1.73.0, cargo 1.73.0
|
|
11
|
+
- solana-cli 1.17.5
|
|
12
|
+
|
|
13
|
+
## Producing events for indexing
|
|
14
|
+
|
|
15
|
+
First, activate the devenv
|
|
16
|
+
|
|
17
|
+
`. ./scripts/devenv.sh`
|
|
18
|
+
|
|
19
|
+
If you're new, run
|
|
20
|
+
|
|
21
|
+
`./scripts/install.sh`
|
|
22
|
+
|
|
23
|
+
Run the monorepo build script
|
|
24
|
+
`./scripts/build.sh`
|
|
25
|
+
|
|
26
|
+
Go to stateless.js
|
|
27
|
+
`cd js/stateless.js`
|
|
28
|
+
|
|
29
|
+
and run
|
|
30
|
+
`pnpm run test-validator`
|
|
31
|
+
|
|
32
|
+
this starts a solana-test-validator + auto-initialized the env, programs, and accounts Light needs.
|
|
33
|
+
It should print: "Executing command solana-test-validator...
|
|
34
|
+
Waiting for fees to stabilize 1..."
|
|
35
|
+
Keep the validator running.
|
|
36
|
+
|
|
37
|
+
Now open another terminal, activate the devenv again + move to js/compressed-token.
|
|
38
|
+
|
|
39
|
+
now run:
|
|
40
|
+
|
|
41
|
+
`pnpm emit-event:create_mint`
|
|
42
|
+
`pnpm emit-event:mint_to`
|
|
43
|
+
`pnpm emit-event:transfer`
|
|
44
|
+
|
|
45
|
+
You'll be able to index the emitted events (output utxos) according to the event rust struct on localnet. Create mint doesn't create an output utxo, mint_to doesn't use input_utxos. also note that currently we're creating mock inputs for the transfer, meaning you don't need to run mint_to before transfer.
|
|
46
|
+
|
|
47
|
+
### Troubleshooting
|
|
48
|
+
|
|
49
|
+
If you're having trouble building the project or cli,
|
|
50
|
+
|
|
51
|
+
- Nuke git clean -xfd (careful)
|
|
52
|
+
|
|
53
|
+
- re-run install.sh etc
|
|
54
|
+
|
|
55
|
+
- you may want to manually build the programs (anchor build)
|
|
56
|
+
or manually build the cli (`pnpm run build` in ./cli) before running
|
|
57
|
+
`./cli/test_bin/run test-validator`
|
|
58
|
+
|
|
59
|
+
### Other side notes
|
|
60
|
+
|
|
61
|
+
1. This is unsafe. We don't verify ZKPs yet, nor do we validate tree roots.
|
|
62
|
+
2. this is also what allows us to make up input-utxos for emit-event:transfer
|
|
63
|
+
3. on-chain runs a sumcheck on the state transition (outputs, inputs).
|