Skip to content

Commit

Permalink
Merge pull request #90 from gnosis/development
Browse files Browse the repository at this point in the history
Dev to master
  • Loading branch information
mmv08 authored Feb 5, 2021
2 parents 89d8a61 + 50fbcc5 commit 5312b1f
Show file tree
Hide file tree
Showing 18 changed files with 735 additions and 208 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
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
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,22 @@ You can find more resources on Safe Apps in the [Gnosis Safe Developer Portal](h

## Packages

| Package | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------- |
| [cra-template-safe-app](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/cra-template-safe-app) | CRA template to quickly bootstrap a Safe app |
| [safe-apps-react-sdk](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/safe-apps-react-sdk) | A wrapper of safe-apps-sdk with helpful hooks |
| [safe-apps-sdk](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/safe-apps-sdk) [![npm version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-apps-sdk.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-apps-sdk) | JavaScript SDK |
| Package | Description |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----------------------------------------------------------------- |
| [cra-template-safe-app](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/cra-template-safe-app) | CRA template to quickly bootstrap a Safe app |
| [safe-apps-react-sdk](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/safe-apps-react-sdk) | A wrapper of safe-apps-sdk with helpful hooks |
| [safe-apps-sdk](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/safe-apps-sdk) [![npm version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-apps-sdk.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-apps-sdk) | JavaScript SDK |
| [safe-apps-ethers-provider](https://github.com/gnosis/safe-apps-sdk/tree/master/packages/safe-apps-ethers-provider) | An ethers.js provider to be used with ethers.js contract instances |

## Setting up development environment

### Installing dependencies

```
npm i -g lerna
yarn global add lerna
lerna bootstrap
```

### Running commands
Expand All @@ -35,17 +34,13 @@ We will use `build` command as an example. Same applies to other commands.
For all packages:

```
lerna run build
```

For a specific package:

```
lerna run --scope @gnosis.pm/safe-apps-sdk build --stream
```

`--stream` options enables command output. By default, lerna displays it only in case of an error.
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
"devDependencies": {
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^4.10.0",
"@typescript-eslint/parser": "^4.10.0",
"eslint": "7.15.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^3.2.0",
"eslint-plugin-react": "^7.21.5",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"eslint": "7.18.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.3",
"ts-jest": "^26.4.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/cra-template-safe-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/cra-template-safe-app",
"version": "2.0.0",
"version": "2.1.0",
"description": "Gnosis Safe App Starter",
"author": "Gnosis (https://gnosis.pm)",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/cra-template-safe-app/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"package": {
"homepage": "./",
"dependencies": {
"@gnosis.pm/safe-apps-react-sdk": "1.0.0-beta.1",
"@gnosis.pm/safe-apps-react-sdk": "1.1.0",
"@gnosis.pm/safe-react-components": "^0.3.0",
"@material-ui/core": "^4.11.0",
"@testing-library/jest-dom": "^5.11.4",
Expand Down
54 changes: 54 additions & 0 deletions packages/safe-apps-ethers-provider/README.md
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
29 changes: 29 additions & 0 deletions packages/safe-apps-ethers-provider/package.json
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"
}
}
1 change: 1 addition & 0 deletions packages/safe-apps-ethers-provider/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SafeAppsSdkProvider } from './provider';
Loading

0 comments on commit 5312b1f

Please sign in to comment.