Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
readwasm endpoint added
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammad-Mubeen committed Apr 19, 2022
1 parent 81cb55b commit 99d045d
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ CALLEE_CONTRACT=c981f2165686f3fa8ab77f89b3ac364987325e48a038f6fbdfd6bb46123f0e3c
CALLEE_PACKAGE=dec17bf68eeb83be7e96e5974981c64772a2f48e402fe95b63877bf50df7854e
TOKEN0_CONTRACT=238834bc76aed9e18ad0260e65d2ef751999c97c13da92dee83bd511e31e2d2d
TOKEN0_CONTRACT_PACKAGE=afcaa550ebb63266fb2752b58ecd7e8fcd78e0a75777ecd57045213a013d9813
TOKEN1_CONTRACT=9aef66efbac45daf71f92f3446422a00fd3adaaf206a1c29d80f26bc513c105d
TOKEN1_CONTRACT_PACKAGE=03e3e09b28dc4d41a4507b38073e7a1641becc0b40e79beb72733d2fb022defa
TOKEN1_CONTRACT=5240db456a1a2cb63cabcdebb86a5177d0e9ceddab7a737b3bd90caeae33e80e
TOKEN1_CONTRACT_PACKAGE=bdcd8c9844cd2f98c81b3f98ce806f20c5a625f954d7b29bf70626fef060ff1f

DAI_CONTRACT=1fe0d3e12e456b482f0f82a86b914d34cc4f4e51fd021316f3702906aacd0943
DAI_PACKAGE=58d6f4bfc63ab3d16685d576e4ecce3d6ab0f4bcf5c553b8c398a3c34ebc7e86
Expand All @@ -42,7 +42,7 @@ WCSPR_WETH_CONTRACT=cdba28c1136debb97e650e9355a4495dfe67408968601c68951212abda06
WCSPR_WETH_CONTRACT_PACKAGE=cb0f9f291ae73928b739c90c03eca70cd610d945304ea606fe4adced3fa07060


GRAPHQL=https://casper-uniswap-v2-graphql.herokuapp.com/graphql
GRAPHQL=http://v2casperswapgraphqlbackend-env.eba-npfjx8q6.us-east-1.elasticbeanstalk.com/graphql
CHAIN_NAME=casper-test
NODE_ADDRESS=http://159.65.118.250:7777/rpc
EVENT_STREAM_ADDRESS=http://159.65.118.250:9999/events/main
Expand Down
2 changes: 1 addition & 1 deletion JsClients/ERC20/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEABlCsNxb/OaC2a+wgP6NAOREjfCfPs4+kOz2jnpCfw7Y=
MCowBQYDK2VwAyEAXU0jCEGukxOfIxJFl0aPTp1/f2hHn1OUzNAHmBRmFQQ=
-----END PUBLIC KEY-----
2 changes: 1 addition & 1 deletion JsClients/ERC20/keys/public_key_hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
010650ac3716ff39a0b66bec203fa3403911237c27cfb38fa43b3da39e909fc3b6
015d4d230841ae93139f23124597468f4e9d7f7f68479f5394ccd0079814661504
2 changes: 1 addition & 1 deletion JsClients/ERC20/keys/secret_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIPw2THQrmfrBz8VgHfmmuE04dGPwYmPuiBjT2bkgrXKo
MC4CAQAwBQYDK2VwBCIEIGmu6s8jhbAznIU8GvBRnQcX9OfuEejuYpmqAuP+Xovs
-----END PRIVATE KEY-----
18 changes: 9 additions & 9 deletions JsClients/ERC20/test/installed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,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);
// 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");
// await getDeploy(NODE_ADDRESS!, approveDeployHash);
// console.log("... Token approved successfully");

