Skip to content

Commit

Permalink
Merge pull request #266 from safe-global/development
Browse files Browse the repository at this point in the history
v3.1.0
  • Loading branch information
germartinez authored Sep 21, 2022
2 parents a0fefbf + 85289e9 commit b0a6c4b
Show file tree
Hide file tree
Showing 37 changed files with 572 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ about: Bug report about the Safe Core SDK
## Prerequisites

- First, many thanks for taking part in the community and helping us improve. We appreciate that a lot.
- Support questions are better asked in our Discord chat: https://discord.com/channels/477106835862716416/477391201708802058
- Support questions are better asked in our Discord chat: https://chat.gnosis-safe.io/
- Please ensure the issue isn't already reported.

*Please delete the above section and the instructions in the sections below before submitting*
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ about: Suggest an idea or feature request for the Safe Core SDK
## Prerequisites

- First, many thanks for taking part in the community and helping us improve. We appreciate that a lot.
- Support questions are better asked in our Discord chat: https://discord.com/channels/477106835862716416/477391201708802058
- Support questions are better asked in our Discord chat: https://chat.gnosis-safe.io/
- Please ensure the issue isn't already reported.

*Please delete the above section and the instructions in the sections below before submitting*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
path-to-signatures: 'signatures/version1/cla.json'
path-to-cla-document: 'https://gnosis-safe.io/cla/'
branch: 'cla-signatures'
allowlist: germartinez,mikheevm,rmeissner,Uxio0,dasanra,davidalbela,luarx,giacomolicari,lukasschor,tschubotz,gnosis-info,bot*,katspaugh
allowlist: germartinez,mikheevm,rmeissner,Uxio0,dasanra,luarx,lukasschor,tschubotz,bot*,katspaugh
empty-commit-flag: false
blockchain-storage-flag: false
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Safe Core SDK Monorepo

