move token addresses to config
ADD
dump.rdb
dump.rdb
Binary files /dev/null and b/dump.rdb differ

MODIFY
examples/node/config.js
examples/node/config.js
@@ -4,5 +4,9 @@ module.exports = {
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',
+ MATICWETH_ADDRESS: '0xFCbE295b918848001eB43941Db3fF9b6439a5e13',
+ PRIVATE_KEY:
+ '0xecdccb2bded99cfd3fbcc47fe9add154cf861940e10ba77a492bfa1ca89bee8d',
+ TEST_TOKEN: '0x7c779D7353d746535E6dBDb7edA2E457262C5a7d',
+ KOVAN_TEST: '0x670568761764f53E6C10cd63b71024c31551c9EC',
}

MODIFY
examples/node/deposit.js
examples/node/deposit.js
const Matic = require('maticjs').default
const config = require('./config')
-const token = '0x670568761764f53E6C10cd63b71024c31551c9EC' // test token address
-const amount = '10000000000000000' // amount in wei
+const token = config.KOVAN_TEST // test token address
+const amount = '4200000000000000000000000000000' // amount in wei
const from = '0x6e0c217de3235f1d8a95605d10bcc1b36ff7996f' // from address
// Create object of Matic
@@ -14,22 +14,24 @@ const matic = new Matic({
watcherUrl: config.WATCHER_URL,
})
-matic.wallet = '<private-key>' // prefix with `0x`
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
// Approve token
matic
.approveTokensForDeposit(token, amount, {
from,
- onTransactionHash: () => {
+ onTransactionHash: tx => {
// action on Transaction success
+ console.log(tx)
},
})
.then(() => {
// Deposit tokens
matic.depositTokens(token, from, amount, {
from,
- onTransactionHash: () => {
+ onTransactionHash: tx => {
// action on Transaction success
+ console.log(tx)
},
})
})

ADD
examples/node/depositEther.js
+const Matic = require('maticjs').default
+const config = require('./config')
+
+const token = config.KOVAN_TEST // test token address
+const amount = '4200000000000000000000000000000' // amount in wei
+const from = '0x6e0c217de3235f1d8a95605d10bcc1b36ff7996f' // 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`
+
+// Approve token
+
+// Deposit tokens
+matic.depositEthers(from, {
+ from,
+ value: amount,
+ onTransactionHash: tx => {
+ // action on Transaction success
+ console.log(tx)
+ },
+})

MODIFY
examples/node/getMaticTokenAddress.js
examples/node/getMaticTokenAddress.js
@@ -11,11 +11,12 @@ const matic = new Matic({
maticWethAddress: config.MATICWETH_ADDRESS,
})
-const tokenAddress = '0x670568761764f53E6C10cd63b71024c31551c9EC' // token address on mainchain
+const tokenAddress = config.KOVAN_TEST // token address on mainchain
-matic.wallet = '<private-key>' // prefix with `0x`
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
// get token address mapped with mainchain token address
-matic.getMappedTokenAddress(tokenAddress).then(() => {
+matic.getMappedTokenAddress(tokenAddress).then(address => {
// action on Transaction success
+ console.log(address)
})

MODIFY
examples/node/package-lock.json
examples/node/package-lock.json
}
},
"@types/node": {
- "version": "10.12.0",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.0.tgz",
- "integrity": "sha512-3TUHC3jsBAB7qVRGxT6lWyYo2v96BMmD2PTcl47H25Lu7UXtFH/2qqmKiVrnel6Ne//0TFYf6uvNX+HW2FRkLQ=="
+ "version": "10.12.20",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.20.tgz",
+ "integrity": "sha512-9spv6SklidqxevvZyOUGjZVz4QRXGu2dNaLyXIFzFYZW0AGDykzPRIUFJXTlQXyfzAucddwTcGtJNim8zqSOPA=="
},
"abstract-leveldown": {
"version": "2.6.3",
"integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0="
},
"ajv": {
- "version": "5.5.2",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
- "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
+ "version": "6.7.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz",
+ "integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==",
"requires": {
- "co": "^4.6.0",
- "fast-deep-equal": "^1.0.0",
+ "fast-deep-equal": "^2.0.1",
"fast-json-stable-stringify": "^2.0.0",
- "json-schema-traverse": "^0.3.0"
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
}
},
"any-promise": {
}
},
"bindings": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz",
- "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw=="
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.4.0.tgz",
+ "integrity": "sha512-7znEVX22Djn+nYjxCWKDne0RRloa9XfYa84yk3s+HkE3LpDYZmhArYr9O9huBoHY3/oXispx5LorIX7Sl2CgSQ==",
+ "requires": {
+ "file-uri-to-path": "1.0.0"
+ }
},
"bip66": {
"version": "1.1.5",
},
"bl": {
"version": "1.2.2",
- "resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
+ "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
"integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==",
"requires": {
"readable-stream": "^2.3.5",
}
},
"bluebird": {
- "version": "3.5.2",
- "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz",
- "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg=="
+ "version": "3.5.3",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz",
+ "integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw=="
},
"bn.js": {
"version": "4.11.8",
},
"browserify-aes": {
"version": "1.2.0",
- "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
+ "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
"integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
"requires": {
"buffer-xor": "^1.0.3",
},
"browserify-rsa": {
"version": "4.0.1",
- "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",
+ "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz",
"integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=",
"requires": {
"bn.js": "^4.1.0",
}
},
"browserify-sha3": {
- "version": "0.0.1",
- "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz",
- "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=",
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.4.tgz",
+ "integrity": "sha1-CGxHuMgjFsnUcCLCYYWVRXbdjiY=",
"requires": {
- "js-sha3": "^0.3.1"
+ "js-sha3": "^0.6.1",
+ "safe-buffer": "^5.1.1"
},
"dependencies": {
"js-sha3": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz",
- "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM="
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz",
+ "integrity": "sha1-W4n3enR3Z5h39YxKB1JAk0sflcA="
}
}
},
"safe-buffer": "^5.0.1"
}
},
- "co": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
- "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
- },
"combined-stream": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
},
"commander": {
"version": "2.8.1",
- "resolved": "http://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz",
"integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=",
"requires": {
"graceful-readlink": ">= 1.0.0"
"integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA=="
},
"core-js": {
- "version": "2.5.7",
- "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz",
- "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw=="
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.3.tgz",
+ "integrity": "sha512-l00tmFFZOBHtYhN4Cz7k32VM7vTn3rE2ANjQDxdEN6zmXZ/xq1jQuutnmHvMG1ZJ7xd72+TA5YpUK8wz3rWsfQ=="
},
"core-util-is": {
"version": "1.0.2",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"cors": {
- "version": "2.8.4",
- "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz",
- "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=",
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
+ "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"requires": {
"object-assign": "^4",
"vary": "^1"
},
"create-hash": {
"version": "1.2.0",
- "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
+ "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
"integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
"requires": {
"cipher-base": "^1.0.1",
},
"create-hmac": {
"version": "1.1.7",
- "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
+ "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
"integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
"requires": {
"cipher-base": "^1.0.3",
"dependencies": {
"file-type": {
"version": "3.9.0",
- "resolved": "http://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
"integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek="
},
"get-stream": {
"version": "2.3.1",
- "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz",
"integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=",
"requires": {
"object-assign": "^4.0.1",
},
"diffie-hellman": {
"version": "5.0.3",
- "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
+ "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
"integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==",
"requires": {
"bn.js": "^4.1.0",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
},
"fast-deep-equal": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
- "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
+ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
"integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY="
},
+ "file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
+ },
"finalhandler": {
"version": "1.1.1",
- "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz",
"integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==",
"requires": {
"debug": "2.6.9",
},
"get-stream": {
"version": "3.0.0",
- "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
},
"getpass": {
}
},
"graceful-fs": {
- "version": "4.1.11",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz",
- "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg="
+ "version": "4.1.15",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
},
"graceful-readlink": {
"version": "1.0.1",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
},
"har-validator": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz",
- "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==",
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
+ "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
"requires": {
- "ajv": "^5.3.0",
+ "ajv": "^6.5.5",
"har-schema": "^2.0.0"
}
},
}
},
"hash.js": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz",
- "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==",
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
+ "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
"requires": {
"inherits": "^2.0.3",
"minimalistic-assert": "^1.0.1"
},
"http-errors": {
"version": "1.6.3",
- "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
"requires": {
"depd": "~1.1.2",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
},
"json-schema-traverse": {
- "version": "0.3.1",
- "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
- "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
},
"json-stringify-safe": {
"version": "5.0.1",
},
"jsonfile": {
"version": "2.4.0",
- "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
"requires": {
"graceful-fs": "^4.1.6"
}
},
"keccakjs": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz",
- "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=",
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz",
+ "integrity": "sha512-BjLkNDcfaZ6l8HBG9tH0tpmDv3sS2mA7FNQxFHpCdzP3Gb2MVruXBSuoM66SnVxKJpAr5dKGdkHD+bDokt8fTg==",
"requires": {
- "browserify-sha3": "^0.0.1",
- "sha3": "^1.1.0"
+ "browserify-sha3": "^0.0.4",
+ "sha3": "^1.2.2"
}
},
"level-codec": {
},
"level-iterator-stream": {
"version": "1.3.1",
- "resolved": "http://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-1.3.1.tgz",
+ "resolved": "https://registry.npmjs.org/level-iterator-stream/-/level-iterator-stream-1.3.1.tgz",
"integrity": "sha1-5Dt4sagUPm+pek9IXrjqUwNS8u0=",
"requires": {
"inherits": "^2.0.1",
"dependencies": {
"readable-stream": {
"version": "1.1.14",
- "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"requires": {
"core-util-is": "~1.0.0",
"dependencies": {
"readable-stream": {
"version": "1.0.34",
- "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
"requires": {
"core-util-is": "~1.0.0",
}
},
"maticjs": {
- "version": "1.0.0-beta.5",
- "resolved": "https://registry.npmjs.org/maticjs/-/maticjs-1.0.0-beta.5.tgz",
- "integrity": "sha512-FXJ0RufH22iwHyZ5CYT6OGDzdTZzX/xyQuNkaE8TPIrklFzqpxSSPu+aST7wcsxbTDV+OIIHNgNLUNmknfiZSQ==",
+ "version": "1.0.0-beta.8",
+ "resolved": "https://registry.npmjs.org/maticjs/-/maticjs-1.0.0-beta.8.tgz",
+ "integrity": "sha512-/aYvPiHd2h5HHiEzZILsiz4598Zymk4tT2uG3Zzh3Qqf7lJ+NGnbdO5uqFa0PXVSJnDt+URHA+MItHGELglGkg==",
"requires": {
"@babel/polyfill": "7.0.0",
"@babel/runtime": "7.1.2",
},
"media-typer": {
"version": "0.3.0",
- "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"memdown": {
"dependencies": {
"async": {
"version": "1.5.2",
- "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz",
+ "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
"integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo="
}
}
},
"minimist": {
"version": "0.0.8",
- "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"mkdirp": {
"version": "0.5.1",
- "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
}
},
"nan": {
- "version": "2.11.1",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz",
- "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA=="
+ "version": "2.12.1",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz",
+ "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw=="
},
"nano-json-stream-parser": {
"version": "0.1.2",
}
},
"parse-asn1": {
- "version": "5.1.1",
- "resolved": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz",
- "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==",
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.3.tgz",
+ "integrity": "sha512-VrPoetlz7B/FqjBLD2f5wBVZvsZVLnRUrxVLfRYhGXCODa/NWE4p3Wp+6+aV3ZPL3KM7/OZmxDIwwijD7yuucg==",
"requires": {
"asn1.js": "^4.0.0",
"browserify-aes": "^1.0.0",
"create-hash": "^1.1.0",
"evp_bytestokey": "^1.0.0",
- "pbkdf2": "^3.0.3"
+ "pbkdf2": "^3.0.3",
+ "safe-buffer": "^5.1.1"
}
},
"parse-headers": {
},
"pify": {
"version": "2.3.0",
- "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
},
"pinkie": {
"integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY="
},
"psl": {
- "version": "1.1.29",
- "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz",
- "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ=="
+ "version": "1.1.31",
+ "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz",
+ "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw=="
},
"public-encrypt": {
"version": "4.0.3",
}
},
"punycode": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
- "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"qs": {
"version": "6.5.2",
},
"readable-stream": {
"version": "2.3.6",
- "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
"requires": {
"core-util-is": "~1.0.0",
}
},
"rimraf": {
- "version": "2.6.2",
- "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
- "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
+ "version": "2.6.3",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz",
+ "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==",
"requires": {
- "glob": "^7.0.5"
+ "glob": "^7.1.3"
}
},
"ripemd160": {
}
},
"rlp": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.1.0.tgz",
- "integrity": "sha512-93U7IKH5j7nmXFVg19MeNBGzQW5uXW1pmCuKY8veeKIhYTE32C2d0mOegfiIAfXcHOKJjjPlJisn8iHDF5AezA==",
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.2.tgz",
+ "integrity": "sha512-Ng2kJEN731Sfv4ZAY2i0ytPMc0BbJKBsVNl0QZY8LxOWSwd+1xpg+fpSRfaMn0heHU447s6Kgy8qfHZR0XTyVw==",
"requires": {
+ "bn.js": "^4.11.1",
"safe-buffer": "^5.1.1"
}
},
},
"scrypt-js": {
"version": "2.0.3",
- "resolved": "http://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz",
+ "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz",
"integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q="
},
"scrypt.js": {
}
},
"secp256k1": {
- "version": "3.5.2",
- "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.5.2.tgz",
- "integrity": "sha512-iin3kojdybY6NArd+UFsoTuapOF7bnJNf2UbcWXaY3z+E1sJDipl60vtzB5hbO/uquBu7z0fd4VC4Irp+xoFVQ==",
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.6.2.tgz",
+ "integrity": "sha512-90nYt7yb0LmI4A2jJs1grglkTAXrBwxYAjP9bpeKjvJKOjG2fOeH/YI/lchDMIvjrOasd5QXwvV2jwN168xNng==",
"requires": {
"bindings": "^1.2.1",
"bip66": "^1.1.3",
},
"sha.js": {
"version": "2.4.11",
- "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
+ "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
"requires": {
"inherits": "^2.0.1",
"dependencies": {
"nan": {
"version": "2.10.0",
- "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz",
"integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA=="
}
}
}
},
"sshpk": {
- "version": "1.15.1",
- "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.1.tgz",
- "integrity": "sha512-mSdgNUaidk+dRU5MhYtN9zebdzF2iG0cNPWy8HG+W8y+fT1JnSkh0fzzpjOa0L7P8i1Rscz38t0h4gPcKz43xA==",
+ "version": "1.16.1",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
+ "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
"requires": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"dependencies": {
"bluebird": {
"version": "2.11.0",
- "resolved": "http://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
"integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE="
}
}
},
"through": {
"version": "2.3.8",
- "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"timed-out": {
"requires": {
"psl": "^1.1.24",
"punycode": "^1.4.1"
+ },
+ "dependencies": {
+ "punycode": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
+ }
}
},
"trim": {
},
"buffer": {
"version": "3.6.0",
- "resolved": "http://registry.npmjs.org/buffer/-/buffer-3.6.0.tgz",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-3.6.0.tgz",
"integrity": "sha1-pyyTb3e5a/UvX357RnGAYoVR3vs=",
"requires": {
"base64-js": "0.0.8",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
+ "uri-js": {
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
+ "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==",
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
"url-parse-lax": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz",
},
"uuid": {
"version": "2.0.1",
- "resolved": "http://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz",
"integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w="
},
"vary": {
"dependencies": {
"query-string": {
"version": "5.1.1",
- "resolved": "http://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz",
+ "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz",
"integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==",
"requires": {
"decode-uri-component": "^0.2.0",

MODIFY
examples/node/package.json
examples/node/package.json
"author": "Sayli Patil <sayli@matic.network>",
"license": "ISC",
"dependencies": {
- "maticjs": "1.0.0-beta.5"
+ "maticjs": "1.0.0-beta.8"
}
}

MODIFY
examples/node/sendEthers.js
examples/node/sendEthers.js
@@ -15,13 +15,14 @@ const matic = new Matic({
maticWethAddress: config.MATICWETH_ADDRESS,
})
-matic.wallet = '<private-key>' // prefix with `0x`
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
// Send Tokens
matic.transferEthers(to, amount, {
from,
- parent: true, // For token transfer on Main network (false for Matic Network)
- onTransactionHash: () => {
+ // parent: true, // For token transfer on Main network (false for Matic Network)
+ onTransactionHash: tx => {
// action on Transaction success
+ console.log(tx)
},
})

MODIFY
examples/node/transfer-matic-ethers.js
examples/node/transfer-matic-ethers.js
-const Matic = require('matic.js').default
+const Matic = require('maticjs').default
const config = require('./config')
const from = '0x6e0c217de3235f1d8a95605d10bcc1b36ff7996f' // from address
@@ -16,12 +16,13 @@ const matic = new Matic({
maticWethAddress: config.MATICWETH_ADDRESS,
})
-matic.wallet = '<private-key>' // prefix with `0x`
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
// Send Matic Ethers
matic.transferMaticEthers(to, amount, {
from,
- onTransactionHash: () => {
+ onTransactionHash: tx => {
// action on Transaction success
+ console.log(tx)
},
})

MODIFY
examples/node/transfer.js
examples/node/transfer.js
const Matic = require('maticjs').default
const config = require('./config')
-const from = '0x6e0c217de3235f1d8a95605d10bcc1b36ff7996f' // from address
+const from = '0x6E0c217dE3235F1D8a95605d10bCC1B36ff7996f' // from address
const to = '0x7ed7f36694153ba6eff6ca6726b60f6e2bb17fcf' // to address
-const token = '0x670568761764f53E6C10cd63b71024c31551c9EC' // test token address
-const amount = '10000000000000000' // amount in wei
+const token = config.TEST_TOKEN // test token address
+const amount = '1' // amount in wei
// Create object of Matic
const matic = new Matic({
@@ -17,13 +17,14 @@ const matic = new Matic({
maticWethAddress: config.MATICWETH_ADDRESS,
})
-matic.wallet = '<private-key>' // prefix with `0x`
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
// Send Tokens
matic.transferTokens(token, to, amount, {
from,
- parent: true, // For token transfer on Main network (false for Matic Network)
- onTransactionHash: () => {
+ // parent: true, // For token transfer on Main network (false for Matic Network)
+ onTransactionHash: tx => {
// action on Transaction success
+ console.log(tx)
},
})

MODIFY
examples/node/withdraw-testing.js
examples/node/withdraw-testing.js
@@ -14,7 +14,7 @@ const matic = new Matic({
watcherUrl: config.WATCHER_URL,
})
-matic.wallet = '<private-key>' // prefix with `0x`
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
var transactionHash = null

MODIFY
examples/node/withdraw.js
examples/node/withdraw.js
const Matic = require('maticjs').default
const config = require('./config')
-const mtoken = '0x343461c74133E3fA476Dbbc614a87473270a226c' // test token address
+const mtoken = config.TEST_TOKEN // test token address
const amount = '10000000000000000' // amount in wei
const from = '0x6e0c217de3235f1d8a95605d10bcc1b36ff7996f' // from address
@@ -14,24 +14,25 @@ const matic = new Matic({
watcherUrl: config.WATCHER_URL,
})
-matic.wallet = '<private-key>'
+matic.wallet = config.PRIVATE_KEY // prefix with `0x`
-var transactionHash = null
+var transactionHash =
+ '0x4b4879943dbc209794741807214df8fb1da06c751ae6e4d6ffdf5aad64c17936'
-matic
- .startWithdraw(mtoken, amount, {
- from,
- onTransactionHash: txHash => {
- transactionHash = txHash
- },
- })
- .then(() => {
+// matic.startWithdraw(mtoken, amount, {
+// from,
+// onTransactionHash: txHash => {
+// transactionHash = txHash
+// console.log(txHash)
+// },
+// })
+// .then(() => {
//wait till checkpoint is submitted, then only procced
matic.withdraw(transactionHash, {
from,
- onTransactionHash: () => {
+ onTransactionHash: tx => {
// action on Transaction success
- process.exit()
+ console.log(tx)
},
})
- })
+// })

move token addresses to config