// // //transfer
// // const transferDeployHash = await erc20.transfer(
Expand Down
2 changes: 1 addition & 1 deletion JsClients/FACTORY/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEABlCsNxb/OaC2a+wgP6NAOREjfCfPs4+kOz2jnpCfw7Y=
MCowBQYDK2VwAyEAXU0jCEGukxOfIxJFl0aPTp1/f2hHn1OUzNAHmBRmFQQ=
-----END PUBLIC KEY-----
2 changes: 1 addition & 1 deletion JsClients/FACTORY/keys/public_key_hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
010650ac3716ff39a0b66bec203fa3403911237c27cfb38fa43b3da39e909fc3b6
015d4d230841ae93139f23124597468f4e9d7f7f68479f5394ccd0079814661504
2 changes: 1 addition & 1 deletion JsClients/FACTORY/keys/secret_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIPw2THQrmfrBz8VgHfmmuE04dGPwYmPuiBjT2bkgrXKo
MC4CAQAwBQYDK2VwBCIEIGmu6s8jhbAznIU8GvBRnQcX9OfuEejuYpmqAuP+Xovs
-----END PRIVATE KEY-----
2 changes: 1 addition & 1 deletion JsClients/PAIR/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEABlCsNxb/OaC2a+wgP6NAOREjfCfPs4+kOz2jnpCfw7Y=
MCowBQYDK2VwAyEAXU0jCEGukxOfIxJFl0aPTp1/f2hHn1OUzNAHmBRmFQQ=
-----END PUBLIC KEY-----
2 changes: 1 addition & 1 deletion JsClients/PAIR/keys/public_key_hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
010650ac3716ff39a0b66bec203fa3403911237c27cfb38fa43b3da39e909fc3b6
015d4d230841ae93139f23124597468f4e9d7f7f68479f5394ccd0079814661504
2 changes: 1 addition & 1 deletion JsClients/PAIR/keys/secret_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIPw2THQrmfrBz8VgHfmmuE04dGPwYmPuiBjT2bkgrXKo
MC4CAQAwBQYDK2VwBCIEIGmu6s8jhbAznIU8GvBRnQcX9OfuEejuYpmqAuP+Xovs
-----END PRIVATE KEY-----
2 changes: 1 addition & 1 deletion JsClients/ROUTER/keys/public_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEABlCsNxb/OaC2a+wgP6NAOREjfCfPs4+kOz2jnpCfw7Y=
MCowBQYDK2VwAyEAXU0jCEGukxOfIxJFl0aPTp1/f2hHn1OUzNAHmBRmFQQ=
-----END PUBLIC KEY-----
2 changes: 1 addition & 1 deletion JsClients/ROUTER/keys/public_key_hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
010650ac3716ff39a0b66bec203fa3403911237c27cfb38fa43b3da39e909fc3b6
015d4d230841ae93139f23124597468f4e9d7f7f68479f5394ccd0079814661504
2 changes: 1 addition & 1 deletion JsClients/ROUTER/keys/secret_key.pem
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIPw2THQrmfrBz8VgHfmmuE04dGPwYmPuiBjT2bkgrXKo
MC4CAQAwBQYDK2VwBCIEIGmu6s8jhbAznIU8GvBRnQcX9OfuEejuYpmqAuP+Xovs
-----END PRIVATE KEY-----
Binary file added JsClients/ROUTER/wasm/purse-proxy.wasm
Binary file not shown.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var pairRouter = require("./routes/pairroutes");
var erc20Router = require("./routes/erc20routes");
var coinsmarketcapapiRouter = require("./routes/coinsmarketcapapi");
var pathRouter = require("./routes/pathroutes");
var readWasmRouter = require("./routes/readWasm");

// view engine setup
app.set("views", path.join(__dirname, "views"));
Expand Down Expand Up @@ -81,6 +82,7 @@ app.use("/", pairRouter);
app.use("/", erc20Router);
app.use("/", coinsmarketcapapiRouter);
app.use("/", pathRouter);
app.use("/", readWasmRouter);

app.use(
"/graphql",
Expand Down
27 changes: 27 additions & 0 deletions routes/readWasm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require("dotenv").config();
var express = require("express");
var router = express.Router();
var routerJsClient=require('../JsClients/ROUTER/src/utils')

router.route("/getWasmData").get(async function (req, res, next) {
try {

let wasmData= routerJsClient.getBinary('JsClients/ROUTER/wasm/purse-proxy.wasm');
console.log(wasmData)

return res.status(200).json({
success: true,
message: "Wasm data successfully read and converted. ",
wasmData: wasmData,
});

} catch (error) {
console.log("error (try-catch) : " + error);
return res.status(500).json({
success: false,
err: error,
});
}
});

module.exports = router;

0 comments on commit 99d045d

Please sign in to comment.