Remove not implemented examples
DELETE
examples/node/balance-of-ERC20.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-// 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,
- maticWethAddress: config.MATICWETH_ADDRESS,
-})
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-const tokenAddress = config.MATIC_TEST_TOKEN // token address on mainchain
-const from = config.FROM_ADDRESS // from address
-
-matic.balanceOfERC20(from, tokenAddress, {
- // parent: true, // For token balance on Main network (false for Matic Network)
-}).then((hash) => {
- // action on Transaction success
- console.log(hash) // eslint-disable-line
-})

DELETE
examples/node/balance-of-ERC721.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-// 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,
- maticWethAddress: config.MATICWETH_ADDRESS,
-})
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-const tokenAddress = config.MATIC_ERC721_TOKEN // token address on mainchain
-const from = config.FROM_ADDRESS // from address
-
-matic.balanceOfERC721(from, tokenAddress, {
- // parent: true, // For token balance on Main network (false for Matic Network)
-}).then((hash) => {
- // action on Transaction success
- console.log(hash) // eslint-disable-line
-})

MODIFY
examples/node/confirm-withdraw.js
examples/node/confirm-withdraw.js
@@ -4,8 +4,8 @@ const config = require('./config')
const from = config.FROM_ADDRESS // from address
-
-var transactionHash = '0x03042186456e1ca3843c0eed088acba8fc56c3687d26ad028f0f1d1ad450647d' // Insert txHash generated from initiate-withdraw.js
+// 0xbbaf7712bc426b665650992215f9c15ac9bda72bbb4e7d453ba9ed3875e0ebf5 ERC721 withdraw
+var transactionHash = '0xbbaf7712bc426b665650992215f9c15ac9bda72bbb4e7d453ba9ed3875e0ebf5' // Insert txHash generated from initiate-withdraw.js
// Create object of Matic
const matic = new Matic({

DELETE
examples/node/deposit-ether.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-const amount = '1000000000000000000' // amount in wei
-const from = config.FROM_ADDRESS // 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 = config.PRIVATE_KEY // prefix with `0x`
-
-// deposit ethers
-matic.depositEthers({
- from,
- value: amount,
- onTransactionHash: (hash) => {
- // action on Transaction success
- console.log(hash) // eslint-disable-line
- },
-})

DELETE
examples/node/get-matic-token-address.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-// 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,
- maticWethAddress: config.MATICWETH_ADDRESS,
- depositManagerAddress: config.DEPOSITMANAGER_ADDRESS,
-})
-
-const tokenAddress = config.ROPSTEN_TEST_TOKEN // token address on mainchain
-
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-// get token address mapped with mainchain token address
-matic.getMappedTokenAddress(tokenAddress).then((hash) => {
- // action on Transaction success
- console.log(hash) // eslint-disable-line
-})

DELETE
examples/node/initiate-withdraw-ethers.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-const token = config.MATICWETH_ADDRESS // test token address
-const amount = '1000000000000000000' // amount in wei
-const from = config.FROM_ADDRESS // 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,
- withdrawManagerAddress: config.WITHDRAWMANAGER_ADDRESS,
-})
-
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-// NOTE: Initiate the withdraw on the Matic chain, and wait for ~5 minutes for
-// the checkpoint (refer https://whitepaper.matic.network/#checklayer for technical details)
-// before confirming the withdraw by executing `confirm-withdraw.js`.
-// The txHash from the output needs to be copied to the `confirm-withdraw.js` file before executing
-matic
- .startWithdraw(token, amount, {
- from,
- onTransactionHash: (hash) => {
- // console.log("Withdraw Initiated")
- console.log(hash) // eslint-disable-line
- },
-})

DELETE
examples/node/process-exit-ERC20.js
-
-const Matic = require('maticjs').default
-const config = require('./config')
-
-const from = config.FROM_ADDRESS // from address
-const rootTokenAddress = config.ROPSTEN_TEST_TOKEN // Root token 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,
- withdrawManagerAddress: config.WITHDRAWMANAGER_ADDRESS,
-})
-
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-// NOTE: Wait for NFT Challenge period tobe complete
-matic.processExits(rootTokenAddress, {
- from,
- onTransactionHash: (hash) => {
- // action on Transaction success
- // DEVNOTE: on sucessfull processExits funds will be transfered to your mainchain account
- console.log(hash) // eslint-disable-line
- },
-})
\ No newline at end of file

DELETE
examples/node/process-exit-ERC721.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-const from = config.FROM_ADDRESS // from address
-const rootTokenAddress = config.ROPSTEN_ERC721_TOKEN
-
-// 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,
- withdrawManagerAddress: config.WITHDRAWMANAGER_ADDRESS,
-})
-
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-
-// NOTE: Wait for NFT Challenge period tobe complete
-matic.processExits(rootTokenAddress, {
- from,
- onTransactionHash: (hash) => {
- // action on Transaction success
- // DEVNOTE: on sucessfull processExits funds will be transfered to your mainchain account
- console.log(hash) // eslint-disable-line
- },
-})
\ No newline at end of file

DELETE
examples/node/process-exit-ether.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-const from = config.FROM_ADDRESS // from address
-const rootTokenAddress = config.ROOTWETH_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,
- withdrawManagerAddress: config.WITHDRAWMANAGER_ADDRESS,
-})
-
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-
-// NOTE: Wait for NFT Challenge period tobe complete
-matic.processExits(rootTokenAddress, {
- from,
- onTransactionHash: (hash) => {
- // action on Transaction success
- // DEVNOTE: on sucessfull processExits funds will be transfered to your mainchain account
- console.log(hash) // eslint-disable-line
- },
-})
\ No newline at end of file

DELETE
examples/node/token-of-owner-ERC721.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-// 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,
- maticWethAddress: config.MATICWETH_ADDRESS,
-})
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-const tokenAddress = config.ROPSTEN_ERC721_TOKEN // token address on mainchain
-const from = config.FROM_ADDRESS // from address
-
-matic
- .tokenOfOwnerByIndexERC721(from, tokenAddress, 0, {
- from,
- parent: true, // For transaction on Main network (false for Matic Network)
- })
- .then(hash => {
- // action on Transaction success
- console.log(hash) // eslint-disable-line
- })

DELETE
examples/node/transfer-ethers.js
-const Matic = require('maticjs').default
-const config = require('./config')
-
-const from = config.FROM_ADDRESS // from address
-const receipent = 'Paste Your receipent address here ...' // to address
-
-const amount = '1000000000000000000' // amount in wei
-
-// 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,
- maticWethAddress: config.MATICWETH_ADDRESS,
-})
-
-matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-
-// Send Tokens
-matic.transferEthers(receipent, amount, {
- from,
- // parent: true, // For token transfer on Main network (false for Matic Network)
- onTransactionHash: (hash) => {
- // action on Transaction success
- console.log(hash) // eslint-disable-line
- },
-})

Remove not implemented examples