1.7.1 • Published 3 years ago
@gnosis.pm/safe-web3-lib v1.7.1
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 installBuild
Build the package with yarn or npm:
yarn build
npm buildInitialization
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 '@gnosis.pm/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)