Skip to content

Instantly share code, notes, and snippets.

@anurag-arjun
Last active January 14, 2019 13:05
Show Gist options
  • Save anurag-arjun/21a0820ea911169a186cbcb08b9fe520 to your computer and use it in GitHub Desktop.
Save anurag-arjun/21a0820ea911169a186cbcb08b9fe520 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 = null
matic
.startWithdraw(mtoken, amount, {
from,
onTransactionHash: txHash => {
transactionHash = txHash
console.log("Withdraw Initiated")
console.log(transactionHash)
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment