added fetch_config function to fetch configs from our FLO address

This commit is contained in:
Abhishek Sinha 2018-10-23 20:15:01 +05:30
parent 6989c93717
commit be2efeb1e8

View File

@ -7420,9 +7420,7 @@
<!-- Keys Object Operations (Generate, Sign and Verify) -->
<script>
var wallets = localbitcoinplusplus.wallets = function (wallets) {
//3354E12F0D2737A16B30B46D66CEDB9C7C0CD35F22CFCCE9828318DDBB73C0F6 // private key
this.master_node = "038E48297353843614190D9C36D1F6565D68CB24C01A66DC7432BD91D979F7AC68"; // pub key
this.rm_flo_addr = "FSTDEb1ygMSwKB65uMYrrzjhdcCpXkt1uH";
//
};
wallets.prototype = {
ecparams: EllipticCurve.getSECCurveByName("secp256k1"),
@ -7542,6 +7540,9 @@
/*Initiate trade level with 0*/
var Trade = localbitcoinplusplus.trade = function processTrade() {
//this.op_code = null;
//3354E12F0D2737A16B30B46D66CEDB9C7C0CD35F22CFCCE9828318DDBB73C0F6 // private key
const MASTER_NODE = "038E48297353843614190D9C36D1F6565D68CB24C01A66DC7432BD91D979F7AC68"; // pub key
const RM_FLO_ADDR = "FSTDEb1ygMSwKB65uMYrrzjhdcCpXkt1uH";
this.errors = [];
this.level = 0; // default
this.order_type = null;
@ -7550,12 +7551,19 @@
this.valid_product = ["BTC", "INR"];
this.currency = null;
this.valid_currencies = ["BTC", "INR"],
this.buy_price = null;
this.buy_price = null;
this.buyer_public_key = null;
this.buyer_key_signature = null;
this.order_validator_public_key = null;
this.rpc_job = null;
this.floAddress = null;
this.fetch_configs= function(callback) {
this.floAddress = RM_FLO_ADDR;
this.parse_flo_comments(function (floData) {
callback(floData);
});
}
}
Trade.prototype = {
@ -7657,7 +7665,6 @@
if (request.status >= 200 && request.status < 400) {
data.txs.forEach(tx => {
console.log(tx.floData);
callback(tx.floData);
});
} else {
@ -7666,6 +7673,7 @@
}
request.send();
}
}
</script>
@ -7950,13 +7958,12 @@
var RM_TRADE = new localbitcoinplusplus.trade;
var RM_RPC = new localbitcoinplusplus.rpc;
// Test: fetch flo comment
RM_TRADE.floAddress = RM_WALLET.rm_flo_addr;
var fetch_configs = RM_TRADE.parse_flo_comments(function (floData) {
console.log(floData);
//Test: fetch flo comment
var rm_configs = RM_TRADE.fetch_configs(function(data) {
console.log(data);
});
// Test: Trade functionality
// // Test: Trade functionality
var trade_btn = document.createElement("button");
trade_btn.innerText = "Trade";
trade_btn.onclick = function () {