fix: erc721 examples and added missed APIs
MODIFY
examples/pos/erc721/approve.js
examples/pos/erc721/approve.js
@@ -5,7 +5,7 @@ const execute = async () => {
const client = await getPOSClient();
const erc721Token = client.erc721(pos.parent.erc721, true);
- const result = await erc721Token.approve('7398876539240070972813129052603381458438854170847909423332655142373978982692');
+ const result = await erc721Token.approve('800');
const txHash = await result.getTransactionHash();
console.log("txHash", txHash);

ADD
examples/pos/erc721/approve_all.js
+const { pos } = require('../../config');
+const { getPOSClient, from } = require('../../utils');
+
+const execute = async () => {
+ const client = await getPOSClient();
+ const erc721Token = client.erc721(pos.parent.erc721, true);
+
+ const result = await erc721Token.approveAll();
+
+ const txHash = await result.getTransactionHash();
+ console.log("txHash", txHash);
+ const receipt = await result.getReceipt();
+ console.log("receipt", receipt);
+
+}
+execute().then(() => {
+}).catch(err => {
+ console.error("err", err);
+}).finally(_ => {
+ process.exit(0);
+})
\ No newline at end of file

MODIFY
examples/pos/erc721/deposit.js
examples/pos/erc721/deposit.js
@@ -5,7 +5,7 @@ const execute = async () => {
const client = await getPOSClient();
const erc721Token = client.erc721(pos.parent.erc721, true);
- const result = await erc721Token.deposit('7398876539240070972813129052603381458438854170847909423332655142373978982692', from);
+ const result = await erc721Token.deposit('802', from);
const txHash = await result.getTransactionHash();
console.log("txHash", txHash);

ADD
examples/pos/erc721/deposit_many.js
+const { pos } = require('../../config');
+const { getPOSClient, from } = require('../../utils');
+
+const execute = async () => {
+ const client = await getPOSClient();
+ const erc721Token = client.erc721(pos.parent.erc721, true);
+
+ const result = await erc721Token.depositMany(['800', '802'], from);
+
+ const txHash = await result.getTransactionHash();
+ console.log("txHash", txHash);
+ const receipt = await result.getReceipt();
+ console.log("receipt", receipt);
+
+}
+execute().then(() => {
+}).catch(err => {
+ console.error("err", err);
+}).finally(_ => {
+ process.exit(0);
+})
\ No newline at end of file

MODIFY
examples/pos/erc721/get_tokenid_at_index_for_user.js
examples/pos/erc721/get_tokenid_at_index_for_user.js
@@ -5,7 +5,7 @@ const execute = async () => {
const client = await getPOSClient();
const erc721Token = client.erc721(pos.parent.erc721, true);
- const result = await erc721Token.getTokenIdAtIndexForUser(0, from);
+ const result = await erc721Token.getTokenIdAtIndexForUser(1, from);
console.log("result", result);
}

MODIFY
examples/pos/erc721/is_approved.js
examples/pos/erc721/is_approved.js
@@ -5,7 +5,7 @@ const execute = async () => {
const client = await getPOSClient();
const erc721Token = client.erc721(pos.parent.erc721, true);
- const result = await erc721Token.isApproved('7398876539240070972813129052603381458438854170847909423332655142373978982692');
+ const result = await erc721Token.isApproved('805');
console.log("isApproved", result);

ADD
examples/pos/erc721/is_approved_all.js
+const { pos } = require('../../config');
+const { getPOSClient, from } = require('../../utils');
+
+const execute = async () => {
+ const client = await getPOSClient();
+ const erc721Token = client.erc721(pos.parent.erc721, true);
+
+ const result = await erc721Token.isApprovedAll(from);
+
+ console.log("isApprovedAll", result);
+
+}
+execute().then(() => {
+}).catch(err => {
+ console.error("err", err);
+}).finally(_ => {
+ process.exit(0);
+})
\ No newline at end of file

MODIFY
examples/pos/erc721/withdraw_exit.js
examples/pos/erc721/withdraw_exit.js
@@ -5,7 +5,7 @@ const execute = async () => {
const client = await getPOSClient();
const erc721Token = client.erc721(pos.parent.erc721, true);
- const result = await erc721Token.withdrawExit('0xf63a77f1b6435e5d89c8958d80b658350f74409188a8efa17d51044d3a32e1d0');
+ const result = await erc721Token.withdrawExit('0x53e6d80253b238d6190f5a9d5b2146b733a93b92fcd8e38686068571eee5fe18');
const txHash = await result.getTransactionHash();
console.log("txHash", txHash);

ADD
examples/pos/erc721/withdraw_exit_many.js
+const { pos } = require('../../config');
+const { getPOSClient, from } = require('../../utils');
+
+const execute = async () => {
+ const client = await getPOSClient();
+ const erc721Token = client.erc721(pos.parent.erc721, true);
+
+ const result = await erc721Token.withdrawExitMany('0x54f47c891b460369661e22e27eeb4afbbb5dd792c7c8b48cab758892c14ffe85');
+
+ const txHash = await result.getTransactionHash();
+ console.log("txHash", txHash);
+ const receipt = await result.getReceipt();
+ console.log("receipt", receipt);
+
+}
+execute().then(() => {
+}).catch(err => {
+ console.error("err", err);
+}).finally(_ => {
+ process.exit(0);
+})
\ No newline at end of file

MODIFY
examples/pos/erc721/withdraw_start.js
examples/pos/erc721/withdraw_start.js
@@ -5,8 +5,8 @@ const execute = async () => {
const client = await getPOSClient();
const erc721Token = client.erc721(pos.child.erc721);
- const result = await erc721Token.withdrawStart('80047528142848335216688806836823083759679468829674837391037312559932191102210', {
- nonce: 11793,
+ const result = await erc721Token.withdrawStart('801', {
+ // nonce: 11793,
// returnTransaction: true,
gasPrice: '4000000000',
})

ADD
examples/pos/erc721/withdraw_start_many.js
+const { pos } = require('../../config');
+const { getPOSClient, from } = require('../../utils');
+
+const execute = async () => {
+ const client = await getPOSClient();
+ const erc721Token = client.erc721(pos.child.erc721);
+
+ const result = await erc721Token.withdrawStartMany(['800', '802'], {
+ // nonce: 11793,
+ // returnTransaction: true,
+ gasPrice: '4000000000',
+ })
+
+ console.log(result);
+
+ const txHash = await result.getTransactionHash();
+ console.log("txHash", txHash);
+ const receipt = await result.getReceipt();
+ console.log("receipt", receipt);
+
+}
+execute().then(() => {
+}).catch(err => {
+ console.error("err", err);
+}).finally(_ => {
+ process.exit(0);
+})
\ No newline at end of file

MODIFY
examples/pos/is_check_pointed.js
examples/pos/is_check_pointed.js
@@ -4,7 +4,7 @@ const { getPOSClient, from } = require('../utils');
const execute = async () => {
const client = await getPOSClient();
- const result = await client.isCheckPointed('0xb005d8db45f33836c422ee18286fa8ebe49b4ec7b9930e673d85ecd081cc3b8e');
+ const result = await client.isCheckPointed('0x54f47c891b460369661e22e27eeb4afbbb5dd792c7c8b48cab758892c14ffe85');
console.log("result", result);
}

MODIFY
examples/pos/is_deposited.js
examples/pos/is_deposited.js
@@ -4,7 +4,7 @@ const { getPOSClient, from } = require('../utils');
const execute = async () => {
const client = await getPOSClient();
- const isDeposited = await client.isDeposited('0x967ab5578a09d278db8b400354e874a0e5d38374db7b9edc42a3640fffdb3c7c');
+ const isDeposited = await client.isDeposited('0x48fe1e4f8c915d01ef13ccd7ac1e7cb6db1db15ea1d1df2e6fd8e957fe980dab');
console.log("isDeposited", isDeposited);
}

fix: erc721 examples and added missed APIs