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
fuji: { | |
url: 'https://api.avax-test.network/ext/bc/C/rpc', | |
gasPrice: 225000000000, | |
chainId: 43113, | |
accounts: [ | |
"0x7727b8bf7f114f93cede28f67da7ac4fbcd34d481f4bb1597256102985ebea17", //private key | |
"0x40c933e2b79efc76286ad0190d64eeg43dd6724a4b2674bb2f83ac63c2aabe19", | |
"0x1637e4c222057f9d3b177d7a5dd1aba62baf9ebe0fa511cb2944b0e70b062a68", | |
"0x5a4758ffb1216ab80ce6c6fa374833f1f10f1966ca9ff7fa13332e4bd78d43c7", | |
"0x4d4849a8d599a6adc9d58a3b76fcf90dcedea99fed5a425dc4f4a55f120ce8e8", |
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 avalanche = require("avalanche"); | |
let bintools = avalanche.BinTools.getInstance(); | |
const ID = 1; | |
const ava = new avalanche.Avalanche("api.avax-test.network", 443, "https", networkID); | |
const xchain = ava.XChain(); | |
let xKeychain = xchain.keyChain(); | |
let keypair = xKeychain.makeKey(); | |
//p ublic and private keys | |
let pubkstr = keypair.getPublicKeyString(); |
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
<script> | |
import {get} from "svelte/store"; | |
export const getBalance = (contract) => async (e) => { | |
await contract; // ensure $web3.eth is defined | |
return get(web3).eth.getBalance(get(selectedAccount)); | |
}; | |
export let checkAccount = get(selectedAccount) || "0x0000000000000000000000000000000000000000"; | |
let myContract = getContext("myContract"); | |
</script> |
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 const transfer= (contract) => (to) => async (tokenId) => { | |
let myContract = await contract; | |
try { | |
let tx = await get(web3).eth.sendTransaction({ | |
gasPrice: get(web3).utils.toHex(get(web3).utils.toWei("225", "gwei")), | |
gasLimit: get(web3).utils.toHex("600000"), | |
from: get(selectedAccount), | |
to: contractAddress, | |
data: myContract.methods.transfer(to, tokenId).encodeABI(), | |
}); |
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!"); | |
} |
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 axios from "axios"; | |
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!"); | |
} |
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 pinataSDK = require('@pinata/sdk'); | |
const pinata = pinataSDK(yourKey, yourKey2); | |
const fs = require('fs'); | |
function getStream(){ | |
return fs.createReadStream(PATH_TO_IMAGES+files[i]); | |
} | |
let readableStreamForFile = getStream(); | |
//pin on IPFS | |
cur_promise = await new Promise((resolve, reject) => { |
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 tx = { | |
from: address, | |
to: contractAddress, | |
gas: 20000, | |
value: 1000, | |
data: myContract.methods.setAddresses(MetaDataAddress, BINAddress).encodeABI(), | |
common: {customChain: {networkId:1, chainId: 43113}} //chain information | |
}; |
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.6.0 <0.9.0; | |
// This contract keeps all Ether sent to it with no way | |
// to get it back. | |
contract Sink { | |
event Received(address, uint); | |
receive() external payable { | |
emit Received(msg.sender, msg.value); | |
} |
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
contract TipJar{ | |
address owner; | |
constructor() public{ | |
owner = msg.sender; | |
} | |
receive() external payable{ | |
} | |
fallback() external payable { |
NewerOlder