The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I know there must be a simple answer to this, but I can't find it yet. There is no documentation in the godot dock.

I create a interface called ethereum.

Them i called ethereum.networkVersion and it works perfect.

Now i must call this method from javascript:

ethereum.request({ method: 'eth_requestAccounts' });

I try like this

**var RequestArguments : String = "{ method : 'eth_requestAccounts' }"

and does not work

this is not the first Dapp that I do, but it is the first time that I do it with godot, I do not know exactly how to call that method. What would be the correct syntax?

I only need to connect the wallet, the rest is easy.

# ethereum.isMetaMask ---- it works

# ethereum.networkVersion -- it works

var callback_wallet = JavaScript.create_callback(self, "_on_etherium_response")

var ethereum = JavaScript.get_interface("ethereum")

func _ready():

`if ethereum.isConnected() :`

    `$Button.text = "Connect To Metamask"`


    `$Button.text = "Install Metamask"`

func _on_etherium_response(args):

`var js_event = args[0]`

`$RichTextLabel.bbcode_text = "[center]" + str(js_event)` 

func _on_Button_pressed():

`var RequestArguments : String = "{ method : 'eth_requestAccounts' }"`

Godot version 3.4
in Engine by (90 points)
edited by

1 Answer

0 votes


var RequestArguments       = JavaScript.create_object( "Object")
RequestArguments["method"] = "eth_requestAccounts"    

by (90 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.