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' }"
ethereum.request(RequestArguments).then(callback_wallet)**
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"`
`else:`
`$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' }"`
`ethereum.request(RequestArguments).then(callback_wallet)`