Skip to content

Instantly share code, notes, and snippets.

@anurag-arjun
Last active January 14, 2019 13:07
Show Gist options
  • Save anurag-arjun/cac8f2bc2810969bd07fc584f25459ad to your computer and use it in GitHub Desktop.
Save anurag-arjun/cac8f2bc2810969bd07fc584f25459ad to your computer and use it in GitHub Desktop.
const Matic = require('maticjs').default
const config = require('./config')
const mtoken = '0x343461c74133E3fA476Dbbc614a87473270a226c' // test token address
const amount = '10000000000000000' // amount in wei (0.01 TEST)
const from = '0xdcd53258BA8A69C6a505300BE75447A772bFd3d6' // from address
// Create object of Matic
const matic = new Matic({
maticProvider: config.MATIC_PROVIDER,
parentProvider: config.PARENT_PROVIDER,
rootChainAddress: config.ROOTCHAIN_ADDRESS,
syncerUrl: config.SYNCER_URL,
watcherUrl: config.WATCHER_URL,
})
matic.wallet = '0x' + config.PRIVATE_KEY // prefix with `0x`
var transactionHash = "0xacd94a91e6d1dec48db29d1edf71102f69cb0a334ad8db3c0d0a219fe44a5d51"
//Wait for 5 mins till the checkpoint is submitted, then run the confirm withdraw
matic.withdraw(transactionHash, {
from,
onTransactionHash: (txHash) => {
// action on Transaction success
console.log("Withdraw complete",txHash)
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment