blockchain:静的htmlからipfsにファイルをアップロードする
差分
このページの2つのバージョン間の差分を表示します。
次のリビジョン | 前のリビジョン | ||
blockchain:静的htmlからipfsにファイルをアップロードする [2022/06/14 05:30] – 作成 dot | blockchain:静的htmlからipfsにファイルをアップロードする [2022/06/14 06:25] (現在) – dot | ||
---|---|---|---|
行 12: | 行 12: | ||
<code html> | <code html> | ||
- | require(" | ||
- | // This is a sample Hardhat task. To learn how to create your own go to | + | <html> |
- | // https:// | + | |
- | task(" | + | |
- | const accounts = await hre.ethers.getSigners(); | + | |
- | for (const account of accounts) { | + | < |
- | | + | <meta http-equiv=" |
- | } | + | < |
- | }); | + | </ |
+ | < | ||
- | // You need to export an object to set up your config | + | <script src=" |
- | // Go to https://hardhat.org/config/ to learn more | + | |
- | // Go to https://www.alchemyapi.io, sign up, create | + | <script type=" |
- | // a new App in its dashboard, and replace | + | async function fileSelected(element){ |
- | const ALCHEMY_API_KEY | + | const fileList = element.files; |
+ | const targetFile = fileList[0]; | ||
+ | const ipfs = await window.Ipfs.create(); | ||
+ | const _result = await ipfs.add(targetFile); | ||
+ | let resultElement = document.getElementById(" | ||
+ | resultElement.innerHTML = '< | ||
+ | } | ||
+ | </ | ||
- | // Replace this private key with your Goerli account private key | + | <div> |
- | // To export your private key from Metamask, open Metamask and | + | < |
- | // go to Account Details | + | < |
- | // Be aware of NEVER putting real Ether into testing accounts | + | </ |
- | const GOERLI_PRIVATE_KEY | + | |
- | /** | + | </body> |
- | * @type import(' | + | </html> |
- | */ | + | |
- | module.exports = { | + | |
- | solidity: " | + | |
- | networks: { | + | |
- | hardhat: {}, | + | |
- | goerli: { | + | |
- | url: `https:// | + | |
- | accounts: [`${GOERLI_PRIVATE_KEY}`] | + | |
- | } | + | |
- | } | + | |
- | }; | + | |
</ | </ |
blockchain/静的htmlからipfsにファイルをアップロードする.1655184620.txt.gz · 最終更新: 2022/06/14 05:30 by dot