This file contains hidden or 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 Matic = require('maticjs').default | |
| const config = require('./config') | |
| const from = '0xdcd53258BA8A69C6a505300BE75447A772bFd3d6' // from address | |
| const to = '0x4933ba598e6B1f33bCDc299bE76AbE2DdFbCC6A4' // to address | |
| const token = '0x343461c74133E3fA476Dbbc614a87473270a226c' // test token address | |
| const amount = '10000000000000000' // amount in wei (0.01 TEST) | |
| // Create object of Matic |
This file contains hidden or 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
| // Approve token from your account to the Matic contracts | |
| matic | |
| .approveTokensForDeposit(token, amount, { | |
| from, | |
| onTransactionHash: () => { | |
| // action on Transaction success | |
| console.log("Deposit Tokens from Kovan/Ethereum to Matic - Transaction Approved.") | |
| }, | |
| }) |
This file contains hidden or 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
| PRIVATE_KEY: '<insert-your-private-key-here>' |
This file contains hidden or 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
| module.exports = { | |
| MATIC_PROVIDER: 'https://testnet.matic.network', | |
| PARENT_PROVIDER: 'https://kovan.infura.io/matic', | |
| ROOTCHAIN_ADDRESS: '0x24e01716a6ac34d5f2c4c082f553d86a557543a7', | |
| SYNCER_URL: 'https://eth-syncer.api.matic.network/api/v1', | |
| WATCHER_URL: 'https://eth-watcher.api.matic.network/api/v1', | |
| MATICWETH_ADDRESS: '0xeD3CAFb4dCf835E7a1D2E3169F8D296f931b4aA7', | |
| PRIVATE_KEY: '<insert-your-private-key-here>' | |
| } |
This file contains hidden or 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
| // Deposit tokens | |
| matic. | |
| depositTokens(token, from, amount, { | |
| from, | |
| onTransactionHash: () => { | |
| // action on Transaction success | |
| console.log("Tokens deposited from Kovan/Ethereum to Matic.") | |
| }, | |
| }) |
This file contains hidden or 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
| // Approve token from your account to the Matic contracts | |
| matic | |
| .approveTokensForDeposit(token, amount, { | |
| from, | |
| onTransactionHash: () => { | |
| // action on Transaction success | |
| console.log("Deposit Tokens from Kovan/Ethereum to Matic - Transaction Approved.") | |
| }, | |
| }) |
This file contains hidden or 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
| matic.wallet = '0x' + config.PRIVATE_KEY // prefix with `0x` |
This file contains hidden or 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 from = '0xdcd53258BA8A69C6a505300BE75447A772bFd3d6' // from address |
This file contains hidden or 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 amount = '10000000000000000' // amount in wei (0.01 TEST) |
This file contains hidden or 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 token = '0x670568761764f53E6C10cd63b71024c31551c9EC' // test token address |