diff --git a/JsClients/ERC20/src/erc20.ts b/JsClients/ERC20/src/erc20.ts index 56fd575a..42d2f22d 100644 --- a/JsClients/ERC20/src/erc20.ts +++ b/JsClients/ERC20/src/erc20.ts @@ -369,7 +369,6 @@ class ERC20Client { // amount: CLValueBuilder.u256(amount) // }); - // const deployHash = await contractCall({ // chainName: this.chainName, // contractHash: this.contractHash, diff --git a/JsClients/ERC20/test/installed.ts b/JsClients/ERC20/test/installed.ts index f1689328..3ff1a362 100644 --- a/JsClients/ERC20/test/installed.ts +++ b/JsClients/ERC20/test/installed.ts @@ -70,7 +70,7 @@ const erc20 = new ERC20Client( const test = async () => { - await erc20.setContractHash(TOKEN1_CONTRACT!); + await erc20.setContractHash(TOKEN0_CONTRACT!); //getTotalSupply(TOKEN1_CONTRACT!); // // //name // // const name = await erc20.name(); @@ -133,16 +133,16 @@ const test = async () => { // // console.log(`... Total supply: ${totalSupply}`); //approve - const approveDeployHash = await erc20.approve( - ROUTERKEYS, - PACKAGE_HASH!, - AMOUNT_B_DESIRED!, - APPROVE_PAYMENT_AMOUNT! - ); - console.log("... Approve deploy hash: ", approveDeployHash); - - await getDeploy(NODE_ADDRESS!, approveDeployHash); - console.log("... Token approved successfully"); + // const approveDeployHash = await erc20.approve( + // ROUTERKEYS, + // PACKAGE_HASH!, + // AMOUNT_B_DESIRED!, + // APPROVE_PAYMENT_AMOUNT! + // ); + // console.log("... Approve deploy hash: ", approveDeployHash); + + // await getDeploy(NODE_ADDRESS!, approveDeployHash); + // console.log("... Token approved successfully"); // // //transfer // // const transferDeployHash = await erc20.transfer( diff --git a/routes/pairroutes.js b/routes/pairroutes.js index 8a79c78a..c7c3a000 100644 --- a/routes/pairroutes.js +++ b/routes/pairroutes.js @@ -70,9 +70,17 @@ router message: "spender not found in request body", }); } - + let data = await AllcontractsData.findOne({ + packageHash: req.body.contractHash, + }); + if (data == null) { + return res.status(400).json({ + success: false, + message: "pair not found against this package hash ", + }); + } let allowance = await pair.allowance( - req.body.contractHash, + data.contractHash, req.body.owner, req.body.spender );