This file contains hidden or 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
export function eventID(name: string, types: string[]): Buffer; | |
export function methodID(name: string, types: string[]): Buffer; | |
export function rawEncode<Values = any[]>(types: string[], values: T): Buffer; | |
export function rawDecode<Values = any[]>( | |
types: string[], | |
data: Buffer | |
): Values; | |
export function simpleEncode<Args = any[]>( | |
method: string, | |
...args: Args |
This file contains hidden or 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
const ethers = require("ethers"); | |
const wallet = require("./wallet"); | |
const provider = require("./provider"); | |
async function main(args) { | |
const account = wallet.connect(provider); | |
// Define balanceOf and transfer functions in the contract | |
const usdc = new ethers.Contract( | |
"0x68ec573C119826db2eaEA1Efbfc2970cDaC869c4", |
This file contains hidden or 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
const ethers = require("ethers"); | |
const wallet = require("./wallet"); | |
const provider = require("./provider"); | |
async function main(args) { | |
const account = wallet.connect(provider); | |
let to, value; | |
// Parse the first argument - recipient address | |
try { |
This file contains hidden or 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
const ethers = require("ethers"); | |
const wallet = require("./wallet"); | |
const provider = require("./provider"); | |
async function main() { | |
const account = wallet.connect(provider); | |
// Define contract interface | |
const usdc = new ethers.Contract( | |
"0x68ec573C119826db2eaEA1Efbfc2970cDaC869c4", |
This file contains hidden or 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
const ethers = require("ethers"); | |
const wallet = require("./wallet"); | |
const provider = require("./provider"); | |
async function main() { | |
const account = wallet.connect(provider); | |
const usdc = new ethers.Contract( | |
"0x68ec573C119826db2eaEA1Efbfc2970cDaC869c4", | |
["function gimmeSome() external"], |
This file contains hidden or 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
const ethers = require("ethers"); | |
const wallet = require("./wallet"); | |
const provider = require("./provider"); | |
async function main() { | |
const account = wallet.connect(provider); | |
const balance = await account.getBalance(); | |
console.log(`ETH Balance: ${ethers.utils.formatUnits(balance, 18)}`); | |
} |
This file contains hidden or 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
const ethers = require("ethers"); | |
const provider = ethers.getDefaultProvider("ropsten", { | |
// Replace the following with your own INFURA API key | |
infura: "0123456789abcdef0123456789abcdef", | |
}); | |
module.exports = provider; |
This file contains hidden or 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
const ethers = require("ethers"); | |
// Replace the following with your own mnemonic | |
const mnemonic = | |
"rabbit enforce proof always embrace tennis version reward scout shock license wing"; | |
const wallet = ethers.Wallet.fromMnemonic(mnemonic); | |
console.log(`Mnemonic: ${wallet.mnemonic.phrase}`); | |
console.log(`Address: ${wallet.address}`); |
This file contains hidden or 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
const ethers = require("ethers"); | |
const wallet = ethers.Wallet.createRandom(); | |
console.log(`Mnemonic: ${wallet.mnemonic.phrase}`); | |
console.log(`Address: ${wallet.address}`); |
This file contains hidden or 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
import WalletLink from "walletlink" | |
import Web3 from "web3" | |
export const WalletLink = new WalletLink({ | |
appName: "My Awesome DApp", | |
appLogoUrl: "https://example.com/logo.png" | |
}) | |
export const ethereum = walletLink.makeWeb3Provider( | |
"https://mainnet.infura.io/v3/INFURA_API_KEY", 1 |