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 (79 points)
edited by

1 Answer

0 votes


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

by (79 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 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 webmaster@godotengine.org with your username.