@lightprotocol/stateless.js 0.1.0-alpha.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.
Files changed (44) hide show
  1. package/README.md +58 -0
  2. package/dist/cjs/index.cjs +4031 -0
  3. package/dist/es/index.js +3988 -0
  4. package/dist/types/actions/common.d.ts +3 -0
  5. package/dist/types/actions/compress-lamports.d.ts +16 -0
  6. package/dist/types/actions/decompress-lamports.d.ts +16 -0
  7. package/dist/types/actions/index.d.ts +4 -0
  8. package/dist/types/actions/init-sol-omnibus-account.d.ts +13 -0
  9. package/dist/types/constants.d.ts +34 -0
  10. package/dist/types/errors.d.ts +74 -0
  11. package/dist/types/idls/account_compression.d.ts +932 -0
  12. package/dist/types/idls/index.d.ts +5 -0
  13. package/dist/types/idls/light.d.ts +192 -0
  14. package/dist/types/idls/psp_compressed_pda.d.ts +607 -0
  15. package/dist/types/idls/user_registry.d.ts +69 -0
  16. package/dist/types/index.d.ts +12 -0
  17. package/dist/types/instruction/index.d.ts +1 -0
  18. package/dist/types/instruction/pack-compressed-accounts.d.ts +30 -0
  19. package/dist/types/programs/compressed-pda.d.ts +148 -0
  20. package/dist/types/programs/index.d.ts +1 -0
  21. package/dist/types/rpc-interface.d.ts +430 -0
  22. package/dist/types/rpc.d.ts +26 -0
  23. package/dist/types/state/BN254.d.ts +20 -0
  24. package/dist/types/state/compressed-account.d.ts +35 -0
  25. package/dist/types/state/index.d.ts +3 -0
  26. package/dist/types/state/types.d.ts +108 -0
  27. package/dist/types/test-utils/common.d.ts +32 -0
  28. package/dist/types/test-utils/index.d.ts +5 -0
  29. package/dist/types/test-utils/merkle-tree.d.ts +92 -0
  30. package/dist/types/test-utils/parse-event.d.ts +7 -0
  31. package/dist/types/test-utils/parse-validity-proof.d.ts +20 -0
  32. package/dist/types/test-utils/test-rpc.d.ts +51 -0
  33. package/dist/types/utils/airdrop.d.ts +7 -0
  34. package/dist/types/utils/conversion.d.ts +10 -0
  35. package/dist/types/utils/index.d.ts +6 -0
  36. package/dist/types/utils/pipe.d.ts +2 -0
  37. package/dist/types/utils/send-and-confirm.d.ts +18 -0
  38. package/dist/types/utils/sleep.d.ts +1 -0
  39. package/dist/types/utils/validation.d.ts +4 -0
  40. package/dist/types/wallet/index.d.ts +1 -0
  41. package/dist/types/wallet/interface.d.ts +25 -0
  42. package/dist/types/wallet/use-wallet.d.ts +9 -0
  43. package/dist/umd/index.js +4027 -0
  44. package/package.json +81 -0
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ js clients for the light protocol system programs
2
+
3
+ ### Requirements
4
+
5
+ reproduced on mac m2:
6
+
7
+ - node: v20.9.0
8
+ - rustup 1.26.0, rustc 1.73.0, cargo 1.73.0
9
+ - solana-cli 1.17.5
10
+
11
+ ## Producing events for indexing
12
+
13
+ First, activate the devenv
14
+
15
+ `. ./scripts/devenv.sh`
16
+
17
+ If you're new, run
18
+
19
+ `./scripts/install.sh`
20
+
21
+ Run the monorepo build script
22
+ `./scripts/build.sh`
23
+
24
+ Go to stateless.js
25
+ `cd js/stateless.js`
26
+
27
+ and run
28
+ `pnpm run test-validator`
29
+
30
+ this starts a solana-test-validator + auto-initialized the env, programs, and accounts Light needs. Keep the validator running.
31
+
32
+ now open another terminal, enter the devenv + stateless.js again,
33
+
34
+ `cd js/stateless.js`
35
+
36
+ now run:
37
+
38
+ `pnpm emit-event:transfer`
39
+
40
+ This runs ./tests/e2e/transfer-emit-events.test.ts which executes a simple compressed sol transfer against the test-validator. You'll be able to index the emitted events (output utxos) according to the event rust structs.
41
+
42
+ ### Troubleshooting
43
+
44
+ If you're having trouble building the project or cli,
45
+
46
+ - Nuke git clean -xfd (careful)
47
+
48
+ - re-run install.sh etc
49
+
50
+ - you may want to manually build the programs (anchor build)
51
+ or manually build the cli (`pnpm run build` in ./cli) before running
52
+ `./cli/test_bin/run test-validator`
53
+
54
+ ### Other side notes
55
+
56
+ 1. This is unsafe. We don't verify ZKPs yet, nor do we validate tree roots.
57
+ 2. this is also what allows us to make up input-utxos for emit-event:transfer
58
+ 3. on-chain runs a sumcheck on the state transition (outputs, inputs).