ERROR: addAccount accepts a private key as a prefixed hex string now!

My current code looks like:

            gsnProvider.addAccount({
                address: account.address,
                privateKey: Buffer.from(account.privateKey.replace('0x',''),'hex')
            })

and i get “ERROR: addAccount accepts a private key as a prefixed hex string now!” (which doesn’t cause the program to exit)

when I use this though:

            gsnProvider.addAccount({
                address: account.address,
                privateKey: account.privateKey
            })

I get an error about my private key not being valid.

How is this supposed to be used? I’ve tried a few different ways.
Is there a way to suppress the Error output?

addAccount was modified, and now accepts a string private key, not an object (that is, you don’t provide the address at all, only private key)

1 Like