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
// Code snippet for eth-JSON RPC method | |
import axios from "axios"; | |
import { MATIC_RPC_URL } from "../utils/constants"; | |
// Fetch finality data using eth-JSON RPC method | |
export async function ethJsonRpcMethod(yourBlock: number): Promise<void> { | |
try { | |
console.log("Waiting for your block to get finalized...\n"); | |
// Flag for block finality | |
let finalised: boolean = false; |
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
export const placeSingleOrderController = async ( | |
req: ClientWithRequestQueryBody<{ projectId: string }, { qty: number; price: number }>, | |
res: Response, | |
) => { | |
try { | |
const { projectId } = req.query; | |
const { qty, price } = req.body; | |
const order = { | |
category: 'spot', |
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 { sleep } from "../utils/utilityFunctions"; | |
import { getPlasmaClient } from "../utils/plasmaClient"; | |
import { maticAddressL1 } from "../../config"; | |
import { ITransactionWriteResult } from "@maticnetwork/maticjs"; | |
import { PlasmaClient } from "@maticnetwork/maticjs-plasma"; | |
import type { ERC20 } from "@maticnetwork/maticjs-plasma/dist/ts/erc20"; | |
import ps from "prompt-sync"; | |
const prompt = ps(); | |
export async function withdrawExitMATIC() { |
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 { sleep } from "../utils/utilityFunctions"; | |
import { getPlasmaClient } from "../utils/plasmaClient"; | |
import { getChildUser, maticAddressL1 } from "../../config"; | |
import { ITransactionWriteResult } from "@maticnetwork/maticjs"; | |
import { PlasmaClient } from "@maticnetwork/maticjs-plasma"; | |
import type { ERC20 } from "@maticnetwork/maticjs-plasma/dist/ts/erc20"; | |
import ps from "prompt-sync"; | |
const prompt = ps(); | |
export async function depositMATIC() { |
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 { | |
getRootUser, | |
getChildUser, | |
getPrivateKeyGoerli, | |
getInfuraProjectId, | |
getPrivateKeyMumbai, | |
} from "../../config"; | |
import { use } from "@maticnetwork/maticjs"; | |
import HDWalletProvider from "@truffle/hdwallet-provider"; | |
import { PlasmaClient } from "@maticnetwork/maticjs-plasma"; |
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
[ | |
{ | |
"index": 1, | |
"milestone_id": "905ecdf5-5d5b-46c2-ae7c-0afe96433975 - 0xa7f58370bed9b19598480fe25a9cadc37ad19f3c", | |
"totalTime": "0 min and 46 sec" | |
}, | |
{ | |
"index": 2, | |
"milestone_id": "249ada97-51a2-4e06-ba72-fa7be6112fe8 - 0x72a247cc589ed37c8742fc75b1149149d13d1443", | |
"totalTime": "5 min and 10 sec" |
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
export const MILESTONE_API = "https://heimdall-api-testnet.polygon.technology/milestone/latest"; |
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
const erc20TransferFrom = async () => { | |
try { | |
/* ---------------------------- SETUP ------------------------------ */ | |
/* | |
USING INFURA PROVIDER | |
*/ | |
const provider: ethers.providers.InfuraProvider = | |
new ethers.providers.InfuraProvider('maticmum', infuraProjectID); |