Created
October 27, 2023 07:17
-
-
Save jeasonstudio/ee4e51257675a12ec3e815c3768173cb to your computer and use it in GitHub Desktop.
Deploy on scroll mainnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 切换到 Scroll Mainnet (0x82750) | |
// 或者是 Scroll Sepolia Testnet(0x8274f) | |
await ethereum.request({ | |
method: 'wallet_switchEthereumChain', | |
params: [{ chainId: '0x82750' }], | |
}); | |
// 连接钱包(选择有余额的账户) | |
const [address] = await ethereum.request({ method: 'eth_requestAccounts' }); | |
// 部署合约 | |
const txHash = await ethereum.request({ | |
method: 'eth_sendTransaction', | |
params: [{ | |
from: address, | |
// 一段 evm 字节码,向合约内填充一段字符串 "Hi Scroll!" | |
data: '0x600a600a5F39600a5FF34869205363726f6c6c21', | |
}], | |
}); | |
console.log(`tx hash:`, txHash); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment