Skip to content

Commit

Permalink
fix stringifying bigint
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Oct 24, 2023
1 parent 8533171 commit 8d21261
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/remix-ide/src/app/tabs/web3-provider.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../../package.json'
import {isBigInt} from 'web3-validator'

export const profile = {
name: 'web3Provider',
Expand All @@ -10,6 +11,11 @@ export const profile = {
kind: 'provider'
}

const replacer = (key, value) => {
if (isBigInt(value)) value = value.toString()
return value
}

export class Web3ProviderModule extends Plugin {
constructor(blockchain) {
super(profile)
Expand All @@ -23,7 +29,7 @@ export class Web3ProviderModule extends Plugin {
sendAsync(payload) {

return new Promise((resolve, reject) => {
this.askUserPermission('sendAsync', `Calling ${payload.method} with parameters ${JSON.stringify(payload.params, null, '\t')}`).then(
this.askUserPermission('sendAsync', `Calling ${payload.method} with parameters ${JSON.stringify(payload.params, replacer, '\t')}`).then(
async (result) => {
if (result) {
const provider = this.blockchain.web3().currentProvider
Expand Down

0 comments on commit 8d21261

Please sign in to comment.