fix erc1155 example
MODIFY
examples/pos/erc1155/approve.js
examples/pos/erc1155/approve.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, pos, from } = require('../../utils')
+
+const token = pos.parent.erc1155
const execute = async () => {
try {
- const tx = await maticPOSClient.approveERC1155ForDeposit(config.root.DERC1155)
+ const tx = await getMaticPOSClient().approveERC1155ForDeposit(token)
console.log(tx.transactionHash) // eslint-disable-line
} catch (e) {
console.error(e) // eslint-disable-line

DELETE
examples/pos/erc1155/burnBatch.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
-
-const execute = async () => {
- try {
- const tx = await maticPOSClient.burnBatchERC1155(
- config.child.DERC1155,
- [config.user.tokenId, config.user.tokenId2],
- [config.user.amount, config.user.amount2]
- )
- console.log(tx.transactionHash) // eslint-disable-line
- } catch (e) {
- console.error(e) // eslint-disable-line
- }
-}
-
-execute().then(() => process.exit(0))

ADD
examples/pos/erc1155/burn_batch.js
+const { getMaticPOSClient, pos, from } = require('../../utils')
+
+const token = pos.child.erc1155
+
+const execute = async () => {
+ try {
+ const tx = await getMaticPOSClient().burnBatchERC1155(token[('<tokenId1>', '<tokenid2>')], [
+ '<amount1>',
+ '<amount2>',
+ ])
+ console.log(tx.transactionHash) // eslint-disable-line
+ } catch (e) {
+ console.error(e) // eslint-disable-line
+ }
+}
+
+execute().then(() => process.exit(0))

RENAME
examples/pos/erc1155/burnSingle.js
examples/pos/erc1155/burn_single.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, pos, from } = require('../../utils')
+
+const token = pos.child.erc1155
const execute = async () => {
try {
- let tx = await maticPOSClient.burnSingleERC1155(
- config.child.DERC1155, //token address
+ let tx = await getMaticPOSClient().burnSingleERC1155(
+ token, //token address
'123', // id to burn
'1' // amount of id token to burn
)

DELETE
examples/pos/erc1155/depositBatch.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
-
-const execute = async () => {
- try {
- const tx = await maticPOSClient.depositBatchERC1155ForUser(
- config.root.DERC1155,
- config.user.address,
- [config.user.tokenId, config.user.tokenId2],
- [config.user.amount, config.user.amount2]
- )
- console.log(tx.transactionHash) // eslint-disable-line
- } catch (e) {
- console.error(e) // eslint-disable-line
- }
-}
-
-execute().then(() => process.exit(0))

ADD
examples/pos/erc1155/deposit_batch.js
+const { getMaticPOSClient, pos, from } = require('../../utils')
+
+const token = pos.parent.erc1155
+
+const execute = async () => {
+ try {
+ const tx = await getMaticPOSClient().depositBatchERC1155ForUser(
+ token,
+ from,
+ ['<tokenid1>', '<tokenid2>'],
+ ['amount1', 'amount2']
+ )
+ console.log(tx.transactionHash) // eslint-disable-line
+ } catch (e) {
+ console.error(e) // eslint-disable-line
+ }
+}
+
+execute().then(() => process.exit(0))

RENAME
examples/pos/erc1155/depositSingle.js
examples/pos/erc1155/deposit_single.js
-const config = require('../config')
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, pos, from } = require('../../utils')
+
+const token = pos.parent.erc1155
const execute = async () => {
try {
- const tx = await maticPOSClient.depositSingleERC1155ForUser(
- config.root.DERC1155,
- config.user.address,
+ const tx = await getMaticPOSClient().depositSingleERC1155ForUser(
+ token,
+ from,
'123', // token id
'1', // amount
[], // optional bytes
{
- from: config.user.address,
+ from: from,
gasPrice: '900000000000',
gas: '550000',
}

RENAME
examples/pos/erc1155/exitBatch.js
examples/pos/erc1155/exit_batch.js
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
+const { getMaticPOSClient, pos, from } = require('../../utils')
const burnHash = '0xbadbf10a33ba5ae48cfa1660e011eb15bf927773610ace9466c71d14749d4132'
const execute = async () => {
try {
- const tx = await maticPOSClient.exitBatchERC1155(burnHash)
+ const tx = await getMaticPOSClient().exitBatchERC1155(burnHash)
console.log(tx.transactionHash) // eslint-disable-line
} catch (e) {
console.error(e) // eslint-disable-line

RENAME
examples/pos/erc1155/exitSingle.js
examples/pos/erc1155/exit_single.js
-const utils = require('../utils')
-const maticPOSClient = utils.getMaticPOSClient()
-
+const { getMaticPOSClient, pos, from } = require('../../utils')
const burnHash = '0xbadbf10a33ba5ae48cfa1660e011eb15bf927773610ace9466c71d14749d4132'
const execute = async () => {
try {
- const tx = await maticPOSClient.exitSingleERC1155(burnHash)
+ const tx = await getMaticPOSClient().exitSingleERC1155(burnHash)
console.log(tx.transactionHash) // eslint-disable-line
} catch (e) {
console.error(e) // eslint-disable-line

fix erc1155 example