diff --git a/index.html b/index.html index 9dbd52f..d34b22d 100644 --- a/index.html +++ b/index.html @@ -684,6 +684,8 @@ sessionStorage[ "determined_feerate" ] = sessionStorage[ "feerate" ]; } + let base_size = 160; + for(let i = 0; i < files.length; i++) { @@ -716,9 +718,12 @@ if(files[i].sha256 == '') { - txsize = 300 + Math.floor(files[i].hex.length / 2); + base_size = Math.floor(data.length / 4) * i; + txsize = 200 + Math.floor(data.length / 4); } + console.log("TXSIZE", txsize); + let fee = feerate * txsize; total_fee += fee; @@ -744,7 +749,7 @@ let decodedToAddress = "5120" + BTON.Tap.decodeAddress( toAddress ).hex; console.log('To address decoded:', decodedToAddress ); - let total_fees = 550 + (50 * inscriptions.length) + total_fee + ( padding * inscriptions.length ); + let total_fees = 550 + (base_size * inscriptions.length) + total_fee + (padding * inscriptions.length); let sats_price = await satsToDollars( total_fees ); sats_price = Math.floor( sats_price * 100 ) / 100; @@ -808,7 +813,7 @@ console.log('Init TX', _txid); - let count = 0; + let include_mempool = true; async function inscribe(inscription, vout) { @@ -816,19 +821,6 @@ // we are running into an issue with 25 child transactions for unconfirmed parents. // so once the limit is reached, we wait for the parent tx to confirm. - let include_mempool = true; - - console.log("count", count); - - if(count >= 23){ - - console.log('Excluding Mempool!'); - - include_mempool = false; - } - - count += 1; - await loopTilAddressReceivesMoney(inscription.inscriptionAddress, include_mempool); await waitSomeSeconds( 2 ); let txinfo2 = await addressReceivedMoneyInThisTx( inscription.inscriptionAddress ); @@ -865,17 +857,18 @@ // since we don't know any mempool space api rate limits, we will be careful with spamming await isPushing(); pushing = true; - try{ - - _txid2 = await pushBTCpmt( rawtx2 ); - } - catch(e) - { - _txid2 = e.toString(); - } + _txid2 = await pushBTCpmt( rawtx2 ); await sleep(1000); pushing = false; + if(_txid2.includes('descendant')) + { + include_mempool = false; + inscribe(inscription, vout); + $('#descendants-warning').style.display = 'inline-block'; + return; + } + try { JSON.parse(_txid2); @@ -1091,7 +1084,9 @@ if ( !data_i_seek ) { setTimeout( async function() { console.log( "waiting for address to receive money..." ); - itReceivedMoney = await addressOnceHadMoney( address, includeMempool ); + try { + itReceivedMoney = await addressOnceHadMoney(address, includeMempool); + }catch(e){ } let msg = await isDataSetYet( itReceivedMoney ); resolve( msg ); }, 2000 ); @@ -1361,7 +1356,11 @@ init( 0 );
- + diff --git a/signet-bootstrap.html b/signet-bootstrap.html index c846757..eb92576 100644 --- a/signet-bootstrap.html +++ b/signet-bootstrap.html @@ -1,148 +1,148 @@ - - - - - + + + + + - + - + - + - + - + - + - + - Inscribe the planet - - - - - - - - - - - + + + + + + + + + - - + async function getBitcoinPrice() { + let prices = []; + let cbprice = await getBitcoinPriceFromCoinbase(); + let kprice = await getBitcoinPriceFromKraken(); + let cdprice = await getBitcoinPriceFromCoindesk(); + let gprice = await getBitcoinPriceFromGemini(); + let bprice = await getBitcoinPriceFromBybit(); + prices.push( Number( cbprice ), Number( kprice ), Number( cdprice ), Number( gprice ), Number( bprice ) ); + prices.sort(); + return prices[ 2 ]; + } + + + -
+
-
-
-
+
+
+
-
+
-
+
-

Inscribe the Planet

+

Inscribe the Planet

+
+ +
+ +
+
+
+ +
+
+
+
+
+ +

This tool may not work in safari browser. If you are using that, consider switching.

+
+ +
+ +
-
+ -
-
-
+
-
-
-
-
-
- -

This tool may not work in safari browser. If you are using that, consider switching.

-
- -
- - -
- - - - - -
- + - -
+ +
-
- -
+
+ +
-
+
-
- - -
- -
- - -
- -
- - -
- -
- -
- -
- - -
- -
- - -
- -
- - -
- -
- - 61 - -

Select a feerate (sats/vB)

-
-
-
...
-
Min
-
-
-
...
-
Mid
-
-
-
...
-
Max
-
-
-
- - -
- -
- - + + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + 61 + +

Select a feerate (sats/vB)

+
+
+
...
+
Min
+
+
+
...
+
Mid
+
+
+
...
+
Max
-
- - +
+ +
-
- - + + +
+ +
+
+ + +
+
+ +
-
-
+ + + +
- - -
- - - - - - + await sleep(1000); + } + + if(inscribed_already.length != 0) + { + alert("The following files are inscribed already: " + inscribed_already.join(', ')); + } + + if(errors.length != 0) + { + alert("Could not check the following files due to an error: " + inscribed_already.join(', ')); + } + + if(inscribed_already.length == 0) + { + alert("Your files seem not to be inscribed yet."); + } + + $('#bytes_checker').innerHTML = 'Check if file(s) are inscribed already'; + } + + async function init( num ) { + if ( !num ) { + let isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + if ( isSafari ) $( '.safari_warning' ).style.display = "block"; + let minfee = await getMinFeeRate(); + $( '#sats_per_byte' ).innerText = minfee; + $( '#sats_range' ).value = minfee; + } + num = num + 1; + let allrates = await getAllFeeRates(); + $( '.minfee .num' ).innerText = allrates[ "minimumFee" ]; + $( '.midfee .num' ).innerText = allrates[ "hourFee" ]; + $( '.maxfee .num' ).innerText = allrates[ "fastestFee" ]; + let isgreen; + $$( '.fee .num' ).forEach( function( item ) { + if ( item.style.backgroundColor == "green" || getComputedStyle( item ).backgroundColor == "rgb(0, 128, 0)" ) isgreen = item; + }); + if ( isgreen ) { + $( '#sats_per_byte' ).innerText = Number( isgreen.innerText ); + $( '#sats_range' ).value = Number( isgreen.innerText ); + sessionStorage[ "feerate" ] = isgreen.innerText; + } + sessionStorage[ "bitcoin_price" ] = await getBitcoinPrice(); + await waitSomeSeconds( 10 ); + init( num ); + } + init( 0 ); + +
+ + + + + + diff --git a/signet.html b/signet.html index 4327776..7c1f505 100644 --- a/signet.html +++ b/signet.html @@ -712,6 +712,8 @@ sessionStorage["determined_feerate"] = sessionStorage["feerate"]; } + let base_size = 160; + for (let i = 0; i < files.length; i++) { const hex = files[i].hex; @@ -743,7 +745,8 @@ if(files[i].sha256 == '') { - txsize = 300 + Math.floor(files[i].hex.length / 2); + base_size = Math.floor(data.length / 4) * i; + txsize = 200 + Math.floor(data.length / 4); } console.log("TXSIZE", txsize); @@ -773,7 +776,7 @@ let decodedToAddress = "5120" + BTON.Tap.decodeAddress(toAddress).hex; console.log('To address decoded:', decodedToAddress); - let total_fees = 550 + (50 * inscriptions.length) + total_fee + (padding * inscriptions.length); + let total_fees = 550 + (base_size * inscriptions.length) + total_fee + (padding * inscriptions.length); let sats_price = await satsToDollars(total_fees); sats_price = Math.floor(sats_price * 100) / 100; @@ -836,26 +839,13 @@ console.log('Init TX', _txid); - let count = 0; + let include_mempool = true; async function inscribe(inscription, vout) { // we are running into an issue with 25 child transactions for unconfirmed parents. // so once the limit is reached, we wait for the parent tx to confirm. - let include_mempool = true; - - console.log("count", count); - - if(count >= 23){ - - console.log('Excluding Mempool!'); - - include_mempool = false; - } - - count += 1; - await loopTilAddressReceivesMoney(inscription.inscriptionAddress, include_mempool); await waitSomeSeconds(2); let txinfo2 = await addressReceivedMoneyInThisTx(inscription.inscriptionAddress); @@ -892,23 +882,26 @@ // since we don't know any mempool space api rate limits, we will be careful with spamming await isPushing(); pushing = true; - try{ - - _txid2 = await pushBTCpmt( rawtx2 ); - } - catch(e) - { - _txid2 = e.toString(); - } + _txid2 = await pushBTCpmt( rawtx2 ); await sleep(1000); pushing = false; + if(_txid2.includes('descendant')) + { + include_mempool = false; + inscribe(inscription, vout); + $('#descendants-warning').style.display = 'inline-block'; + return; + } + try { + JSON.parse(_txid2); let html = `

Error: ${_txid2}

`; html += '
'; $('.modal').innerHTML += html; + } catch (e) { let html = `

Inscription #${vout} transaction:

https://mempool.space/${mempoolNetwork}tx/${_txid2}

`; @@ -1133,7 +1126,9 @@ if (!data_i_seek) { setTimeout(async function () { console.log("waiting for address to receive money..."); - itReceivedMoney = await addressOnceHadMoney(address, includeMempool); + try { + itReceivedMoney = await addressOnceHadMoney(address, includeMempool); + }catch(e){ } let msg = await isDataSetYet(itReceivedMoney); resolve(msg); }, 2000); @@ -1407,6 +1402,7 @@