This file contains 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
// dynamically load a script and wait for load event | |
async function loadScript(url) { | |
return new Promise((resolve, reject) => { | |
let ourScript = document.createElement('script'); | |
ourScript.addEventListener('load', () => { | |
console.log('script was loaded'); | |
resolve('awesome'); | |
}); |
This file contains 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
function loadScript() { | |
// create a script element | |
let ourScript = document.createElement('script'); | |
// add the src, where we are loading the script from | |
ourScript.src = "https://cdn.jsdelivr.net/..."; | |
// append the script to the doucment head (load the script into the DOM) | |
document.head.appendChild(ourScript); | |
} |
This file contains 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 { ethers } from "ethers" | |
const rpcUrl = `https://eth-mainnet.g.alchemy.com/v2/demo`; | |
async function inspectBlocks(){ | |
const provider = new ethers.providers.JsonRpcProvider(rpcUrl); | |
const blockNumber = await provider.getBlockNumber(); | |
console.log(blockNumber); | |
const previousBlock = await provider.getBlock(blockNumber - 1); |
This file contains 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 { ethers } from 'ethers'; | |
import { formatUnits } from 'ethers/lib/utils.js'; | |
const rpcUrl = `https://eth-mainnet.g.alchemy.com/v2/demo`; | |
const imxERC20TokenAddress = "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF"; | |
const contractABI = [ | |
"function name() view returns (string)", | |
"function symbol() view returns (string)", |
This file contains 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 { ethers } from "ethers"; | |
import { formatEther, parseEther } from "ethers/lib/utils.js"; | |
// As this demo is for sending funds, connect to the goerli test network to not spend real money | |
const rpcUrl = "https://eth-goerli.g.alchemy.com/v2/demo"; | |
const wallet1PublicAddress = ""; // add the wallet address you want to send goerli ETH from | |
const wallet1PrivateKey = ""; // Do not expose this Private key. Only use a test wallet for this demo. | |
const wallet2PublicAddress = ""; // add the wallet address you want to send funds to |
This file contains 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 { ethers } from "ethers"; | |
import { formatUnits } from "ethers/lib/utils.js"; | |
const walletAddress = ""; // add the wallet address you want to check the balance of | |
const rpcUrl = "https://eth-mainnet.g.alchemy.com/v2/demo; | |
const imxERC20TokenAddress = "0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF"; // Immutable X ERC20 token contract address | |
const contractABI = [ | |
"function name() view returns (string)", | |
"function symbol() view returns (string)", |
This file contains 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 { ethers } from "ethers" | |
import { formatEther } from "ethers/lib/utils.js"; | |
const walletAddress = ""; // add the wallet address you want to check the balance of | |
const rpcUrl = "https://eth-mainnet.g.alchemy.com/v2/demo"; | |
async function getWalletBalance(){ | |
const provider = new ethers.providers.JsonRpcProvider(rpcUrl); | |
const balance = await provider.getBalance(walletAddress); |
This file contains 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 "~@angular/material/theming"; | |
@include mat-core(); | |
// Standard material custom theme setup | |
$primary: mat-palette($mat-blue, 800, 500, 900); | |
$accent: mat-palette($mat-pink, 500, 300, 700); | |
$warn: mat-palette($mat-red, 700); | |
$my-theme: mat-light-theme($primary, $accent, $warn); |
This file contains 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
using Microsoft.EntityFrameworkCore; | |
... | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
// Add other services here | |
// Add the database context to the services collection for dependency injection | |
services.AddDbContext<MyDatabaseContext>(options => | |
options.UseSqlServer(Configuration.GetConnectionString("DatabaseConnectionString"))); |
This file contains 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
// Paste this snippet in your .NET Core main .csproj file | |
// Change (or remove) the Condition statement if you want this to run on Debug builds (locally) as well | |
<Target Name="Create Migrations Script" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'"> | |
<Exec Command="dotnet ef migrations script --configuration $(Configuration) --no-build --idempotent --output $(TargetDir)/migrations.sql"/> | |
</Target> |