diff --git a/README.md b/README.md index 103661b53bba8e050139a52102c7c90cb62e957e..8276d93256a24c4dcd5f8c4e981de99f0482bc92 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,50 @@ Examples for how to use this package can be found at: https://git.xx.network/xx_network/xxdk-examples +## How to use xxDK in your Web Application + +To install with npm, run the following: + +``` +npm i --save xxdk-wasm +``` + +By default, xxdk uses a CDN hosted by the [xx +foundation](http://xxfoundation.org). If you would like to self-host +the wasm binaries, you can include the following postinstall script in +your package.json file: + +``` +{ + ... + "scripts": { + ... + "postinstall": "mkdir -p public && cp -r node_modules/xxdk-wasm public/xxdk-wasm" + }, + ... +} +``` + +You may also run this command manually after installation to +accomplish the same result. + +Then you will need to override the base path with `setXXDKBasePath` +inside your useEffect statement to load the wasm file from your local +public assets: + +``` + xxdk.setXXDKBasePath(window!.location.href + "xxdk-wasm"); +``` + +See the +[xxdk-examples](https://git.xx.network/xx_network/xxdk-examples) repository for +examples in react and plain html/javascript. + +For support, please reach out on [Discord](https://disxord.xx.network) or +[Telegram](https://t.me/xxnetwork). We also monitor +[xx general chat](http://alpha.speakeasy.tech/join?0Name=xxGeneralChat&1Description=Talking+about+the+xx+network&2Level=Public&3Created=1674152234202224215&e=%2FqE8BEgQQkXC6n0yxeXGQjvyklaRH6Z%2BWu8qvbFxiuw%3D&k=RMfN%2B9pD%2FJCzPTIzPk%2Bpf0ThKPvI425hye4JqUxi3iA%3D&l=368&m=0&p=1&s=rb%2BrK0HsOYcPpTF6KkpuDWxh7scZbj74kVMHuwhgUR0%3D&v=1) +on xx network. + ## Updates The current semantic version of this repository is stored in `SEMVER` in