@crossbell-box/safe-web3-lib
v1.9.3
Published
Web3 library adapter to be used by Safe Core SDK
Downloads
2
Readme
Safe Web3 Lib
Web3.js wrapper that contains some utilities and the Safe contracts types (generated with typechain web3-v1). It is used to initialize the Safe Core SDK.
Table of contents
Installation
Install the package with yarn or npm:
yarn install
npm install
Build
Build the package with yarn or npm:
yarn build
npm build
Initialization
If the app integrating the SDK is using Web3
, create an instance of the Web3Adapter
, where signerAddress
is the Ethereum account we are connecting and the one who will sign the transactions.
import Web3 from 'web3'
import Web3Adapter from '@safe-global/safe-web3-lib'
const provider = new Web3.providers.HttpProvider('http://localhost:8545')
const web3 = new Web3(provider)
const safeOwner = '0x<address>'
const ethAdapter = new Web3Adapter({
web3,
signerAddress: safeOwner
})
In case the ethAdapter
instance is only used to execute read-only methods the signerAddress
property can be omitted.
const readOnlyEthAdapter = new Web3Adapter({ web3 })
License
This library is released under MIT.
Contributors
- Germán Martínez (germartinez)