当前位置:   article > 正文

小狐狸JSON-RPC:wallet_addEthereumChain(添加指定链)_await ethereum.request 不支持trustwallet

await ethereum.request 不支持trustwallet

wallet_addethereumchain(添加网络)

var res = await window.ethereum.request({
	"method": "wallet_addEthereumChain",
	"params": [{
		"chainId": "0x64", // 链 ID (必填)
		"chainName": "Gnosis", // 链名(必填)
		"rpcUrls": [ // RPC(必填)
			"https://rpc.ankr.com/gnosis"
		],
		"iconUrls": [ // 图标Url(可选)
			"https://xdaichain.com/fake/example/url/xdai.svg",
			"https://xdaichain.com/fake/example/url/xdai.png"
		],
		"nativeCurrency": {
			"name": "xDAI", // 货币符号(必填)
			"symbol": "xDAI", // 货币符号(必填)
			"decimals": 18 // 精度(必填)
		},
		"blockExplorerUrls": [ // 区块浏览器 URL(必填)
			"https://blockscout.com/poa/xdai/"
		]
	}]
});
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

在这里插入图片描述

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号