|
45 | 45 |
|
46 | 46 |
|
47 | 47 | <script> |
48 | | - |
49 | | -// Initialize values used in pre-flight send checks |
50 | | -FW.SEND_TYPE = 'send'; |
51 | | -FW.SEND_DESTINATION = ''; |
52 | | - |
53 | 48 | // Handle generating a transaction using current data and passing it to a callback function |
54 | 49 | function generateTransaction(callback=null, broadcast=false){ |
55 | 50 | var vals = array2Object($('#send-form').serializeArray()), |
|
61 | 56 | command = (broadcast) ? 'cpSend' : 'createSend'; |
62 | 57 | // Single Sends |
63 | 58 | if(vals.type=='single'){ |
64 | | - if(FW.SEND_TYPE=='dispense') |
65 | | - command = (broadcast) ? 'cpDispense' : 'createDispense'; |
66 | 59 | // Placeholder to easily reference destinations in updateTransactionSize() |
67 | 60 | FW.SEND_DESTINATIONS = vals.destination; |
68 | 61 | eval(command)(network, vals.source, vals.destination, vals.memo, is_data, vals.name, amt_sat, fee_sat, callback); |
|
110 | 103 | } |
111 | 104 | } |
112 | 105 |
|
113 | | - |
114 | | - |
115 | | -// Handle checking a destination address to determine if it has an active dispenser on it |
116 | | -function checkDestinationForDispenser(){ |
117 | | - var vals = array2Object($('#send-form').serializeArray()); |
118 | | - if(vals.type=='single' && isValidAddress(vals.destination) && vals.name=='BTC' && vals.amount>0 && vals.destination!=FW.SEND_DESTINATION){ |
119 | | - // Set flag so we only check the address for dispensers once |
120 | | - FW.SEND_DESTINATION = vals.destination; |
121 | | - getDispensersList(FW.SEND_DESTINATION, null, 'open', function(o){ |
122 | | - var found = false; |
123 | | - o.forEach(function(item){ |
124 | | - // Detect open and closing soon dispensers |
125 | | - if(item.status==0 || item.status==11) |
126 | | - found = true; |
127 | | - }); |
128 | | - // Prompt user if they are sending to a dispenser |
129 | | - if(found){ |
130 | | - var title = 'Sending to Dispenser?'; |
131 | | - msg = getConfirmationMessage('<center>Are you trying to send BTC to a dispenser?</b></center>'); |
132 | | - dialogConfirm(title, msg, false, true, function(){ |
133 | | - FW.SEND_TYPE = 'dispense'; |
134 | | - // Force update of transaction size so we make call to API to generate dispense (larger tx than a send as it requires an OP_RETURN) |
135 | | - updateTransactionSize(); |
136 | | - }); |
137 | | - } |
138 | | - }); |
139 | | - } |
140 | | -} |
141 | | - |
142 | | - |
143 | 106 | $(document).ready(function(){ |
144 | 107 |
|
145 | 108 | // Load form field |
|
0 commit comments