From aeacc5b70ed77328b07969545ecb2ee17556c10c Mon Sep 17 00:00:00 2001 From: politeWall <138504353+politeWall@users.noreply.github.com> Date: Wed, 22 Nov 2023 17:06:16 +0100 Subject: [PATCH] feat: update FE script --- README.md | 1 + front_end_script/upload.js | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index bb35d67..85d8f92 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ A spot order is fulfilled when the specified price set by the trader aligns with - **Stop Loss Functionality**: Enable users to set automated orders that trigger when the asset's price reaches a specified lower limit, minimizing potential losses. - **Limit Sell Functionality**: Allow users to set automated orders that execute when the asset's price reaches a specified upper limit, securing profits. - **Limit Buy Fuctionality**: Allow user to set automated orders that execute when the limit price is reaches, securing profits. +- **Market Buy Fuctionality**: Allow users to set automated orders that will execute at market price ### Margin Order diff --git a/front_end_script/upload.js b/front_end_script/upload.js index 30f9fe5..0aedaa1 100644 --- a/front_end_script/upload.js +++ b/front_end_script/upload.js @@ -158,3 +158,25 @@ async function getSpotOrders(pagination, order_type, owner_address) { ); console.log(`Result: `, result); } + +async function SwapEstimationByDenom(amount, denom_in, denom_out) { + const sender_wallet = await DirectSecp256k1HdWallet.fromMnemonic( + sender.mnemonic, + { prefix: "elys" } + ); + const sender_client = await SigningCosmWasmClient.connectWithSigner( + rpcEndpoint, + sender_wallet + ); + const result = await sender_client.queryContractSmart( + trade_shield_contract_addr, + { + swap_estimation_by_denom: { + amount: amount, + denom_in: denom_in, + denom_out: denom_out, + }, + } + ); + console.log(`Result: `, result); +}