Software developer tools that facilitate the interaction with the Gnosis Safe [contracts](https://github.com/safe-global/safe-contracts) and [services](https://github.com/safe-global/safe-transaction-service).
Software developer tools that facilitate the interaction with the Safe [contracts](https://github.com/safe-global/safe-contracts) and [services](https://github.com/safe-global/safe-transaction-service).

## Guides

Expand All @@ -12,13 +12,13 @@ Software developer tools that facilitate the interaction with the Gnosis Safe [c

| Package | Release | Description |
| ------- | :-----: | ----------- |
| [safe-core-sdk](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-core-sdk) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk) | TypeScript library that facilitates the interaction with the [Gnosis Safe contracts](https://github.com/safe-global/safe-contracts) |
| [safe-core-sdk](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-core-sdk) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk) | TypeScript library that facilitates the interaction with the [Safe contracts](https://github.com/safe-global/safe-contracts) |
[safe-core-sdk-types](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-core-sdk-types) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk-types.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk-types) | Common types extracted from the [Safe Core SDK](https://github.com/safe-global/safe-core-sdk/tree/main/packages) packages |
[safe-core-sdk-utils](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-core-sdk-utils) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk-utils.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-core-sdk-utils) | Utilities for the [Safe Core SDK](https://github.com/safe-global/safe-core-sdk/tree/main/packages) packages |
[safe-ethers-lib](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-ethers-lib) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-ethers-lib.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-ethers-lib) | Ethers.js utilities and Safe contracts types (typechain ethers-v5) used to initialize the [Safe Core SDK](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-core-sdk) |
[safe-web3-lib](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-web3-lib) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-web3-lib.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-web3-lib) | Web3.js utilities and Safe contracts types (typechain web3-v1) used to initialize the [Safe Core SDK](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-core-sdk) |
[safe-service-client](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-service-client) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-service-client.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-service-client) | [Safe Transaction Service API](https://github.com/safe-global/safe-transaction-service) client library |
[safe-ethers-adapters](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-ethers-adapters) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-ethers-adapters.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-ethers-adapters) | [Ethers](https://docs.ethers.io/v5/single-page/) adapter that facilitates the interaction with the [Gnosis Safe Services](https://github.com/safe-global/safe-transaction-service) |
[safe-ethers-adapters](https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-ethers-adapters) | [![NPM Version](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-ethers-adapters.svg)](https://badge.fury.io/js/%40gnosis.pm%2Fsafe-ethers-adapters) | [Ethers](https://docs.ethers.io/v5/single-page/) adapter that facilitates the interaction with the [Safe Services](https://github.com/safe-global/safe-transaction-service) |

## Playground

Expand Down
6 changes: 3 additions & 3 deletions guides/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Guide: Integrating the Safe Core SDK

## What is Gnosis Safe
## What is Safe

Read about the basics of Gnosis Safe and how it compares to other solutions [here](https://help.gnosis-safe.io/en/articles/3876456-what-is-gnosis-safe).
Read about the basics of Safe and how it compares to other solutions [here](https://help.gnosis-safe.io/en/articles/3876456-what-is-gnosis-safe).

## Safe Core SDK

Expand Down Expand Up @@ -41,6 +41,6 @@ We'll assume that you are familiar with TypeScript (JavaScript), Ethereum and ha

## Help

If you need help, you can reach Gnosis Safe developers in the #safe-developers channel at https://chat.gnosis.io/ or create a discussion at https://github.com/safe-global/safe-core-sdk/discussions.
If you need help, you can reach Safe developers in the #safe-developers channel at https://chat.gnosis-safe.io/ or create a discussion at https://github.com/safe-global/safe-core-sdk/discussions.

Let's jump into the guide: [Integrating the Safe Core SDK](/guides/integrating-the-safe-core-sdk.md)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"packages/*"
]
},
"author": "Gnosis Safe (https://gnosis-safe.io)",
"author": "Safe (https://safe.global)",
"license": "MIT",
"devDependencies": {
"lerna": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/safe-core-sdk-types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/safe-core-sdk-types",
"version": "1.5.0",
"version": "1.6.0",
"description": "Safe Core SDK types",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand All @@ -20,7 +20,7 @@
"type": "git",
"url": "git+https://github.com/safe-global/safe-core-sdk.git"
},
"author": "Gnosis Safe (https://gnosis-safe.io)",
"author": "Safe (https://safe.global)",
"license": "MIT",
"bugs": {
"url": "https://github.com/safe-global/safe-core-sdk/issues"
Expand Down
2 changes: 2 additions & 0 deletions packages/safe-core-sdk-types/src/ethereumLibs/EthAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface EthAdapter {
}: GetContractProps): GnosisSafeProxyFactoryContract
getContractCode(address: string, defaultBlock?: string | number): Promise<string>
isContractDeployed(address: string, defaultBlock?: string | number): Promise<boolean>
getStorageAt(address: string, position: string): Promise<string>
getTransaction(transactionHash: string): Promise<any>
getSignerAddress(): Promise<string>
signMessage(message: string): Promise<string>
Expand All @@ -76,4 +77,5 @@ export interface EthAdapter {
): Promise<number>
call(transaction: EthAdapterTransaction, defaultBlock?: string | number): Promise<string>
encodeParameters(types: string[], values: any[]): string
decodeParameters(types: any[], values: string): { [key: string]: any }
}
2 changes: 1 addition & 1 deletion packages/safe-core-sdk-types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface TransactionOptions {
gasPrice?: number | string
maxFeePerGas?: number | string
maxPriorityFeePerGas?: number | string
nonce?: number
nonce?: number | string
}

export interface BaseTransactionResult {
Expand Down
6 changes: 3 additions & 3 deletions packages/safe-core-sdk-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/safe-core-sdk-utils",
"version": "1.3.0",
"version": "1.4.0",
"description": "Safe Core SDK Utilities",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand All @@ -22,7 +22,7 @@
"type": "git",
"url": "git+https://github.com/safe-global/safe-core-sdk.git"
},
"author": "Gnosis Safe (https://gnosis-safe.io)",
"author": "Safe (https://safe.global)",
"license": "MIT",
"bugs": {
"url": "https://github.com/safe-global/safe-core-sdk/issues"
Expand Down Expand Up @@ -52,7 +52,7 @@
"typescript": "^4.8.2"
},
"dependencies": {
"@gnosis.pm/safe-core-sdk-types": "^1.5.0",
"@gnosis.pm/safe-core-sdk-types": "^1.6.0",
"semver": "^7.3.7",
"web3-utils": "^1.7.5"
}
Expand Down
60 changes: 51 additions & 9 deletions packages/safe-core-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![GitHub Release](https://img.shields.io/github/release/safe-global/safe-core-sdk.svg?style=flat)](https://github.com/safe-global/safe-core-sdk/releases)
[![GitHub](https://img.shields.io/github/license/safe-global/safe-core-sdk)](https://github.com/safe-global/safe-core-sdk/blob/main/LICENSE.md)

Software development kit that facilitates the interaction with the [Gnosis Safe contracts](https://github.com/safe-global/safe-contracts).
Software development kit that facilitates the interaction with the [Safe contracts](https://github.com/safe-global/safe-contracts).

## Table of contents
* [Installation](#installation)
Expand Down Expand Up @@ -35,7 +35,7 @@ npm build

## <a name="getting-started">Getting Started</a>

The following steps show how to set up the Safe Core SDK, deploy a new Safe, create a Safe transaction, generate the required signatures from owners and execute the transaction. However, using the Safe Core SDK alone will not allow for the collection of owner signatures off-chain. To do this and be able to see and confirm the pending transactions shown in the [Gnosis Safe Web App](https://gnosis-safe.io/app/), it is recommended that you follow this other [guide](/guides/integrating-the-safe-core-sdk.md) that covers the use of the Safe Core SDK, combined with the Safe Service Client.
The following steps show how to set up the Safe Core SDK, deploy a new Safe, create a Safe transaction, generate the required signatures from owners and execute the transaction. However, using the Safe Core SDK alone will not allow for the collection of owner signatures off-chain. To do this and be able to see and confirm the pending transactions shown in the [Safe Web App](https://gnosis-safe.io/app/), it is recommended that you follow this other [guide](/packages/guides/integrating-the-safe-core-sdk.md) that covers the use of the Safe Core SDK, combined with the Safe Service Client.

### 1. Instantiate an EthAdapter

Expand Down Expand Up @@ -355,7 +355,7 @@ const safeSdk2 = await safeSdk.connect({ ethAdapter, safeAddress })
Returns the address of the current SafeProxy contract.
```js
const address = safeSdk.getAddress()
const safeAddress = safeSdk.getAddress()
```
### getContractVersion
Expand All @@ -371,7 +371,7 @@ const contractVersion = await safeSdk.getContractVersion()
Returns the list of Safe owner accounts.
```js
const owners = await safeSdk.getOwners()
const ownerAddresses = await safeSdk.getOwners()
```
### getNonce
Expand Down Expand Up @@ -406,12 +406,20 @@ Returns the ETH balance of the Safe.
const balance = await safeSdk.getBalance()
```
### getGuard
Returns the enabled Safe guard or 0x address if no guards are enabled.
```js
const guardAddress = await safeSdk.getGuard()
```
### getModules
Returns the list of addresses of all the enabled Safe modules.
```js
const modules = await safeSdk.getModules()
const moduleAddresses = await safeSdk.getModules()
```
### isModuleEnabled
Expand Down Expand Up @@ -648,15 +656,15 @@ const safeTransactionData: SafeTransactionDataPartial = {
}
const safeTransaction = await safeSdk.createTransaction({ safeTransactionData })
const txHash = await safeSdk.getTransactionHash(safeTransaction)
const owners = await safeSdk.getOwnersWhoApprovedTx(txHash)
const ownerAddresses = await safeSdk.getOwnersWhoApprovedTx(txHash)
```
### createEnableModuleTx
### createEnableGuardTx
Returns a Safe transaction ready to be signed that will enable a Safe module.
Returns the Safe transaction to enable a Safe guard.
```js
const safeTransaction = await safeSdk.createEnableModuleTx(moduleAddress)
const safeTransaction = await safeSdk.createEnableGuardTx(guardAddress)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.transactionResponse?.wait()
```
Expand All @@ -672,6 +680,40 @@ const options: SafeTransactionOptionalProps = {
refundReceiver, // Optional
nonce // Optional
}
const safeTransaction = await safeSdk.createEnableGuardTx(guardAddress, options)
```
### createDisableGuardTx
Returns the Safe transaction to disable a Safe guard.
```js
const safeTransaction = await safeSdk.createDisableGuardTx()
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.transactionResponse?.wait()
```
This method can optionally receive the `options` parameter:
```js
const options: SafeTransactionOptionalProps = { ... }
const safeTransaction = await safeSdk.createDisableGuardTx(options)
```
### createEnableModuleTx
Returns a Safe transaction ready to be signed that will enable a Safe module.
```js
const safeTransaction = await safeSdk.createEnableModuleTx(moduleAddress)
const txResponse = await safeSdk.executeTransaction(safeTransaction)
await txResponse.transactionResponse?.wait()
```
This method can optionally receive the `options` parameter:
```js
const options: SafeTransactionOptionalProps = { ... }
const safeTransaction = await safeSdk.createEnableModuleTx(moduleAddress, options)
```
Expand Down
1 change: 1 addition & 0 deletions packages/safe-core-sdk/contracts/Deps_V1_3_0.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { GnosisSafeProxyFactory } from "@gnosis.pm/safe-contracts-v1.3.0/contrac
import { GnosisSafe } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/GnosisSafe.sol";
import { MultiSend } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/libraries/MultiSend.sol";
import { MultiSendCallOnly } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/libraries/MultiSendCallOnly.sol";
import { DebugTransactionGuard } from "@gnosis.pm/safe-contracts-v1.3.0/contracts/examples/guards/DebugTransactionGuard.sol";

contract ProxyFactory_SV1_3_0 is GnosisSafeProxyFactory {}
contract GnosisSafe_SV1_3_0 is GnosisSafe {}
Expand Down
6 changes: 6 additions & 0 deletions packages/safe-core-sdk/hardhat/deploy/deploy-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment): Promise<v
args: [],
log: true
})

await deploy('DebugTransactionGuard', {
from: deployer,
args: [],
log: true
})
}

export default deploy
11 changes: 6 additions & 5 deletions packages/safe-core-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gnosis.pm/safe-core-sdk",
"version": "3.0.0",
"version": "3.1.0",
"description": "Safe Core SDK",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand Down Expand Up @@ -29,7 +29,7 @@
"type": "git",
"url": "git+https://github.com/safe-global/safe-core-sdk.git"
},
"author": "Gnosis Safe (https://gnosis-safe.io)",
"author": "Safe (https://safe.global)",
"license": "MIT",
"bugs": {
"url": "https://github.com/safe-global/safe-core-sdk/issues"
Expand All @@ -41,8 +41,8 @@
"devDependencies": {
"@gnosis.pm/safe-contracts-v1.2.0": "npm:@gnosis.pm/[email protected]",
"@gnosis.pm/safe-contracts-v1.3.0": "npm:@gnosis.pm/[email protected]",
"@gnosis.pm/safe-ethers-lib": "^1.5.0",
"@gnosis.pm/safe-web3-lib": "^1.5.0",
"@gnosis.pm/safe-ethers-lib": "^1.6.0",
"@gnosis.pm/safe-web3-lib": "^1.6.0",
"@nomiclabs/hardhat-ethers": "^2.1.1",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@nomiclabs/hardhat-web3": "^2.0.0",
Expand Down Expand Up @@ -88,8 +88,9 @@
}
},
"dependencies": {
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/solidity": "^5.7.0",
"@gnosis.pm/safe-core-sdk-types": "^1.5.0",
"@gnosis.pm/safe-core-sdk-types": "^1.6.0",
"@gnosis.pm/safe-deployments": "1.16.0",
"ethereumjs-util": "^7.1.5",
"semver": "^7.3.7",
Expand Down
Loading

0 comments on commit b0a6c4b

Please sign in to comment.