Skip to content

Commit

Permalink
fix(safe-apps-provider): fallback value and data were overwritten…
Browse files Browse the repository at this point in the history
… with `undefined` (#530)
  • Loading branch information
dasanra authored Dec 11, 2023
1 parent 53bd4a8 commit d6baa64
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-lizards-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@safe-global/safe-apps-provider': patch
---

fallback `value` and `data` were overwritten with `undefined`
3 changes: 2 additions & 1 deletion packages/safe-apps-provider/dist/provider.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/safe-apps-provider/dist/provider.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions packages/safe-apps-provider/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ export class SafeAppProvider extends EventEmitter implements EIP1193Provider {
}

case 'eth_sendTransaction':
// `value` or `data` can be explicitly set as `undefined` for example in Viem. The spread will overwrite the fallback value.
const tx = {
value: '0',
data: '0x',
...params[0],
value: params[0].value || '0',
data: params[0].data || '0x',
};

// Some ethereum libraries might pass the gas as a hex-encoded string
Expand Down

0 comments on commit d6baa64

Please sign in to comment.