-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from gnosis/development
Dev to master
- Loading branch information
Showing
18 changed files
with
735 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Test | ||
on: [push, pull_request] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [12.x] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: | | ||
yarn global add lerna | ||
# approach taken from https://github.com/actions/setup-node/issues/85 | ||
echo "$(yarn global bin)" >> $GITHUB_PATH | ||
- run: lerna bootstrap | ||
- run: lerna run test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Safe Apps Ethers Provider | ||
|
||
[![npm](https://img.shields.io/npm/v/@gnosis.pm/safe-apps-ethers-provider)](https://www.npmjs.com/package/@gnosis.pm/safe-apps-ethers-provider) | ||
|
||
This is an `ethers.js` provider to use with `ethers.js` contract instances. | ||
|
||
### How to use | ||
|
||
- Add npm package | ||
|
||
```bash | ||
yarn add @gnosis.pm/safe-apps-ethers-provider | ||
|
||
npm i @gnosis.pm/safe-apps-ethers-provider | ||
``` | ||
|
||
- Usage example with [safe-apps-react-sdk](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/safe-apps-react-sdk) | ||
|
||
```js | ||
import React, { useMemo, useState } from 'react'; | ||
import { useSafeAppsSDK } from '@gnosis.pm/safe-apps-react-sdk'; | ||
import { ethers } from 'ethers'; | ||
import { SafeAppsSdkProvider } from '@gnosis.pm/safe-apps-ethers-provider'; | ||
import Contract from './contracts/DelayedTxModule.json'; | ||
|
||
const App = () => { | ||
const { sdk, safe } = useSafeAppsSDK(); | ||
const contract = useMemo(() => ethers.Contract(Contract.address, Contract.abi, new SafeAppsSdkProvider(safe, sdk)), [ | ||
sdk, | ||
safe, | ||
]); | ||
|
||
// calling write methods | ||
const doSomething = async () => { | ||
const { safeTxHash } = await sdk.txs.send({ | ||
txs: [ | ||
{ | ||
to: safe.safeAddress, | ||
value: '0', | ||
data: contract.interface.encodeFunctionData('someFunc', ['someArg']), | ||
}, | ||
], | ||
}); | ||
}; | ||
|
||
return; | ||
}; | ||
|
||
export default App; | ||
``` | ||
|
||
#### More scenarios | ||
|
||
For the SDK overview documentation, please refer to the [safe-apps-sdk](https://github.com/gnosis/safe-apps-sdk/) documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@gnosis.pm/safe-apps-ethers-provider", | ||
"version": "0.0.1", | ||
"description": "An ethers.js provider wrapper of Safe Apps SDK", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "yarn rimraf dist && tsc", | ||
"prepublishOnly": "yarn build", | ||
"test": "echo No tests specified" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/gnosis/safe-apps-sdk.git" | ||
}, | ||
"author": "Gnosis (https://gnosis.io)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/gnosis/safe-apps-sdk/issues" | ||
}, | ||
"homepage": "https://github.com/gnosis/safe-apps-sdk#readme", | ||
"dependencies": { | ||
"@ethersproject/bytes": "^5.0.9", | ||
"@ethersproject/logger": "^5.0.8", | ||
"@ethersproject/properties": "^5.0.7", | ||
"@ethersproject/providers": "^5.0.19", | ||
"@gnosis.pm/safe-apps-sdk": "^1.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { SafeAppsSdkProvider } from './provider'; |
Oops, something went wrong.