fix: POS examples
MODIFY
examples/node/approve-POS-ERC20-for-deposit.js
examples/node/approve-POS-ERC20-for-deposit.js
@@ -17,12 +17,12 @@ const matic = new Matic({
})
async function execute() {
- await matic.initialize()
matic.setWallet(config.PRIVATE_KEY)
return matic.approvePOSERC20ForDeposit(rootToken, amount, { from })
}
-async function executeRaw() { // eslint-disable-line
+async function executeRaw() {
+ // eslint-disable-line
await matic.initialize()
const txParams = await matic.approvePOSERC20ForDeposit(rootToken, amount, { from, encodeAbi: true })
let serializedTx = utils.buildRawTransaction(txParams, config.PRIVATE_KEY)

MODIFY
examples/node/burn-POS-ERC20.js
examples/node/burn-POS-ERC20.js
@@ -17,7 +17,6 @@ const matic = new Matic({
posRootChainManager: config.POS_ROOT_CHAIN_MANAGER_ADDRESS,
})
-matic.initialize().then(() => {
matic.setWallet(config.PRIVATE_KEY)
matic
.burnPOSERC20(childToken, amount, {
@@ -26,4 +25,3 @@ matic.initialize().then(() => {
.then(res => {
console.log(res) // eslint-disable-line
})
-})

MODIFY
examples/node/deposit-POS-ERC20-for-user.js
examples/node/deposit-POS-ERC20-for-user.js
@@ -17,13 +17,13 @@ const matic = new Matic({
})
async function execute() {
- await matic.initialize()
matic.setWallet(config.PRIVATE_KEY)
await matic.approvePOSERC20ForDeposit(rootToken, amount, { from, gasPrice: '10000000000' })
return matic.depositPOSERC20ForUser(rootToken, from, amount, { from, gasPrice: '10000000000' })
}
-async function executeRaw() { // eslint-disable-line
+async function executeRaw() {
+ // eslint-disable-line
await matic.initialize()
let txParams = await matic.approvePOSERC20ForDeposit(rootToken, amount, { from, encodeAbi: true })
let serializedTx = utils.buildRawTransaction(txParams, config.PRIVATE_KEY)

MODIFY
examples/node/exit-POS-ERC20.js
examples/node/exit-POS-ERC20.js
@@ -15,7 +15,6 @@ const matic = new Matic({
posRootChainManager: config.POS_ROOT_CHAIN_MANAGER_ADDRESS,
})
-matic.initialize().then(() => {
matic.setWallet(config.PRIVATE_KEY)
matic
.exitPOSERC20(burnTxHash, {
@@ -24,4 +23,3 @@ matic.initialize().then(() => {
.then(res => {
console.log(res) // eslint-disable-line
})
-})

fix: POS examples