https://github.com/ProjectOpenSea/opensea-js
const url = "https://eth-ropsten.alchemyapi.io/v2/d8CAFhdFj2MZSdPiCmoYOic-_TqW6Oo5";
// Using web3js
const web3 = new Web3(url);
// Using ethers.js
const provider =
new ethers.providers.JsonRpcProvider(url);
const provider = typeof window.web3 !== 'undefined'
// @ts-ignore
? window.web3.currentProvider
// @ts-ignore
: new Web3.providers.HttpProvider('https://mainnet.infura.io');
let fs = require("fs");
let axios = require("axios");
let ipfsArray = [];
let promises = [];
for (let i = 0; i < 100; i++) {
let paddedHex = ("0000000000000000000000000000000000000000000000000000000000000000" + i.toString(16)).substr("-64");
promises.push(new Promise( (res, rej) => {
fs.readFile(`${__dirname}/export/${paddedHex}.png`, (err, data) => {
if(err) rej();
ipfsArray.push({
path: `images/${paddedHex}.png`,
content: data.toString("base64")
})
res();
})
}))
}
Promise.all(promises).then( () => {
axios.post("https://deep-index.moralis.io/api/v2/ipfs/uploadFolder",
ipfsArray,
{
headers: {
"X-API-KEY": '',
"Content-Type": "application/json",
"accept": "application/json"
}
}
).then( (res) => {
console.log(res.data);
})
.catch ( (error) => {
console.log(error)
})
})
mehtod: 'eth_requestAccounts'
서드파티를 이용하지 않고 컴퓨터에 직접 노드를 구축하면 솔리디티 컴파일도 직접 해야함
$ git clone https://github.com/ethereum/remix-project.git
// contracts/ExampleToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/
ERC20.sol";