Skip to content

Commit e3f4f4c

Browse files
authored
[gas-v2.1.4-alpha.1]: Fix - Update gas package to contain main and browser entry points (#1336)
* Update package.json within gas package to contain main and browser entry points * Add Gnosis docs updates for setting gas within a Gnosis Safe app * Update react example in hooks readme
1 parent 4102ea6 commit e3f4f4c

File tree

5 files changed

+38
-3
lines changed

5 files changed

+38
-3
lines changed

packages/gas/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/gas",
3-
"version": "2.1.3",
3+
"version": "2.1.4-alpha.1",
44
"description": "Estimate the gas prices needed to get a transaction in to the next block for Ethereum Mainnet and Polygon Matic Mainnet.",
55
"keywords": [
66
"gas",
@@ -16,6 +16,8 @@
1616
"bugs": "https://github.com/blocknative/web3-onboard/issues",
1717
"module": "dist/index.js",
1818
"typings": "dist/index.d.ts",
19+
"browser": "dist/index.js",
20+
"main": "dist/index.js",
1921
"files": [
2022
"dist"
2123
],

packages/gnosis/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,27 @@ const onboard = Onboard({
3333
const connectedWallets = await onboard.connectWallet()
3434
console.log(connectedWallets)
3535
```
36+
37+
## Customizing Gnosis Transaction Gas
38+
39+
If you are looking to set the `gasLimit` of a transaction within Gnosis, the gas properties within the transaction WILL BE IGNORED.
40+
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.
41+
The Gnosis sdk instance exposed by the web3-onboard must be used to set the `safeTxGas` prop and send the transaction.
42+
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.
43+
An example of accessing the Gnosis SDK instance and sending a transaction can be found below.
44+
45+
```typescript
46+
const tx = {
47+
to: toAddress,
48+
value: 1000000000000000,
49+
data: '0x',
50+
}
51+
const params = {
52+
safeTxGas: 5000000,
53+
};
54+
55+
// wallet is the provider exposed by web3-onboard after the Gnosis wallet is connected
56+
let trans = await wallet.instance.txs.send({txs:[tx], params})
57+
```
58+
59+
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.

packages/gnosis/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/gnosis",
3-
"version": "2.1.3",
3+
"version": "2.1.4-alpha.1",
44
"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.",
55
"keywords": [
66
"Ethereum",

packages/react/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function App() {
5656
<div>
5757
<button
5858
disabled={connecting}
59-
onClick={() => (wallet ? disconnect() : connect())}
59+
onClick={() => (wallet ? disconnect(wallet) : connect())}
6060
>
6161
{connecting ? 'connecting' : wallet ? 'disconnect' : 'connect'}
6262
</button>

yarn.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,6 +2953,15 @@
29532953
dependencies:
29542954
"@walletconnect/window-getters" "^1.0.0"
29552955

2956+
"@web3-onboard/gas@^2.0.0", "@web3-onboard/gas@^2.1.3":
2957+
version "2.1.3"
2958+
resolved "https://registry.yarnpkg.com/@web3-onboard/gas/-/gas-2.1.3.tgz#1f4f2da8e758dba6bb2cdca8e552dcc801c4981d"
2959+
integrity sha512-5k3O5bX0hdJvGvi1w5ztUg8/muJeyPTuzcryCOnY1/PoSq/znUy3z1Qjl3V1zJtUhKydirPRzXEbUushjQ1VVQ==
2960+
dependencies:
2961+
"@web3-onboard/common" "^2.2.3"
2962+
joi "^17.6.1"
2963+
rxjs "^7.5.2"
2964+
29562965
"@web3auth/base-plugin@^1.0.1":
29572966
version "1.0.1"
29582967
resolved "https://registry.yarnpkg.com/@web3auth/base-plugin/-/base-plugin-1.0.1.tgz#1e2a87acf745299fdff6f92e6c46ee9bc38aa670"

0 commit comments

Comments
 (0)