Created
April 30, 2021 02:38
-
-
Save apow2/8902dd999b32fd2a6582fd40d9e21cc0 to your computer and use it in GitHub Desktop.
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 {web3, selectedAccount, chainId, connected} from "svelte-web3"; | |
import {contractAddress, abi} from "./utils/contract.js"; | |
let myContract; | |
let init = async () => { | |
await ethStore.setProvider("https://api.avax-test.network/ext/bc/C/rpc"); | |
await ethStore.setBrowserProvider(); | |
let contract = await new $web3.eth.Contract(abi, contractAddress); | |
if ($chainId != 43113) { | |
alert("Warning: You are not connected to Avalanche Fuji test-net!"); | |
} | |
return contract; | |
}; | |
setContext("myContract", init()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment