Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade gnosis dependencies and move to peerDependencies #1785

Merged
merged 8 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ For full documentation, check out the README.md for each package or the [docs pa
- [Coinbase](packages/coinbase/README.md)
- [Trust](packages/trust/README.md)
- [WalletConnect](packages/walletconnect/README.md)
- [Gnosis](packages/gnosis/README.md)
- [Safe](packages/gnosis/README.md)
- [Magic](packages/magic/README.md)
- [Fortmatic](packages/fortmatic/README.md)
- [Portis](packages/portis/README.md)
Expand Down
30 changes: 15 additions & 15 deletions docs/src/routes/docs/[...4]wallets/[...9]gnosis/+page.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
---
title: Gnosis
title: Safe
---

# {$frontmatter.title}

Wallet module for connecting Gnosis Safe to web3-onboard
Wallet module for connecting Safe to web3-onboard

## Install

<Tabs values={['yarn', 'npm']}>
<TabPanel value="yarn">

```sh copy
yarn add @web3-onboard/gnosis
yarn add @web3-onboard/gnosis @safe-global/safe-apps-provider @safe-global/safe-apps-sdk
```

</TabPanel>
<TabPanel value="npm">

```sh copy
npm install @web3-onboard/gnosis
npm install @web3-onboard/gnosis @safe-global/safe-apps-provider @safe-global/safe-apps-sdk
```

</TabPanel>
Expand All @@ -37,14 +37,14 @@ type GnosisOptions = {

```typescript
import Onboard from '@web3-onboard/core'
import gnosisModule from '@web3-onboard/gnosis'
import safeModule from '@web3-onboard/gnosis'

const gnosis = gnosisModule()
const safe = safeModule()

const onboard = Onboard({
// ... other Onboard options
wallets: [
gnosis
safe
//... other wallets
]
})
Expand All @@ -53,13 +53,13 @@ const connectedWallets = await onboard.connectWallet()
console.log(connectedWallets)
```

## Customizing Gnosis Transaction Gas
## Customizing Safe Transaction Gas

If you are looking to set the `gasLimit` of a transaction within Gnosis, the gas properties within the transaction WILL BE IGNORED.
Instead you will need to use the `safeTxGas` prop AND the web3-onboard Gnosis instance that is exposed through the provider to send along the transaction.
The Gnosis sdk instance exposed by the web3-onboard must be used to set the `safeTxGas` prop and send the transaction.
Check [Gnosis docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full detail as it can be a bit confusing.
An example of accessing the Gnosis SDK instance and sending a transaction can be found below.
If you are looking to set the `gasLimit` of a transaction within Safe, the gas properties within the transaction WILL BE IGNORED.
Instead you will need to use the `safeTxGas` prop AND the web3-onboard Safe instance that is exposed through the provider to send along the transaction.
The Safe sdk instance exposed by the web3-onboard must be used to set the `safeTxGas` prop and send the transaction.
Check [Safe docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full detail as it can be a bit confusing.
An example of accessing the Safe SDK instance and sending a transaction can be found below.

```typescript
const tx = {
Expand All @@ -71,11 +71,11 @@ const params = {
safeTxGas: 5000000
}

// wallet is the provider exposed by web3-onboard after the Gnosis wallet is connected
// wallet is the provider exposed by web3-onboard after the Safe wallet is connected
let trans = await wallet.instance.txs.send({ txs: [tx], params })
```

Note: With the `safeTxGas` you will see additional value on the `gasLimit` displayed in the Safe. Check [Gnosis docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full details on that computation.
Note: With the `safeTxGas` you will see additional value on the `gasLimit` displayed in the Safe. Check [Safe docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full details on that computation.

## Build Environments

Expand Down
12 changes: 6 additions & 6 deletions docs/src/routes/examples/[...1]connect-wallet/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { Web3OnboardProvider, init } from '@web3-onboard/react'
import injectedModule from '@web3-onboard/injected-wallets'
import infinityWalletModule from '@web3-onboard/infinity-wallet'
import fortmaticModule from '@web3-onboard/fortmatic'
import gnosisModule from '@web3-onboard/gnosis'
import safeModule from '@web3-onboard/gnosis'
import keepkeyModule from '@web3-onboard/keepkey'
import keystoneModule from '@web3-onboard/keystone'
import ledgerModule from '@web3-onboard/ledger'
Expand Down Expand Up @@ -83,7 +83,7 @@ const infinityWallet = infinityWalletModule()
const ledger = ledgerModule()
const keystone = keystoneModule()
const keepkey = keepkeyModule()
const gnosis = gnosisModule()
const safe = safeModule()
const sequence = sequenceModule()
const taho = tahoModule() // Previously named Tally Ho wallet
const trust = trustModule()
Expand Down Expand Up @@ -113,7 +113,7 @@ const wallets = [
dcent,
trezor,
walletConnect,
gnosis,
safe,
magic,
fortmatic,
keystone,
Expand Down Expand Up @@ -298,7 +298,7 @@ import Onboard from '@web3-onboard/core'
import injectedModule from '@web3-onboard/injected-wallets'
import infinityWalletModule from '@web3-onboard/infinity-wallet'
import fortmaticModule from '@web3-onboard/fortmatic'
import gnosisModule from '@web3-onboard/gnosis'
import safeModule from '@web3-onboard/gnosis'
import keepkeyModule from '@web3-onboard/keepkey'
import keystoneModule from '@web3-onboard/keystone'
import ledgerModule from '@web3-onboard/ledger'
Expand Down Expand Up @@ -334,7 +334,7 @@ const infinityWallet = infinityWalletModule()
const ledger = ledgerModule()
const keystone = keystoneModule()
const keepkey = keepkeyModule()
const gnosis = gnosisModule()
const safe = safeModule()
const sequence = sequenceModule()
const taho = tahoModule() // Previously named Tally Ho wallet
const trust = trustModule()
Expand Down Expand Up @@ -369,7 +369,7 @@ const wallets = [
walletConnect,
enkrypt,
mewWallet,
gnosis,
safe,
magic,
fortmatic,
keystone,
Expand Down
6 changes: 3 additions & 3 deletions examples/with-nextjs-13/web3-onboard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fortmaticModule from '@web3-onboard/fortmatic'
import gnosisModule from '@web3-onboard/gnosis'
import safeModule from '@web3-onboard/gnosis'
import injectedModule from '@web3-onboard/injected-wallets'
import keepkeyModule from '@web3-onboard/keepkey'
import keystoneModule from '@web3-onboard/keystone'
Expand Down Expand Up @@ -47,7 +47,7 @@ const torus = torusModule()
const ledger = ledgerModule()
const keepkey = keepkeyModule()
const keystone = keystoneModule()
const gnosis = gnosisModule()
const safe = safeModule()
const dcent = dcentModule()
const mew = mewModule()
const tahoWalletSdk = tahoWalletModule() // Previously named Tally Ho wallet
Expand Down Expand Up @@ -75,7 +75,7 @@ export default init({
// An array of wallet modules that you would like to be presented to the user to select from when connecting a wallet.
wallets: [
injected,
gnosis,
safe,
fortmatic,
portis,
walletLink,
Expand Down
6 changes: 3 additions & 3 deletions examples/with-vite-react/src/web3-onboard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fortmaticModule from '@web3-onboard/fortmatic'
import gnosisModule from '@web3-onboard/gnosis'
import safeModule from '@web3-onboard/gnosis'
import injectedModule from '@web3-onboard/injected-wallets'
import keepkeyModule from '@web3-onboard/keepkey'
import keystoneModule from '@web3-onboard/keystone'
Expand Down Expand Up @@ -55,7 +55,7 @@ const torus = torusModule()
const ledger = ledgerModule()
const keepkey = keepkeyModule()
const keystone = keystoneModule()
const gnosis = gnosisModule()
const safe = safeModule()
const dcent = dcentModule()
const mew = mewModule()
const tahoWalletSdk = tahoWalletModule()
Expand Down Expand Up @@ -83,7 +83,7 @@ export default init({
// An array of wallet modules that you would like to be presented to the user to select from when connecting a wallet.
wallets: [
injected,
gnosis,
safe,
fortmatic,
portis,
walletLink,
Expand Down
6 changes: 3 additions & 3 deletions packages/demo/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Onboard from '@web3-onboard/core'
import fortmaticModule from '@web3-onboard/fortmatic'
import frameModule from '@web3-onboard/frame'
import gnosisModule from '@web3-onboard/gnosis'
import safeModule from '@web3-onboard/gnosis'
import infinityWalletModule from '@web3-onboard/infinity-wallet'
import injectedModule, { ProviderLabel } from '@web3-onboard/injected-wallets'
import keepkeyModule from '@web3-onboard/keepkey'
Expand Down Expand Up @@ -141,7 +141,7 @@
const ledger = ledgerModule({ projectId: 'f6bd6e2911b56f5ac3bc8b2d0e2d7ad5' })
const keepkey = keepkeyModule()
const keystone = keystoneModule()
const gnosis = gnosisModule()
const safe = safeModule()
const tallyho = tallyHoModule()
const xdefi = xdefiWalletModule()
const zeal = zealModule()
Expand Down Expand Up @@ -196,7 +196,7 @@
walletConnect,
coinbaseWallet,
phantom,
gnosis,
safe,
trust,
tallyho,
enkrypt,
Expand Down
26 changes: 13 additions & 13 deletions packages/gnosis/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# @web3-onboard/gnosis

## Wallet module for connecting Gnosis Safe to web3-onboard
## Wallet module for connecting Safe to web3-onboard

### Install

`npm i @web3-onboard/gnosis`
`npm i @web3-onboard/gnosis @safe-global/safe-apps-provider @safe-global/safe-apps-sdk`

### Options

Expand All @@ -18,14 +18,14 @@ type GnosisOptions = {

```typescript
import Onboard from '@web3-onboard/core'
import gnosisModule from '@web3-onboard/gnosis'
import safeModule from '@web3-onboard/gnosis'

const gnosis = gnosisModule()
const safe = safeModule()

const onboard = Onboard({
// ... other Onboard options
wallets: [
gnosis
safe
//... other wallets
]
})
Expand All @@ -34,13 +34,13 @@ const connectedWallets = await onboard.connectWallet()
console.log(connectedWallets)
```

## Customizing Gnosis Transaction Gas
## Customizing Safe Transaction Gas

If you are looking to set the `gasLimit` of a transaction within Gnosis, the gas properties within the transaction WILL BE IGNORED.
Instead you will need to use the `safeTxGas` prop AND the web3-onboard Gnosis instance that is exposed through the provider to send along the transaction.
The Gnosis sdk instance exposed by the web3-onboard must be used to set the `safeTxGas` prop and send the transaction.
Check [Gnosis docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full detail as it can be a bit confusing.
An example of accessing the Gnosis SDK instance and sending a transaction can be found below.
If you are looking to set the `gasLimit` of a transaction within Safe, the gas properties within the transaction WILL BE IGNORED.
Instead you will need to use the `safeTxGas` prop AND the web3-onboard Safe instance that is exposed through the provider to send along the transaction.
The Safe sdk instance exposed by the web3-onboard must be used to set the `safeTxGas` prop and send the transaction.
Check [Safe docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full detail as it can be a bit confusing.
An example of accessing the Safe SDK instance and sending a transaction can be found below.

```typescript
const tx = {
Expand All @@ -52,8 +52,8 @@ const params = {
safeTxGas: 5000000,
};

// wallet is the provider exposed by web3-onboard after the Gnosis wallet is connected
// wallet is the provider exposed by web3-onboard after the Safe wallet is connected
let trans = await wallet.instance.txs.send({txs:[tx], params})
```

Note: With the `safeTxGas` you will see additional value on the `gasLimit` displayed in the Safe. Check [Gnosis docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full details on that computation.
Note: With the `safeTxGas` you will see additional value on the `gasLimit` displayed in the Safe. Check [Safe docs](https://github.com/safe-global/safe-contracts/blob/a6504a9afdeac186a8cdb29ad68b189523c80eda/docs/safe_tx_gas.md) for full details on that computation.
14 changes: 9 additions & 5 deletions packages/gnosis/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@web3-onboard/gnosis",
"version": "2.1.10",
"description": "Gnosis Safe module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"version": "2.2.0-alpha.1",
"description": "Safe module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
"Web3",
Expand Down Expand Up @@ -54,11 +54,15 @@
"license": "MIT",
"devDependencies": {
"@types/node": "17.0.19",
"typescript": "^4.5.5"
"typescript": "^4.5.5",
"@safe-global/safe-apps-provider": "^0.17.1",
"@safe-global/safe-apps-sdk": "^8.0.0"
},
"dependencies": {
"@gnosis.pm/safe-apps-provider": "^0.9.2",
"@gnosis.pm/safe-apps-sdk": "^6.1.1",
"@web3-onboard/common": "^2.3.3"
},
"peerDependencies": {
"@safe-global/safe-apps-provider": "^0.17.1",
"@safe-global/safe-apps-sdk": "^8.0.0"
}
}
7 changes: 3 additions & 4 deletions packages/gnosis/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ type GnosisOptions = {
function gnosis(options?: GnosisOptions): WalletInit {
const {
whitelistedDomains = [
/^https:\/\/gnosis-safe\.io$/,
/^https:\/\/app\.safe\.global$/,
/^https:\/\/safe\.global$/
]
Expand All @@ -22,11 +21,11 @@ function gnosis(options?: GnosisOptions): WalletInit {
getIcon: async () => (await import('./icon.js')).default,
getInterface: async () => {
const { default: SafeAppsSDK } = await import(
'@gnosis.pm/safe-apps-sdk'
'@safe-global/safe-apps-sdk'
)

const { SafeAppProvider } = await import(
'@gnosis.pm/safe-apps-provider'
'@safe-global/safe-apps-provider'
)

const { createEIP1193Provider } = await import(
Expand All @@ -50,7 +49,7 @@ function gnosis(options?: GnosisOptions): WalletInit {

if (!safe) {
throw new Error(
`App must be loaded in a Safe App context, head to <a href="https://gnosis-safe.io/app">the Safe</a> and open this website as an app.`
`App must be loaded in a Safe App context, head to <a href="https://app.safe.global/">the Safe</a> and open this website as an app.`
)
}

Expand Down
Loading
Loading