#0
bitcom
0.00000000 BSV
j"1ChDHzdd1H4wSjgGMHyndZm6qxEDGjqpJLM ~.from(this.hashes[r],"hex"));for(e.writeVarintNum(this.flags.length),r=0;r<this.flags.length;r++)e.writeUInt8(this.flags[r]);return e},X.prototype.toObject=X.prototype.toJSON=function(){return{header:this.header.toObject(),numTransactions:this.numTransactions,hashes:this.hashes,flags:this.flags}},X.prototype.validMerkleTree=function(){if(me.checkState(Nd.isArray(this.flags),"MerkleBlock flags is not an array"),me.checkState(Nd.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)return!1;if(8*this.flags.length<this.hashes.length)return!1;var e=this._calcTreeHeight(),r={hashesUsed:0,flagBitsUsed:0},a=this._traverseMerkleTree(e,0,r);return r.hashesUsed===this.hashes.length&&kj.equals(a,this.header.merkleRoot)},X.prototype.filterdTxsHash=function(){if(me.checkState(Nd.isArray(this.flags),"MerkleBlock flags is not an array"),me.checkState(Nd.isArray(this.hashes),"MerkleBlock hashes is not an array"),this.hashes.length>this.numTransactions)throw new El.MerkleBlock.InvalidMerkleTree;if(8*this.flags.length<this.hashes.length)throw new El.MerkleBlock.InvalidMerkleTree;if(1===this.hashes.length)return[];var e=this._calcTreeHeight(),r={hashesUsed:0,flagBitsUsed:0},a=this._traverseMerkleTree(e,0,r,!0);if(r.hashesUsed!==this.hashes.length)throw new El.MerkleBlock.InvalidMerkleTree;return a},X.prototype._traverseMerkleTree=function(e,r,a,t){if((a=a||{}).txs=a.txs||[],a.flagBitsUsed=a.flagBitsUsed||0,a.hashesUsed=a.hashesUsed||0,t=t||!1,a.flagBitsUsed>8*this.flags.length)return null;var $=this.flags[a.flagBitsUsed>>3]>>>(7&a.flagBitsUsed++)&1;if(0!==e&&$){var s=this._traverseMerkleTree(e-1,2*r,a),i=s;return 2*r+1<this._calcTreeWidth(e-1)&&(i=this._traverseMerkleTree(e-1,2*r+1,a)),t?a.txs:kP.sha256sha256(xh.concat([s,i]))}if(a.hashesUsed>=this.hashes.length)return null;var h=this.hashes[a.hashesUsed++];return 0===e&&$&&a.txs.push(h),xh.from(h,"hex")},X.prototype._calcTreeWidth=function(e){return this.numTransactions+(1<<e)-1>>e},X.prototype._calcTreeHeight=function(){for(var e=0;this._calcTreeWidth(e)>1;)e++;return e},X.prototype.hasTransaction=function(e){me.checkArgument(!Nd.isUndefined(e),"tx cannot be undefined"),me.checkArgument(e instanceof zn||"string"==typeof e,"Invalid tx given, tx must be a \"string\" or \"Transaction\"");var r=e;e instanceof zn&&(r=kj.reverse(xh.from(e.id,"hex")).toString("hex"));var a=[],t=this._calcTreeHeight();return this._traverseMerkleTree(t,0,{txs:a}),-1!==a.indexOf(r)},X._fromBufferReader=function(e){me.checkState(!e.finished(),"No merkleblock data received");var r={};r.header=Ad.fromBufferReader(e),r.numTransactions=e.readUInt32LE();var a=e.readVarintNum();r.hashes=[];for(var t=0;t<a;t++)r.hashes.push(e.read(32).toString("hex"));var $=e.readVarintNum();for(r.flags=[],t=0;t<$;t++)r.flags.push(e.readUInt8());return r},X.fromObject=function(e){return new X(e)},Np=X;($r=UO).BlockHeader=Ad,$r.MerkleBlock=Np;var jm,hm,ha,am,Gs,uP,yi,rs,Mi,Sd,pl,sr,er,wf,Lb,_g,gp,D,HP=false;function c(e){if(e instanceof c)return e;if(!(this instanceof c))return new c(e);if(e){if(ha.isString(e)||D.isBuffer(e)){var r=c.getSerializedError(e);if(r){if(D.isBuffer(e)&&!c.getSerializedError(e.toString()))return this._buildFromSerialized(e.toString());if(r instanceof Lb.ArgumentIsPrivateExtended)return new Mi(e).hdPublicKey;throw r}return this._buildFromSerialized(e)}if(ha.isObject(e))return e instanceof Mi?this._buildFromPrivate(e):this._buildFromObject(e);throw new Lb.UnrecognizedArgument(e)}throw new Lb.MustSupplyArgument}function Bn(){if(HP)return;HP=true;jm={};hm=(k(),j).Buffer;ha=(C(),E);am=(G(),H);Gs=(Ja(),Ka);uP=(vi(),Di);yi=(Tf(),eg);rs=(Pa(),Oa);Mi=(Wm(),hn);Sd=(Ud(),je);pl=(ue(),re);sr=(ic(),ac);er=(ub(),yb);wf=er;Lb=er.HDPublicKey;_g=(uf(),Jg);gp=(Ha(),Ca);D=(T(),N);c.fromHDPrivateKey=function(e){return new c(e)},c.isValidPath=function(e){if(ha.isString(e)){var r=Mi._getDerivationIndexes(e);return null!==r&&ha.every(r,c.isValidPath)}return!!ha.isNumber(e)&&e>=0&&e<c.Hardened},c.prototype.derive=function(){throw new Error("derive has been deprecated. use deriveChild or, for the old way, deriveNonCompliantChild.")},c.prototype.deriveChild=function(e,r){if(ha.isNumber(e))return this._deriveWithNumber(e,r);if(ha.isString(e))return this._deriveFromString(e);throw new Lb.InvalidDerivationArgument(e)},c.prototype._deriveWithNumber=function(e,r){if(e>=c.Hardened||r)throw new Lb.InvalidIndexCantDeriveHardened;if(e<0)throw new Lb.InvalidPath(e);var $,i=D.integerAsBuffer(e),t=D.concat([this.publicKey.toBuffer(),i]),a=rs.sha512hmac(t,this._buffers.chainCode),n=Gs.fromBuffer(a.slice(0,32),{size:32}),u=a.slice(32,64);try{$=sr.fromPoint(pl.getG().mul(n).add(this.publicKey.point))}catch(H){return this._deriveWithNumber(e+1)}return new c({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:u,publicKey:$})},c.prototype._deriveFromString=function(e){if(ha.includes(e,"'"))throw new Lb.InvalidIndexCantDeriveHardened;if(!c.isValidPath(e))throw new Lb.InvalidPath(e);return Mi._getDerivationIndexes(e).reduce(function(e,r){return e._deriveWithNumber(r)},this)},c.isValidSerialized=function(e,r){return ha.isNull(c.getSerializedError(e,r))},c.getSerializedError=function(e,r){if(!ha.isString(e)&&!D.isBuffer(e))return new Lb.UnrecognizedArgument("expected buffer or string");if(!uP.validCharacters(e))return new wf.InvalidB58Char("(unknown)",e);try{e=yi.decode(e)}catch(t){return new wf.InvalidB58Checksum(e)}if(e.length!==c.DataSize)return new Lb.InvalidLength(e);if(!ha.isUndefined(r)){var $=c._validateNetwork(e,r);if($)return $}var i=D.integerFromBuffer(e.slice(0,4));return i===Sd.livenet.xprivkey||i===Sd.testnet.xprivkey?new Lb.ArgumentIsPrivateExtended:null},c._validateNetwork=function(e,r){var $=Sd.get(r);if(!$)return new wf.InvalidNetworkArgument(r);var i=e.slice(c.VersionStart,c.VersionEnd);return D.integerFromBuffer(i)!==$.xpubkey?new wf.InvalidNetwork(i):null},c.prototype._buildFromPrivate=function(e){var r=ha.clone(e._buffers),$=pl.getG().mul(Gs.fromBuffer(r.privateKey));return r.publicKey=pl.pointToCompressed($),r.version=D.integerAsBuffer(Sd.get(D.integerFromBuffer(r.version)).xpubkey),r.privateKey=void 0,r.checksum=void 0,r.xprivkey=void 0,this._buildFromBuffers(r)},c.prototype._buildFromObject=function(e){var r={version:e.network?D.integerAsBuffer(Sd.get(e.network).xpubkey):e.version,depth:ha.isNumber(e.depth)?D.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:ha.isNumber(e.parentFingerPrint)?D.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:ha.isNumber(e.childIndex)?D.integerAsBuffer(e.childIndex):e.childIndex,chainCode:ha.isString(e.chainCode)?D.hexToBuffer(e.chainCode):e.chainCode,publicKey:ha.isString(e.publicKey)?D.hexToBuffer(e.publicKey):D.isBuffer(e.publicKey)?e.publicKey:e.publicKey.toBuffer(),checksum:ha.isNumber(e.checksum)?D.integerAsBuffer(e.checksum):e.checksum};return this._buildFromBuffers(r)},c.prototype._buildFromSerialized=function(e){var r=yi.decode(e),$={version:r.slice(c.VersionStart,c.VersionEnd),depth:r.slice(c.DepthStart,c.DepthEnd),parentFingerPrint:r.slice(c.ParentFingerPrintStart,c.ParentFingerPrintEnd),childIndex:r.slice(c.ChildIndexStart,c.ChildIndexEnd),chainCode:r.slice(c.ChainCodeStart,c.ChainCodeEnd),publicKey:r.slice(c.PublicKeyStart,c.PublicKeyEnd),checksum:r.slice(c.ChecksumStart,c.ChecksumEnd),xpubkey:e};return this._buildFromBuffers($)},c.prototype._buildFromBuffers=function(e){c._validateBufferArguments(e),gp.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,e.publicKey],$=D.concat(r),i=yi.checksum($);if(e.checksum&&e.checksum.length){if(e.checksum.toString("hex")!==i.toString("hex"))throw new wf.InvalidB58Checksum($,i)}else e.checksum=i;var t,a=Sd.get(D.integerFromBuffer(e.version));t=yi.encode(D.concat(r)),e.xpubkey=hm.from(t);var n=new sr(e.publicKey,{network:a}),u=c.ParentFingerPrintSize,H=rs.sha256ripemd160(n.toBuffer()).slice(0,u);return gp.defineImmutable(this,{xpubkey:t,network:a,depth:D.integerFromSingleByteBuffer(e.depth),publicKey:n,fingerPrint:H}),this},c._validateBufferArguments=function(e){var r=function(r,$){var i=e[r];_g(D.isBuffer(i),r+" argument is not a buffer, it's "+typeof i),_g(i.length===$,r+" has not the expected size: found "+i.length+", expected "+$)};r("version",c.VersionSize),r("depth",c.DepthSize),r("parentFingerPrint",c.ParentFingerPrintSize),r("childIndex",c.ChildIndexSize),r("chainCode",c.ChainCodeSize),r("publicKey",c.PublicKeySize),e.checksum&&e.checksum.length&&r("checksum",c.CheckSumSize)},c.fromString=function(e){return am.checkArgument(ha.isString(e),"No valid string was provided"),new c(e)},c.fromObject=function(e){return am.checkArgument(ha.isObject(e),"No valid argument was provided"),new c(e)},c.prototype.toString=function(){return this.xpubkey},c.prototype.inspect=function(){return"<HDPublicKey: "+this.xpubkey+">"},c.prototype.toObject=c.prototype.toJSON=function(){return{network:Sd.get(D.integerFromBuffer(this._buffers.version)).name,depth:D.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:D.integerFromBuffer(this.fingerPrint),parentFingerPrint:D.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:D.integerFromBuffer(this._buffers.childIndex),chainCode:D.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:D.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},c.fromBuffer=function(e){return new c(e)},c.fromHex=function(e){return c.fromBuffer(hm.from(e,"hex"))},c.prototype.toBuffer=function(){return D.copy(this._buffers.xpubkey)},c.prototype.toHex=function(){return this.toBuffer().toString("hex")},c.Hardened=2147483648,c.RootElementAlias=["m","M"],c.VersionSize=4,c.DepthSize=1,c.ParentFingerPrintSize=4,c.ChildIndexSize=4,c.ChainCodeSize=32,c.PublicKeySize=33,c.CheckSumSize=4,c.DataSize=78,c.SerializedByteSize=82,c.VersionStart=0,c.VersionEnd=c.VersionStart+c.VersionSize,c.DepthStart=c.VersionEnd,c.DepthEnd=c.DepthStart+c.DepthSize,c.ParentFingerPrintStart=c.DepthEnd,c.ParentFingerPrintEnd=c.ParentFingerPrintStart+c.ParentFingerPrintSize,c.ChildIndexStart=c.ParentFingerPrintEnd,c.ChildIndexEnd=c.ChildIndexStart+c.ChildIndexSize,c.ChainCodeStart=c.ChildIndexEnd,c.ChainCodeEnd=c.ChainCodeStart+c.ChainCodeSize,c.PublicKeyStart=c.ChainCodeEnd,c.PublicKeyEnd=c.PublicKeyStart+c.PublicKeySize,c.ChecksumStart=c.PublicKeyEnd,c.ChecksumEnd=c.ChecksumStart+c.CheckSumSize,_g(c.PublicKeyEnd===c.DataSize),_g(c.ChecksumEnd===c.SerializedByteSize),jm=c}var hn,gh,hh,Df,ca,gm,Sl,RP,Gf,xk,Td,VP,Pr,XP,Le,bc,L,Zf,aQ,Ip,cQ,dQ=false;function b(e){if(e instanceof b)return e;if(!(this instanceof b))return new b(e);if(!e)return this._generateRandomly();if(Td.get(e))return this._generateRandomly(e);if(ca.isString(e)||L.isBuffer(e)){if(b.isValidSerialized(e))this._buildFromSerialized(e);else if(Zf.isValidJSON(e))this._buildFromJSON(e);else{if(!L.isBuffer(e)||!b.isValidSerialized(e.toString()))throw b.getSerializedError(e);this._buildFromSerialized(e.toString())}}else{if(!ca.isObject(e))throw new bc.UnrecognizedArgument(e);this._buildFromObject(e)}}function Wm(){if(dQ)return;dQ=true;hn={};gh=(k(),j).Buffer;hh=(uf(),Jg);Df=(k(),j);ca=(C(),E);gm=(G(),H);Sl=(Ja(),Ka);RP=(vi(),Di);Gf=(Tf(),eg);xk=(Pa(),Oa);Td=(Ud(),je);VP=(ue(),re);Pr=(Oh(),Eh);XP=(zh(),sh);Le=(ub(),yb);bc=Le.HDPrivateKey;L=(T(),N);Zf=(Ha(),Ca);aQ=128;Ip=1/8;cQ=512;b.fromRandom=function(){return new b},b.isValidPath=function(e,r){if(ca.isString(e)){var $=b._getDerivationIndexes(e);return null!==$&&ca.every($,b.isValidPath)}return!!ca.isNumber(e)&&(e<b.Hardened&&!0===r&&(e+=b.Hardened),e>=0&&e<b.MaxIndex)},b._getDerivationIndexes=function(e){var r=e.split("/");if(ca.includes(b.RootElementAlias,e))return[];if(!ca.includes(b.RootElementAlias,r[0]))return null;var $=r.slice(1).map(function(e){var r="'"===e.slice(-1);if(r&&(e=e.slice(0,-1)),!e||"-"===e[0])return NaN;var $=+e;return r&&($+=b.Hardened),$});return ca.some($,isNaN)?null:$},b.prototype.derive=function(){throw new Error("derive has been deprecated. use deriveChild or, for the old way, deriveNonCompliantChild.")},b.prototype.deriveChild=function(e,r){if(ca.isNumber(e))return this._deriveWithNumber(e,r);if(ca.isString(e))return this._deriveFromString(e);throw new bc.InvalidDerivationArgument(e)},b.prototype.deriveNonCompliantChild=function(e,r){if(ca.isNumber(e))return this._deriveWithNumber(e,r,!0);if(ca.isString(e))return this._deriveFromString(e,!0);throw new bc.InvalidDerivationArgument(e)},b.prototype._deriveWithNumber=function(e,r,$){if(!b.isValidPath(e,r))throw new bc.InvalidPath(e);r=e>=b.Hardened||r,e<b.Hardened&&!0===r&&(e+=b.Hardened);var v,i=L.integerAsBuffer(e);if(r&&$){var t=this.privateKey.bn.toBuffer();v=L.concat([Df.Buffer.from([0]),t,i])}else if(r){var a=this.privateKey.bn.toBuffer({size:32});hh(32===a.length,"length of private key buffer is expected to be 32 bytes"),v=L.concat([Df.Buffer.from([0]),a,i])}else v=L.concat([this.publicKey.toBuffer(),i]);var y=xk.sha512hmac(v,this._buffers.chainCode),n=Sl.fromBuffer(y.slice(0,32),{size:32}),w=y.slice(32,64),z=n.add(this.privateKey.toBigNumber()).umod(VP.getN()).toBuffer({size:32});return Pr.isValid(z)?new b({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:e,chainCode:w,privateKey:z}):this._deriveWithNumber(e+1,null,$)},b.prototype._deriveFromString=function(e,r){if(!b.isValidPath(e))throw new bc.InvalidPath(e);return b._getDerivationIndexes(e).reduce(function(e,$){return e._deriveWithNumber($,null,r)},this)},b.isValidSerialized=function(e,r){return!b.getSerializedError(e,r)},b.getSerializedError=function(e,r){if(!ca.isString(e)&&!L.isBuffer(e))return new bc.UnrecognizedArgument("Expected string or buffer");if(!RP.validCharacters(e))return new Le.InvalidB58Char("(unknown)",e);try{e=Gf.decode(e)}catch(v){return new Le.InvalidB58Checksum(e)}if(e.length!==b.DataLength)return new bc.InvalidLength(e);if(!ca.isUndefined(r)){var $=b._validateNetwork(e,r);if($)return $}return null},b._validateNetwork=function(e,r){var $=Td.get(r);if(!$)return new Le.InvalidNetworkArgument(r);var v=e.slice(0,4);return L.integerFromBuffer(v)!==$.xprivkey?new Le.InvalidNetwork(v):null},b.fromString=function(e){return gm.checkArgument(ca.isString(e),"No valid string was provided"),new b(e)},b.fromObject=function(e){return gm.checkArgument(ca.isObject(e),"No valid argument was provided"),new b(e)},b.prototype._buildFromJSON=function(e){return this._buildFromObject(JSON.parse(e))},b.prototype._buildFromObject=function(e){var r={version:e.network?L.integerAsBuffer(Td.get(e.network).xprivkey):e.version,depth:ca.isNumber(e.depth)?L.integerAsSingleByteBuffer(e.depth):e.depth,parentFingerPrint:ca.isNumber(e.parentFingerPrint)?L.integerAsBuffer(e.parentFingerPrint):e.parentFingerPrint,childIndex:ca.isNumber(e.childIndex)?L.integerAsBuffer(e.childIndex):e.childIndex,chainCode:ca.isString(e.chainCode)?L.hexToBuffer(e.chainCode):e.chainCode,privateKey:ca.isString(e.privateKey)&&Zf.isHexa(e.privateKey)?L.hexToBuffer(e.privateKey):e.privateKey,checksum:e.checksum?e.checksum.length?e.checksum:L.integerAsBuffer(e.checksum):void 0};return this._buildFromBuffers(r)},b.prototype._buildFromSerialized=function(e){var r=Gf.decode(e),$={version:r.slice(b.VersionStart,b.VersionEnd),depth:r.slice(b.DepthStart,b.DepthEnd),parentFingerPrint:r.slice(b.ParentFingerPrintStart,b.ParentFingerPrintEnd),childIndex:r.slice(b.ChildIndexStart,b.ChildIndexEnd),chainCode:r.slice(b.ChainCodeStart,b.ChainCodeEnd),privateKey:r.slice(b.PrivateKeyStart,b.PrivateKeyEnd),checksum:r.slice(b.ChecksumStart,b.ChecksumEnd),xprivkey:e};return this._buildFromBuffers($)},b.prototype._generateRandomly=function(e){return b.fromSeed(XP.getRandomBuffer(64),e)},b.fromSeed=function(e,r){if(Zf.isHexaString(e)&&(e=L.hexToBuffer(e)),!gh.isBuffer(e))throw new bc.InvalidEntropyArgument(e);if(e.length<aQ*Ip)throw new bc.InvalidEntropyArgument.NotEnoughEntropy(e);if(e.length>cQ*Ip)throw new bc.InvalidEntropyArgument.TooMuchEntropy(e);var $=xk.sha512hmac(e,Df.Buffer.from("Bitcoin seed"));return new b({network:Td.get(r)||Td.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:$.slice(0,32),chainCode:$.slice(32,64)})},b.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=(Bn(),jm);this._hdPublicKey=new e(this)}},b.prototype._buildFromBuffers=function(e){b._validateBufferArguments(e),Zf.defineImmutable(this,{_buffers:e});var r=[e.version,e.depth,e.parentFingerPrint,e.childIndex,e.chainCode,L.emptyBuffer(1),e.privateKey],$=Df.Buffer.concat(r);if(e.checksum&&e.checksum.length){if(e.checksum.toString()!==Gf.checksum($).toString())throw new Le.InvalidB58Checksum($)}else e.checksum=Gf.checksum($);var v,i=Td.get(L.integerFromBuffer(e.version));v=Gf.encode(Df.Buffer.concat(r)),e.xprivkey=gh.from(v);var t=new Pr(Sl.fromBuffer(e.privateKey),i),a=t.toPublicKey(),y=b.ParentFingerPrintSize,n=xk.sha256ripemd160(a.toBuffer()).slice(0,y);return Zf.defineImmutable(this,{xprivkey:v,network:i,depth:L.integerFromSingleByteBuffer(e.depth),privateKey:t,publicKey:a,fingerPrint:n}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},b._validateBufferArguments=function(e){var r=function(r,$){var v=e[r];hh(L.isBuffer(v),r+" argument is not a buffer"),hh(v.length===$,r+" has not the expected size: found "+v.length+", expected "+$)};r("version",b.VersionSize),r("depth",b.DepthSize),r("parentFingerPrint",b.ParentFingerPrintSize),r("childIndex",b.ChildIndexSize),r("chainCode",b.ChainCodeSize),r("privateKey",b.PrivateKeySize),e.checksum&&e.checksum.length&&r("checksum",b.CheckSumSize)},b.prototype.toString=function(){return this.xprivkey},b.prototype.inspect=function(){return"<HDPrivateKey: "+this.xprivkey+">"},b.prototype.toObject=b.prototype.toJSON=function(){return{network:Td.get(L.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:L.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:L.integerFromBuffer(this.fingerPrint),parentFingerPrint:L.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:L.integerFromBuffer(this._buffers.childIndex),chainCode:L.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:L.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},b.fromBuffer=function(e){return new b(e.toString())},b.fromHex=function(e){return b.fromBuffer(gh.from(e,"hex"))},b.prototype.toBuffer=function(){return gh.from(this.toString())},b.prototype.toHex=function(){return this.toBuffer().toString("hex")},b.DefaultDepth=0,b.DefaultFingerprint=0,b.DefaultChildIndex=0,b.Hardened=2147483648,b.MaxIndex=2*b.Hardened,b.RootElementAlias=["m","M","m'","M'"],b.VersionSize=4,b.DepthSize=1,b.ParentFingerPrintSize=4,b.ChildIndexSize=4,b.ChainCodeSize=32,b.PrivateKeySize=32,b.CheckSumSize=4,b.DataLength=78,b.SerializedByteSize=82,b.VersionStart=0,b.VersionEnd=b.VersionStart+b.VersionSize,b.DepthStart=b.VersionEnd,b.DepthEnd=b.DepthStart+b.DepthSize,b.ParentFingerPrintStart=b.DepthEnd,b.ParentFingerPrintEnd=b.ParentFingerPrintStart+b.ParentFingerPrintSize,b.ChildIndexStart=b.ParentFingerPrintEnd,b.ChildIndexEnd=b.ChildIndexStart+b.ChildIndexSize,b.ChainCodeStart=b.ChildIndexEnd,b.ChainCodeEnd=b.ChainCodeStart+b.ChainCodeSize,b.PrivateKeyStart=b.ChainCodeEnd+1,b.PrivateKeyEnd=b.PrivateKeyStart+b.PrivateKeySize,b.ChecksumStart=b.PrivateKeyEnd,b.ChecksumEnd=b.ChecksumStart+b.CheckSumSize,hh(b.ChecksumEnd===b.SerializedByteSize),hn=b}p.version="v"+pz.version,p.versionGuard=function(r){if(void 0!==r){console.warn("\n More than one instance of bsv found.\n Please make sure to require bsv and check that submodules do\n not also include their own bsv dependency.")}},p.versionGuard(Q._bsv),Q._bsv=p.version,p.crypto={},p.crypto.BN=(Ja(),Ka),p.crypto.ECDSA=(ms(),gt),p.crypto.Hash=(Pa(),Oa),p.crypto.Random=(zh(),sh),p.crypto.Point=(ue(),re),p.crypto.Signature=(Ob(),Rb),p.encoding={},p.encoding.Base58=(vi(),Di),p.encoding.Base58Check=(Tf(),eg),p.encoding.BufferReader=(cd(),gd),p.encoding.BufferWriter=(Zb(),kc),p.encoding.Varint=(vf(),lf),p.util={},p.util.buffer=(T(),N),p.util.js=(Ha(),Ca),p.util.preconditions=(G(),H),p.errors=(ub(),yb),p.Address=(_e(),Ke),p.Block=$r,p.MerkleBlock=Np,p.BlockHeader=Ad,p.HDPrivateKey=(Wm(),hn),p.HDPublicKey=(Bn(),jm),p.Networks=(Ud(),je),p.Opcode=(jl(),Cl),p.PrivateKey=(Oh(),Eh),p.PublicKey=(ic(),ac),p.Script=(vb(),xb),p.Transaction=(mi(),td),p.deps={},p.deps.bnjs=(Z(),Y),p.deps.bs58=(Bp(),Dp),p.deps.Buffer=oz,p.deps.elliptic=(Da(),ya),p.deps._=(C(),E),p.Transaction.sighash=(vd(),_c);var gQ,hQ,iQ,jQ,kg={},um=kg&&kg.__assign||function(){return(um=Object.assign||function($){for(var t,a=1,r=arguments.length;a<r;a++)for(var o in t=arguments[a])Object.prototype.hasOwnProperty.call(t,o)&&($[o]=t[o]);return $}).apply(this,arguments)},dk="";try{dk=tc.location.hostname+tc.location.href+tc.location.protocol}catch(e){var tc={location:{hostname:dk,href:dk,protocol:dk}}}var Rs="file:"===tc.location.protocol||["localhost","127.0.0.1"].includes(tc.location.hostname),Js=96e3,mg={doLog:!0,dustLimit:547,enforceHttps:!1,preClearLocalStorage:!1,pushNotificationFromMovements:!0,fixedRandomWallet:null,refreshUtxosInterval:3e4,skipLoadingAnimation:!1,voidLogging:!/\?.*?log/.test(tc.location.href),autoSplit:!/\?.*?nosplit/.test(tc.location.href),network:/\?.*?stn/.test(tc.location.href)?"stn":/\?.*?testnet/.test(tc.location.href)?"test":"main",checkLocalParts:!0};Rs&&!jQ&&((mg=um({},mg,{doLog:!0,enforceHttps:!1,preClearLocalStorage:!1,pushNotificationFromMovements:!1,refreshUtxosInterval:2e4,skipLoadingAnimation:!1,voidLogging:!1,network:"main",checkLocalParts:!1})).fixedRandomWallet="stn"===mg.network?iQ:"test"===mg.network?hQ:gQ);var ys=Js+mg.dustLimit+256,xs=0,Wi=2,uQ=ys*(1+(xs+Wi)/100),Kl=um({},mg,{chunkSize:Js,nickelSatMin:ys,nickelSatMax:uQ,donate:(xs-Wi)/100,untrack:Wi/100,re:{ignoreFiles:/^\.DS_Store$/},bitcomNamespace:{b:"19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut",bcat:"15DHFxWZJT58f9nhyGnsRBqrgwK4W6h4Up",bcatPart:"1ChDHzdd1H4wSjgGMHyndZm6qxEDGjqpJL",d:"19iG3WTYSsbyos3uJ733yK4zEioi1FesNU",c:"1KCm9cgDdT7r88WRQmm6gynFNmTrskdygn"},DEV:Rs,maxInputPerTx:645,maxOutputPerTx:2e3,multiAdrFeeBuffer:16,maxPartsInBcat:3010});kg.default=Kl;var Jl={};var qb={};function yQ(r){for(var e,$=r.length-1;$>0;$--){var t=Math.floor(Math.random()*($+1));e=[r[t],r[$]],r[$]=e[0],r[t]=e[1]}return r}const Gp=["bytes","kB","MB","GB","TB","PB","EB","ZB","YB"],yp=(t,e)=>{let r=t;return"string"==typeof e?r=t.toLocaleString(e):!0===e&&(r=t.toLocaleString()),r};var BQ=function(t,e){if(!Number.isFinite(t))throw new TypeError(`Expected a finite number, got ${typeof t}: ${t}`);if((e=Object.assign({},e)).signed&&0===t)return" 0 B";const r=t<0,o=r?"-":e.signed?"+":"";if(r&&(t=-t),t<1){return o+yp(t,e.locale)+" B"}const $=Math.min(Math.floor(Math.log10(t)/3),Gp.length-1);return t=Number((t/Math.pow(1e3,$)).toPrecision(e.precision||3)),o+yp(t,e.locale)+" "+Gp[$]};qb.shipRawTx=il,qb.niceByte=BQ,qb.shuffle=yQ;function CQ(r,e){if(void 0===e&&(e={}),/`/.test(r))throw"Template contains a \"`\"";return new Function("env","_","return `"+r.replace("`","")+"`")(Kl,e)}qb.strTmpl=CQ;var DQ=Promise.any||function(r){return new Promise(function(e,$,t,n){t=[],n=r.map(function(r,o){return Promise.resolve(r).then(e,function(r){return t[o]=r,--n||$({errors:t})})}).length})};qb.any=DQ;var qj={},Li={WALLET:{WIF:"wallet.WIF",ADDRESS:"wallet.address",QR:"wallet.qr",BALANCE:"wallet.balance",OTHER_BALANCE:"wallet.otherBalance",NICKEL_BALANCE:"wallet.nickelBalance",UPDATING:"wallet.updating",UPDATED_ONCE:"wallet.updatedOnce",BALANCE_OLD:"wallet.balanceOld",INCOMMING_NICKELS:"wallet.incommingNikels",CURRENT_NICKELS:"wallet.currentNickels",FUTURE_NICKELS:"wallet.futureNickels",UTXO:{ALL:"wallet.utxo.all",NICKEL:{CONFIRMED:"wallet.utxo.nickel.confirmed",CONFIRMED_SAT:"wallet.utxo.nickel.confirmedSat",UNCONFIRMED:"wallet.utxo.nickel.unconfirmed",UNCONFIRMED_SAT:"wallet.utxo.nickel.unconfirmedSat"},OTHER:{CONFIRMED:"wallet.utxo.other.confirmed",CONFIRMED_SAT:"wallet.utxo.other.confirmedSat",UNCONFIRMED:"wallet.utxo.other.unconfirmed",UNCONFIRMED_SAT:"wallet.utxo.other.unconfirmedSat"},TOTAL_SAT:"wallet.utxo.totalSat",CONFIRMED_SAT:"wallet.utxo.confirmedSat",UNCONFIRMED_SAT:"wallet.utxo.unconfirmedSat",CONFIRMED_PCT:"wallet.utxo.confirmedPct",UNCONFIRMED_PCT:"wallet.utxo.unconfirmedPct"}},ENDPOINT:{UTXOS:{URL:"https://api.bitindex.network/api/v3/${env.network}/addr/${_.address}/utxo",API_KEY:"5eTuVfKYpWiaRWaEBN5NF1VPKf9Tvm2HBXh9mmigjNG2iC94ZCnut1SMb3sNV4hwV4"},TX_SEND:{URL:"https://api.bitindex.network/api/v3/${env.network}/tx/send",URL2:"https://api.whatsonchain.com/v1/bsv/${env.network}/tx/raw",API_KEY:"5eTuVfKYpWiaRWaEBN5NF1VPKf9Tvm2HBXh9mmigjNG2iC94ZCnut1SMb3sNV4hwV4"},MOVEMENT:["https://chronos.bitdb.network/s/1P6o45vqLdo6X8HRCZk8XuDsniURmXqiXo","https://neongenesis.bitdb.network/s/1HcBPzWoKDL2FhCMbocQmLuFTYsiD73u1j","https://genesis.bitdb.network/s/1FnauZ9aUH2Bex6JzdcV4eNX7oLSSEbxtN"]},EVENT:{PLZ_USE_MB:"plzUseMb",PLZ_ADD_KEY:"plzAddKey",PLZ_MAKE_KEY:"plzMakeKey",PLZ_FORGET_ME:"plzForgetMe",PLZ_INFO_DROP_FILES:"plzInfoDrop",PLZ_INFO_PASTE:"plzInfoPaste",TX_MOVED:"txMoved",FILES_SELECTED:"filesSelected"},FILES:"files"};qj.default=Li;var il=function(t,n,r){void 0===n&&(n=1),void 0===r&&(r=1);var o=[HQ,Is];r<1&&(o=[Is]);var $=[];return qb.shuffle(o),o.slice(0,Math.max(1,n)).forEach(function(n){$.push(n(t).then(function(t){if(!t.ok)return t.json().then(function(t){throw t})}))}),qb.any($)};function HQ(t){var n=qb.strTmpl(Li.ENDPOINT.TX_SEND.URL);return fetch(n,{method:"POST",body:JSON.stringify({rawtx:t}),headers:{api_key:Li.ENDPOINT.TX_SEND.API_KEY,"Content-Type":"application/json"}})}function Is(t){var n=qb.strTmpl(Li.ENDPOINT.TX_SEND.URL2);return fetch(n,{method:"POST",body:JSON.stringify({rawtx:t}),headers:{"Content-Type":"application/json"}})}Jl.default=il;var zd={},gn=zd&&zd.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(o,i){function s(t){try{a(n.next(t))}catch(e){i(e)}}function u(t){try{a(n.throw(t))}catch(e){i(e)}}function a(t){t.done?o(t.value):new r(function(e){e(t.value)}).then(s,u)}a((n=n.apply(t,e||[])).next())})},wm=zd&&zd.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue;}i=e.call(t,s)}catch(u){i=[6,u],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},fm=function(){function t(t){this.concurrency=t.concurrency||1,this.chill=t.chill||!0,this.paused=t.paused||!1,this.running=0,this.retryMax=t.retryMax||0,this.retryCooling=t.retryCooling||50,this.q=[]}return t.prototype.tick=function(){return gn(this,void 0,void 0,function(){var t,e,r=this;return wm(this,function(n){return this.paused?[2]:this.concurrency<=this.running?[2]:(t=this.q.shift())?(this.running++,e=function(){return gn(r,void 0,void 0,function(){var e,r,n=this;return wm(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,t.task()];case 1:return e=o.sent(),[3,3];case 2:return r=o.sent(),this.running--,this.retryMax<0||t.retries++<this.retryMax?setTimeout(function(){n.q.unshift(t),n.next()},this.retryCooling):t.reject(r),[2,this.next()];case 3:return this.running--,t.resolve(e),[2,this.next()];}})})},this.chill?Promise.resolve(setTimeout(function(){return e()},0)):Promise.resolve(e()),[2]):[2]})})},t.prototype.add=function(t){var e=this;if("function"!=typeof t)throw"Please pass a function";return new Promise(function(r,n){e.q.push({task:t,resolve:r,reject:n,retried:0}),e.tick()})},t.prototype.pause=function(){this.paused=!0},t.prototype.restart=function(){for(this.paused=!1;this.q.length&&this.running<=this.concurrency;)this.tick()},t.prototype.next=function(){var t=this;return this.chill?setTimeout(function(){t.tick()},0):this.tick()},t}();zd.default=fm;var ft=ed&&ed.__awaiter||function(e,r,n,o){return new(n||(n=Promise))(function(t,f){function $(e){try{i(o.next(e))}catch(r){f(r)}}function a(e){try{i(o.throw(e))}catch(r){f(r)}}function i(e){e.done?t(e.value):new n(function(r){r(e.value)}).then($,a)}i((o=o.apply(e,r||[])).next())})},nq=ed&&ed.__generator||function(e,r){var n,o,t,f,$={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return f={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(f[Symbol.iterator]=function(){return this}),f;function a(f){return function(a){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;$;)try{if(n=1,o&&(t=2&f[0]?o.return:f[0]?o.throw||((t=o.return)&&t.call(o),0):o.next)&&!(t=t.call(o,f[1])).done)return t;switch(o=0,t&&(f=[2&f[0],t.value]),f[0]){case 0:case 1:t=f;break;case 4:return $.label++,{value:f[1],done:!1};case 5:$.label++,o=f[1],f=[0];continue;case 7:f=$.ops.pop(),$.trys.pop();continue;default:if(!(t=(t=$.trys).length>0&&t[t.length-1])&&(6===f[0]||2===f[0])){$=0;continue}if(3===f[0]&&(!t||f[1]>t[0]&&f[1]<t[3])){$.label=f[1];break}if(6===f[0]&&$.label<t[1]){$.label=t[1],t=f;break}if(t&&$.label<t[2]){$.label=t[2],$.ops.push(f);break}t[2]&&$.ops.pop(),$.trys.pop();continue;}f=r.call(e,$)}catch(a){f=[6,a],o=0}finally{n=t=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([f,a])}}},PQ=new fm({concurrency:1}),Kt=Kl,vz=console.log;self.onmessage=function(e){return ft(ed,void 0,void 0,function(){var r,n,o,t;return nq(this,function(f){return r=JSON.parse(e.data),vz(Object.keys(r)),r.env?[2,Kt=r.env]:(n=r.destinationAddress,o=r.privateKey,t=r.utxos,PQ.add(function(){return aj(n,o,t)}),[2])})})};var bq=0,dd=function(){return"MV"+bq+")"};function aj(e,r,n,o){return void 0===o&&(o=-1),ft(this,void 0,void 0,function(){var t,f,$;return nq(this,function(a){if((t=n.reduce(function(e,r){return e+r.satoshis},0))<Kt.dustLimit)return[2];var $ys1A$$interop$default=QQ(p);bq++,console.log(dd(),"Creating tx to move "+n.length+" UTXOs with "+t+" satoshi"),f=new $ys1A$$interop$default.d.Transaction().from(n).change(e).sign(r);try{$=f.serialize()}catch(i){return console.warn(i),[2,jk(e,r,n,o)]}return 1e5<$.length/2?[2,jk(e,r,n,o)]:(console.log(dd(),"Move tx:",f.hash),console.log(dd(),"Move tx size:",$.length/2),console.log(dd(),"Move tx fee:",f.getFee()),console.groupCollapsed(dd(),"Move tx full"),console.log($),console.log(f),console.groupEnd(),console.log(dd(),"Sending move tx"),[2,il($,1/0).then(function(){return console.log(dd(),"Move done")}).catch(function(){console.warn(dd(),"Oh! Looks like you reached the speed limit. Will try again in one minute."),jk(e,r,n,o)})])})})}function jk(e,r,n,o){var t,f,$=n.reduce(function(e,r){return e+r.satoshis},0);o<10||$<10*Kt.nickelSatMax||n.length<10?(t=n,f=[]):(t=n.splice(0,n.length/2),f=n.splice(n.length/2)),setTimeout(function(){aj(e,r,t,++o),aj(e,r,f,++o)},6e4)}if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=ed}else if(typeof define==="function"&&define.amd){define(function(){return ed})}kg.__esModule=true;Jl.__esModule=true;qb.__esModule=true;qj.__esModule=true;zd.__esModule=true;return{"hffB":ed,"ys1A":p,"70rD":(qe(),{}),"dskh":(k(),j),"DlZn":(uf(),Jg),"FN88":(Sb(),Bb),"4Bm0":(i(),e),"fnRj":(kh(),ih),"t0b9":(ni(),li),"+ghX":kg,"G6Oj":Jl,"2JC8":qb,"jovf":qj,"o3w4":zd};});
https://whatsonchain.com/tx/b61a9fdc8e39035aa2af01ccd6793c40e16fc5ba534c7ccdd54c8568ff35af86