@corpus-core/colibri-stateless 0.2.0 → 0.2.1

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
@@ -28,7 +28,7 @@ import Colibri from "@corpus-core/colibri-stateless";
28
28
  async function main() {
29
29
 
30
30
  // Initialize the client with the default configuration and RPCs
31
- const client = new Colibri();
31
+ const client = new Colibri({proofer:['https://mainnet.colibri-proof.tech']});
32
32
 
33
33
  // Use Colibri client as the EIP-1193 provider for ethers (v6)
34
34
  const provider = new BrowserProvider(client);
@@ -48,7 +48,7 @@ import Colibri from "@corpus-core/colibri-stateless";
48
48
  async function main() {
49
49
 
50
50
  // Initialize the client with the default configuration and RPCs
51
- const client = new Colibri();
51
+ const client = new Colibri({proofer:['https://mainnet.colibri-proof.tech']});
52
52
 
53
53
  // Use Colibri client as the EIP-1193 provider for ethers (v6)
54
54
  const provider = new ethers.providers.Web3Provider(client);
@@ -70,7 +70,7 @@ import Colibri from "@corpus-core/colibri-stateless";
70
70
  async function main() {
71
71
 
72
72
  // Initialize the client with the default configuration and RPCs
73
- const client = new Colibri();
73
+ const client = new Colibri({proofer:['https://mainnet.colibri-proof.tech']});
74
74
 
75
75
  // Use Colibri client as the EIP-1193 provider for web3.js
76
76
  const web3 = new Web3(client);
@@ -93,7 +93,7 @@ import Colibri from "@corpus-core/colibri-stateless";
93
93
  async function main() {
94
94
 
95
95
  // Initialize the Colibri client
96
- const colibriClient = new Colibri();
96
+ const colibriClient = new Colibri({proofer:['https://mainnet.colibri-proof.tech']});
97
97
 
98
98
  // Create a viem Public Client using Colibri as a custom EIP-1193 transport
99
99
  const viemClient = createPublicClient({
@@ -207,27 +207,52 @@ The constructor of the colibri client accepts a configuration-object, which may
207
207
 
208
208
  ## Building
209
209
 
210
- In order to build the Javascript bindings from source, you need to have [emscripten installed](https://emscripten.org/docs/getting_started/downloads.html).
210
+ In order to build the Javascript bindings from source, you need to have [emscripten installed](https://emscripten.org/docs/getting_started/downloads.html) and the `EMSDK` environment variable pointing to its installation directory.
211
211
 
212
212
  *The Colibri JS-Binding has been tested with Version 4.0.3. Using latest or other versions may result in unexpected issues. For example Version 4.0.7 is not working. So make sure you select the right version when installing!*
213
213
 
214
- ```sh
215
- git clone https://github.com/corpus-core/colibri-stateless.git && cd colibri-stateless
216
- mkdir build && cd build
217
- emcmake cmake -DWASM=true -DCURL=false ..
218
- make -j
219
- ```
220
-
221
- Of course, building your own version allows you to use any of the [cmake flags options](../building/cmake-colibri-lib.md). So you can choose which chains or which Proofs schouls be supported allowing a very small wasm build.
214
+ **Recommended Method: Using CMake Presets**
222
215
 
223
- like
224
- ```sh
225
- emcmake cmake -DWASM=true -DCURL=false -DETH_ACCOUNT=1 -DETH_CALL=0 -DETH_LOGS=0 -DETH_BLOCK=0 -DETH_TX=0 -DETH_RECEIPT=0 -DETH_UTIL=0 ..
226
- ```
216
+ This project includes a `CMakePresets.json` file for easier configuration.
227
217
 
228
- this would turn off all code which is not needed dramticly decreasing the size, if all you want to do is verify accountProofs (like eth_getBalance).
218
+ 1. **Set Environment Variable:** Ensure the `EMSDK` environment variable points to your Emscripten SDK directory.
219
+ ```sh
220
+ export EMSDK=/path/to/your/emsdk
221
+ ```
222
+ 2. **Configure using Preset:** Use the `wasm` preset.
223
+ * **In VS Code/Cursor:** Select the `[wasm]` configure preset via the status bar or command palette (`CMake: Select Configure Preset`).
224
+ * **On the Command Line:**
225
+ ```sh
226
+ # Configure (from the project root)
227
+ cmake --preset wasm -S .
228
+ # The binary directory (e.g., build/wasm) is defined in the preset
229
+ ```
230
+ 3. **Build:**
231
+ * **In VS Code/Cursor:** Use the build button or the command palette (`CMake: Build`). Make sure the `[wasm]` build preset is selected.
232
+ * **On the Command Line:**
233
+ ```sh
234
+ # Build (using the build directory from the preset)
235
+ cmake --build build/wasm -j
236
+ ```
237
+
238
+ This preset automatically sets `-DWASM=true`, `-DCURL=false`, and the correct toolchain file based on your `EMSDK` variable. You can create custom presets in `CMakeUserPresets.json` if you need different CMake flags (e.g., `-DETH_ACCOUNT=1`).
239
+
240
+ **Alternative Method: Manual `emcmake`**
241
+
242
+ If you prefer not to use presets or your environment doesn't support them well:
243
+
244
+ 1. **Set Environment Variable:** Ensure `EMSDK` is set and the Emscripten environment is active (e.g., via `source ./emsdk_env.sh`).
245
+ 2. **Configure and Build:**
246
+ ```sh
247
+ git clone https://github.com/corpus-core/colibri-stateless.git && cd colibri-stateless
248
+ mkdir build/wasm-manual && cd build/wasm-manual # Use a dedicated build dir
249
+ # Ensure EMSDK is set correctly before running emcmake
250
+ emcmake cmake -DWASM=true -DCURL=false <other_flags> ../..
251
+ make -j
252
+ ```
253
+ Replace `<other_flags>` with any additional CMake options you need (like `-DETH_ACCOUNT=1`).
229
254
 
230
- After calling `make`, The js-module will be in the `build/emscripten` folder.
255
+ After a successful build (using either method), the JS/WASM module will be in the configured build directory's `emscripten` subfolder (e.g., `build/wasm/emscripten`).
231
256
 
232
257
 
233
258
  ## Concept