Skip to content

Commit

Permalink
Add installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
kanewallmann committed Oct 10, 2023
1 parent dfa80f9 commit 56d8c02
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,53 @@ This is a list of what has been implemented and what is planned.

MIT - Copyright (c) 2023, Kane Wallmann

## Installation

This library exports a module that can be included in your project via Zig's package manager.

Add it as a dependency to your `build.zig.zon` like so:

```
...
.dependencies = .{
.web3 = .{
.url = "https://github.com/kanewallmann/web3.zig/archive/refs/heads/master.tar.gz",
},
},
...
```

In your `build.zig` file add the module to your build by adding the lines:

```c
const web3 = b.dependency("web3", .{ .target = target, .optimize = optimize });
exe.addModule("web3", web3.module("web3"));
```
Then run `zig build`.
Zig will complain about the hash being incorrect:
```
note: expected .hash = "12201309cabc8d4c7d5482c7f19754f1f7f779e3cae525a4e6c9ea0e0a824a0bfe69",
```
Copy that into your `build.zig.zon` file like so:
```
...
.dependencies = .{
.web3 = .{
.url = "https://github.com/kanewallmann/web3.zig/archive/refs/heads/master.tar.gz",
.hash = "12201309cabc8d4c7d5482c7f19754f1f7f779e3cae525a4e6c9ea0e0a824a0bfe69",
},
},
...
```
And then you are ready to `@import("web3")` in your project.
## Examples
There are a few examples under `src/examples`. They can be run with `zig build example_{example_name} -- {rpc_endpoint}` where
Expand Down

0 comments on commit 56d8c02

Please sign in to comment.