Web3JS, Ethers and other third-party libraries
Here you can find examples of how to use utilities for well-known libraries provided by Swisstronik
For Swisstronik, in order to execute transactions and call functions you have to use encryption to communicate with the blockchain node. That means regular Ethereum libraries may not function correctly, and require additional modification. Thankfully, Swisstronik team has prepared several options to facilitate blockchain interaction.
Ethers.js
With Ethers.js, we've created a fork of the most popular Ethers.js v5.7.2 (source code is here - https://github.com/SigmaGmbH/ethers.js)
You can check out example usage code here: https://github.com/SigmaGmbH/swisstronik-ethersjs-example-usage In order to use your code with Swisstronik, just replace
to
Now, sendTransaction, estimateGas, call
will be encrypted / decrypted as needed automatically.
Web3.js Plugin
With web3.js you can use a plugin, located here: https://github.com/SigmaGmbH/web3-plugin-swisstronik
Installation
Note: Please make sure to use web3
version 4.0.3 or higher.
Example usage is pretty straightforward:
Last updated