diff --git a/supernode/cash_payments_handler.html b/supernode/cash_payments_handler.html index 31b70fc..8f05913 100644 --- a/supernode/cash_payments_handler.html +++ b/supernode/cash_payments_handler.html @@ -129,18 +129,10 @@ @@ -174,72 +166,91 @@ This page is to be used by Localbitcoinplusplus Cashiers as a tool to manage cash deposits and withdraws.

+ +
+
+ +

+

+

+ Rupee

+

+

+

+
+
-
-
-
+ -
- - - - - - - - - - - - -
User UPI IdUser FLO IdDepositing AmountCurrencyAction
+
+
+ + + + + + + + + + + + +
User UPI IdUser FLO IdDepositing AmountCurrencyAction
+
-
- - - - - - - - - - - - - -
User UPI IdUser FLO IdWithdrawal AmountCurrencyTxidAction
+
+
+ + + + + + + + + + + + + +
User UPI IdUser FLO IdWithdrawal AmountCurrencyTxidAction
+
@@ -13815,18 +13826,68 @@ }); } + async function transferTokensManually() { + try { + const token_sender = localbitcoinplusplus.wallets.my_local_flo_address; + const token_balance_url = `${localbitcoinplusplus.server.flo_api_testnet}/api/v1.0/getFloAddressBalance?token=${token_name}&floAddress=${token_sender}`; + const sender_token_balance = await helper_functions.ajaxGet(token_balance_url); + const token_receiver = document.getElementById('token_receiver').value; + const send_tokens_btn = document.getElementById('send_tokens_btn'); + const token_amount = Number(document.getElementById('token_amount').value); + const token_name = document.querySelector('input[name="transfer_token_name"]:checked').value; + const flo_comment = `transfer ${token_amount} ${token_name}# to ${token_receiver}`; + + let err_msg = ''; + + if(typeof sender_token_balance!=="object" + || typeof sender_token_balance.balance!=="number" + || sender_token_balance.balance{ + let flo_txid = ''; + const RM_WALLET = new localbitcoinplusplus.wallets; + const flo_tx = await RM_WALLET.sendTransaction( + localbitcoinplusplus.assets.FLO, + localbitcoinplusplus.wallets.my_local_flo_address, + localbitcoinplusplus.wallets.MY_SUPERNODE_PRIVATE_KEY, + token_receiver, + token_amount, + localbitcoinplusplus.wallets.my_local_flo_address, + flo_comment + ); + if (typeof flo_tx.txid == "string" && + flo_tx.txid.length > 0 + ) { + resp_obj = JSON.parse(flo_tx.txid); + flo_txid = resp_obj.txid.result || resp_obj.txid; + } + if (typeof flo_txid!=="string" || flo_txid.length < 1) { + err_msg = `Error: Failed to broadcast token transfer transaction.`; + showMessage(err_msg); + reject(err_msg); + } else { + showMessage(`INFO: Successful token transfer txid: ${flo_txid}`); + showMessage(`INFO: ${token_amount} ${token_name} transferred to ${token_receiver}.`); + resolve(flo_txid); + } + }) + } + + } catch (error) { + throw new Error(error); + } + } + // Reset Flo Id function loadResetFloBtnUi() { // RESET KEYS - const reset_flo_keys_div = document.getElementById("flo_keys_div"); - const reset_flo_keys_btn = document.createElement("button"); - reset_flo_keys_btn.className += ` button bg-purple mg-5 `; - const reset_flo_keys_btn_text = document.createTextNode( - `Reset FLO Keys` - ); - reset_flo_keys_btn.appendChild(reset_flo_keys_btn_text); - reset_flo_keys_div.appendChild(reset_flo_keys_btn); - + const reset_flo_keys_btn = document.getElementById("flo_keys_reset"); + reset_flo_keys_btn.onclick = function() { if ( confirm( @@ -13849,9 +13910,6 @@ const dataBaseUIOperations = async function() { localbitcoinplusplus.is_ui_loaded = true; - //const RM_WALLET = new localbitcoinplusplus.wallets(); - //const RM_RPC = new localbitcoinplusplus.rpc(); - try { readDB("paymentsHandlerDetails", "00-01").then(async function( idbData @@ -13966,6 +14024,9 @@ dataBaseUIOperations(); } + // load token transfer ui + transferTokensManually(); + resolve(true); return; } else { @@ -14018,6 +14079,9 @@ dataBaseUIOperations(); } + // load token transfer ui + transferTokensManually(); + resolve(true); }); });