From 2154cfa4bcf2a4743a0d8307426f4cd25b1a5548 Mon Sep 17 00:00:00 2001 From: homura Date: Thu, 28 Oct 2021 19:25:07 +0800 Subject: [PATCH 1/6] feat: supported ckb2021 vm version selection https://github.com/nervosnetwork/rfcs/blob/c0aacf775a347ec44b3b0c02ba6dd67a5a47128c/rfcs/0032-ckb-vm-version-selection/0032-ckb-vm-version-selection.md --- src/normalizers.js | 4 ++++ src/validators.js | 8 ++++---- tests/serializers.js | 17 +++++++++++++++++ tests/validators.js | 11 +++++++++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/normalizers.js b/src/normalizers.js index 4f0eace..5409b95 100644 --- a/src/normalizers.js +++ b/src/normalizers.js @@ -77,10 +77,14 @@ export function NormalizeScript(script, { debugPath = "script" } = {}) { return 0; case "type": return 1; + case "data1": + return 2; case 0: return value; case 1: return value; + case 2: + return value; default: throw new Error(`${debugPath}.hash_type has invalid value: ${value}`); } diff --git a/src/validators.js b/src/validators.js index cce14ad..7716fbf 100644 --- a/src/validators.js +++ b/src/validators.js @@ -48,7 +48,7 @@ function assertHexString(debugPath, string) { function assertHash(debugPath, hash) { assertHexString(debugPath, hash); - if (hash.length != 66) { + if (hash.length !== 66) { throw new Error(`${debugPath} must be a hex string of 66 bytes long!`); } } @@ -75,7 +75,7 @@ export function ValidateScript( assertHash(`${debugPath}.code_hash`, script.code_hash); assertHexString(`${debugPath}.args`, script.args); - if (script.hash_type !== "data" && script.hash_type !== "type") { + if (script.hash_type !== "data" && script.hash_type !== "type" && script.hash_type !== "data1") { throw new Error(`${debugPath}.hash_type must be either data or type!`); } } @@ -299,7 +299,7 @@ export function ValidateHeader( [] ); assertHexString(`${debugPath}.nonce`, header.nonce); - if (header.nonce.length != 34) { + if (header.nonce.length !== 34) { throw new Error( `${debugPath}.nonce must be a hex string of 34 bytes long!` ); @@ -308,7 +308,7 @@ export function ValidateHeader( function assertProposalShortId(debugPath, shortId) { assertHexString(debugPath, shortId); - if (shortId.length != 22) { + if (shortId.length !== 22) { throw new Error(`${debugPath} must be a hex string of 22 bytes long!`); } } diff --git a/tests/serializers.js b/tests/serializers.js index efa0698..5ab3f2e 100644 --- a/tests/serializers.js +++ b/tests/serializers.js @@ -18,6 +18,23 @@ test("normalize and serialize script", t => { ); }); +test("normalize and serialize ckb2021 script", t => { + const value = { + code_hash: + "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8", + args: "0xaabbccdd44332211", + hash_type: "data1" + }; + + const normalizedValue = normalizers.NormalizeScript(value); + const serializedValue = CKB.SerializeScript(normalizedValue); + const serializedHex = new Reader(serializedValue).serializeJson(); + t.deepEqual( + serializedHex, + "0x3d0000001000000030000000310000009bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce80208000000aabbccdd44332211" + ); +}); + test("normalize and serialize script with integer hash type", t => { const value = { code_hash: diff --git a/tests/validators.js b/tests/validators.js index dbc334a..d674f4a 100644 --- a/tests/validators.js +++ b/tests/validators.js @@ -11,6 +11,17 @@ test("correct script should pass validation", t => { t.pass(); }); +test("concorect ckb2021 script should pass validation", t => { + validators.ValidateScript({ + code_hash: + "0xa98c57135830e1b91345948df6c4b8870828199a786b26f09f7dec4bc27a73da", + args: "0x1234", + hash_type: "data1" + }); + + t.pass(); +}) + test("correct script with empty args", t => { validators.ValidateScript({ code_hash: From 47f330b102ed0dcd80c939e53223884580348a67 Mon Sep 17 00:00:00 2001 From: homura Date: Thu, 28 Oct 2021 19:31:16 +0800 Subject: [PATCH 2/6] style: prettier --- src/validators.js | 6 +++++- tests/validators.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/validators.js b/src/validators.js index 7716fbf..976ab58 100644 --- a/src/validators.js +++ b/src/validators.js @@ -75,7 +75,11 @@ export function ValidateScript( assertHash(`${debugPath}.code_hash`, script.code_hash); assertHexString(`${debugPath}.args`, script.args); - if (script.hash_type !== "data" && script.hash_type !== "type" && script.hash_type !== "data1") { + if ( + script.hash_type !== "data" && + script.hash_type !== "type" && + script.hash_type !== "data1" + ) { throw new Error(`${debugPath}.hash_type must be either data or type!`); } } diff --git a/tests/validators.js b/tests/validators.js index d674f4a..f5e82c1 100644 --- a/tests/validators.js +++ b/tests/validators.js @@ -20,7 +20,7 @@ test("concorect ckb2021 script should pass validation", t => { }); t.pass(); -}) +}); test("correct script with empty args", t => { validators.ValidateScript({ From 04b78c6904a52428b63c16069f08d4a618007925 Mon Sep 17 00:00:00 2001 From: homura Date: Thu, 28 Oct 2021 19:37:28 +0800 Subject: [PATCH 3/6] chore: upgrade dist file --- dist/ckb-js-toolkit.esm.js | 2 +- dist/ckb-js-toolkit.node.js | 2 +- dist/ckb-js-toolkit.node.js.map | 2 +- dist/ckb-js-toolkit.umd.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/ckb-js-toolkit.esm.js b/dist/ckb-js-toolkit.esm.js index 0c0e94f..83ed4ad 100644 --- a/dist/ckb-js-toolkit.esm.js +++ b/dist/ckb-js-toolkit.esm.js @@ -1 +1 @@ -class t{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class e{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(t,r)}return new t(r)}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var o=i((function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r,n=0;nl.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=h(this,o(l).call(this,t))).sign=r,n}return i(l,r),n(l,[{key:"toDebugString",value:function(){var t=["BigInt["],e=!0,r=!1,n=void 0;try{for(var i,o,a=this[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)o=i.value,t.push((o?(o>>>0).toString(16):o)+", ")}catch(t){r=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw n}}return t.push("]"),t.join("")}},{key:"toString",value:function(){var t=0t||36this.length&&(r=this.length);for(var n=65535&t,i=t>>>16,o=0,a=65535&e,s=e>>>16,_=0;_>>16,c=u(f,n),g=u(f,i),d=u(h,n),p=u(h,i),v=a+(65535&c),b=s+o+(v>>>16)+(c>>>16)+(65535&g)+(65535&d);o=(a=(g>>>16)+(d>>>16)+(65535&p)+(b>>>16))>>>16,a&=65535,s=p>>>16,this.__setDigit(_,65535&v|b<<16)}if(0!==o||0!==a||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(t,e,r){for(var n,i=0,o=0;o>>16,this.__setHalfDigit(e+o,n);return i}},{key:"__inplaceSub",value:function(t,e,r){var n=0;if(1&e){e>>=1;for(var i=this.__digit(e),o=65535&i,a=0;a>>1;a++){var s=t.__digit(a),u=(i>>>16)-(65535&s)-n;n=1&u>>>16,this.__setDigit(e+a,u<<16|65535&o),n=1&(o=(65535&(i=this.__digit(e+a+1)))-(s>>>16)-n)>>>16}var _=t.__digit(a),l=(i>>>16)-(65535&_)-n;if(n=1&l>>>16,this.__setDigit(e+a,l<<16|65535&o),e+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(65535&(i=this.__digit(e+a+1)))-(_>>>16)-n)>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;for(var f=0;f>>16)-(c>>>16)-(n=1&g>>>16);n=1&d>>>16,this.__setDigit(e+f,d<<16|65535&g)}var p=this.__digit(e+f),v=t.__digit(f),b=(65535&p)-(65535&v)-n;n=1&b>>>16;var y=0;0==(1&r)&&(n=1&(y=(p>>>16)-(v>>>16)-n)>>>16),this.__setDigit(e+f,y<<16|65535&b)}return n}},{key:"__inplaceRightShift",value:function(t){if(0!==t){for(var e,r=this.__digit(0)>>>t,n=this.length-1,i=0;i>>t;this.__setDigit(n,r)}}},{key:"__digit",value:function(t){return this[t]}},{key:"__unsignedDigit",value:function(t){return this[t]>>>0}},{key:"__setDigit",value:function(t,e){this[t]=0|e}},{key:"__setDigitGrow",value:function(t,e){this[t]=0|e}},{key:"__halfDigitLength",value:function(){var t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}},{key:"__halfDigit",value:function(t){return 65535&this[t>>>1]>>>((1&t)<<4)}},{key:"__setHalfDigit",value:function(t,e){var r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}}],[{key:"BigInt",value:function(e){var r=Math.floor,n=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if((0|e)===e)return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!n(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var i=l.__fromString(e);if(null===i)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return i}if("boolean"==typeof e)return!0===e?l.__oneDigit(1,!1):l.__zero();if("object"===t(e)){if(e.constructor===l)return e;var o=l.__toPrimitive(e);return l.BigInt(o)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(t){var e=t.length;if(0===e)return 0;if(1===e){var r=t.__unsignedDigit(0);return t.sign?-r:r}var n=t.__digit(e-1),i=_(n),o=32*e-i;if(1024>>=12;var c=f-12,g=12<=f?0:s<<20+f,d=20+f;0>>32-c,g=s<>>32-d,d-=32);var p=l.__decideRounding(t,d,u,s);if((1===p||0===p&&1==(1&g))&&0==(g=g+1>>>0)&&0!=++h>>>20&&(h=0,1023<++a))return t.sign?-1/0:1/0;var v=t.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=v|a|h,l.__kBitConversionInts[0]=g,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(t){if(0===t.length)return t;var e=t.__copy();return e.sign=!t.sign,e}},{key:"bitwiseNot",value:function(t){return t.sign?l.__absoluteSubOne(t).__trim():l.__absoluteAddOne(t,!0)}},{key:"exponentiate",value:function(t,e){if(e.sign)throw new RangeError("Exponent must be positive");if(0===e.length)return l.__oneDigit(1,!1);if(0===t.length)return t;if(1===t.length&&1===t.__digit(0))return t.sign&&0==(1&e.__digit(0))?l.unaryMinus(t):t;if(1=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){var n=1+(r>>>5),i=new l(n,t.sign&&0!=(1&r));i.__initializeDigits();var o=1<<(31&r);return i.__setDigit(n-1,o),i}var a=null,s=t;for(0!=(1&r)&&(a=t),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(t,e){if(0===t.length)return t;if(0===e.length)return e;var r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;var n=new l(r,t.sign!==e.sign);n.__initializeDigits();for(var i=0;il.__absoluteCompare(t,e))return l.__zero();var r,n=t.sign!==e.sign,i=e.__unsignedDigit(0);if(1===e.length&&65535>=i){if(1===i)return n===t.sign?t:l.unaryMinus(t);r=l.__absoluteDivSmall(t,i,null)}else r=l.__absoluteDivLarge(t,e,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(t,e))return t;var r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(t,r);return 0===n?l.__zero():l.__oneDigit(n,t.sign)}var i=l.__absoluteDivLarge(t,e,!1,!0);return i.sign=t.sign,i.__trim()}},{key:"add",value:function(t,e){var r=t.sign;return r===e.sign?l.__absoluteAdd(t,e,r):0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r)}},{key:"subtract",value:function(t,e){var r=t.sign;return r===e.sign?0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r):l.__absoluteAdd(t,e,r)}},{key:"leftShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__rightShiftByAbsolute(t,e):l.__leftShiftByAbsolute(t,e)}},{key:"signedRightShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__leftShiftByAbsolute(t,e):l.__rightShiftByAbsolute(t,e)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(t,e){return 0>l.__compareToBigInt(t,e)}},{key:"lessThanOrEqual",value:function(t,e){return 0>=l.__compareToBigInt(t,e)}},{key:"greaterThan",value:function(t,e){return 0=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.lengthl.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.length>>n)return e}return l.__truncateToNBits(t,e)}},{key:"ADD",value:function(t,e){if(t=l.__toPrimitive(t),e=l.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)&&l.__isBigInt(e))return l.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(t,e){return l.__compare(t,e,0)}},{key:"LE",value:function(t,e){return l.__compare(t,e,1)}},{key:"GT",value:function(t,e){return l.__compare(t,e,2)}},{key:"GE",value:function(t,e){return l.__compare(t,e,3)}},{key:"EQ",value:function(e,r){for(;;){if(l.__isBigInt(e))return l.__isBigInt(r)?l.equal(e,r):l.EQ(r,e);if("number"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("string"==typeof e){if(l.__isBigInt(r))return null!==(e=l.__fromString(e))&&l.equal(e,r);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("boolean"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,+e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("symbol"===t(e)){if(l.__isBigInt(r))return!1;if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else{if("object"!==t(e))return e==r;if("object"===t(r)&&r.constructor!==l)return e==r;e=l.__toPrimitive(e)}}}},{key:"NE",value:function(t,e){return!l.EQ(t,e)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(t,e){var r=new l(1,e);return r.__setDigit(0,t),r}},{key:"__decideRounding",value:function(t,e,r,n){if(0e)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}var o=1<>>20)-1023,n=1+(r>>>5),i=new l(n,0>t),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&r,_=0;if(u>>f,o=o<<32-f|a>>>f,a<<=32-f}else if(u===s)_=32,e=o,o=a;else{var h=u-s;_=32-h,e=o<>>32-h,o=a<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}},{key:"__fromString",value:function(t){var e=11073741824/s)return null;var _=new l(31+(s*a+u>>>l.__kBitsPerCharTableShift)>>>5,!1),f=10>e?e:10,h=10>=l.__kBitsPerCharTableShift;var c=[],g=[],d=!1;do{for(var p,v=0,b=0;;){if(p=void 0,o-48>>>0>>0>>0>>0>>l.__kBitsPerCharTableShift+5;_.__inplaceMultiplyAdd(D,k,P)}while(!y)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i>>u-(o-=32))}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=e-1,a=t.__digit(r-1),s=0|(32*r-_(a)+i-1)/i;if(t.sign&&s++,268435456>>v,c=32-v;c>=i;)u[f--]=l.__kConversionChars[h&o],h>>>=i,c-=i}var b=(h|a<>>i-c;0!==h;)u[f--]=l.__kConversionChars[h&o],h>>>=i;if(t.sign&&(u[f--]="-"),-1!==f)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(t,e,r){var n=t.length;if(0===n)return"";if(1===n){var i=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(i="-"+i),i}var o,a,s=32*n-_(t.__digit(n-1)),u=l.__kMaxBitsPerChar[e]-1,f=s*l.__kBitsPerCharTableMultiplier,h=1+(f=0|(f+=u-1)/u)>>1,c=l.exponentiate(l.__oneDigit(e,!1),l.__oneDigit(h,!1)),g=c.__unsignedDigit(0);if(1===c.length&&65535>=g){(o=new l(t.length,!1)).__initializeDigits();for(var d,p=0,v=2*t.length-1;0<=v;v--)d=p<<16|t.__halfDigit(v),o.__setHalfDigit(v,0|d/g),p=0|d%g;a=p.toString(e)}else{var b=l.__absoluteDivLarge(t,c,!0,!0);o=b.quotient;var y=b.remainder.__trim();a=l.__toStringGeneric(y,e,!0)}o.__trim();for(var m=l.__toStringGeneric(o,e,!0);a.lengthn?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(t,e){if(!0|e){var r=t.sign,n=0>e;if(r!==n)return l.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?l.__absoluteGreater(r):oe)return l.__unequalSign(r);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;l.__kBitConversionDouble[0]=e;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=t.length,a=t.__digit(o-1),s=_(a),u=32*o-s,f=i+1;if(uf)return l.__absoluteGreater(r);var h=1048576|1048575&l.__kBitConversionInts[1],c=l.__kBitConversionInts[0],g=20,d=31-s;if(d!==(u-1)%31)throw new Error("implementation bug");var p,v=0;if(d>>b,h=h<<32-b|c>>>b,c<<=32-b}else if(d===g)v=32,p=h,h=c;else{var y=d-g;v=32-y,p=h<>>32-y,h=c<>>=0)>(p>>>=0))return l.__absoluteGreater(r);if(a>>0,h=c,c=0):p=0;var w=t.__unsignedDigit(m);if(w>p)return l.__absoluteGreater(r);if(we&&t.__unsignedDigit(0)===a(e):0===l.__compareToDouble(t,e)}},{key:"__comparisonResultToBool",value:function(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(l.__isBigInt(t)&&"string"==typeof e)return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("string"==typeof t&&l.__isBigInt(e))return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)){if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}},{key:"__absoluteAdd",value:function(t,e,r){if(t.length>>16)+(s>>>16)+(_>>>16);o=f>>>16,i.__setDigit(a,65535&_|f<<16)}for(;a>>16)+(c>>>16);o=g>>>16,i.__setDigit(a,65535&c|g<<16)}return a>>16)-(s>>>16)-(i=1&u>>>16);i=1&_>>>16,n.__setDigit(o,65535&u|_<<16)}for(;o>>16)-(i=1&h>>>16);i=1&c>>>16,n.__setDigit(o,65535&h|c<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(t,e){var r=2n?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(t,e,r,n){if(0!==e){for(var i=65535&e,o=e>>>16,a=0,s=0,_=0,l=0;l>>16,g=t.__digit(l),d=65535&g,p=g>>>16,v=u(d,i),b=u(d,o),y=u(p,i),m=u(p,o);a=(s=(b>>>16)+(y>>>16)+(65535&m)+(a=(c+=_+a+((h+=s+(65535&v))>>>16)+(v>>>16)+(65535&b)+(65535&y))>>>16))>>>16,s&=65535,_=m>>>16,f=65535&h|c<<16,r.__setDigit(n,f)}for(;0!==a||0!==s||0!==_;n++){var w=r.__digit(n),k=(65535&w)+s,D=(w>>>16)+(k>>>16)+_+a;s=0,_=0,a=D>>>16,w=65535&k|D<<16,r.__setDigit(n,w)}}}},{key:"__internalMultiplyAdd",value:function(t,e,r,n,i){for(var o=r,a=0,s=0;s>>16;var h=u(_>>>16,e),c=(65535&h)+(l>>>16)+o;o=c>>>16,a=h>>>16,i.__setDigit(s,c<<16|65535&f)}if(i.length>n)for(i.__setDigit(n++,o+a);n>>0,a=0|o/e,s=0|(o=((n=0|o%e)<<16|t.__halfDigit(i-1))>>>0)/e;n=0|o%e,r.__setDigit(i>>>1,a<<16|s)}return r}},{key:"__absoluteModSmall",value:function(t,e){for(var r=0,n=2*t.length-1;0<=n;n--)r=0|((r<<16|t.__halfDigit(n))>>>0)%e;return r}},{key:"__absoluteDivLarge",value:function(t,e,r,n){var i=e.__halfDigitLength(),o=e.length,a=t.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var _=new l(i+2>>>1,!1);_.__initializeDigits();var f=l.__clz16(e.__halfDigit(i-1));0>>0;p=0|b/c;for(var y=0|b%c,m=e.__halfDigit(i-2),w=h.__halfDigit(d+i-2);u(p,m)>>>0>(y<<16|w)>>>0&&(p--,!(65535<(y+=c))););}l.__internalMultiplyAdd(e,p,0,o,_);var k=h.__inplaceSub(_,d,i+1);0!==k&&(k=h.__inplaceAdd(e,d,i),h.__setHalfDigit(d+i,h.__halfDigit(d+i)+k),p--),r&&(1&d?g=p<<16:s.__setDigit(d>>>1,g|p))}return n?(h.__inplaceRightShift(f),r?{quotient:s,remainder:h}:h):r?s:void 0}},{key:"__clz16",value:function(t){return _(t)-16}},{key:"__specialLeftShift",value:function(t,e,r){var n=t.length,i=new l(n+r,!1);if(0===e){for(var o=0;o>>32-e;return 0r)throw new RangeError("BigInt too big");var n=r>>>5,i=31&r,o=t.length,a=0!==i&&0!=t.__digit(o-1)>>>32-i,s=o+n+(a?1:0),u=new l(s,t.sign);if(0===i){for(var _=0;_>>32-i;if(a)u.__setDigit(o+n,f);else if(0!==f)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(t,e){var r=t.length,n=t.sign,i=l.__toShiftAmount(e);if(0>i)return l.__rightShiftByMaximum(n);var o=i>>>5,a=31&i,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(t.__digit(o)&(1<>>a,d=r-o-1,p=0;p>>a;f.__setDigit(d,g)}return u&&(f=l.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:"__rightShiftByMaximum",value:function(t){return t?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(t){if(1l.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(e){var r=1>>5,n=new l(r,e.sign),i=r-1,o=0;o>>s}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(t,e,r){for(var n=Math.min,i=t+31>>>5,o=new l(i,r),a=0,s=i-1,u=0,_=n(s,e.length);a<_;a++){var f=e.__digit(a),h=0-(65535&f)-u,c=0-(f>>>16)-(u=1&h>>>16);u=1&c>>>16,o.__setDigit(a,65535&h|c<<16)}for(;a>>16)-(u=1&v>>>16)<<16}else{var b=32-p,y=1<<32-b,m=(65535&y)-(65535&(d=d<>>b))-u;g=65535&m|(y>>>16)-(d>>>16)-(u=1&m>>>16)<<16,g&=y-1}return o.__setDigit(s,g),o.__trim()}},{key:"__digitPow",value:function(t,e){for(var r=1;0>>=1,t*=t;return r}}]),l}(l(Array));return c.__kMaxLength=33554432,c.__kMaxLengthBits=c.__kMaxLength<<5,c.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],c.__kBitsPerCharTableShift=5,c.__kBitsPerCharTableMultiplier=1<a)throw new Error(s);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(s);if(u.find(t=>!n.includes(t)))throw new Error(s)}function s(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function u(t,e){if(s(t,e),66!=e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function _(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function l(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(a(r,t,["code_hash","hash_type","args"],[]),u(r+".code_hash",t.code_hash),s(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function f(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){a(r,t,["tx_hash","index"],[]),u(r+".tx_hash",t.tx_hash),_(r+".index",t.index)}function h(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){a(r,t,["since","previous_output"],[]),_(r+".since",t.since),e&&f(t.previous_output,{debugPath:r+".previous_output"})}function c(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){a(r,t,["capacity","lock"],["type"]),_(r+".capacity",t.capacity),e&&(l(t.lock,{debugPath:r+".lock"}),t.type&&l(t.type,{debugPath:r+".type"}))}function g(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(a(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&f(t.out_point,{debugPath:r+".out_point"})}function d(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}}var S=i((function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:n);!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function _(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},v.call(y.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];w.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function D(t,r){return new Promise((function(n,o){var a=new y(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}D.polyfill=!0,t.fetch||(t.fetch=D,t.Headers=h,t.Request=y,t.Response=w),e.Headers=h,e.Request=y,e.Response=w,e.fetch=D}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}));function x(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const O={get:(t,e,r)=>"send"===e?async()=>{const e=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},C={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},O):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class I{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,C)}static create(t){return new I(t)}}function j(t){return o.BigInt(t)}function R(t){return"0x"+t.toString(16)}function z(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=R(o.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&n.byteLength!==t)throw new Error(`${e} has invalid length ${n.byteLength}, required: ${t}`);return n}}function N(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function L(t,{debugPath:e="script"}={}){return N(e,t,{code_hash:M(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case 0:case 1:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:M(-1)})}function U(t,{debugPath:e="out_point"}={}){return N(e,t,{tx_hash:M(32),index:z(4)})}function q(t){return function(e,r){return t(r,{debugPath:e})}}function V(t,{debugPath:e="cell_input"}={}){return N(e,t,{since:z(8),previous_output:q(U)})}function $(t,{debugPath:e="cell_output"}={}){const r=N(e,t,{capacity:z(8),lock:q(L)});return t.type&&(r.type_=L(t.type,{debugPath:e+".type"})),r}function F(t,{debugPath:e="cell_dep"}={}){return N(e,t,{out_point:q(U),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function G(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function H(t,{debugPath:e="raw_transaction"}={}){return N(e,t,{version:z(4),cell_deps:G(q(F)),header_deps:G(M(32)),inputs:G(q(V)),outputs:G(q($)),outputs_data:G(M(-1))})}function W(t,{debugPath:e="transaction"}={}){const r=H(t,{debugPath:"(raw)"+e}),n=N(e,t,{witnesses:G(M(-1))});return n.raw=r,n}function J(t,{debugPath:e="raw_header"}={}){return N(e,t,{version:z(4),compact_target:z(4),timestamp:z(8),number:z(8),epoch:z(8),parent_hash:M(32),transactions_root:M(32),proposals_hash:M(32),uncles_hash:M(32),dao:M(32)})}function X(t,{debugPath:e="header"}={}){const r=J(t,{debugPath:"(raw)"+e}),n=N(e,t,{nonce:z(16)});return n.raw=r,n}function Q(t,{debugPath:e="uncle_block"}={}){return N(e,t,{header:q(X),proposals:G(M(10))})}var K=Object.freeze({__proto__:null,NormalizeScript:L,NormalizeOutPoint:U,NormalizeCellInput:V,NormalizeCellOutput:$,NormalizeCellDep:F,NormalizeRawTransaction:H,NormalizeTransaction:W,NormalizeRawHeader:J,NormalizeHeader:X,NormalizeUncleBlock:Q,NormalizeBlock:function(t,{debugPath:e="block"}={}){return N(e,t,{header:q(X),uncles:G(q(Q)),transactions:G(q(W)),proposals:G(M(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return N(e,t,{lock:q(L),message:M(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=M(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=M(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=M(-1)(e+".output_type",t.output_type)),r}});function Y(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Z(t,e,r){if(!((e=Y(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function tt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Z(r,t,{code_hash:Y,hash_type:Y,args:Y}),e&&l(t,{debugPath:"(transformed) "+r}),t}function et(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Z(r,t,{tx_hash:Y,index:Y}),e&&f(t,{debugPath:"(transformed) "+r}),t}function rt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function nt(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Z(r,t,{since:Y,previous_output:rt(et)}),e&&h(t,{debugPath:"(transformed) "+r}),t}function it(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Z(r,t,{capacity:Y,lock:rt(tt),type:rt(tt)}),e&&c(t,{debugPath:"(transformed) "+r}),t}function ot(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Z(r,t,{out_point:rt(et),dep_type:Y}),e&&g(t,{debugPath:"(transformed) "+r}),t}function at(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function st(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y),witnesses:at(Y)}),e&&y(t,{debugPath:"(transformed) "+r}),t}function ut(t,{validation:e=!0,debugPath:r="header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y,nonce:Y}),e&&w(t,{debugPath:"(transformed) "+r}),t}function _t(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Z(r,t,{header:rt(ut),proposals:at(Y)}),e&&D(t,{debugPath:"(transformed) "+r}),t}var lt=Object.freeze({__proto__:null,TransformScript:tt,TransformOutPoint:et,TransformCellInput:nt,TransformCellOutput:it,TransformCellDep:ot,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y)}),e&&b(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:st,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y}),e&&m(t,{debugPath:"(transformed) "+r}),t},TransformHeader:ut,TransformUncleBlock:_t,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Z(r,t,{header:rt(ut),uncles:at(rt(_t)),transactions:at(rt(st)),proposals:at(Y)}),e&&B(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Z(r,t,{lock:rt(tt),message:Y}),e&&P(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Z(r,t,{lock:Y,input_type:Y,output_type:Y}),e&&A(t,{debugPath:"(transformed) "+r}),t}});var ft=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:n=!0,loadData:i=!1,loadBlockNumber:o=!0}={}){this.rpc=t,this.lockHash=new r(e).serializeJson(),this.skipCellWithContent=n,this.loadData=i,this.loadBlockNumber=o}async*collect(){const t=j(await this.rpc.get_tip_block_number());let e=o.BigInt(0);for(;o.lessThanOrEqual(e,t);){let r=o.add(e,o.BigInt(100));o.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,R(e),R(r));for(const t of n){if(this.skipCellWithContent&&(t.type||o.greaterThan(j(t.output_data_len),o.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=o.add(r,o.BigInt(1))}}}});const ht="0.10.2";export{R as BigIntToHexString,j as HexStringToBigInt,I as RPC,r as Reader,E as TransactionDumper,ht as VERSION,ft as cell_collectors,K as normalizers,lt as transformers,T as validators}; +class t{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class e{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(t,r)}return new t(r)}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var o=i((function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r,n=0;nl.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=h(this,o(l).call(this,t))).sign=r,n}return i(l,r),n(l,[{key:"toDebugString",value:function(){var t=["BigInt["],e=!0,r=!1,n=void 0;try{for(var i,o,a=this[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)o=i.value,t.push((o?(o>>>0).toString(16):o)+", ")}catch(t){r=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw n}}return t.push("]"),t.join("")}},{key:"toString",value:function(){var t=0t||36this.length&&(r=this.length);for(var n=65535&t,i=t>>>16,o=0,a=65535&e,s=e>>>16,_=0;_>>16,c=u(f,n),g=u(f,i),d=u(h,n),p=u(h,i),v=a+(65535&c),y=s+o+(v>>>16)+(c>>>16)+(65535&g)+(65535&d);o=(a=(g>>>16)+(d>>>16)+(65535&p)+(y>>>16))>>>16,a&=65535,s=p>>>16,this.__setDigit(_,65535&v|y<<16)}if(0!==o||0!==a||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(t,e,r){for(var n,i=0,o=0;o>>16,this.__setHalfDigit(e+o,n);return i}},{key:"__inplaceSub",value:function(t,e,r){var n=0;if(1&e){e>>=1;for(var i=this.__digit(e),o=65535&i,a=0;a>>1;a++){var s=t.__digit(a),u=(i>>>16)-(65535&s)-n;n=1&u>>>16,this.__setDigit(e+a,u<<16|65535&o),n=1&(o=(65535&(i=this.__digit(e+a+1)))-(s>>>16)-n)>>>16}var _=t.__digit(a),l=(i>>>16)-(65535&_)-n;if(n=1&l>>>16,this.__setDigit(e+a,l<<16|65535&o),e+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(65535&(i=this.__digit(e+a+1)))-(_>>>16)-n)>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;for(var f=0;f>>16)-(c>>>16)-(n=1&g>>>16);n=1&d>>>16,this.__setDigit(e+f,d<<16|65535&g)}var p=this.__digit(e+f),v=t.__digit(f),y=(65535&p)-(65535&v)-n;n=1&y>>>16;var b=0;0==(1&r)&&(n=1&(b=(p>>>16)-(v>>>16)-n)>>>16),this.__setDigit(e+f,b<<16|65535&y)}return n}},{key:"__inplaceRightShift",value:function(t){if(0!==t){for(var e,r=this.__digit(0)>>>t,n=this.length-1,i=0;i>>t;this.__setDigit(n,r)}}},{key:"__digit",value:function(t){return this[t]}},{key:"__unsignedDigit",value:function(t){return this[t]>>>0}},{key:"__setDigit",value:function(t,e){this[t]=0|e}},{key:"__setDigitGrow",value:function(t,e){this[t]=0|e}},{key:"__halfDigitLength",value:function(){var t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}},{key:"__halfDigit",value:function(t){return 65535&this[t>>>1]>>>((1&t)<<4)}},{key:"__setHalfDigit",value:function(t,e){var r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}}],[{key:"BigInt",value:function(e){var r=Math.floor,n=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if((0|e)===e)return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!n(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var i=l.__fromString(e);if(null===i)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return i}if("boolean"==typeof e)return!0===e?l.__oneDigit(1,!1):l.__zero();if("object"===t(e)){if(e.constructor===l)return e;var o=l.__toPrimitive(e);return l.BigInt(o)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(t){var e=t.length;if(0===e)return 0;if(1===e){var r=t.__unsignedDigit(0);return t.sign?-r:r}var n=t.__digit(e-1),i=_(n),o=32*e-i;if(1024>>=12;var c=f-12,g=12<=f?0:s<<20+f,d=20+f;0>>32-c,g=s<>>32-d,d-=32);var p=l.__decideRounding(t,d,u,s);if((1===p||0===p&&1==(1&g))&&0==(g=g+1>>>0)&&0!=++h>>>20&&(h=0,1023<++a))return t.sign?-1/0:1/0;var v=t.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=v|a|h,l.__kBitConversionInts[0]=g,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(t){if(0===t.length)return t;var e=t.__copy();return e.sign=!t.sign,e}},{key:"bitwiseNot",value:function(t){return t.sign?l.__absoluteSubOne(t).__trim():l.__absoluteAddOne(t,!0)}},{key:"exponentiate",value:function(t,e){if(e.sign)throw new RangeError("Exponent must be positive");if(0===e.length)return l.__oneDigit(1,!1);if(0===t.length)return t;if(1===t.length&&1===t.__digit(0))return t.sign&&0==(1&e.__digit(0))?l.unaryMinus(t):t;if(1=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){var n=1+(r>>>5),i=new l(n,t.sign&&0!=(1&r));i.__initializeDigits();var o=1<<(31&r);return i.__setDigit(n-1,o),i}var a=null,s=t;for(0!=(1&r)&&(a=t),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(t,e){if(0===t.length)return t;if(0===e.length)return e;var r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;var n=new l(r,t.sign!==e.sign);n.__initializeDigits();for(var i=0;il.__absoluteCompare(t,e))return l.__zero();var r,n=t.sign!==e.sign,i=e.__unsignedDigit(0);if(1===e.length&&65535>=i){if(1===i)return n===t.sign?t:l.unaryMinus(t);r=l.__absoluteDivSmall(t,i,null)}else r=l.__absoluteDivLarge(t,e,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(t,e))return t;var r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(t,r);return 0===n?l.__zero():l.__oneDigit(n,t.sign)}var i=l.__absoluteDivLarge(t,e,!1,!0);return i.sign=t.sign,i.__trim()}},{key:"add",value:function(t,e){var r=t.sign;return r===e.sign?l.__absoluteAdd(t,e,r):0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r)}},{key:"subtract",value:function(t,e){var r=t.sign;return r===e.sign?0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r):l.__absoluteAdd(t,e,r)}},{key:"leftShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__rightShiftByAbsolute(t,e):l.__leftShiftByAbsolute(t,e)}},{key:"signedRightShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__leftShiftByAbsolute(t,e):l.__rightShiftByAbsolute(t,e)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(t,e){return 0>l.__compareToBigInt(t,e)}},{key:"lessThanOrEqual",value:function(t,e){return 0>=l.__compareToBigInt(t,e)}},{key:"greaterThan",value:function(t,e){return 0=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.lengthl.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.length>>n)return e}return l.__truncateToNBits(t,e)}},{key:"ADD",value:function(t,e){if(t=l.__toPrimitive(t),e=l.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)&&l.__isBigInt(e))return l.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(t,e){return l.__compare(t,e,0)}},{key:"LE",value:function(t,e){return l.__compare(t,e,1)}},{key:"GT",value:function(t,e){return l.__compare(t,e,2)}},{key:"GE",value:function(t,e){return l.__compare(t,e,3)}},{key:"EQ",value:function(e,r){for(;;){if(l.__isBigInt(e))return l.__isBigInt(r)?l.equal(e,r):l.EQ(r,e);if("number"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("string"==typeof e){if(l.__isBigInt(r))return null!==(e=l.__fromString(e))&&l.equal(e,r);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("boolean"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,+e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("symbol"===t(e)){if(l.__isBigInt(r))return!1;if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else{if("object"!==t(e))return e==r;if("object"===t(r)&&r.constructor!==l)return e==r;e=l.__toPrimitive(e)}}}},{key:"NE",value:function(t,e){return!l.EQ(t,e)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(t,e){var r=new l(1,e);return r.__setDigit(0,t),r}},{key:"__decideRounding",value:function(t,e,r,n){if(0e)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}var o=1<>>20)-1023,n=1+(r>>>5),i=new l(n,0>t),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&r,_=0;if(u>>f,o=o<<32-f|a>>>f,a<<=32-f}else if(u===s)_=32,e=o,o=a;else{var h=u-s;_=32-h,e=o<>>32-h,o=a<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}},{key:"__fromString",value:function(t){var e=11073741824/s)return null;var _=new l(31+(s*a+u>>>l.__kBitsPerCharTableShift)>>>5,!1),f=10>e?e:10,h=10>=l.__kBitsPerCharTableShift;var c=[],g=[],d=!1;do{for(var p,v=0,y=0;;){if(p=void 0,o-48>>>0>>0>>0>>0>>l.__kBitsPerCharTableShift+5;_.__inplaceMultiplyAdd(D,k,P)}while(!b)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i>>u-(o-=32))}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=e-1,a=t.__digit(r-1),s=0|(32*r-_(a)+i-1)/i;if(t.sign&&s++,268435456>>v,c=32-v;c>=i;)u[f--]=l.__kConversionChars[h&o],h>>>=i,c-=i}var y=(h|a<>>i-c;0!==h;)u[f--]=l.__kConversionChars[h&o],h>>>=i;if(t.sign&&(u[f--]="-"),-1!==f)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(t,e,r){var n=t.length;if(0===n)return"";if(1===n){var i=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(i="-"+i),i}var o,a,s=32*n-_(t.__digit(n-1)),u=l.__kMaxBitsPerChar[e]-1,f=s*l.__kBitsPerCharTableMultiplier,h=1+(f=0|(f+=u-1)/u)>>1,c=l.exponentiate(l.__oneDigit(e,!1),l.__oneDigit(h,!1)),g=c.__unsignedDigit(0);if(1===c.length&&65535>=g){(o=new l(t.length,!1)).__initializeDigits();for(var d,p=0,v=2*t.length-1;0<=v;v--)d=p<<16|t.__halfDigit(v),o.__setHalfDigit(v,0|d/g),p=0|d%g;a=p.toString(e)}else{var y=l.__absoluteDivLarge(t,c,!0,!0);o=y.quotient;var b=y.remainder.__trim();a=l.__toStringGeneric(b,e,!0)}o.__trim();for(var m=l.__toStringGeneric(o,e,!0);a.lengthn?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(t,e){if(!0|e){var r=t.sign,n=0>e;if(r!==n)return l.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?l.__absoluteGreater(r):oe)return l.__unequalSign(r);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;l.__kBitConversionDouble[0]=e;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=t.length,a=t.__digit(o-1),s=_(a),u=32*o-s,f=i+1;if(uf)return l.__absoluteGreater(r);var h=1048576|1048575&l.__kBitConversionInts[1],c=l.__kBitConversionInts[0],g=20,d=31-s;if(d!==(u-1)%31)throw new Error("implementation bug");var p,v=0;if(d>>y,h=h<<32-y|c>>>y,c<<=32-y}else if(d===g)v=32,p=h,h=c;else{var b=d-g;v=32-b,p=h<>>32-b,h=c<>>=0)>(p>>>=0))return l.__absoluteGreater(r);if(a>>0,h=c,c=0):p=0;var w=t.__unsignedDigit(m);if(w>p)return l.__absoluteGreater(r);if(we&&t.__unsignedDigit(0)===a(e):0===l.__compareToDouble(t,e)}},{key:"__comparisonResultToBool",value:function(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(l.__isBigInt(t)&&"string"==typeof e)return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("string"==typeof t&&l.__isBigInt(e))return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)){if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}},{key:"__absoluteAdd",value:function(t,e,r){if(t.length>>16)+(s>>>16)+(_>>>16);o=f>>>16,i.__setDigit(a,65535&_|f<<16)}for(;a>>16)+(c>>>16);o=g>>>16,i.__setDigit(a,65535&c|g<<16)}return a>>16)-(s>>>16)-(i=1&u>>>16);i=1&_>>>16,n.__setDigit(o,65535&u|_<<16)}for(;o>>16)-(i=1&h>>>16);i=1&c>>>16,n.__setDigit(o,65535&h|c<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(t,e){var r=2n?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(t,e,r,n){if(0!==e){for(var i=65535&e,o=e>>>16,a=0,s=0,_=0,l=0;l>>16,g=t.__digit(l),d=65535&g,p=g>>>16,v=u(d,i),y=u(d,o),b=u(p,i),m=u(p,o);a=(s=(y>>>16)+(b>>>16)+(65535&m)+(a=(c+=_+a+((h+=s+(65535&v))>>>16)+(v>>>16)+(65535&y)+(65535&b))>>>16))>>>16,s&=65535,_=m>>>16,f=65535&h|c<<16,r.__setDigit(n,f)}for(;0!==a||0!==s||0!==_;n++){var w=r.__digit(n),k=(65535&w)+s,D=(w>>>16)+(k>>>16)+_+a;s=0,_=0,a=D>>>16,w=65535&k|D<<16,r.__setDigit(n,w)}}}},{key:"__internalMultiplyAdd",value:function(t,e,r,n,i){for(var o=r,a=0,s=0;s>>16;var h=u(_>>>16,e),c=(65535&h)+(l>>>16)+o;o=c>>>16,a=h>>>16,i.__setDigit(s,c<<16|65535&f)}if(i.length>n)for(i.__setDigit(n++,o+a);n>>0,a=0|o/e,s=0|(o=((n=0|o%e)<<16|t.__halfDigit(i-1))>>>0)/e;n=0|o%e,r.__setDigit(i>>>1,a<<16|s)}return r}},{key:"__absoluteModSmall",value:function(t,e){for(var r=0,n=2*t.length-1;0<=n;n--)r=0|((r<<16|t.__halfDigit(n))>>>0)%e;return r}},{key:"__absoluteDivLarge",value:function(t,e,r,n){var i=e.__halfDigitLength(),o=e.length,a=t.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var _=new l(i+2>>>1,!1);_.__initializeDigits();var f=l.__clz16(e.__halfDigit(i-1));0>>0;p=0|y/c;for(var b=0|y%c,m=e.__halfDigit(i-2),w=h.__halfDigit(d+i-2);u(p,m)>>>0>(b<<16|w)>>>0&&(p--,!(65535<(b+=c))););}l.__internalMultiplyAdd(e,p,0,o,_);var k=h.__inplaceSub(_,d,i+1);0!==k&&(k=h.__inplaceAdd(e,d,i),h.__setHalfDigit(d+i,h.__halfDigit(d+i)+k),p--),r&&(1&d?g=p<<16:s.__setDigit(d>>>1,g|p))}return n?(h.__inplaceRightShift(f),r?{quotient:s,remainder:h}:h):r?s:void 0}},{key:"__clz16",value:function(t){return _(t)-16}},{key:"__specialLeftShift",value:function(t,e,r){var n=t.length,i=new l(n+r,!1);if(0===e){for(var o=0;o>>32-e;return 0r)throw new RangeError("BigInt too big");var n=r>>>5,i=31&r,o=t.length,a=0!==i&&0!=t.__digit(o-1)>>>32-i,s=o+n+(a?1:0),u=new l(s,t.sign);if(0===i){for(var _=0;_>>32-i;if(a)u.__setDigit(o+n,f);else if(0!==f)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(t,e){var r=t.length,n=t.sign,i=l.__toShiftAmount(e);if(0>i)return l.__rightShiftByMaximum(n);var o=i>>>5,a=31&i,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(t.__digit(o)&(1<>>a,d=r-o-1,p=0;p>>a;f.__setDigit(d,g)}return u&&(f=l.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:"__rightShiftByMaximum",value:function(t){return t?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(t){if(1l.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(e){var r=1>>5,n=new l(r,e.sign),i=r-1,o=0;o>>s}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(t,e,r){for(var n=Math.min,i=t+31>>>5,o=new l(i,r),a=0,s=i-1,u=0,_=n(s,e.length);a<_;a++){var f=e.__digit(a),h=0-(65535&f)-u,c=0-(f>>>16)-(u=1&h>>>16);u=1&c>>>16,o.__setDigit(a,65535&h|c<<16)}for(;a>>16)-(u=1&v>>>16)<<16}else{var y=32-p,b=1<<32-y,m=(65535&b)-(65535&(d=d<>>y))-u;g=65535&m|(b>>>16)-(d>>>16)-(u=1&m>>>16)<<16,g&=b-1}return o.__setDigit(s,g),o.__trim()}},{key:"__digitPow",value:function(t,e){for(var r=1;0>>=1,t*=t;return r}}]),l}(l(Array));return c.__kMaxLength=33554432,c.__kMaxLengthBits=c.__kMaxLength<<5,c.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],c.__kBitsPerCharTableShift=5,c.__kBitsPerCharTableMultiplier=1<a)throw new Error(s);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(s);if(u.find(t=>!n.includes(t)))throw new Error(s)}function s(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function u(t,e){if(s(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function _(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function l(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(a(r,t,["code_hash","hash_type","args"],[]),u(r+".code_hash",t.code_hash),s(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function f(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){a(r,t,["tx_hash","index"],[]),u(r+".tx_hash",t.tx_hash),_(r+".index",t.index)}function h(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){a(r,t,["since","previous_output"],[]),_(r+".since",t.since),e&&f(t.previous_output,{debugPath:r+".previous_output"})}function c(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){a(r,t,["capacity","lock"],["type"]),_(r+".capacity",t.capacity),e&&(l(t.lock,{debugPath:r+".lock"}),t.type&&l(t.type,{debugPath:r+".type"}))}function g(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(a(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&f(t.out_point,{debugPath:r+".out_point"})}function d(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}}var S=i((function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:n);!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function _(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];w.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function D(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}D.polyfill=!0,t.fetch||(t.fetch=D,t.Headers=h,t.Request=b,t.Response=w),e.Headers=h,e.Request=b,e.Response=w,e.fetch=D}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}));function x(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const O={get:(t,e,r)=>"send"===e?async()=>{const e=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},C={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},O):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class I{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,C)}static create(t){return new I(t)}}function j(t){return o.BigInt(t)}function R(t){return"0x"+t.toString(16)}function z(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=R(o.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&n.byteLength!==t)throw new Error(`${e} has invalid length ${n.byteLength}, required: ${t}`);return n}}function N(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function L(t,{debugPath:e="script"}={}){return N(e,t,{code_hash:M(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:M(-1)})}function U(t,{debugPath:e="out_point"}={}){return N(e,t,{tx_hash:M(32),index:z(4)})}function q(t){return function(e,r){return t(r,{debugPath:e})}}function V(t,{debugPath:e="cell_input"}={}){return N(e,t,{since:z(8),previous_output:q(U)})}function $(t,{debugPath:e="cell_output"}={}){const r=N(e,t,{capacity:z(8),lock:q(L)});return t.type&&(r.type_=L(t.type,{debugPath:e+".type"})),r}function F(t,{debugPath:e="cell_dep"}={}){return N(e,t,{out_point:q(U),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function G(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function H(t,{debugPath:e="raw_transaction"}={}){return N(e,t,{version:z(4),cell_deps:G(q(F)),header_deps:G(M(32)),inputs:G(q(V)),outputs:G(q($)),outputs_data:G(M(-1))})}function W(t,{debugPath:e="transaction"}={}){const r=H(t,{debugPath:"(raw)"+e}),n=N(e,t,{witnesses:G(M(-1))});return n.raw=r,n}function J(t,{debugPath:e="raw_header"}={}){return N(e,t,{version:z(4),compact_target:z(4),timestamp:z(8),number:z(8),epoch:z(8),parent_hash:M(32),transactions_root:M(32),proposals_hash:M(32),uncles_hash:M(32),dao:M(32)})}function X(t,{debugPath:e="header"}={}){const r=J(t,{debugPath:"(raw)"+e}),n=N(e,t,{nonce:z(16)});return n.raw=r,n}function Q(t,{debugPath:e="uncle_block"}={}){return N(e,t,{header:q(X),proposals:G(M(10))})}var K=Object.freeze({__proto__:null,NormalizeScript:L,NormalizeOutPoint:U,NormalizeCellInput:V,NormalizeCellOutput:$,NormalizeCellDep:F,NormalizeRawTransaction:H,NormalizeTransaction:W,NormalizeRawHeader:J,NormalizeHeader:X,NormalizeUncleBlock:Q,NormalizeBlock:function(t,{debugPath:e="block"}={}){return N(e,t,{header:q(X),uncles:G(q(Q)),transactions:G(q(W)),proposals:G(M(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return N(e,t,{lock:q(L),message:M(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=M(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=M(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=M(-1)(e+".output_type",t.output_type)),r}});function Y(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Z(t,e,r){if(!((e=Y(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function tt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Z(r,t,{code_hash:Y,hash_type:Y,args:Y}),e&&l(t,{debugPath:"(transformed) "+r}),t}function et(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Z(r,t,{tx_hash:Y,index:Y}),e&&f(t,{debugPath:"(transformed) "+r}),t}function rt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function nt(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Z(r,t,{since:Y,previous_output:rt(et)}),e&&h(t,{debugPath:"(transformed) "+r}),t}function it(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Z(r,t,{capacity:Y,lock:rt(tt),type:rt(tt)}),e&&c(t,{debugPath:"(transformed) "+r}),t}function ot(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Z(r,t,{out_point:rt(et),dep_type:Y}),e&&g(t,{debugPath:"(transformed) "+r}),t}function at(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function st(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y),witnesses:at(Y)}),e&&b(t,{debugPath:"(transformed) "+r}),t}function ut(t,{validation:e=!0,debugPath:r="header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y,nonce:Y}),e&&w(t,{debugPath:"(transformed) "+r}),t}function _t(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Z(r,t,{header:rt(ut),proposals:at(Y)}),e&&D(t,{debugPath:"(transformed) "+r}),t}var lt=Object.freeze({__proto__:null,TransformScript:tt,TransformOutPoint:et,TransformCellInput:nt,TransformCellOutput:it,TransformCellDep:ot,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y)}),e&&y(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:st,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y}),e&&m(t,{debugPath:"(transformed) "+r}),t},TransformHeader:ut,TransformUncleBlock:_t,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Z(r,t,{header:rt(ut),uncles:at(rt(_t)),transactions:at(rt(st)),proposals:at(Y)}),e&&B(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Z(r,t,{lock:rt(tt),message:Y}),e&&P(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Z(r,t,{lock:Y,input_type:Y,output_type:Y}),e&&A(t,{debugPath:"(transformed) "+r}),t}});var ft=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:n=!0,loadData:i=!1,loadBlockNumber:o=!0}={}){this.rpc=t,this.lockHash=new r(e).serializeJson(),this.skipCellWithContent=n,this.loadData=i,this.loadBlockNumber=o}async*collect(){const t=j(await this.rpc.get_tip_block_number());let e=o.BigInt(0);for(;o.lessThanOrEqual(e,t);){let r=o.add(e,o.BigInt(100));o.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,R(e),R(r));for(const t of n){if(this.skipCellWithContent&&(t.type||o.greaterThan(j(t.output_data_len),o.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=o.add(r,o.BigInt(1))}}}});const ht="0.10.2";export{R as BigIntToHexString,j as HexStringToBigInt,I as RPC,r as Reader,E as TransactionDumper,ht as VERSION,ft as cell_collectors,K as normalizers,lt as transformers,T as validators}; diff --git a/dist/ckb-js-toolkit.node.js b/dist/ckb-js-toolkit.node.js index 19a7d2b..b02e5d6 100644 --- a/dist/ckb-js-toolkit.node.js +++ b/dist/ckb-js-toolkit.node.js @@ -1,2 +1,2 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("stream"),e=require("http"),r=require("url"),n=require("https"),i=require("zlib");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=o(t),a=o(e),u=o(r),l=o(n),c=o(i);class _{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class f{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");r.setUint8(e,n)}return new _(e)}}class g extends Array{constructor(t,e){if(t>g.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");super(t),this.sign=e}static BigInt(t){var e=Math.floor,r=Number.isFinite;if("number"==typeof t){if(0===t)return g.__zero();if((0|t)===t)return 0>t?g.__oneDigit(-t,!0):g.__oneDigit(t,!1);if(!r(t)||e(t)!==t)throw new RangeError("The number "+t+" cannot be converted to BigInt because it is not an integer");return g.__fromDouble(t)}if("string"==typeof t){const e=g.__fromString(t);if(null===e)throw new SyntaxError("Cannot convert "+t+" to a BigInt");return e}if("boolean"==typeof t)return!0===t?g.__oneDigit(1,!1):g.__zero();if("object"==typeof t){if(t.constructor===g)return t;const e=g.__toPrimitive(t);return g.BigInt(e)}throw new TypeError("Cannot convert "+t+" to a BigInt")}toDebugString(){const t=["BigInt["];for(const e of this)t.push((e?(e>>>0).toString(16):e)+", ");return t.push("]"),t.join("")}toString(t=10){if(2>t||36>>=12;const _=l-12;let f=12<=l?0:a<<20+l,h=20+l;0<_&&0>>32-_,f=a<<_,h=_),0>>32-h,h-=32);const d=g.__decideRounding(t,h,u,a);if((1===d||0===d&&1==(1&f))&&(f=f+1>>>0,0==f&&(c++,0!=c>>>20&&(c=0,s++,1023=g.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){const e=1+(r>>>5),n=t.sign&&0!=(1&r),i=new g(e,n);i.__initializeDigits();const o=1<<(31&r);return i.__setDigit(e-1,o),i}let n=null,i=t;for(0!=(1&r)&&(n=t),r>>=1;0!==r;r>>=1)i=g.multiply(i,i),0!=(1&r)&&(n=null===n?i:g.multiply(n,i));return n}static multiply(t,e){if(0===t.length)return t;if(0===e.length)return e;let r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;const n=new g(r,t.sign!==e.sign);n.__initializeDigits();for(let r=0;rg.__absoluteCompare(t,e))return g.__zero();const r=t.sign!==e.sign,n=e.__unsignedDigit(0);let i;if(1===e.length&&65535>=n){if(1===n)return r===t.sign?t:g.unaryMinus(t);i=g.__absoluteDivSmall(t,n,null)}else i=g.__absoluteDivLarge(t,e,!0,!1);return i.sign=r,i.__trim()}static remainder(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>g.__absoluteCompare(t,e))return t;const r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return g.__zero();const e=g.__absoluteModSmall(t,r);return 0===e?g.__zero():g.__oneDigit(e,t.sign)}const n=g.__absoluteDivLarge(t,e,!1,!0);return n.sign=t.sign,n.__trim()}static add(t,e){const r=t.sign;return r===e.sign?g.__absoluteAdd(t,e,r):0<=g.__absoluteCompare(t,e)?g.__absoluteSub(t,e,r):g.__absoluteSub(e,t,!r)}static subtract(t,e){const r=t.sign;return r===e.sign?0<=g.__absoluteCompare(t,e)?g.__absoluteSub(t,e,r):g.__absoluteSub(e,t,!r):g.__absoluteAdd(t,e,r)}static leftShift(t,e){return 0===e.length||0===t.length?t:e.sign?g.__rightShiftByAbsolute(t,e):g.__leftShiftByAbsolute(t,e)}static signedRightShift(t,e){return 0===e.length||0===t.length?t:e.sign?g.__leftShiftByAbsolute(t,e):g.__rightShiftByAbsolute(t,e)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(t,e){return 0>g.__compareToBigInt(t,e)}static lessThanOrEqual(t,e){return 0>=g.__compareToBigInt(t,e)}static greaterThan(t,e){return 0=g.__kMaxLengthBits)return e;const r=t+31>>>5;if(e.lengthg.__kMaxLengthBits)throw new RangeError("BigInt too big");return g.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=g.__kMaxLengthBits)return e;const r=t+31>>>5;if(e.length>>n)return e}return g.__truncateToNBits(t,e)}static ADD(t,e){if(t=g.__toPrimitive(t),e=g.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=g.__toNumeric(t),e=g.__toNumeric(e),g.__isBigInt(t)&&g.__isBigInt(e))return g.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(t,e){return g.__compare(t,e,0)}static LE(t,e){return g.__compare(t,e,1)}static GT(t,e){return g.__compare(t,e,2)}static GE(t,e){return g.__compare(t,e,3)}static EQ(t,e){for(;;){if(g.__isBigInt(t))return g.__isBigInt(e)?g.equal(t,e):g.EQ(e,t);if("number"==typeof t){if(g.__isBigInt(e))return g.__equalToNumber(e,t);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("string"==typeof t){if(g.__isBigInt(e))return null!==(t=g.__fromString(t))&&g.equal(t,e);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("boolean"==typeof t){if(g.__isBigInt(e))return g.__equalToNumber(e,+t);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("symbol"==typeof t){if(g.__isBigInt(e))return!1;if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else{if("object"!=typeof t)return t==e;if("object"==typeof e&&e.constructor!==g)return t==e;t=g.__toPrimitive(t)}}}static NE(t,e){return!g.EQ(t,e)}static __zero(){return new g(0,!1)}static __oneDigit(t,e){const r=new g(1,e);return r.__setDigit(0,t),r}__copy(){const t=new g(this.length,this.sign);for(let e=0;ee)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}let o=1<>>20)-1023,r=1+(e>>>5),n=new g(r,0>t);let i=1048575&g.__kBitConversionInts[1]|1048576,o=g.__kBitConversionInts[0];const s=31&e;let a,u=0;if(s<20){const t=20-s;u=t+32,a=i>>>t,i=i<<32-t|o>>>t,o<<=32-t}else if(20===s)u=32,a=i,i=o;else{const t=s-20;u=32-t,a=i<>>32-t,i=o<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}static __fromString(t,e=0){let r=0;const n=t.length;let i=0;if(i===n)return g.__zero();let o=t.charCodeAt(i);for(;g.__isWhitespace(o);){if(++i===n)return g.__zero();o=t.charCodeAt(i)}if(43===o){if(++i===n)return null;o=t.charCodeAt(i),r=1}else if(45===o){if(++i===n)return null;o=t.charCodeAt(i),r=-1}if(0===e){if(e=10,48===o){if(++i===n)return g.__zero();if(o=t.charCodeAt(i),88===o||120===o){if(e=16,++i===n)return null;o=t.charCodeAt(i)}else if(79===o||111===o){if(e=8,++i===n)return null;o=t.charCodeAt(i)}else if(66===o||98===o){if(e=2,++i===n)return null;o=t.charCodeAt(i)}}}else if(16===e&&48===o){if(++i===n)return g.__zero();if(o=t.charCodeAt(i),88===o||120===o){if(++i===n)return null;o=t.charCodeAt(i)}}for(;48===o;){if(++i===n)return g.__zero();o=t.charCodeAt(i)}const s=n-i;let a=g.__kMaxBitsPerChar[e],u=g.__kBitsPerCharTableMultiplier-1;if(s>1073741824/a)return null;const l=a*s+u>>>g.__kBitsPerCharTableShift,c=new g(l+31>>>5,!1),_=10>e?e:10,f=10>=g.__kBitsPerCharTableShift;const e=[],r=[];let s=!1;do{let u=0,l=0;for(;;){let e;if(o-48>>>0<_)e=o-48;else{if(!((32|o)-97>>>0>>0<_)a=o-48;else{if(!((32|o)-97>>>0>>g.__kBitsPerCharTableShift+5;c.__inplaceMultiplyAdd(h,l,d)}while(!r)}if(i!==n){if(!g.__isWhitespace(o))return null;for(i++;i>>u-o)}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&i),i=(51&i>>>2)+(51&i),i=(15&i>>>4)+(15&i);const o=i,s=e-1,a=t.__digit(n-1);let u=0|(32*n-r(a)+o-1)/o;if(t.sign&&u++,268435456>>i,f=32-i;f>=o;)l[c--]=g.__kConversionChars[_&s],_>>>=o,f-=o}const h=(_|a<>>o-f;0!==_;)l[c--]=g.__kConversionChars[_&s],_>>>=o;if(t.sign&&(l[c--]="-"),-1!=c)throw new Error("implementation bug");return l.join("")}static __toStringGeneric(t,e,r){var n=Math.clz32;const i=t.length;if(0===i)return"";if(1===i){let n=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(n="-"+n),n}const o=32*i-n(t.__digit(i-1)),s=g.__kMaxBitsPerChar[e]-1;let a=o*g.__kBitsPerCharTableMultiplier;a+=s-1,a=0|a/s;const u=a+1>>1,l=g.exponentiate(g.__oneDigit(e,!1),g.__oneDigit(u,!1));let c,_;const f=l.__unsignedDigit(0);if(1===l.length&&65535>=f){c=new g(t.length,!1),c.__initializeDigits();let r=0;for(let e=2*t.length-1;0<=e;e--){const n=r<<16|t.__halfDigit(e);c.__setHalfDigit(e,0|n/f),r=0|n%f}_=r.toString(e)}else{const r=g.__absoluteDivLarge(t,l,!0,!0);c=r.quotient;const n=r.remainder.__trim();_=g.__toStringGeneric(n,e,!0)}c.__trim();let h=g.__toStringGeneric(c,e,!0);for(;_.lengthn?g.__absoluteLess(r):0}static __compareToNumber(t,e){if(!0|e){const r=t.sign,n=0>e;if(r!==n)return g.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?g.__absoluteGreater(r):oe)return g.__unequalSign(n);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;g.__kBitConversionDouble[0]=e;const i=2047&g.__kBitConversionInts[1]>>>20;if(2047==i)throw new Error("implementation bug: handled elsewhere");const o=i-1023;if(0>o)return g.__absoluteGreater(n);const s=t.length;let a=t.__digit(s-1);const u=r(a),l=32*s-u,c=o+1;if(lc)return g.__absoluteGreater(n);let _=1048576|1048575&g.__kBitConversionInts[1],f=g.__kBitConversionInts[0];const h=31-u;if(h!==(l-1)%31)throw new Error("implementation bug");let d,p=0;if(20>h){const t=20-h;p=t+32,d=_>>>t,_=_<<32-t|f>>>t,f<<=32-t}else if(20===h)p=32,d=_,_=f;else{const t=h-20;p=32-t,d=_<>>32-t,_=f<>>=0,d>>>=0,a>d)return g.__absoluteGreater(n);if(a>>0,_=f,f=0):d=0;const r=t.__unsignedDigit(e);if(r>d)return g.__absoluteGreater(n);if(re&&t.__unsignedDigit(0)===r(e):0===g.__compareToDouble(t,e)}static __comparisonResultToBool(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(g.__isBigInt(t)&&"string"==typeof e)return null!==(e=g.__fromString(e))&&g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if("string"==typeof t&&g.__isBigInt(e))return null!==(t=g.__fromString(t))&&g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if(t=g.__toNumeric(t),e=g.__toNumeric(e),g.__isBigInt(t)){if(g.__isBigInt(e))return g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return g.__comparisonResultToBool(g.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(g.__isBigInt(e))return g.__comparisonResultToBool(g.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(t,e,r){if(t.length>>16)+(r>>>16)+(a>>>16);o=u>>>16,i.__setDigit(s,65535&a|u<<16)}for(;s>>16)+(r>>>16);o=n>>>16,i.__setDigit(s,65535&r|n<<16)}return s>>16;const u=(r>>>16)-(s>>>16)-i;i=1&u>>>16,n.__setDigit(o,65535&a|u<<16)}for(;o>>16;const s=(e>>>16)-i;i=1&s>>>16,n.__setDigit(o,65535&r|s<<16)}return n.__trim()}static __absoluteAddOne(t,e,r=null){const n=t.length;null===r?r=new g(n,e):r.sign=e;let i=!0;for(let e,o=0;on?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}static __multiplyAccumulate(t,e,r,n){var i=Math.imul;if(0===e)return;const o=65535&e,s=e>>>16;let a=0,u=0,l=0;for(let e=0;e>>16;const h=t.__digit(e),g=65535&h,d=h>>>16,p=i(g,o),b=i(g,s),m=i(d,o),y=i(d,s);_+=u+(65535&p),f+=l+a+(_>>>16)+(p>>>16)+(65535&b)+(65535&m),a=f>>>16,u=(b>>>16)+(m>>>16)+(65535&y)+a,a=u>>>16,u&=65535,l=y>>>16,c=65535&_|f<<16,r.__setDigit(n,c)}for(;0!=a||0!==u||0!==l;n++){let t=r.__digit(n);const e=(65535&t)+u,i=(t>>>16)+(e>>>16)+l+a;u=0,l=0,a=i>>>16,t=65535&e|i<<16,r.__setDigit(n,t)}}static __internalMultiplyAdd(t,e,r,n,i){var o=Math.imul;let s=r,a=0;for(let r=0;r>>16;const c=o(n>>>16,e),_=(65535&c)+(u>>>16)+s;s=_>>>16,a=c>>>16,i.__setDigit(r,_<<16|65535&l)}if(i.length>n)for(i.__setDigit(n++,s+a);nthis.length&&(r=this.length);const i=65535&t,o=t>>>16;let s=0,a=65535&e,u=e>>>16;for(let t=0;t>>16,c=n(r,i),_=n(r,o),f=n(l,i),h=n(l,o),g=a+(65535&c),d=u+s+(g>>>16)+(c>>>16)+(65535&_)+(65535&f);a=(_>>>16)+(f>>>16)+(65535&h)+(d>>>16),s=a>>>16,a&=65535,u=h>>>16,this.__setDigit(t,65535&g|d<<16)}if(0!=s||0!==a||0!==u)throw new Error("implementation bug")}static __absoluteDivSmall(t,e,r){null===r&&(r=new g(t.length,!1));let n=0;for(let i,o=2*t.length-1;0<=o;o-=2){i=(n<<16|t.__halfDigit(o))>>>0;const s=0|i/e;n=0|i%e,i=(n<<16|t.__halfDigit(o-1))>>>0;const a=0|i/e;n=0|i%e,r.__setDigit(o>>>1,s<<16|a)}return r}static __absoluteModSmall(t,e){let r=0;for(let n=2*t.length-1;0<=n;n--){r=0|((r<<16|t.__halfDigit(n))>>>0)%e}return r}static __absoluteDivLarge(t,e,r,n){var i=Math.imul;const o=e.__halfDigitLength(),s=e.length,a=t.__halfDigitLength()-o;let u=null;r&&(u=new g(a+2>>>1,!1),u.__initializeDigits());const l=new g(o+2>>>1,!1);l.__initializeDigits();const c=g.__clz16(e.__halfDigit(o-1));0>>0;t=0|r/f;let s=0|r%f;const u=e.__halfDigit(o-2),l=_.__halfDigit(n+o-2);for(;i(t,u)>>>0>(s<<16|l)>>>0&&(t--,s+=f,!(65535>>1,h|t))}return n?(_.__inplaceRightShift(c),r?{quotient:u,remainder:_}:_):r?u:void 0}static __clz16(t){return Math.clz32(t)-16}__inplaceAdd(t,e,r){let n=0;for(let i=0;i>>16,this.__setHalfDigit(e+i,r)}return n}__inplaceSub(t,e,r){let n=0;if(1&e){e>>=1;let i=this.__digit(e),o=65535&i,s=0;for(;s>>1;s++){const r=t.__digit(s),a=(i>>>16)-(65535&r)-n;n=1&a>>>16,this.__setDigit(e+s,a<<16|65535&o),i=this.__digit(e+s+1),o=(65535&i)-(r>>>16)-n,n=1&o>>>16}const a=t.__digit(s),u=(i>>>16)-(65535&a)-n;if(n=1&u>>>16,this.__setDigit(e+s,u<<16|65535&o),e+s+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(i=this.__digit(e+s+1),o=(65535&i)-(a>>>16)-n,n=1&o>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;let i=0;for(;i>>16;const a=(r>>>16)-(o>>>16)-n;n=1&a>>>16,this.__setDigit(e+i,a<<16|65535&s)}const o=this.__digit(e+i),s=t.__digit(i),a=(65535&o)-(65535&s)-n;n=1&a>>>16;let u=0;0==(1&r)&&(u=(o>>>16)-(s>>>16)-n,n=1&u>>>16),this.__setDigit(e+i,u<<16|65535&a)}return n}__inplaceRightShift(t){if(0===t)return;let e=this.__digit(0)>>>t;const r=this.length-1;for(let n=0;n>>t}this.__setDigit(r,e)}static __specialLeftShift(t,e,r){const n=t.length,i=new g(n+r,!1);if(0===e){for(let e=0;e>>32-e}return 0r)throw new RangeError("BigInt too big");const n=r>>>5,i=31&r,o=t.length,s=0!==i&&0!=t.__digit(o-1)>>>32-i,a=o+n+(s?1:0),u=new g(a,t.sign);if(0===i){let e=0;for(;e>>32-i}if(s)u.__setDigit(o+n,e);else if(0!=e)throw new Error("implementation bug")}return u.__trim()}static __rightShiftByAbsolute(t,e){const r=t.length,n=t.sign,i=g.__toShiftAmount(e);if(0>i)return g.__rightShiftByMaximum(n);const o=i>>>5,s=31&i;let a=r-o;if(0>=a)return g.__rightShiftByMaximum(n);let u=!1;if(n)if(0!=(t.__digit(o)&(1<>>s;const n=r-o-1;for(let r=0;r>>s}l.__setDigit(n,e)}return u&&(l=g.__absoluteAddOne(l,!0,l)),l.__trim()}static __rightShiftByMaximum(t){return t?g.__oneDigit(1,!0):g.__zero()}static __toShiftAmount(t){if(1g.__kMaxLengthBits?-1:e}static __toPrimitive(t,e="default"){if("object"!=typeof t)return t;if(t.constructor===g)return t;const r=t[Symbol.toPrimitive];if(r){const t=r(e);if("object"!=typeof t)return t;throw new TypeError("Cannot convert object to primitive value")}const n=t.valueOf;if(n){const e=n.call(t);if("object"!=typeof e)return e}const i=t.toString;if(i){const e=i.call(t);if("object"!=typeof e)return e}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(t){return g.__isBigInt(t)?t:+t}static __isBigInt(t){return"object"==typeof t&&t.constructor===g}static __truncateToNBits(t,e){const r=t+31>>>5,n=new g(r,e.sign),i=r-1;for(let t=0;t>>e}return n.__setDigit(i,o),n.__trim()}static __truncateAndSubFromPowerOfTwo(t,e,r){var n=Math.min;const i=t+31>>>5,o=new g(i,r);let s=0;const a=i-1;let u=0;for(const t=n(a,e.length);s>>16;const n=0-(t>>>16)-u;u=1&n>>>16,o.__setDigit(s,65535&r|n<<16)}for(;s>>16;_=65535&t|0-(l>>>16)-u<<16}else{const t=32-c;l=l<>>t;const e=1<<32-t,r=(65535&e)-(65535&l)-u;u=1&r>>>16;_=65535&r|(e>>>16)-(l>>>16)-u<<16,_&=e-1}return o.__setDigit(a,_),o.__trim()}__digit(t){return this[t]}__unsignedDigit(t){return this[t]>>>0}__setDigit(t,e){this[t]=0|e}__setDigitGrow(t,e){this[t]=0|e}__halfDigitLength(){const t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}__halfDigit(t){return 65535&this[t>>>1]>>>((1&t)<<4)}__setHalfDigit(t,e){const r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}static __digitPow(t,e){let r=1;for(;0>>=1,t*=t;return r}}function d(t,e,r,n=[]){!function(t,e){if(!(e instanceof Object))throw new Error(t+" is not an object!")}(t,e);const i=Object.keys(e).sort(),o=r.length,s=r.length+n.length,a=`${t} does not have correct keys! Required keys: [${r.sort().join(", ")}], optional keys: [${n.sort().join(", ")}], actual keys: [${i.join(", ")}]`;if(i.lengths)throw new Error(a);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(a);if(u.find(t=>!n.includes(t)))throw new Error(a)}function p(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function b(t,e){if(p(t,e),66!=e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function m(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function y(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(d(r,t,["code_hash","hash_type","args"],[]),b(r+".code_hash",t.code_hash),p(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function w(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){d(r,t,["tx_hash","index"],[]),b(r+".tx_hash",t.tx_hash),m(r+".index",t.index)}function v(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){d(r,t,["since","previous_output"],[]),m(r+".since",t.since),e&&w(t.previous_output,{debugPath:r+".previous_output"})}function B(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){d(r,t,["capacity","lock"],["type"]),m(r+".capacity",t.capacity),e&&(y(t.lock,{debugPath:r+".lock"}),t.type&&y(t.type,{debugPath:r+".type"}))}function P(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(d(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&w(t.out_point,{debugPath:r+".out_point"})}function D(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=r.size;let i=void 0===n?0:n;var o=r.timeout;let a=void 0===o?0:o;null==t?t=null:W(t)?t=Buffer.from(t.toString()):J(t)||Buffer.isBuffer(t)||("[object ArrayBuffer]"===Object.prototype.toString.call(t)?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof s.default||(t=Buffer.from(String(t)))),this[V]={body:t,disturbed:!1,error:null},this.size=i,this.timeout=a,t instanceof s.default&&t.on("error",(function(t){const r="AbortError"===t.name?t:new q(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t);e[V].error=r}))}function G(){var t=this;if(this[V].disturbed)return F.Promise.reject(new TypeError("body used already for: "+this.url));if(this[V].disturbed=!0,this[V].error)return F.Promise.reject(this[V].error);let e=this.body;if(null===e)return F.Promise.resolve(Buffer.alloc(0));if(J(e)&&(e=e.stream()),Buffer.isBuffer(e))return F.Promise.resolve(e);if(!(e instanceof s.default))return F.Promise.resolve(Buffer.alloc(0));let r=[],n=0,i=!1;return new F.Promise((function(o,s){let a;t.timeout&&(a=setTimeout((function(){i=!0,s(new q(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))}),t.timeout)),e.on("error",(function(e){"AbortError"===e.name?(i=!0,s(e)):s(new q(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e))})),e.on("data",(function(e){if(!i&&null!==e){if(t.size&&n+e.length>t.size)return i=!0,void s(new q(`content size at ${t.url} over limit: ${t.size}`,"max-size"));n+=e.length,r.push(e)}})),e.on("end",(function(){if(!i){clearTimeout(a);try{o(Buffer.concat(r,n))}catch(e){s(new q(`Could not create Buffer from response body for ${t.url}: ${e.message}`,"system",e))}}}))}))}function W(t){return"object"==typeof t&&"function"==typeof t.append&&"function"==typeof t.delete&&"function"==typeof t.get&&"function"==typeof t.getAll&&"function"==typeof t.has&&"function"==typeof t.set&&("URLSearchParams"===t.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(t)||"function"==typeof t.sort)}function J(t){return"object"==typeof t&&"function"==typeof t.arrayBuffer&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function X(t){let e,r,n=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof s.default&&"function"!=typeof n.getBoundary&&(e=new H,r=new H,n.pipe(e),n.pipe(r),t[V].body=e,n=r),n}function Q(t){return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":W(t)?"application/x-www-form-urlencoded;charset=UTF-8":J(t)?t.type||null:Buffer.isBuffer(t)||"[object ArrayBuffer]"===Object.prototype.toString.call(t)||ArrayBuffer.isView(t)?null:"function"==typeof t.getBoundary?"multipart/form-data;boundary="+t.getBoundary():t instanceof s.default?null:"text/plain;charset=UTF-8"}function Z(t){const e=t.body;return null===e?0:J(e)?e.size:Buffer.isBuffer(e)?e.length:e&&"function"==typeof e.getLengthSync&&(e._lengthRetrievers&&0==e._lengthRetrievers.length||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}F.prototype={get body(){return this[V].body},get bodyUsed(){return this[V].disturbed},arrayBuffer(){return G.call(this).then((function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}))},blob(){let t=this.headers&&this.headers.get("content-type")||"";return G.call(this).then((function(e){return Object.assign(new $([],{type:t.toLowerCase()}),{[M]:e})}))},json(){var t=this;return G.call(this).then((function(e){try{return JSON.parse(e.toString())}catch(e){return F.Promise.reject(new q(`invalid json response body at ${t.url} reason: ${e.message}`,"invalid-json"))}}))},text(){return G.call(this).then((function(t){return t.toString()}))},buffer(){return G.call(this)},textConverted(){var t=this;return G.call(this).then((function(e){return function(t,e){if("function"!=typeof U)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=e.get("content-type");let n,i,o="utf-8";r&&(n=/charset=([^;]*)/i.exec(r));i=t.slice(0,1024).toString(),!n&&i&&(n=/0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[nt]=Object.create(null),t instanceof it){const e=t.raw(),r=Object.keys(e);for(const t of r)for(const r of e[t])this.append(t,r)}else if(null==t);else{if("object"!=typeof t)throw new TypeError("Provided initializer must be an object");{const e=t[Symbol.iterator];if(null!=e){if("function"!=typeof e)throw new TypeError("Header pairs must be iterable");const r=[];for(const e of t){if("object"!=typeof e||"function"!=typeof e[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(e))}for(const t of r){if(2!==t.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(t[0],t[1])}}else for(const e of Object.keys(t)){const r=t[e];this.append(e,r)}}}}get(t){tt(t=""+t);const e=rt(this[nt],t);return void 0===e?null:this[nt][e].join(", ")}forEach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=ot(this),n=0;for(;n1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(t[nt]).sort();return r.map("key"===e?function(t){return t.toLowerCase()}:"value"===e?function(e){return t[nt][e].join(", ")}:function(e){return[e.toLowerCase(),t[nt][e].join(", ")]})}it.prototype.entries=it.prototype[Symbol.iterator],Object.defineProperty(it.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(it.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const st=Symbol("internal");function at(t,e){const r=Object.create(ut);return r[st]={target:t,kind:e,index:0},r}const ut=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==ut)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[st];const e=t.target,r=t.kind,n=t.index,i=ot(e,r);return n>=i.length?{value:void 0,done:!0}:(this[st].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function lt(t){const e=Object.assign({__proto__:null},t[nt]),r=rt(t[nt],"Host");return void 0!==r&&(e[r]=e[r][0]),e}Object.defineProperty(ut,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const ct=Symbol("Response internals"),_t=a.default.STATUS_CODES;class ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};F.call(this,t,e);const r=e.status||200,n=new it(e.headers);if(null!=t&&!n.has("Content-Type")){const e=Q(t);e&&n.append("Content-Type",e)}this[ct]={url:e.url,status:r,statusText:e.statusText||_t[r],headers:n,counter:e.counter}}get url(){return this[ct].url||""}get status(){return this[ct].status}get ok(){return this[ct].status>=200&&this[ct].status<300}get redirected(){return this[ct].counter>0}get statusText(){return this[ct].statusText}get headers(){return this[ct].headers}clone(){return new ft(X(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}F.mixIn(ft.prototype),Object.defineProperties(ft.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(ft.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const ht=Symbol("Request internals"),gt=u.default.parse,dt=u.default.format,pt="destroy"in s.default.Readable.prototype;function bt(t){return"object"==typeof t&&"object"==typeof t[ht]}class mt{constructor(t){let e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt(t)?e=gt(t.url):(e=t&&t.href?gt(t.href):gt(""+t),t={});let n=r.method||t.method||"GET";if(n=n.toUpperCase(),(null!=r.body||bt(t)&&null!==t.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let i=null!=r.body?r.body:bt(t)&&null!==t.body?X(t):null;F.call(this,i,{timeout:r.timeout||t.timeout||0,size:r.size||t.size||0});const o=new it(r.headers||t.headers||{});if(null!=i&&!o.has("Content-Type")){const t=Q(i);t&&o.append("Content-Type",t)}let s=bt(t)?t.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(t){const e=t&&"object"==typeof t&&Object.getPrototypeOf(t);return!(!e||"AbortSignal"!==e.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[ht]={method:n,redirect:r.redirect||t.redirect||"follow",headers:o,parsedURL:e,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==t.follow?t.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===t.compress||t.compress,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent}get method(){return this[ht].method}get url(){return dt(this[ht].parsedURL)}get headers(){return this[ht].headers}get redirect(){return this[ht].redirect}get signal(){return this[ht].signal}clone(){return new mt(this)}}function yt(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}F.mixIn(mt.prototype),Object.defineProperty(mt.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(mt.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),yt.prototype=Object.create(Error.prototype),yt.prototype.constructor=yt,yt.prototype.name="AbortError";const wt=s.default.PassThrough,vt=u.default.resolve;function Bt(t,e){if(!Bt.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return F.Promise=Bt.Promise,new Bt.Promise((function(r,n){const i=new mt(t,e),o=function(t){const e=t[ht].parsedURL,r=new it(t[ht].headers);if(r.has("Accept")||r.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof s.default.Readable&&!pt)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let n=null;if(null==t.body&&/^(POST|PUT)$/i.test(t.method)&&(n="0"),null!=t.body){const e=Z(t);"number"==typeof e&&(n=String(e))}n&&r.set("Content-Length",n),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=t.agent;return"function"==typeof i&&(i=i(e)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},e,{method:t.method,headers:lt(r),agent:i})}(i),u=("https:"===o.protocol?l.default:a.default).request,_=i.signal;let f=null;const h=function(){let t=new yt("The user aborted a request.");n(t),i.body&&i.body instanceof s.default.Readable&&i.body.destroy(t),f&&f.body&&f.body.emit("error",t)};if(_&&_.aborted)return void h();const g=function(){h(),b()},d=u(o);let p;function b(){d.abort(),_&&_.removeEventListener("abort",g),clearTimeout(p)}_&&_.addEventListener("abort",g),i.timeout&&d.once("socket",(function(t){p=setTimeout((function(){n(new q("network timeout at: "+i.url,"request-timeout")),b()}),i.timeout)})),d.on("error",(function(t){n(new q(`request to ${i.url} failed, reason: ${t.message}`,"system",t)),b()})),d.on("response",(function(t){clearTimeout(p);const e=function(t){const e=new it;for(const r of Object.keys(t))if(!K.test(r))if(Array.isArray(t[r]))for(const n of t[r])Y.test(n)||(void 0===e[nt][r]?e[nt][r]=[n]:e[nt][r].push(n));else Y.test(t[r])||(e[nt][r]=[t[r]]);return e}(t.headers);if(Bt.isRedirect(t.statusCode)){const o=e.get("Location"),s=null===o?null:vt(i.url,o);switch(i.redirect){case"error":return n(new q("uri requested responds with a redirect, redirect mode is set to error: "+i.url,"no-redirect")),void b();case"manual":if(null!==s)try{e.set("Location",s)}catch(t){n(t)}break;case"follow":if(null===s)break;if(i.counter>=i.follow)return n(new q("maximum redirect reached at: "+i.url,"max-redirect")),void b();const o={headers:new it(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:i.body,signal:i.signal,timeout:i.timeout,size:i.size};return 303!==t.statusCode&&i.body&&null===Z(i)?(n(new q("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void b()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==i.method)||(o.method="GET",o.body=void 0,o.headers.delete("content-length")),r(Bt(new mt(s,o))),void b())}}t.once("end",(function(){_&&_.removeEventListener("abort",g)}));let o=t.pipe(new wt);const s={url:i.url,status:t.statusCode,statusText:t.statusMessage,headers:e,size:i.size,timeout:i.timeout,counter:i.counter},a=e.get("Content-Encoding");if(!i.compress||"HEAD"===i.method||null===a||204===t.statusCode||304===t.statusCode)return f=new ft(o,s),void r(f);const u={flush:c.default.Z_SYNC_FLUSH,finishFlush:c.default.Z_SYNC_FLUSH};if("gzip"==a||"x-gzip"==a)return o=o.pipe(c.default.createGunzip(u)),f=new ft(o,s),void r(f);if("deflate"!=a&&"x-deflate"!=a){if("br"==a&&"function"==typeof c.default.createBrotliDecompress)return o=o.pipe(c.default.createBrotliDecompress()),f=new ft(o,s),void r(f);f=new ft(o,s),r(f)}else{t.pipe(new wt).once("data",(function(t){o=8==(15&t[0])?o.pipe(c.default.createInflate()):o.pipe(c.default.createInflateRaw()),f=new ft(o,s),r(f)}))}})),function(t,e){const r=e.body;null===r?t.end():J(r)?r.stream().pipe(t):Buffer.isBuffer(r)?(t.write(r),t.end()):r.pipe(t)}(d,i)}))}Bt.isRedirect=function(t){return 301===t||302===t||303===t||307===t||308===t},Bt.Promise=global.Promise;var Pt,Dt,St=Object.freeze({__proto__:null,default:Bt,Headers:it,Request:mt,Response:ft,FetchError:q}),Tt=(function(t,e){var r=St.default||St,n=function(t,e){return/^\/\//.test(t)&&(t="https:"+t),r.call(this,t,e)};t.exports=e=n,e.fetch=n,e.Headers=St.Headers,e.Request=St.Request,e.Response=St.Response,e.default=n}(Dt={path:Pt,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&Dt.path)}},Dt.exports),Dt.exports);function kt(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const xt={get:(t,e,r)=>"send"===e?async()=>{const e=await Tt(t.uri,kt({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},Ct={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},xt):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await Tt(t.uri,kt({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class Et{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,Ct)}static create(t){return new Et(t)}}function Ot(t){return g.BigInt(t)}function At(t){return"0x"+t.toString(16)}function jt(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=At(g.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function It(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function Rt(t,{debugPath:e="script"}={}){return It(e,t,{code_hash:zt(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case 0:case 1:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:zt(-1)})}function Lt(t,{debugPath:e="out_point"}={}){return It(e,t,{tx_hash:zt(32),index:jt(4)})}function Mt(t){return function(e,r){return t(r,{debugPath:e})}}function Nt(t,{debugPath:e="cell_input"}={}){return It(e,t,{since:jt(8),previous_output:Mt(Lt)})}function $t(t,{debugPath:e="cell_output"}={}){const r=It(e,t,{capacity:jt(8),lock:Mt(Rt)});return t.type&&(r.type_=Rt(t.type,{debugPath:e+".type"})),r}function qt(t,{debugPath:e="cell_dep"}={}){return It(e,t,{out_point:Mt(Lt),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function Ut(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function Vt(t,{debugPath:e="raw_transaction"}={}){return It(e,t,{version:jt(4),cell_deps:Ut(Mt(qt)),header_deps:Ut(zt(32)),inputs:Ut(Mt(Nt)),outputs:Ut(Mt($t)),outputs_data:Ut(zt(-1))})}function Ht(t,{debugPath:e="transaction"}={}){const r=Vt(t,{debugPath:"(raw)"+e}),n=It(e,t,{witnesses:Ut(zt(-1))});return n.raw=r,n}function Ft(t,{debugPath:e="raw_header"}={}){return It(e,t,{version:jt(4),compact_target:jt(4),timestamp:jt(8),number:jt(8),epoch:jt(8),parent_hash:zt(32),transactions_root:zt(32),proposals_hash:zt(32),uncles_hash:zt(32),dao:zt(32)})}function Gt(t,{debugPath:e="header"}={}){const r=Ft(t,{debugPath:"(raw)"+e}),n=It(e,t,{nonce:jt(16)});return n.raw=r,n}function Wt(t,{debugPath:e="uncle_block"}={}){return It(e,t,{header:Mt(Gt),proposals:Ut(zt(10))})}var Jt=Object.freeze({__proto__:null,NormalizeScript:Rt,NormalizeOutPoint:Lt,NormalizeCellInput:Nt,NormalizeCellOutput:$t,NormalizeCellDep:qt,NormalizeRawTransaction:Vt,NormalizeTransaction:Ht,NormalizeRawHeader:Ft,NormalizeHeader:Gt,NormalizeUncleBlock:Wt,NormalizeBlock:function(t,{debugPath:e="block"}={}){return It(e,t,{header:Mt(Gt),uncles:Ut(Mt(Wt)),transactions:Ut(Mt(Ht)),proposals:Ut(zt(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return It(e,t,{lock:Mt(Rt),message:zt(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=zt(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=zt(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=zt(-1)(e+".output_type",t.output_type)),r}});function Xt(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Qt(t,e,r){if(!((e=Xt(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function Zt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Qt(r,t,{code_hash:Xt,hash_type:Xt,args:Xt}),e&&y(t,{debugPath:"(transformed) "+r}),t}function Kt(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Qt(r,t,{tx_hash:Xt,index:Xt}),e&&w(t,{debugPath:"(transformed) "+r}),t}function Yt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function te(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Qt(r,t,{since:Xt,previous_output:Yt(Kt)}),e&&v(t,{debugPath:"(transformed) "+r}),t}function ee(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Qt(r,t,{capacity:Xt,lock:Yt(Zt),type:Yt(Zt)}),e&&B(t,{debugPath:"(transformed) "+r}),t}function re(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Qt(r,t,{out_point:Yt(Kt),dep_type:Xt}),e&&P(t,{debugPath:"(transformed) "+r}),t}function ne(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function ie(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Qt(r,t,{version:Xt,cell_deps:ne(Yt(re)),header_deps:ne(Xt),inputs:ne(Yt(te)),outputs:ne(Yt(ee)),outputs_data:ne(Xt),witnesses:ne(Xt)}),e&&x(t,{debugPath:"(transformed) "+r}),t}function oe(t,{validation:e=!0,debugPath:r="header"}={}){return t=Qt(r,t,{version:Xt,compact_target:Xt,timestamp:Xt,number:Xt,epoch:Xt,parent_hash:Xt,transactions_root:Xt,proposals_hash:Xt,uncles_hash:Xt,dao:Xt,nonce:Xt}),e&&E(t,{debugPath:"(transformed) "+r}),t}function se(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Qt(r,t,{header:Yt(oe),proposals:ne(Xt)}),e&&A(t,{debugPath:"(transformed) "+r}),t}var ae=Object.freeze({__proto__:null,TransformScript:Zt,TransformOutPoint:Kt,TransformCellInput:te,TransformCellOutput:ee,TransformCellDep:re,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Qt(r,t,{version:Xt,cell_deps:ne(Yt(re)),header_deps:ne(Xt),inputs:ne(Yt(te)),outputs:ne(Yt(ee)),outputs_data:ne(Xt)}),e&&k(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:ie,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Qt(r,t,{version:Xt,compact_target:Xt,timestamp:Xt,number:Xt,epoch:Xt,parent_hash:Xt,transactions_root:Xt,proposals_hash:Xt,uncles_hash:Xt,dao:Xt}),e&&C(t,{debugPath:"(transformed) "+r}),t},TransformHeader:oe,TransformUncleBlock:se,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Qt(r,t,{header:Yt(oe),uncles:ne(Yt(se)),transactions:ne(Yt(ie)),proposals:ne(Xt)}),e&&j(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Qt(r,t,{lock:Yt(Zt),message:Xt}),e&&z(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Qt(r,t,{lock:Xt,input_type:Xt,output_type:Xt}),e&&I(t,{debugPath:"(transformed) "+r}),t}});var ue=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:r=!0,loadData:n=!1,loadBlockNumber:i=!0}={}){this.rpc=t,this.lockHash=new h(e).serializeJson(),this.skipCellWithContent=r,this.loadData=n,this.loadBlockNumber=i}async*collect(){const t=Ot(await this.rpc.get_tip_block_number());let e=g.BigInt(0);for(;g.lessThanOrEqual(e,t);){let r=g.add(e,g.BigInt(100));g.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,At(e),At(r));for(const t of n){if(this.skipCellWithContent&&(t.type||g.greaterThan(Ot(t.output_data_len),g.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=g.add(r,g.BigInt(1))}}}});exports.BigIntToHexString=At,exports.HexStringToBigInt=Ot,exports.RPC=Et,exports.Reader=h,exports.TransactionDumper=class{constructor(t,{validateTransaction:e=!0,depGroupUnpacker:r=null}={}){this.rpc=t,this.validateTransaction=e,this.depGroupUnpacker=r}async dumpByHash(t){const e=(await this.rpc.get_transaction(t)).transaction;return delete e.hash,await this.dump(e)}async dump(t){this.validateTransaction&&x(t);const e=[];for(const r of t.inputs){const{output:t,data:n,header:i}=await this._resolveOutPoint(r.previous_output);e.push({input:r,output:t,data:n,header:i})}const r=[];for(const e of t.cell_deps){const{output:t,data:n,header:i}=await this._resolveOutPoint(e.out_point);if(r.push({cell_dep:e,output:t,data:n,header:i}),"dep_group"===e.dep_type){if(!this.depGroupUnpacker)throw new Error("depGroupUnpacker must be provided when the transaction contains dep_group!");const t=this.depGroupUnpacker(new h(n));for(const e of t){w(e);const{output:t,data:n,header:i}=await this._resolveOutPoint(e);r.push({cell_dep:{out_point:e,dep_type:"code"},output:t,data:n,header:i})}}}const n=[];for(const e of t.header_deps)n.push(await this.rpc.get_header(e));return JSON.stringify({mock_info:{inputs:e,cell_deps:r,header_deps:n},tx:t})}async _resolveOutPoint(t){const e=await this.rpc.get_transaction(t.tx_hash);if(!e||!e.transaction)throw new Error(`Transaction ${t.tx_hash} cannot be found!`);const r=e.transaction,n=g.toNumber(g.BigInt(t.index));if(n>=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}},exports.VERSION="0.10.2",exports.cell_collectors=ue,exports.normalizers=Jt,exports.transformers=ae,exports.validators=R; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("stream"),e=require("http"),r=require("url"),n=require("https"),i=require("zlib");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=o(t),a=o(e),u=o(r),l=o(n),c=o(i);class _{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class f{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");r.setUint8(e,n)}return new _(e)}}class g extends Array{constructor(t,e){if(t>g.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");super(t),this.sign=e}static BigInt(t){var e=Math.floor,r=Number.isFinite;if("number"==typeof t){if(0===t)return g.__zero();if((0|t)===t)return 0>t?g.__oneDigit(-t,!0):g.__oneDigit(t,!1);if(!r(t)||e(t)!==t)throw new RangeError("The number "+t+" cannot be converted to BigInt because it is not an integer");return g.__fromDouble(t)}if("string"==typeof t){const e=g.__fromString(t);if(null===e)throw new SyntaxError("Cannot convert "+t+" to a BigInt");return e}if("boolean"==typeof t)return!0===t?g.__oneDigit(1,!1):g.__zero();if("object"==typeof t){if(t.constructor===g)return t;const e=g.__toPrimitive(t);return g.BigInt(e)}throw new TypeError("Cannot convert "+t+" to a BigInt")}toDebugString(){const t=["BigInt["];for(const e of this)t.push((e?(e>>>0).toString(16):e)+", ");return t.push("]"),t.join("")}toString(t=10){if(2>t||36>>=12;const _=l-12;let f=12<=l?0:a<<20+l,h=20+l;0<_&&0>>32-_,f=a<<_,h=_),0>>32-h,h-=32);const d=g.__decideRounding(t,h,u,a);if((1===d||0===d&&1==(1&f))&&(f=f+1>>>0,0==f&&(c++,0!=c>>>20&&(c=0,s++,1023=g.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){const e=1+(r>>>5),n=t.sign&&0!=(1&r),i=new g(e,n);i.__initializeDigits();const o=1<<(31&r);return i.__setDigit(e-1,o),i}let n=null,i=t;for(0!=(1&r)&&(n=t),r>>=1;0!==r;r>>=1)i=g.multiply(i,i),0!=(1&r)&&(n=null===n?i:g.multiply(n,i));return n}static multiply(t,e){if(0===t.length)return t;if(0===e.length)return e;let r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;const n=new g(r,t.sign!==e.sign);n.__initializeDigits();for(let r=0;rg.__absoluteCompare(t,e))return g.__zero();const r=t.sign!==e.sign,n=e.__unsignedDigit(0);let i;if(1===e.length&&65535>=n){if(1===n)return r===t.sign?t:g.unaryMinus(t);i=g.__absoluteDivSmall(t,n,null)}else i=g.__absoluteDivLarge(t,e,!0,!1);return i.sign=r,i.__trim()}static remainder(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>g.__absoluteCompare(t,e))return t;const r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return g.__zero();const e=g.__absoluteModSmall(t,r);return 0===e?g.__zero():g.__oneDigit(e,t.sign)}const n=g.__absoluteDivLarge(t,e,!1,!0);return n.sign=t.sign,n.__trim()}static add(t,e){const r=t.sign;return r===e.sign?g.__absoluteAdd(t,e,r):0<=g.__absoluteCompare(t,e)?g.__absoluteSub(t,e,r):g.__absoluteSub(e,t,!r)}static subtract(t,e){const r=t.sign;return r===e.sign?0<=g.__absoluteCompare(t,e)?g.__absoluteSub(t,e,r):g.__absoluteSub(e,t,!r):g.__absoluteAdd(t,e,r)}static leftShift(t,e){return 0===e.length||0===t.length?t:e.sign?g.__rightShiftByAbsolute(t,e):g.__leftShiftByAbsolute(t,e)}static signedRightShift(t,e){return 0===e.length||0===t.length?t:e.sign?g.__leftShiftByAbsolute(t,e):g.__rightShiftByAbsolute(t,e)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(t,e){return 0>g.__compareToBigInt(t,e)}static lessThanOrEqual(t,e){return 0>=g.__compareToBigInt(t,e)}static greaterThan(t,e){return 0=g.__kMaxLengthBits)return e;const r=t+31>>>5;if(e.lengthg.__kMaxLengthBits)throw new RangeError("BigInt too big");return g.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=g.__kMaxLengthBits)return e;const r=t+31>>>5;if(e.length>>n)return e}return g.__truncateToNBits(t,e)}static ADD(t,e){if(t=g.__toPrimitive(t),e=g.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=g.__toNumeric(t),e=g.__toNumeric(e),g.__isBigInt(t)&&g.__isBigInt(e))return g.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(t,e){return g.__compare(t,e,0)}static LE(t,e){return g.__compare(t,e,1)}static GT(t,e){return g.__compare(t,e,2)}static GE(t,e){return g.__compare(t,e,3)}static EQ(t,e){for(;;){if(g.__isBigInt(t))return g.__isBigInt(e)?g.equal(t,e):g.EQ(e,t);if("number"==typeof t){if(g.__isBigInt(e))return g.__equalToNumber(e,t);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("string"==typeof t){if(g.__isBigInt(e))return null!==(t=g.__fromString(t))&&g.equal(t,e);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("boolean"==typeof t){if(g.__isBigInt(e))return g.__equalToNumber(e,+t);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("symbol"==typeof t){if(g.__isBigInt(e))return!1;if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else{if("object"!=typeof t)return t==e;if("object"==typeof e&&e.constructor!==g)return t==e;t=g.__toPrimitive(t)}}}static NE(t,e){return!g.EQ(t,e)}static __zero(){return new g(0,!1)}static __oneDigit(t,e){const r=new g(1,e);return r.__setDigit(0,t),r}__copy(){const t=new g(this.length,this.sign);for(let e=0;ee)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}let o=1<>>20)-1023,r=1+(e>>>5),n=new g(r,0>t);let i=1048575&g.__kBitConversionInts[1]|1048576,o=g.__kBitConversionInts[0];const s=31&e;let a,u=0;if(s<20){const t=20-s;u=t+32,a=i>>>t,i=i<<32-t|o>>>t,o<<=32-t}else if(20===s)u=32,a=i,i=o;else{const t=s-20;u=32-t,a=i<>>32-t,i=o<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}static __fromString(t,e=0){let r=0;const n=t.length;let i=0;if(i===n)return g.__zero();let o=t.charCodeAt(i);for(;g.__isWhitespace(o);){if(++i===n)return g.__zero();o=t.charCodeAt(i)}if(43===o){if(++i===n)return null;o=t.charCodeAt(i),r=1}else if(45===o){if(++i===n)return null;o=t.charCodeAt(i),r=-1}if(0===e){if(e=10,48===o){if(++i===n)return g.__zero();if(o=t.charCodeAt(i),88===o||120===o){if(e=16,++i===n)return null;o=t.charCodeAt(i)}else if(79===o||111===o){if(e=8,++i===n)return null;o=t.charCodeAt(i)}else if(66===o||98===o){if(e=2,++i===n)return null;o=t.charCodeAt(i)}}}else if(16===e&&48===o){if(++i===n)return g.__zero();if(o=t.charCodeAt(i),88===o||120===o){if(++i===n)return null;o=t.charCodeAt(i)}}for(;48===o;){if(++i===n)return g.__zero();o=t.charCodeAt(i)}const s=n-i;let a=g.__kMaxBitsPerChar[e],u=g.__kBitsPerCharTableMultiplier-1;if(s>1073741824/a)return null;const l=a*s+u>>>g.__kBitsPerCharTableShift,c=new g(l+31>>>5,!1),_=10>e?e:10,f=10>=g.__kBitsPerCharTableShift;const e=[],r=[];let s=!1;do{let u=0,l=0;for(;;){let e;if(o-48>>>0<_)e=o-48;else{if(!((32|o)-97>>>0>>0<_)a=o-48;else{if(!((32|o)-97>>>0>>g.__kBitsPerCharTableShift+5;c.__inplaceMultiplyAdd(h,l,d)}while(!r)}if(i!==n){if(!g.__isWhitespace(o))return null;for(i++;i>>u-o)}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&i),i=(51&i>>>2)+(51&i),i=(15&i>>>4)+(15&i);const o=i,s=e-1,a=t.__digit(n-1);let u=0|(32*n-r(a)+o-1)/o;if(t.sign&&u++,268435456>>i,f=32-i;f>=o;)l[c--]=g.__kConversionChars[_&s],_>>>=o,f-=o}const h=(_|a<>>o-f;0!==_;)l[c--]=g.__kConversionChars[_&s],_>>>=o;if(t.sign&&(l[c--]="-"),-1!=c)throw new Error("implementation bug");return l.join("")}static __toStringGeneric(t,e,r){var n=Math.clz32;const i=t.length;if(0===i)return"";if(1===i){let n=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(n="-"+n),n}const o=32*i-n(t.__digit(i-1)),s=g.__kMaxBitsPerChar[e]-1;let a=o*g.__kBitsPerCharTableMultiplier;a+=s-1,a=0|a/s;const u=a+1>>1,l=g.exponentiate(g.__oneDigit(e,!1),g.__oneDigit(u,!1));let c,_;const f=l.__unsignedDigit(0);if(1===l.length&&65535>=f){c=new g(t.length,!1),c.__initializeDigits();let r=0;for(let e=2*t.length-1;0<=e;e--){const n=r<<16|t.__halfDigit(e);c.__setHalfDigit(e,0|n/f),r=0|n%f}_=r.toString(e)}else{const r=g.__absoluteDivLarge(t,l,!0,!0);c=r.quotient;const n=r.remainder.__trim();_=g.__toStringGeneric(n,e,!0)}c.__trim();let h=g.__toStringGeneric(c,e,!0);for(;_.lengthn?g.__absoluteLess(r):0}static __compareToNumber(t,e){if(!0|e){const r=t.sign,n=0>e;if(r!==n)return g.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?g.__absoluteGreater(r):oe)return g.__unequalSign(n);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;g.__kBitConversionDouble[0]=e;const i=2047&g.__kBitConversionInts[1]>>>20;if(2047==i)throw new Error("implementation bug: handled elsewhere");const o=i-1023;if(0>o)return g.__absoluteGreater(n);const s=t.length;let a=t.__digit(s-1);const u=r(a),l=32*s-u,c=o+1;if(lc)return g.__absoluteGreater(n);let _=1048576|1048575&g.__kBitConversionInts[1],f=g.__kBitConversionInts[0];const h=31-u;if(h!==(l-1)%31)throw new Error("implementation bug");let d,p=0;if(20>h){const t=20-h;p=t+32,d=_>>>t,_=_<<32-t|f>>>t,f<<=32-t}else if(20===h)p=32,d=_,_=f;else{const t=h-20;p=32-t,d=_<>>32-t,_=f<>>=0,d>>>=0,a>d)return g.__absoluteGreater(n);if(a>>0,_=f,f=0):d=0;const r=t.__unsignedDigit(e);if(r>d)return g.__absoluteGreater(n);if(re&&t.__unsignedDigit(0)===r(e):0===g.__compareToDouble(t,e)}static __comparisonResultToBool(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(g.__isBigInt(t)&&"string"==typeof e)return null!==(e=g.__fromString(e))&&g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if("string"==typeof t&&g.__isBigInt(e))return null!==(t=g.__fromString(t))&&g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if(t=g.__toNumeric(t),e=g.__toNumeric(e),g.__isBigInt(t)){if(g.__isBigInt(e))return g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return g.__comparisonResultToBool(g.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(g.__isBigInt(e))return g.__comparisonResultToBool(g.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(t,e,r){if(t.length>>16)+(r>>>16)+(a>>>16);o=u>>>16,i.__setDigit(s,65535&a|u<<16)}for(;s>>16)+(r>>>16);o=n>>>16,i.__setDigit(s,65535&r|n<<16)}return s>>16;const u=(r>>>16)-(s>>>16)-i;i=1&u>>>16,n.__setDigit(o,65535&a|u<<16)}for(;o>>16;const s=(e>>>16)-i;i=1&s>>>16,n.__setDigit(o,65535&r|s<<16)}return n.__trim()}static __absoluteAddOne(t,e,r=null){const n=t.length;null===r?r=new g(n,e):r.sign=e;let i=!0;for(let e,o=0;on?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}static __multiplyAccumulate(t,e,r,n){var i=Math.imul;if(0===e)return;const o=65535&e,s=e>>>16;let a=0,u=0,l=0;for(let e=0;e>>16;const h=t.__digit(e),g=65535&h,d=h>>>16,p=i(g,o),b=i(g,s),m=i(d,o),y=i(d,s);_+=u+(65535&p),f+=l+a+(_>>>16)+(p>>>16)+(65535&b)+(65535&m),a=f>>>16,u=(b>>>16)+(m>>>16)+(65535&y)+a,a=u>>>16,u&=65535,l=y>>>16,c=65535&_|f<<16,r.__setDigit(n,c)}for(;0!=a||0!==u||0!==l;n++){let t=r.__digit(n);const e=(65535&t)+u,i=(t>>>16)+(e>>>16)+l+a;u=0,l=0,a=i>>>16,t=65535&e|i<<16,r.__setDigit(n,t)}}static __internalMultiplyAdd(t,e,r,n,i){var o=Math.imul;let s=r,a=0;for(let r=0;r>>16;const c=o(n>>>16,e),_=(65535&c)+(u>>>16)+s;s=_>>>16,a=c>>>16,i.__setDigit(r,_<<16|65535&l)}if(i.length>n)for(i.__setDigit(n++,s+a);nthis.length&&(r=this.length);const i=65535&t,o=t>>>16;let s=0,a=65535&e,u=e>>>16;for(let t=0;t>>16,c=n(r,i),_=n(r,o),f=n(l,i),h=n(l,o),g=a+(65535&c),d=u+s+(g>>>16)+(c>>>16)+(65535&_)+(65535&f);a=(_>>>16)+(f>>>16)+(65535&h)+(d>>>16),s=a>>>16,a&=65535,u=h>>>16,this.__setDigit(t,65535&g|d<<16)}if(0!=s||0!==a||0!==u)throw new Error("implementation bug")}static __absoluteDivSmall(t,e,r){null===r&&(r=new g(t.length,!1));let n=0;for(let i,o=2*t.length-1;0<=o;o-=2){i=(n<<16|t.__halfDigit(o))>>>0;const s=0|i/e;n=0|i%e,i=(n<<16|t.__halfDigit(o-1))>>>0;const a=0|i/e;n=0|i%e,r.__setDigit(o>>>1,s<<16|a)}return r}static __absoluteModSmall(t,e){let r=0;for(let n=2*t.length-1;0<=n;n--){r=0|((r<<16|t.__halfDigit(n))>>>0)%e}return r}static __absoluteDivLarge(t,e,r,n){var i=Math.imul;const o=e.__halfDigitLength(),s=e.length,a=t.__halfDigitLength()-o;let u=null;r&&(u=new g(a+2>>>1,!1),u.__initializeDigits());const l=new g(o+2>>>1,!1);l.__initializeDigits();const c=g.__clz16(e.__halfDigit(o-1));0>>0;t=0|r/f;let s=0|r%f;const u=e.__halfDigit(o-2),l=_.__halfDigit(n+o-2);for(;i(t,u)>>>0>(s<<16|l)>>>0&&(t--,s+=f,!(65535>>1,h|t))}return n?(_.__inplaceRightShift(c),r?{quotient:u,remainder:_}:_):r?u:void 0}static __clz16(t){return Math.clz32(t)-16}__inplaceAdd(t,e,r){let n=0;for(let i=0;i>>16,this.__setHalfDigit(e+i,r)}return n}__inplaceSub(t,e,r){let n=0;if(1&e){e>>=1;let i=this.__digit(e),o=65535&i,s=0;for(;s>>1;s++){const r=t.__digit(s),a=(i>>>16)-(65535&r)-n;n=1&a>>>16,this.__setDigit(e+s,a<<16|65535&o),i=this.__digit(e+s+1),o=(65535&i)-(r>>>16)-n,n=1&o>>>16}const a=t.__digit(s),u=(i>>>16)-(65535&a)-n;if(n=1&u>>>16,this.__setDigit(e+s,u<<16|65535&o),e+s+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(i=this.__digit(e+s+1),o=(65535&i)-(a>>>16)-n,n=1&o>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;let i=0;for(;i>>16;const a=(r>>>16)-(o>>>16)-n;n=1&a>>>16,this.__setDigit(e+i,a<<16|65535&s)}const o=this.__digit(e+i),s=t.__digit(i),a=(65535&o)-(65535&s)-n;n=1&a>>>16;let u=0;0==(1&r)&&(u=(o>>>16)-(s>>>16)-n,n=1&u>>>16),this.__setDigit(e+i,u<<16|65535&a)}return n}__inplaceRightShift(t){if(0===t)return;let e=this.__digit(0)>>>t;const r=this.length-1;for(let n=0;n>>t}this.__setDigit(r,e)}static __specialLeftShift(t,e,r){const n=t.length,i=new g(n+r,!1);if(0===e){for(let e=0;e>>32-e}return 0r)throw new RangeError("BigInt too big");const n=r>>>5,i=31&r,o=t.length,s=0!==i&&0!=t.__digit(o-1)>>>32-i,a=o+n+(s?1:0),u=new g(a,t.sign);if(0===i){let e=0;for(;e>>32-i}if(s)u.__setDigit(o+n,e);else if(0!=e)throw new Error("implementation bug")}return u.__trim()}static __rightShiftByAbsolute(t,e){const r=t.length,n=t.sign,i=g.__toShiftAmount(e);if(0>i)return g.__rightShiftByMaximum(n);const o=i>>>5,s=31&i;let a=r-o;if(0>=a)return g.__rightShiftByMaximum(n);let u=!1;if(n)if(0!=(t.__digit(o)&(1<>>s;const n=r-o-1;for(let r=0;r>>s}l.__setDigit(n,e)}return u&&(l=g.__absoluteAddOne(l,!0,l)),l.__trim()}static __rightShiftByMaximum(t){return t?g.__oneDigit(1,!0):g.__zero()}static __toShiftAmount(t){if(1g.__kMaxLengthBits?-1:e}static __toPrimitive(t,e="default"){if("object"!=typeof t)return t;if(t.constructor===g)return t;const r=t[Symbol.toPrimitive];if(r){const t=r(e);if("object"!=typeof t)return t;throw new TypeError("Cannot convert object to primitive value")}const n=t.valueOf;if(n){const e=n.call(t);if("object"!=typeof e)return e}const i=t.toString;if(i){const e=i.call(t);if("object"!=typeof e)return e}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(t){return g.__isBigInt(t)?t:+t}static __isBigInt(t){return"object"==typeof t&&t.constructor===g}static __truncateToNBits(t,e){const r=t+31>>>5,n=new g(r,e.sign),i=r-1;for(let t=0;t>>e}return n.__setDigit(i,o),n.__trim()}static __truncateAndSubFromPowerOfTwo(t,e,r){var n=Math.min;const i=t+31>>>5,o=new g(i,r);let s=0;const a=i-1;let u=0;for(const t=n(a,e.length);s>>16;const n=0-(t>>>16)-u;u=1&n>>>16,o.__setDigit(s,65535&r|n<<16)}for(;s>>16;_=65535&t|0-(l>>>16)-u<<16}else{const t=32-c;l=l<>>t;const e=1<<32-t,r=(65535&e)-(65535&l)-u;u=1&r>>>16;_=65535&r|(e>>>16)-(l>>>16)-u<<16,_&=e-1}return o.__setDigit(a,_),o.__trim()}__digit(t){return this[t]}__unsignedDigit(t){return this[t]>>>0}__setDigit(t,e){this[t]=0|e}__setDigitGrow(t,e){this[t]=0|e}__halfDigitLength(){const t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}__halfDigit(t){return 65535&this[t>>>1]>>>((1&t)<<4)}__setHalfDigit(t,e){const r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}static __digitPow(t,e){let r=1;for(;0>>=1,t*=t;return r}}function d(t,e,r,n=[]){!function(t,e){if(!(e instanceof Object))throw new Error(t+" is not an object!")}(t,e);const i=Object.keys(e).sort(),o=r.length,s=r.length+n.length,a=`${t} does not have correct keys! Required keys: [${r.sort().join(", ")}], optional keys: [${n.sort().join(", ")}], actual keys: [${i.join(", ")}]`;if(i.lengths)throw new Error(a);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(a);if(u.find(t=>!n.includes(t)))throw new Error(a)}function p(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function b(t,e){if(p(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function m(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function y(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(d(r,t,["code_hash","hash_type","args"],[]),b(r+".code_hash",t.code_hash),p(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function w(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){d(r,t,["tx_hash","index"],[]),b(r+".tx_hash",t.tx_hash),m(r+".index",t.index)}function v(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){d(r,t,["since","previous_output"],[]),m(r+".since",t.since),e&&w(t.previous_output,{debugPath:r+".previous_output"})}function B(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){d(r,t,["capacity","lock"],["type"]),m(r+".capacity",t.capacity),e&&(y(t.lock,{debugPath:r+".lock"}),t.type&&y(t.type,{debugPath:r+".type"}))}function P(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(d(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&w(t.out_point,{debugPath:r+".out_point"})}function D(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=r.size;let i=void 0===n?0:n;var o=r.timeout;let a=void 0===o?0:o;null==t?t=null:W(t)?t=Buffer.from(t.toString()):J(t)||Buffer.isBuffer(t)||("[object ArrayBuffer]"===Object.prototype.toString.call(t)?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof s.default||(t=Buffer.from(String(t)))),this[V]={body:t,disturbed:!1,error:null},this.size=i,this.timeout=a,t instanceof s.default&&t.on("error",(function(t){const r="AbortError"===t.name?t:new q(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t);e[V].error=r}))}function G(){var t=this;if(this[V].disturbed)return F.Promise.reject(new TypeError("body used already for: "+this.url));if(this[V].disturbed=!0,this[V].error)return F.Promise.reject(this[V].error);let e=this.body;if(null===e)return F.Promise.resolve(Buffer.alloc(0));if(J(e)&&(e=e.stream()),Buffer.isBuffer(e))return F.Promise.resolve(e);if(!(e instanceof s.default))return F.Promise.resolve(Buffer.alloc(0));let r=[],n=0,i=!1;return new F.Promise((function(o,s){let a;t.timeout&&(a=setTimeout((function(){i=!0,s(new q(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))}),t.timeout)),e.on("error",(function(e){"AbortError"===e.name?(i=!0,s(e)):s(new q(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e))})),e.on("data",(function(e){if(!i&&null!==e){if(t.size&&n+e.length>t.size)return i=!0,void s(new q(`content size at ${t.url} over limit: ${t.size}`,"max-size"));n+=e.length,r.push(e)}})),e.on("end",(function(){if(!i){clearTimeout(a);try{o(Buffer.concat(r,n))}catch(e){s(new q(`Could not create Buffer from response body for ${t.url}: ${e.message}`,"system",e))}}}))}))}function W(t){return"object"==typeof t&&"function"==typeof t.append&&"function"==typeof t.delete&&"function"==typeof t.get&&"function"==typeof t.getAll&&"function"==typeof t.has&&"function"==typeof t.set&&("URLSearchParams"===t.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(t)||"function"==typeof t.sort)}function J(t){return"object"==typeof t&&"function"==typeof t.arrayBuffer&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function X(t){let e,r,n=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof s.default&&"function"!=typeof n.getBoundary&&(e=new H,r=new H,n.pipe(e),n.pipe(r),t[V].body=e,n=r),n}function Q(t){return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":W(t)?"application/x-www-form-urlencoded;charset=UTF-8":J(t)?t.type||null:Buffer.isBuffer(t)||"[object ArrayBuffer]"===Object.prototype.toString.call(t)||ArrayBuffer.isView(t)?null:"function"==typeof t.getBoundary?"multipart/form-data;boundary="+t.getBoundary():t instanceof s.default?null:"text/plain;charset=UTF-8"}function Z(t){const e=t.body;return null===e?0:J(e)?e.size:Buffer.isBuffer(e)?e.length:e&&"function"==typeof e.getLengthSync&&(e._lengthRetrievers&&0==e._lengthRetrievers.length||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}F.prototype={get body(){return this[V].body},get bodyUsed(){return this[V].disturbed},arrayBuffer(){return G.call(this).then((function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}))},blob(){let t=this.headers&&this.headers.get("content-type")||"";return G.call(this).then((function(e){return Object.assign(new $([],{type:t.toLowerCase()}),{[M]:e})}))},json(){var t=this;return G.call(this).then((function(e){try{return JSON.parse(e.toString())}catch(e){return F.Promise.reject(new q(`invalid json response body at ${t.url} reason: ${e.message}`,"invalid-json"))}}))},text(){return G.call(this).then((function(t){return t.toString()}))},buffer(){return G.call(this)},textConverted(){var t=this;return G.call(this).then((function(e){return function(t,e){if("function"!=typeof U)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=e.get("content-type");let n,i,o="utf-8";r&&(n=/charset=([^;]*)/i.exec(r));i=t.slice(0,1024).toString(),!n&&i&&(n=/0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[nt]=Object.create(null),t instanceof it){const e=t.raw(),r=Object.keys(e);for(const t of r)for(const r of e[t])this.append(t,r)}else if(null==t);else{if("object"!=typeof t)throw new TypeError("Provided initializer must be an object");{const e=t[Symbol.iterator];if(null!=e){if("function"!=typeof e)throw new TypeError("Header pairs must be iterable");const r=[];for(const e of t){if("object"!=typeof e||"function"!=typeof e[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(e))}for(const t of r){if(2!==t.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(t[0],t[1])}}else for(const e of Object.keys(t)){const r=t[e];this.append(e,r)}}}}get(t){tt(t=""+t);const e=rt(this[nt],t);return void 0===e?null:this[nt][e].join(", ")}forEach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=ot(this),n=0;for(;n1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(t[nt]).sort();return r.map("key"===e?function(t){return t.toLowerCase()}:"value"===e?function(e){return t[nt][e].join(", ")}:function(e){return[e.toLowerCase(),t[nt][e].join(", ")]})}it.prototype.entries=it.prototype[Symbol.iterator],Object.defineProperty(it.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(it.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const st=Symbol("internal");function at(t,e){const r=Object.create(ut);return r[st]={target:t,kind:e,index:0},r}const ut=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==ut)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[st];const e=t.target,r=t.kind,n=t.index,i=ot(e,r);return n>=i.length?{value:void 0,done:!0}:(this[st].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function lt(t){const e=Object.assign({__proto__:null},t[nt]),r=rt(t[nt],"Host");return void 0!==r&&(e[r]=e[r][0]),e}Object.defineProperty(ut,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const ct=Symbol("Response internals"),_t=a.default.STATUS_CODES;class ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};F.call(this,t,e);const r=e.status||200,n=new it(e.headers);if(null!=t&&!n.has("Content-Type")){const e=Q(t);e&&n.append("Content-Type",e)}this[ct]={url:e.url,status:r,statusText:e.statusText||_t[r],headers:n,counter:e.counter}}get url(){return this[ct].url||""}get status(){return this[ct].status}get ok(){return this[ct].status>=200&&this[ct].status<300}get redirected(){return this[ct].counter>0}get statusText(){return this[ct].statusText}get headers(){return this[ct].headers}clone(){return new ft(X(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}F.mixIn(ft.prototype),Object.defineProperties(ft.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(ft.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const ht=Symbol("Request internals"),gt=u.default.parse,dt=u.default.format,pt="destroy"in s.default.Readable.prototype;function bt(t){return"object"==typeof t&&"object"==typeof t[ht]}class mt{constructor(t){let e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt(t)?e=gt(t.url):(e=t&&t.href?gt(t.href):gt(""+t),t={});let n=r.method||t.method||"GET";if(n=n.toUpperCase(),(null!=r.body||bt(t)&&null!==t.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let i=null!=r.body?r.body:bt(t)&&null!==t.body?X(t):null;F.call(this,i,{timeout:r.timeout||t.timeout||0,size:r.size||t.size||0});const o=new it(r.headers||t.headers||{});if(null!=i&&!o.has("Content-Type")){const t=Q(i);t&&o.append("Content-Type",t)}let s=bt(t)?t.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(t){const e=t&&"object"==typeof t&&Object.getPrototypeOf(t);return!(!e||"AbortSignal"!==e.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[ht]={method:n,redirect:r.redirect||t.redirect||"follow",headers:o,parsedURL:e,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==t.follow?t.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===t.compress||t.compress,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent}get method(){return this[ht].method}get url(){return dt(this[ht].parsedURL)}get headers(){return this[ht].headers}get redirect(){return this[ht].redirect}get signal(){return this[ht].signal}clone(){return new mt(this)}}function yt(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}F.mixIn(mt.prototype),Object.defineProperty(mt.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(mt.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),yt.prototype=Object.create(Error.prototype),yt.prototype.constructor=yt,yt.prototype.name="AbortError";const wt=s.default.PassThrough,vt=u.default.resolve;function Bt(t,e){if(!Bt.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return F.Promise=Bt.Promise,new Bt.Promise((function(r,n){const i=new mt(t,e),o=function(t){const e=t[ht].parsedURL,r=new it(t[ht].headers);if(r.has("Accept")||r.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof s.default.Readable&&!pt)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let n=null;if(null==t.body&&/^(POST|PUT)$/i.test(t.method)&&(n="0"),null!=t.body){const e=Z(t);"number"==typeof e&&(n=String(e))}n&&r.set("Content-Length",n),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=t.agent;return"function"==typeof i&&(i=i(e)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},e,{method:t.method,headers:lt(r),agent:i})}(i),u=("https:"===o.protocol?l.default:a.default).request,_=i.signal;let f=null;const h=function(){let t=new yt("The user aborted a request.");n(t),i.body&&i.body instanceof s.default.Readable&&i.body.destroy(t),f&&f.body&&f.body.emit("error",t)};if(_&&_.aborted)return void h();const g=function(){h(),b()},d=u(o);let p;function b(){d.abort(),_&&_.removeEventListener("abort",g),clearTimeout(p)}_&&_.addEventListener("abort",g),i.timeout&&d.once("socket",(function(t){p=setTimeout((function(){n(new q("network timeout at: "+i.url,"request-timeout")),b()}),i.timeout)})),d.on("error",(function(t){n(new q(`request to ${i.url} failed, reason: ${t.message}`,"system",t)),b()})),d.on("response",(function(t){clearTimeout(p);const e=function(t){const e=new it;for(const r of Object.keys(t))if(!K.test(r))if(Array.isArray(t[r]))for(const n of t[r])Y.test(n)||(void 0===e[nt][r]?e[nt][r]=[n]:e[nt][r].push(n));else Y.test(t[r])||(e[nt][r]=[t[r]]);return e}(t.headers);if(Bt.isRedirect(t.statusCode)){const o=e.get("Location"),s=null===o?null:vt(i.url,o);switch(i.redirect){case"error":return n(new q("uri requested responds with a redirect, redirect mode is set to error: "+i.url,"no-redirect")),void b();case"manual":if(null!==s)try{e.set("Location",s)}catch(t){n(t)}break;case"follow":if(null===s)break;if(i.counter>=i.follow)return n(new q("maximum redirect reached at: "+i.url,"max-redirect")),void b();const o={headers:new it(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:i.body,signal:i.signal,timeout:i.timeout,size:i.size};return 303!==t.statusCode&&i.body&&null===Z(i)?(n(new q("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void b()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==i.method)||(o.method="GET",o.body=void 0,o.headers.delete("content-length")),r(Bt(new mt(s,o))),void b())}}t.once("end",(function(){_&&_.removeEventListener("abort",g)}));let o=t.pipe(new wt);const s={url:i.url,status:t.statusCode,statusText:t.statusMessage,headers:e,size:i.size,timeout:i.timeout,counter:i.counter},a=e.get("Content-Encoding");if(!i.compress||"HEAD"===i.method||null===a||204===t.statusCode||304===t.statusCode)return f=new ft(o,s),void r(f);const u={flush:c.default.Z_SYNC_FLUSH,finishFlush:c.default.Z_SYNC_FLUSH};if("gzip"==a||"x-gzip"==a)return o=o.pipe(c.default.createGunzip(u)),f=new ft(o,s),void r(f);if("deflate"!=a&&"x-deflate"!=a){if("br"==a&&"function"==typeof c.default.createBrotliDecompress)return o=o.pipe(c.default.createBrotliDecompress()),f=new ft(o,s),void r(f);f=new ft(o,s),r(f)}else{t.pipe(new wt).once("data",(function(t){o=8==(15&t[0])?o.pipe(c.default.createInflate()):o.pipe(c.default.createInflateRaw()),f=new ft(o,s),r(f)}))}})),function(t,e){const r=e.body;null===r?t.end():J(r)?r.stream().pipe(t):Buffer.isBuffer(r)?(t.write(r),t.end()):r.pipe(t)}(d,i)}))}Bt.isRedirect=function(t){return 301===t||302===t||303===t||307===t||308===t},Bt.Promise=global.Promise;var Pt,Dt,St=Object.freeze({__proto__:null,default:Bt,Headers:it,Request:mt,Response:ft,FetchError:q}),Tt=(function(t,e){var r=St.default||St,n=function(t,e){return/^\/\//.test(t)&&(t="https:"+t),r.call(this,t,e)};t.exports=e=n,e.fetch=n,e.Headers=St.Headers,e.Request=St.Request,e.Response=St.Response,e.default=n}(Dt={path:Pt,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&Dt.path)}},Dt.exports),Dt.exports);function kt(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const xt={get:(t,e,r)=>"send"===e?async()=>{const e=await Tt(t.uri,kt({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},Ct={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},xt):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await Tt(t.uri,kt({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class Et{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,Ct)}static create(t){return new Et(t)}}function Ot(t){return g.BigInt(t)}function At(t){return"0x"+t.toString(16)}function jt(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=At(g.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function It(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function Rt(t,{debugPath:e="script"}={}){return It(e,t,{code_hash:zt(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:zt(-1)})}function Lt(t,{debugPath:e="out_point"}={}){return It(e,t,{tx_hash:zt(32),index:jt(4)})}function Mt(t){return function(e,r){return t(r,{debugPath:e})}}function Nt(t,{debugPath:e="cell_input"}={}){return It(e,t,{since:jt(8),previous_output:Mt(Lt)})}function $t(t,{debugPath:e="cell_output"}={}){const r=It(e,t,{capacity:jt(8),lock:Mt(Rt)});return t.type&&(r.type_=Rt(t.type,{debugPath:e+".type"})),r}function qt(t,{debugPath:e="cell_dep"}={}){return It(e,t,{out_point:Mt(Lt),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function Ut(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function Vt(t,{debugPath:e="raw_transaction"}={}){return It(e,t,{version:jt(4),cell_deps:Ut(Mt(qt)),header_deps:Ut(zt(32)),inputs:Ut(Mt(Nt)),outputs:Ut(Mt($t)),outputs_data:Ut(zt(-1))})}function Ht(t,{debugPath:e="transaction"}={}){const r=Vt(t,{debugPath:"(raw)"+e}),n=It(e,t,{witnesses:Ut(zt(-1))});return n.raw=r,n}function Ft(t,{debugPath:e="raw_header"}={}){return It(e,t,{version:jt(4),compact_target:jt(4),timestamp:jt(8),number:jt(8),epoch:jt(8),parent_hash:zt(32),transactions_root:zt(32),proposals_hash:zt(32),uncles_hash:zt(32),dao:zt(32)})}function Gt(t,{debugPath:e="header"}={}){const r=Ft(t,{debugPath:"(raw)"+e}),n=It(e,t,{nonce:jt(16)});return n.raw=r,n}function Wt(t,{debugPath:e="uncle_block"}={}){return It(e,t,{header:Mt(Gt),proposals:Ut(zt(10))})}var Jt=Object.freeze({__proto__:null,NormalizeScript:Rt,NormalizeOutPoint:Lt,NormalizeCellInput:Nt,NormalizeCellOutput:$t,NormalizeCellDep:qt,NormalizeRawTransaction:Vt,NormalizeTransaction:Ht,NormalizeRawHeader:Ft,NormalizeHeader:Gt,NormalizeUncleBlock:Wt,NormalizeBlock:function(t,{debugPath:e="block"}={}){return It(e,t,{header:Mt(Gt),uncles:Ut(Mt(Wt)),transactions:Ut(Mt(Ht)),proposals:Ut(zt(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return It(e,t,{lock:Mt(Rt),message:zt(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=zt(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=zt(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=zt(-1)(e+".output_type",t.output_type)),r}});function Xt(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Qt(t,e,r){if(!((e=Xt(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function Zt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Qt(r,t,{code_hash:Xt,hash_type:Xt,args:Xt}),e&&y(t,{debugPath:"(transformed) "+r}),t}function Kt(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Qt(r,t,{tx_hash:Xt,index:Xt}),e&&w(t,{debugPath:"(transformed) "+r}),t}function Yt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function te(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Qt(r,t,{since:Xt,previous_output:Yt(Kt)}),e&&v(t,{debugPath:"(transformed) "+r}),t}function ee(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Qt(r,t,{capacity:Xt,lock:Yt(Zt),type:Yt(Zt)}),e&&B(t,{debugPath:"(transformed) "+r}),t}function re(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Qt(r,t,{out_point:Yt(Kt),dep_type:Xt}),e&&P(t,{debugPath:"(transformed) "+r}),t}function ne(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function ie(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Qt(r,t,{version:Xt,cell_deps:ne(Yt(re)),header_deps:ne(Xt),inputs:ne(Yt(te)),outputs:ne(Yt(ee)),outputs_data:ne(Xt),witnesses:ne(Xt)}),e&&x(t,{debugPath:"(transformed) "+r}),t}function oe(t,{validation:e=!0,debugPath:r="header"}={}){return t=Qt(r,t,{version:Xt,compact_target:Xt,timestamp:Xt,number:Xt,epoch:Xt,parent_hash:Xt,transactions_root:Xt,proposals_hash:Xt,uncles_hash:Xt,dao:Xt,nonce:Xt}),e&&E(t,{debugPath:"(transformed) "+r}),t}function se(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Qt(r,t,{header:Yt(oe),proposals:ne(Xt)}),e&&A(t,{debugPath:"(transformed) "+r}),t}var ae=Object.freeze({__proto__:null,TransformScript:Zt,TransformOutPoint:Kt,TransformCellInput:te,TransformCellOutput:ee,TransformCellDep:re,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Qt(r,t,{version:Xt,cell_deps:ne(Yt(re)),header_deps:ne(Xt),inputs:ne(Yt(te)),outputs:ne(Yt(ee)),outputs_data:ne(Xt)}),e&&k(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:ie,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Qt(r,t,{version:Xt,compact_target:Xt,timestamp:Xt,number:Xt,epoch:Xt,parent_hash:Xt,transactions_root:Xt,proposals_hash:Xt,uncles_hash:Xt,dao:Xt}),e&&C(t,{debugPath:"(transformed) "+r}),t},TransformHeader:oe,TransformUncleBlock:se,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Qt(r,t,{header:Yt(oe),uncles:ne(Yt(se)),transactions:ne(Yt(ie)),proposals:ne(Xt)}),e&&j(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Qt(r,t,{lock:Yt(Zt),message:Xt}),e&&z(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Qt(r,t,{lock:Xt,input_type:Xt,output_type:Xt}),e&&I(t,{debugPath:"(transformed) "+r}),t}});var ue=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:r=!0,loadData:n=!1,loadBlockNumber:i=!0}={}){this.rpc=t,this.lockHash=new h(e).serializeJson(),this.skipCellWithContent=r,this.loadData=n,this.loadBlockNumber=i}async*collect(){const t=Ot(await this.rpc.get_tip_block_number());let e=g.BigInt(0);for(;g.lessThanOrEqual(e,t);){let r=g.add(e,g.BigInt(100));g.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,At(e),At(r));for(const t of n){if(this.skipCellWithContent&&(t.type||g.greaterThan(Ot(t.output_data_len),g.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=g.add(r,g.BigInt(1))}}}});exports.BigIntToHexString=At,exports.HexStringToBigInt=Ot,exports.RPC=Et,exports.Reader=h,exports.TransactionDumper=class{constructor(t,{validateTransaction:e=!0,depGroupUnpacker:r=null}={}){this.rpc=t,this.validateTransaction=e,this.depGroupUnpacker=r}async dumpByHash(t){const e=(await this.rpc.get_transaction(t)).transaction;return delete e.hash,await this.dump(e)}async dump(t){this.validateTransaction&&x(t);const e=[];for(const r of t.inputs){const{output:t,data:n,header:i}=await this._resolveOutPoint(r.previous_output);e.push({input:r,output:t,data:n,header:i})}const r=[];for(const e of t.cell_deps){const{output:t,data:n,header:i}=await this._resolveOutPoint(e.out_point);if(r.push({cell_dep:e,output:t,data:n,header:i}),"dep_group"===e.dep_type){if(!this.depGroupUnpacker)throw new Error("depGroupUnpacker must be provided when the transaction contains dep_group!");const t=this.depGroupUnpacker(new h(n));for(const e of t){w(e);const{output:t,data:n,header:i}=await this._resolveOutPoint(e);r.push({cell_dep:{out_point:e,dep_type:"code"},output:t,data:n,header:i})}}}const n=[];for(const e of t.header_deps)n.push(await this.rpc.get_header(e));return JSON.stringify({mock_info:{inputs:e,cell_deps:r,header_deps:n},tx:t})}async _resolveOutPoint(t){const e=await this.rpc.get_transaction(t.tx_hash);if(!e||!e.transaction)throw new Error(`Transaction ${t.tx_hash} cannot be found!`);const r=e.transaction,n=g.toNumber(g.BigInt(t.index));if(n>=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}},exports.VERSION="0.10.2",exports.cell_collectors=ue,exports.normalizers=Jt,exports.transformers=ae,exports.validators=R; //# sourceMappingURL=ckb-js-toolkit.node.js.map diff --git a/dist/ckb-js-toolkit.node.js.map b/dist/ckb-js-toolkit.node.js.map index 24f0a76..4ad13b7 100644 --- a/dist/ckb-js-toolkit.node.js.map +++ b/dist/ckb-js-toolkit.node.js.map @@ -1 +1 @@ -{"version":3,"file":"ckb-js-toolkit.node.js","sources":["../src/reader.js","../node_modules/jsbi/dist/jsbi.mjs","../src/validators.js","../node_modules/node-fetch/lib/index.mjs","../node_modules/cross-fetch/dist/node-ponyfill.js","../src/rpc.js","../src/normalizers.js","../src/transformers.js","../src/cell_collectors/rpc_collector.js","../src/transaction_dumper.js","../src/index.js"],"sourcesContent":["class ArrayBufferReader {\n constructor(buffer) {\n this.view = new DataView(buffer);\n }\n\n length() {\n return this.view.byteLength;\n }\n\n indexAt(i) {\n return this.view.getUint8(i);\n }\n\n toArrayBuffer() {\n return this.view.buffer;\n }\n\n serializeJson() {\n return (\n \"0x\" +\n Array.prototype.map\n .call(new Uint8Array(this.view.buffer), x =>\n (\"00\" + x.toString(16)).slice(-2)\n )\n .join(\"\")\n );\n }\n}\n\nclass HexStringReader {\n constructor(string) {\n this.string = string;\n }\n\n length() {\n return this.string.length / 2 - 1;\n }\n\n indexAt(i) {\n return parseInt(this.string.substr(2 + i * 2, 2), 16);\n }\n\n toArrayBuffer() {\n const buffer = new ArrayBuffer(this.length());\n const view = new DataView(buffer);\n\n for (let i = 0; i < this.length(); i++) {\n view.setUint8(i, this.indexAt(i));\n }\n return buffer;\n }\n\n serializeJson() {\n return this.string;\n }\n}\n\nexport class Reader {\n constructor(input) {\n if (\n input instanceof HexStringReader ||\n input instanceof ArrayBufferReader\n ) {\n return input;\n }\n if (typeof input === \"string\") {\n if (!input.startsWith(\"0x\") || input.length % 2 != 0) {\n throw new Error(\n \"Hex string must start with 0x, and has even numbered length!\"\n );\n }\n return new HexStringReader(input);\n }\n if (input instanceof ArrayBuffer) {\n return new ArrayBufferReader(input);\n }\n throw new Error(\"Reader can only accept hex string or ArrayBuffer!\");\n }\n\n static fromRawString(string) {\n const buffer = new ArrayBuffer(string.length);\n const view = new DataView(buffer);\n\n for (let i = 0; i < string.length; i++) {\n const c = string.charCodeAt(i);\n if (c > 0xff) {\n throw new Error(\"fromRawString can only accept UTF-8 raw string!\");\n }\n view.setUint8(i, c);\n }\n return new ArrayBufferReader(buffer);\n }\n}\n","class JSBI extends Array{constructor(a,b){if(a>JSBI.__kMaxLength)throw new RangeError(\"Maximum BigInt size exceeded\");super(a),this.sign=b}static BigInt(a){var b=Math.floor,c=Number.isFinite;if(\"number\"==typeof a){if(0===a)return JSBI.__zero();if((0|a)===a)return 0>a?JSBI.__oneDigit(-a,!0):JSBI.__oneDigit(a,!1);if(!c(a)||b(a)!==a)throw new RangeError(\"The number \"+a+\" cannot be converted to BigInt because it is not an integer\");return JSBI.__fromDouble(a)}if(\"string\"==typeof a){const b=JSBI.__fromString(a);if(null===b)throw new SyntaxError(\"Cannot convert \"+a+\" to a BigInt\");return b}if(\"boolean\"==typeof a)return!0===a?JSBI.__oneDigit(1,!1):JSBI.__zero();if(\"object\"==typeof a){if(a.constructor===JSBI)return a;const b=JSBI.__toPrimitive(a);return JSBI.BigInt(b)}throw new TypeError(\"Cannot convert \"+a+\" to a BigInt\")}toDebugString(){const a=[\"BigInt[\"];for(const b of this)a.push((b?(b>>>0).toString(16):b)+\", \");return a.push(\"]\"),a.join(\"\")}toString(a=10){if(2>a||36>>=12;const l=j-12;let m=12<=j?0:h<<20+j,n=20+j;0>>32-l,m=h<>>32-n,n-=32);const o=JSBI.__decideRounding(a,n,i,h);if((1===o||0===o&&1==(1&m))&&(m=m+1>>>0,0==m&&(k++,0!=k>>>20&&(k=0,g++,1023=JSBI.__kMaxLengthBits)throw new RangeError(\"BigInt too big\");if(1===a.length&&2===a.__digit(0)){const b=1+(c>>>5),d=a.sign&&0!=(1&c),e=new JSBI(b,d);e.__initializeDigits();const f=1<<(31&c);return e.__setDigit(b-1,f),e}let d=null,e=a;for(0!=(1&c)&&(d=a),c>>=1;0!==c;c>>=1)e=JSBI.multiply(e,e),0!=(1&c)&&(null===d?d=e:d=JSBI.multiply(d,e));return d}static multiply(a,b){if(0===a.length)return a;if(0===b.length)return b;let c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;const d=new JSBI(c,a.sign!==b.sign);d.__initializeDigits();for(let c=0;cJSBI.__absoluteCompare(a,b))return JSBI.__zero();const c=a.sign!==b.sign,d=b.__unsignedDigit(0);let e;if(1===b.length&&65535>=d){if(1===d)return c===a.sign?a:JSBI.unaryMinus(a);e=JSBI.__absoluteDivSmall(a,d,null)}else e=JSBI.__absoluteDivLarge(a,b,!0,!1);return e.sign=c,e.__trim()}static remainder(a,b){if(0===b.length)throw new RangeError(\"Division by zero\");if(0>JSBI.__absoluteCompare(a,b))return a;const c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return JSBI.__zero();const b=JSBI.__absoluteModSmall(a,c);return 0===b?JSBI.__zero():JSBI.__oneDigit(b,a.sign)}const d=JSBI.__absoluteDivLarge(a,b,!1,!0);return d.sign=a.sign,d.__trim()}static add(a,b){const c=a.sign;return c===b.sign?JSBI.__absoluteAdd(a,b,c):0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c)}static subtract(a,b){const c=a.sign;return c===b.sign?0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c):JSBI.__absoluteAdd(a,b,c)}static leftShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__rightShiftByAbsolute(a,b):JSBI.__leftShiftByAbsolute(a,b)}static signedRightShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__leftShiftByAbsolute(a,b):JSBI.__rightShiftByAbsolute(a,b)}static unsignedRightShift(){throw new TypeError(\"BigInts have no unsigned right shift; use >> instead\")}static lessThan(a,b){return 0>JSBI.__compareToBigInt(a,b)}static lessThanOrEqual(a,b){return 0>=JSBI.__compareToBigInt(a,b)}static greaterThan(a,b){return 0=JSBI.__kMaxLengthBits)return b;const c=a+31>>>5;if(b.lengthJSBI.__kMaxLengthBits)throw new RangeError(\"BigInt too big\");return JSBI.__truncateAndSubFromPowerOfTwo(a,b,!1)}if(a>=JSBI.__kMaxLengthBits)return b;const c=a+31>>>5;if(b.length>>d)return b}return JSBI.__truncateToNBits(a,b)}static ADD(a,b){if(a=JSBI.__toPrimitive(a),b=JSBI.__toPrimitive(b),\"string\"==typeof a)return\"string\"!=typeof b&&(b=b.toString()),a+b;if(\"string\"==typeof b)return a.toString()+b;if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)&&JSBI.__isBigInt(b))return JSBI.add(a,b);if(\"number\"==typeof a&&\"number\"==typeof b)return a+b;throw new TypeError(\"Cannot mix BigInt and other types, use explicit conversions\")}static LT(a,b){return JSBI.__compare(a,b,0)}static LE(a,b){return JSBI.__compare(a,b,1)}static GT(a,b){return JSBI.__compare(a,b,2)}static GE(a,b){return JSBI.__compare(a,b,3)}static EQ(a,b){for(;;){if(JSBI.__isBigInt(a))return JSBI.__isBigInt(b)?JSBI.equal(a,b):JSBI.EQ(b,a);if(\"number\"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,a);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"string\"==typeof a){if(JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.equal(a,b);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"boolean\"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,+a);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"symbol\"==typeof a){if(JSBI.__isBigInt(b))return!1;if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"object\"==typeof a){if(\"object\"==typeof b&&b.constructor!==JSBI)return a==b;a=JSBI.__toPrimitive(a)}else return a==b}}static NE(a,b){return!JSBI.EQ(a,b)}static __zero(){return new JSBI(0,!1)}static __oneDigit(a,b){const c=new JSBI(1,b);return c.__setDigit(0,a),c}__copy(){const a=new JSBI(this.length,this.sign);for(let b=0;bb)e=-b-1;else{if(0===c)return-1;c--,d=a.__digit(c),e=31}let f=1<>>20,c=b-1023,d=(c>>>5)+1,e=new JSBI(d,0>a);let f=1048575&JSBI.__kBitConversionInts[1]|1048576,g=JSBI.__kBitConversionInts[0];const h=20,i=31&c;let j,k=0;if(i<20){const a=h-i;k=a+32,j=f>>>a,f=f<<32-a|g>>>a,g<<=32-a}else if(i===20)k=32,j=f,f=g;else{const a=i-h;k=32-a,j=f<>>32-a,f=g<=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}static __fromString(a,b=0){let c=0;const e=a.length;let f=0;if(f===e)return JSBI.__zero();let g=a.charCodeAt(f);for(;JSBI.__isWhitespace(g);){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}if(43===g){if(++f===e)return null;g=a.charCodeAt(f),c=1}else if(45===g){if(++f===e)return null;g=a.charCodeAt(f),c=-1}if(0===b){if(b=10,48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(b=16,++f===e)return null;g=a.charCodeAt(f)}else if(79===g||111===g){if(b=8,++f===e)return null;g=a.charCodeAt(f)}else if(66===g||98===g){if(b=2,++f===e)return null;g=a.charCodeAt(f)}}}else if(16===b&&48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(++f===e)return null;g=a.charCodeAt(f)}}for(;48===g;){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}const h=e-f;let i=JSBI.__kMaxBitsPerChar[b],j=JSBI.__kBitsPerCharTableMultiplier-1;if(h>1073741824/i)return null;const k=i*h+j>>>JSBI.__kBitsPerCharTableShift,l=new JSBI(k+31>>>5,!1),n=10>b?b:10,o=10>=JSBI.__kBitsPerCharTableShift;const b=[],c=[];let d=!1;do{let h=0,j=0;for(;;){let b;if(g-48>>>0>>0>>0>>0>>JSBI.__kBitsPerCharTableShift+5;l.__inplaceMultiplyAdd(p,k,q)}while(!c)}if(f!==e){if(!JSBI.__isWhitespace(g))return null;for(f++;f>>i-f)}if(0!==e){if(d>=a.length)throw new Error(\"implementation bug\");a.__setDigit(d++,e)}for(;d>>1)+(85&e),e=(51&e>>>2)+(51&e),e=(15&e>>>4)+(15&e);const f=e,g=b-1,h=a.__digit(d-1),i=c(h);let j=0|(32*d-i+f-1)/f;if(a.sign&&j++,268435456>>e,n=32-e;n>=f;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f,n-=f}const o=(m|h<>>f-n;0!==m;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f;if(a.sign&&(k[l--]=\"-\"),-1!=l)throw new Error(\"implementation bug\");return k.join(\"\")}static __toStringGeneric(a,b,c){var d=Math.clz32;const e=a.length;if(0===e)return\"\";if(1===e){let d=a.__unsignedDigit(0).toString(b);return!1===c&&a.sign&&(d=\"-\"+d),d}const f=32*e-d(a.__digit(e-1)),g=JSBI.__kMaxBitsPerChar[b],h=g-1;let i=f*JSBI.__kBitsPerCharTableMultiplier;i+=h-1,i=0|i/h;const j=i+1>>1,k=JSBI.exponentiate(JSBI.__oneDigit(b,!1),JSBI.__oneDigit(j,!1));let l,m;const n=k.__unsignedDigit(0);if(1===k.length&&65535>=n){l=new JSBI(a.length,!1),l.__initializeDigits();let c=0;for(let b=2*a.length-1;0<=b;b--){const d=c<<16|a.__halfDigit(b);l.__setHalfDigit(b,0|d/n),c=0|d%n}m=c.toString(b)}else{const c=JSBI.__absoluteDivLarge(a,k,!0,!0);l=c.quotient;const d=c.remainder.__trim();m=JSBI.__toStringGeneric(d,b,!0)}l.__trim();let o=JSBI.__toStringGeneric(l,b,!0);for(;m.lengthd?JSBI.__absoluteLess(c):0}static __compareToNumber(a,b){if(b|!0){const c=a.sign,d=0>b;if(c!==d)return JSBI.__unequalSign(c);if(0===a.length){if(d)throw new Error(\"implementation bug\");return 0===b?0:-1}if(1e?JSBI.__absoluteGreater(c):fb)return JSBI.__unequalSign(d);if(0===b)throw new Error(\"implementation bug: should be handled elsewhere\");if(0===a.length)return-1;JSBI.__kBitConversionDouble[0]=b;const e=2047&JSBI.__kBitConversionInts[1]>>>20;if(2047==e)throw new Error(\"implementation bug: handled elsewhere\");const f=e-1023;if(0>f)return JSBI.__absoluteGreater(d);const g=a.length;let h=a.__digit(g-1);const i=c(h),j=32*g-i,k=f+1;if(jk)return JSBI.__absoluteGreater(d);let l=1048576|1048575&JSBI.__kBitConversionInts[1],m=JSBI.__kBitConversionInts[0];const n=20,o=31-i;if(o!==(j-1)%31)throw new Error(\"implementation bug\");let p,q=0;if(20>o){const a=n-o;q=a+32,p=l>>>a,l=l<<32-a|m>>>a,m<<=32-a}else if(20===o)q=32,p=l,l=m;else{const a=o-n;q=32-a,p=l<>>32-a,l=m<>>=0,p>>>=0,h>p)return JSBI.__absoluteGreater(d);if(h>>0,l=m,m=0):p=0;const b=a.__unsignedDigit(c);if(b>p)return JSBI.__absoluteGreater(d);if(bb&&a.__unsignedDigit(0)===c(b):0===JSBI.__compareToDouble(a,b)}static __comparisonResultToBool(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0b;case 3:return a>=b;}if(JSBI.__isBigInt(a)&&\"string\"==typeof b)return b=JSBI.__fromString(b),null!==b&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(\"string\"==typeof a&&JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)){if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(\"number\"!=typeof b)throw new Error(\"implementation bug\");return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(a,b),c)}if(\"number\"!=typeof a)throw new Error(\"implementation bug\");if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(b,a),2^c);if(\"number\"!=typeof b)throw new Error(\"implementation bug\");return 0===c?ab:3===c?a>=b:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(a,b,c){if(a.length>>16)+(c>>>16)+(h>>>16);f=i>>>16,e.__setDigit(g,65535&h|i<<16)}for(;g>>16)+(c>>>16);f=d>>>16,e.__setDigit(g,65535&c|d<<16)}return g>>16;const i=(c>>>16)-(g>>>16)-e;e=1&i>>>16,d.__setDigit(f,65535&h|i<<16)}for(;f>>16;const g=(b>>>16)-e;e=1&g>>>16,d.__setDigit(f,65535&c|g<<16)}return d.__trim()}static __absoluteAddOne(a,b,c=null){const d=a.length;null===c?c=new JSBI(d,b):c.sign=b;let e=!0;for(let f,g=0;gd?0:a.__unsignedDigit(d)>b.__unsignedDigit(d)?1:-1}static __multiplyAccumulate(a,b,c,d){var e=Math.imul;if(0===b)return;const f=65535&b,g=b>>>16;let h=0,j=0,k=0;for(let l=0;l>>16;const n=a.__digit(l),o=65535&n,p=n>>>16,q=e(o,f),r=e(o,g),s=e(p,f),t=e(p,g);i+=j+(65535&q),m+=k+h+(i>>>16)+(q>>>16)+(65535&r)+(65535&s),h=m>>>16,j=(r>>>16)+(s>>>16)+(65535&t)+h,h=j>>>16,j&=65535,k=t>>>16,b=65535&i|m<<16,c.__setDigit(d,b)}for(;0!=h||0!==j||0!==k;d++){let a=c.__digit(d);const b=(65535&a)+j,e=(a>>>16)+(b>>>16)+k+h;j=0,k=0,h=e>>>16,a=65535&b|e<<16,c.__setDigit(d,a)}}static __internalMultiplyAdd(a,b,c,d,e){var f=Math.imul;let g=c,h=0;for(let j=0;j>>16;const k=f(c>>>16,b),l=(65535&k)+(d>>>16)+g;g=l>>>16,h=k>>>16,e.__setDigit(j,l<<16|65535&i)}if(e.length>d)for(e.__setDigit(d++,g+h);dthis.length&&(c=this.length);const f=65535&a,g=a>>>16;let h=0,j=65535&b,k=b>>>16;for(let l=0;l>>16,d=e(b,f),i=e(b,g),m=e(c,f),n=e(c,g),o=j+(65535&d),p=k+h+(o>>>16)+(d>>>16)+(65535&i)+(65535&m);j=(i>>>16)+(m>>>16)+(65535&n)+(p>>>16),h=j>>>16,j&=65535,k=n>>>16;this.__setDigit(l,65535&o|p<<16)}if(0!=h||0!==j||0!==k)throw new Error(\"implementation bug\")}static __absoluteDivSmall(a,b,c){null===c&&(c=new JSBI(a.length,!1));let d=0;for(let e,f=2*a.length-1;0<=f;f-=2){e=(d<<16|a.__halfDigit(f))>>>0;const g=0|e/b;d=0|e%b,e=(d<<16|a.__halfDigit(f-1))>>>0;const h=0|e/b;d=0|e%b,c.__setDigit(f>>>1,g<<16|h)}return c}static __absoluteModSmall(a,b){let c=0;for(let d=2*a.length-1;0<=d;d--){const e=(c<<16|a.__halfDigit(d))>>>0;c=0|e%b}return c}static __absoluteDivLarge(a,b,d,e){var f=Math.imul;const g=b.__halfDigitLength(),h=b.length,c=a.__halfDigitLength()-g;let i=null;d&&(i=new JSBI(c+2>>>1,!1),i.__initializeDigits());const k=new JSBI(g+2>>>1,!1);k.__initializeDigits();const l=JSBI.__clz16(b.__halfDigit(g-1));0>>0;l=0|c/n;let d=0|c%n;const e=b.__halfDigit(g-2),h=m.__halfDigit(p+g-2);for(;f(l,e)>>>0>(d<<16|h)>>>0&&(l--,d+=n,!(65535>>1,o|l))}return e?(m.__inplaceRightShift(l),d?{quotient:i,remainder:m}:m):d?i:void 0}static __clz16(a){return Math.clz32(a)-16}__inplaceAdd(a,b,c){let d=0;for(let e=0;e>>16,this.__setHalfDigit(b+e,c)}return d}__inplaceSub(a,b,c){let d=0;if(1&b){b>>=1;let e=this.__digit(b),f=65535&e,g=0;for(;g>>1;g++){const c=a.__digit(g),h=(e>>>16)-(65535&c)-d;d=1&h>>>16,this.__setDigit(b+g,h<<16|65535&f),e=this.__digit(b+g+1),f=(65535&e)-(c>>>16)-d,d=1&f>>>16}const h=a.__digit(g),i=(e>>>16)-(65535&h)-d;d=1&i>>>16,this.__setDigit(b+g,i<<16|65535&f);if(b+g+1>=this.length)throw new RangeError(\"out of bounds\");0==(1&c)&&(e=this.__digit(b+g+1),f=(65535&e)-(h>>>16)-d,d=1&f>>>16,this.__setDigit(b+a.length,4294901760&e|65535&f))}else{b>>=1;let e=0;for(;e>>16;const h=(c>>>16)-(f>>>16)-d;d=1&h>>>16,this.__setDigit(b+e,h<<16|65535&g)}const f=this.__digit(b+e),g=a.__digit(e),h=(65535&f)-(65535&g)-d;d=1&h>>>16;let i=0;0==(1&c)&&(i=(f>>>16)-(g>>>16)-d,d=1&i>>>16),this.__setDigit(b+e,i<<16|65535&h)}return d}__inplaceRightShift(a){if(0===a)return;let b=this.__digit(0)>>>a;const c=this.length-1;for(let e=0;e>>a}this.__setDigit(c,b)}static __specialLeftShift(a,b,c){const d=a.length,e=new JSBI(d+c,!1);if(0===b){for(let b=0;b>>32-b}return 0c)throw new RangeError(\"BigInt too big\");const e=c>>>5,f=31&c,g=a.length,h=0!==f&&0!=a.__digit(g-1)>>>32-f,j=g+e+(h?1:0),k=new JSBI(j,a.sign);if(0===f){let b=0;for(;b>>32-f}if(h)k.__setDigit(g+e,b);else if(0!=b)throw new Error(\"implementation bug\")}return k.__trim()}static __rightShiftByAbsolute(a,b){const c=a.length,d=a.sign,e=JSBI.__toShiftAmount(b);if(0>e)return JSBI.__rightShiftByMaximum(d);const f=e>>>5,g=31&e;let h=c-f;if(0>=h)return JSBI.__rightShiftByMaximum(d);let i=!1;if(d){if(0!=(a.__digit(f)&(1<>>g;const d=c-f-1;for(let c=0;c>>g}j.__setDigit(d,b)}return i&&(j=JSBI.__absoluteAddOne(j,!0,j)),j.__trim()}static __rightShiftByMaximum(a){return a?JSBI.__oneDigit(1,!0):JSBI.__zero()}static __toShiftAmount(a){if(1JSBI.__kMaxLengthBits?-1:b}static __toPrimitive(a,b=\"default\"){if(\"object\"!=typeof a)return a;if(a.constructor===JSBI)return a;const c=a[Symbol.toPrimitive];if(c){const a=c(b);if(\"object\"!=typeof a)return a;throw new TypeError(\"Cannot convert object to primitive value\")}const d=a.valueOf;if(d){const b=d.call(a);if(\"object\"!=typeof b)return b}const e=a.toString;if(e){const b=e.call(a);if(\"object\"!=typeof b)return b}throw new TypeError(\"Cannot convert object to primitive value\")}static __toNumeric(a){return JSBI.__isBigInt(a)?a:+a}static __isBigInt(a){return\"object\"==typeof a&&a.constructor===JSBI}static __truncateToNBits(a,b){const c=a+31>>>5,d=new JSBI(c,b.sign),e=c-1;for(let c=0;c>>b}return d.__setDigit(e,f),d.__trim()}static __truncateAndSubFromPowerOfTwo(a,b,c){var d=Math.min;const e=a+31>>>5,f=new JSBI(e,c);let g=0;const h=e-1;let j=0;for(const e=d(h,b.length);g>>16;const d=0-(a>>>16)-j;j=1&d>>>16,f.__setDigit(g,65535&c|d<<16)}for(;g>>16;const b=0-(k>>>16)-j;m=65535&a|b<<16}else{const a=32-l;k=k<>>a;const b=1<<32-a,c=(65535&b)-(65535&k)-j;j=1&c>>>16;const d=(b>>>16)-(k>>>16)-j;m=65535&c|d<<16,m&=b-1}return f.__setDigit(h,m),f.__trim()}__digit(a){return this[a]}__unsignedDigit(a){return this[a]>>>0}__setDigit(a,b){this[a]=0|b}__setDigitGrow(a,b){this[a]=0|b}__halfDigitLength(){const a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}__halfDigit(a){return 65535&this[a>>>1]>>>((1&a)<<4)}__setHalfDigit(a,b){const c=a>>>1,d=this.__digit(c),e=1&a?65535&d|b<<16:4294901760&d|65535&b;this.__setDigit(c,e)}static __digitPow(a,b){let c=1;for(;0>>=1,a*=a;return c}}JSBI.__kMaxLength=33554432,JSBI.__kMaxLengthBits=JSBI.__kMaxLength<<5,JSBI.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],JSBI.__kBitsPerCharTableShift=5,JSBI.__kBitsPerCharTableMultiplier=1< maximalLength\n ) {\n throw new Error(errorMessage);\n }\n let optionalProvidedKeys = providedKeys.filter(\n key => !expectedKeys.includes(key)\n );\n if (providedKeys.length - optionalProvidedKeys.length !== requiredLength) {\n throw new Error(errorMessage);\n }\n if (optionalProvidedKeys.find(key => !optionalKeys.includes(key))) {\n throw new Error(errorMessage);\n }\n}\n\nfunction assertHexString(debugPath, string) {\n if (!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(string)) {\n throw new Error(`${debugPath} must be a hex string!`);\n }\n}\n\nfunction assertHash(debugPath, hash) {\n assertHexString(debugPath, hash);\n if (hash.length != 66) {\n throw new Error(`${debugPath} must be a hex string of 66 bytes long!`);\n }\n}\n\nfunction assertInteger(debugPath, i) {\n if (i === \"0x0\") {\n return;\n }\n if (!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(i)) {\n throw new Error(`${debugPath} must be a hex integer!`);\n }\n}\n\nexport function ValidateScript(\n script,\n { nestedValidation = true, debugPath = \"script\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n script,\n [\"code_hash\", \"hash_type\", \"args\"],\n []\n );\n assertHash(`${debugPath}.code_hash`, script.code_hash);\n assertHexString(`${debugPath}.args`, script.args);\n\n if (script.hash_type !== \"data\" && script.hash_type !== \"type\") {\n throw new Error(`${debugPath}.hash_type must be either data or type!`);\n }\n}\n\nexport function ValidateOutPoint(\n outPoint,\n { nestedValidation = true, debugPath = \"out_point\" } = {}\n) {\n assertObjectWithKeys(debugPath, outPoint, [\"tx_hash\", \"index\"], []);\n assertHash(`${debugPath}.tx_hash`, outPoint.tx_hash);\n assertInteger(`${debugPath}.index`, outPoint.index);\n}\n\nexport function ValidateCellInput(\n cellInput,\n { nestedValidation = true, debugPath = \"cell_input\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellInput, [\"since\", \"previous_output\"], []);\n assertInteger(`${debugPath}.since`, cellInput.since);\n\n if (nestedValidation) {\n ValidateOutPoint(cellInput.previous_output, {\n debugPath: `${debugPath}.previous_output`\n });\n }\n}\n\nexport function ValidateCellOutput(\n cellOutput,\n { nestedValidation = true, debugPath = \"cell_output\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellOutput, [\"capacity\", \"lock\"], [\"type\"]);\n assertInteger(`${debugPath}.capacity`, cellOutput.capacity);\n\n if (nestedValidation) {\n ValidateScript(cellOutput.lock, {\n debugPath: `${debugPath}.lock`\n });\n if (cellOutput.type) {\n ValidateScript(cellOutput.type, {\n debugPath: `${debugPath}.type`\n });\n }\n }\n}\n\nexport function ValidateCellDep(\n cellDep,\n { nestedValidation = true, debugPath = \"cell_dep\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellDep, [\"out_point\", \"dep_type\"], []);\n if (cellDep.dep_type !== \"code\" && cellDep.dep_type !== \"dep_group\") {\n throw new Error(`${debugPath}.dep_type must be either code or dep_group!`);\n }\n\n if (nestedValidation) {\n ValidateOutPoint(cellDep.out_point, {\n debugPath: `${debugPath}.out_point`\n });\n }\n}\n\nfunction assertArray(debugPath, array, validateFunction, nestedValidation) {\n if (!Array.isArray(array)) {\n throw new Error(`${debugPath} is not an array!`);\n }\n if (nestedValidation) {\n for (let i = 0; i < array.length; i++) {\n validateFunction(`${debugPath}[${i}]`, array[i]);\n }\n }\n}\n\nfunction toAssert(validateFunction, nestedValidation) {\n return function(debugPath, value) {\n validateFunction(value, {\n nestedValidation: nestedValidation,\n debugPath: debugPath\n });\n };\n}\n\nfunction assertCommonTransaction(debugPath, rawTransaction, nestedValidation) {\n assertInteger(`${debugPath}.version`, rawTransaction.version);\n assertArray(\n `${debugPath}.cell_deps`,\n rawTransaction.cell_deps,\n toAssert(ValidateCellDep, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.header_deps`,\n rawTransaction.header_deps,\n assertHash,\n nestedValidation\n );\n assertArray(\n `${debugPath}.inputs`,\n rawTransaction.inputs,\n toAssert(ValidateCellInput, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.outputs`,\n rawTransaction.outputs,\n toAssert(ValidateCellOutput, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.outputs_data`,\n rawTransaction.outputs_data,\n assertHexString,\n nestedValidation\n );\n}\n\nexport function ValidateRawTransaction(\n rawTransaction,\n { nestedValidation = true, debugPath = \"raw_transaction\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n rawTransaction,\n [\n \"version\",\n \"cell_deps\",\n \"header_deps\",\n \"inputs\",\n \"outputs\",\n \"outputs_data\"\n ],\n []\n );\n assertCommonTransaction(debugPath, rawTransaction, nestedValidation);\n}\n\nexport function ValidateTransaction(\n transaction,\n { nestedValidation = true, debugPath = \"transaction\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n transaction,\n [\n \"version\",\n \"cell_deps\",\n \"header_deps\",\n \"inputs\",\n \"outputs\",\n \"outputs_data\",\n \"witnesses\"\n ],\n []\n );\n assertCommonTransaction(debugPath, transaction, nestedValidation);\n assertArray(\n `${debugPath}.witnesses`,\n transaction.witnesses,\n assertHexString,\n nestedValidation\n );\n}\n\nfunction assertCommonHeader(debugPath, rawHeader) {\n assertInteger(`${debugPath}.version`, rawHeader.version);\n assertInteger(`${debugPath}.compact_target`, rawHeader.compact_target);\n assertInteger(`${debugPath}.timestamp`, rawHeader.timestamp);\n assertInteger(`${debugPath}.number`, rawHeader.number);\n assertInteger(`${debugPath}.epoch`, rawHeader.epoch);\n assertHash(`${debugPath}.parent_hash`, rawHeader.parent_hash);\n assertHash(`${debugPath}.transactions_root`, rawHeader.transactions_root);\n assertHash(`${debugPath}.proposals_hash`, rawHeader.proposals_hash);\n assertHash(`${debugPath}.uncles_hash`, rawHeader.uncles_hash);\n assertHash(`${debugPath}.dao`, rawHeader.dao);\n}\n\nexport function ValidateRawHeader(\n rawHeader,\n { nestedValidation = true, debugPath = \"raw_header\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n rawHeader,\n [\n \"version\",\n \"compact_target\",\n \"timestamp\",\n \"number\",\n \"epoch\",\n \"parent_hash\",\n \"transactions_root\",\n \"proposals_hash\",\n \"uncles_hash\",\n \"dao\"\n ],\n []\n );\n assertCommonHeader(debugPath, rawHeader);\n}\n\nexport function ValidateHeader(\n header,\n { nestedValidation = true, debugPath = \"header\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n header,\n [\n \"version\",\n \"compact_target\",\n \"timestamp\",\n \"number\",\n \"epoch\",\n \"parent_hash\",\n \"transactions_root\",\n \"proposals_hash\",\n \"uncles_hash\",\n \"dao\",\n \"nonce\"\n ],\n []\n );\n assertHexString(`${debugPath}.nonce`, header.nonce);\n if (header.nonce.length != 34) {\n throw new Error(\n `${debugPath}.nonce must be a hex string of 34 bytes long!`\n );\n }\n}\n\nfunction assertProposalShortId(debugPath, shortId) {\n assertHexString(debugPath, shortId);\n if (shortId.length != 22) {\n throw new Error(`${debugPath} must be a hex string of 22 bytes long!`);\n }\n}\n\nexport function ValidateUncleBlock(\n uncleBlock,\n { nestedValidation = true, debugPath = \"uncle_block\" } = {}\n) {\n assertObjectWithKeys(debugPath, uncleBlock, [\"header\", \"proposals\"], []);\n\n if (nestedValidation) {\n ValidateHeader(uncleBlock.header, {\n debugPath: `${debugPath}.header`\n });\n }\n assertArray(\n `${debugPath}.proposals`,\n uncleBlock.proposals,\n assertProposalShortId,\n nestedValidation\n );\n}\n\nexport function ValidateBlock(\n block,\n { nestedValidation = true, debugPath = \"block\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n block,\n [\"header\", \"uncles\", \"transactions\", \"proposals\"],\n []\n );\n\n if (nestedValidation) {\n ValidateHeader(block.header, {\n debugPath: `${debugPath}.header`\n });\n }\n assertArray(\n `${debugPath}.uncles`,\n block.uncles,\n toAssert(ValidateUncleBlock, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.transactions`,\n block.transactions,\n toAssert(ValidateTransaction, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.proposals`,\n block.proposals,\n assertProposalShortId,\n nestedValidation\n );\n}\n\nexport function ValidateCellbaseWitness(\n cellbaseWitness,\n { nestedValidation = true, debugPath = \"cellbase_witness\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellbaseWitness, [\"lock\", \"message\"], []);\n assertHexString(`${debugPath}.message`, cellbaseWitness.message);\n\n if (nestedValidation) {\n ValidateScript(cellbaseWitness.lock, {\n debugPath: `${debugPath}.lock`\n });\n }\n}\n\nexport function ValidateWitnessArgs(\n witnessArgs,\n { nestedValidation = true, debugPath = \"witness_args\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n witnessArgs,\n [],\n [\"lock\", \"input_type\", \"output_type\"]\n );\n\n if (witnessArgs.lock) {\n assertHexString(`${debugPath}.lock`, witnessArgs.lock);\n }\n if (witnessArgs.input_type) {\n assertHexString(`${debugPath}.input_type`, witnessArgs.input_type);\n }\n if (witnessArgs.output_type) {\n assertHexString(`${debugPath}.output_type`, witnessArgs.output_type);\n }\n}\n","import Stream from 'stream';\nimport http from 'http';\nimport Url from 'url';\nimport https from 'https';\nimport zlib from 'zlib';\n\n// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js\n\n// fix for \"Readable\" isn't a named export issue\nconst Readable = Stream.Readable;\n\nconst BUFFER = Symbol('buffer');\nconst TYPE = Symbol('type');\n\nclass Blob {\n\tconstructor() {\n\t\tthis[TYPE] = '';\n\n\t\tconst blobParts = arguments[0];\n\t\tconst options = arguments[1];\n\n\t\tconst buffers = [];\n\t\tlet size = 0;\n\n\t\tif (blobParts) {\n\t\t\tconst a = blobParts;\n\t\t\tconst length = Number(a.length);\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\tconst element = a[i];\n\t\t\t\tlet buffer;\n\t\t\t\tif (element instanceof Buffer) {\n\t\t\t\t\tbuffer = element;\n\t\t\t\t} else if (ArrayBuffer.isView(element)) {\n\t\t\t\t\tbuffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);\n\t\t\t\t} else if (element instanceof ArrayBuffer) {\n\t\t\t\t\tbuffer = Buffer.from(element);\n\t\t\t\t} else if (element instanceof Blob) {\n\t\t\t\t\tbuffer = element[BUFFER];\n\t\t\t\t} else {\n\t\t\t\t\tbuffer = Buffer.from(typeof element === 'string' ? element : String(element));\n\t\t\t\t}\n\t\t\t\tsize += buffer.length;\n\t\t\t\tbuffers.push(buffer);\n\t\t\t}\n\t\t}\n\n\t\tthis[BUFFER] = Buffer.concat(buffers);\n\n\t\tlet type = options && options.type !== undefined && String(options.type).toLowerCase();\n\t\tif (type && !/[^\\u0020-\\u007E]/.test(type)) {\n\t\t\tthis[TYPE] = type;\n\t\t}\n\t}\n\tget size() {\n\t\treturn this[BUFFER].length;\n\t}\n\tget type() {\n\t\treturn this[TYPE];\n\t}\n\ttext() {\n\t\treturn Promise.resolve(this[BUFFER].toString());\n\t}\n\tarrayBuffer() {\n\t\tconst buf = this[BUFFER];\n\t\tconst ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n\t\treturn Promise.resolve(ab);\n\t}\n\tstream() {\n\t\tconst readable = new Readable();\n\t\treadable._read = function () {};\n\t\treadable.push(this[BUFFER]);\n\t\treadable.push(null);\n\t\treturn readable;\n\t}\n\ttoString() {\n\t\treturn '[object Blob]';\n\t}\n\tslice() {\n\t\tconst size = this.size;\n\n\t\tconst start = arguments[0];\n\t\tconst end = arguments[1];\n\t\tlet relativeStart, relativeEnd;\n\t\tif (start === undefined) {\n\t\t\trelativeStart = 0;\n\t\t} else if (start < 0) {\n\t\t\trelativeStart = Math.max(size + start, 0);\n\t\t} else {\n\t\t\trelativeStart = Math.min(start, size);\n\t\t}\n\t\tif (end === undefined) {\n\t\t\trelativeEnd = size;\n\t\t} else if (end < 0) {\n\t\t\trelativeEnd = Math.max(size + end, 0);\n\t\t} else {\n\t\t\trelativeEnd = Math.min(end, size);\n\t\t}\n\t\tconst span = Math.max(relativeEnd - relativeStart, 0);\n\n\t\tconst buffer = this[BUFFER];\n\t\tconst slicedBuffer = buffer.slice(relativeStart, relativeStart + span);\n\t\tconst blob = new Blob([], { type: arguments[2] });\n\t\tblob[BUFFER] = slicedBuffer;\n\t\treturn blob;\n\t}\n}\n\nObject.defineProperties(Blob.prototype, {\n\tsize: { enumerable: true },\n\ttype: { enumerable: true },\n\tslice: { enumerable: true }\n});\n\nObject.defineProperty(Blob.prototype, Symbol.toStringTag, {\n\tvalue: 'Blob',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\n/**\n * fetch-error.js\n *\n * FetchError interface for operational errors\n */\n\n/**\n * Create FetchError instance\n *\n * @param String message Error message for human\n * @param String type Error type for machine\n * @param String systemError For Node.js system error\n * @return FetchError\n */\nfunction FetchError(message, type, systemError) {\n Error.call(this, message);\n\n this.message = message;\n this.type = type;\n\n // when err.type is `system`, err.code contains system error code\n if (systemError) {\n this.code = this.errno = systemError.code;\n }\n\n // hide custom error implementation details from end-users\n Error.captureStackTrace(this, this.constructor);\n}\n\nFetchError.prototype = Object.create(Error.prototype);\nFetchError.prototype.constructor = FetchError;\nFetchError.prototype.name = 'FetchError';\n\nlet convert;\ntry {\n\tconvert = require('encoding').convert;\n} catch (e) {}\n\nconst INTERNALS = Symbol('Body internals');\n\n// fix an issue where \"PassThrough\" isn't a named export for node <10\nconst PassThrough = Stream.PassThrough;\n\n/**\n * Body mixin\n *\n * Ref: https://fetch.spec.whatwg.org/#body\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nfunction Body(body) {\n\tvar _this = this;\n\n\tvar _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n\t _ref$size = _ref.size;\n\n\tlet size = _ref$size === undefined ? 0 : _ref$size;\n\tvar _ref$timeout = _ref.timeout;\n\tlet timeout = _ref$timeout === undefined ? 0 : _ref$timeout;\n\n\tif (body == null) {\n\t\t// body is undefined or null\n\t\tbody = null;\n\t} else if (isURLSearchParams(body)) {\n\t\t// body is a URLSearchParams\n\t\tbody = Buffer.from(body.toString());\n\t} else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {\n\t\t// body is ArrayBuffer\n\t\tbody = Buffer.from(body);\n\t} else if (ArrayBuffer.isView(body)) {\n\t\t// body is ArrayBufferView\n\t\tbody = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n\t} else if (body instanceof Stream) ; else {\n\t\t// none of the above\n\t\t// coerce to string then buffer\n\t\tbody = Buffer.from(String(body));\n\t}\n\tthis[INTERNALS] = {\n\t\tbody,\n\t\tdisturbed: false,\n\t\terror: null\n\t};\n\tthis.size = size;\n\tthis.timeout = timeout;\n\n\tif (body instanceof Stream) {\n\t\tbody.on('error', function (err) {\n\t\t\tconst error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);\n\t\t\t_this[INTERNALS].error = error;\n\t\t});\n\t}\n}\n\nBody.prototype = {\n\tget body() {\n\t\treturn this[INTERNALS].body;\n\t},\n\n\tget bodyUsed() {\n\t\treturn this[INTERNALS].disturbed;\n\t},\n\n\t/**\n * Decode response as ArrayBuffer\n *\n * @return Promise\n */\n\tarrayBuffer() {\n\t\treturn consumeBody.call(this).then(function (buf) {\n\t\t\treturn buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n\t\t});\n\t},\n\n\t/**\n * Return raw response as Blob\n *\n * @return Promise\n */\n\tblob() {\n\t\tlet ct = this.headers && this.headers.get('content-type') || '';\n\t\treturn consumeBody.call(this).then(function (buf) {\n\t\t\treturn Object.assign(\n\t\t\t// Prevent copying\n\t\t\tnew Blob([], {\n\t\t\t\ttype: ct.toLowerCase()\n\t\t\t}), {\n\t\t\t\t[BUFFER]: buf\n\t\t\t});\n\t\t});\n\t},\n\n\t/**\n * Decode response as json\n *\n * @return Promise\n */\n\tjson() {\n\t\tvar _this2 = this;\n\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\ttry {\n\t\t\t\treturn JSON.parse(buffer.toString());\n\t\t\t} catch (err) {\n\t\t\t\treturn Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));\n\t\t\t}\n\t\t});\n\t},\n\n\t/**\n * Decode response as text\n *\n * @return Promise\n */\n\ttext() {\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\treturn buffer.toString();\n\t\t});\n\t},\n\n\t/**\n * Decode response as buffer (non-spec api)\n *\n * @return Promise\n */\n\tbuffer() {\n\t\treturn consumeBody.call(this);\n\t},\n\n\t/**\n * Decode response as text, while automatically detecting the encoding and\n * trying to decode to UTF-8 (non-spec api)\n *\n * @return Promise\n */\n\ttextConverted() {\n\t\tvar _this3 = this;\n\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\treturn convertBody(buffer, _this3.headers);\n\t\t});\n\t}\n};\n\n// In browsers, all properties are enumerable.\nObject.defineProperties(Body.prototype, {\n\tbody: { enumerable: true },\n\tbodyUsed: { enumerable: true },\n\tarrayBuffer: { enumerable: true },\n\tblob: { enumerable: true },\n\tjson: { enumerable: true },\n\ttext: { enumerable: true }\n});\n\nBody.mixIn = function (proto) {\n\tfor (const name of Object.getOwnPropertyNames(Body.prototype)) {\n\t\t// istanbul ignore else: future proof\n\t\tif (!(name in proto)) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(Body.prototype, name);\n\t\t\tObject.defineProperty(proto, name, desc);\n\t\t}\n\t}\n};\n\n/**\n * Consume and convert an entire Body to a Buffer.\n *\n * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body\n *\n * @return Promise\n */\nfunction consumeBody() {\n\tvar _this4 = this;\n\n\tif (this[INTERNALS].disturbed) {\n\t\treturn Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));\n\t}\n\n\tthis[INTERNALS].disturbed = true;\n\n\tif (this[INTERNALS].error) {\n\t\treturn Body.Promise.reject(this[INTERNALS].error);\n\t}\n\n\tlet body = this.body;\n\n\t// body is null\n\tif (body === null) {\n\t\treturn Body.Promise.resolve(Buffer.alloc(0));\n\t}\n\n\t// body is blob\n\tif (isBlob(body)) {\n\t\tbody = body.stream();\n\t}\n\n\t// body is buffer\n\tif (Buffer.isBuffer(body)) {\n\t\treturn Body.Promise.resolve(body);\n\t}\n\n\t// istanbul ignore if: should never happen\n\tif (!(body instanceof Stream)) {\n\t\treturn Body.Promise.resolve(Buffer.alloc(0));\n\t}\n\n\t// body is stream\n\t// get ready to actually consume the body\n\tlet accum = [];\n\tlet accumBytes = 0;\n\tlet abort = false;\n\n\treturn new Body.Promise(function (resolve, reject) {\n\t\tlet resTimeout;\n\n\t\t// allow timeout on slow response body\n\t\tif (_this4.timeout) {\n\t\t\tresTimeout = setTimeout(function () {\n\t\t\t\tabort = true;\n\t\t\t\treject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));\n\t\t\t}, _this4.timeout);\n\t\t}\n\n\t\t// handle stream errors\n\t\tbody.on('error', function (err) {\n\t\t\tif (err.name === 'AbortError') {\n\t\t\t\t// if the request was aborted, reject with this Error\n\t\t\t\tabort = true;\n\t\t\t\treject(err);\n\t\t\t} else {\n\t\t\t\t// other errors, such as incorrect content-encoding\n\t\t\t\treject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));\n\t\t\t}\n\t\t});\n\n\t\tbody.on('data', function (chunk) {\n\t\t\tif (abort || chunk === null) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (_this4.size && accumBytes + chunk.length > _this4.size) {\n\t\t\t\tabort = true;\n\t\t\t\treject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\taccumBytes += chunk.length;\n\t\t\taccum.push(chunk);\n\t\t});\n\n\t\tbody.on('end', function () {\n\t\t\tif (abort) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tclearTimeout(resTimeout);\n\n\t\t\ttry {\n\t\t\t\tresolve(Buffer.concat(accum, accumBytes));\n\t\t\t} catch (err) {\n\t\t\t\t// handle streams that have accumulated too much data (issue #414)\n\t\t\t\treject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Detect buffer encoding and convert to target encoding\n * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding\n *\n * @param Buffer buffer Incoming buffer\n * @param String encoding Target encoding\n * @return String\n */\nfunction convertBody(buffer, headers) {\n\tif (typeof convert !== 'function') {\n\t\tthrow new Error('The package `encoding` must be installed to use the textConverted() function');\n\t}\n\n\tconst ct = headers.get('content-type');\n\tlet charset = 'utf-8';\n\tlet res, str;\n\n\t// header\n\tif (ct) {\n\t\tres = /charset=([^;]*)/i.exec(ct);\n\t}\n\n\t// no charset in content type, peek at response body for at most 1024 bytes\n\tstr = buffer.slice(0, 1024).toString();\n\n\t// html5\n\tif (!res && str) {\n\t\tres = / 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n\n\t\tthis[MAP] = Object.create(null);\n\n\t\tif (init instanceof Headers) {\n\t\t\tconst rawHeaders = init.raw();\n\t\t\tconst headerNames = Object.keys(rawHeaders);\n\n\t\t\tfor (const headerName of headerNames) {\n\t\t\t\tfor (const value of rawHeaders[headerName]) {\n\t\t\t\t\tthis.append(headerName, value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't worry about converting prop to ByteString here as append()\n\t\t// will handle it.\n\t\tif (init == null) ; else if (typeof init === 'object') {\n\t\t\tconst method = init[Symbol.iterator];\n\t\t\tif (method != null) {\n\t\t\t\tif (typeof method !== 'function') {\n\t\t\t\t\tthrow new TypeError('Header pairs must be iterable');\n\t\t\t\t}\n\n\t\t\t\t// sequence>\n\t\t\t\t// Note: per spec we have to first exhaust the lists then process them\n\t\t\t\tconst pairs = [];\n\t\t\t\tfor (const pair of init) {\n\t\t\t\t\tif (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {\n\t\t\t\t\t\tthrow new TypeError('Each header pair must be iterable');\n\t\t\t\t\t}\n\t\t\t\t\tpairs.push(Array.from(pair));\n\t\t\t\t}\n\n\t\t\t\tfor (const pair of pairs) {\n\t\t\t\t\tif (pair.length !== 2) {\n\t\t\t\t\t\tthrow new TypeError('Each header pair must be a name/value tuple');\n\t\t\t\t\t}\n\t\t\t\t\tthis.append(pair[0], pair[1]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// record\n\t\t\t\tfor (const key of Object.keys(init)) {\n\t\t\t\t\tconst value = init[key];\n\t\t\t\t\tthis.append(key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new TypeError('Provided initializer must be an object');\n\t\t}\n\t}\n\n\t/**\n * Return combined header value given name\n *\n * @param String name Header name\n * @return Mixed\n */\n\tget(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key === undefined) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this[MAP][key].join(', ');\n\t}\n\n\t/**\n * Iterate over all headers\n *\n * @param Function callback Executed for each item with parameters (value, name, thisArg)\n * @param Boolean thisArg `this` context for callback function\n * @return Void\n */\n\tforEach(callback) {\n\t\tlet thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n\t\tlet pairs = getHeaders(this);\n\t\tlet i = 0;\n\t\twhile (i < pairs.length) {\n\t\t\tvar _pairs$i = pairs[i];\n\t\t\tconst name = _pairs$i[0],\n\t\t\t value = _pairs$i[1];\n\n\t\t\tcallback.call(thisArg, value, name, this);\n\t\t\tpairs = getHeaders(this);\n\t\t\ti++;\n\t\t}\n\t}\n\n\t/**\n * Overwrite header values given name\n *\n * @param String name Header name\n * @param String value Header value\n * @return Void\n */\n\tset(name, value) {\n\t\tname = `${name}`;\n\t\tvalue = `${value}`;\n\t\tvalidateName(name);\n\t\tvalidateValue(value);\n\t\tconst key = find(this[MAP], name);\n\t\tthis[MAP][key !== undefined ? key : name] = [value];\n\t}\n\n\t/**\n * Append a value onto existing header\n *\n * @param String name Header name\n * @param String value Header value\n * @return Void\n */\n\tappend(name, value) {\n\t\tname = `${name}`;\n\t\tvalue = `${value}`;\n\t\tvalidateName(name);\n\t\tvalidateValue(value);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key !== undefined) {\n\t\t\tthis[MAP][key].push(value);\n\t\t} else {\n\t\t\tthis[MAP][name] = [value];\n\t\t}\n\t}\n\n\t/**\n * Check for header name existence\n *\n * @param String name Header name\n * @return Boolean\n */\n\thas(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\treturn find(this[MAP], name) !== undefined;\n\t}\n\n\t/**\n * Delete all header values given name\n *\n * @param String name Header name\n * @return Void\n */\n\tdelete(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key !== undefined) {\n\t\t\tdelete this[MAP][key];\n\t\t}\n\t}\n\n\t/**\n * Return raw headers (non-spec api)\n *\n * @return Object\n */\n\traw() {\n\t\treturn this[MAP];\n\t}\n\n\t/**\n * Get an iterator on keys.\n *\n * @return Iterator\n */\n\tkeys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}\n\n\t/**\n * Get an iterator on values.\n *\n * @return Iterator\n */\n\tvalues() {\n\t\treturn createHeadersIterator(this, 'value');\n\t}\n\n\t/**\n * Get an iterator on entries.\n *\n * This is the default iterator of the Headers object.\n *\n * @return Iterator\n */\n\t[Symbol.iterator]() {\n\t\treturn createHeadersIterator(this, 'key+value');\n\t}\n}\nHeaders.prototype.entries = Headers.prototype[Symbol.iterator];\n\nObject.defineProperty(Headers.prototype, Symbol.toStringTag, {\n\tvalue: 'Headers',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nObject.defineProperties(Headers.prototype, {\n\tget: { enumerable: true },\n\tforEach: { enumerable: true },\n\tset: { enumerable: true },\n\tappend: { enumerable: true },\n\thas: { enumerable: true },\n\tdelete: { enumerable: true },\n\tkeys: { enumerable: true },\n\tvalues: { enumerable: true },\n\tentries: { enumerable: true }\n});\n\nfunction getHeaders(headers) {\n\tlet kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';\n\n\tconst keys = Object.keys(headers[MAP]).sort();\n\treturn keys.map(kind === 'key' ? function (k) {\n\t\treturn k.toLowerCase();\n\t} : kind === 'value' ? function (k) {\n\t\treturn headers[MAP][k].join(', ');\n\t} : function (k) {\n\t\treturn [k.toLowerCase(), headers[MAP][k].join(', ')];\n\t});\n}\n\nconst INTERNAL = Symbol('internal');\n\nfunction createHeadersIterator(target, kind) {\n\tconst iterator = Object.create(HeadersIteratorPrototype);\n\titerator[INTERNAL] = {\n\t\ttarget,\n\t\tkind,\n\t\tindex: 0\n\t};\n\treturn iterator;\n}\n\nconst HeadersIteratorPrototype = Object.setPrototypeOf({\n\tnext() {\n\t\t// istanbul ignore if\n\t\tif (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {\n\t\t\tthrow new TypeError('Value of `this` is not a HeadersIterator');\n\t\t}\n\n\t\tvar _INTERNAL = this[INTERNAL];\n\t\tconst target = _INTERNAL.target,\n\t\t kind = _INTERNAL.kind,\n\t\t index = _INTERNAL.index;\n\n\t\tconst values = getHeaders(target, kind);\n\t\tconst len = values.length;\n\t\tif (index >= len) {\n\t\t\treturn {\n\t\t\t\tvalue: undefined,\n\t\t\t\tdone: true\n\t\t\t};\n\t\t}\n\n\t\tthis[INTERNAL].index = index + 1;\n\n\t\treturn {\n\t\t\tvalue: values[index],\n\t\t\tdone: false\n\t\t};\n\t}\n}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));\n\nObject.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {\n\tvalue: 'HeadersIterator',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\n/**\n * Export the Headers object in a form that Node.js can consume.\n *\n * @param Headers headers\n * @return Object\n */\nfunction exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}\n\n/**\n * Create a Headers object from an object of headers, ignoring those that do\n * not conform to HTTP grammar productions.\n *\n * @param Object obj Object of headers\n * @return Headers\n */\nfunction createHeadersLenient(obj) {\n\tconst headers = new Headers();\n\tfor (const name of Object.keys(obj)) {\n\t\tif (invalidTokenRegex.test(name)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(obj[name])) {\n\t\t\tfor (const val of obj[name]) {\n\t\t\t\tif (invalidHeaderCharRegex.test(val)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (headers[MAP][name] === undefined) {\n\t\t\t\t\theaders[MAP][name] = [val];\n\t\t\t\t} else {\n\t\t\t\t\theaders[MAP][name].push(val);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!invalidHeaderCharRegex.test(obj[name])) {\n\t\t\theaders[MAP][name] = [obj[name]];\n\t\t}\n\t}\n\treturn headers;\n}\n\nconst INTERNALS$1 = Symbol('Response internals');\n\n// fix an issue where \"STATUS_CODES\" aren't a named export for node <10\nconst STATUS_CODES = http.STATUS_CODES;\n\n/**\n * Response class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nclass Response {\n\tconstructor() {\n\t\tlet body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\t\tlet opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\t\tBody.call(this, body, opts);\n\n\t\tconst status = opts.status || 200;\n\t\tconst headers = new Headers(opts.headers);\n\n\t\tif (body != null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS$1] = {\n\t\t\turl: opts.url,\n\t\t\tstatus,\n\t\t\tstatusText: opts.statusText || STATUS_CODES[status],\n\t\t\theaders,\n\t\t\tcounter: opts.counter\n\t\t};\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS$1].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS$1].status;\n\t}\n\n\t/**\n * Convenience property representing if the request ended normally\n */\n\tget ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS$1].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS$1].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS$1].headers;\n\t}\n\n\t/**\n * Clone this response\n *\n * @return Response\n */\n\tclone() {\n\t\treturn new Response(clone(this), {\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected\n\t\t});\n\t}\n}\n\nBody.mixIn(Response.prototype);\n\nObject.defineProperties(Response.prototype, {\n\turl: { enumerable: true },\n\tstatus: { enumerable: true },\n\tok: { enumerable: true },\n\tredirected: { enumerable: true },\n\tstatusText: { enumerable: true },\n\theaders: { enumerable: true },\n\tclone: { enumerable: true }\n});\n\nObject.defineProperty(Response.prototype, Symbol.toStringTag, {\n\tvalue: 'Response',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nconst INTERNALS$2 = Symbol('Request internals');\n\n// fix an issue where \"format\", \"parse\" aren't a named export for node <10\nconst parse_url = Url.parse;\nconst format_url = Url.format;\n\nconst streamDestructionSupported = 'destroy' in Stream.Readable.prototype;\n\n/**\n * Check if a value is an instance of Request.\n *\n * @param Mixed input\n * @return Boolean\n */\nfunction isRequest(input) {\n\treturn typeof input === 'object' && typeof input[INTERNALS$2] === 'object';\n}\n\nfunction isAbortSignal(signal) {\n\tconst proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);\n\treturn !!(proto && proto.constructor.name === 'AbortSignal');\n}\n\n/**\n * Request class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nclass Request {\n\tconstructor(input) {\n\t\tlet init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\t\tlet parsedURL;\n\n\t\t// normalize input\n\t\tif (!isRequest(input)) {\n\t\t\tif (input && input.href) {\n\t\t\t\t// in order to support Node.js' Url objects; though WHATWG's URL objects\n\t\t\t\t// will fall into this branch also (since their `toString()` will return\n\t\t\t\t// `href` property anyway)\n\t\t\t\tparsedURL = parse_url(input.href);\n\t\t\t} else {\n\t\t\t\t// coerce input to a string before attempting to parse\n\t\t\t\tparsedURL = parse_url(`${input}`);\n\t\t\t}\n\t\t\tinput = {};\n\t\t} else {\n\t\t\tparsedURL = parse_url(input.url);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tmethod = method.toUpperCase();\n\n\t\tif ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tlet inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;\n\n\t\tBody.call(this, inputBody, {\n\t\t\ttimeout: init.timeout || input.timeout || 0,\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody != null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ? input.signal : null;\n\t\tif ('signal' in init) signal = init.signal;\n\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal');\n\t\t}\n\n\t\tthis[INTERNALS$2] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal\n\t\t};\n\n\t\t// node-fetch-only options\n\t\tthis.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;\n\t\tthis.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t}\n\n\tget method() {\n\t\treturn this[INTERNALS$2].method;\n\t}\n\n\tget url() {\n\t\treturn format_url(this[INTERNALS$2].parsedURL);\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS$2].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS$2].redirect;\n\t}\n\n\tget signal() {\n\t\treturn this[INTERNALS$2].signal;\n\t}\n\n\t/**\n * Clone this request\n *\n * @return Request\n */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n}\n\nBody.mixIn(Request.prototype);\n\nObject.defineProperty(Request.prototype, Symbol.toStringTag, {\n\tvalue: 'Request',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nObject.defineProperties(Request.prototype, {\n\tmethod: { enumerable: true },\n\turl: { enumerable: true },\n\theaders: { enumerable: true },\n\tredirect: { enumerable: true },\n\tclone: { enumerable: true },\n\tsignal: { enumerable: true }\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param Request A Request instance\n * @return Object The options object to be passed to http.request\n */\nfunction getNodeRequestOptions(request) {\n\tconst parsedURL = request[INTERNALS$2].parsedURL;\n\tconst headers = new Headers(request[INTERNALS$2].headers);\n\n\t// fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// Basic fetch\n\tif (!parsedURL.protocol || !parsedURL.hostname) {\n\t\tthrow new TypeError('Only absolute URLs are supported');\n\t}\n\n\tif (!/^https?:$/.test(parsedURL.protocol)) {\n\t\tthrow new TypeError('Only HTTP(S) protocols are supported');\n\t}\n\n\tif (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) {\n\t\tthrow new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body == null && /^(POST|PUT)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\tif (request.body != null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\tif (typeof totalBytes === 'number') {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip,deflate');\n\t}\n\n\tlet agent = request.agent;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\tif (!headers.has('Connection') && !agent) {\n\t\theaders.set('Connection', 'close');\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\treturn Object.assign({}, parsedURL, {\n\t\tmethod: request.method,\n\t\theaders: exportNodeCompatibleHeaders(headers),\n\t\tagent\n\t});\n}\n\n/**\n * abort-error.js\n *\n * AbortError interface for cancelled requests\n */\n\n/**\n * Create AbortError instance\n *\n * @param String message Error message for human\n * @return AbortError\n */\nfunction AbortError(message) {\n Error.call(this, message);\n\n this.type = 'aborted';\n this.message = message;\n\n // hide custom error implementation details from end-users\n Error.captureStackTrace(this, this.constructor);\n}\n\nAbortError.prototype = Object.create(Error.prototype);\nAbortError.prototype.constructor = AbortError;\nAbortError.prototype.name = 'AbortError';\n\n// fix an issue where \"PassThrough\", \"resolve\" aren't a named export for node <10\nconst PassThrough$1 = Stream.PassThrough;\nconst resolve_url = Url.resolve;\n\n/**\n * Fetch function\n *\n * @param Mixed url Absolute url or Request instance\n * @param Object opts Fetch options\n * @return Promise\n */\nfunction fetch(url, opts) {\n\n\t// allow custom promise\n\tif (!fetch.Promise) {\n\t\tthrow new Error('native promise missing, set fetch.Promise to your favorite alternative');\n\t}\n\n\tBody.Promise = fetch.Promise;\n\n\t// wrap http.request into fetch\n\treturn new fetch.Promise(function (resolve, reject) {\n\t\t// build request object\n\t\tconst request = new Request(url, opts);\n\t\tconst options = getNodeRequestOptions(request);\n\n\t\tconst send = (options.protocol === 'https:' ? https : http).request;\n\t\tconst signal = request.signal;\n\n\t\tlet response = null;\n\n\t\tconst abort = function abort() {\n\t\t\tlet error = new AbortError('The user aborted a request.');\n\t\t\treject(error);\n\t\t\tif (request.body && request.body instanceof Stream.Readable) {\n\t\t\t\trequest.body.destroy(error);\n\t\t\t}\n\t\t\tif (!response || !response.body) return;\n\t\t\tresponse.body.emit('error', error);\n\t\t};\n\n\t\tif (signal && signal.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\n\t\tconst abortAndFinalize = function abortAndFinalize() {\n\t\t\tabort();\n\t\t\tfinalize();\n\t\t};\n\n\t\t// send request\n\t\tconst req = send(options);\n\t\tlet reqTimeout;\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', abortAndFinalize);\n\t\t}\n\n\t\tfunction finalize() {\n\t\t\treq.abort();\n\t\t\tif (signal) signal.removeEventListener('abort', abortAndFinalize);\n\t\t\tclearTimeout(reqTimeout);\n\t\t}\n\n\t\tif (request.timeout) {\n\t\t\treq.once('socket', function (socket) {\n\t\t\t\treqTimeout = setTimeout(function () {\n\t\t\t\t\treject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));\n\t\t\t\t\tfinalize();\n\t\t\t\t}, request.timeout);\n\t\t\t});\n\t\t}\n\n\t\treq.on('error', function (err) {\n\t\t\treject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));\n\t\t\tfinalize();\n\t\t});\n\n\t\treq.on('response', function (res) {\n\t\t\tclearTimeout(reqTimeout);\n\n\t\t\tconst headers = createHeadersLenient(res.headers);\n\n\t\t\t// HTTP fetch step 5\n\t\t\tif (fetch.isRedirect(res.statusCode)) {\n\t\t\t\t// HTTP fetch step 5.2\n\t\t\t\tconst location = headers.get('Location');\n\n\t\t\t\t// HTTP fetch step 5.3\n\t\t\t\tconst locationURL = location === null ? null : resolve_url(request.url, location);\n\n\t\t\t\t// HTTP fetch step 5.5\n\t\t\t\tswitch (request.redirect) {\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase 'manual':\n\t\t\t\t\t\t// node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.\n\t\t\t\t\t\tif (locationURL !== null) {\n\t\t\t\t\t\t\t// handle corrupted header\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\theaders.set('Location', locationURL);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t// istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request\n\t\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'follow':\n\t\t\t\t\t\t// HTTP-redirect fetch step 2\n\t\t\t\t\t\tif (locationURL === null) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 5\n\t\t\t\t\t\tif (request.counter >= request.follow) {\n\t\t\t\t\t\t\treject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 6 (counter increment)\n\t\t\t\t\t\t// Create a new Request object.\n\t\t\t\t\t\tconst requestOpts = {\n\t\t\t\t\t\t\theaders: new Headers(request.headers),\n\t\t\t\t\t\t\tfollow: request.follow,\n\t\t\t\t\t\t\tcounter: request.counter + 1,\n\t\t\t\t\t\t\tagent: request.agent,\n\t\t\t\t\t\t\tcompress: request.compress,\n\t\t\t\t\t\t\tmethod: request.method,\n\t\t\t\t\t\t\tbody: request.body,\n\t\t\t\t\t\t\tsignal: request.signal,\n\t\t\t\t\t\t\ttimeout: request.timeout,\n\t\t\t\t\t\t\tsize: request.size\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 9\n\t\t\t\t\t\tif (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {\n\t\t\t\t\t\t\treject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 11\n\t\t\t\t\t\tif (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {\n\t\t\t\t\t\t\trequestOpts.method = 'GET';\n\t\t\t\t\t\t\trequestOpts.body = undefined;\n\t\t\t\t\t\t\trequestOpts.headers.delete('content-length');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 15\n\t\t\t\t\t\tresolve(fetch(new Request(locationURL, requestOpts)));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// prepare response\n\t\t\tres.once('end', function () {\n\t\t\t\tif (signal) signal.removeEventListener('abort', abortAndFinalize);\n\t\t\t});\n\t\t\tlet body = res.pipe(new PassThrough$1());\n\n\t\t\tconst response_options = {\n\t\t\t\turl: request.url,\n\t\t\t\tstatus: res.statusCode,\n\t\t\t\tstatusText: res.statusMessage,\n\t\t\t\theaders: headers,\n\t\t\t\tsize: request.size,\n\t\t\t\ttimeout: request.timeout,\n\t\t\t\tcounter: request.counter\n\t\t\t};\n\n\t\t\t// HTTP-network fetch step 12.1.1.3\n\t\t\tconst codings = headers.get('Content-Encoding');\n\n\t\t\t// HTTP-network fetch step 12.1.1.4: handle content codings\n\n\t\t\t// in following scenarios we ignore compression support\n\t\t\t// 1. compression support is disabled\n\t\t\t// 2. HEAD request\n\t\t\t// 3. no Content-Encoding header\n\t\t\t// 4. no content response (204)\n\t\t\t// 5. content not modified response (304)\n\t\t\tif (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For Node v6+\n\t\t\t// Be less strict when decoding compressed responses, since sometimes\n\t\t\t// servers send slightly invalid responses that are still accepted\n\t\t\t// by common browsers.\n\t\t\t// Always using Z_SYNC_FLUSH is what cURL does.\n\t\t\tconst zlibOptions = {\n\t\t\t\tflush: zlib.Z_SYNC_FLUSH,\n\t\t\t\tfinishFlush: zlib.Z_SYNC_FLUSH\n\t\t\t};\n\n\t\t\t// for gzip\n\t\t\tif (codings == 'gzip' || codings == 'x-gzip') {\n\t\t\t\tbody = body.pipe(zlib.createGunzip(zlibOptions));\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// for deflate\n\t\t\tif (codings == 'deflate' || codings == 'x-deflate') {\n\t\t\t\t// handle the infamous raw deflate response from old servers\n\t\t\t\t// a hack for old IIS and Apache servers\n\t\t\t\tconst raw = res.pipe(new PassThrough$1());\n\t\t\t\traw.once('data', function (chunk) {\n\t\t\t\t\t// see http://stackoverflow.com/questions/37519828\n\t\t\t\t\tif ((chunk[0] & 0x0F) === 0x08) {\n\t\t\t\t\t\tbody = body.pipe(zlib.createInflate());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbody = body.pipe(zlib.createInflateRaw());\n\t\t\t\t\t}\n\t\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\t\tresolve(response);\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// for br\n\t\t\tif (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') {\n\t\t\t\tbody = body.pipe(zlib.createBrotliDecompress());\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// otherwise, use response as-is\n\t\t\tresponse = new Response(body, response_options);\n\t\t\tresolve(response);\n\t\t});\n\n\t\twriteToStream(req, request);\n\t});\n}\n/**\n * Redirect code matching\n *\n * @param Number code Status code\n * @return Boolean\n */\nfetch.isRedirect = function (code) {\n\treturn code === 301 || code === 302 || code === 303 || code === 307 || code === 308;\n};\n\n// expose Promise\nfetch.Promise = global.Promise;\n\nexport default fetch;\nexport { Headers, Request, Response, FetchError };\n","var nodeFetch = require('node-fetch')\nvar realFetch = nodeFetch.default || nodeFetch\n\nvar fetch = function (url, options) {\n // Support schemaless URIs on the server for parity with the browser.\n // Ex: //github.com/ -> https://github.com/\n if (/^\\/\\//.test(url)) {\n url = 'https:' + url\n }\n return realFetch.call(this, url, options)\n}\n\nmodule.exports = exports = fetch\nexports.fetch = fetch\nexports.Headers = nodeFetch.Headers\nexports.Request = nodeFetch.Request\nexports.Response = nodeFetch.Response\n\n// Needed for TypeScript consumers without esModuleInterop.\nexports.default = fetch\n","import fetch from \"cross-fetch\";\nimport JSBI from \"jsbi\";\n\nfunction mergeOptions(overrideOptions, defaultOptions) {\n defaultOptions = defaultOptions || {};\n const headers = Object.assign(\n {},\n defaultOptions.headers || {},\n overrideOptions.headers || {}\n );\n return Object.assign({}, defaultOptions, overrideOptions, {\n headers: headers\n });\n}\n\nconst batchHandler = {\n get: (target, method, receiver) => {\n if (method === \"send\") {\n return async () => {\n const response = await fetch(\n target.uri,\n mergeOptions(\n {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(target.payload)\n },\n target.defaultOptions\n )\n );\n return await response.json();\n };\n }\n return (...params) => {\n const id = target.id;\n target.id = target.id + 1;\n target.payload.push({\n jsonrpc: \"2.0\",\n id: id,\n method: method,\n params: params\n });\n return receiver;\n };\n }\n};\n\nconst handler = {\n get: (target, method) => {\n if (method === \"batch\") {\n return () => {\n return new Proxy(\n {\n id: Math.round(Math.random() * 10000000),\n payload: [],\n uri: target.uri,\n defaultOptions: target.defaultOptions\n },\n batchHandler\n );\n };\n }\n return async (...params) => {\n const id = Math.round(Math.random() * 10000000);\n const response = await fetch(\n target.uri,\n mergeOptions(\n {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: id,\n method: method,\n params: params\n })\n },\n target.defaultOptions\n )\n );\n const data = await response.json();\n if (data.id !== id) {\n throw new Error(\"JSONRPCError: response ID does not match request ID!\");\n }\n if (data.error) {\n throw new Error(\n `JSONRPCError: server error ${JSON.stringify(data.error)}`\n );\n }\n return data.result;\n };\n }\n};\n\nexport class RPC {\n constructor(uri, defaultOptions = {}) {\n this.uri = uri;\n this.defaultOptions = defaultOptions;\n return new Proxy(this, handler);\n }\n\n static create(uri) {\n return new RPC(uri);\n }\n}\n\nexport function HexStringToBigInt(hexString) {\n return JSBI.BigInt(hexString);\n}\n\nexport function BigIntToHexString(bigInt) {\n return \"0x\" + bigInt.toString(16);\n}\n","// This package provides normalizer functions. Even though CKB uses molecule\n// as the serialization layer. There is still CKB specific knowledge that does\n// not belong in molecule. For example, all numbers in CKB protocols are\n// serialized using little endian format. This package tries to encode such\n// knowledge. The goal here, is that you are free to use whatever types that\n// makes most sense to represent the values. As long as you pass your object\n// through the normalizers here, molecule should be able to serialize the values\n// into correct formats required by CKB.\n//\n// Note this is only used when you need to deal with CKB structures in molecule\n// format. If you are using RPCs or GraphQL to interact with CKB, chances are you\n// will not need this package.\nimport JSBI from \"jsbi\";\nimport { Reader } from \"./reader\";\nimport { BigIntToHexString } from \"./rpc\";\n\nfunction normalizeHexNumber(length) {\n return function(debugPath, value) {\n if (!(value instanceof ArrayBuffer)) {\n let intValue = BigIntToHexString(JSBI.BigInt(value)).substr(2);\n if (intValue.length % 2 !== 0) {\n intValue = \"0\" + intValue;\n }\n if (intValue.length / 2 > length) {\n throw new Error(\n `${debugPath} is ${intValue.length /\n 2} bytes long, expected length is ${length}!`\n );\n }\n const view = new DataView(new ArrayBuffer(length));\n for (let i = 0; i < intValue.length / 2; i++) {\n const start = intValue.length - (i + 1) * 2;\n view.setUint8(i, parseInt(intValue.substr(start, 2), 16));\n }\n value = view.buffer;\n }\n if (value.byteLength < length) {\n const array = new Uint8Array(length);\n array.set(new Uint8Array(value), 0);\n value = array.buffer;\n }\n return value;\n };\n}\n\nfunction normalizeRawData(length) {\n return function(debugPath, value) {\n value = new Reader(value).toArrayBuffer();\n if (length > 0 && value.byteLength !== length) {\n throw new Error(\n `${debugPath} has invalid length ${value.byteLength}, required: ${length}`\n );\n }\n return value;\n };\n}\n\nfunction normalizeObject(debugPath, object, keys) {\n const result = {};\n\n for (const [key, f] of Object.entries(keys)) {\n const value = object[key];\n if (!value) {\n throw new Error(`${debugPath} is missing ${key}!`);\n }\n result[key] = f(`${debugPath}.${key}`, value);\n }\n return result;\n}\n\nexport function NormalizeScript(script, { debugPath = \"script\" } = {}) {\n return normalizeObject(debugPath, script, {\n code_hash: normalizeRawData(32),\n hash_type: function(debugPath, value) {\n switch (value) {\n case \"data\":\n return 0;\n case \"type\":\n return 1;\n case 0:\n return value;\n case 1:\n return value;\n default:\n throw new Error(`${debugPath}.hash_type has invalid value: ${value}`);\n }\n },\n args: normalizeRawData(-1)\n });\n}\n\nexport function NormalizeOutPoint(outPoint, { debugPath = \"out_point\" } = {}) {\n return normalizeObject(debugPath, outPoint, {\n tx_hash: normalizeRawData(32),\n index: normalizeHexNumber(4)\n });\n}\n\nfunction toNormalize(normalize) {\n return function(debugPath, value) {\n return normalize(value, {\n debugPath\n });\n };\n}\n\nexport function NormalizeCellInput(\n cellInput,\n { debugPath = \"cell_input\" } = {}\n) {\n return normalizeObject(debugPath, cellInput, {\n since: normalizeHexNumber(8),\n previous_output: toNormalize(NormalizeOutPoint)\n });\n}\n\nexport function NormalizeCellOutput(\n cellOutput,\n { debugPath = \"cell_output\" } = {}\n) {\n const result = normalizeObject(debugPath, cellOutput, {\n capacity: normalizeHexNumber(8),\n lock: toNormalize(NormalizeScript)\n });\n if (cellOutput.type) {\n result.type_ = NormalizeScript(cellOutput.type, {\n debugPath: `${debugPath}.type`\n });\n }\n return result;\n}\n\nexport function NormalizeCellDep(cellDep, { debugPath = \"cell_dep\" } = {}) {\n return normalizeObject(debugPath, cellDep, {\n out_point: toNormalize(NormalizeOutPoint),\n dep_type: function(debugPath, value) {\n switch (value) {\n case \"code\":\n return 0;\n case \"dep_group\":\n return 1;\n case 0:\n return value;\n case 1:\n return value;\n default:\n throw new Error(`${debugPath}.dep_type has invalid value: ${value}`);\n }\n }\n });\n}\n\nfunction toNormalizeArray(normalizeFunction) {\n return function(debugPath, array) {\n return array.map((item, i) => {\n return normalizeFunction(`${debugPath}[${i}]`, item);\n });\n };\n}\n\nexport function NormalizeRawTransaction(\n rawTransaction,\n { debugPath = \"raw_transaction\" } = {}\n) {\n return normalizeObject(debugPath, rawTransaction, {\n version: normalizeHexNumber(4),\n cell_deps: toNormalizeArray(toNormalize(NormalizeCellDep)),\n header_deps: toNormalizeArray(normalizeRawData(32)),\n inputs: toNormalizeArray(toNormalize(NormalizeCellInput)),\n outputs: toNormalizeArray(toNormalize(NormalizeCellOutput)),\n outputs_data: toNormalizeArray(normalizeRawData(-1))\n });\n}\n\nexport function NormalizeTransaction(\n transaction,\n { debugPath = \"transaction\" } = {}\n) {\n const rawTransaction = NormalizeRawTransaction(transaction, {\n debugPath: `(raw)${debugPath}`\n });\n const result = normalizeObject(debugPath, transaction, {\n witnesses: toNormalizeArray(normalizeRawData(-1))\n });\n result.raw = rawTransaction;\n return result;\n}\n\nexport function NormalizeRawHeader(\n rawHeader,\n { debugPath = \"raw_header\" } = {}\n) {\n return normalizeObject(debugPath, rawHeader, {\n version: normalizeHexNumber(4),\n compact_target: normalizeHexNumber(4),\n timestamp: normalizeHexNumber(8),\n number: normalizeHexNumber(8),\n epoch: normalizeHexNumber(8),\n parent_hash: normalizeRawData(32),\n transactions_root: normalizeRawData(32),\n proposals_hash: normalizeRawData(32),\n uncles_hash: normalizeRawData(32),\n dao: normalizeRawData(32)\n });\n}\n\nexport function NormalizeHeader(header, { debugPath = \"header\" } = {}) {\n const rawHeader = NormalizeRawHeader(header, {\n debugPath: `(raw)${debugPath}`\n });\n const result = normalizeObject(debugPath, header, {\n nonce: normalizeHexNumber(16)\n });\n result.raw = rawHeader;\n return result;\n}\n\nexport function NormalizeUncleBlock(\n uncleBlock,\n { debugPath = \"uncle_block\" } = {}\n) {\n return normalizeObject(debugPath, uncleBlock, {\n header: toNormalize(NormalizeHeader),\n proposals: toNormalizeArray(normalizeRawData(10))\n });\n}\n\nexport function NormalizeBlock(block, { debugPath = \"block\" } = {}) {\n return normalizeObject(debugPath, block, {\n header: toNormalize(NormalizeHeader),\n uncles: toNormalizeArray(toNormalize(NormalizeUncleBlock)),\n transactions: toNormalizeArray(toNormalize(NormalizeTransaction)),\n proposals: toNormalizeArray(normalizeRawData(10))\n });\n}\n\nexport function NormalizeCellbaseWitness(\n cellbaseWitness,\n { debugPath = \"cellbase_witness\" } = {}\n) {\n return normalizeObject(debugPath, cellbaseWitness, {\n lock: toNormalize(NormalizeScript),\n message: normalizeRawData(-1)\n });\n}\n\nexport function NormalizeWitnessArgs(\n witnessArgs,\n { debugPath = \"witness_args\" } = {}\n) {\n const result = {};\n if (witnessArgs.lock) {\n result.lock = normalizeRawData(-1)(`${debugPath}.lock`, witnessArgs.lock);\n }\n if (witnessArgs.input_type) {\n result.input_type = normalizeRawData(-1)(\n `${debugPath}.input_type`,\n witnessArgs.input_type\n );\n }\n if (witnessArgs.output_type) {\n result.output_type = normalizeRawData(-1)(\n `${debugPath}.output_type`,\n witnessArgs.output_type\n );\n }\n return result;\n}\n","// This package provides transformer functions that transform JavaScript objects\n// into JSON ready objects that can be passed to RPC. It following the following\n// rules:\n//\n// 1. If the specified object has a serializeJson method, it would invoke this\n// method and use the result to replace current object.\n// 2. It then restricts the keys of the object to keys required by the specified\n// entity(i.e., a Script would only have code_hash, hash_type, args keys),for each\n// sub-field, it then recursively perform the steps here from step 1.\n// 3. It then optionally run validator functions to ensure the resulting object\n// follows specified rules.\n//\n// Note rule 1 here provides the flexibility in defining your own structures: you\n// could define a class containing custom data structures, then provide a\n// serializeJson that transforms the custom one into the rigid data structure\n// required by CKB. You can also leverage the Reader class we provide as much as\n// possible. Since Reader class does provide serializeJson methods, transformers\n// here will transform them to valid hex strings required by CKB.\nimport * as validators from \"./validators\";\n\nfunction invokeSerializeJson(debugPath, value) {\n if (value instanceof Object && value.serializeJson instanceof Function) {\n return value.serializeJson.call(value);\n }\n return value;\n}\n\nfunction transformObject(debugPath, object, keys) {\n object = invokeSerializeJson(debugPath, object);\n if (!(object instanceof Object)) {\n throw new Error(`Transformed ${debugPath} is not an object!`);\n }\n const result = {};\n\n for (const [key, f] of Object.entries(keys)) {\n let value = object[key];\n if (!value) {\n const camelKey = key.replace(/(_[a-z])/g, group =>\n group.toUpperCase().replace(\"_\", \"\")\n );\n value = object[camelKey];\n }\n if (value) {\n result[key] = f(`${debugPath}.${key}`, value);\n }\n }\n return result;\n}\n\nexport function TransformScript(\n script,\n { validation = true, debugPath = \"script\" } = {}\n) {\n script = transformObject(debugPath, script, {\n code_hash: invokeSerializeJson,\n hash_type: invokeSerializeJson,\n args: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateScript(script, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return script;\n}\n\nexport function TransformOutPoint(\n outPoint,\n { validation = true, debugPath = \"out_point\" } = {}\n) {\n outPoint = transformObject(debugPath, outPoint, {\n tx_hash: invokeSerializeJson,\n index: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateOutPoint(outPoint, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return outPoint;\n}\n\nfunction toInvoke(transform) {\n return function(debugPath, value) {\n return transform(value, {\n validation: false,\n debugPath\n });\n };\n}\n\nexport function TransformCellInput(\n cellInput,\n { validation = true, debugPath = \"cell_input\" } = {}\n) {\n cellInput = transformObject(debugPath, cellInput, {\n since: invokeSerializeJson,\n previous_output: toInvoke(TransformOutPoint)\n });\n\n if (validation) {\n validators.ValidateCellInput(cellInput, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellInput;\n}\n\nexport function TransformCellOutput(\n cellOutput,\n { validation = true, debugPath = \"cell_output\" } = {}\n) {\n cellOutput = transformObject(debugPath, cellOutput, {\n capacity: invokeSerializeJson,\n lock: toInvoke(TransformScript),\n type: toInvoke(TransformScript)\n });\n\n if (validation) {\n validators.ValidateCellOutput(cellOutput, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellOutput;\n}\n\nexport function TransformCellDep(\n cellDep,\n { validation = true, debugPath = \"cell_dep\" } = {}\n) {\n cellDep = transformObject(debugPath, cellDep, {\n out_point: toInvoke(TransformOutPoint),\n dep_type: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateCellDep(cellDep, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellDep;\n}\n\nfunction toInvokeArray(invokeFunction) {\n return function(debugPath, array) {\n return array.map((item, i) => {\n return invokeFunction(`${debugPath}[${i}]`, item);\n });\n };\n}\n\nexport function TransformRawTransaction(\n rawTransaction,\n { validation = true, debugPath = \"raw_transaction\" } = {}\n) {\n rawTransaction = transformObject(debugPath, rawTransaction, {\n version: invokeSerializeJson,\n cell_deps: toInvokeArray(toInvoke(TransformCellDep)),\n header_deps: toInvokeArray(invokeSerializeJson),\n inputs: toInvokeArray(toInvoke(TransformCellInput)),\n outputs: toInvokeArray(toInvoke(TransformCellOutput)),\n outputs_data: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateRawTransaction(rawTransaction, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return rawTransaction;\n}\n\nexport function TransformTransaction(\n transaction,\n { validation = true, debugPath = \"transaction\" } = {}\n) {\n transaction = transformObject(debugPath, transaction, {\n version: invokeSerializeJson,\n cell_deps: toInvokeArray(toInvoke(TransformCellDep)),\n header_deps: toInvokeArray(invokeSerializeJson),\n inputs: toInvokeArray(toInvoke(TransformCellInput)),\n outputs: toInvokeArray(toInvoke(TransformCellOutput)),\n outputs_data: toInvokeArray(invokeSerializeJson),\n witnesses: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateTransaction(transaction, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return transaction;\n}\n\nexport function TransformRawHeader(\n rawHeader,\n { validation = true, debugPath = \"raw_header\" } = {}\n) {\n rawHeader = transformObject(debugPath, rawHeader, {\n version: invokeSerializeJson,\n compact_target: invokeSerializeJson,\n timestamp: invokeSerializeJson,\n number: invokeSerializeJson,\n epoch: invokeSerializeJson,\n parent_hash: invokeSerializeJson,\n transactions_root: invokeSerializeJson,\n proposals_hash: invokeSerializeJson,\n uncles_hash: invokeSerializeJson,\n dao: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateRawHeader(rawHeader, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return rawHeader;\n}\n\nexport function TransformHeader(\n header,\n { validation = true, debugPath = \"header\" } = {}\n) {\n header = transformObject(debugPath, header, {\n version: invokeSerializeJson,\n compact_target: invokeSerializeJson,\n timestamp: invokeSerializeJson,\n number: invokeSerializeJson,\n epoch: invokeSerializeJson,\n parent_hash: invokeSerializeJson,\n transactions_root: invokeSerializeJson,\n proposals_hash: invokeSerializeJson,\n uncles_hash: invokeSerializeJson,\n dao: invokeSerializeJson,\n nonce: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateHeader(header, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return header;\n}\n\nexport function TransformUncleBlock(\n uncleBlock,\n { validation = true, debugPath = \"uncle_block\" } = {}\n) {\n uncleBlock = transformObject(debugPath, uncleBlock, {\n header: toInvoke(TransformHeader),\n proposals: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateUncleBlock(uncleBlock, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return uncleBlock;\n}\n\nexport function TransformBlock(\n block,\n { validation = true, debugPath = \"block\" } = {}\n) {\n block = transformObject(debugPath, block, {\n header: toInvoke(TransformHeader),\n uncles: toInvokeArray(toInvoke(TransformUncleBlock)),\n transactions: toInvokeArray(toInvoke(TransformTransaction)),\n proposals: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateBlock(block, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return block;\n}\n\nexport function TransformCellbaseWitness(\n cellbaseWitness,\n { validation = true, debugPath = \"cellbase_witness\" } = {}\n) {\n cellbaseWitness = transformObject(debugPath, cellbaseWitness, {\n lock: toInvoke(TransformScript),\n message: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateCellbaseWitness(cellbaseWitness, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellbaseWitness;\n}\n\nexport function TransformWitnessArgs(\n witnessArgs,\n { validation = true, debugPath = \"witness_args\" } = {}\n) {\n witnessArgs = transformObject(debugPath, witnessArgs, {\n lock: invokeSerializeJson,\n input_type: invokeSerializeJson,\n output_type: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateWitnessArgs(witnessArgs, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return witnessArgs;\n}\n","import JSBI from \"jsbi\";\nimport { Reader } from \"../reader\";\nimport { HexStringToBigInt, BigIntToHexString } from \"../rpc\";\n\nexport class RPCCollector {\n constructor(\n rpc,\n lockHash,\n {\n skipCellWithContent = true,\n loadData = false,\n loadBlockNumber = true\n } = {}\n ) {\n this.rpc = rpc;\n this.lockHash = new Reader(lockHash).serializeJson();\n this.skipCellWithContent = skipCellWithContent;\n this.loadData = loadData;\n this.loadBlockNumber = loadBlockNumber;\n }\n\n async *collect() {\n const to = HexStringToBigInt(await this.rpc.get_tip_block_number());\n let currentFrom = JSBI.BigInt(0);\n while (JSBI.lessThanOrEqual(currentFrom, to)) {\n let currentTo = JSBI.add(currentFrom, JSBI.BigInt(100));\n if (JSBI.greaterThan(currentTo, to)) {\n currentTo = to;\n }\n const cells = await this.rpc.get_cells_by_lock_hash(\n this.lockHash,\n BigIntToHexString(currentFrom),\n BigIntToHexString(currentTo)\n );\n for (const cell of cells) {\n if (this.skipCellWithContent) {\n if (\n cell.type ||\n JSBI.greaterThan(\n HexStringToBigInt(cell.output_data_len),\n JSBI.BigInt(100)\n )\n ) {\n continue;\n }\n }\n let data = null;\n if (this.loadData) {\n const cellWithData = await this.rpc.get_live_cell(\n cell.out_point,\n true\n );\n data = cellWithData.cell.data.content;\n }\n let block_number = null;\n if (this.loadBlockNumber) {\n const header = await this.rpc.get_header(cell.block_hash);\n block_number = header.number;\n }\n yield {\n cellbase: cell.cellbase,\n cell_output: {\n capacity: cell.capacity,\n lock: cell.lock,\n type: cell.type\n },\n out_point: cell.out_point,\n block_hash: cell.block_hash,\n data: data,\n output_data_len: cell.output_data_len,\n block_number\n };\n }\n currentFrom = JSBI.add(currentTo, JSBI.BigInt(1));\n }\n }\n}\n","import JSBI from \"jsbi\";\nimport { Reader } from \"./reader\";\nimport { ValidateTransaction, ValidateOutPoint } from \"./validators\";\n\nexport class TransactionDumper {\n constructor(\n rpc,\n { validateTransaction = true, depGroupUnpacker = null } = {}\n ) {\n this.rpc = rpc;\n this.validateTransaction = validateTransaction;\n this.depGroupUnpacker = depGroupUnpacker;\n }\n\n async dumpByHash(txHash) {\n const tx = (await this.rpc.get_transaction(txHash)).transaction;\n delete tx.hash;\n return await this.dump(tx);\n }\n\n async dump(tx) {\n if (this.validateTransaction) {\n ValidateTransaction(tx);\n }\n const mockInputs = [];\n for (const input of tx.inputs) {\n const { output, data, header } = await this._resolveOutPoint(\n input.previous_output\n );\n mockInputs.push({ input, output, data, header });\n }\n const mockCellDeps = [];\n for (const cellDep of tx.cell_deps) {\n const { output, data, header } = await this._resolveOutPoint(\n cellDep.out_point\n );\n mockCellDeps.push({\n cell_dep: cellDep,\n output,\n data,\n header\n });\n if (cellDep.dep_type === \"dep_group\") {\n if (!this.depGroupUnpacker) {\n throw new Error(\n \"depGroupUnpacker must be provided when the transaction contains dep_group!\"\n );\n }\n const outPoints = this.depGroupUnpacker(new Reader(data));\n for (const outPoint of outPoints) {\n ValidateOutPoint(outPoint);\n const { output, data, header } = await this._resolveOutPoint(\n outPoint\n );\n mockCellDeps.push({\n cell_dep: {\n out_point: outPoint,\n dep_type: \"code\"\n },\n output,\n data,\n header\n });\n }\n }\n }\n const mockHeaderDeps = [];\n for (const headerDep of tx.header_deps) {\n mockHeaderDeps.push(await this.rpc.get_header(headerDep));\n }\n return JSON.stringify({\n mock_info: {\n inputs: mockInputs,\n cell_deps: mockCellDeps,\n header_deps: mockHeaderDeps\n },\n tx\n });\n }\n\n async _resolveOutPoint(out_point) {\n const txStatus = await this.rpc.get_transaction(out_point.tx_hash);\n if (!txStatus || !txStatus.transaction) {\n throw new Error(`Transaction ${out_point.tx_hash} cannot be found!`);\n }\n const tx = txStatus.transaction;\n const index = JSBI.toNumber(JSBI.BigInt(out_point.index));\n if (index >= tx.outputs.length) {\n throw new Error(\n `Transaction ${out_point.tx_hash} does not have output ${index}!`\n );\n }\n const data = {\n output: tx.outputs[index],\n data: tx.outputs_data[index]\n };\n if (txStatus.tx_status.status === \"committed\") {\n data.header = txStatus.tx_status.block_hash;\n }\n return data;\n }\n}\n","export { Reader } from \"./reader.js\";\nexport { TransactionDumper } from \"./transaction_dumper.js\";\nexport { RPC, HexStringToBigInt, BigIntToHexString } from \"./rpc.js\";\nexport * as normalizers from \"./normalizers\";\nexport * as transformers from \"./transformers\";\nexport * as validators from \"./validators\";\nexport * as cell_collectors from \"./cell_collectors\";\nexport const VERSION = \"__development_build__\";\n"],"names":["ArrayBufferReader","[object Object]","buffer","this","view","DataView","byteLength","i","getUint8","Array","prototype","map","call","Uint8Array","x","toString","slice","join","HexStringReader","string","length","parseInt","substr","ArrayBuffer","setUint8","indexAt","Reader","input","startsWith","Error","c","charCodeAt","JSBI","a","b","__kMaxLength","RangeError","super","sign","Math","floor","Number","isFinite","__zero","__oneDigit","__fromDouble","__fromString","SyntaxError","constructor","__toPrimitive","BigInt","TypeError","push","__toStringBasePowerOfTwo","__toStringGeneric","clz32","__unsignedDigit","d","__digit","e","f","Infinity","g","h","j","k","l","m","n","o","__decideRounding","p","__kBitConversionInts","__kBitConversionDouble","__copy","__absoluteSubOne","__trim","__absoluteAddOne","unaryMinus","__kMaxLengthBits","__initializeDigits","__setDigit","multiply","__clzmsd","__multiplyAccumulate","__absoluteCompare","__absoluteDivSmall","__absoluteDivLarge","__absoluteModSmall","__absoluteAdd","__absoluteSub","__rightShiftByAbsolute","__leftShiftByAbsolute","__compareToBigInt","equal","max","__absoluteAnd","__absoluteOr","__absoluteAndNot","__absoluteXor","__truncateToNBits","__truncateAndSubFromPowerOfTwo","__toNumeric","__isBigInt","add","__compare","EQ","__equalToNumber","pop","__isWhitespace","__kMaxBitsPerChar","__kBitsPerCharTableMultiplier","__kBitsPerCharTableShift","__fillFromParts","q","__inplaceMultiplyAdd","__kConversionChars","exponentiate","__halfDigit","__setHalfDigit","quotient","remainder","__unequalSign","__absoluteGreater","__absoluteLess","abs","__compareToDouble","__comparisonResultToBool","__compareToNumber","__setDigitGrow","imul","r","s","t","__halfDigitLength","__clz16","__specialLeftShift","__internalMultiplyAdd","__inplaceSub","__inplaceAdd","__inplaceRightShift","__toShiftAmount","__rightShiftByMaximum","Symbol","toPrimitive","valueOf","min","assertObjectWithKeys","debugPath","object","expectedKeys","optionalKeys","Object","assertObject","providedKeys","keys","sort","requiredLength","maximalLength","errorMessage","optionalProvidedKeys","filter","key","includes","find","assertHexString","test","assertHash","hash","assertInteger","ValidateScript","script","nestedValidation","code_hash","args","hash_type","ValidateOutPoint","outPoint","tx_hash","index","ValidateCellInput","cellInput","since","previous_output","ValidateCellOutput","cellOutput","capacity","lock","type","ValidateCellDep","cellDep","dep_type","out_point","assertArray","array","validateFunction","isArray","toAssert","value","assertCommonTransaction","rawTransaction","version","cell_deps","header_deps","inputs","outputs","outputs_data","ValidateRawTransaction","ValidateTransaction","transaction","witnesses","ValidateRawHeader","rawHeader","compact_target","timestamp","number","epoch","parent_hash","transactions_root","proposals_hash","uncles_hash","dao","assertCommonHeader","ValidateHeader","header","nonce","assertProposalShortId","shortId","ValidateUncleBlock","uncleBlock","proposals","ValidateBlock","block","uncles","transactions","ValidateCellbaseWitness","cellbaseWitness","message","ValidateWitnessArgs","witnessArgs","input_type","output_type","__kBitConversionBuffer","Float64Array","Int32Array","Readable","Stream","BUFFER","TYPE","Blob","blobParts","arguments","options","buffers","size","element","Buffer","isView","from","byteOffset","String","concat","undefined","toLowerCase","Promise","resolve","buf","ab","readable","_read","start","end","relativeStart","relativeEnd","span","slicedBuffer","blob","FetchError","systemError","code","errno","captureStackTrace","convert","defineProperties","enumerable","defineProperty","toStringTag","writable","configurable","create","name","require","INTERNALS","PassThrough","Body","body","_this","_ref","_ref$size","_ref$timeout","timeout","isURLSearchParams","isBlob","isBuffer","disturbed","error","on","err","url","consumeBody","_this4","reject","alloc","stream","accum","accumBytes","abort","resTimeout","setTimeout","chunk","clearTimeout","obj","append","delete","get","getAll","has","set","arrayBuffer","clone","instance","p1","p2","bodyUsed","getBoundary","pipe","extractContentType","getTotalBytes","getLengthSync","_lengthRetrievers","hasKnownLength","then","ct","headers","assign","_this2","JSON","parse","_this3","res","str","charset","exec","convertBody","json","text","mixIn","proto","getOwnPropertyNames","desc","getOwnPropertyDescriptor","global","invalidTokenRegex","invalidHeaderCharRegex","validateName","validateValue","MAP","Headers","init","rawHeaders","raw","headerNames","headerName","method","iterator","pairs","pair","callback","thisArg","getHeaders","_pairs$i","createHeadersIterator","kind","entries","forEach","values","INTERNAL","target","HeadersIteratorPrototype","setPrototypeOf","getPrototypeOf","_INTERNAL","done","exportNodeCompatibleHeaders","__proto__","hostHeaderKey","INTERNALS$1","STATUS_CODES","http","Response","opts","status","contentType","statusText","counter","ok","redirected","INTERNALS$2","parse_url","Url","format_url","format","streamDestructionSupported","isRequest","Request","parsedURL","href","toUpperCase","inputBody","signal","isAbortSignal","redirect","follow","compress","agent","AbortError","PassThrough$1","resolve_url","fetch","request","protocol","hostname","contentLengthValue","totalBytes","getNodeRequestOptions","send","https","response","destroy","emit","aborted","abortAndFinalize","finalize","req","reqTimeout","removeEventListener","addEventListener","once","socket","val","createHeadersLenient","isRedirect","statusCode","location","locationURL","requestOpts","response_options","statusMessage","codings","zlibOptions","flush","zlib","Z_SYNC_FLUSH","finishFlush","createGunzip","createBrotliDecompress","createInflate","createInflateRaw","dest","write","writeToStream","realFetch","nodeFetch","default","module","exports","mergeOptions","overrideOptions","defaultOptions","batchHandler","receiver","async","uri","Content-Type","stringify","payload","params","id","jsonrpc","handler","Proxy","round","random","data","result","RPC","HexStringToBigInt","hexString","BigIntToHexString","bigInt","normalizeHexNumber","intValue","normalizeRawData","toArrayBuffer","normalizeObject","NormalizeScript","NormalizeOutPoint","toNormalize","normalize","NormalizeCellInput","NormalizeCellOutput","type_","NormalizeCellDep","toNormalizeArray","normalizeFunction","item","NormalizeRawTransaction","NormalizeTransaction","NormalizeRawHeader","NormalizeHeader","NormalizeUncleBlock","invokeSerializeJson","serializeJson","Function","transformObject","replace","group","TransformScript","validation","validators.ValidateScript","TransformOutPoint","validators.ValidateOutPoint","toInvoke","transform","TransformCellInput","validators.ValidateCellInput","TransformCellOutput","validators.ValidateCellOutput","TransformCellDep","validators.ValidateCellDep","toInvokeArray","invokeFunction","TransformTransaction","validators.ValidateTransaction","TransformHeader","validators.ValidateHeader","TransformUncleBlock","validators.ValidateUncleBlock","validators.ValidateRawTransaction","validators.ValidateRawHeader","validators.ValidateBlock","validators.ValidateCellbaseWitness","validators.ValidateWitnessArgs","rpc","lockHash","skipCellWithContent","loadData","loadBlockNumber","to","get_tip_block_number","currentFrom","lessThanOrEqual","currentTo","greaterThan","cells","get_cells_by_lock_hash","cell","output_data_len","get_live_cell","content","block_number","get_header","block_hash","cellbase","cell_output","validateTransaction","depGroupUnpacker","txHash","tx","get_transaction","dump","mockInputs","output","_resolveOutPoint","mockCellDeps","cell_dep","outPoints","mockHeaderDeps","headerDep","mock_info","txStatus","toNumber","tx_status"],"mappings":"mRAAA,MAAMA,EACJC,YAAYC,GACVC,KAAKC,KAAO,IAAIC,SAASH,GAG3BD,SACE,OAAOE,KAAKC,KAAKE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AC1D,IAAK4Z,IAAaA,EAAS7X,YACzB,MAAM,IAAIpL,MAAM,eAAemK,EAAUd,4BAE3C,MAAMgZ,EAAKY,EAAS7X,YACd9B,EAAQnJ,EAAK+iB,SAAS/iB,EAAKkB,OAAO8I,EAAUb,QAClD,GAAIA,GAAS+Y,EAAGrX,QAAQzL,OACtB,MAAM,IAAIS,MACR,eAAemK,EAAUd,gCAAgCC,MAG7D,MAAM0T,EAAO,CACXyF,OAAQJ,EAAGrX,QAAQ1B,GACnB0T,KAAMqF,EAAGpX,aAAa3B,IAKxB,MAHkC,cAA9B2Z,EAASE,UAAU/L,SACrB4F,EAAK7Q,OAAS8W,EAASE,UAAUpB,YAE5B/E,oBC5FY"} \ No newline at end of file +{"version":3,"file":"ckb-js-toolkit.node.js","sources":["../src/reader.js","../node_modules/jsbi/dist/jsbi.mjs","../src/validators.js","../node_modules/node-fetch/lib/index.mjs","../node_modules/cross-fetch/dist/node-ponyfill.js","../src/rpc.js","../src/normalizers.js","../src/transformers.js","../src/cell_collectors/rpc_collector.js","../src/transaction_dumper.js","../src/index.js"],"sourcesContent":["class ArrayBufferReader {\n constructor(buffer) {\n this.view = new DataView(buffer);\n }\n\n length() {\n return this.view.byteLength;\n }\n\n indexAt(i) {\n return this.view.getUint8(i);\n }\n\n toArrayBuffer() {\n return this.view.buffer;\n }\n\n serializeJson() {\n return (\n \"0x\" +\n Array.prototype.map\n .call(new Uint8Array(this.view.buffer), x =>\n (\"00\" + x.toString(16)).slice(-2)\n )\n .join(\"\")\n );\n }\n}\n\nclass HexStringReader {\n constructor(string) {\n this.string = string;\n }\n\n length() {\n return this.string.length / 2 - 1;\n }\n\n indexAt(i) {\n return parseInt(this.string.substr(2 + i * 2, 2), 16);\n }\n\n toArrayBuffer() {\n const buffer = new ArrayBuffer(this.length());\n const view = new DataView(buffer);\n\n for (let i = 0; i < this.length(); i++) {\n view.setUint8(i, this.indexAt(i));\n }\n return buffer;\n }\n\n serializeJson() {\n return this.string;\n }\n}\n\nexport class Reader {\n constructor(input) {\n if (\n input instanceof HexStringReader ||\n input instanceof ArrayBufferReader\n ) {\n return input;\n }\n if (typeof input === \"string\") {\n if (!input.startsWith(\"0x\") || input.length % 2 != 0) {\n throw new Error(\n \"Hex string must start with 0x, and has even numbered length!\"\n );\n }\n return new HexStringReader(input);\n }\n if (input instanceof ArrayBuffer) {\n return new ArrayBufferReader(input);\n }\n throw new Error(\"Reader can only accept hex string or ArrayBuffer!\");\n }\n\n static fromRawString(string) {\n const buffer = new ArrayBuffer(string.length);\n const view = new DataView(buffer);\n\n for (let i = 0; i < string.length; i++) {\n const c = string.charCodeAt(i);\n if (c > 0xff) {\n throw new Error(\"fromRawString can only accept UTF-8 raw string!\");\n }\n view.setUint8(i, c);\n }\n return new ArrayBufferReader(buffer);\n }\n}\n","class JSBI extends Array{constructor(a,b){if(a>JSBI.__kMaxLength)throw new RangeError(\"Maximum BigInt size exceeded\");super(a),this.sign=b}static BigInt(a){var b=Math.floor,c=Number.isFinite;if(\"number\"==typeof a){if(0===a)return JSBI.__zero();if((0|a)===a)return 0>a?JSBI.__oneDigit(-a,!0):JSBI.__oneDigit(a,!1);if(!c(a)||b(a)!==a)throw new RangeError(\"The number \"+a+\" cannot be converted to BigInt because it is not an integer\");return JSBI.__fromDouble(a)}if(\"string\"==typeof a){const b=JSBI.__fromString(a);if(null===b)throw new SyntaxError(\"Cannot convert \"+a+\" to a BigInt\");return b}if(\"boolean\"==typeof a)return!0===a?JSBI.__oneDigit(1,!1):JSBI.__zero();if(\"object\"==typeof a){if(a.constructor===JSBI)return a;const b=JSBI.__toPrimitive(a);return JSBI.BigInt(b)}throw new TypeError(\"Cannot convert \"+a+\" to a BigInt\")}toDebugString(){const a=[\"BigInt[\"];for(const b of this)a.push((b?(b>>>0).toString(16):b)+\", \");return a.push(\"]\"),a.join(\"\")}toString(a=10){if(2>a||36>>=12;const l=j-12;let m=12<=j?0:h<<20+j,n=20+j;0>>32-l,m=h<>>32-n,n-=32);const o=JSBI.__decideRounding(a,n,i,h);if((1===o||0===o&&1==(1&m))&&(m=m+1>>>0,0==m&&(k++,0!=k>>>20&&(k=0,g++,1023=JSBI.__kMaxLengthBits)throw new RangeError(\"BigInt too big\");if(1===a.length&&2===a.__digit(0)){const b=1+(c>>>5),d=a.sign&&0!=(1&c),e=new JSBI(b,d);e.__initializeDigits();const f=1<<(31&c);return e.__setDigit(b-1,f),e}let d=null,e=a;for(0!=(1&c)&&(d=a),c>>=1;0!==c;c>>=1)e=JSBI.multiply(e,e),0!=(1&c)&&(null===d?d=e:d=JSBI.multiply(d,e));return d}static multiply(a,b){if(0===a.length)return a;if(0===b.length)return b;let c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;const d=new JSBI(c,a.sign!==b.sign);d.__initializeDigits();for(let c=0;cJSBI.__absoluteCompare(a,b))return JSBI.__zero();const c=a.sign!==b.sign,d=b.__unsignedDigit(0);let e;if(1===b.length&&65535>=d){if(1===d)return c===a.sign?a:JSBI.unaryMinus(a);e=JSBI.__absoluteDivSmall(a,d,null)}else e=JSBI.__absoluteDivLarge(a,b,!0,!1);return e.sign=c,e.__trim()}static remainder(a,b){if(0===b.length)throw new RangeError(\"Division by zero\");if(0>JSBI.__absoluteCompare(a,b))return a;const c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return JSBI.__zero();const b=JSBI.__absoluteModSmall(a,c);return 0===b?JSBI.__zero():JSBI.__oneDigit(b,a.sign)}const d=JSBI.__absoluteDivLarge(a,b,!1,!0);return d.sign=a.sign,d.__trim()}static add(a,b){const c=a.sign;return c===b.sign?JSBI.__absoluteAdd(a,b,c):0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c)}static subtract(a,b){const c=a.sign;return c===b.sign?0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c):JSBI.__absoluteAdd(a,b,c)}static leftShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__rightShiftByAbsolute(a,b):JSBI.__leftShiftByAbsolute(a,b)}static signedRightShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__leftShiftByAbsolute(a,b):JSBI.__rightShiftByAbsolute(a,b)}static unsignedRightShift(){throw new TypeError(\"BigInts have no unsigned right shift; use >> instead\")}static lessThan(a,b){return 0>JSBI.__compareToBigInt(a,b)}static lessThanOrEqual(a,b){return 0>=JSBI.__compareToBigInt(a,b)}static greaterThan(a,b){return 0=JSBI.__kMaxLengthBits)return b;const c=a+31>>>5;if(b.lengthJSBI.__kMaxLengthBits)throw new RangeError(\"BigInt too big\");return JSBI.__truncateAndSubFromPowerOfTwo(a,b,!1)}if(a>=JSBI.__kMaxLengthBits)return b;const c=a+31>>>5;if(b.length>>d)return b}return JSBI.__truncateToNBits(a,b)}static ADD(a,b){if(a=JSBI.__toPrimitive(a),b=JSBI.__toPrimitive(b),\"string\"==typeof a)return\"string\"!=typeof b&&(b=b.toString()),a+b;if(\"string\"==typeof b)return a.toString()+b;if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)&&JSBI.__isBigInt(b))return JSBI.add(a,b);if(\"number\"==typeof a&&\"number\"==typeof b)return a+b;throw new TypeError(\"Cannot mix BigInt and other types, use explicit conversions\")}static LT(a,b){return JSBI.__compare(a,b,0)}static LE(a,b){return JSBI.__compare(a,b,1)}static GT(a,b){return JSBI.__compare(a,b,2)}static GE(a,b){return JSBI.__compare(a,b,3)}static EQ(a,b){for(;;){if(JSBI.__isBigInt(a))return JSBI.__isBigInt(b)?JSBI.equal(a,b):JSBI.EQ(b,a);if(\"number\"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,a);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"string\"==typeof a){if(JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.equal(a,b);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"boolean\"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,+a);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"symbol\"==typeof a){if(JSBI.__isBigInt(b))return!1;if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"object\"==typeof a){if(\"object\"==typeof b&&b.constructor!==JSBI)return a==b;a=JSBI.__toPrimitive(a)}else return a==b}}static NE(a,b){return!JSBI.EQ(a,b)}static __zero(){return new JSBI(0,!1)}static __oneDigit(a,b){const c=new JSBI(1,b);return c.__setDigit(0,a),c}__copy(){const a=new JSBI(this.length,this.sign);for(let b=0;bb)e=-b-1;else{if(0===c)return-1;c--,d=a.__digit(c),e=31}let f=1<>>20,c=b-1023,d=(c>>>5)+1,e=new JSBI(d,0>a);let f=1048575&JSBI.__kBitConversionInts[1]|1048576,g=JSBI.__kBitConversionInts[0];const h=20,i=31&c;let j,k=0;if(i<20){const a=h-i;k=a+32,j=f>>>a,f=f<<32-a|g>>>a,g<<=32-a}else if(i===20)k=32,j=f,f=g;else{const a=i-h;k=32-a,j=f<>>32-a,f=g<=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}static __fromString(a,b=0){let c=0;const e=a.length;let f=0;if(f===e)return JSBI.__zero();let g=a.charCodeAt(f);for(;JSBI.__isWhitespace(g);){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}if(43===g){if(++f===e)return null;g=a.charCodeAt(f),c=1}else if(45===g){if(++f===e)return null;g=a.charCodeAt(f),c=-1}if(0===b){if(b=10,48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(b=16,++f===e)return null;g=a.charCodeAt(f)}else if(79===g||111===g){if(b=8,++f===e)return null;g=a.charCodeAt(f)}else if(66===g||98===g){if(b=2,++f===e)return null;g=a.charCodeAt(f)}}}else if(16===b&&48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(++f===e)return null;g=a.charCodeAt(f)}}for(;48===g;){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}const h=e-f;let i=JSBI.__kMaxBitsPerChar[b],j=JSBI.__kBitsPerCharTableMultiplier-1;if(h>1073741824/i)return null;const k=i*h+j>>>JSBI.__kBitsPerCharTableShift,l=new JSBI(k+31>>>5,!1),n=10>b?b:10,o=10>=JSBI.__kBitsPerCharTableShift;const b=[],c=[];let d=!1;do{let h=0,j=0;for(;;){let b;if(g-48>>>0>>0>>0>>0>>JSBI.__kBitsPerCharTableShift+5;l.__inplaceMultiplyAdd(p,k,q)}while(!c)}if(f!==e){if(!JSBI.__isWhitespace(g))return null;for(f++;f>>i-f)}if(0!==e){if(d>=a.length)throw new Error(\"implementation bug\");a.__setDigit(d++,e)}for(;d>>1)+(85&e),e=(51&e>>>2)+(51&e),e=(15&e>>>4)+(15&e);const f=e,g=b-1,h=a.__digit(d-1),i=c(h);let j=0|(32*d-i+f-1)/f;if(a.sign&&j++,268435456>>e,n=32-e;n>=f;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f,n-=f}const o=(m|h<>>f-n;0!==m;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f;if(a.sign&&(k[l--]=\"-\"),-1!=l)throw new Error(\"implementation bug\");return k.join(\"\")}static __toStringGeneric(a,b,c){var d=Math.clz32;const e=a.length;if(0===e)return\"\";if(1===e){let d=a.__unsignedDigit(0).toString(b);return!1===c&&a.sign&&(d=\"-\"+d),d}const f=32*e-d(a.__digit(e-1)),g=JSBI.__kMaxBitsPerChar[b],h=g-1;let i=f*JSBI.__kBitsPerCharTableMultiplier;i+=h-1,i=0|i/h;const j=i+1>>1,k=JSBI.exponentiate(JSBI.__oneDigit(b,!1),JSBI.__oneDigit(j,!1));let l,m;const n=k.__unsignedDigit(0);if(1===k.length&&65535>=n){l=new JSBI(a.length,!1),l.__initializeDigits();let c=0;for(let b=2*a.length-1;0<=b;b--){const d=c<<16|a.__halfDigit(b);l.__setHalfDigit(b,0|d/n),c=0|d%n}m=c.toString(b)}else{const c=JSBI.__absoluteDivLarge(a,k,!0,!0);l=c.quotient;const d=c.remainder.__trim();m=JSBI.__toStringGeneric(d,b,!0)}l.__trim();let o=JSBI.__toStringGeneric(l,b,!0);for(;m.lengthd?JSBI.__absoluteLess(c):0}static __compareToNumber(a,b){if(b|!0){const c=a.sign,d=0>b;if(c!==d)return JSBI.__unequalSign(c);if(0===a.length){if(d)throw new Error(\"implementation bug\");return 0===b?0:-1}if(1e?JSBI.__absoluteGreater(c):fb)return JSBI.__unequalSign(d);if(0===b)throw new Error(\"implementation bug: should be handled elsewhere\");if(0===a.length)return-1;JSBI.__kBitConversionDouble[0]=b;const e=2047&JSBI.__kBitConversionInts[1]>>>20;if(2047==e)throw new Error(\"implementation bug: handled elsewhere\");const f=e-1023;if(0>f)return JSBI.__absoluteGreater(d);const g=a.length;let h=a.__digit(g-1);const i=c(h),j=32*g-i,k=f+1;if(jk)return JSBI.__absoluteGreater(d);let l=1048576|1048575&JSBI.__kBitConversionInts[1],m=JSBI.__kBitConversionInts[0];const n=20,o=31-i;if(o!==(j-1)%31)throw new Error(\"implementation bug\");let p,q=0;if(20>o){const a=n-o;q=a+32,p=l>>>a,l=l<<32-a|m>>>a,m<<=32-a}else if(20===o)q=32,p=l,l=m;else{const a=o-n;q=32-a,p=l<>>32-a,l=m<>>=0,p>>>=0,h>p)return JSBI.__absoluteGreater(d);if(h>>0,l=m,m=0):p=0;const b=a.__unsignedDigit(c);if(b>p)return JSBI.__absoluteGreater(d);if(bb&&a.__unsignedDigit(0)===c(b):0===JSBI.__compareToDouble(a,b)}static __comparisonResultToBool(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0b;case 3:return a>=b;}if(JSBI.__isBigInt(a)&&\"string\"==typeof b)return b=JSBI.__fromString(b),null!==b&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(\"string\"==typeof a&&JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)){if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(\"number\"!=typeof b)throw new Error(\"implementation bug\");return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(a,b),c)}if(\"number\"!=typeof a)throw new Error(\"implementation bug\");if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(b,a),2^c);if(\"number\"!=typeof b)throw new Error(\"implementation bug\");return 0===c?ab:3===c?a>=b:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(a,b,c){if(a.length>>16)+(c>>>16)+(h>>>16);f=i>>>16,e.__setDigit(g,65535&h|i<<16)}for(;g>>16)+(c>>>16);f=d>>>16,e.__setDigit(g,65535&c|d<<16)}return g>>16;const i=(c>>>16)-(g>>>16)-e;e=1&i>>>16,d.__setDigit(f,65535&h|i<<16)}for(;f>>16;const g=(b>>>16)-e;e=1&g>>>16,d.__setDigit(f,65535&c|g<<16)}return d.__trim()}static __absoluteAddOne(a,b,c=null){const d=a.length;null===c?c=new JSBI(d,b):c.sign=b;let e=!0;for(let f,g=0;gd?0:a.__unsignedDigit(d)>b.__unsignedDigit(d)?1:-1}static __multiplyAccumulate(a,b,c,d){var e=Math.imul;if(0===b)return;const f=65535&b,g=b>>>16;let h=0,j=0,k=0;for(let l=0;l>>16;const n=a.__digit(l),o=65535&n,p=n>>>16,q=e(o,f),r=e(o,g),s=e(p,f),t=e(p,g);i+=j+(65535&q),m+=k+h+(i>>>16)+(q>>>16)+(65535&r)+(65535&s),h=m>>>16,j=(r>>>16)+(s>>>16)+(65535&t)+h,h=j>>>16,j&=65535,k=t>>>16,b=65535&i|m<<16,c.__setDigit(d,b)}for(;0!=h||0!==j||0!==k;d++){let a=c.__digit(d);const b=(65535&a)+j,e=(a>>>16)+(b>>>16)+k+h;j=0,k=0,h=e>>>16,a=65535&b|e<<16,c.__setDigit(d,a)}}static __internalMultiplyAdd(a,b,c,d,e){var f=Math.imul;let g=c,h=0;for(let j=0;j>>16;const k=f(c>>>16,b),l=(65535&k)+(d>>>16)+g;g=l>>>16,h=k>>>16,e.__setDigit(j,l<<16|65535&i)}if(e.length>d)for(e.__setDigit(d++,g+h);dthis.length&&(c=this.length);const f=65535&a,g=a>>>16;let h=0,j=65535&b,k=b>>>16;for(let l=0;l>>16,d=e(b,f),i=e(b,g),m=e(c,f),n=e(c,g),o=j+(65535&d),p=k+h+(o>>>16)+(d>>>16)+(65535&i)+(65535&m);j=(i>>>16)+(m>>>16)+(65535&n)+(p>>>16),h=j>>>16,j&=65535,k=n>>>16;this.__setDigit(l,65535&o|p<<16)}if(0!=h||0!==j||0!==k)throw new Error(\"implementation bug\")}static __absoluteDivSmall(a,b,c){null===c&&(c=new JSBI(a.length,!1));let d=0;for(let e,f=2*a.length-1;0<=f;f-=2){e=(d<<16|a.__halfDigit(f))>>>0;const g=0|e/b;d=0|e%b,e=(d<<16|a.__halfDigit(f-1))>>>0;const h=0|e/b;d=0|e%b,c.__setDigit(f>>>1,g<<16|h)}return c}static __absoluteModSmall(a,b){let c=0;for(let d=2*a.length-1;0<=d;d--){const e=(c<<16|a.__halfDigit(d))>>>0;c=0|e%b}return c}static __absoluteDivLarge(a,b,d,e){var f=Math.imul;const g=b.__halfDigitLength(),h=b.length,c=a.__halfDigitLength()-g;let i=null;d&&(i=new JSBI(c+2>>>1,!1),i.__initializeDigits());const k=new JSBI(g+2>>>1,!1);k.__initializeDigits();const l=JSBI.__clz16(b.__halfDigit(g-1));0>>0;l=0|c/n;let d=0|c%n;const e=b.__halfDigit(g-2),h=m.__halfDigit(p+g-2);for(;f(l,e)>>>0>(d<<16|h)>>>0&&(l--,d+=n,!(65535>>1,o|l))}return e?(m.__inplaceRightShift(l),d?{quotient:i,remainder:m}:m):d?i:void 0}static __clz16(a){return Math.clz32(a)-16}__inplaceAdd(a,b,c){let d=0;for(let e=0;e>>16,this.__setHalfDigit(b+e,c)}return d}__inplaceSub(a,b,c){let d=0;if(1&b){b>>=1;let e=this.__digit(b),f=65535&e,g=0;for(;g>>1;g++){const c=a.__digit(g),h=(e>>>16)-(65535&c)-d;d=1&h>>>16,this.__setDigit(b+g,h<<16|65535&f),e=this.__digit(b+g+1),f=(65535&e)-(c>>>16)-d,d=1&f>>>16}const h=a.__digit(g),i=(e>>>16)-(65535&h)-d;d=1&i>>>16,this.__setDigit(b+g,i<<16|65535&f);if(b+g+1>=this.length)throw new RangeError(\"out of bounds\");0==(1&c)&&(e=this.__digit(b+g+1),f=(65535&e)-(h>>>16)-d,d=1&f>>>16,this.__setDigit(b+a.length,4294901760&e|65535&f))}else{b>>=1;let e=0;for(;e>>16;const h=(c>>>16)-(f>>>16)-d;d=1&h>>>16,this.__setDigit(b+e,h<<16|65535&g)}const f=this.__digit(b+e),g=a.__digit(e),h=(65535&f)-(65535&g)-d;d=1&h>>>16;let i=0;0==(1&c)&&(i=(f>>>16)-(g>>>16)-d,d=1&i>>>16),this.__setDigit(b+e,i<<16|65535&h)}return d}__inplaceRightShift(a){if(0===a)return;let b=this.__digit(0)>>>a;const c=this.length-1;for(let e=0;e>>a}this.__setDigit(c,b)}static __specialLeftShift(a,b,c){const d=a.length,e=new JSBI(d+c,!1);if(0===b){for(let b=0;b>>32-b}return 0c)throw new RangeError(\"BigInt too big\");const e=c>>>5,f=31&c,g=a.length,h=0!==f&&0!=a.__digit(g-1)>>>32-f,j=g+e+(h?1:0),k=new JSBI(j,a.sign);if(0===f){let b=0;for(;b>>32-f}if(h)k.__setDigit(g+e,b);else if(0!=b)throw new Error(\"implementation bug\")}return k.__trim()}static __rightShiftByAbsolute(a,b){const c=a.length,d=a.sign,e=JSBI.__toShiftAmount(b);if(0>e)return JSBI.__rightShiftByMaximum(d);const f=e>>>5,g=31&e;let h=c-f;if(0>=h)return JSBI.__rightShiftByMaximum(d);let i=!1;if(d){if(0!=(a.__digit(f)&(1<>>g;const d=c-f-1;for(let c=0;c>>g}j.__setDigit(d,b)}return i&&(j=JSBI.__absoluteAddOne(j,!0,j)),j.__trim()}static __rightShiftByMaximum(a){return a?JSBI.__oneDigit(1,!0):JSBI.__zero()}static __toShiftAmount(a){if(1JSBI.__kMaxLengthBits?-1:b}static __toPrimitive(a,b=\"default\"){if(\"object\"!=typeof a)return a;if(a.constructor===JSBI)return a;const c=a[Symbol.toPrimitive];if(c){const a=c(b);if(\"object\"!=typeof a)return a;throw new TypeError(\"Cannot convert object to primitive value\")}const d=a.valueOf;if(d){const b=d.call(a);if(\"object\"!=typeof b)return b}const e=a.toString;if(e){const b=e.call(a);if(\"object\"!=typeof b)return b}throw new TypeError(\"Cannot convert object to primitive value\")}static __toNumeric(a){return JSBI.__isBigInt(a)?a:+a}static __isBigInt(a){return\"object\"==typeof a&&a.constructor===JSBI}static __truncateToNBits(a,b){const c=a+31>>>5,d=new JSBI(c,b.sign),e=c-1;for(let c=0;c>>b}return d.__setDigit(e,f),d.__trim()}static __truncateAndSubFromPowerOfTwo(a,b,c){var d=Math.min;const e=a+31>>>5,f=new JSBI(e,c);let g=0;const h=e-1;let j=0;for(const e=d(h,b.length);g>>16;const d=0-(a>>>16)-j;j=1&d>>>16,f.__setDigit(g,65535&c|d<<16)}for(;g>>16;const b=0-(k>>>16)-j;m=65535&a|b<<16}else{const a=32-l;k=k<>>a;const b=1<<32-a,c=(65535&b)-(65535&k)-j;j=1&c>>>16;const d=(b>>>16)-(k>>>16)-j;m=65535&c|d<<16,m&=b-1}return f.__setDigit(h,m),f.__trim()}__digit(a){return this[a]}__unsignedDigit(a){return this[a]>>>0}__setDigit(a,b){this[a]=0|b}__setDigitGrow(a,b){this[a]=0|b}__halfDigitLength(){const a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}__halfDigit(a){return 65535&this[a>>>1]>>>((1&a)<<4)}__setHalfDigit(a,b){const c=a>>>1,d=this.__digit(c),e=1&a?65535&d|b<<16:4294901760&d|65535&b;this.__setDigit(c,e)}static __digitPow(a,b){let c=1;for(;0>>=1,a*=a;return c}}JSBI.__kMaxLength=33554432,JSBI.__kMaxLengthBits=JSBI.__kMaxLength<<5,JSBI.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],JSBI.__kBitsPerCharTableShift=5,JSBI.__kBitsPerCharTableMultiplier=1< maximalLength\n ) {\n throw new Error(errorMessage);\n }\n let optionalProvidedKeys = providedKeys.filter(\n key => !expectedKeys.includes(key)\n );\n if (providedKeys.length - optionalProvidedKeys.length !== requiredLength) {\n throw new Error(errorMessage);\n }\n if (optionalProvidedKeys.find(key => !optionalKeys.includes(key))) {\n throw new Error(errorMessage);\n }\n}\n\nfunction assertHexString(debugPath, string) {\n if (!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(string)) {\n throw new Error(`${debugPath} must be a hex string!`);\n }\n}\n\nfunction assertHash(debugPath, hash) {\n assertHexString(debugPath, hash);\n if (hash.length !== 66) {\n throw new Error(`${debugPath} must be a hex string of 66 bytes long!`);\n }\n}\n\nfunction assertInteger(debugPath, i) {\n if (i === \"0x0\") {\n return;\n }\n if (!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(i)) {\n throw new Error(`${debugPath} must be a hex integer!`);\n }\n}\n\nexport function ValidateScript(\n script,\n { nestedValidation = true, debugPath = \"script\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n script,\n [\"code_hash\", \"hash_type\", \"args\"],\n []\n );\n assertHash(`${debugPath}.code_hash`, script.code_hash);\n assertHexString(`${debugPath}.args`, script.args);\n\n if (\n script.hash_type !== \"data\" &&\n script.hash_type !== \"type\" &&\n script.hash_type !== \"data1\"\n ) {\n throw new Error(`${debugPath}.hash_type must be either data or type!`);\n }\n}\n\nexport function ValidateOutPoint(\n outPoint,\n { nestedValidation = true, debugPath = \"out_point\" } = {}\n) {\n assertObjectWithKeys(debugPath, outPoint, [\"tx_hash\", \"index\"], []);\n assertHash(`${debugPath}.tx_hash`, outPoint.tx_hash);\n assertInteger(`${debugPath}.index`, outPoint.index);\n}\n\nexport function ValidateCellInput(\n cellInput,\n { nestedValidation = true, debugPath = \"cell_input\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellInput, [\"since\", \"previous_output\"], []);\n assertInteger(`${debugPath}.since`, cellInput.since);\n\n if (nestedValidation) {\n ValidateOutPoint(cellInput.previous_output, {\n debugPath: `${debugPath}.previous_output`\n });\n }\n}\n\nexport function ValidateCellOutput(\n cellOutput,\n { nestedValidation = true, debugPath = \"cell_output\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellOutput, [\"capacity\", \"lock\"], [\"type\"]);\n assertInteger(`${debugPath}.capacity`, cellOutput.capacity);\n\n if (nestedValidation) {\n ValidateScript(cellOutput.lock, {\n debugPath: `${debugPath}.lock`\n });\n if (cellOutput.type) {\n ValidateScript(cellOutput.type, {\n debugPath: `${debugPath}.type`\n });\n }\n }\n}\n\nexport function ValidateCellDep(\n cellDep,\n { nestedValidation = true, debugPath = \"cell_dep\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellDep, [\"out_point\", \"dep_type\"], []);\n if (cellDep.dep_type !== \"code\" && cellDep.dep_type !== \"dep_group\") {\n throw new Error(`${debugPath}.dep_type must be either code or dep_group!`);\n }\n\n if (nestedValidation) {\n ValidateOutPoint(cellDep.out_point, {\n debugPath: `${debugPath}.out_point`\n });\n }\n}\n\nfunction assertArray(debugPath, array, validateFunction, nestedValidation) {\n if (!Array.isArray(array)) {\n throw new Error(`${debugPath} is not an array!`);\n }\n if (nestedValidation) {\n for (let i = 0; i < array.length; i++) {\n validateFunction(`${debugPath}[${i}]`, array[i]);\n }\n }\n}\n\nfunction toAssert(validateFunction, nestedValidation) {\n return function(debugPath, value) {\n validateFunction(value, {\n nestedValidation: nestedValidation,\n debugPath: debugPath\n });\n };\n}\n\nfunction assertCommonTransaction(debugPath, rawTransaction, nestedValidation) {\n assertInteger(`${debugPath}.version`, rawTransaction.version);\n assertArray(\n `${debugPath}.cell_deps`,\n rawTransaction.cell_deps,\n toAssert(ValidateCellDep, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.header_deps`,\n rawTransaction.header_deps,\n assertHash,\n nestedValidation\n );\n assertArray(\n `${debugPath}.inputs`,\n rawTransaction.inputs,\n toAssert(ValidateCellInput, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.outputs`,\n rawTransaction.outputs,\n toAssert(ValidateCellOutput, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.outputs_data`,\n rawTransaction.outputs_data,\n assertHexString,\n nestedValidation\n );\n}\n\nexport function ValidateRawTransaction(\n rawTransaction,\n { nestedValidation = true, debugPath = \"raw_transaction\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n rawTransaction,\n [\n \"version\",\n \"cell_deps\",\n \"header_deps\",\n \"inputs\",\n \"outputs\",\n \"outputs_data\"\n ],\n []\n );\n assertCommonTransaction(debugPath, rawTransaction, nestedValidation);\n}\n\nexport function ValidateTransaction(\n transaction,\n { nestedValidation = true, debugPath = \"transaction\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n transaction,\n [\n \"version\",\n \"cell_deps\",\n \"header_deps\",\n \"inputs\",\n \"outputs\",\n \"outputs_data\",\n \"witnesses\"\n ],\n []\n );\n assertCommonTransaction(debugPath, transaction, nestedValidation);\n assertArray(\n `${debugPath}.witnesses`,\n transaction.witnesses,\n assertHexString,\n nestedValidation\n );\n}\n\nfunction assertCommonHeader(debugPath, rawHeader) {\n assertInteger(`${debugPath}.version`, rawHeader.version);\n assertInteger(`${debugPath}.compact_target`, rawHeader.compact_target);\n assertInteger(`${debugPath}.timestamp`, rawHeader.timestamp);\n assertInteger(`${debugPath}.number`, rawHeader.number);\n assertInteger(`${debugPath}.epoch`, rawHeader.epoch);\n assertHash(`${debugPath}.parent_hash`, rawHeader.parent_hash);\n assertHash(`${debugPath}.transactions_root`, rawHeader.transactions_root);\n assertHash(`${debugPath}.proposals_hash`, rawHeader.proposals_hash);\n assertHash(`${debugPath}.uncles_hash`, rawHeader.uncles_hash);\n assertHash(`${debugPath}.dao`, rawHeader.dao);\n}\n\nexport function ValidateRawHeader(\n rawHeader,\n { nestedValidation = true, debugPath = \"raw_header\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n rawHeader,\n [\n \"version\",\n \"compact_target\",\n \"timestamp\",\n \"number\",\n \"epoch\",\n \"parent_hash\",\n \"transactions_root\",\n \"proposals_hash\",\n \"uncles_hash\",\n \"dao\"\n ],\n []\n );\n assertCommonHeader(debugPath, rawHeader);\n}\n\nexport function ValidateHeader(\n header,\n { nestedValidation = true, debugPath = \"header\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n header,\n [\n \"version\",\n \"compact_target\",\n \"timestamp\",\n \"number\",\n \"epoch\",\n \"parent_hash\",\n \"transactions_root\",\n \"proposals_hash\",\n \"uncles_hash\",\n \"dao\",\n \"nonce\"\n ],\n []\n );\n assertHexString(`${debugPath}.nonce`, header.nonce);\n if (header.nonce.length !== 34) {\n throw new Error(\n `${debugPath}.nonce must be a hex string of 34 bytes long!`\n );\n }\n}\n\nfunction assertProposalShortId(debugPath, shortId) {\n assertHexString(debugPath, shortId);\n if (shortId.length !== 22) {\n throw new Error(`${debugPath} must be a hex string of 22 bytes long!`);\n }\n}\n\nexport function ValidateUncleBlock(\n uncleBlock,\n { nestedValidation = true, debugPath = \"uncle_block\" } = {}\n) {\n assertObjectWithKeys(debugPath, uncleBlock, [\"header\", \"proposals\"], []);\n\n if (nestedValidation) {\n ValidateHeader(uncleBlock.header, {\n debugPath: `${debugPath}.header`\n });\n }\n assertArray(\n `${debugPath}.proposals`,\n uncleBlock.proposals,\n assertProposalShortId,\n nestedValidation\n );\n}\n\nexport function ValidateBlock(\n block,\n { nestedValidation = true, debugPath = \"block\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n block,\n [\"header\", \"uncles\", \"transactions\", \"proposals\"],\n []\n );\n\n if (nestedValidation) {\n ValidateHeader(block.header, {\n debugPath: `${debugPath}.header`\n });\n }\n assertArray(\n `${debugPath}.uncles`,\n block.uncles,\n toAssert(ValidateUncleBlock, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.transactions`,\n block.transactions,\n toAssert(ValidateTransaction, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.proposals`,\n block.proposals,\n assertProposalShortId,\n nestedValidation\n );\n}\n\nexport function ValidateCellbaseWitness(\n cellbaseWitness,\n { nestedValidation = true, debugPath = \"cellbase_witness\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellbaseWitness, [\"lock\", \"message\"], []);\n assertHexString(`${debugPath}.message`, cellbaseWitness.message);\n\n if (nestedValidation) {\n ValidateScript(cellbaseWitness.lock, {\n debugPath: `${debugPath}.lock`\n });\n }\n}\n\nexport function ValidateWitnessArgs(\n witnessArgs,\n { nestedValidation = true, debugPath = \"witness_args\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n witnessArgs,\n [],\n [\"lock\", \"input_type\", \"output_type\"]\n );\n\n if (witnessArgs.lock) {\n assertHexString(`${debugPath}.lock`, witnessArgs.lock);\n }\n if (witnessArgs.input_type) {\n assertHexString(`${debugPath}.input_type`, witnessArgs.input_type);\n }\n if (witnessArgs.output_type) {\n assertHexString(`${debugPath}.output_type`, witnessArgs.output_type);\n }\n}\n","import Stream from 'stream';\nimport http from 'http';\nimport Url from 'url';\nimport https from 'https';\nimport zlib from 'zlib';\n\n// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js\n\n// fix for \"Readable\" isn't a named export issue\nconst Readable = Stream.Readable;\n\nconst BUFFER = Symbol('buffer');\nconst TYPE = Symbol('type');\n\nclass Blob {\n\tconstructor() {\n\t\tthis[TYPE] = '';\n\n\t\tconst blobParts = arguments[0];\n\t\tconst options = arguments[1];\n\n\t\tconst buffers = [];\n\t\tlet size = 0;\n\n\t\tif (blobParts) {\n\t\t\tconst a = blobParts;\n\t\t\tconst length = Number(a.length);\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\tconst element = a[i];\n\t\t\t\tlet buffer;\n\t\t\t\tif (element instanceof Buffer) {\n\t\t\t\t\tbuffer = element;\n\t\t\t\t} else if (ArrayBuffer.isView(element)) {\n\t\t\t\t\tbuffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);\n\t\t\t\t} else if (element instanceof ArrayBuffer) {\n\t\t\t\t\tbuffer = Buffer.from(element);\n\t\t\t\t} else if (element instanceof Blob) {\n\t\t\t\t\tbuffer = element[BUFFER];\n\t\t\t\t} else {\n\t\t\t\t\tbuffer = Buffer.from(typeof element === 'string' ? element : String(element));\n\t\t\t\t}\n\t\t\t\tsize += buffer.length;\n\t\t\t\tbuffers.push(buffer);\n\t\t\t}\n\t\t}\n\n\t\tthis[BUFFER] = Buffer.concat(buffers);\n\n\t\tlet type = options && options.type !== undefined && String(options.type).toLowerCase();\n\t\tif (type && !/[^\\u0020-\\u007E]/.test(type)) {\n\t\t\tthis[TYPE] = type;\n\t\t}\n\t}\n\tget size() {\n\t\treturn this[BUFFER].length;\n\t}\n\tget type() {\n\t\treturn this[TYPE];\n\t}\n\ttext() {\n\t\treturn Promise.resolve(this[BUFFER].toString());\n\t}\n\tarrayBuffer() {\n\t\tconst buf = this[BUFFER];\n\t\tconst ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n\t\treturn Promise.resolve(ab);\n\t}\n\tstream() {\n\t\tconst readable = new Readable();\n\t\treadable._read = function () {};\n\t\treadable.push(this[BUFFER]);\n\t\treadable.push(null);\n\t\treturn readable;\n\t}\n\ttoString() {\n\t\treturn '[object Blob]';\n\t}\n\tslice() {\n\t\tconst size = this.size;\n\n\t\tconst start = arguments[0];\n\t\tconst end = arguments[1];\n\t\tlet relativeStart, relativeEnd;\n\t\tif (start === undefined) {\n\t\t\trelativeStart = 0;\n\t\t} else if (start < 0) {\n\t\t\trelativeStart = Math.max(size + start, 0);\n\t\t} else {\n\t\t\trelativeStart = Math.min(start, size);\n\t\t}\n\t\tif (end === undefined) {\n\t\t\trelativeEnd = size;\n\t\t} else if (end < 0) {\n\t\t\trelativeEnd = Math.max(size + end, 0);\n\t\t} else {\n\t\t\trelativeEnd = Math.min(end, size);\n\t\t}\n\t\tconst span = Math.max(relativeEnd - relativeStart, 0);\n\n\t\tconst buffer = this[BUFFER];\n\t\tconst slicedBuffer = buffer.slice(relativeStart, relativeStart + span);\n\t\tconst blob = new Blob([], { type: arguments[2] });\n\t\tblob[BUFFER] = slicedBuffer;\n\t\treturn blob;\n\t}\n}\n\nObject.defineProperties(Blob.prototype, {\n\tsize: { enumerable: true },\n\ttype: { enumerable: true },\n\tslice: { enumerable: true }\n});\n\nObject.defineProperty(Blob.prototype, Symbol.toStringTag, {\n\tvalue: 'Blob',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\n/**\n * fetch-error.js\n *\n * FetchError interface for operational errors\n */\n\n/**\n * Create FetchError instance\n *\n * @param String message Error message for human\n * @param String type Error type for machine\n * @param String systemError For Node.js system error\n * @return FetchError\n */\nfunction FetchError(message, type, systemError) {\n Error.call(this, message);\n\n this.message = message;\n this.type = type;\n\n // when err.type is `system`, err.code contains system error code\n if (systemError) {\n this.code = this.errno = systemError.code;\n }\n\n // hide custom error implementation details from end-users\n Error.captureStackTrace(this, this.constructor);\n}\n\nFetchError.prototype = Object.create(Error.prototype);\nFetchError.prototype.constructor = FetchError;\nFetchError.prototype.name = 'FetchError';\n\nlet convert;\ntry {\n\tconvert = require('encoding').convert;\n} catch (e) {}\n\nconst INTERNALS = Symbol('Body internals');\n\n// fix an issue where \"PassThrough\" isn't a named export for node <10\nconst PassThrough = Stream.PassThrough;\n\n/**\n * Body mixin\n *\n * Ref: https://fetch.spec.whatwg.org/#body\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nfunction Body(body) {\n\tvar _this = this;\n\n\tvar _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n\t _ref$size = _ref.size;\n\n\tlet size = _ref$size === undefined ? 0 : _ref$size;\n\tvar _ref$timeout = _ref.timeout;\n\tlet timeout = _ref$timeout === undefined ? 0 : _ref$timeout;\n\n\tif (body == null) {\n\t\t// body is undefined or null\n\t\tbody = null;\n\t} else if (isURLSearchParams(body)) {\n\t\t// body is a URLSearchParams\n\t\tbody = Buffer.from(body.toString());\n\t} else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {\n\t\t// body is ArrayBuffer\n\t\tbody = Buffer.from(body);\n\t} else if (ArrayBuffer.isView(body)) {\n\t\t// body is ArrayBufferView\n\t\tbody = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n\t} else if (body instanceof Stream) ; else {\n\t\t// none of the above\n\t\t// coerce to string then buffer\n\t\tbody = Buffer.from(String(body));\n\t}\n\tthis[INTERNALS] = {\n\t\tbody,\n\t\tdisturbed: false,\n\t\terror: null\n\t};\n\tthis.size = size;\n\tthis.timeout = timeout;\n\n\tif (body instanceof Stream) {\n\t\tbody.on('error', function (err) {\n\t\t\tconst error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);\n\t\t\t_this[INTERNALS].error = error;\n\t\t});\n\t}\n}\n\nBody.prototype = {\n\tget body() {\n\t\treturn this[INTERNALS].body;\n\t},\n\n\tget bodyUsed() {\n\t\treturn this[INTERNALS].disturbed;\n\t},\n\n\t/**\n * Decode response as ArrayBuffer\n *\n * @return Promise\n */\n\tarrayBuffer() {\n\t\treturn consumeBody.call(this).then(function (buf) {\n\t\t\treturn buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n\t\t});\n\t},\n\n\t/**\n * Return raw response as Blob\n *\n * @return Promise\n */\n\tblob() {\n\t\tlet ct = this.headers && this.headers.get('content-type') || '';\n\t\treturn consumeBody.call(this).then(function (buf) {\n\t\t\treturn Object.assign(\n\t\t\t// Prevent copying\n\t\t\tnew Blob([], {\n\t\t\t\ttype: ct.toLowerCase()\n\t\t\t}), {\n\t\t\t\t[BUFFER]: buf\n\t\t\t});\n\t\t});\n\t},\n\n\t/**\n * Decode response as json\n *\n * @return Promise\n */\n\tjson() {\n\t\tvar _this2 = this;\n\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\ttry {\n\t\t\t\treturn JSON.parse(buffer.toString());\n\t\t\t} catch (err) {\n\t\t\t\treturn Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));\n\t\t\t}\n\t\t});\n\t},\n\n\t/**\n * Decode response as text\n *\n * @return Promise\n */\n\ttext() {\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\treturn buffer.toString();\n\t\t});\n\t},\n\n\t/**\n * Decode response as buffer (non-spec api)\n *\n * @return Promise\n */\n\tbuffer() {\n\t\treturn consumeBody.call(this);\n\t},\n\n\t/**\n * Decode response as text, while automatically detecting the encoding and\n * trying to decode to UTF-8 (non-spec api)\n *\n * @return Promise\n */\n\ttextConverted() {\n\t\tvar _this3 = this;\n\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\treturn convertBody(buffer, _this3.headers);\n\t\t});\n\t}\n};\n\n// In browsers, all properties are enumerable.\nObject.defineProperties(Body.prototype, {\n\tbody: { enumerable: true },\n\tbodyUsed: { enumerable: true },\n\tarrayBuffer: { enumerable: true },\n\tblob: { enumerable: true },\n\tjson: { enumerable: true },\n\ttext: { enumerable: true }\n});\n\nBody.mixIn = function (proto) {\n\tfor (const name of Object.getOwnPropertyNames(Body.prototype)) {\n\t\t// istanbul ignore else: future proof\n\t\tif (!(name in proto)) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(Body.prototype, name);\n\t\t\tObject.defineProperty(proto, name, desc);\n\t\t}\n\t}\n};\n\n/**\n * Consume and convert an entire Body to a Buffer.\n *\n * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body\n *\n * @return Promise\n */\nfunction consumeBody() {\n\tvar _this4 = this;\n\n\tif (this[INTERNALS].disturbed) {\n\t\treturn Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));\n\t}\n\n\tthis[INTERNALS].disturbed = true;\n\n\tif (this[INTERNALS].error) {\n\t\treturn Body.Promise.reject(this[INTERNALS].error);\n\t}\n\n\tlet body = this.body;\n\n\t// body is null\n\tif (body === null) {\n\t\treturn Body.Promise.resolve(Buffer.alloc(0));\n\t}\n\n\t// body is blob\n\tif (isBlob(body)) {\n\t\tbody = body.stream();\n\t}\n\n\t// body is buffer\n\tif (Buffer.isBuffer(body)) {\n\t\treturn Body.Promise.resolve(body);\n\t}\n\n\t// istanbul ignore if: should never happen\n\tif (!(body instanceof Stream)) {\n\t\treturn Body.Promise.resolve(Buffer.alloc(0));\n\t}\n\n\t// body is stream\n\t// get ready to actually consume the body\n\tlet accum = [];\n\tlet accumBytes = 0;\n\tlet abort = false;\n\n\treturn new Body.Promise(function (resolve, reject) {\n\t\tlet resTimeout;\n\n\t\t// allow timeout on slow response body\n\t\tif (_this4.timeout) {\n\t\t\tresTimeout = setTimeout(function () {\n\t\t\t\tabort = true;\n\t\t\t\treject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));\n\t\t\t}, _this4.timeout);\n\t\t}\n\n\t\t// handle stream errors\n\t\tbody.on('error', function (err) {\n\t\t\tif (err.name === 'AbortError') {\n\t\t\t\t// if the request was aborted, reject with this Error\n\t\t\t\tabort = true;\n\t\t\t\treject(err);\n\t\t\t} else {\n\t\t\t\t// other errors, such as incorrect content-encoding\n\t\t\t\treject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));\n\t\t\t}\n\t\t});\n\n\t\tbody.on('data', function (chunk) {\n\t\t\tif (abort || chunk === null) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (_this4.size && accumBytes + chunk.length > _this4.size) {\n\t\t\t\tabort = true;\n\t\t\t\treject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\taccumBytes += chunk.length;\n\t\t\taccum.push(chunk);\n\t\t});\n\n\t\tbody.on('end', function () {\n\t\t\tif (abort) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tclearTimeout(resTimeout);\n\n\t\t\ttry {\n\t\t\t\tresolve(Buffer.concat(accum, accumBytes));\n\t\t\t} catch (err) {\n\t\t\t\t// handle streams that have accumulated too much data (issue #414)\n\t\t\t\treject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Detect buffer encoding and convert to target encoding\n * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding\n *\n * @param Buffer buffer Incoming buffer\n * @param String encoding Target encoding\n * @return String\n */\nfunction convertBody(buffer, headers) {\n\tif (typeof convert !== 'function') {\n\t\tthrow new Error('The package `encoding` must be installed to use the textConverted() function');\n\t}\n\n\tconst ct = headers.get('content-type');\n\tlet charset = 'utf-8';\n\tlet res, str;\n\n\t// header\n\tif (ct) {\n\t\tres = /charset=([^;]*)/i.exec(ct);\n\t}\n\n\t// no charset in content type, peek at response body for at most 1024 bytes\n\tstr = buffer.slice(0, 1024).toString();\n\n\t// html5\n\tif (!res && str) {\n\t\tres = / 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n\n\t\tthis[MAP] = Object.create(null);\n\n\t\tif (init instanceof Headers) {\n\t\t\tconst rawHeaders = init.raw();\n\t\t\tconst headerNames = Object.keys(rawHeaders);\n\n\t\t\tfor (const headerName of headerNames) {\n\t\t\t\tfor (const value of rawHeaders[headerName]) {\n\t\t\t\t\tthis.append(headerName, value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't worry about converting prop to ByteString here as append()\n\t\t// will handle it.\n\t\tif (init == null) ; else if (typeof init === 'object') {\n\t\t\tconst method = init[Symbol.iterator];\n\t\t\tif (method != null) {\n\t\t\t\tif (typeof method !== 'function') {\n\t\t\t\t\tthrow new TypeError('Header pairs must be iterable');\n\t\t\t\t}\n\n\t\t\t\t// sequence>\n\t\t\t\t// Note: per spec we have to first exhaust the lists then process them\n\t\t\t\tconst pairs = [];\n\t\t\t\tfor (const pair of init) {\n\t\t\t\t\tif (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {\n\t\t\t\t\t\tthrow new TypeError('Each header pair must be iterable');\n\t\t\t\t\t}\n\t\t\t\t\tpairs.push(Array.from(pair));\n\t\t\t\t}\n\n\t\t\t\tfor (const pair of pairs) {\n\t\t\t\t\tif (pair.length !== 2) {\n\t\t\t\t\t\tthrow new TypeError('Each header pair must be a name/value tuple');\n\t\t\t\t\t}\n\t\t\t\t\tthis.append(pair[0], pair[1]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// record\n\t\t\t\tfor (const key of Object.keys(init)) {\n\t\t\t\t\tconst value = init[key];\n\t\t\t\t\tthis.append(key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new TypeError('Provided initializer must be an object');\n\t\t}\n\t}\n\n\t/**\n * Return combined header value given name\n *\n * @param String name Header name\n * @return Mixed\n */\n\tget(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key === undefined) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this[MAP][key].join(', ');\n\t}\n\n\t/**\n * Iterate over all headers\n *\n * @param Function callback Executed for each item with parameters (value, name, thisArg)\n * @param Boolean thisArg `this` context for callback function\n * @return Void\n */\n\tforEach(callback) {\n\t\tlet thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n\t\tlet pairs = getHeaders(this);\n\t\tlet i = 0;\n\t\twhile (i < pairs.length) {\n\t\t\tvar _pairs$i = pairs[i];\n\t\t\tconst name = _pairs$i[0],\n\t\t\t value = _pairs$i[1];\n\n\t\t\tcallback.call(thisArg, value, name, this);\n\t\t\tpairs = getHeaders(this);\n\t\t\ti++;\n\t\t}\n\t}\n\n\t/**\n * Overwrite header values given name\n *\n * @param String name Header name\n * @param String value Header value\n * @return Void\n */\n\tset(name, value) {\n\t\tname = `${name}`;\n\t\tvalue = `${value}`;\n\t\tvalidateName(name);\n\t\tvalidateValue(value);\n\t\tconst key = find(this[MAP], name);\n\t\tthis[MAP][key !== undefined ? key : name] = [value];\n\t}\n\n\t/**\n * Append a value onto existing header\n *\n * @param String name Header name\n * @param String value Header value\n * @return Void\n */\n\tappend(name, value) {\n\t\tname = `${name}`;\n\t\tvalue = `${value}`;\n\t\tvalidateName(name);\n\t\tvalidateValue(value);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key !== undefined) {\n\t\t\tthis[MAP][key].push(value);\n\t\t} else {\n\t\t\tthis[MAP][name] = [value];\n\t\t}\n\t}\n\n\t/**\n * Check for header name existence\n *\n * @param String name Header name\n * @return Boolean\n */\n\thas(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\treturn find(this[MAP], name) !== undefined;\n\t}\n\n\t/**\n * Delete all header values given name\n *\n * @param String name Header name\n * @return Void\n */\n\tdelete(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key !== undefined) {\n\t\t\tdelete this[MAP][key];\n\t\t}\n\t}\n\n\t/**\n * Return raw headers (non-spec api)\n *\n * @return Object\n */\n\traw() {\n\t\treturn this[MAP];\n\t}\n\n\t/**\n * Get an iterator on keys.\n *\n * @return Iterator\n */\n\tkeys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}\n\n\t/**\n * Get an iterator on values.\n *\n * @return Iterator\n */\n\tvalues() {\n\t\treturn createHeadersIterator(this, 'value');\n\t}\n\n\t/**\n * Get an iterator on entries.\n *\n * This is the default iterator of the Headers object.\n *\n * @return Iterator\n */\n\t[Symbol.iterator]() {\n\t\treturn createHeadersIterator(this, 'key+value');\n\t}\n}\nHeaders.prototype.entries = Headers.prototype[Symbol.iterator];\n\nObject.defineProperty(Headers.prototype, Symbol.toStringTag, {\n\tvalue: 'Headers',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nObject.defineProperties(Headers.prototype, {\n\tget: { enumerable: true },\n\tforEach: { enumerable: true },\n\tset: { enumerable: true },\n\tappend: { enumerable: true },\n\thas: { enumerable: true },\n\tdelete: { enumerable: true },\n\tkeys: { enumerable: true },\n\tvalues: { enumerable: true },\n\tentries: { enumerable: true }\n});\n\nfunction getHeaders(headers) {\n\tlet kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';\n\n\tconst keys = Object.keys(headers[MAP]).sort();\n\treturn keys.map(kind === 'key' ? function (k) {\n\t\treturn k.toLowerCase();\n\t} : kind === 'value' ? function (k) {\n\t\treturn headers[MAP][k].join(', ');\n\t} : function (k) {\n\t\treturn [k.toLowerCase(), headers[MAP][k].join(', ')];\n\t});\n}\n\nconst INTERNAL = Symbol('internal');\n\nfunction createHeadersIterator(target, kind) {\n\tconst iterator = Object.create(HeadersIteratorPrototype);\n\titerator[INTERNAL] = {\n\t\ttarget,\n\t\tkind,\n\t\tindex: 0\n\t};\n\treturn iterator;\n}\n\nconst HeadersIteratorPrototype = Object.setPrototypeOf({\n\tnext() {\n\t\t// istanbul ignore if\n\t\tif (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {\n\t\t\tthrow new TypeError('Value of `this` is not a HeadersIterator');\n\t\t}\n\n\t\tvar _INTERNAL = this[INTERNAL];\n\t\tconst target = _INTERNAL.target,\n\t\t kind = _INTERNAL.kind,\n\t\t index = _INTERNAL.index;\n\n\t\tconst values = getHeaders(target, kind);\n\t\tconst len = values.length;\n\t\tif (index >= len) {\n\t\t\treturn {\n\t\t\t\tvalue: undefined,\n\t\t\t\tdone: true\n\t\t\t};\n\t\t}\n\n\t\tthis[INTERNAL].index = index + 1;\n\n\t\treturn {\n\t\t\tvalue: values[index],\n\t\t\tdone: false\n\t\t};\n\t}\n}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));\n\nObject.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {\n\tvalue: 'HeadersIterator',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\n/**\n * Export the Headers object in a form that Node.js can consume.\n *\n * @param Headers headers\n * @return Object\n */\nfunction exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}\n\n/**\n * Create a Headers object from an object of headers, ignoring those that do\n * not conform to HTTP grammar productions.\n *\n * @param Object obj Object of headers\n * @return Headers\n */\nfunction createHeadersLenient(obj) {\n\tconst headers = new Headers();\n\tfor (const name of Object.keys(obj)) {\n\t\tif (invalidTokenRegex.test(name)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(obj[name])) {\n\t\t\tfor (const val of obj[name]) {\n\t\t\t\tif (invalidHeaderCharRegex.test(val)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (headers[MAP][name] === undefined) {\n\t\t\t\t\theaders[MAP][name] = [val];\n\t\t\t\t} else {\n\t\t\t\t\theaders[MAP][name].push(val);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!invalidHeaderCharRegex.test(obj[name])) {\n\t\t\theaders[MAP][name] = [obj[name]];\n\t\t}\n\t}\n\treturn headers;\n}\n\nconst INTERNALS$1 = Symbol('Response internals');\n\n// fix an issue where \"STATUS_CODES\" aren't a named export for node <10\nconst STATUS_CODES = http.STATUS_CODES;\n\n/**\n * Response class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nclass Response {\n\tconstructor() {\n\t\tlet body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\t\tlet opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\t\tBody.call(this, body, opts);\n\n\t\tconst status = opts.status || 200;\n\t\tconst headers = new Headers(opts.headers);\n\n\t\tif (body != null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS$1] = {\n\t\t\turl: opts.url,\n\t\t\tstatus,\n\t\t\tstatusText: opts.statusText || STATUS_CODES[status],\n\t\t\theaders,\n\t\t\tcounter: opts.counter\n\t\t};\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS$1].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS$1].status;\n\t}\n\n\t/**\n * Convenience property representing if the request ended normally\n */\n\tget ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS$1].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS$1].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS$1].headers;\n\t}\n\n\t/**\n * Clone this response\n *\n * @return Response\n */\n\tclone() {\n\t\treturn new Response(clone(this), {\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected\n\t\t});\n\t}\n}\n\nBody.mixIn(Response.prototype);\n\nObject.defineProperties(Response.prototype, {\n\turl: { enumerable: true },\n\tstatus: { enumerable: true },\n\tok: { enumerable: true },\n\tredirected: { enumerable: true },\n\tstatusText: { enumerable: true },\n\theaders: { enumerable: true },\n\tclone: { enumerable: true }\n});\n\nObject.defineProperty(Response.prototype, Symbol.toStringTag, {\n\tvalue: 'Response',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nconst INTERNALS$2 = Symbol('Request internals');\n\n// fix an issue where \"format\", \"parse\" aren't a named export for node <10\nconst parse_url = Url.parse;\nconst format_url = Url.format;\n\nconst streamDestructionSupported = 'destroy' in Stream.Readable.prototype;\n\n/**\n * Check if a value is an instance of Request.\n *\n * @param Mixed input\n * @return Boolean\n */\nfunction isRequest(input) {\n\treturn typeof input === 'object' && typeof input[INTERNALS$2] === 'object';\n}\n\nfunction isAbortSignal(signal) {\n\tconst proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);\n\treturn !!(proto && proto.constructor.name === 'AbortSignal');\n}\n\n/**\n * Request class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nclass Request {\n\tconstructor(input) {\n\t\tlet init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\t\tlet parsedURL;\n\n\t\t// normalize input\n\t\tif (!isRequest(input)) {\n\t\t\tif (input && input.href) {\n\t\t\t\t// in order to support Node.js' Url objects; though WHATWG's URL objects\n\t\t\t\t// will fall into this branch also (since their `toString()` will return\n\t\t\t\t// `href` property anyway)\n\t\t\t\tparsedURL = parse_url(input.href);\n\t\t\t} else {\n\t\t\t\t// coerce input to a string before attempting to parse\n\t\t\t\tparsedURL = parse_url(`${input}`);\n\t\t\t}\n\t\t\tinput = {};\n\t\t} else {\n\t\t\tparsedURL = parse_url(input.url);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tmethod = method.toUpperCase();\n\n\t\tif ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tlet inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;\n\n\t\tBody.call(this, inputBody, {\n\t\t\ttimeout: init.timeout || input.timeout || 0,\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody != null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ? input.signal : null;\n\t\tif ('signal' in init) signal = init.signal;\n\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal');\n\t\t}\n\n\t\tthis[INTERNALS$2] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal\n\t\t};\n\n\t\t// node-fetch-only options\n\t\tthis.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;\n\t\tthis.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t}\n\n\tget method() {\n\t\treturn this[INTERNALS$2].method;\n\t}\n\n\tget url() {\n\t\treturn format_url(this[INTERNALS$2].parsedURL);\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS$2].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS$2].redirect;\n\t}\n\n\tget signal() {\n\t\treturn this[INTERNALS$2].signal;\n\t}\n\n\t/**\n * Clone this request\n *\n * @return Request\n */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n}\n\nBody.mixIn(Request.prototype);\n\nObject.defineProperty(Request.prototype, Symbol.toStringTag, {\n\tvalue: 'Request',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nObject.defineProperties(Request.prototype, {\n\tmethod: { enumerable: true },\n\turl: { enumerable: true },\n\theaders: { enumerable: true },\n\tredirect: { enumerable: true },\n\tclone: { enumerable: true },\n\tsignal: { enumerable: true }\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param Request A Request instance\n * @return Object The options object to be passed to http.request\n */\nfunction getNodeRequestOptions(request) {\n\tconst parsedURL = request[INTERNALS$2].parsedURL;\n\tconst headers = new Headers(request[INTERNALS$2].headers);\n\n\t// fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// Basic fetch\n\tif (!parsedURL.protocol || !parsedURL.hostname) {\n\t\tthrow new TypeError('Only absolute URLs are supported');\n\t}\n\n\tif (!/^https?:$/.test(parsedURL.protocol)) {\n\t\tthrow new TypeError('Only HTTP(S) protocols are supported');\n\t}\n\n\tif (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) {\n\t\tthrow new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body == null && /^(POST|PUT)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\tif (request.body != null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\tif (typeof totalBytes === 'number') {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip,deflate');\n\t}\n\n\tlet agent = request.agent;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\tif (!headers.has('Connection') && !agent) {\n\t\theaders.set('Connection', 'close');\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\treturn Object.assign({}, parsedURL, {\n\t\tmethod: request.method,\n\t\theaders: exportNodeCompatibleHeaders(headers),\n\t\tagent\n\t});\n}\n\n/**\n * abort-error.js\n *\n * AbortError interface for cancelled requests\n */\n\n/**\n * Create AbortError instance\n *\n * @param String message Error message for human\n * @return AbortError\n */\nfunction AbortError(message) {\n Error.call(this, message);\n\n this.type = 'aborted';\n this.message = message;\n\n // hide custom error implementation details from end-users\n Error.captureStackTrace(this, this.constructor);\n}\n\nAbortError.prototype = Object.create(Error.prototype);\nAbortError.prototype.constructor = AbortError;\nAbortError.prototype.name = 'AbortError';\n\n// fix an issue where \"PassThrough\", \"resolve\" aren't a named export for node <10\nconst PassThrough$1 = Stream.PassThrough;\nconst resolve_url = Url.resolve;\n\n/**\n * Fetch function\n *\n * @param Mixed url Absolute url or Request instance\n * @param Object opts Fetch options\n * @return Promise\n */\nfunction fetch(url, opts) {\n\n\t// allow custom promise\n\tif (!fetch.Promise) {\n\t\tthrow new Error('native promise missing, set fetch.Promise to your favorite alternative');\n\t}\n\n\tBody.Promise = fetch.Promise;\n\n\t// wrap http.request into fetch\n\treturn new fetch.Promise(function (resolve, reject) {\n\t\t// build request object\n\t\tconst request = new Request(url, opts);\n\t\tconst options = getNodeRequestOptions(request);\n\n\t\tconst send = (options.protocol === 'https:' ? https : http).request;\n\t\tconst signal = request.signal;\n\n\t\tlet response = null;\n\n\t\tconst abort = function abort() {\n\t\t\tlet error = new AbortError('The user aborted a request.');\n\t\t\treject(error);\n\t\t\tif (request.body && request.body instanceof Stream.Readable) {\n\t\t\t\trequest.body.destroy(error);\n\t\t\t}\n\t\t\tif (!response || !response.body) return;\n\t\t\tresponse.body.emit('error', error);\n\t\t};\n\n\t\tif (signal && signal.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\n\t\tconst abortAndFinalize = function abortAndFinalize() {\n\t\t\tabort();\n\t\t\tfinalize();\n\t\t};\n\n\t\t// send request\n\t\tconst req = send(options);\n\t\tlet reqTimeout;\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', abortAndFinalize);\n\t\t}\n\n\t\tfunction finalize() {\n\t\t\treq.abort();\n\t\t\tif (signal) signal.removeEventListener('abort', abortAndFinalize);\n\t\t\tclearTimeout(reqTimeout);\n\t\t}\n\n\t\tif (request.timeout) {\n\t\t\treq.once('socket', function (socket) {\n\t\t\t\treqTimeout = setTimeout(function () {\n\t\t\t\t\treject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));\n\t\t\t\t\tfinalize();\n\t\t\t\t}, request.timeout);\n\t\t\t});\n\t\t}\n\n\t\treq.on('error', function (err) {\n\t\t\treject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));\n\t\t\tfinalize();\n\t\t});\n\n\t\treq.on('response', function (res) {\n\t\t\tclearTimeout(reqTimeout);\n\n\t\t\tconst headers = createHeadersLenient(res.headers);\n\n\t\t\t// HTTP fetch step 5\n\t\t\tif (fetch.isRedirect(res.statusCode)) {\n\t\t\t\t// HTTP fetch step 5.2\n\t\t\t\tconst location = headers.get('Location');\n\n\t\t\t\t// HTTP fetch step 5.3\n\t\t\t\tconst locationURL = location === null ? null : resolve_url(request.url, location);\n\n\t\t\t\t// HTTP fetch step 5.5\n\t\t\t\tswitch (request.redirect) {\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase 'manual':\n\t\t\t\t\t\t// node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.\n\t\t\t\t\t\tif (locationURL !== null) {\n\t\t\t\t\t\t\t// handle corrupted header\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\theaders.set('Location', locationURL);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t// istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request\n\t\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'follow':\n\t\t\t\t\t\t// HTTP-redirect fetch step 2\n\t\t\t\t\t\tif (locationURL === null) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 5\n\t\t\t\t\t\tif (request.counter >= request.follow) {\n\t\t\t\t\t\t\treject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 6 (counter increment)\n\t\t\t\t\t\t// Create a new Request object.\n\t\t\t\t\t\tconst requestOpts = {\n\t\t\t\t\t\t\theaders: new Headers(request.headers),\n\t\t\t\t\t\t\tfollow: request.follow,\n\t\t\t\t\t\t\tcounter: request.counter + 1,\n\t\t\t\t\t\t\tagent: request.agent,\n\t\t\t\t\t\t\tcompress: request.compress,\n\t\t\t\t\t\t\tmethod: request.method,\n\t\t\t\t\t\t\tbody: request.body,\n\t\t\t\t\t\t\tsignal: request.signal,\n\t\t\t\t\t\t\ttimeout: request.timeout,\n\t\t\t\t\t\t\tsize: request.size\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 9\n\t\t\t\t\t\tif (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {\n\t\t\t\t\t\t\treject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 11\n\t\t\t\t\t\tif (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {\n\t\t\t\t\t\t\trequestOpts.method = 'GET';\n\t\t\t\t\t\t\trequestOpts.body = undefined;\n\t\t\t\t\t\t\trequestOpts.headers.delete('content-length');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 15\n\t\t\t\t\t\tresolve(fetch(new Request(locationURL, requestOpts)));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// prepare response\n\t\t\tres.once('end', function () {\n\t\t\t\tif (signal) signal.removeEventListener('abort', abortAndFinalize);\n\t\t\t});\n\t\t\tlet body = res.pipe(new PassThrough$1());\n\n\t\t\tconst response_options = {\n\t\t\t\turl: request.url,\n\t\t\t\tstatus: res.statusCode,\n\t\t\t\tstatusText: res.statusMessage,\n\t\t\t\theaders: headers,\n\t\t\t\tsize: request.size,\n\t\t\t\ttimeout: request.timeout,\n\t\t\t\tcounter: request.counter\n\t\t\t};\n\n\t\t\t// HTTP-network fetch step 12.1.1.3\n\t\t\tconst codings = headers.get('Content-Encoding');\n\n\t\t\t// HTTP-network fetch step 12.1.1.4: handle content codings\n\n\t\t\t// in following scenarios we ignore compression support\n\t\t\t// 1. compression support is disabled\n\t\t\t// 2. HEAD request\n\t\t\t// 3. no Content-Encoding header\n\t\t\t// 4. no content response (204)\n\t\t\t// 5. content not modified response (304)\n\t\t\tif (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For Node v6+\n\t\t\t// Be less strict when decoding compressed responses, since sometimes\n\t\t\t// servers send slightly invalid responses that are still accepted\n\t\t\t// by common browsers.\n\t\t\t// Always using Z_SYNC_FLUSH is what cURL does.\n\t\t\tconst zlibOptions = {\n\t\t\t\tflush: zlib.Z_SYNC_FLUSH,\n\t\t\t\tfinishFlush: zlib.Z_SYNC_FLUSH\n\t\t\t};\n\n\t\t\t// for gzip\n\t\t\tif (codings == 'gzip' || codings == 'x-gzip') {\n\t\t\t\tbody = body.pipe(zlib.createGunzip(zlibOptions));\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// for deflate\n\t\t\tif (codings == 'deflate' || codings == 'x-deflate') {\n\t\t\t\t// handle the infamous raw deflate response from old servers\n\t\t\t\t// a hack for old IIS and Apache servers\n\t\t\t\tconst raw = res.pipe(new PassThrough$1());\n\t\t\t\traw.once('data', function (chunk) {\n\t\t\t\t\t// see http://stackoverflow.com/questions/37519828\n\t\t\t\t\tif ((chunk[0] & 0x0F) === 0x08) {\n\t\t\t\t\t\tbody = body.pipe(zlib.createInflate());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbody = body.pipe(zlib.createInflateRaw());\n\t\t\t\t\t}\n\t\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\t\tresolve(response);\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// for br\n\t\t\tif (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') {\n\t\t\t\tbody = body.pipe(zlib.createBrotliDecompress());\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// otherwise, use response as-is\n\t\t\tresponse = new Response(body, response_options);\n\t\t\tresolve(response);\n\t\t});\n\n\t\twriteToStream(req, request);\n\t});\n}\n/**\n * Redirect code matching\n *\n * @param Number code Status code\n * @return Boolean\n */\nfetch.isRedirect = function (code) {\n\treturn code === 301 || code === 302 || code === 303 || code === 307 || code === 308;\n};\n\n// expose Promise\nfetch.Promise = global.Promise;\n\nexport default fetch;\nexport { Headers, Request, Response, FetchError };\n","var nodeFetch = require('node-fetch')\nvar realFetch = nodeFetch.default || nodeFetch\n\nvar fetch = function (url, options) {\n // Support schemaless URIs on the server for parity with the browser.\n // Ex: //github.com/ -> https://github.com/\n if (/^\\/\\//.test(url)) {\n url = 'https:' + url\n }\n return realFetch.call(this, url, options)\n}\n\nmodule.exports = exports = fetch\nexports.fetch = fetch\nexports.Headers = nodeFetch.Headers\nexports.Request = nodeFetch.Request\nexports.Response = nodeFetch.Response\n\n// Needed for TypeScript consumers without esModuleInterop.\nexports.default = fetch\n","import fetch from \"cross-fetch\";\nimport JSBI from \"jsbi\";\n\nfunction mergeOptions(overrideOptions, defaultOptions) {\n defaultOptions = defaultOptions || {};\n const headers = Object.assign(\n {},\n defaultOptions.headers || {},\n overrideOptions.headers || {}\n );\n return Object.assign({}, defaultOptions, overrideOptions, {\n headers: headers\n });\n}\n\nconst batchHandler = {\n get: (target, method, receiver) => {\n if (method === \"send\") {\n return async () => {\n const response = await fetch(\n target.uri,\n mergeOptions(\n {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(target.payload)\n },\n target.defaultOptions\n )\n );\n return await response.json();\n };\n }\n return (...params) => {\n const id = target.id;\n target.id = target.id + 1;\n target.payload.push({\n jsonrpc: \"2.0\",\n id: id,\n method: method,\n params: params\n });\n return receiver;\n };\n }\n};\n\nconst handler = {\n get: (target, method) => {\n if (method === \"batch\") {\n return () => {\n return new Proxy(\n {\n id: Math.round(Math.random() * 10000000),\n payload: [],\n uri: target.uri,\n defaultOptions: target.defaultOptions\n },\n batchHandler\n );\n };\n }\n return async (...params) => {\n const id = Math.round(Math.random() * 10000000);\n const response = await fetch(\n target.uri,\n mergeOptions(\n {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: id,\n method: method,\n params: params\n })\n },\n target.defaultOptions\n )\n );\n const data = await response.json();\n if (data.id !== id) {\n throw new Error(\"JSONRPCError: response ID does not match request ID!\");\n }\n if (data.error) {\n throw new Error(\n `JSONRPCError: server error ${JSON.stringify(data.error)}`\n );\n }\n return data.result;\n };\n }\n};\n\nexport class RPC {\n constructor(uri, defaultOptions = {}) {\n this.uri = uri;\n this.defaultOptions = defaultOptions;\n return new Proxy(this, handler);\n }\n\n static create(uri) {\n return new RPC(uri);\n }\n}\n\nexport function HexStringToBigInt(hexString) {\n return JSBI.BigInt(hexString);\n}\n\nexport function BigIntToHexString(bigInt) {\n return \"0x\" + bigInt.toString(16);\n}\n","// This package provides normalizer functions. Even though CKB uses molecule\n// as the serialization layer. There is still CKB specific knowledge that does\n// not belong in molecule. For example, all numbers in CKB protocols are\n// serialized using little endian format. This package tries to encode such\n// knowledge. The goal here, is that you are free to use whatever types that\n// makes most sense to represent the values. As long as you pass your object\n// through the normalizers here, molecule should be able to serialize the values\n// into correct formats required by CKB.\n//\n// Note this is only used when you need to deal with CKB structures in molecule\n// format. If you are using RPCs or GraphQL to interact with CKB, chances are you\n// will not need this package.\nimport JSBI from \"jsbi\";\nimport { Reader } from \"./reader\";\nimport { BigIntToHexString } from \"./rpc\";\n\nfunction normalizeHexNumber(length) {\n return function(debugPath, value) {\n if (!(value instanceof ArrayBuffer)) {\n let intValue = BigIntToHexString(JSBI.BigInt(value)).substr(2);\n if (intValue.length % 2 !== 0) {\n intValue = \"0\" + intValue;\n }\n if (intValue.length / 2 > length) {\n throw new Error(\n `${debugPath} is ${intValue.length /\n 2} bytes long, expected length is ${length}!`\n );\n }\n const view = new DataView(new ArrayBuffer(length));\n for (let i = 0; i < intValue.length / 2; i++) {\n const start = intValue.length - (i + 1) * 2;\n view.setUint8(i, parseInt(intValue.substr(start, 2), 16));\n }\n value = view.buffer;\n }\n if (value.byteLength < length) {\n const array = new Uint8Array(length);\n array.set(new Uint8Array(value), 0);\n value = array.buffer;\n }\n return value;\n };\n}\n\nfunction normalizeRawData(length) {\n return function(debugPath, value) {\n value = new Reader(value).toArrayBuffer();\n if (length > 0 && value.byteLength !== length) {\n throw new Error(\n `${debugPath} has invalid length ${value.byteLength}, required: ${length}`\n );\n }\n return value;\n };\n}\n\nfunction normalizeObject(debugPath, object, keys) {\n const result = {};\n\n for (const [key, f] of Object.entries(keys)) {\n const value = object[key];\n if (!value) {\n throw new Error(`${debugPath} is missing ${key}!`);\n }\n result[key] = f(`${debugPath}.${key}`, value);\n }\n return result;\n}\n\nexport function NormalizeScript(script, { debugPath = \"script\" } = {}) {\n return normalizeObject(debugPath, script, {\n code_hash: normalizeRawData(32),\n hash_type: function(debugPath, value) {\n switch (value) {\n case \"data\":\n return 0;\n case \"type\":\n return 1;\n case \"data1\":\n return 2;\n case 0:\n return value;\n case 1:\n return value;\n case 2:\n return value;\n default:\n throw new Error(`${debugPath}.hash_type has invalid value: ${value}`);\n }\n },\n args: normalizeRawData(-1)\n });\n}\n\nexport function NormalizeOutPoint(outPoint, { debugPath = \"out_point\" } = {}) {\n return normalizeObject(debugPath, outPoint, {\n tx_hash: normalizeRawData(32),\n index: normalizeHexNumber(4)\n });\n}\n\nfunction toNormalize(normalize) {\n return function(debugPath, value) {\n return normalize(value, {\n debugPath\n });\n };\n}\n\nexport function NormalizeCellInput(\n cellInput,\n { debugPath = \"cell_input\" } = {}\n) {\n return normalizeObject(debugPath, cellInput, {\n since: normalizeHexNumber(8),\n previous_output: toNormalize(NormalizeOutPoint)\n });\n}\n\nexport function NormalizeCellOutput(\n cellOutput,\n { debugPath = \"cell_output\" } = {}\n) {\n const result = normalizeObject(debugPath, cellOutput, {\n capacity: normalizeHexNumber(8),\n lock: toNormalize(NormalizeScript)\n });\n if (cellOutput.type) {\n result.type_ = NormalizeScript(cellOutput.type, {\n debugPath: `${debugPath}.type`\n });\n }\n return result;\n}\n\nexport function NormalizeCellDep(cellDep, { debugPath = \"cell_dep\" } = {}) {\n return normalizeObject(debugPath, cellDep, {\n out_point: toNormalize(NormalizeOutPoint),\n dep_type: function(debugPath, value) {\n switch (value) {\n case \"code\":\n return 0;\n case \"dep_group\":\n return 1;\n case 0:\n return value;\n case 1:\n return value;\n default:\n throw new Error(`${debugPath}.dep_type has invalid value: ${value}`);\n }\n }\n });\n}\n\nfunction toNormalizeArray(normalizeFunction) {\n return function(debugPath, array) {\n return array.map((item, i) => {\n return normalizeFunction(`${debugPath}[${i}]`, item);\n });\n };\n}\n\nexport function NormalizeRawTransaction(\n rawTransaction,\n { debugPath = \"raw_transaction\" } = {}\n) {\n return normalizeObject(debugPath, rawTransaction, {\n version: normalizeHexNumber(4),\n cell_deps: toNormalizeArray(toNormalize(NormalizeCellDep)),\n header_deps: toNormalizeArray(normalizeRawData(32)),\n inputs: toNormalizeArray(toNormalize(NormalizeCellInput)),\n outputs: toNormalizeArray(toNormalize(NormalizeCellOutput)),\n outputs_data: toNormalizeArray(normalizeRawData(-1))\n });\n}\n\nexport function NormalizeTransaction(\n transaction,\n { debugPath = \"transaction\" } = {}\n) {\n const rawTransaction = NormalizeRawTransaction(transaction, {\n debugPath: `(raw)${debugPath}`\n });\n const result = normalizeObject(debugPath, transaction, {\n witnesses: toNormalizeArray(normalizeRawData(-1))\n });\n result.raw = rawTransaction;\n return result;\n}\n\nexport function NormalizeRawHeader(\n rawHeader,\n { debugPath = \"raw_header\" } = {}\n) {\n return normalizeObject(debugPath, rawHeader, {\n version: normalizeHexNumber(4),\n compact_target: normalizeHexNumber(4),\n timestamp: normalizeHexNumber(8),\n number: normalizeHexNumber(8),\n epoch: normalizeHexNumber(8),\n parent_hash: normalizeRawData(32),\n transactions_root: normalizeRawData(32),\n proposals_hash: normalizeRawData(32),\n uncles_hash: normalizeRawData(32),\n dao: normalizeRawData(32)\n });\n}\n\nexport function NormalizeHeader(header, { debugPath = \"header\" } = {}) {\n const rawHeader = NormalizeRawHeader(header, {\n debugPath: `(raw)${debugPath}`\n });\n const result = normalizeObject(debugPath, header, {\n nonce: normalizeHexNumber(16)\n });\n result.raw = rawHeader;\n return result;\n}\n\nexport function NormalizeUncleBlock(\n uncleBlock,\n { debugPath = \"uncle_block\" } = {}\n) {\n return normalizeObject(debugPath, uncleBlock, {\n header: toNormalize(NormalizeHeader),\n proposals: toNormalizeArray(normalizeRawData(10))\n });\n}\n\nexport function NormalizeBlock(block, { debugPath = \"block\" } = {}) {\n return normalizeObject(debugPath, block, {\n header: toNormalize(NormalizeHeader),\n uncles: toNormalizeArray(toNormalize(NormalizeUncleBlock)),\n transactions: toNormalizeArray(toNormalize(NormalizeTransaction)),\n proposals: toNormalizeArray(normalizeRawData(10))\n });\n}\n\nexport function NormalizeCellbaseWitness(\n cellbaseWitness,\n { debugPath = \"cellbase_witness\" } = {}\n) {\n return normalizeObject(debugPath, cellbaseWitness, {\n lock: toNormalize(NormalizeScript),\n message: normalizeRawData(-1)\n });\n}\n\nexport function NormalizeWitnessArgs(\n witnessArgs,\n { debugPath = \"witness_args\" } = {}\n) {\n const result = {};\n if (witnessArgs.lock) {\n result.lock = normalizeRawData(-1)(`${debugPath}.lock`, witnessArgs.lock);\n }\n if (witnessArgs.input_type) {\n result.input_type = normalizeRawData(-1)(\n `${debugPath}.input_type`,\n witnessArgs.input_type\n );\n }\n if (witnessArgs.output_type) {\n result.output_type = normalizeRawData(-1)(\n `${debugPath}.output_type`,\n witnessArgs.output_type\n );\n }\n return result;\n}\n","// This package provides transformer functions that transform JavaScript objects\n// into JSON ready objects that can be passed to RPC. It following the following\n// rules:\n//\n// 1. If the specified object has a serializeJson method, it would invoke this\n// method and use the result to replace current object.\n// 2. It then restricts the keys of the object to keys required by the specified\n// entity(i.e., a Script would only have code_hash, hash_type, args keys),for each\n// sub-field, it then recursively perform the steps here from step 1.\n// 3. It then optionally run validator functions to ensure the resulting object\n// follows specified rules.\n//\n// Note rule 1 here provides the flexibility in defining your own structures: you\n// could define a class containing custom data structures, then provide a\n// serializeJson that transforms the custom one into the rigid data structure\n// required by CKB. You can also leverage the Reader class we provide as much as\n// possible. Since Reader class does provide serializeJson methods, transformers\n// here will transform them to valid hex strings required by CKB.\nimport * as validators from \"./validators\";\n\nfunction invokeSerializeJson(debugPath, value) {\n if (value instanceof Object && value.serializeJson instanceof Function) {\n return value.serializeJson.call(value);\n }\n return value;\n}\n\nfunction transformObject(debugPath, object, keys) {\n object = invokeSerializeJson(debugPath, object);\n if (!(object instanceof Object)) {\n throw new Error(`Transformed ${debugPath} is not an object!`);\n }\n const result = {};\n\n for (const [key, f] of Object.entries(keys)) {\n let value = object[key];\n if (!value) {\n const camelKey = key.replace(/(_[a-z])/g, group =>\n group.toUpperCase().replace(\"_\", \"\")\n );\n value = object[camelKey];\n }\n if (value) {\n result[key] = f(`${debugPath}.${key}`, value);\n }\n }\n return result;\n}\n\nexport function TransformScript(\n script,\n { validation = true, debugPath = \"script\" } = {}\n) {\n script = transformObject(debugPath, script, {\n code_hash: invokeSerializeJson,\n hash_type: invokeSerializeJson,\n args: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateScript(script, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return script;\n}\n\nexport function TransformOutPoint(\n outPoint,\n { validation = true, debugPath = \"out_point\" } = {}\n) {\n outPoint = transformObject(debugPath, outPoint, {\n tx_hash: invokeSerializeJson,\n index: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateOutPoint(outPoint, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return outPoint;\n}\n\nfunction toInvoke(transform) {\n return function(debugPath, value) {\n return transform(value, {\n validation: false,\n debugPath\n });\n };\n}\n\nexport function TransformCellInput(\n cellInput,\n { validation = true, debugPath = \"cell_input\" } = {}\n) {\n cellInput = transformObject(debugPath, cellInput, {\n since: invokeSerializeJson,\n previous_output: toInvoke(TransformOutPoint)\n });\n\n if (validation) {\n validators.ValidateCellInput(cellInput, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellInput;\n}\n\nexport function TransformCellOutput(\n cellOutput,\n { validation = true, debugPath = \"cell_output\" } = {}\n) {\n cellOutput = transformObject(debugPath, cellOutput, {\n capacity: invokeSerializeJson,\n lock: toInvoke(TransformScript),\n type: toInvoke(TransformScript)\n });\n\n if (validation) {\n validators.ValidateCellOutput(cellOutput, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellOutput;\n}\n\nexport function TransformCellDep(\n cellDep,\n { validation = true, debugPath = \"cell_dep\" } = {}\n) {\n cellDep = transformObject(debugPath, cellDep, {\n out_point: toInvoke(TransformOutPoint),\n dep_type: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateCellDep(cellDep, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellDep;\n}\n\nfunction toInvokeArray(invokeFunction) {\n return function(debugPath, array) {\n return array.map((item, i) => {\n return invokeFunction(`${debugPath}[${i}]`, item);\n });\n };\n}\n\nexport function TransformRawTransaction(\n rawTransaction,\n { validation = true, debugPath = \"raw_transaction\" } = {}\n) {\n rawTransaction = transformObject(debugPath, rawTransaction, {\n version: invokeSerializeJson,\n cell_deps: toInvokeArray(toInvoke(TransformCellDep)),\n header_deps: toInvokeArray(invokeSerializeJson),\n inputs: toInvokeArray(toInvoke(TransformCellInput)),\n outputs: toInvokeArray(toInvoke(TransformCellOutput)),\n outputs_data: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateRawTransaction(rawTransaction, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return rawTransaction;\n}\n\nexport function TransformTransaction(\n transaction,\n { validation = true, debugPath = \"transaction\" } = {}\n) {\n transaction = transformObject(debugPath, transaction, {\n version: invokeSerializeJson,\n cell_deps: toInvokeArray(toInvoke(TransformCellDep)),\n header_deps: toInvokeArray(invokeSerializeJson),\n inputs: toInvokeArray(toInvoke(TransformCellInput)),\n outputs: toInvokeArray(toInvoke(TransformCellOutput)),\n outputs_data: toInvokeArray(invokeSerializeJson),\n witnesses: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateTransaction(transaction, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return transaction;\n}\n\nexport function TransformRawHeader(\n rawHeader,\n { validation = true, debugPath = \"raw_header\" } = {}\n) {\n rawHeader = transformObject(debugPath, rawHeader, {\n version: invokeSerializeJson,\n compact_target: invokeSerializeJson,\n timestamp: invokeSerializeJson,\n number: invokeSerializeJson,\n epoch: invokeSerializeJson,\n parent_hash: invokeSerializeJson,\n transactions_root: invokeSerializeJson,\n proposals_hash: invokeSerializeJson,\n uncles_hash: invokeSerializeJson,\n dao: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateRawHeader(rawHeader, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return rawHeader;\n}\n\nexport function TransformHeader(\n header,\n { validation = true, debugPath = \"header\" } = {}\n) {\n header = transformObject(debugPath, header, {\n version: invokeSerializeJson,\n compact_target: invokeSerializeJson,\n timestamp: invokeSerializeJson,\n number: invokeSerializeJson,\n epoch: invokeSerializeJson,\n parent_hash: invokeSerializeJson,\n transactions_root: invokeSerializeJson,\n proposals_hash: invokeSerializeJson,\n uncles_hash: invokeSerializeJson,\n dao: invokeSerializeJson,\n nonce: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateHeader(header, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return header;\n}\n\nexport function TransformUncleBlock(\n uncleBlock,\n { validation = true, debugPath = \"uncle_block\" } = {}\n) {\n uncleBlock = transformObject(debugPath, uncleBlock, {\n header: toInvoke(TransformHeader),\n proposals: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateUncleBlock(uncleBlock, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return uncleBlock;\n}\n\nexport function TransformBlock(\n block,\n { validation = true, debugPath = \"block\" } = {}\n) {\n block = transformObject(debugPath, block, {\n header: toInvoke(TransformHeader),\n uncles: toInvokeArray(toInvoke(TransformUncleBlock)),\n transactions: toInvokeArray(toInvoke(TransformTransaction)),\n proposals: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateBlock(block, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return block;\n}\n\nexport function TransformCellbaseWitness(\n cellbaseWitness,\n { validation = true, debugPath = \"cellbase_witness\" } = {}\n) {\n cellbaseWitness = transformObject(debugPath, cellbaseWitness, {\n lock: toInvoke(TransformScript),\n message: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateCellbaseWitness(cellbaseWitness, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellbaseWitness;\n}\n\nexport function TransformWitnessArgs(\n witnessArgs,\n { validation = true, debugPath = \"witness_args\" } = {}\n) {\n witnessArgs = transformObject(debugPath, witnessArgs, {\n lock: invokeSerializeJson,\n input_type: invokeSerializeJson,\n output_type: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateWitnessArgs(witnessArgs, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return witnessArgs;\n}\n","import JSBI from \"jsbi\";\nimport { Reader } from \"../reader\";\nimport { HexStringToBigInt, BigIntToHexString } from \"../rpc\";\n\nexport class RPCCollector {\n constructor(\n rpc,\n lockHash,\n {\n skipCellWithContent = true,\n loadData = false,\n loadBlockNumber = true\n } = {}\n ) {\n this.rpc = rpc;\n this.lockHash = new Reader(lockHash).serializeJson();\n this.skipCellWithContent = skipCellWithContent;\n this.loadData = loadData;\n this.loadBlockNumber = loadBlockNumber;\n }\n\n async *collect() {\n const to = HexStringToBigInt(await this.rpc.get_tip_block_number());\n let currentFrom = JSBI.BigInt(0);\n while (JSBI.lessThanOrEqual(currentFrom, to)) {\n let currentTo = JSBI.add(currentFrom, JSBI.BigInt(100));\n if (JSBI.greaterThan(currentTo, to)) {\n currentTo = to;\n }\n const cells = await this.rpc.get_cells_by_lock_hash(\n this.lockHash,\n BigIntToHexString(currentFrom),\n BigIntToHexString(currentTo)\n );\n for (const cell of cells) {\n if (this.skipCellWithContent) {\n if (\n cell.type ||\n JSBI.greaterThan(\n HexStringToBigInt(cell.output_data_len),\n JSBI.BigInt(100)\n )\n ) {\n continue;\n }\n }\n let data = null;\n if (this.loadData) {\n const cellWithData = await this.rpc.get_live_cell(\n cell.out_point,\n true\n );\n data = cellWithData.cell.data.content;\n }\n let block_number = null;\n if (this.loadBlockNumber) {\n const header = await this.rpc.get_header(cell.block_hash);\n block_number = header.number;\n }\n yield {\n cellbase: cell.cellbase,\n cell_output: {\n capacity: cell.capacity,\n lock: cell.lock,\n type: cell.type\n },\n out_point: cell.out_point,\n block_hash: cell.block_hash,\n data: data,\n output_data_len: cell.output_data_len,\n block_number\n };\n }\n currentFrom = JSBI.add(currentTo, JSBI.BigInt(1));\n }\n }\n}\n","import JSBI from \"jsbi\";\nimport { Reader } from \"./reader\";\nimport { ValidateTransaction, ValidateOutPoint } from \"./validators\";\n\nexport class TransactionDumper {\n constructor(\n rpc,\n { validateTransaction = true, depGroupUnpacker = null } = {}\n ) {\n this.rpc = rpc;\n this.validateTransaction = validateTransaction;\n this.depGroupUnpacker = depGroupUnpacker;\n }\n\n async dumpByHash(txHash) {\n const tx = (await this.rpc.get_transaction(txHash)).transaction;\n delete tx.hash;\n return await this.dump(tx);\n }\n\n async dump(tx) {\n if (this.validateTransaction) {\n ValidateTransaction(tx);\n }\n const mockInputs = [];\n for (const input of tx.inputs) {\n const { output, data, header } = await this._resolveOutPoint(\n input.previous_output\n );\n mockInputs.push({ input, output, data, header });\n }\n const mockCellDeps = [];\n for (const cellDep of tx.cell_deps) {\n const { output, data, header } = await this._resolveOutPoint(\n cellDep.out_point\n );\n mockCellDeps.push({\n cell_dep: cellDep,\n output,\n data,\n header\n });\n if (cellDep.dep_type === \"dep_group\") {\n if (!this.depGroupUnpacker) {\n throw new Error(\n \"depGroupUnpacker must be provided when the transaction contains dep_group!\"\n );\n }\n const outPoints = this.depGroupUnpacker(new Reader(data));\n for (const outPoint of outPoints) {\n ValidateOutPoint(outPoint);\n const { output, data, header } = await this._resolveOutPoint(\n outPoint\n );\n mockCellDeps.push({\n cell_dep: {\n out_point: outPoint,\n dep_type: \"code\"\n },\n output,\n data,\n header\n });\n }\n }\n }\n const mockHeaderDeps = [];\n for (const headerDep of tx.header_deps) {\n mockHeaderDeps.push(await this.rpc.get_header(headerDep));\n }\n return JSON.stringify({\n mock_info: {\n inputs: mockInputs,\n cell_deps: mockCellDeps,\n header_deps: mockHeaderDeps\n },\n tx\n });\n }\n\n async _resolveOutPoint(out_point) {\n const txStatus = await this.rpc.get_transaction(out_point.tx_hash);\n if (!txStatus || !txStatus.transaction) {\n throw new Error(`Transaction ${out_point.tx_hash} cannot be found!`);\n }\n const tx = txStatus.transaction;\n const index = JSBI.toNumber(JSBI.BigInt(out_point.index));\n if (index >= tx.outputs.length) {\n throw new Error(\n `Transaction ${out_point.tx_hash} does not have output ${index}!`\n );\n }\n const data = {\n output: tx.outputs[index],\n data: tx.outputs_data[index]\n };\n if (txStatus.tx_status.status === \"committed\") {\n data.header = txStatus.tx_status.block_hash;\n }\n return data;\n }\n}\n","export { Reader } from \"./reader.js\";\nexport { TransactionDumper } from \"./transaction_dumper.js\";\nexport { RPC, HexStringToBigInt, BigIntToHexString } from \"./rpc.js\";\nexport * as normalizers from \"./normalizers\";\nexport * as transformers from \"./transformers\";\nexport * as validators from \"./validators\";\nexport * as cell_collectors from \"./cell_collectors\";\nexport const VERSION = \"__development_build__\";\n"],"names":["ArrayBufferReader","[object Object]","buffer","this","view","DataView","byteLength","i","getUint8","Array","prototype","map","call","Uint8Array","x","toString","slice","join","HexStringReader","string","length","parseInt","substr","ArrayBuffer","setUint8","indexAt","Reader","input","startsWith","Error","c","charCodeAt","JSBI","a","b","__kMaxLength","RangeError","super","sign","Math","floor","Number","isFinite","__zero","__oneDigit","__fromDouble","__fromString","SyntaxError","constructor","__toPrimitive","BigInt","TypeError","push","__toStringBasePowerOfTwo","__toStringGeneric","clz32","__unsignedDigit","d","__digit","e","f","Infinity","g","h","j","k","l","m","n","o","__decideRounding","p","__kBitConversionInts","__kBitConversionDouble","__copy","__absoluteSubOne","__trim","__absoluteAddOne","unaryMinus","__kMaxLengthBits","__initializeDigits","__setDigit","multiply","__clzmsd","__multiplyAccumulate","__absoluteCompare","__absoluteDivSmall","__absoluteDivLarge","__absoluteModSmall","__absoluteAdd","__absoluteSub","__rightShiftByAbsolute","__leftShiftByAbsolute","__compareToBigInt","equal","max","__absoluteAnd","__absoluteOr","__absoluteAndNot","__absoluteXor","__truncateToNBits","__truncateAndSubFromPowerOfTwo","__toNumeric","__isBigInt","add","__compare","EQ","__equalToNumber","pop","__isWhitespace","__kMaxBitsPerChar","__kBitsPerCharTableMultiplier","__kBitsPerCharTableShift","__fillFromParts","q","__inplaceMultiplyAdd","__kConversionChars","exponentiate","__halfDigit","__setHalfDigit","quotient","remainder","__unequalSign","__absoluteGreater","__absoluteLess","abs","__compareToDouble","__comparisonResultToBool","__compareToNumber","__setDigitGrow","imul","r","s","t","__halfDigitLength","__clz16","__specialLeftShift","__internalMultiplyAdd","__inplaceSub","__inplaceAdd","__inplaceRightShift","__toShiftAmount","__rightShiftByMaximum","Symbol","toPrimitive","valueOf","min","assertObjectWithKeys","debugPath","object","expectedKeys","optionalKeys","Object","assertObject","providedKeys","keys","sort","requiredLength","maximalLength","errorMessage","optionalProvidedKeys","filter","key","includes","find","assertHexString","test","assertHash","hash","assertInteger","ValidateScript","script","nestedValidation","code_hash","args","hash_type","ValidateOutPoint","outPoint","tx_hash","index","ValidateCellInput","cellInput","since","previous_output","ValidateCellOutput","cellOutput","capacity","lock","type","ValidateCellDep","cellDep","dep_type","out_point","assertArray","array","validateFunction","isArray","toAssert","value","assertCommonTransaction","rawTransaction","version","cell_deps","header_deps","inputs","outputs","outputs_data","ValidateRawTransaction","ValidateTransaction","transaction","witnesses","ValidateRawHeader","rawHeader","compact_target","timestamp","number","epoch","parent_hash","transactions_root","proposals_hash","uncles_hash","dao","assertCommonHeader","ValidateHeader","header","nonce","assertProposalShortId","shortId","ValidateUncleBlock","uncleBlock","proposals","ValidateBlock","block","uncles","transactions","ValidateCellbaseWitness","cellbaseWitness","message","ValidateWitnessArgs","witnessArgs","input_type","output_type","__kBitConversionBuffer","Float64Array","Int32Array","Readable","Stream","BUFFER","TYPE","Blob","blobParts","arguments","options","buffers","size","element","Buffer","isView","from","byteOffset","String","concat","undefined","toLowerCase","Promise","resolve","buf","ab","readable","_read","start","end","relativeStart","relativeEnd","span","slicedBuffer","blob","FetchError","systemError","code","errno","captureStackTrace","convert","defineProperties","enumerable","defineProperty","toStringTag","writable","configurable","create","name","require","INTERNALS","PassThrough","Body","body","_this","_ref","_ref$size","_ref$timeout","timeout","isURLSearchParams","isBlob","isBuffer","disturbed","error","on","err","url","consumeBody","_this4","reject","alloc","stream","accum","accumBytes","abort","resTimeout","setTimeout","chunk","clearTimeout","obj","append","delete","get","getAll","has","set","arrayBuffer","clone","instance","p1","p2","bodyUsed","getBoundary","pipe","extractContentType","getTotalBytes","getLengthSync","_lengthRetrievers","hasKnownLength","then","ct","headers","assign","_this2","JSON","parse","_this3","res","str","charset","exec","convertBody","json","text","mixIn","proto","getOwnPropertyNames","desc","getOwnPropertyDescriptor","global","invalidTokenRegex","invalidHeaderCharRegex","validateName","validateValue","MAP","Headers","init","rawHeaders","raw","headerNames","headerName","method","iterator","pairs","pair","callback","thisArg","getHeaders","_pairs$i","createHeadersIterator","kind","entries","forEach","values","INTERNAL","target","HeadersIteratorPrototype","setPrototypeOf","getPrototypeOf","_INTERNAL","done","exportNodeCompatibleHeaders","__proto__","hostHeaderKey","INTERNALS$1","STATUS_CODES","http","Response","opts","status","contentType","statusText","counter","ok","redirected","INTERNALS$2","parse_url","Url","format_url","format","streamDestructionSupported","isRequest","Request","parsedURL","href","toUpperCase","inputBody","signal","isAbortSignal","redirect","follow","compress","agent","AbortError","PassThrough$1","resolve_url","fetch","request","protocol","hostname","contentLengthValue","totalBytes","getNodeRequestOptions","send","https","response","destroy","emit","aborted","abortAndFinalize","finalize","req","reqTimeout","removeEventListener","addEventListener","once","socket","val","createHeadersLenient","isRedirect","statusCode","location","locationURL","requestOpts","response_options","statusMessage","codings","zlibOptions","flush","zlib","Z_SYNC_FLUSH","finishFlush","createGunzip","createBrotliDecompress","createInflate","createInflateRaw","dest","write","writeToStream","realFetch","nodeFetch","default","module","exports","mergeOptions","overrideOptions","defaultOptions","batchHandler","receiver","async","uri","Content-Type","stringify","payload","params","id","jsonrpc","handler","Proxy","round","random","data","result","RPC","HexStringToBigInt","hexString","BigIntToHexString","bigInt","normalizeHexNumber","intValue","normalizeRawData","toArrayBuffer","normalizeObject","NormalizeScript","NormalizeOutPoint","toNormalize","normalize","NormalizeCellInput","NormalizeCellOutput","type_","NormalizeCellDep","toNormalizeArray","normalizeFunction","item","NormalizeRawTransaction","NormalizeTransaction","NormalizeRawHeader","NormalizeHeader","NormalizeUncleBlock","invokeSerializeJson","serializeJson","Function","transformObject","replace","group","TransformScript","validation","validators.ValidateScript","TransformOutPoint","validators.ValidateOutPoint","toInvoke","transform","TransformCellInput","validators.ValidateCellInput","TransformCellOutput","validators.ValidateCellOutput","TransformCellDep","validators.ValidateCellDep","toInvokeArray","invokeFunction","TransformTransaction","validators.ValidateTransaction","TransformHeader","validators.ValidateHeader","TransformUncleBlock","validators.ValidateUncleBlock","validators.ValidateRawTransaction","validators.ValidateRawHeader","validators.ValidateBlock","validators.ValidateCellbaseWitness","validators.ValidateWitnessArgs","rpc","lockHash","skipCellWithContent","loadData","loadBlockNumber","to","get_tip_block_number","currentFrom","lessThanOrEqual","currentTo","greaterThan","cells","get_cells_by_lock_hash","cell","output_data_len","get_live_cell","content","block_number","get_header","block_hash","cellbase","cell_output","validateTransaction","depGroupUnpacker","txHash","tx","get_transaction","dump","mockInputs","output","_resolveOutPoint","mockCellDeps","cell_dep","outPoints","mockHeaderDeps","headerDep","mock_info","txStatus","toNumber","tx_status"],"mappings":"mRAAA,MAAMA,EACJC,YAAYC,GACVC,KAAKC,KAAO,IAAIC,SAASH,GAG3BD,SACE,OAAOE,KAAKC,KAAKE,WAGnBL,QAAQM,GACN,OAAOJ,KAAKC,KAAKI,SAASD,GAG5BN,gBACE,OAAOE,KAAKC,KAAKF,OAGnB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AAM,IAAIpL,MAAM,eAAemK,EAAUd,4BAE3C,MAAMgZ,EAAKY,EAAS7X,YACd9B,EAAQnJ,EAAK+iB,SAAS/iB,EAAKkB,OAAO8I,EAAUb,QAClD,GAAIA,GAAS+Y,EAAGrX,QAAQzL,OACtB,MAAM,IAAIS,MACR,eAAemK,EAAUd,gCAAgCC,MAG7D,MAAM0T,EAAO,CACXyF,OAAQJ,EAAGrX,QAAQ1B,GACnB0T,KAAMqF,EAAGpX,aAAa3B,IAKxB,MAHkC,cAA9B2Z,EAASE,UAAU/L,SACrB4F,EAAK7Q,OAAS8W,EAASE,UAAUpB,YAE5B/E,oBC5FY"} \ No newline at end of file diff --git a/dist/ckb-js-toolkit.umd.js b/dist/ckb-js-toolkit.umd.js index f2085d4..464dec4 100644 --- a/dist/ckb-js-toolkit.umd.js +++ b/dist/ckb-js-toolkit.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CKBJSToolkit={})}(this,(function(t){"use strict";class e{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class r{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(e,r)}return new e(r)}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var a=o((function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r,n=0;nl.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=h(this,o(l).call(this,t))).sign=r,n}return i(l,r),n(l,[{key:"toDebugString",value:function(){var t=["BigInt["],e=!0,r=!1,n=void 0;try{for(var i,o,a=this[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)o=i.value,t.push((o?(o>>>0).toString(16):o)+", ")}catch(t){r=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw n}}return t.push("]"),t.join("")}},{key:"toString",value:function(){var t=0t||36this.length&&(r=this.length);for(var n=65535&t,i=t>>>16,o=0,a=65535&e,s=e>>>16,_=0;_>>16,c=u(f,n),g=u(f,i),d=u(h,n),p=u(h,i),v=a+(65535&c),y=s+o+(v>>>16)+(c>>>16)+(65535&g)+(65535&d);o=(a=(g>>>16)+(d>>>16)+(65535&p)+(y>>>16))>>>16,a&=65535,s=p>>>16,this.__setDigit(_,65535&v|y<<16)}if(0!==o||0!==a||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(t,e,r){for(var n,i=0,o=0;o>>16,this.__setHalfDigit(e+o,n);return i}},{key:"__inplaceSub",value:function(t,e,r){var n=0;if(1&e){e>>=1;for(var i=this.__digit(e),o=65535&i,a=0;a>>1;a++){var s=t.__digit(a),u=(i>>>16)-(65535&s)-n;n=1&u>>>16,this.__setDigit(e+a,u<<16|65535&o),n=1&(o=(65535&(i=this.__digit(e+a+1)))-(s>>>16)-n)>>>16}var _=t.__digit(a),l=(i>>>16)-(65535&_)-n;if(n=1&l>>>16,this.__setDigit(e+a,l<<16|65535&o),e+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(65535&(i=this.__digit(e+a+1)))-(_>>>16)-n)>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;for(var f=0;f>>16)-(c>>>16)-(n=1&g>>>16);n=1&d>>>16,this.__setDigit(e+f,d<<16|65535&g)}var p=this.__digit(e+f),v=t.__digit(f),y=(65535&p)-(65535&v)-n;n=1&y>>>16;var b=0;0==(1&r)&&(n=1&(b=(p>>>16)-(v>>>16)-n)>>>16),this.__setDigit(e+f,b<<16|65535&y)}return n}},{key:"__inplaceRightShift",value:function(t){if(0!==t){for(var e,r=this.__digit(0)>>>t,n=this.length-1,i=0;i>>t;this.__setDigit(n,r)}}},{key:"__digit",value:function(t){return this[t]}},{key:"__unsignedDigit",value:function(t){return this[t]>>>0}},{key:"__setDigit",value:function(t,e){this[t]=0|e}},{key:"__setDigitGrow",value:function(t,e){this[t]=0|e}},{key:"__halfDigitLength",value:function(){var t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}},{key:"__halfDigit",value:function(t){return 65535&this[t>>>1]>>>((1&t)<<4)}},{key:"__setHalfDigit",value:function(t,e){var r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}}],[{key:"BigInt",value:function(e){var r=Math.floor,n=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if((0|e)===e)return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!n(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var i=l.__fromString(e);if(null===i)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return i}if("boolean"==typeof e)return!0===e?l.__oneDigit(1,!1):l.__zero();if("object"===t(e)){if(e.constructor===l)return e;var o=l.__toPrimitive(e);return l.BigInt(o)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(t){var e=t.length;if(0===e)return 0;if(1===e){var r=t.__unsignedDigit(0);return t.sign?-r:r}var n=t.__digit(e-1),i=_(n),o=32*e-i;if(1024>>=12;var c=f-12,g=12<=f?0:s<<20+f,d=20+f;0>>32-c,g=s<>>32-d,d-=32);var p=l.__decideRounding(t,d,u,s);if((1===p||0===p&&1==(1&g))&&0==(g=g+1>>>0)&&0!=++h>>>20&&(h=0,1023<++a))return t.sign?-1/0:1/0;var v=t.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=v|a|h,l.__kBitConversionInts[0]=g,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(t){if(0===t.length)return t;var e=t.__copy();return e.sign=!t.sign,e}},{key:"bitwiseNot",value:function(t){return t.sign?l.__absoluteSubOne(t).__trim():l.__absoluteAddOne(t,!0)}},{key:"exponentiate",value:function(t,e){if(e.sign)throw new RangeError("Exponent must be positive");if(0===e.length)return l.__oneDigit(1,!1);if(0===t.length)return t;if(1===t.length&&1===t.__digit(0))return t.sign&&0==(1&e.__digit(0))?l.unaryMinus(t):t;if(1=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){var n=1+(r>>>5),i=new l(n,t.sign&&0!=(1&r));i.__initializeDigits();var o=1<<(31&r);return i.__setDigit(n-1,o),i}var a=null,s=t;for(0!=(1&r)&&(a=t),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(t,e){if(0===t.length)return t;if(0===e.length)return e;var r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;var n=new l(r,t.sign!==e.sign);n.__initializeDigits();for(var i=0;il.__absoluteCompare(t,e))return l.__zero();var r,n=t.sign!==e.sign,i=e.__unsignedDigit(0);if(1===e.length&&65535>=i){if(1===i)return n===t.sign?t:l.unaryMinus(t);r=l.__absoluteDivSmall(t,i,null)}else r=l.__absoluteDivLarge(t,e,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(t,e))return t;var r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(t,r);return 0===n?l.__zero():l.__oneDigit(n,t.sign)}var i=l.__absoluteDivLarge(t,e,!1,!0);return i.sign=t.sign,i.__trim()}},{key:"add",value:function(t,e){var r=t.sign;return r===e.sign?l.__absoluteAdd(t,e,r):0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r)}},{key:"subtract",value:function(t,e){var r=t.sign;return r===e.sign?0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r):l.__absoluteAdd(t,e,r)}},{key:"leftShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__rightShiftByAbsolute(t,e):l.__leftShiftByAbsolute(t,e)}},{key:"signedRightShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__leftShiftByAbsolute(t,e):l.__rightShiftByAbsolute(t,e)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(t,e){return 0>l.__compareToBigInt(t,e)}},{key:"lessThanOrEqual",value:function(t,e){return 0>=l.__compareToBigInt(t,e)}},{key:"greaterThan",value:function(t,e){return 0=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.lengthl.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.length>>n)return e}return l.__truncateToNBits(t,e)}},{key:"ADD",value:function(t,e){if(t=l.__toPrimitive(t),e=l.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)&&l.__isBigInt(e))return l.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(t,e){return l.__compare(t,e,0)}},{key:"LE",value:function(t,e){return l.__compare(t,e,1)}},{key:"GT",value:function(t,e){return l.__compare(t,e,2)}},{key:"GE",value:function(t,e){return l.__compare(t,e,3)}},{key:"EQ",value:function(e,r){for(;;){if(l.__isBigInt(e))return l.__isBigInt(r)?l.equal(e,r):l.EQ(r,e);if("number"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("string"==typeof e){if(l.__isBigInt(r))return null!==(e=l.__fromString(e))&&l.equal(e,r);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("boolean"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,+e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("symbol"===t(e)){if(l.__isBigInt(r))return!1;if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else{if("object"!==t(e))return e==r;if("object"===t(r)&&r.constructor!==l)return e==r;e=l.__toPrimitive(e)}}}},{key:"NE",value:function(t,e){return!l.EQ(t,e)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(t,e){var r=new l(1,e);return r.__setDigit(0,t),r}},{key:"__decideRounding",value:function(t,e,r,n){if(0e)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}var o=1<>>20)-1023,n=1+(r>>>5),i=new l(n,0>t),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&r,_=0;if(u>>f,o=o<<32-f|a>>>f,a<<=32-f}else if(u===s)_=32,e=o,o=a;else{var h=u-s;_=32-h,e=o<>>32-h,o=a<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}},{key:"__fromString",value:function(t){var e=11073741824/s)return null;var _=new l(31+(s*a+u>>>l.__kBitsPerCharTableShift)>>>5,!1),f=10>e?e:10,h=10>=l.__kBitsPerCharTableShift;var c=[],g=[],d=!1;do{for(var p,v=0,y=0;;){if(p=void 0,o-48>>>0>>0>>0>>0>>l.__kBitsPerCharTableShift+5;_.__inplaceMultiplyAdd(D,k,P)}while(!b)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i>>u-(o-=32))}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=e-1,a=t.__digit(r-1),s=0|(32*r-_(a)+i-1)/i;if(t.sign&&s++,268435456>>v,c=32-v;c>=i;)u[f--]=l.__kConversionChars[h&o],h>>>=i,c-=i}var y=(h|a<>>i-c;0!==h;)u[f--]=l.__kConversionChars[h&o],h>>>=i;if(t.sign&&(u[f--]="-"),-1!==f)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(t,e,r){var n=t.length;if(0===n)return"";if(1===n){var i=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(i="-"+i),i}var o,a,s=32*n-_(t.__digit(n-1)),u=l.__kMaxBitsPerChar[e]-1,f=s*l.__kBitsPerCharTableMultiplier,h=1+(f=0|(f+=u-1)/u)>>1,c=l.exponentiate(l.__oneDigit(e,!1),l.__oneDigit(h,!1)),g=c.__unsignedDigit(0);if(1===c.length&&65535>=g){(o=new l(t.length,!1)).__initializeDigits();for(var d,p=0,v=2*t.length-1;0<=v;v--)d=p<<16|t.__halfDigit(v),o.__setHalfDigit(v,0|d/g),p=0|d%g;a=p.toString(e)}else{var y=l.__absoluteDivLarge(t,c,!0,!0);o=y.quotient;var b=y.remainder.__trim();a=l.__toStringGeneric(b,e,!0)}o.__trim();for(var m=l.__toStringGeneric(o,e,!0);a.lengthn?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(t,e){if(!0|e){var r=t.sign,n=0>e;if(r!==n)return l.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?l.__absoluteGreater(r):oe)return l.__unequalSign(r);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;l.__kBitConversionDouble[0]=e;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=t.length,a=t.__digit(o-1),s=_(a),u=32*o-s,f=i+1;if(uf)return l.__absoluteGreater(r);var h=1048576|1048575&l.__kBitConversionInts[1],c=l.__kBitConversionInts[0],g=20,d=31-s;if(d!==(u-1)%31)throw new Error("implementation bug");var p,v=0;if(d>>y,h=h<<32-y|c>>>y,c<<=32-y}else if(d===g)v=32,p=h,h=c;else{var b=d-g;v=32-b,p=h<>>32-b,h=c<>>=0)>(p>>>=0))return l.__absoluteGreater(r);if(a>>0,h=c,c=0):p=0;var w=t.__unsignedDigit(m);if(w>p)return l.__absoluteGreater(r);if(we&&t.__unsignedDigit(0)===a(e):0===l.__compareToDouble(t,e)}},{key:"__comparisonResultToBool",value:function(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(l.__isBigInt(t)&&"string"==typeof e)return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("string"==typeof t&&l.__isBigInt(e))return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)){if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}},{key:"__absoluteAdd",value:function(t,e,r){if(t.length>>16)+(s>>>16)+(_>>>16);o=f>>>16,i.__setDigit(a,65535&_|f<<16)}for(;a>>16)+(c>>>16);o=g>>>16,i.__setDigit(a,65535&c|g<<16)}return a>>16)-(s>>>16)-(i=1&u>>>16);i=1&_>>>16,n.__setDigit(o,65535&u|_<<16)}for(;o>>16)-(i=1&h>>>16);i=1&c>>>16,n.__setDigit(o,65535&h|c<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(t,e){var r=2n?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(t,e,r,n){if(0!==e){for(var i=65535&e,o=e>>>16,a=0,s=0,_=0,l=0;l>>16,g=t.__digit(l),d=65535&g,p=g>>>16,v=u(d,i),y=u(d,o),b=u(p,i),m=u(p,o);a=(s=(y>>>16)+(b>>>16)+(65535&m)+(a=(c+=_+a+((h+=s+(65535&v))>>>16)+(v>>>16)+(65535&y)+(65535&b))>>>16))>>>16,s&=65535,_=m>>>16,f=65535&h|c<<16,r.__setDigit(n,f)}for(;0!==a||0!==s||0!==_;n++){var w=r.__digit(n),k=(65535&w)+s,D=(w>>>16)+(k>>>16)+_+a;s=0,_=0,a=D>>>16,w=65535&k|D<<16,r.__setDigit(n,w)}}}},{key:"__internalMultiplyAdd",value:function(t,e,r,n,i){for(var o=r,a=0,s=0;s>>16;var h=u(_>>>16,e),c=(65535&h)+(l>>>16)+o;o=c>>>16,a=h>>>16,i.__setDigit(s,c<<16|65535&f)}if(i.length>n)for(i.__setDigit(n++,o+a);n>>0,a=0|o/e,s=0|(o=((n=0|o%e)<<16|t.__halfDigit(i-1))>>>0)/e;n=0|o%e,r.__setDigit(i>>>1,a<<16|s)}return r}},{key:"__absoluteModSmall",value:function(t,e){for(var r=0,n=2*t.length-1;0<=n;n--)r=0|((r<<16|t.__halfDigit(n))>>>0)%e;return r}},{key:"__absoluteDivLarge",value:function(t,e,r,n){var i=e.__halfDigitLength(),o=e.length,a=t.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var _=new l(i+2>>>1,!1);_.__initializeDigits();var f=l.__clz16(e.__halfDigit(i-1));0>>0;p=0|y/c;for(var b=0|y%c,m=e.__halfDigit(i-2),w=h.__halfDigit(d+i-2);u(p,m)>>>0>(b<<16|w)>>>0&&(p--,!(65535<(b+=c))););}l.__internalMultiplyAdd(e,p,0,o,_);var k=h.__inplaceSub(_,d,i+1);0!==k&&(k=h.__inplaceAdd(e,d,i),h.__setHalfDigit(d+i,h.__halfDigit(d+i)+k),p--),r&&(1&d?g=p<<16:s.__setDigit(d>>>1,g|p))}return n?(h.__inplaceRightShift(f),r?{quotient:s,remainder:h}:h):r?s:void 0}},{key:"__clz16",value:function(t){return _(t)-16}},{key:"__specialLeftShift",value:function(t,e,r){var n=t.length,i=new l(n+r,!1);if(0===e){for(var o=0;o>>32-e;return 0r)throw new RangeError("BigInt too big");var n=r>>>5,i=31&r,o=t.length,a=0!==i&&0!=t.__digit(o-1)>>>32-i,s=o+n+(a?1:0),u=new l(s,t.sign);if(0===i){for(var _=0;_>>32-i;if(a)u.__setDigit(o+n,f);else if(0!==f)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(t,e){var r=t.length,n=t.sign,i=l.__toShiftAmount(e);if(0>i)return l.__rightShiftByMaximum(n);var o=i>>>5,a=31&i,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(t.__digit(o)&(1<>>a,d=r-o-1,p=0;p>>a;f.__setDigit(d,g)}return u&&(f=l.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:"__rightShiftByMaximum",value:function(t){return t?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(t){if(1l.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(e){var r=1>>5,n=new l(r,e.sign),i=r-1,o=0;o>>s}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(t,e,r){for(var n=Math.min,i=t+31>>>5,o=new l(i,r),a=0,s=i-1,u=0,_=n(s,e.length);a<_;a++){var f=e.__digit(a),h=0-(65535&f)-u,c=0-(f>>>16)-(u=1&h>>>16);u=1&c>>>16,o.__setDigit(a,65535&h|c<<16)}for(;a>>16)-(u=1&v>>>16)<<16}else{var y=32-p,b=1<<32-y,m=(65535&b)-(65535&(d=d<>>y))-u;g=65535&m|(b>>>16)-(d>>>16)-(u=1&m>>>16)<<16,g&=b-1}return o.__setDigit(s,g),o.__trim()}},{key:"__digitPow",value:function(t,e){for(var r=1;0>>=1,t*=t;return r}}]),l}(l(Array));return c.__kMaxLength=33554432,c.__kMaxLengthBits=c.__kMaxLength<<5,c.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],c.__kBitsPerCharTableShift=5,c.__kBitsPerCharTableMultiplier=1<a)throw new Error(s);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(s);if(u.find(t=>!n.includes(t)))throw new Error(s)}function u(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function _(t,e){if(u(t,e),66!=e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function l(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function f(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(s(r,t,["code_hash","hash_type","args"],[]),_(r+".code_hash",t.code_hash),u(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function h(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){s(r,t,["tx_hash","index"],[]),_(r+".tx_hash",t.tx_hash),l(r+".index",t.index)}function c(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){s(r,t,["since","previous_output"],[]),l(r+".since",t.since),e&&h(t.previous_output,{debugPath:r+".previous_output"})}function g(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){s(r,t,["capacity","lock"],["type"]),l(r+".capacity",t.capacity),e&&(f(t.lock,{debugPath:r+".lock"}),t.type&&f(t.type,{debugPath:r+".type"}))}function d(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(s(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&h(t.out_point,{debugPath:r+".out_point"})}function p(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n-1};function _(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];w.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function D(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}D.polyfill=!0,t.fetch||(t.fetch=D,t.Headers=h,t.Request=b,t.Response=w),e.Headers=h,e.Request=b,e.Response=w,e.fetch=D}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}));function x(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const O={get:(t,e,r)=>"send"===e?async()=>{const e=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},C={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},O):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class I{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,C)}static create(t){return new I(t)}}function j(t){return a.BigInt(t)}function R(t){return"0x"+t.toString(16)}function z(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=R(a.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function N(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function L(t,{debugPath:e="script"}={}){return N(e,t,{code_hash:M(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case 0:case 1:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:M(-1)})}function U(t,{debugPath:e="out_point"}={}){return N(e,t,{tx_hash:M(32),index:z(4)})}function V(t){return function(e,r){return t(r,{debugPath:e})}}function q(t,{debugPath:e="cell_input"}={}){return N(e,t,{since:z(8),previous_output:V(U)})}function $(t,{debugPath:e="cell_output"}={}){const r=N(e,t,{capacity:z(8),lock:V(L)});return t.type&&(r.type_=L(t.type,{debugPath:e+".type"})),r}function F(t,{debugPath:e="cell_dep"}={}){return N(e,t,{out_point:V(U),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function H(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function G(t,{debugPath:e="raw_transaction"}={}){return N(e,t,{version:z(4),cell_deps:H(V(F)),header_deps:H(M(32)),inputs:H(V(q)),outputs:H(V($)),outputs_data:H(M(-1))})}function W(t,{debugPath:e="transaction"}={}){const r=G(t,{debugPath:"(raw)"+e}),n=N(e,t,{witnesses:H(M(-1))});return n.raw=r,n}function J(t,{debugPath:e="raw_header"}={}){return N(e,t,{version:z(4),compact_target:z(4),timestamp:z(8),number:z(8),epoch:z(8),parent_hash:M(32),transactions_root:M(32),proposals_hash:M(32),uncles_hash:M(32),dao:M(32)})}function X(t,{debugPath:e="header"}={}){const r=J(t,{debugPath:"(raw)"+e}),n=N(e,t,{nonce:z(16)});return n.raw=r,n}function Q(t,{debugPath:e="uncle_block"}={}){return N(e,t,{header:V(X),proposals:H(M(10))})}var K=Object.freeze({__proto__:null,NormalizeScript:L,NormalizeOutPoint:U,NormalizeCellInput:q,NormalizeCellOutput:$,NormalizeCellDep:F,NormalizeRawTransaction:G,NormalizeTransaction:W,NormalizeRawHeader:J,NormalizeHeader:X,NormalizeUncleBlock:Q,NormalizeBlock:function(t,{debugPath:e="block"}={}){return N(e,t,{header:V(X),uncles:H(V(Q)),transactions:H(V(W)),proposals:H(M(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return N(e,t,{lock:V(L),message:M(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=M(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=M(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=M(-1)(e+".output_type",t.output_type)),r}});function Y(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Z(t,e,r){if(!((e=Y(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function tt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Z(r,t,{code_hash:Y,hash_type:Y,args:Y}),e&&f(t,{debugPath:"(transformed) "+r}),t}function et(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Z(r,t,{tx_hash:Y,index:Y}),e&&h(t,{debugPath:"(transformed) "+r}),t}function rt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function nt(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Z(r,t,{since:Y,previous_output:rt(et)}),e&&c(t,{debugPath:"(transformed) "+r}),t}function it(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Z(r,t,{capacity:Y,lock:rt(tt),type:rt(tt)}),e&&g(t,{debugPath:"(transformed) "+r}),t}function ot(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Z(r,t,{out_point:rt(et),dep_type:Y}),e&&d(t,{debugPath:"(transformed) "+r}),t}function at(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function st(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y),witnesses:at(Y)}),e&&m(t,{debugPath:"(transformed) "+r}),t}function ut(t,{validation:e=!0,debugPath:r="header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y,nonce:Y}),e&&k(t,{debugPath:"(transformed) "+r}),t}function _t(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Z(r,t,{header:rt(ut),proposals:at(Y)}),e&&B(t,{debugPath:"(transformed) "+r}),t}var lt=Object.freeze({__proto__:null,TransformScript:tt,TransformOutPoint:et,TransformCellInput:nt,TransformCellOutput:it,TransformCellDep:ot,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y)}),e&&b(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:st,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y}),e&&w(t,{debugPath:"(transformed) "+r}),t},TransformHeader:ut,TransformUncleBlock:_t,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Z(r,t,{header:rt(ut),uncles:at(rt(_t)),transactions:at(rt(st)),proposals:at(Y)}),e&&P(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Z(r,t,{lock:rt(tt),message:Y}),e&&T(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Z(r,t,{lock:Y,input_type:Y,output_type:Y}),e&&A(t,{debugPath:"(transformed) "+r}),t}});var ft=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:r=!0,loadData:i=!1,loadBlockNumber:o=!0}={}){this.rpc=t,this.lockHash=new n(e).serializeJson(),this.skipCellWithContent=r,this.loadData=i,this.loadBlockNumber=o}async*collect(){const t=j(await this.rpc.get_tip_block_number());let e=a.BigInt(0);for(;a.lessThanOrEqual(e,t);){let r=a.add(e,a.BigInt(100));a.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,R(e),R(r));for(const t of n){if(this.skipCellWithContent&&(t.type||a.greaterThan(j(t.output_data_len),a.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=a.add(r,a.BigInt(1))}}}});t.BigIntToHexString=R,t.HexStringToBigInt=j,t.RPC=I,t.Reader=n,t.TransactionDumper=class{constructor(t,{validateTransaction:e=!0,depGroupUnpacker:r=null}={}){this.rpc=t,this.validateTransaction=e,this.depGroupUnpacker=r}async dumpByHash(t){const e=(await this.rpc.get_transaction(t)).transaction;return delete e.hash,await this.dump(e)}async dump(t){this.validateTransaction&&m(t);const e=[];for(const r of t.inputs){const{output:t,data:n,header:i}=await this._resolveOutPoint(r.previous_output);e.push({input:r,output:t,data:n,header:i})}const r=[];for(const e of t.cell_deps){const{output:t,data:i,header:o}=await this._resolveOutPoint(e.out_point);if(r.push({cell_dep:e,output:t,data:i,header:o}),"dep_group"===e.dep_type){if(!this.depGroupUnpacker)throw new Error("depGroupUnpacker must be provided when the transaction contains dep_group!");const t=this.depGroupUnpacker(new n(i));for(const e of t){h(e);const{output:t,data:n,header:i}=await this._resolveOutPoint(e);r.push({cell_dep:{out_point:e,dep_type:"code"},output:t,data:n,header:i})}}}const i=[];for(const e of t.header_deps)i.push(await this.rpc.get_header(e));return JSON.stringify({mock_info:{inputs:e,cell_deps:r,header_deps:i},tx:t})}async _resolveOutPoint(t){const e=await this.rpc.get_transaction(t.tx_hash);if(!e||!e.transaction)throw new Error(`Transaction ${t.tx_hash} cannot be found!`);const r=e.transaction,n=a.toNumber(a.BigInt(t.index));if(n>=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}},t.VERSION="0.10.2",t.cell_collectors=ft,t.normalizers=K,t.transformers=lt,t.validators=E,Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CKBJSToolkit={})}(this,(function(t){"use strict";class e{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class r{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(e,r)}return new e(r)}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var a=o((function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r,n=0;nl.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=h(this,o(l).call(this,t))).sign=r,n}return i(l,r),n(l,[{key:"toDebugString",value:function(){var t=["BigInt["],e=!0,r=!1,n=void 0;try{for(var i,o,a=this[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)o=i.value,t.push((o?(o>>>0).toString(16):o)+", ")}catch(t){r=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw n}}return t.push("]"),t.join("")}},{key:"toString",value:function(){var t=0t||36this.length&&(r=this.length);for(var n=65535&t,i=t>>>16,o=0,a=65535&e,s=e>>>16,_=0;_>>16,c=u(f,n),g=u(f,i),d=u(h,n),p=u(h,i),v=a+(65535&c),y=s+o+(v>>>16)+(c>>>16)+(65535&g)+(65535&d);o=(a=(g>>>16)+(d>>>16)+(65535&p)+(y>>>16))>>>16,a&=65535,s=p>>>16,this.__setDigit(_,65535&v|y<<16)}if(0!==o||0!==a||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(t,e,r){for(var n,i=0,o=0;o>>16,this.__setHalfDigit(e+o,n);return i}},{key:"__inplaceSub",value:function(t,e,r){var n=0;if(1&e){e>>=1;for(var i=this.__digit(e),o=65535&i,a=0;a>>1;a++){var s=t.__digit(a),u=(i>>>16)-(65535&s)-n;n=1&u>>>16,this.__setDigit(e+a,u<<16|65535&o),n=1&(o=(65535&(i=this.__digit(e+a+1)))-(s>>>16)-n)>>>16}var _=t.__digit(a),l=(i>>>16)-(65535&_)-n;if(n=1&l>>>16,this.__setDigit(e+a,l<<16|65535&o),e+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(65535&(i=this.__digit(e+a+1)))-(_>>>16)-n)>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;for(var f=0;f>>16)-(c>>>16)-(n=1&g>>>16);n=1&d>>>16,this.__setDigit(e+f,d<<16|65535&g)}var p=this.__digit(e+f),v=t.__digit(f),y=(65535&p)-(65535&v)-n;n=1&y>>>16;var b=0;0==(1&r)&&(n=1&(b=(p>>>16)-(v>>>16)-n)>>>16),this.__setDigit(e+f,b<<16|65535&y)}return n}},{key:"__inplaceRightShift",value:function(t){if(0!==t){for(var e,r=this.__digit(0)>>>t,n=this.length-1,i=0;i>>t;this.__setDigit(n,r)}}},{key:"__digit",value:function(t){return this[t]}},{key:"__unsignedDigit",value:function(t){return this[t]>>>0}},{key:"__setDigit",value:function(t,e){this[t]=0|e}},{key:"__setDigitGrow",value:function(t,e){this[t]=0|e}},{key:"__halfDigitLength",value:function(){var t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}},{key:"__halfDigit",value:function(t){return 65535&this[t>>>1]>>>((1&t)<<4)}},{key:"__setHalfDigit",value:function(t,e){var r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}}],[{key:"BigInt",value:function(e){var r=Math.floor,n=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if((0|e)===e)return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!n(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var i=l.__fromString(e);if(null===i)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return i}if("boolean"==typeof e)return!0===e?l.__oneDigit(1,!1):l.__zero();if("object"===t(e)){if(e.constructor===l)return e;var o=l.__toPrimitive(e);return l.BigInt(o)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(t){var e=t.length;if(0===e)return 0;if(1===e){var r=t.__unsignedDigit(0);return t.sign?-r:r}var n=t.__digit(e-1),i=_(n),o=32*e-i;if(1024>>=12;var c=f-12,g=12<=f?0:s<<20+f,d=20+f;0>>32-c,g=s<>>32-d,d-=32);var p=l.__decideRounding(t,d,u,s);if((1===p||0===p&&1==(1&g))&&0==(g=g+1>>>0)&&0!=++h>>>20&&(h=0,1023<++a))return t.sign?-1/0:1/0;var v=t.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=v|a|h,l.__kBitConversionInts[0]=g,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(t){if(0===t.length)return t;var e=t.__copy();return e.sign=!t.sign,e}},{key:"bitwiseNot",value:function(t){return t.sign?l.__absoluteSubOne(t).__trim():l.__absoluteAddOne(t,!0)}},{key:"exponentiate",value:function(t,e){if(e.sign)throw new RangeError("Exponent must be positive");if(0===e.length)return l.__oneDigit(1,!1);if(0===t.length)return t;if(1===t.length&&1===t.__digit(0))return t.sign&&0==(1&e.__digit(0))?l.unaryMinus(t):t;if(1=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){var n=1+(r>>>5),i=new l(n,t.sign&&0!=(1&r));i.__initializeDigits();var o=1<<(31&r);return i.__setDigit(n-1,o),i}var a=null,s=t;for(0!=(1&r)&&(a=t),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(t,e){if(0===t.length)return t;if(0===e.length)return e;var r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;var n=new l(r,t.sign!==e.sign);n.__initializeDigits();for(var i=0;il.__absoluteCompare(t,e))return l.__zero();var r,n=t.sign!==e.sign,i=e.__unsignedDigit(0);if(1===e.length&&65535>=i){if(1===i)return n===t.sign?t:l.unaryMinus(t);r=l.__absoluteDivSmall(t,i,null)}else r=l.__absoluteDivLarge(t,e,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(t,e))return t;var r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(t,r);return 0===n?l.__zero():l.__oneDigit(n,t.sign)}var i=l.__absoluteDivLarge(t,e,!1,!0);return i.sign=t.sign,i.__trim()}},{key:"add",value:function(t,e){var r=t.sign;return r===e.sign?l.__absoluteAdd(t,e,r):0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r)}},{key:"subtract",value:function(t,e){var r=t.sign;return r===e.sign?0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r):l.__absoluteAdd(t,e,r)}},{key:"leftShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__rightShiftByAbsolute(t,e):l.__leftShiftByAbsolute(t,e)}},{key:"signedRightShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__leftShiftByAbsolute(t,e):l.__rightShiftByAbsolute(t,e)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(t,e){return 0>l.__compareToBigInt(t,e)}},{key:"lessThanOrEqual",value:function(t,e){return 0>=l.__compareToBigInt(t,e)}},{key:"greaterThan",value:function(t,e){return 0=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.lengthl.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.length>>n)return e}return l.__truncateToNBits(t,e)}},{key:"ADD",value:function(t,e){if(t=l.__toPrimitive(t),e=l.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)&&l.__isBigInt(e))return l.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(t,e){return l.__compare(t,e,0)}},{key:"LE",value:function(t,e){return l.__compare(t,e,1)}},{key:"GT",value:function(t,e){return l.__compare(t,e,2)}},{key:"GE",value:function(t,e){return l.__compare(t,e,3)}},{key:"EQ",value:function(e,r){for(;;){if(l.__isBigInt(e))return l.__isBigInt(r)?l.equal(e,r):l.EQ(r,e);if("number"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("string"==typeof e){if(l.__isBigInt(r))return null!==(e=l.__fromString(e))&&l.equal(e,r);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("boolean"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,+e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("symbol"===t(e)){if(l.__isBigInt(r))return!1;if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else{if("object"!==t(e))return e==r;if("object"===t(r)&&r.constructor!==l)return e==r;e=l.__toPrimitive(e)}}}},{key:"NE",value:function(t,e){return!l.EQ(t,e)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(t,e){var r=new l(1,e);return r.__setDigit(0,t),r}},{key:"__decideRounding",value:function(t,e,r,n){if(0e)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}var o=1<>>20)-1023,n=1+(r>>>5),i=new l(n,0>t),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&r,_=0;if(u>>f,o=o<<32-f|a>>>f,a<<=32-f}else if(u===s)_=32,e=o,o=a;else{var h=u-s;_=32-h,e=o<>>32-h,o=a<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}},{key:"__fromString",value:function(t){var e=11073741824/s)return null;var _=new l(31+(s*a+u>>>l.__kBitsPerCharTableShift)>>>5,!1),f=10>e?e:10,h=10>=l.__kBitsPerCharTableShift;var c=[],g=[],d=!1;do{for(var p,v=0,y=0;;){if(p=void 0,o-48>>>0>>0>>0>>0>>l.__kBitsPerCharTableShift+5;_.__inplaceMultiplyAdd(D,k,P)}while(!b)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i>>u-(o-=32))}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=e-1,a=t.__digit(r-1),s=0|(32*r-_(a)+i-1)/i;if(t.sign&&s++,268435456>>v,c=32-v;c>=i;)u[f--]=l.__kConversionChars[h&o],h>>>=i,c-=i}var y=(h|a<>>i-c;0!==h;)u[f--]=l.__kConversionChars[h&o],h>>>=i;if(t.sign&&(u[f--]="-"),-1!==f)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(t,e,r){var n=t.length;if(0===n)return"";if(1===n){var i=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(i="-"+i),i}var o,a,s=32*n-_(t.__digit(n-1)),u=l.__kMaxBitsPerChar[e]-1,f=s*l.__kBitsPerCharTableMultiplier,h=1+(f=0|(f+=u-1)/u)>>1,c=l.exponentiate(l.__oneDigit(e,!1),l.__oneDigit(h,!1)),g=c.__unsignedDigit(0);if(1===c.length&&65535>=g){(o=new l(t.length,!1)).__initializeDigits();for(var d,p=0,v=2*t.length-1;0<=v;v--)d=p<<16|t.__halfDigit(v),o.__setHalfDigit(v,0|d/g),p=0|d%g;a=p.toString(e)}else{var y=l.__absoluteDivLarge(t,c,!0,!0);o=y.quotient;var b=y.remainder.__trim();a=l.__toStringGeneric(b,e,!0)}o.__trim();for(var m=l.__toStringGeneric(o,e,!0);a.lengthn?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(t,e){if(!0|e){var r=t.sign,n=0>e;if(r!==n)return l.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?l.__absoluteGreater(r):oe)return l.__unequalSign(r);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;l.__kBitConversionDouble[0]=e;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=t.length,a=t.__digit(o-1),s=_(a),u=32*o-s,f=i+1;if(uf)return l.__absoluteGreater(r);var h=1048576|1048575&l.__kBitConversionInts[1],c=l.__kBitConversionInts[0],g=20,d=31-s;if(d!==(u-1)%31)throw new Error("implementation bug");var p,v=0;if(d>>y,h=h<<32-y|c>>>y,c<<=32-y}else if(d===g)v=32,p=h,h=c;else{var b=d-g;v=32-b,p=h<>>32-b,h=c<>>=0)>(p>>>=0))return l.__absoluteGreater(r);if(a>>0,h=c,c=0):p=0;var w=t.__unsignedDigit(m);if(w>p)return l.__absoluteGreater(r);if(we&&t.__unsignedDigit(0)===a(e):0===l.__compareToDouble(t,e)}},{key:"__comparisonResultToBool",value:function(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(l.__isBigInt(t)&&"string"==typeof e)return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("string"==typeof t&&l.__isBigInt(e))return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)){if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}},{key:"__absoluteAdd",value:function(t,e,r){if(t.length>>16)+(s>>>16)+(_>>>16);o=f>>>16,i.__setDigit(a,65535&_|f<<16)}for(;a>>16)+(c>>>16);o=g>>>16,i.__setDigit(a,65535&c|g<<16)}return a>>16)-(s>>>16)-(i=1&u>>>16);i=1&_>>>16,n.__setDigit(o,65535&u|_<<16)}for(;o>>16)-(i=1&h>>>16);i=1&c>>>16,n.__setDigit(o,65535&h|c<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(t,e){var r=2n?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(t,e,r,n){if(0!==e){for(var i=65535&e,o=e>>>16,a=0,s=0,_=0,l=0;l>>16,g=t.__digit(l),d=65535&g,p=g>>>16,v=u(d,i),y=u(d,o),b=u(p,i),m=u(p,o);a=(s=(y>>>16)+(b>>>16)+(65535&m)+(a=(c+=_+a+((h+=s+(65535&v))>>>16)+(v>>>16)+(65535&y)+(65535&b))>>>16))>>>16,s&=65535,_=m>>>16,f=65535&h|c<<16,r.__setDigit(n,f)}for(;0!==a||0!==s||0!==_;n++){var w=r.__digit(n),k=(65535&w)+s,D=(w>>>16)+(k>>>16)+_+a;s=0,_=0,a=D>>>16,w=65535&k|D<<16,r.__setDigit(n,w)}}}},{key:"__internalMultiplyAdd",value:function(t,e,r,n,i){for(var o=r,a=0,s=0;s>>16;var h=u(_>>>16,e),c=(65535&h)+(l>>>16)+o;o=c>>>16,a=h>>>16,i.__setDigit(s,c<<16|65535&f)}if(i.length>n)for(i.__setDigit(n++,o+a);n>>0,a=0|o/e,s=0|(o=((n=0|o%e)<<16|t.__halfDigit(i-1))>>>0)/e;n=0|o%e,r.__setDigit(i>>>1,a<<16|s)}return r}},{key:"__absoluteModSmall",value:function(t,e){for(var r=0,n=2*t.length-1;0<=n;n--)r=0|((r<<16|t.__halfDigit(n))>>>0)%e;return r}},{key:"__absoluteDivLarge",value:function(t,e,r,n){var i=e.__halfDigitLength(),o=e.length,a=t.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var _=new l(i+2>>>1,!1);_.__initializeDigits();var f=l.__clz16(e.__halfDigit(i-1));0>>0;p=0|y/c;for(var b=0|y%c,m=e.__halfDigit(i-2),w=h.__halfDigit(d+i-2);u(p,m)>>>0>(b<<16|w)>>>0&&(p--,!(65535<(b+=c))););}l.__internalMultiplyAdd(e,p,0,o,_);var k=h.__inplaceSub(_,d,i+1);0!==k&&(k=h.__inplaceAdd(e,d,i),h.__setHalfDigit(d+i,h.__halfDigit(d+i)+k),p--),r&&(1&d?g=p<<16:s.__setDigit(d>>>1,g|p))}return n?(h.__inplaceRightShift(f),r?{quotient:s,remainder:h}:h):r?s:void 0}},{key:"__clz16",value:function(t){return _(t)-16}},{key:"__specialLeftShift",value:function(t,e,r){var n=t.length,i=new l(n+r,!1);if(0===e){for(var o=0;o>>32-e;return 0r)throw new RangeError("BigInt too big");var n=r>>>5,i=31&r,o=t.length,a=0!==i&&0!=t.__digit(o-1)>>>32-i,s=o+n+(a?1:0),u=new l(s,t.sign);if(0===i){for(var _=0;_>>32-i;if(a)u.__setDigit(o+n,f);else if(0!==f)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(t,e){var r=t.length,n=t.sign,i=l.__toShiftAmount(e);if(0>i)return l.__rightShiftByMaximum(n);var o=i>>>5,a=31&i,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(t.__digit(o)&(1<>>a,d=r-o-1,p=0;p>>a;f.__setDigit(d,g)}return u&&(f=l.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:"__rightShiftByMaximum",value:function(t){return t?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(t){if(1l.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(e){var r=1>>5,n=new l(r,e.sign),i=r-1,o=0;o>>s}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(t,e,r){for(var n=Math.min,i=t+31>>>5,o=new l(i,r),a=0,s=i-1,u=0,_=n(s,e.length);a<_;a++){var f=e.__digit(a),h=0-(65535&f)-u,c=0-(f>>>16)-(u=1&h>>>16);u=1&c>>>16,o.__setDigit(a,65535&h|c<<16)}for(;a>>16)-(u=1&v>>>16)<<16}else{var y=32-p,b=1<<32-y,m=(65535&b)-(65535&(d=d<>>y))-u;g=65535&m|(b>>>16)-(d>>>16)-(u=1&m>>>16)<<16,g&=b-1}return o.__setDigit(s,g),o.__trim()}},{key:"__digitPow",value:function(t,e){for(var r=1;0>>=1,t*=t;return r}}]),l}(l(Array));return c.__kMaxLength=33554432,c.__kMaxLengthBits=c.__kMaxLength<<5,c.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],c.__kBitsPerCharTableShift=5,c.__kBitsPerCharTableMultiplier=1<a)throw new Error(s);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(s);if(u.find(t=>!n.includes(t)))throw new Error(s)}function u(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function _(t,e){if(u(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function l(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function f(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(s(r,t,["code_hash","hash_type","args"],[]),_(r+".code_hash",t.code_hash),u(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function h(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){s(r,t,["tx_hash","index"],[]),_(r+".tx_hash",t.tx_hash),l(r+".index",t.index)}function c(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){s(r,t,["since","previous_output"],[]),l(r+".since",t.since),e&&h(t.previous_output,{debugPath:r+".previous_output"})}function g(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){s(r,t,["capacity","lock"],["type"]),l(r+".capacity",t.capacity),e&&(f(t.lock,{debugPath:r+".lock"}),t.type&&f(t.type,{debugPath:r+".type"}))}function d(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(s(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&h(t.out_point,{debugPath:r+".out_point"})}function p(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n-1};function _(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];w.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function D(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}D.polyfill=!0,t.fetch||(t.fetch=D,t.Headers=h,t.Request=b,t.Response=w),e.Headers=h,e.Request=b,e.Response=w,e.fetch=D}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}));function x(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const O={get:(t,e,r)=>"send"===e?async()=>{const e=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},C={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},O):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class I{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,C)}static create(t){return new I(t)}}function j(t){return a.BigInt(t)}function R(t){return"0x"+t.toString(16)}function z(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=R(a.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function N(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function L(t,{debugPath:e="script"}={}){return N(e,t,{code_hash:M(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:M(-1)})}function U(t,{debugPath:e="out_point"}={}){return N(e,t,{tx_hash:M(32),index:z(4)})}function V(t){return function(e,r){return t(r,{debugPath:e})}}function q(t,{debugPath:e="cell_input"}={}){return N(e,t,{since:z(8),previous_output:V(U)})}function $(t,{debugPath:e="cell_output"}={}){const r=N(e,t,{capacity:z(8),lock:V(L)});return t.type&&(r.type_=L(t.type,{debugPath:e+".type"})),r}function F(t,{debugPath:e="cell_dep"}={}){return N(e,t,{out_point:V(U),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function H(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function G(t,{debugPath:e="raw_transaction"}={}){return N(e,t,{version:z(4),cell_deps:H(V(F)),header_deps:H(M(32)),inputs:H(V(q)),outputs:H(V($)),outputs_data:H(M(-1))})}function W(t,{debugPath:e="transaction"}={}){const r=G(t,{debugPath:"(raw)"+e}),n=N(e,t,{witnesses:H(M(-1))});return n.raw=r,n}function J(t,{debugPath:e="raw_header"}={}){return N(e,t,{version:z(4),compact_target:z(4),timestamp:z(8),number:z(8),epoch:z(8),parent_hash:M(32),transactions_root:M(32),proposals_hash:M(32),uncles_hash:M(32),dao:M(32)})}function X(t,{debugPath:e="header"}={}){const r=J(t,{debugPath:"(raw)"+e}),n=N(e,t,{nonce:z(16)});return n.raw=r,n}function Q(t,{debugPath:e="uncle_block"}={}){return N(e,t,{header:V(X),proposals:H(M(10))})}var K=Object.freeze({__proto__:null,NormalizeScript:L,NormalizeOutPoint:U,NormalizeCellInput:q,NormalizeCellOutput:$,NormalizeCellDep:F,NormalizeRawTransaction:G,NormalizeTransaction:W,NormalizeRawHeader:J,NormalizeHeader:X,NormalizeUncleBlock:Q,NormalizeBlock:function(t,{debugPath:e="block"}={}){return N(e,t,{header:V(X),uncles:H(V(Q)),transactions:H(V(W)),proposals:H(M(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return N(e,t,{lock:V(L),message:M(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=M(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=M(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=M(-1)(e+".output_type",t.output_type)),r}});function Y(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Z(t,e,r){if(!((e=Y(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function tt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Z(r,t,{code_hash:Y,hash_type:Y,args:Y}),e&&f(t,{debugPath:"(transformed) "+r}),t}function et(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Z(r,t,{tx_hash:Y,index:Y}),e&&h(t,{debugPath:"(transformed) "+r}),t}function rt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function nt(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Z(r,t,{since:Y,previous_output:rt(et)}),e&&c(t,{debugPath:"(transformed) "+r}),t}function it(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Z(r,t,{capacity:Y,lock:rt(tt),type:rt(tt)}),e&&g(t,{debugPath:"(transformed) "+r}),t}function ot(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Z(r,t,{out_point:rt(et),dep_type:Y}),e&&d(t,{debugPath:"(transformed) "+r}),t}function at(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function st(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y),witnesses:at(Y)}),e&&m(t,{debugPath:"(transformed) "+r}),t}function ut(t,{validation:e=!0,debugPath:r="header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y,nonce:Y}),e&&k(t,{debugPath:"(transformed) "+r}),t}function _t(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Z(r,t,{header:rt(ut),proposals:at(Y)}),e&&B(t,{debugPath:"(transformed) "+r}),t}var lt=Object.freeze({__proto__:null,TransformScript:tt,TransformOutPoint:et,TransformCellInput:nt,TransformCellOutput:it,TransformCellDep:ot,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y)}),e&&b(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:st,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y}),e&&w(t,{debugPath:"(transformed) "+r}),t},TransformHeader:ut,TransformUncleBlock:_t,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Z(r,t,{header:rt(ut),uncles:at(rt(_t)),transactions:at(rt(st)),proposals:at(Y)}),e&&P(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Z(r,t,{lock:rt(tt),message:Y}),e&&T(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Z(r,t,{lock:Y,input_type:Y,output_type:Y}),e&&A(t,{debugPath:"(transformed) "+r}),t}});var ft=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:r=!0,loadData:i=!1,loadBlockNumber:o=!0}={}){this.rpc=t,this.lockHash=new n(e).serializeJson(),this.skipCellWithContent=r,this.loadData=i,this.loadBlockNumber=o}async*collect(){const t=j(await this.rpc.get_tip_block_number());let e=a.BigInt(0);for(;a.lessThanOrEqual(e,t);){let r=a.add(e,a.BigInt(100));a.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,R(e),R(r));for(const t of n){if(this.skipCellWithContent&&(t.type||a.greaterThan(j(t.output_data_len),a.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=a.add(r,a.BigInt(1))}}}});t.BigIntToHexString=R,t.HexStringToBigInt=j,t.RPC=I,t.Reader=n,t.TransactionDumper=class{constructor(t,{validateTransaction:e=!0,depGroupUnpacker:r=null}={}){this.rpc=t,this.validateTransaction=e,this.depGroupUnpacker=r}async dumpByHash(t){const e=(await this.rpc.get_transaction(t)).transaction;return delete e.hash,await this.dump(e)}async dump(t){this.validateTransaction&&m(t);const e=[];for(const r of t.inputs){const{output:t,data:n,header:i}=await this._resolveOutPoint(r.previous_output);e.push({input:r,output:t,data:n,header:i})}const r=[];for(const e of t.cell_deps){const{output:t,data:i,header:o}=await this._resolveOutPoint(e.out_point);if(r.push({cell_dep:e,output:t,data:i,header:o}),"dep_group"===e.dep_type){if(!this.depGroupUnpacker)throw new Error("depGroupUnpacker must be provided when the transaction contains dep_group!");const t=this.depGroupUnpacker(new n(i));for(const e of t){h(e);const{output:t,data:n,header:i}=await this._resolveOutPoint(e);r.push({cell_dep:{out_point:e,dep_type:"code"},output:t,data:n,header:i})}}}const i=[];for(const e of t.header_deps)i.push(await this.rpc.get_header(e));return JSON.stringify({mock_info:{inputs:e,cell_deps:r,header_deps:i},tx:t})}async _resolveOutPoint(t){const e=await this.rpc.get_transaction(t.tx_hash);if(!e||!e.transaction)throw new Error(`Transaction ${t.tx_hash} cannot be found!`);const r=e.transaction,n=a.toNumber(a.BigInt(t.index));if(n>=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}},t.VERSION="0.10.2",t.cell_collectors=ft,t.normalizers=K,t.transformers=lt,t.validators=E,Object.defineProperty(t,"__esModule",{value:!0})})); From a4cb52f9c3211f72fc5c409a5ad532a73d3aeaec Mon Sep 17 00:00:00 2001 From: homura Date: Fri, 29 Oct 2021 10:37:32 +0800 Subject: [PATCH 4/6] feat: supported CKB2021 schema --- dist/ckb-js-toolkit.esm.js | 2 +- dist/ckb-js-toolkit.node.js | 2 +- dist/ckb-js-toolkit.node.js.map | 2 +- dist/ckb-js-toolkit.umd.js | 2 +- package.json | 2 +- src/normalizers.js | 2 +- src/transformers.js | 4 +- src/validators.js | 6 +- testfiles/blockchain.umd.js | 126 +++++++++++++++++++++++--------- tests/serializers.js | 6 +- tests/transformers.js | 10 +-- tests/validators.js | 12 +-- 12 files changed, 117 insertions(+), 59 deletions(-) diff --git a/dist/ckb-js-toolkit.esm.js b/dist/ckb-js-toolkit.esm.js index 83ed4ad..7316efe 100644 --- a/dist/ckb-js-toolkit.esm.js +++ b/dist/ckb-js-toolkit.esm.js @@ -1 +1 @@ -class t{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class e{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(t,r)}return new t(r)}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var o=i((function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r,n=0;nl.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=h(this,o(l).call(this,t))).sign=r,n}return i(l,r),n(l,[{key:"toDebugString",value:function(){var t=["BigInt["],e=!0,r=!1,n=void 0;try{for(var i,o,a=this[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)o=i.value,t.push((o?(o>>>0).toString(16):o)+", ")}catch(t){r=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw n}}return t.push("]"),t.join("")}},{key:"toString",value:function(){var t=0t||36this.length&&(r=this.length);for(var n=65535&t,i=t>>>16,o=0,a=65535&e,s=e>>>16,_=0;_>>16,c=u(f,n),g=u(f,i),d=u(h,n),p=u(h,i),v=a+(65535&c),y=s+o+(v>>>16)+(c>>>16)+(65535&g)+(65535&d);o=(a=(g>>>16)+(d>>>16)+(65535&p)+(y>>>16))>>>16,a&=65535,s=p>>>16,this.__setDigit(_,65535&v|y<<16)}if(0!==o||0!==a||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(t,e,r){for(var n,i=0,o=0;o>>16,this.__setHalfDigit(e+o,n);return i}},{key:"__inplaceSub",value:function(t,e,r){var n=0;if(1&e){e>>=1;for(var i=this.__digit(e),o=65535&i,a=0;a>>1;a++){var s=t.__digit(a),u=(i>>>16)-(65535&s)-n;n=1&u>>>16,this.__setDigit(e+a,u<<16|65535&o),n=1&(o=(65535&(i=this.__digit(e+a+1)))-(s>>>16)-n)>>>16}var _=t.__digit(a),l=(i>>>16)-(65535&_)-n;if(n=1&l>>>16,this.__setDigit(e+a,l<<16|65535&o),e+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(65535&(i=this.__digit(e+a+1)))-(_>>>16)-n)>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;for(var f=0;f>>16)-(c>>>16)-(n=1&g>>>16);n=1&d>>>16,this.__setDigit(e+f,d<<16|65535&g)}var p=this.__digit(e+f),v=t.__digit(f),y=(65535&p)-(65535&v)-n;n=1&y>>>16;var b=0;0==(1&r)&&(n=1&(b=(p>>>16)-(v>>>16)-n)>>>16),this.__setDigit(e+f,b<<16|65535&y)}return n}},{key:"__inplaceRightShift",value:function(t){if(0!==t){for(var e,r=this.__digit(0)>>>t,n=this.length-1,i=0;i>>t;this.__setDigit(n,r)}}},{key:"__digit",value:function(t){return this[t]}},{key:"__unsignedDigit",value:function(t){return this[t]>>>0}},{key:"__setDigit",value:function(t,e){this[t]=0|e}},{key:"__setDigitGrow",value:function(t,e){this[t]=0|e}},{key:"__halfDigitLength",value:function(){var t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}},{key:"__halfDigit",value:function(t){return 65535&this[t>>>1]>>>((1&t)<<4)}},{key:"__setHalfDigit",value:function(t,e){var r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}}],[{key:"BigInt",value:function(e){var r=Math.floor,n=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if((0|e)===e)return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!n(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var i=l.__fromString(e);if(null===i)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return i}if("boolean"==typeof e)return!0===e?l.__oneDigit(1,!1):l.__zero();if("object"===t(e)){if(e.constructor===l)return e;var o=l.__toPrimitive(e);return l.BigInt(o)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(t){var e=t.length;if(0===e)return 0;if(1===e){var r=t.__unsignedDigit(0);return t.sign?-r:r}var n=t.__digit(e-1),i=_(n),o=32*e-i;if(1024>>=12;var c=f-12,g=12<=f?0:s<<20+f,d=20+f;0>>32-c,g=s<>>32-d,d-=32);var p=l.__decideRounding(t,d,u,s);if((1===p||0===p&&1==(1&g))&&0==(g=g+1>>>0)&&0!=++h>>>20&&(h=0,1023<++a))return t.sign?-1/0:1/0;var v=t.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=v|a|h,l.__kBitConversionInts[0]=g,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(t){if(0===t.length)return t;var e=t.__copy();return e.sign=!t.sign,e}},{key:"bitwiseNot",value:function(t){return t.sign?l.__absoluteSubOne(t).__trim():l.__absoluteAddOne(t,!0)}},{key:"exponentiate",value:function(t,e){if(e.sign)throw new RangeError("Exponent must be positive");if(0===e.length)return l.__oneDigit(1,!1);if(0===t.length)return t;if(1===t.length&&1===t.__digit(0))return t.sign&&0==(1&e.__digit(0))?l.unaryMinus(t):t;if(1=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){var n=1+(r>>>5),i=new l(n,t.sign&&0!=(1&r));i.__initializeDigits();var o=1<<(31&r);return i.__setDigit(n-1,o),i}var a=null,s=t;for(0!=(1&r)&&(a=t),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(t,e){if(0===t.length)return t;if(0===e.length)return e;var r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;var n=new l(r,t.sign!==e.sign);n.__initializeDigits();for(var i=0;il.__absoluteCompare(t,e))return l.__zero();var r,n=t.sign!==e.sign,i=e.__unsignedDigit(0);if(1===e.length&&65535>=i){if(1===i)return n===t.sign?t:l.unaryMinus(t);r=l.__absoluteDivSmall(t,i,null)}else r=l.__absoluteDivLarge(t,e,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(t,e))return t;var r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(t,r);return 0===n?l.__zero():l.__oneDigit(n,t.sign)}var i=l.__absoluteDivLarge(t,e,!1,!0);return i.sign=t.sign,i.__trim()}},{key:"add",value:function(t,e){var r=t.sign;return r===e.sign?l.__absoluteAdd(t,e,r):0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r)}},{key:"subtract",value:function(t,e){var r=t.sign;return r===e.sign?0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r):l.__absoluteAdd(t,e,r)}},{key:"leftShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__rightShiftByAbsolute(t,e):l.__leftShiftByAbsolute(t,e)}},{key:"signedRightShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__leftShiftByAbsolute(t,e):l.__rightShiftByAbsolute(t,e)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(t,e){return 0>l.__compareToBigInt(t,e)}},{key:"lessThanOrEqual",value:function(t,e){return 0>=l.__compareToBigInt(t,e)}},{key:"greaterThan",value:function(t,e){return 0=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.lengthl.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.length>>n)return e}return l.__truncateToNBits(t,e)}},{key:"ADD",value:function(t,e){if(t=l.__toPrimitive(t),e=l.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)&&l.__isBigInt(e))return l.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(t,e){return l.__compare(t,e,0)}},{key:"LE",value:function(t,e){return l.__compare(t,e,1)}},{key:"GT",value:function(t,e){return l.__compare(t,e,2)}},{key:"GE",value:function(t,e){return l.__compare(t,e,3)}},{key:"EQ",value:function(e,r){for(;;){if(l.__isBigInt(e))return l.__isBigInt(r)?l.equal(e,r):l.EQ(r,e);if("number"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("string"==typeof e){if(l.__isBigInt(r))return null!==(e=l.__fromString(e))&&l.equal(e,r);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("boolean"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,+e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("symbol"===t(e)){if(l.__isBigInt(r))return!1;if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else{if("object"!==t(e))return e==r;if("object"===t(r)&&r.constructor!==l)return e==r;e=l.__toPrimitive(e)}}}},{key:"NE",value:function(t,e){return!l.EQ(t,e)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(t,e){var r=new l(1,e);return r.__setDigit(0,t),r}},{key:"__decideRounding",value:function(t,e,r,n){if(0e)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}var o=1<>>20)-1023,n=1+(r>>>5),i=new l(n,0>t),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&r,_=0;if(u>>f,o=o<<32-f|a>>>f,a<<=32-f}else if(u===s)_=32,e=o,o=a;else{var h=u-s;_=32-h,e=o<>>32-h,o=a<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}},{key:"__fromString",value:function(t){var e=11073741824/s)return null;var _=new l(31+(s*a+u>>>l.__kBitsPerCharTableShift)>>>5,!1),f=10>e?e:10,h=10>=l.__kBitsPerCharTableShift;var c=[],g=[],d=!1;do{for(var p,v=0,y=0;;){if(p=void 0,o-48>>>0>>0>>0>>0>>l.__kBitsPerCharTableShift+5;_.__inplaceMultiplyAdd(D,k,P)}while(!b)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i>>u-(o-=32))}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=e-1,a=t.__digit(r-1),s=0|(32*r-_(a)+i-1)/i;if(t.sign&&s++,268435456>>v,c=32-v;c>=i;)u[f--]=l.__kConversionChars[h&o],h>>>=i,c-=i}var y=(h|a<>>i-c;0!==h;)u[f--]=l.__kConversionChars[h&o],h>>>=i;if(t.sign&&(u[f--]="-"),-1!==f)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(t,e,r){var n=t.length;if(0===n)return"";if(1===n){var i=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(i="-"+i),i}var o,a,s=32*n-_(t.__digit(n-1)),u=l.__kMaxBitsPerChar[e]-1,f=s*l.__kBitsPerCharTableMultiplier,h=1+(f=0|(f+=u-1)/u)>>1,c=l.exponentiate(l.__oneDigit(e,!1),l.__oneDigit(h,!1)),g=c.__unsignedDigit(0);if(1===c.length&&65535>=g){(o=new l(t.length,!1)).__initializeDigits();for(var d,p=0,v=2*t.length-1;0<=v;v--)d=p<<16|t.__halfDigit(v),o.__setHalfDigit(v,0|d/g),p=0|d%g;a=p.toString(e)}else{var y=l.__absoluteDivLarge(t,c,!0,!0);o=y.quotient;var b=y.remainder.__trim();a=l.__toStringGeneric(b,e,!0)}o.__trim();for(var m=l.__toStringGeneric(o,e,!0);a.lengthn?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(t,e){if(!0|e){var r=t.sign,n=0>e;if(r!==n)return l.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?l.__absoluteGreater(r):oe)return l.__unequalSign(r);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;l.__kBitConversionDouble[0]=e;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=t.length,a=t.__digit(o-1),s=_(a),u=32*o-s,f=i+1;if(uf)return l.__absoluteGreater(r);var h=1048576|1048575&l.__kBitConversionInts[1],c=l.__kBitConversionInts[0],g=20,d=31-s;if(d!==(u-1)%31)throw new Error("implementation bug");var p,v=0;if(d>>y,h=h<<32-y|c>>>y,c<<=32-y}else if(d===g)v=32,p=h,h=c;else{var b=d-g;v=32-b,p=h<>>32-b,h=c<>>=0)>(p>>>=0))return l.__absoluteGreater(r);if(a>>0,h=c,c=0):p=0;var w=t.__unsignedDigit(m);if(w>p)return l.__absoluteGreater(r);if(we&&t.__unsignedDigit(0)===a(e):0===l.__compareToDouble(t,e)}},{key:"__comparisonResultToBool",value:function(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(l.__isBigInt(t)&&"string"==typeof e)return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("string"==typeof t&&l.__isBigInt(e))return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)){if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}},{key:"__absoluteAdd",value:function(t,e,r){if(t.length>>16)+(s>>>16)+(_>>>16);o=f>>>16,i.__setDigit(a,65535&_|f<<16)}for(;a>>16)+(c>>>16);o=g>>>16,i.__setDigit(a,65535&c|g<<16)}return a>>16)-(s>>>16)-(i=1&u>>>16);i=1&_>>>16,n.__setDigit(o,65535&u|_<<16)}for(;o>>16)-(i=1&h>>>16);i=1&c>>>16,n.__setDigit(o,65535&h|c<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(t,e){var r=2n?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(t,e,r,n){if(0!==e){for(var i=65535&e,o=e>>>16,a=0,s=0,_=0,l=0;l>>16,g=t.__digit(l),d=65535&g,p=g>>>16,v=u(d,i),y=u(d,o),b=u(p,i),m=u(p,o);a=(s=(y>>>16)+(b>>>16)+(65535&m)+(a=(c+=_+a+((h+=s+(65535&v))>>>16)+(v>>>16)+(65535&y)+(65535&b))>>>16))>>>16,s&=65535,_=m>>>16,f=65535&h|c<<16,r.__setDigit(n,f)}for(;0!==a||0!==s||0!==_;n++){var w=r.__digit(n),k=(65535&w)+s,D=(w>>>16)+(k>>>16)+_+a;s=0,_=0,a=D>>>16,w=65535&k|D<<16,r.__setDigit(n,w)}}}},{key:"__internalMultiplyAdd",value:function(t,e,r,n,i){for(var o=r,a=0,s=0;s>>16;var h=u(_>>>16,e),c=(65535&h)+(l>>>16)+o;o=c>>>16,a=h>>>16,i.__setDigit(s,c<<16|65535&f)}if(i.length>n)for(i.__setDigit(n++,o+a);n>>0,a=0|o/e,s=0|(o=((n=0|o%e)<<16|t.__halfDigit(i-1))>>>0)/e;n=0|o%e,r.__setDigit(i>>>1,a<<16|s)}return r}},{key:"__absoluteModSmall",value:function(t,e){for(var r=0,n=2*t.length-1;0<=n;n--)r=0|((r<<16|t.__halfDigit(n))>>>0)%e;return r}},{key:"__absoluteDivLarge",value:function(t,e,r,n){var i=e.__halfDigitLength(),o=e.length,a=t.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var _=new l(i+2>>>1,!1);_.__initializeDigits();var f=l.__clz16(e.__halfDigit(i-1));0>>0;p=0|y/c;for(var b=0|y%c,m=e.__halfDigit(i-2),w=h.__halfDigit(d+i-2);u(p,m)>>>0>(b<<16|w)>>>0&&(p--,!(65535<(b+=c))););}l.__internalMultiplyAdd(e,p,0,o,_);var k=h.__inplaceSub(_,d,i+1);0!==k&&(k=h.__inplaceAdd(e,d,i),h.__setHalfDigit(d+i,h.__halfDigit(d+i)+k),p--),r&&(1&d?g=p<<16:s.__setDigit(d>>>1,g|p))}return n?(h.__inplaceRightShift(f),r?{quotient:s,remainder:h}:h):r?s:void 0}},{key:"__clz16",value:function(t){return _(t)-16}},{key:"__specialLeftShift",value:function(t,e,r){var n=t.length,i=new l(n+r,!1);if(0===e){for(var o=0;o>>32-e;return 0r)throw new RangeError("BigInt too big");var n=r>>>5,i=31&r,o=t.length,a=0!==i&&0!=t.__digit(o-1)>>>32-i,s=o+n+(a?1:0),u=new l(s,t.sign);if(0===i){for(var _=0;_>>32-i;if(a)u.__setDigit(o+n,f);else if(0!==f)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(t,e){var r=t.length,n=t.sign,i=l.__toShiftAmount(e);if(0>i)return l.__rightShiftByMaximum(n);var o=i>>>5,a=31&i,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(t.__digit(o)&(1<>>a,d=r-o-1,p=0;p>>a;f.__setDigit(d,g)}return u&&(f=l.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:"__rightShiftByMaximum",value:function(t){return t?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(t){if(1l.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(e){var r=1>>5,n=new l(r,e.sign),i=r-1,o=0;o>>s}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(t,e,r){for(var n=Math.min,i=t+31>>>5,o=new l(i,r),a=0,s=i-1,u=0,_=n(s,e.length);a<_;a++){var f=e.__digit(a),h=0-(65535&f)-u,c=0-(f>>>16)-(u=1&h>>>16);u=1&c>>>16,o.__setDigit(a,65535&h|c<<16)}for(;a>>16)-(u=1&v>>>16)<<16}else{var y=32-p,b=1<<32-y,m=(65535&b)-(65535&(d=d<>>y))-u;g=65535&m|(b>>>16)-(d>>>16)-(u=1&m>>>16)<<16,g&=b-1}return o.__setDigit(s,g),o.__trim()}},{key:"__digitPow",value:function(t,e){for(var r=1;0>>=1,t*=t;return r}}]),l}(l(Array));return c.__kMaxLength=33554432,c.__kMaxLengthBits=c.__kMaxLength<<5,c.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],c.__kBitsPerCharTableShift=5,c.__kBitsPerCharTableMultiplier=1<a)throw new Error(s);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(s);if(u.find(t=>!n.includes(t)))throw new Error(s)}function s(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function u(t,e){if(s(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function _(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function l(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(a(r,t,["code_hash","hash_type","args"],[]),u(r+".code_hash",t.code_hash),s(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function f(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){a(r,t,["tx_hash","index"],[]),u(r+".tx_hash",t.tx_hash),_(r+".index",t.index)}function h(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){a(r,t,["since","previous_output"],[]),_(r+".since",t.since),e&&f(t.previous_output,{debugPath:r+".previous_output"})}function c(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){a(r,t,["capacity","lock"],["type"]),_(r+".capacity",t.capacity),e&&(l(t.lock,{debugPath:r+".lock"}),t.type&&l(t.type,{debugPath:r+".type"}))}function g(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(a(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&f(t.out_point,{debugPath:r+".out_point"})}function d(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}}var S=i((function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:n);!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function _(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];w.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function D(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}D.polyfill=!0,t.fetch||(t.fetch=D,t.Headers=h,t.Request=b,t.Response=w),e.Headers=h,e.Request=b,e.Response=w,e.fetch=D}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}));function x(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const O={get:(t,e,r)=>"send"===e?async()=>{const e=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},C={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},O):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class I{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,C)}static create(t){return new I(t)}}function j(t){return o.BigInt(t)}function R(t){return"0x"+t.toString(16)}function z(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=R(o.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&n.byteLength!==t)throw new Error(`${e} has invalid length ${n.byteLength}, required: ${t}`);return n}}function N(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function L(t,{debugPath:e="script"}={}){return N(e,t,{code_hash:M(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:M(-1)})}function U(t,{debugPath:e="out_point"}={}){return N(e,t,{tx_hash:M(32),index:z(4)})}function q(t){return function(e,r){return t(r,{debugPath:e})}}function V(t,{debugPath:e="cell_input"}={}){return N(e,t,{since:z(8),previous_output:q(U)})}function $(t,{debugPath:e="cell_output"}={}){const r=N(e,t,{capacity:z(8),lock:q(L)});return t.type&&(r.type_=L(t.type,{debugPath:e+".type"})),r}function F(t,{debugPath:e="cell_dep"}={}){return N(e,t,{out_point:q(U),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function G(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function H(t,{debugPath:e="raw_transaction"}={}){return N(e,t,{version:z(4),cell_deps:G(q(F)),header_deps:G(M(32)),inputs:G(q(V)),outputs:G(q($)),outputs_data:G(M(-1))})}function W(t,{debugPath:e="transaction"}={}){const r=H(t,{debugPath:"(raw)"+e}),n=N(e,t,{witnesses:G(M(-1))});return n.raw=r,n}function J(t,{debugPath:e="raw_header"}={}){return N(e,t,{version:z(4),compact_target:z(4),timestamp:z(8),number:z(8),epoch:z(8),parent_hash:M(32),transactions_root:M(32),proposals_hash:M(32),uncles_hash:M(32),dao:M(32)})}function X(t,{debugPath:e="header"}={}){const r=J(t,{debugPath:"(raw)"+e}),n=N(e,t,{nonce:z(16)});return n.raw=r,n}function Q(t,{debugPath:e="uncle_block"}={}){return N(e,t,{header:q(X),proposals:G(M(10))})}var K=Object.freeze({__proto__:null,NormalizeScript:L,NormalizeOutPoint:U,NormalizeCellInput:V,NormalizeCellOutput:$,NormalizeCellDep:F,NormalizeRawTransaction:H,NormalizeTransaction:W,NormalizeRawHeader:J,NormalizeHeader:X,NormalizeUncleBlock:Q,NormalizeBlock:function(t,{debugPath:e="block"}={}){return N(e,t,{header:q(X),uncles:G(q(Q)),transactions:G(q(W)),proposals:G(M(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return N(e,t,{lock:q(L),message:M(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=M(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=M(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=M(-1)(e+".output_type",t.output_type)),r}});function Y(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Z(t,e,r){if(!((e=Y(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function tt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Z(r,t,{code_hash:Y,hash_type:Y,args:Y}),e&&l(t,{debugPath:"(transformed) "+r}),t}function et(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Z(r,t,{tx_hash:Y,index:Y}),e&&f(t,{debugPath:"(transformed) "+r}),t}function rt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function nt(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Z(r,t,{since:Y,previous_output:rt(et)}),e&&h(t,{debugPath:"(transformed) "+r}),t}function it(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Z(r,t,{capacity:Y,lock:rt(tt),type:rt(tt)}),e&&c(t,{debugPath:"(transformed) "+r}),t}function ot(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Z(r,t,{out_point:rt(et),dep_type:Y}),e&&g(t,{debugPath:"(transformed) "+r}),t}function at(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function st(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y),witnesses:at(Y)}),e&&b(t,{debugPath:"(transformed) "+r}),t}function ut(t,{validation:e=!0,debugPath:r="header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y,nonce:Y}),e&&w(t,{debugPath:"(transformed) "+r}),t}function _t(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Z(r,t,{header:rt(ut),proposals:at(Y)}),e&&D(t,{debugPath:"(transformed) "+r}),t}var lt=Object.freeze({__proto__:null,TransformScript:tt,TransformOutPoint:et,TransformCellInput:nt,TransformCellOutput:it,TransformCellDep:ot,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y)}),e&&y(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:st,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y}),e&&m(t,{debugPath:"(transformed) "+r}),t},TransformHeader:ut,TransformUncleBlock:_t,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Z(r,t,{header:rt(ut),uncles:at(rt(_t)),transactions:at(rt(st)),proposals:at(Y)}),e&&B(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Z(r,t,{lock:rt(tt),message:Y}),e&&P(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Z(r,t,{lock:Y,input_type:Y,output_type:Y}),e&&A(t,{debugPath:"(transformed) "+r}),t}});var ft=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:n=!0,loadData:i=!1,loadBlockNumber:o=!0}={}){this.rpc=t,this.lockHash=new r(e).serializeJson(),this.skipCellWithContent=n,this.loadData=i,this.loadBlockNumber=o}async*collect(){const t=j(await this.rpc.get_tip_block_number());let e=o.BigInt(0);for(;o.lessThanOrEqual(e,t);){let r=o.add(e,o.BigInt(100));o.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,R(e),R(r));for(const t of n){if(this.skipCellWithContent&&(t.type||o.greaterThan(j(t.output_data_len),o.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=o.add(r,o.BigInt(1))}}}});const ht="0.10.2";export{R as BigIntToHexString,j as HexStringToBigInt,I as RPC,r as Reader,E as TransactionDumper,ht as VERSION,ft as cell_collectors,K as normalizers,lt as transformers,T as validators}; +class t{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class e{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(t,r)}return new t(r)}}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function i(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var o=i((function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r,n=0;nl.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=h(this,o(l).call(this,t))).sign=r,n}return i(l,r),n(l,[{key:"toDebugString",value:function(){var t=["BigInt["],e=!0,r=!1,n=void 0;try{for(var i,o,a=this[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)o=i.value,t.push((o?(o>>>0).toString(16):o)+", ")}catch(t){r=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw n}}return t.push("]"),t.join("")}},{key:"toString",value:function(){var t=0t||36this.length&&(r=this.length);for(var n=65535&t,i=t>>>16,o=0,a=65535&e,s=e>>>16,_=0;_>>16,c=u(f,n),g=u(f,i),d=u(h,n),p=u(h,i),v=a+(65535&c),y=s+o+(v>>>16)+(c>>>16)+(65535&g)+(65535&d);o=(a=(g>>>16)+(d>>>16)+(65535&p)+(y>>>16))>>>16,a&=65535,s=p>>>16,this.__setDigit(_,65535&v|y<<16)}if(0!==o||0!==a||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(t,e,r){for(var n,i=0,o=0;o>>16,this.__setHalfDigit(e+o,n);return i}},{key:"__inplaceSub",value:function(t,e,r){var n=0;if(1&e){e>>=1;for(var i=this.__digit(e),o=65535&i,a=0;a>>1;a++){var s=t.__digit(a),u=(i>>>16)-(65535&s)-n;n=1&u>>>16,this.__setDigit(e+a,u<<16|65535&o),n=1&(o=(65535&(i=this.__digit(e+a+1)))-(s>>>16)-n)>>>16}var _=t.__digit(a),l=(i>>>16)-(65535&_)-n;if(n=1&l>>>16,this.__setDigit(e+a,l<<16|65535&o),e+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(65535&(i=this.__digit(e+a+1)))-(_>>>16)-n)>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;for(var f=0;f>>16)-(c>>>16)-(n=1&g>>>16);n=1&d>>>16,this.__setDigit(e+f,d<<16|65535&g)}var p=this.__digit(e+f),v=t.__digit(f),y=(65535&p)-(65535&v)-n;n=1&y>>>16;var b=0;0==(1&r)&&(n=1&(b=(p>>>16)-(v>>>16)-n)>>>16),this.__setDigit(e+f,b<<16|65535&y)}return n}},{key:"__inplaceRightShift",value:function(t){if(0!==t){for(var e,r=this.__digit(0)>>>t,n=this.length-1,i=0;i>>t;this.__setDigit(n,r)}}},{key:"__digit",value:function(t){return this[t]}},{key:"__unsignedDigit",value:function(t){return this[t]>>>0}},{key:"__setDigit",value:function(t,e){this[t]=0|e}},{key:"__setDigitGrow",value:function(t,e){this[t]=0|e}},{key:"__halfDigitLength",value:function(){var t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}},{key:"__halfDigit",value:function(t){return 65535&this[t>>>1]>>>((1&t)<<4)}},{key:"__setHalfDigit",value:function(t,e){var r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}}],[{key:"BigInt",value:function(e){var r=Math.floor,n=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if((0|e)===e)return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!n(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var i=l.__fromString(e);if(null===i)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return i}if("boolean"==typeof e)return!0===e?l.__oneDigit(1,!1):l.__zero();if("object"===t(e)){if(e.constructor===l)return e;var o=l.__toPrimitive(e);return l.BigInt(o)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(t){var e=t.length;if(0===e)return 0;if(1===e){var r=t.__unsignedDigit(0);return t.sign?-r:r}var n=t.__digit(e-1),i=_(n),o=32*e-i;if(1024>>=12;var c=f-12,g=12<=f?0:s<<20+f,d=20+f;0>>32-c,g=s<>>32-d,d-=32);var p=l.__decideRounding(t,d,u,s);if((1===p||0===p&&1==(1&g))&&0==(g=g+1>>>0)&&0!=++h>>>20&&(h=0,1023<++a))return t.sign?-1/0:1/0;var v=t.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=v|a|h,l.__kBitConversionInts[0]=g,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(t){if(0===t.length)return t;var e=t.__copy();return e.sign=!t.sign,e}},{key:"bitwiseNot",value:function(t){return t.sign?l.__absoluteSubOne(t).__trim():l.__absoluteAddOne(t,!0)}},{key:"exponentiate",value:function(t,e){if(e.sign)throw new RangeError("Exponent must be positive");if(0===e.length)return l.__oneDigit(1,!1);if(0===t.length)return t;if(1===t.length&&1===t.__digit(0))return t.sign&&0==(1&e.__digit(0))?l.unaryMinus(t):t;if(1=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){var n=1+(r>>>5),i=new l(n,t.sign&&0!=(1&r));i.__initializeDigits();var o=1<<(31&r);return i.__setDigit(n-1,o),i}var a=null,s=t;for(0!=(1&r)&&(a=t),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(t,e){if(0===t.length)return t;if(0===e.length)return e;var r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;var n=new l(r,t.sign!==e.sign);n.__initializeDigits();for(var i=0;il.__absoluteCompare(t,e))return l.__zero();var r,n=t.sign!==e.sign,i=e.__unsignedDigit(0);if(1===e.length&&65535>=i){if(1===i)return n===t.sign?t:l.unaryMinus(t);r=l.__absoluteDivSmall(t,i,null)}else r=l.__absoluteDivLarge(t,e,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(t,e))return t;var r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(t,r);return 0===n?l.__zero():l.__oneDigit(n,t.sign)}var i=l.__absoluteDivLarge(t,e,!1,!0);return i.sign=t.sign,i.__trim()}},{key:"add",value:function(t,e){var r=t.sign;return r===e.sign?l.__absoluteAdd(t,e,r):0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r)}},{key:"subtract",value:function(t,e){var r=t.sign;return r===e.sign?0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r):l.__absoluteAdd(t,e,r)}},{key:"leftShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__rightShiftByAbsolute(t,e):l.__leftShiftByAbsolute(t,e)}},{key:"signedRightShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__leftShiftByAbsolute(t,e):l.__rightShiftByAbsolute(t,e)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(t,e){return 0>l.__compareToBigInt(t,e)}},{key:"lessThanOrEqual",value:function(t,e){return 0>=l.__compareToBigInt(t,e)}},{key:"greaterThan",value:function(t,e){return 0=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.lengthl.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.length>>n)return e}return l.__truncateToNBits(t,e)}},{key:"ADD",value:function(t,e){if(t=l.__toPrimitive(t),e=l.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)&&l.__isBigInt(e))return l.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(t,e){return l.__compare(t,e,0)}},{key:"LE",value:function(t,e){return l.__compare(t,e,1)}},{key:"GT",value:function(t,e){return l.__compare(t,e,2)}},{key:"GE",value:function(t,e){return l.__compare(t,e,3)}},{key:"EQ",value:function(e,r){for(;;){if(l.__isBigInt(e))return l.__isBigInt(r)?l.equal(e,r):l.EQ(r,e);if("number"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("string"==typeof e){if(l.__isBigInt(r))return null!==(e=l.__fromString(e))&&l.equal(e,r);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("boolean"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,+e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("symbol"===t(e)){if(l.__isBigInt(r))return!1;if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else{if("object"!==t(e))return e==r;if("object"===t(r)&&r.constructor!==l)return e==r;e=l.__toPrimitive(e)}}}},{key:"NE",value:function(t,e){return!l.EQ(t,e)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(t,e){var r=new l(1,e);return r.__setDigit(0,t),r}},{key:"__decideRounding",value:function(t,e,r,n){if(0e)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}var o=1<>>20)-1023,n=1+(r>>>5),i=new l(n,0>t),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&r,_=0;if(u>>f,o=o<<32-f|a>>>f,a<<=32-f}else if(u===s)_=32,e=o,o=a;else{var h=u-s;_=32-h,e=o<>>32-h,o=a<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}},{key:"__fromString",value:function(t){var e=11073741824/s)return null;var _=new l(31+(s*a+u>>>l.__kBitsPerCharTableShift)>>>5,!1),f=10>e?e:10,h=10>=l.__kBitsPerCharTableShift;var c=[],g=[],d=!1;do{for(var p,v=0,y=0;;){if(p=void 0,o-48>>>0>>0>>0>>0>>l.__kBitsPerCharTableShift+5;_.__inplaceMultiplyAdd(D,k,P)}while(!b)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i>>u-(o-=32))}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=e-1,a=t.__digit(r-1),s=0|(32*r-_(a)+i-1)/i;if(t.sign&&s++,268435456>>v,c=32-v;c>=i;)u[f--]=l.__kConversionChars[h&o],h>>>=i,c-=i}var y=(h|a<>>i-c;0!==h;)u[f--]=l.__kConversionChars[h&o],h>>>=i;if(t.sign&&(u[f--]="-"),-1!==f)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(t,e,r){var n=t.length;if(0===n)return"";if(1===n){var i=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(i="-"+i),i}var o,a,s=32*n-_(t.__digit(n-1)),u=l.__kMaxBitsPerChar[e]-1,f=s*l.__kBitsPerCharTableMultiplier,h=1+(f=0|(f+=u-1)/u)>>1,c=l.exponentiate(l.__oneDigit(e,!1),l.__oneDigit(h,!1)),g=c.__unsignedDigit(0);if(1===c.length&&65535>=g){(o=new l(t.length,!1)).__initializeDigits();for(var d,p=0,v=2*t.length-1;0<=v;v--)d=p<<16|t.__halfDigit(v),o.__setHalfDigit(v,0|d/g),p=0|d%g;a=p.toString(e)}else{var y=l.__absoluteDivLarge(t,c,!0,!0);o=y.quotient;var b=y.remainder.__trim();a=l.__toStringGeneric(b,e,!0)}o.__trim();for(var m=l.__toStringGeneric(o,e,!0);a.lengthn?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(t,e){if(!0|e){var r=t.sign,n=0>e;if(r!==n)return l.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?l.__absoluteGreater(r):oe)return l.__unequalSign(r);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;l.__kBitConversionDouble[0]=e;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=t.length,a=t.__digit(o-1),s=_(a),u=32*o-s,f=i+1;if(uf)return l.__absoluteGreater(r);var h=1048576|1048575&l.__kBitConversionInts[1],c=l.__kBitConversionInts[0],g=20,d=31-s;if(d!==(u-1)%31)throw new Error("implementation bug");var p,v=0;if(d>>y,h=h<<32-y|c>>>y,c<<=32-y}else if(d===g)v=32,p=h,h=c;else{var b=d-g;v=32-b,p=h<>>32-b,h=c<>>=0)>(p>>>=0))return l.__absoluteGreater(r);if(a>>0,h=c,c=0):p=0;var w=t.__unsignedDigit(m);if(w>p)return l.__absoluteGreater(r);if(we&&t.__unsignedDigit(0)===a(e):0===l.__compareToDouble(t,e)}},{key:"__comparisonResultToBool",value:function(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(l.__isBigInt(t)&&"string"==typeof e)return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("string"==typeof t&&l.__isBigInt(e))return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)){if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}},{key:"__absoluteAdd",value:function(t,e,r){if(t.length>>16)+(s>>>16)+(_>>>16);o=f>>>16,i.__setDigit(a,65535&_|f<<16)}for(;a>>16)+(c>>>16);o=g>>>16,i.__setDigit(a,65535&c|g<<16)}return a>>16)-(s>>>16)-(i=1&u>>>16);i=1&_>>>16,n.__setDigit(o,65535&u|_<<16)}for(;o>>16)-(i=1&h>>>16);i=1&c>>>16,n.__setDigit(o,65535&h|c<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(t,e){var r=2n?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(t,e,r,n){if(0!==e){for(var i=65535&e,o=e>>>16,a=0,s=0,_=0,l=0;l>>16,g=t.__digit(l),d=65535&g,p=g>>>16,v=u(d,i),y=u(d,o),b=u(p,i),m=u(p,o);a=(s=(y>>>16)+(b>>>16)+(65535&m)+(a=(c+=_+a+((h+=s+(65535&v))>>>16)+(v>>>16)+(65535&y)+(65535&b))>>>16))>>>16,s&=65535,_=m>>>16,f=65535&h|c<<16,r.__setDigit(n,f)}for(;0!==a||0!==s||0!==_;n++){var w=r.__digit(n),k=(65535&w)+s,D=(w>>>16)+(k>>>16)+_+a;s=0,_=0,a=D>>>16,w=65535&k|D<<16,r.__setDigit(n,w)}}}},{key:"__internalMultiplyAdd",value:function(t,e,r,n,i){for(var o=r,a=0,s=0;s>>16;var h=u(_>>>16,e),c=(65535&h)+(l>>>16)+o;o=c>>>16,a=h>>>16,i.__setDigit(s,c<<16|65535&f)}if(i.length>n)for(i.__setDigit(n++,o+a);n>>0,a=0|o/e,s=0|(o=((n=0|o%e)<<16|t.__halfDigit(i-1))>>>0)/e;n=0|o%e,r.__setDigit(i>>>1,a<<16|s)}return r}},{key:"__absoluteModSmall",value:function(t,e){for(var r=0,n=2*t.length-1;0<=n;n--)r=0|((r<<16|t.__halfDigit(n))>>>0)%e;return r}},{key:"__absoluteDivLarge",value:function(t,e,r,n){var i=e.__halfDigitLength(),o=e.length,a=t.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var _=new l(i+2>>>1,!1);_.__initializeDigits();var f=l.__clz16(e.__halfDigit(i-1));0>>0;p=0|y/c;for(var b=0|y%c,m=e.__halfDigit(i-2),w=h.__halfDigit(d+i-2);u(p,m)>>>0>(b<<16|w)>>>0&&(p--,!(65535<(b+=c))););}l.__internalMultiplyAdd(e,p,0,o,_);var k=h.__inplaceSub(_,d,i+1);0!==k&&(k=h.__inplaceAdd(e,d,i),h.__setHalfDigit(d+i,h.__halfDigit(d+i)+k),p--),r&&(1&d?g=p<<16:s.__setDigit(d>>>1,g|p))}return n?(h.__inplaceRightShift(f),r?{quotient:s,remainder:h}:h):r?s:void 0}},{key:"__clz16",value:function(t){return _(t)-16}},{key:"__specialLeftShift",value:function(t,e,r){var n=t.length,i=new l(n+r,!1);if(0===e){for(var o=0;o>>32-e;return 0r)throw new RangeError("BigInt too big");var n=r>>>5,i=31&r,o=t.length,a=0!==i&&0!=t.__digit(o-1)>>>32-i,s=o+n+(a?1:0),u=new l(s,t.sign);if(0===i){for(var _=0;_>>32-i;if(a)u.__setDigit(o+n,f);else if(0!==f)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(t,e){var r=t.length,n=t.sign,i=l.__toShiftAmount(e);if(0>i)return l.__rightShiftByMaximum(n);var o=i>>>5,a=31&i,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(t.__digit(o)&(1<>>a,d=r-o-1,p=0;p>>a;f.__setDigit(d,g)}return u&&(f=l.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:"__rightShiftByMaximum",value:function(t){return t?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(t){if(1l.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(e){var r=1>>5,n=new l(r,e.sign),i=r-1,o=0;o>>s}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(t,e,r){for(var n=Math.min,i=t+31>>>5,o=new l(i,r),a=0,s=i-1,u=0,_=n(s,e.length);a<_;a++){var f=e.__digit(a),h=0-(65535&f)-u,c=0-(f>>>16)-(u=1&h>>>16);u=1&c>>>16,o.__setDigit(a,65535&h|c<<16)}for(;a>>16)-(u=1&v>>>16)<<16}else{var y=32-p,b=1<<32-y,m=(65535&b)-(65535&(d=d<>>y))-u;g=65535&m|(b>>>16)-(d>>>16)-(u=1&m>>>16)<<16,g&=b-1}return o.__setDigit(s,g),o.__trim()}},{key:"__digitPow",value:function(t,e){for(var r=1;0>>=1,t*=t;return r}}]),l}(l(Array));return c.__kMaxLength=33554432,c.__kMaxLengthBits=c.__kMaxLength<<5,c.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],c.__kBitsPerCharTableShift=5,c.__kBitsPerCharTableMultiplier=1<a)throw new Error(s);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(s);if(u.find(t=>!n.includes(t)))throw new Error(s)}function s(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function u(t,e){if(s(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function _(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function l(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(a(r,t,["code_hash","hash_type","args"],[]),u(r+".code_hash",t.code_hash),s(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function f(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){a(r,t,["tx_hash","index"],[]),u(r+".tx_hash",t.tx_hash),_(r+".index",t.index)}function h(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){a(r,t,["since","previous_output"],[]),_(r+".since",t.since),e&&f(t.previous_output,{debugPath:r+".previous_output"})}function c(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){a(r,t,["capacity","lock"],["type"]),_(r+".capacity",t.capacity),e&&(l(t.lock,{debugPath:r+".lock"}),t.type&&l(t.type,{debugPath:r+".type"}))}function g(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(a(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&f(t.out_point,{debugPath:r+".out_point"})}function d(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}}var S=i((function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:n);!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,i="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,a="ArrayBuffer"in t;if(a)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function _(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];w.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function D(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}D.polyfill=!0,t.fetch||(t.fetch=D,t.Headers=h,t.Request=b,t.Response=w),e.Headers=h,e.Request=b,e.Response=w,e.fetch=D}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}));function x(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const O={get:(t,e,r)=>"send"===e?async()=>{const e=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},C={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},O):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class I{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,C)}static create(t){return new I(t)}}function j(t){return o.BigInt(t)}function R(t){return"0x"+t.toString(16)}function z(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=R(o.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&n.byteLength!==t)throw new Error(`${e} has invalid length ${n.byteLength}, required: ${t}`);return n}}function N(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function L(t,{debugPath:e="script"}={}){return N(e,t,{code_hash:M(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:M(-1)})}function U(t,{debugPath:e="out_point"}={}){return N(e,t,{tx_hash:M(32),index:z(4)})}function q(t){return function(e,r){return t(r,{debugPath:e})}}function V(t,{debugPath:e="cell_input"}={}){return N(e,t,{since:z(8),previous_output:q(U)})}function $(t,{debugPath:e="cell_output"}={}){const r=N(e,t,{capacity:z(8),lock:q(L)});return t.type&&(r.type_=L(t.type,{debugPath:e+".type"})),r}function F(t,{debugPath:e="cell_dep"}={}){return N(e,t,{out_point:q(U),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function G(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function H(t,{debugPath:e="raw_transaction"}={}){return N(e,t,{version:z(4),cell_deps:G(q(F)),header_deps:G(M(32)),inputs:G(q(V)),outputs:G(q($)),outputs_data:G(M(-1))})}function W(t,{debugPath:e="transaction"}={}){const r=H(t,{debugPath:"(raw)"+e}),n=N(e,t,{witnesses:G(M(-1))});return n.raw=r,n}function J(t,{debugPath:e="raw_header"}={}){return N(e,t,{version:z(4),compact_target:z(4),timestamp:z(8),number:z(8),epoch:z(8),parent_hash:M(32),transactions_root:M(32),proposals_hash:M(32),extra_hash:M(32),dao:M(32)})}function X(t,{debugPath:e="header"}={}){const r=J(t,{debugPath:"(raw)"+e}),n=N(e,t,{nonce:z(16)});return n.raw=r,n}function Q(t,{debugPath:e="uncle_block"}={}){return N(e,t,{header:q(X),proposals:G(M(10))})}var K=Object.freeze({__proto__:null,NormalizeScript:L,NormalizeOutPoint:U,NormalizeCellInput:V,NormalizeCellOutput:$,NormalizeCellDep:F,NormalizeRawTransaction:H,NormalizeTransaction:W,NormalizeRawHeader:J,NormalizeHeader:X,NormalizeUncleBlock:Q,NormalizeBlock:function(t,{debugPath:e="block"}={}){return N(e,t,{header:q(X),uncles:G(q(Q)),transactions:G(q(W)),proposals:G(M(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return N(e,t,{lock:q(L),message:M(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=M(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=M(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=M(-1)(e+".output_type",t.output_type)),r}});function Y(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Z(t,e,r){if(!((e=Y(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function tt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Z(r,t,{code_hash:Y,hash_type:Y,args:Y}),e&&l(t,{debugPath:"(transformed) "+r}),t}function et(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Z(r,t,{tx_hash:Y,index:Y}),e&&f(t,{debugPath:"(transformed) "+r}),t}function rt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function nt(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Z(r,t,{since:Y,previous_output:rt(et)}),e&&h(t,{debugPath:"(transformed) "+r}),t}function it(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Z(r,t,{capacity:Y,lock:rt(tt),type:rt(tt)}),e&&c(t,{debugPath:"(transformed) "+r}),t}function ot(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Z(r,t,{out_point:rt(et),dep_type:Y}),e&&g(t,{debugPath:"(transformed) "+r}),t}function at(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function st(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y),witnesses:at(Y)}),e&&b(t,{debugPath:"(transformed) "+r}),t}function ut(t,{validation:e=!0,debugPath:r="header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,extra_hash:Y,dao:Y,nonce:Y}),e&&w(t,{debugPath:"(transformed) "+r}),t}function _t(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Z(r,t,{header:rt(ut),proposals:at(Y)}),e&&D(t,{debugPath:"(transformed) "+r}),t}var lt=Object.freeze({__proto__:null,TransformScript:tt,TransformOutPoint:et,TransformCellInput:nt,TransformCellOutput:it,TransformCellDep:ot,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y)}),e&&y(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:st,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,extra_hash:Y,dao:Y}),e&&m(t,{debugPath:"(transformed) "+r}),t},TransformHeader:ut,TransformUncleBlock:_t,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Z(r,t,{header:rt(ut),uncles:at(rt(_t)),transactions:at(rt(st)),proposals:at(Y)}),e&&B(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Z(r,t,{lock:rt(tt),message:Y}),e&&P(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Z(r,t,{lock:Y,input_type:Y,output_type:Y}),e&&A(t,{debugPath:"(transformed) "+r}),t}});var ft=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:n=!0,loadData:i=!1,loadBlockNumber:o=!0}={}){this.rpc=t,this.lockHash=new r(e).serializeJson(),this.skipCellWithContent=n,this.loadData=i,this.loadBlockNumber=o}async*collect(){const t=j(await this.rpc.get_tip_block_number());let e=o.BigInt(0);for(;o.lessThanOrEqual(e,t);){let r=o.add(e,o.BigInt(100));o.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,R(e),R(r));for(const t of n){if(this.skipCellWithContent&&(t.type||o.greaterThan(j(t.output_data_len),o.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=o.add(r,o.BigInt(1))}}}});const ht="0.10.2";export{R as BigIntToHexString,j as HexStringToBigInt,I as RPC,r as Reader,E as TransactionDumper,ht as VERSION,ft as cell_collectors,K as normalizers,lt as transformers,T as validators}; diff --git a/dist/ckb-js-toolkit.node.js b/dist/ckb-js-toolkit.node.js index b02e5d6..73005bb 100644 --- a/dist/ckb-js-toolkit.node.js +++ b/dist/ckb-js-toolkit.node.js @@ -1,2 +1,2 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("stream"),e=require("http"),r=require("url"),n=require("https"),i=require("zlib");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=o(t),a=o(e),u=o(r),l=o(n),c=o(i);class _{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class f{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");r.setUint8(e,n)}return new _(e)}}class g extends Array{constructor(t,e){if(t>g.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");super(t),this.sign=e}static BigInt(t){var e=Math.floor,r=Number.isFinite;if("number"==typeof t){if(0===t)return g.__zero();if((0|t)===t)return 0>t?g.__oneDigit(-t,!0):g.__oneDigit(t,!1);if(!r(t)||e(t)!==t)throw new RangeError("The number "+t+" cannot be converted to BigInt because it is not an integer");return g.__fromDouble(t)}if("string"==typeof t){const e=g.__fromString(t);if(null===e)throw new SyntaxError("Cannot convert "+t+" to a BigInt");return e}if("boolean"==typeof t)return!0===t?g.__oneDigit(1,!1):g.__zero();if("object"==typeof t){if(t.constructor===g)return t;const e=g.__toPrimitive(t);return g.BigInt(e)}throw new TypeError("Cannot convert "+t+" to a BigInt")}toDebugString(){const t=["BigInt["];for(const e of this)t.push((e?(e>>>0).toString(16):e)+", ");return t.push("]"),t.join("")}toString(t=10){if(2>t||36>>=12;const _=l-12;let f=12<=l?0:a<<20+l,h=20+l;0<_&&0>>32-_,f=a<<_,h=_),0>>32-h,h-=32);const d=g.__decideRounding(t,h,u,a);if((1===d||0===d&&1==(1&f))&&(f=f+1>>>0,0==f&&(c++,0!=c>>>20&&(c=0,s++,1023=g.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){const e=1+(r>>>5),n=t.sign&&0!=(1&r),i=new g(e,n);i.__initializeDigits();const o=1<<(31&r);return i.__setDigit(e-1,o),i}let n=null,i=t;for(0!=(1&r)&&(n=t),r>>=1;0!==r;r>>=1)i=g.multiply(i,i),0!=(1&r)&&(n=null===n?i:g.multiply(n,i));return n}static multiply(t,e){if(0===t.length)return t;if(0===e.length)return e;let r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;const n=new g(r,t.sign!==e.sign);n.__initializeDigits();for(let r=0;rg.__absoluteCompare(t,e))return g.__zero();const r=t.sign!==e.sign,n=e.__unsignedDigit(0);let i;if(1===e.length&&65535>=n){if(1===n)return r===t.sign?t:g.unaryMinus(t);i=g.__absoluteDivSmall(t,n,null)}else i=g.__absoluteDivLarge(t,e,!0,!1);return i.sign=r,i.__trim()}static remainder(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>g.__absoluteCompare(t,e))return t;const r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return g.__zero();const e=g.__absoluteModSmall(t,r);return 0===e?g.__zero():g.__oneDigit(e,t.sign)}const n=g.__absoluteDivLarge(t,e,!1,!0);return n.sign=t.sign,n.__trim()}static add(t,e){const r=t.sign;return r===e.sign?g.__absoluteAdd(t,e,r):0<=g.__absoluteCompare(t,e)?g.__absoluteSub(t,e,r):g.__absoluteSub(e,t,!r)}static subtract(t,e){const r=t.sign;return r===e.sign?0<=g.__absoluteCompare(t,e)?g.__absoluteSub(t,e,r):g.__absoluteSub(e,t,!r):g.__absoluteAdd(t,e,r)}static leftShift(t,e){return 0===e.length||0===t.length?t:e.sign?g.__rightShiftByAbsolute(t,e):g.__leftShiftByAbsolute(t,e)}static signedRightShift(t,e){return 0===e.length||0===t.length?t:e.sign?g.__leftShiftByAbsolute(t,e):g.__rightShiftByAbsolute(t,e)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(t,e){return 0>g.__compareToBigInt(t,e)}static lessThanOrEqual(t,e){return 0>=g.__compareToBigInt(t,e)}static greaterThan(t,e){return 0=g.__kMaxLengthBits)return e;const r=t+31>>>5;if(e.lengthg.__kMaxLengthBits)throw new RangeError("BigInt too big");return g.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=g.__kMaxLengthBits)return e;const r=t+31>>>5;if(e.length>>n)return e}return g.__truncateToNBits(t,e)}static ADD(t,e){if(t=g.__toPrimitive(t),e=g.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=g.__toNumeric(t),e=g.__toNumeric(e),g.__isBigInt(t)&&g.__isBigInt(e))return g.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(t,e){return g.__compare(t,e,0)}static LE(t,e){return g.__compare(t,e,1)}static GT(t,e){return g.__compare(t,e,2)}static GE(t,e){return g.__compare(t,e,3)}static EQ(t,e){for(;;){if(g.__isBigInt(t))return g.__isBigInt(e)?g.equal(t,e):g.EQ(e,t);if("number"==typeof t){if(g.__isBigInt(e))return g.__equalToNumber(e,t);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("string"==typeof t){if(g.__isBigInt(e))return null!==(t=g.__fromString(t))&&g.equal(t,e);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("boolean"==typeof t){if(g.__isBigInt(e))return g.__equalToNumber(e,+t);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("symbol"==typeof t){if(g.__isBigInt(e))return!1;if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else{if("object"!=typeof t)return t==e;if("object"==typeof e&&e.constructor!==g)return t==e;t=g.__toPrimitive(t)}}}static NE(t,e){return!g.EQ(t,e)}static __zero(){return new g(0,!1)}static __oneDigit(t,e){const r=new g(1,e);return r.__setDigit(0,t),r}__copy(){const t=new g(this.length,this.sign);for(let e=0;ee)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}let o=1<>>20)-1023,r=1+(e>>>5),n=new g(r,0>t);let i=1048575&g.__kBitConversionInts[1]|1048576,o=g.__kBitConversionInts[0];const s=31&e;let a,u=0;if(s<20){const t=20-s;u=t+32,a=i>>>t,i=i<<32-t|o>>>t,o<<=32-t}else if(20===s)u=32,a=i,i=o;else{const t=s-20;u=32-t,a=i<>>32-t,i=o<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}static __fromString(t,e=0){let r=0;const n=t.length;let i=0;if(i===n)return g.__zero();let o=t.charCodeAt(i);for(;g.__isWhitespace(o);){if(++i===n)return g.__zero();o=t.charCodeAt(i)}if(43===o){if(++i===n)return null;o=t.charCodeAt(i),r=1}else if(45===o){if(++i===n)return null;o=t.charCodeAt(i),r=-1}if(0===e){if(e=10,48===o){if(++i===n)return g.__zero();if(o=t.charCodeAt(i),88===o||120===o){if(e=16,++i===n)return null;o=t.charCodeAt(i)}else if(79===o||111===o){if(e=8,++i===n)return null;o=t.charCodeAt(i)}else if(66===o||98===o){if(e=2,++i===n)return null;o=t.charCodeAt(i)}}}else if(16===e&&48===o){if(++i===n)return g.__zero();if(o=t.charCodeAt(i),88===o||120===o){if(++i===n)return null;o=t.charCodeAt(i)}}for(;48===o;){if(++i===n)return g.__zero();o=t.charCodeAt(i)}const s=n-i;let a=g.__kMaxBitsPerChar[e],u=g.__kBitsPerCharTableMultiplier-1;if(s>1073741824/a)return null;const l=a*s+u>>>g.__kBitsPerCharTableShift,c=new g(l+31>>>5,!1),_=10>e?e:10,f=10>=g.__kBitsPerCharTableShift;const e=[],r=[];let s=!1;do{let u=0,l=0;for(;;){let e;if(o-48>>>0<_)e=o-48;else{if(!((32|o)-97>>>0>>0<_)a=o-48;else{if(!((32|o)-97>>>0>>g.__kBitsPerCharTableShift+5;c.__inplaceMultiplyAdd(h,l,d)}while(!r)}if(i!==n){if(!g.__isWhitespace(o))return null;for(i++;i>>u-o)}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&i),i=(51&i>>>2)+(51&i),i=(15&i>>>4)+(15&i);const o=i,s=e-1,a=t.__digit(n-1);let u=0|(32*n-r(a)+o-1)/o;if(t.sign&&u++,268435456>>i,f=32-i;f>=o;)l[c--]=g.__kConversionChars[_&s],_>>>=o,f-=o}const h=(_|a<>>o-f;0!==_;)l[c--]=g.__kConversionChars[_&s],_>>>=o;if(t.sign&&(l[c--]="-"),-1!=c)throw new Error("implementation bug");return l.join("")}static __toStringGeneric(t,e,r){var n=Math.clz32;const i=t.length;if(0===i)return"";if(1===i){let n=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(n="-"+n),n}const o=32*i-n(t.__digit(i-1)),s=g.__kMaxBitsPerChar[e]-1;let a=o*g.__kBitsPerCharTableMultiplier;a+=s-1,a=0|a/s;const u=a+1>>1,l=g.exponentiate(g.__oneDigit(e,!1),g.__oneDigit(u,!1));let c,_;const f=l.__unsignedDigit(0);if(1===l.length&&65535>=f){c=new g(t.length,!1),c.__initializeDigits();let r=0;for(let e=2*t.length-1;0<=e;e--){const n=r<<16|t.__halfDigit(e);c.__setHalfDigit(e,0|n/f),r=0|n%f}_=r.toString(e)}else{const r=g.__absoluteDivLarge(t,l,!0,!0);c=r.quotient;const n=r.remainder.__trim();_=g.__toStringGeneric(n,e,!0)}c.__trim();let h=g.__toStringGeneric(c,e,!0);for(;_.lengthn?g.__absoluteLess(r):0}static __compareToNumber(t,e){if(!0|e){const r=t.sign,n=0>e;if(r!==n)return g.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?g.__absoluteGreater(r):oe)return g.__unequalSign(n);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;g.__kBitConversionDouble[0]=e;const i=2047&g.__kBitConversionInts[1]>>>20;if(2047==i)throw new Error("implementation bug: handled elsewhere");const o=i-1023;if(0>o)return g.__absoluteGreater(n);const s=t.length;let a=t.__digit(s-1);const u=r(a),l=32*s-u,c=o+1;if(lc)return g.__absoluteGreater(n);let _=1048576|1048575&g.__kBitConversionInts[1],f=g.__kBitConversionInts[0];const h=31-u;if(h!==(l-1)%31)throw new Error("implementation bug");let d,p=0;if(20>h){const t=20-h;p=t+32,d=_>>>t,_=_<<32-t|f>>>t,f<<=32-t}else if(20===h)p=32,d=_,_=f;else{const t=h-20;p=32-t,d=_<>>32-t,_=f<>>=0,d>>>=0,a>d)return g.__absoluteGreater(n);if(a>>0,_=f,f=0):d=0;const r=t.__unsignedDigit(e);if(r>d)return g.__absoluteGreater(n);if(re&&t.__unsignedDigit(0)===r(e):0===g.__compareToDouble(t,e)}static __comparisonResultToBool(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(g.__isBigInt(t)&&"string"==typeof e)return null!==(e=g.__fromString(e))&&g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if("string"==typeof t&&g.__isBigInt(e))return null!==(t=g.__fromString(t))&&g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if(t=g.__toNumeric(t),e=g.__toNumeric(e),g.__isBigInt(t)){if(g.__isBigInt(e))return g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return g.__comparisonResultToBool(g.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(g.__isBigInt(e))return g.__comparisonResultToBool(g.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(t,e,r){if(t.length>>16)+(r>>>16)+(a>>>16);o=u>>>16,i.__setDigit(s,65535&a|u<<16)}for(;s>>16)+(r>>>16);o=n>>>16,i.__setDigit(s,65535&r|n<<16)}return s>>16;const u=(r>>>16)-(s>>>16)-i;i=1&u>>>16,n.__setDigit(o,65535&a|u<<16)}for(;o>>16;const s=(e>>>16)-i;i=1&s>>>16,n.__setDigit(o,65535&r|s<<16)}return n.__trim()}static __absoluteAddOne(t,e,r=null){const n=t.length;null===r?r=new g(n,e):r.sign=e;let i=!0;for(let e,o=0;on?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}static __multiplyAccumulate(t,e,r,n){var i=Math.imul;if(0===e)return;const o=65535&e,s=e>>>16;let a=0,u=0,l=0;for(let e=0;e>>16;const h=t.__digit(e),g=65535&h,d=h>>>16,p=i(g,o),b=i(g,s),m=i(d,o),y=i(d,s);_+=u+(65535&p),f+=l+a+(_>>>16)+(p>>>16)+(65535&b)+(65535&m),a=f>>>16,u=(b>>>16)+(m>>>16)+(65535&y)+a,a=u>>>16,u&=65535,l=y>>>16,c=65535&_|f<<16,r.__setDigit(n,c)}for(;0!=a||0!==u||0!==l;n++){let t=r.__digit(n);const e=(65535&t)+u,i=(t>>>16)+(e>>>16)+l+a;u=0,l=0,a=i>>>16,t=65535&e|i<<16,r.__setDigit(n,t)}}static __internalMultiplyAdd(t,e,r,n,i){var o=Math.imul;let s=r,a=0;for(let r=0;r>>16;const c=o(n>>>16,e),_=(65535&c)+(u>>>16)+s;s=_>>>16,a=c>>>16,i.__setDigit(r,_<<16|65535&l)}if(i.length>n)for(i.__setDigit(n++,s+a);nthis.length&&(r=this.length);const i=65535&t,o=t>>>16;let s=0,a=65535&e,u=e>>>16;for(let t=0;t>>16,c=n(r,i),_=n(r,o),f=n(l,i),h=n(l,o),g=a+(65535&c),d=u+s+(g>>>16)+(c>>>16)+(65535&_)+(65535&f);a=(_>>>16)+(f>>>16)+(65535&h)+(d>>>16),s=a>>>16,a&=65535,u=h>>>16,this.__setDigit(t,65535&g|d<<16)}if(0!=s||0!==a||0!==u)throw new Error("implementation bug")}static __absoluteDivSmall(t,e,r){null===r&&(r=new g(t.length,!1));let n=0;for(let i,o=2*t.length-1;0<=o;o-=2){i=(n<<16|t.__halfDigit(o))>>>0;const s=0|i/e;n=0|i%e,i=(n<<16|t.__halfDigit(o-1))>>>0;const a=0|i/e;n=0|i%e,r.__setDigit(o>>>1,s<<16|a)}return r}static __absoluteModSmall(t,e){let r=0;for(let n=2*t.length-1;0<=n;n--){r=0|((r<<16|t.__halfDigit(n))>>>0)%e}return r}static __absoluteDivLarge(t,e,r,n){var i=Math.imul;const o=e.__halfDigitLength(),s=e.length,a=t.__halfDigitLength()-o;let u=null;r&&(u=new g(a+2>>>1,!1),u.__initializeDigits());const l=new g(o+2>>>1,!1);l.__initializeDigits();const c=g.__clz16(e.__halfDigit(o-1));0>>0;t=0|r/f;let s=0|r%f;const u=e.__halfDigit(o-2),l=_.__halfDigit(n+o-2);for(;i(t,u)>>>0>(s<<16|l)>>>0&&(t--,s+=f,!(65535>>1,h|t))}return n?(_.__inplaceRightShift(c),r?{quotient:u,remainder:_}:_):r?u:void 0}static __clz16(t){return Math.clz32(t)-16}__inplaceAdd(t,e,r){let n=0;for(let i=0;i>>16,this.__setHalfDigit(e+i,r)}return n}__inplaceSub(t,e,r){let n=0;if(1&e){e>>=1;let i=this.__digit(e),o=65535&i,s=0;for(;s>>1;s++){const r=t.__digit(s),a=(i>>>16)-(65535&r)-n;n=1&a>>>16,this.__setDigit(e+s,a<<16|65535&o),i=this.__digit(e+s+1),o=(65535&i)-(r>>>16)-n,n=1&o>>>16}const a=t.__digit(s),u=(i>>>16)-(65535&a)-n;if(n=1&u>>>16,this.__setDigit(e+s,u<<16|65535&o),e+s+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(i=this.__digit(e+s+1),o=(65535&i)-(a>>>16)-n,n=1&o>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;let i=0;for(;i>>16;const a=(r>>>16)-(o>>>16)-n;n=1&a>>>16,this.__setDigit(e+i,a<<16|65535&s)}const o=this.__digit(e+i),s=t.__digit(i),a=(65535&o)-(65535&s)-n;n=1&a>>>16;let u=0;0==(1&r)&&(u=(o>>>16)-(s>>>16)-n,n=1&u>>>16),this.__setDigit(e+i,u<<16|65535&a)}return n}__inplaceRightShift(t){if(0===t)return;let e=this.__digit(0)>>>t;const r=this.length-1;for(let n=0;n>>t}this.__setDigit(r,e)}static __specialLeftShift(t,e,r){const n=t.length,i=new g(n+r,!1);if(0===e){for(let e=0;e>>32-e}return 0r)throw new RangeError("BigInt too big");const n=r>>>5,i=31&r,o=t.length,s=0!==i&&0!=t.__digit(o-1)>>>32-i,a=o+n+(s?1:0),u=new g(a,t.sign);if(0===i){let e=0;for(;e>>32-i}if(s)u.__setDigit(o+n,e);else if(0!=e)throw new Error("implementation bug")}return u.__trim()}static __rightShiftByAbsolute(t,e){const r=t.length,n=t.sign,i=g.__toShiftAmount(e);if(0>i)return g.__rightShiftByMaximum(n);const o=i>>>5,s=31&i;let a=r-o;if(0>=a)return g.__rightShiftByMaximum(n);let u=!1;if(n)if(0!=(t.__digit(o)&(1<>>s;const n=r-o-1;for(let r=0;r>>s}l.__setDigit(n,e)}return u&&(l=g.__absoluteAddOne(l,!0,l)),l.__trim()}static __rightShiftByMaximum(t){return t?g.__oneDigit(1,!0):g.__zero()}static __toShiftAmount(t){if(1g.__kMaxLengthBits?-1:e}static __toPrimitive(t,e="default"){if("object"!=typeof t)return t;if(t.constructor===g)return t;const r=t[Symbol.toPrimitive];if(r){const t=r(e);if("object"!=typeof t)return t;throw new TypeError("Cannot convert object to primitive value")}const n=t.valueOf;if(n){const e=n.call(t);if("object"!=typeof e)return e}const i=t.toString;if(i){const e=i.call(t);if("object"!=typeof e)return e}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(t){return g.__isBigInt(t)?t:+t}static __isBigInt(t){return"object"==typeof t&&t.constructor===g}static __truncateToNBits(t,e){const r=t+31>>>5,n=new g(r,e.sign),i=r-1;for(let t=0;t>>e}return n.__setDigit(i,o),n.__trim()}static __truncateAndSubFromPowerOfTwo(t,e,r){var n=Math.min;const i=t+31>>>5,o=new g(i,r);let s=0;const a=i-1;let u=0;for(const t=n(a,e.length);s>>16;const n=0-(t>>>16)-u;u=1&n>>>16,o.__setDigit(s,65535&r|n<<16)}for(;s>>16;_=65535&t|0-(l>>>16)-u<<16}else{const t=32-c;l=l<>>t;const e=1<<32-t,r=(65535&e)-(65535&l)-u;u=1&r>>>16;_=65535&r|(e>>>16)-(l>>>16)-u<<16,_&=e-1}return o.__setDigit(a,_),o.__trim()}__digit(t){return this[t]}__unsignedDigit(t){return this[t]>>>0}__setDigit(t,e){this[t]=0|e}__setDigitGrow(t,e){this[t]=0|e}__halfDigitLength(){const t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}__halfDigit(t){return 65535&this[t>>>1]>>>((1&t)<<4)}__setHalfDigit(t,e){const r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}static __digitPow(t,e){let r=1;for(;0>>=1,t*=t;return r}}function d(t,e,r,n=[]){!function(t,e){if(!(e instanceof Object))throw new Error(t+" is not an object!")}(t,e);const i=Object.keys(e).sort(),o=r.length,s=r.length+n.length,a=`${t} does not have correct keys! Required keys: [${r.sort().join(", ")}], optional keys: [${n.sort().join(", ")}], actual keys: [${i.join(", ")}]`;if(i.lengths)throw new Error(a);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(a);if(u.find(t=>!n.includes(t)))throw new Error(a)}function p(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function b(t,e){if(p(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function m(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function y(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(d(r,t,["code_hash","hash_type","args"],[]),b(r+".code_hash",t.code_hash),p(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function w(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){d(r,t,["tx_hash","index"],[]),b(r+".tx_hash",t.tx_hash),m(r+".index",t.index)}function v(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){d(r,t,["since","previous_output"],[]),m(r+".since",t.since),e&&w(t.previous_output,{debugPath:r+".previous_output"})}function B(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){d(r,t,["capacity","lock"],["type"]),m(r+".capacity",t.capacity),e&&(y(t.lock,{debugPath:r+".lock"}),t.type&&y(t.type,{debugPath:r+".type"}))}function P(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(d(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&w(t.out_point,{debugPath:r+".out_point"})}function D(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=r.size;let i=void 0===n?0:n;var o=r.timeout;let a=void 0===o?0:o;null==t?t=null:W(t)?t=Buffer.from(t.toString()):J(t)||Buffer.isBuffer(t)||("[object ArrayBuffer]"===Object.prototype.toString.call(t)?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof s.default||(t=Buffer.from(String(t)))),this[V]={body:t,disturbed:!1,error:null},this.size=i,this.timeout=a,t instanceof s.default&&t.on("error",(function(t){const r="AbortError"===t.name?t:new q(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t);e[V].error=r}))}function G(){var t=this;if(this[V].disturbed)return F.Promise.reject(new TypeError("body used already for: "+this.url));if(this[V].disturbed=!0,this[V].error)return F.Promise.reject(this[V].error);let e=this.body;if(null===e)return F.Promise.resolve(Buffer.alloc(0));if(J(e)&&(e=e.stream()),Buffer.isBuffer(e))return F.Promise.resolve(e);if(!(e instanceof s.default))return F.Promise.resolve(Buffer.alloc(0));let r=[],n=0,i=!1;return new F.Promise((function(o,s){let a;t.timeout&&(a=setTimeout((function(){i=!0,s(new q(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))}),t.timeout)),e.on("error",(function(e){"AbortError"===e.name?(i=!0,s(e)):s(new q(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e))})),e.on("data",(function(e){if(!i&&null!==e){if(t.size&&n+e.length>t.size)return i=!0,void s(new q(`content size at ${t.url} over limit: ${t.size}`,"max-size"));n+=e.length,r.push(e)}})),e.on("end",(function(){if(!i){clearTimeout(a);try{o(Buffer.concat(r,n))}catch(e){s(new q(`Could not create Buffer from response body for ${t.url}: ${e.message}`,"system",e))}}}))}))}function W(t){return"object"==typeof t&&"function"==typeof t.append&&"function"==typeof t.delete&&"function"==typeof t.get&&"function"==typeof t.getAll&&"function"==typeof t.has&&"function"==typeof t.set&&("URLSearchParams"===t.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(t)||"function"==typeof t.sort)}function J(t){return"object"==typeof t&&"function"==typeof t.arrayBuffer&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function X(t){let e,r,n=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof s.default&&"function"!=typeof n.getBoundary&&(e=new H,r=new H,n.pipe(e),n.pipe(r),t[V].body=e,n=r),n}function Q(t){return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":W(t)?"application/x-www-form-urlencoded;charset=UTF-8":J(t)?t.type||null:Buffer.isBuffer(t)||"[object ArrayBuffer]"===Object.prototype.toString.call(t)||ArrayBuffer.isView(t)?null:"function"==typeof t.getBoundary?"multipart/form-data;boundary="+t.getBoundary():t instanceof s.default?null:"text/plain;charset=UTF-8"}function Z(t){const e=t.body;return null===e?0:J(e)?e.size:Buffer.isBuffer(e)?e.length:e&&"function"==typeof e.getLengthSync&&(e._lengthRetrievers&&0==e._lengthRetrievers.length||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}F.prototype={get body(){return this[V].body},get bodyUsed(){return this[V].disturbed},arrayBuffer(){return G.call(this).then((function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}))},blob(){let t=this.headers&&this.headers.get("content-type")||"";return G.call(this).then((function(e){return Object.assign(new $([],{type:t.toLowerCase()}),{[M]:e})}))},json(){var t=this;return G.call(this).then((function(e){try{return JSON.parse(e.toString())}catch(e){return F.Promise.reject(new q(`invalid json response body at ${t.url} reason: ${e.message}`,"invalid-json"))}}))},text(){return G.call(this).then((function(t){return t.toString()}))},buffer(){return G.call(this)},textConverted(){var t=this;return G.call(this).then((function(e){return function(t,e){if("function"!=typeof U)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=e.get("content-type");let n,i,o="utf-8";r&&(n=/charset=([^;]*)/i.exec(r));i=t.slice(0,1024).toString(),!n&&i&&(n=/0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[nt]=Object.create(null),t instanceof it){const e=t.raw(),r=Object.keys(e);for(const t of r)for(const r of e[t])this.append(t,r)}else if(null==t);else{if("object"!=typeof t)throw new TypeError("Provided initializer must be an object");{const e=t[Symbol.iterator];if(null!=e){if("function"!=typeof e)throw new TypeError("Header pairs must be iterable");const r=[];for(const e of t){if("object"!=typeof e||"function"!=typeof e[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(e))}for(const t of r){if(2!==t.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(t[0],t[1])}}else for(const e of Object.keys(t)){const r=t[e];this.append(e,r)}}}}get(t){tt(t=""+t);const e=rt(this[nt],t);return void 0===e?null:this[nt][e].join(", ")}forEach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=ot(this),n=0;for(;n1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(t[nt]).sort();return r.map("key"===e?function(t){return t.toLowerCase()}:"value"===e?function(e){return t[nt][e].join(", ")}:function(e){return[e.toLowerCase(),t[nt][e].join(", ")]})}it.prototype.entries=it.prototype[Symbol.iterator],Object.defineProperty(it.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(it.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const st=Symbol("internal");function at(t,e){const r=Object.create(ut);return r[st]={target:t,kind:e,index:0},r}const ut=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==ut)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[st];const e=t.target,r=t.kind,n=t.index,i=ot(e,r);return n>=i.length?{value:void 0,done:!0}:(this[st].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function lt(t){const e=Object.assign({__proto__:null},t[nt]),r=rt(t[nt],"Host");return void 0!==r&&(e[r]=e[r][0]),e}Object.defineProperty(ut,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const ct=Symbol("Response internals"),_t=a.default.STATUS_CODES;class ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};F.call(this,t,e);const r=e.status||200,n=new it(e.headers);if(null!=t&&!n.has("Content-Type")){const e=Q(t);e&&n.append("Content-Type",e)}this[ct]={url:e.url,status:r,statusText:e.statusText||_t[r],headers:n,counter:e.counter}}get url(){return this[ct].url||""}get status(){return this[ct].status}get ok(){return this[ct].status>=200&&this[ct].status<300}get redirected(){return this[ct].counter>0}get statusText(){return this[ct].statusText}get headers(){return this[ct].headers}clone(){return new ft(X(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}F.mixIn(ft.prototype),Object.defineProperties(ft.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(ft.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const ht=Symbol("Request internals"),gt=u.default.parse,dt=u.default.format,pt="destroy"in s.default.Readable.prototype;function bt(t){return"object"==typeof t&&"object"==typeof t[ht]}class mt{constructor(t){let e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt(t)?e=gt(t.url):(e=t&&t.href?gt(t.href):gt(""+t),t={});let n=r.method||t.method||"GET";if(n=n.toUpperCase(),(null!=r.body||bt(t)&&null!==t.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let i=null!=r.body?r.body:bt(t)&&null!==t.body?X(t):null;F.call(this,i,{timeout:r.timeout||t.timeout||0,size:r.size||t.size||0});const o=new it(r.headers||t.headers||{});if(null!=i&&!o.has("Content-Type")){const t=Q(i);t&&o.append("Content-Type",t)}let s=bt(t)?t.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(t){const e=t&&"object"==typeof t&&Object.getPrototypeOf(t);return!(!e||"AbortSignal"!==e.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[ht]={method:n,redirect:r.redirect||t.redirect||"follow",headers:o,parsedURL:e,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==t.follow?t.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===t.compress||t.compress,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent}get method(){return this[ht].method}get url(){return dt(this[ht].parsedURL)}get headers(){return this[ht].headers}get redirect(){return this[ht].redirect}get signal(){return this[ht].signal}clone(){return new mt(this)}}function yt(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}F.mixIn(mt.prototype),Object.defineProperty(mt.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(mt.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),yt.prototype=Object.create(Error.prototype),yt.prototype.constructor=yt,yt.prototype.name="AbortError";const wt=s.default.PassThrough,vt=u.default.resolve;function Bt(t,e){if(!Bt.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return F.Promise=Bt.Promise,new Bt.Promise((function(r,n){const i=new mt(t,e),o=function(t){const e=t[ht].parsedURL,r=new it(t[ht].headers);if(r.has("Accept")||r.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof s.default.Readable&&!pt)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let n=null;if(null==t.body&&/^(POST|PUT)$/i.test(t.method)&&(n="0"),null!=t.body){const e=Z(t);"number"==typeof e&&(n=String(e))}n&&r.set("Content-Length",n),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=t.agent;return"function"==typeof i&&(i=i(e)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},e,{method:t.method,headers:lt(r),agent:i})}(i),u=("https:"===o.protocol?l.default:a.default).request,_=i.signal;let f=null;const h=function(){let t=new yt("The user aborted a request.");n(t),i.body&&i.body instanceof s.default.Readable&&i.body.destroy(t),f&&f.body&&f.body.emit("error",t)};if(_&&_.aborted)return void h();const g=function(){h(),b()},d=u(o);let p;function b(){d.abort(),_&&_.removeEventListener("abort",g),clearTimeout(p)}_&&_.addEventListener("abort",g),i.timeout&&d.once("socket",(function(t){p=setTimeout((function(){n(new q("network timeout at: "+i.url,"request-timeout")),b()}),i.timeout)})),d.on("error",(function(t){n(new q(`request to ${i.url} failed, reason: ${t.message}`,"system",t)),b()})),d.on("response",(function(t){clearTimeout(p);const e=function(t){const e=new it;for(const r of Object.keys(t))if(!K.test(r))if(Array.isArray(t[r]))for(const n of t[r])Y.test(n)||(void 0===e[nt][r]?e[nt][r]=[n]:e[nt][r].push(n));else Y.test(t[r])||(e[nt][r]=[t[r]]);return e}(t.headers);if(Bt.isRedirect(t.statusCode)){const o=e.get("Location"),s=null===o?null:vt(i.url,o);switch(i.redirect){case"error":return n(new q("uri requested responds with a redirect, redirect mode is set to error: "+i.url,"no-redirect")),void b();case"manual":if(null!==s)try{e.set("Location",s)}catch(t){n(t)}break;case"follow":if(null===s)break;if(i.counter>=i.follow)return n(new q("maximum redirect reached at: "+i.url,"max-redirect")),void b();const o={headers:new it(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:i.body,signal:i.signal,timeout:i.timeout,size:i.size};return 303!==t.statusCode&&i.body&&null===Z(i)?(n(new q("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void b()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==i.method)||(o.method="GET",o.body=void 0,o.headers.delete("content-length")),r(Bt(new mt(s,o))),void b())}}t.once("end",(function(){_&&_.removeEventListener("abort",g)}));let o=t.pipe(new wt);const s={url:i.url,status:t.statusCode,statusText:t.statusMessage,headers:e,size:i.size,timeout:i.timeout,counter:i.counter},a=e.get("Content-Encoding");if(!i.compress||"HEAD"===i.method||null===a||204===t.statusCode||304===t.statusCode)return f=new ft(o,s),void r(f);const u={flush:c.default.Z_SYNC_FLUSH,finishFlush:c.default.Z_SYNC_FLUSH};if("gzip"==a||"x-gzip"==a)return o=o.pipe(c.default.createGunzip(u)),f=new ft(o,s),void r(f);if("deflate"!=a&&"x-deflate"!=a){if("br"==a&&"function"==typeof c.default.createBrotliDecompress)return o=o.pipe(c.default.createBrotliDecompress()),f=new ft(o,s),void r(f);f=new ft(o,s),r(f)}else{t.pipe(new wt).once("data",(function(t){o=8==(15&t[0])?o.pipe(c.default.createInflate()):o.pipe(c.default.createInflateRaw()),f=new ft(o,s),r(f)}))}})),function(t,e){const r=e.body;null===r?t.end():J(r)?r.stream().pipe(t):Buffer.isBuffer(r)?(t.write(r),t.end()):r.pipe(t)}(d,i)}))}Bt.isRedirect=function(t){return 301===t||302===t||303===t||307===t||308===t},Bt.Promise=global.Promise;var Pt,Dt,St=Object.freeze({__proto__:null,default:Bt,Headers:it,Request:mt,Response:ft,FetchError:q}),Tt=(function(t,e){var r=St.default||St,n=function(t,e){return/^\/\//.test(t)&&(t="https:"+t),r.call(this,t,e)};t.exports=e=n,e.fetch=n,e.Headers=St.Headers,e.Request=St.Request,e.Response=St.Response,e.default=n}(Dt={path:Pt,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&Dt.path)}},Dt.exports),Dt.exports);function kt(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const xt={get:(t,e,r)=>"send"===e?async()=>{const e=await Tt(t.uri,kt({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},Ct={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},xt):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await Tt(t.uri,kt({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class Et{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,Ct)}static create(t){return new Et(t)}}function Ot(t){return g.BigInt(t)}function At(t){return"0x"+t.toString(16)}function jt(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=At(g.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function It(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function Rt(t,{debugPath:e="script"}={}){return It(e,t,{code_hash:zt(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:zt(-1)})}function Lt(t,{debugPath:e="out_point"}={}){return It(e,t,{tx_hash:zt(32),index:jt(4)})}function Mt(t){return function(e,r){return t(r,{debugPath:e})}}function Nt(t,{debugPath:e="cell_input"}={}){return It(e,t,{since:jt(8),previous_output:Mt(Lt)})}function $t(t,{debugPath:e="cell_output"}={}){const r=It(e,t,{capacity:jt(8),lock:Mt(Rt)});return t.type&&(r.type_=Rt(t.type,{debugPath:e+".type"})),r}function qt(t,{debugPath:e="cell_dep"}={}){return It(e,t,{out_point:Mt(Lt),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function Ut(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function Vt(t,{debugPath:e="raw_transaction"}={}){return It(e,t,{version:jt(4),cell_deps:Ut(Mt(qt)),header_deps:Ut(zt(32)),inputs:Ut(Mt(Nt)),outputs:Ut(Mt($t)),outputs_data:Ut(zt(-1))})}function Ht(t,{debugPath:e="transaction"}={}){const r=Vt(t,{debugPath:"(raw)"+e}),n=It(e,t,{witnesses:Ut(zt(-1))});return n.raw=r,n}function Ft(t,{debugPath:e="raw_header"}={}){return It(e,t,{version:jt(4),compact_target:jt(4),timestamp:jt(8),number:jt(8),epoch:jt(8),parent_hash:zt(32),transactions_root:zt(32),proposals_hash:zt(32),uncles_hash:zt(32),dao:zt(32)})}function Gt(t,{debugPath:e="header"}={}){const r=Ft(t,{debugPath:"(raw)"+e}),n=It(e,t,{nonce:jt(16)});return n.raw=r,n}function Wt(t,{debugPath:e="uncle_block"}={}){return It(e,t,{header:Mt(Gt),proposals:Ut(zt(10))})}var Jt=Object.freeze({__proto__:null,NormalizeScript:Rt,NormalizeOutPoint:Lt,NormalizeCellInput:Nt,NormalizeCellOutput:$t,NormalizeCellDep:qt,NormalizeRawTransaction:Vt,NormalizeTransaction:Ht,NormalizeRawHeader:Ft,NormalizeHeader:Gt,NormalizeUncleBlock:Wt,NormalizeBlock:function(t,{debugPath:e="block"}={}){return It(e,t,{header:Mt(Gt),uncles:Ut(Mt(Wt)),transactions:Ut(Mt(Ht)),proposals:Ut(zt(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return It(e,t,{lock:Mt(Rt),message:zt(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=zt(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=zt(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=zt(-1)(e+".output_type",t.output_type)),r}});function Xt(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Qt(t,e,r){if(!((e=Xt(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function Zt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Qt(r,t,{code_hash:Xt,hash_type:Xt,args:Xt}),e&&y(t,{debugPath:"(transformed) "+r}),t}function Kt(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Qt(r,t,{tx_hash:Xt,index:Xt}),e&&w(t,{debugPath:"(transformed) "+r}),t}function Yt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function te(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Qt(r,t,{since:Xt,previous_output:Yt(Kt)}),e&&v(t,{debugPath:"(transformed) "+r}),t}function ee(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Qt(r,t,{capacity:Xt,lock:Yt(Zt),type:Yt(Zt)}),e&&B(t,{debugPath:"(transformed) "+r}),t}function re(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Qt(r,t,{out_point:Yt(Kt),dep_type:Xt}),e&&P(t,{debugPath:"(transformed) "+r}),t}function ne(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function ie(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Qt(r,t,{version:Xt,cell_deps:ne(Yt(re)),header_deps:ne(Xt),inputs:ne(Yt(te)),outputs:ne(Yt(ee)),outputs_data:ne(Xt),witnesses:ne(Xt)}),e&&x(t,{debugPath:"(transformed) "+r}),t}function oe(t,{validation:e=!0,debugPath:r="header"}={}){return t=Qt(r,t,{version:Xt,compact_target:Xt,timestamp:Xt,number:Xt,epoch:Xt,parent_hash:Xt,transactions_root:Xt,proposals_hash:Xt,uncles_hash:Xt,dao:Xt,nonce:Xt}),e&&E(t,{debugPath:"(transformed) "+r}),t}function se(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Qt(r,t,{header:Yt(oe),proposals:ne(Xt)}),e&&A(t,{debugPath:"(transformed) "+r}),t}var ae=Object.freeze({__proto__:null,TransformScript:Zt,TransformOutPoint:Kt,TransformCellInput:te,TransformCellOutput:ee,TransformCellDep:re,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Qt(r,t,{version:Xt,cell_deps:ne(Yt(re)),header_deps:ne(Xt),inputs:ne(Yt(te)),outputs:ne(Yt(ee)),outputs_data:ne(Xt)}),e&&k(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:ie,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Qt(r,t,{version:Xt,compact_target:Xt,timestamp:Xt,number:Xt,epoch:Xt,parent_hash:Xt,transactions_root:Xt,proposals_hash:Xt,uncles_hash:Xt,dao:Xt}),e&&C(t,{debugPath:"(transformed) "+r}),t},TransformHeader:oe,TransformUncleBlock:se,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Qt(r,t,{header:Yt(oe),uncles:ne(Yt(se)),transactions:ne(Yt(ie)),proposals:ne(Xt)}),e&&j(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Qt(r,t,{lock:Yt(Zt),message:Xt}),e&&z(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Qt(r,t,{lock:Xt,input_type:Xt,output_type:Xt}),e&&I(t,{debugPath:"(transformed) "+r}),t}});var ue=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:r=!0,loadData:n=!1,loadBlockNumber:i=!0}={}){this.rpc=t,this.lockHash=new h(e).serializeJson(),this.skipCellWithContent=r,this.loadData=n,this.loadBlockNumber=i}async*collect(){const t=Ot(await this.rpc.get_tip_block_number());let e=g.BigInt(0);for(;g.lessThanOrEqual(e,t);){let r=g.add(e,g.BigInt(100));g.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,At(e),At(r));for(const t of n){if(this.skipCellWithContent&&(t.type||g.greaterThan(Ot(t.output_data_len),g.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=g.add(r,g.BigInt(1))}}}});exports.BigIntToHexString=At,exports.HexStringToBigInt=Ot,exports.RPC=Et,exports.Reader=h,exports.TransactionDumper=class{constructor(t,{validateTransaction:e=!0,depGroupUnpacker:r=null}={}){this.rpc=t,this.validateTransaction=e,this.depGroupUnpacker=r}async dumpByHash(t){const e=(await this.rpc.get_transaction(t)).transaction;return delete e.hash,await this.dump(e)}async dump(t){this.validateTransaction&&x(t);const e=[];for(const r of t.inputs){const{output:t,data:n,header:i}=await this._resolveOutPoint(r.previous_output);e.push({input:r,output:t,data:n,header:i})}const r=[];for(const e of t.cell_deps){const{output:t,data:n,header:i}=await this._resolveOutPoint(e.out_point);if(r.push({cell_dep:e,output:t,data:n,header:i}),"dep_group"===e.dep_type){if(!this.depGroupUnpacker)throw new Error("depGroupUnpacker must be provided when the transaction contains dep_group!");const t=this.depGroupUnpacker(new h(n));for(const e of t){w(e);const{output:t,data:n,header:i}=await this._resolveOutPoint(e);r.push({cell_dep:{out_point:e,dep_type:"code"},output:t,data:n,header:i})}}}const n=[];for(const e of t.header_deps)n.push(await this.rpc.get_header(e));return JSON.stringify({mock_info:{inputs:e,cell_deps:r,header_deps:n},tx:t})}async _resolveOutPoint(t){const e=await this.rpc.get_transaction(t.tx_hash);if(!e||!e.transaction)throw new Error(`Transaction ${t.tx_hash} cannot be found!`);const r=e.transaction,n=g.toNumber(g.BigInt(t.index));if(n>=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}},exports.VERSION="0.10.2",exports.cell_collectors=ue,exports.normalizers=Jt,exports.transformers=ae,exports.validators=R; +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("stream"),e=require("http"),r=require("url"),n=require("https"),i=require("zlib");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=o(t),a=o(e),u=o(r),l=o(n),c=o(i);class _{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class f{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");r.setUint8(e,n)}return new _(e)}}class g extends Array{constructor(t,e){if(t>g.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");super(t),this.sign=e}static BigInt(t){var e=Math.floor,r=Number.isFinite;if("number"==typeof t){if(0===t)return g.__zero();if((0|t)===t)return 0>t?g.__oneDigit(-t,!0):g.__oneDigit(t,!1);if(!r(t)||e(t)!==t)throw new RangeError("The number "+t+" cannot be converted to BigInt because it is not an integer");return g.__fromDouble(t)}if("string"==typeof t){const e=g.__fromString(t);if(null===e)throw new SyntaxError("Cannot convert "+t+" to a BigInt");return e}if("boolean"==typeof t)return!0===t?g.__oneDigit(1,!1):g.__zero();if("object"==typeof t){if(t.constructor===g)return t;const e=g.__toPrimitive(t);return g.BigInt(e)}throw new TypeError("Cannot convert "+t+" to a BigInt")}toDebugString(){const t=["BigInt["];for(const e of this)t.push((e?(e>>>0).toString(16):e)+", ");return t.push("]"),t.join("")}toString(t=10){if(2>t||36>>=12;const _=l-12;let f=12<=l?0:a<<20+l,h=20+l;0<_&&0>>32-_,f=a<<_,h=_),0>>32-h,h-=32);const d=g.__decideRounding(t,h,u,a);if((1===d||0===d&&1==(1&f))&&(f=f+1>>>0,0==f&&(c++,0!=c>>>20&&(c=0,s++,1023=g.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){const e=1+(r>>>5),n=t.sign&&0!=(1&r),i=new g(e,n);i.__initializeDigits();const o=1<<(31&r);return i.__setDigit(e-1,o),i}let n=null,i=t;for(0!=(1&r)&&(n=t),r>>=1;0!==r;r>>=1)i=g.multiply(i,i),0!=(1&r)&&(n=null===n?i:g.multiply(n,i));return n}static multiply(t,e){if(0===t.length)return t;if(0===e.length)return e;let r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;const n=new g(r,t.sign!==e.sign);n.__initializeDigits();for(let r=0;rg.__absoluteCompare(t,e))return g.__zero();const r=t.sign!==e.sign,n=e.__unsignedDigit(0);let i;if(1===e.length&&65535>=n){if(1===n)return r===t.sign?t:g.unaryMinus(t);i=g.__absoluteDivSmall(t,n,null)}else i=g.__absoluteDivLarge(t,e,!0,!1);return i.sign=r,i.__trim()}static remainder(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>g.__absoluteCompare(t,e))return t;const r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return g.__zero();const e=g.__absoluteModSmall(t,r);return 0===e?g.__zero():g.__oneDigit(e,t.sign)}const n=g.__absoluteDivLarge(t,e,!1,!0);return n.sign=t.sign,n.__trim()}static add(t,e){const r=t.sign;return r===e.sign?g.__absoluteAdd(t,e,r):0<=g.__absoluteCompare(t,e)?g.__absoluteSub(t,e,r):g.__absoluteSub(e,t,!r)}static subtract(t,e){const r=t.sign;return r===e.sign?0<=g.__absoluteCompare(t,e)?g.__absoluteSub(t,e,r):g.__absoluteSub(e,t,!r):g.__absoluteAdd(t,e,r)}static leftShift(t,e){return 0===e.length||0===t.length?t:e.sign?g.__rightShiftByAbsolute(t,e):g.__leftShiftByAbsolute(t,e)}static signedRightShift(t,e){return 0===e.length||0===t.length?t:e.sign?g.__leftShiftByAbsolute(t,e):g.__rightShiftByAbsolute(t,e)}static unsignedRightShift(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}static lessThan(t,e){return 0>g.__compareToBigInt(t,e)}static lessThanOrEqual(t,e){return 0>=g.__compareToBigInt(t,e)}static greaterThan(t,e){return 0=g.__kMaxLengthBits)return e;const r=t+31>>>5;if(e.lengthg.__kMaxLengthBits)throw new RangeError("BigInt too big");return g.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=g.__kMaxLengthBits)return e;const r=t+31>>>5;if(e.length>>n)return e}return g.__truncateToNBits(t,e)}static ADD(t,e){if(t=g.__toPrimitive(t),e=g.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=g.__toNumeric(t),e=g.__toNumeric(e),g.__isBigInt(t)&&g.__isBigInt(e))return g.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}static LT(t,e){return g.__compare(t,e,0)}static LE(t,e){return g.__compare(t,e,1)}static GT(t,e){return g.__compare(t,e,2)}static GE(t,e){return g.__compare(t,e,3)}static EQ(t,e){for(;;){if(g.__isBigInt(t))return g.__isBigInt(e)?g.equal(t,e):g.EQ(e,t);if("number"==typeof t){if(g.__isBigInt(e))return g.__equalToNumber(e,t);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("string"==typeof t){if(g.__isBigInt(e))return null!==(t=g.__fromString(t))&&g.equal(t,e);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("boolean"==typeof t){if(g.__isBigInt(e))return g.__equalToNumber(e,+t);if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else if("symbol"==typeof t){if(g.__isBigInt(e))return!1;if("object"!=typeof e)return t==e;e=g.__toPrimitive(e)}else{if("object"!=typeof t)return t==e;if("object"==typeof e&&e.constructor!==g)return t==e;t=g.__toPrimitive(t)}}}static NE(t,e){return!g.EQ(t,e)}static __zero(){return new g(0,!1)}static __oneDigit(t,e){const r=new g(1,e);return r.__setDigit(0,t),r}__copy(){const t=new g(this.length,this.sign);for(let e=0;ee)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}let o=1<>>20)-1023,r=1+(e>>>5),n=new g(r,0>t);let i=1048575&g.__kBitConversionInts[1]|1048576,o=g.__kBitConversionInts[0];const s=31&e;let a,u=0;if(s<20){const t=20-s;u=t+32,a=i>>>t,i=i<<32-t|o>>>t,o<<=32-t}else if(20===s)u=32,a=i,i=o;else{const t=s-20;u=32-t,a=i<>>32-t,i=o<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}static __fromString(t,e=0){let r=0;const n=t.length;let i=0;if(i===n)return g.__zero();let o=t.charCodeAt(i);for(;g.__isWhitespace(o);){if(++i===n)return g.__zero();o=t.charCodeAt(i)}if(43===o){if(++i===n)return null;o=t.charCodeAt(i),r=1}else if(45===o){if(++i===n)return null;o=t.charCodeAt(i),r=-1}if(0===e){if(e=10,48===o){if(++i===n)return g.__zero();if(o=t.charCodeAt(i),88===o||120===o){if(e=16,++i===n)return null;o=t.charCodeAt(i)}else if(79===o||111===o){if(e=8,++i===n)return null;o=t.charCodeAt(i)}else if(66===o||98===o){if(e=2,++i===n)return null;o=t.charCodeAt(i)}}}else if(16===e&&48===o){if(++i===n)return g.__zero();if(o=t.charCodeAt(i),88===o||120===o){if(++i===n)return null;o=t.charCodeAt(i)}}for(;48===o;){if(++i===n)return g.__zero();o=t.charCodeAt(i)}const s=n-i;let a=g.__kMaxBitsPerChar[e],u=g.__kBitsPerCharTableMultiplier-1;if(s>1073741824/a)return null;const l=a*s+u>>>g.__kBitsPerCharTableShift,c=new g(l+31>>>5,!1),_=10>e?e:10,f=10>=g.__kBitsPerCharTableShift;const e=[],r=[];let s=!1;do{let u=0,l=0;for(;;){let e;if(o-48>>>0<_)e=o-48;else{if(!((32|o)-97>>>0>>0<_)a=o-48;else{if(!((32|o)-97>>>0>>g.__kBitsPerCharTableShift+5;c.__inplaceMultiplyAdd(h,l,d)}while(!r)}if(i!==n){if(!g.__isWhitespace(o))return null;for(i++;i>>u-o)}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&i),i=(51&i>>>2)+(51&i),i=(15&i>>>4)+(15&i);const o=i,s=e-1,a=t.__digit(n-1);let u=0|(32*n-r(a)+o-1)/o;if(t.sign&&u++,268435456>>i,f=32-i;f>=o;)l[c--]=g.__kConversionChars[_&s],_>>>=o,f-=o}const h=(_|a<>>o-f;0!==_;)l[c--]=g.__kConversionChars[_&s],_>>>=o;if(t.sign&&(l[c--]="-"),-1!=c)throw new Error("implementation bug");return l.join("")}static __toStringGeneric(t,e,r){var n=Math.clz32;const i=t.length;if(0===i)return"";if(1===i){let n=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(n="-"+n),n}const o=32*i-n(t.__digit(i-1)),s=g.__kMaxBitsPerChar[e]-1;let a=o*g.__kBitsPerCharTableMultiplier;a+=s-1,a=0|a/s;const u=a+1>>1,l=g.exponentiate(g.__oneDigit(e,!1),g.__oneDigit(u,!1));let c,_;const f=l.__unsignedDigit(0);if(1===l.length&&65535>=f){c=new g(t.length,!1),c.__initializeDigits();let r=0;for(let e=2*t.length-1;0<=e;e--){const n=r<<16|t.__halfDigit(e);c.__setHalfDigit(e,0|n/f),r=0|n%f}_=r.toString(e)}else{const r=g.__absoluteDivLarge(t,l,!0,!0);c=r.quotient;const n=r.remainder.__trim();_=g.__toStringGeneric(n,e,!0)}c.__trim();let h=g.__toStringGeneric(c,e,!0);for(;_.lengthn?g.__absoluteLess(r):0}static __compareToNumber(t,e){if(!0|e){const r=t.sign,n=0>e;if(r!==n)return g.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?g.__absoluteGreater(r):oe)return g.__unequalSign(n);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;g.__kBitConversionDouble[0]=e;const i=2047&g.__kBitConversionInts[1]>>>20;if(2047==i)throw new Error("implementation bug: handled elsewhere");const o=i-1023;if(0>o)return g.__absoluteGreater(n);const s=t.length;let a=t.__digit(s-1);const u=r(a),l=32*s-u,c=o+1;if(lc)return g.__absoluteGreater(n);let _=1048576|1048575&g.__kBitConversionInts[1],f=g.__kBitConversionInts[0];const h=31-u;if(h!==(l-1)%31)throw new Error("implementation bug");let d,p=0;if(20>h){const t=20-h;p=t+32,d=_>>>t,_=_<<32-t|f>>>t,f<<=32-t}else if(20===h)p=32,d=_,_=f;else{const t=h-20;p=32-t,d=_<>>32-t,_=f<>>=0,d>>>=0,a>d)return g.__absoluteGreater(n);if(a>>0,_=f,f=0):d=0;const r=t.__unsignedDigit(e);if(r>d)return g.__absoluteGreater(n);if(re&&t.__unsignedDigit(0)===r(e):0===g.__compareToDouble(t,e)}static __comparisonResultToBool(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(g.__isBigInt(t)&&"string"==typeof e)return null!==(e=g.__fromString(e))&&g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if("string"==typeof t&&g.__isBigInt(e))return null!==(t=g.__fromString(t))&&g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if(t=g.__toNumeric(t),e=g.__toNumeric(e),g.__isBigInt(t)){if(g.__isBigInt(e))return g.__comparisonResultToBool(g.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return g.__comparisonResultToBool(g.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(g.__isBigInt(e))return g.__comparisonResultToBool(g.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(t,e,r){if(t.length>>16)+(r>>>16)+(a>>>16);o=u>>>16,i.__setDigit(s,65535&a|u<<16)}for(;s>>16)+(r>>>16);o=n>>>16,i.__setDigit(s,65535&r|n<<16)}return s>>16;const u=(r>>>16)-(s>>>16)-i;i=1&u>>>16,n.__setDigit(o,65535&a|u<<16)}for(;o>>16;const s=(e>>>16)-i;i=1&s>>>16,n.__setDigit(o,65535&r|s<<16)}return n.__trim()}static __absoluteAddOne(t,e,r=null){const n=t.length;null===r?r=new g(n,e):r.sign=e;let i=!0;for(let e,o=0;on?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}static __multiplyAccumulate(t,e,r,n){var i=Math.imul;if(0===e)return;const o=65535&e,s=e>>>16;let a=0,u=0,l=0;for(let e=0;e>>16;const h=t.__digit(e),g=65535&h,d=h>>>16,p=i(g,o),b=i(g,s),m=i(d,o),y=i(d,s);_+=u+(65535&p),f+=l+a+(_>>>16)+(p>>>16)+(65535&b)+(65535&m),a=f>>>16,u=(b>>>16)+(m>>>16)+(65535&y)+a,a=u>>>16,u&=65535,l=y>>>16,c=65535&_|f<<16,r.__setDigit(n,c)}for(;0!=a||0!==u||0!==l;n++){let t=r.__digit(n);const e=(65535&t)+u,i=(t>>>16)+(e>>>16)+l+a;u=0,l=0,a=i>>>16,t=65535&e|i<<16,r.__setDigit(n,t)}}static __internalMultiplyAdd(t,e,r,n,i){var o=Math.imul;let s=r,a=0;for(let r=0;r>>16;const c=o(n>>>16,e),_=(65535&c)+(u>>>16)+s;s=_>>>16,a=c>>>16,i.__setDigit(r,_<<16|65535&l)}if(i.length>n)for(i.__setDigit(n++,s+a);nthis.length&&(r=this.length);const i=65535&t,o=t>>>16;let s=0,a=65535&e,u=e>>>16;for(let t=0;t>>16,c=n(r,i),_=n(r,o),f=n(l,i),h=n(l,o),g=a+(65535&c),d=u+s+(g>>>16)+(c>>>16)+(65535&_)+(65535&f);a=(_>>>16)+(f>>>16)+(65535&h)+(d>>>16),s=a>>>16,a&=65535,u=h>>>16,this.__setDigit(t,65535&g|d<<16)}if(0!=s||0!==a||0!==u)throw new Error("implementation bug")}static __absoluteDivSmall(t,e,r){null===r&&(r=new g(t.length,!1));let n=0;for(let i,o=2*t.length-1;0<=o;o-=2){i=(n<<16|t.__halfDigit(o))>>>0;const s=0|i/e;n=0|i%e,i=(n<<16|t.__halfDigit(o-1))>>>0;const a=0|i/e;n=0|i%e,r.__setDigit(o>>>1,s<<16|a)}return r}static __absoluteModSmall(t,e){let r=0;for(let n=2*t.length-1;0<=n;n--){r=0|((r<<16|t.__halfDigit(n))>>>0)%e}return r}static __absoluteDivLarge(t,e,r,n){var i=Math.imul;const o=e.__halfDigitLength(),s=e.length,a=t.__halfDigitLength()-o;let u=null;r&&(u=new g(a+2>>>1,!1),u.__initializeDigits());const l=new g(o+2>>>1,!1);l.__initializeDigits();const c=g.__clz16(e.__halfDigit(o-1));0>>0;t=0|r/f;let s=0|r%f;const u=e.__halfDigit(o-2),l=_.__halfDigit(n+o-2);for(;i(t,u)>>>0>(s<<16|l)>>>0&&(t--,s+=f,!(65535>>1,h|t))}return n?(_.__inplaceRightShift(c),r?{quotient:u,remainder:_}:_):r?u:void 0}static __clz16(t){return Math.clz32(t)-16}__inplaceAdd(t,e,r){let n=0;for(let i=0;i>>16,this.__setHalfDigit(e+i,r)}return n}__inplaceSub(t,e,r){let n=0;if(1&e){e>>=1;let i=this.__digit(e),o=65535&i,s=0;for(;s>>1;s++){const r=t.__digit(s),a=(i>>>16)-(65535&r)-n;n=1&a>>>16,this.__setDigit(e+s,a<<16|65535&o),i=this.__digit(e+s+1),o=(65535&i)-(r>>>16)-n,n=1&o>>>16}const a=t.__digit(s),u=(i>>>16)-(65535&a)-n;if(n=1&u>>>16,this.__setDigit(e+s,u<<16|65535&o),e+s+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(i=this.__digit(e+s+1),o=(65535&i)-(a>>>16)-n,n=1&o>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;let i=0;for(;i>>16;const a=(r>>>16)-(o>>>16)-n;n=1&a>>>16,this.__setDigit(e+i,a<<16|65535&s)}const o=this.__digit(e+i),s=t.__digit(i),a=(65535&o)-(65535&s)-n;n=1&a>>>16;let u=0;0==(1&r)&&(u=(o>>>16)-(s>>>16)-n,n=1&u>>>16),this.__setDigit(e+i,u<<16|65535&a)}return n}__inplaceRightShift(t){if(0===t)return;let e=this.__digit(0)>>>t;const r=this.length-1;for(let n=0;n>>t}this.__setDigit(r,e)}static __specialLeftShift(t,e,r){const n=t.length,i=new g(n+r,!1);if(0===e){for(let e=0;e>>32-e}return 0r)throw new RangeError("BigInt too big");const n=r>>>5,i=31&r,o=t.length,s=0!==i&&0!=t.__digit(o-1)>>>32-i,a=o+n+(s?1:0),u=new g(a,t.sign);if(0===i){let e=0;for(;e>>32-i}if(s)u.__setDigit(o+n,e);else if(0!=e)throw new Error("implementation bug")}return u.__trim()}static __rightShiftByAbsolute(t,e){const r=t.length,n=t.sign,i=g.__toShiftAmount(e);if(0>i)return g.__rightShiftByMaximum(n);const o=i>>>5,s=31&i;let a=r-o;if(0>=a)return g.__rightShiftByMaximum(n);let u=!1;if(n)if(0!=(t.__digit(o)&(1<>>s;const n=r-o-1;for(let r=0;r>>s}l.__setDigit(n,e)}return u&&(l=g.__absoluteAddOne(l,!0,l)),l.__trim()}static __rightShiftByMaximum(t){return t?g.__oneDigit(1,!0):g.__zero()}static __toShiftAmount(t){if(1g.__kMaxLengthBits?-1:e}static __toPrimitive(t,e="default"){if("object"!=typeof t)return t;if(t.constructor===g)return t;const r=t[Symbol.toPrimitive];if(r){const t=r(e);if("object"!=typeof t)return t;throw new TypeError("Cannot convert object to primitive value")}const n=t.valueOf;if(n){const e=n.call(t);if("object"!=typeof e)return e}const i=t.toString;if(i){const e=i.call(t);if("object"!=typeof e)return e}throw new TypeError("Cannot convert object to primitive value")}static __toNumeric(t){return g.__isBigInt(t)?t:+t}static __isBigInt(t){return"object"==typeof t&&t.constructor===g}static __truncateToNBits(t,e){const r=t+31>>>5,n=new g(r,e.sign),i=r-1;for(let t=0;t>>e}return n.__setDigit(i,o),n.__trim()}static __truncateAndSubFromPowerOfTwo(t,e,r){var n=Math.min;const i=t+31>>>5,o=new g(i,r);let s=0;const a=i-1;let u=0;for(const t=n(a,e.length);s>>16;const n=0-(t>>>16)-u;u=1&n>>>16,o.__setDigit(s,65535&r|n<<16)}for(;s>>16;_=65535&t|0-(l>>>16)-u<<16}else{const t=32-c;l=l<>>t;const e=1<<32-t,r=(65535&e)-(65535&l)-u;u=1&r>>>16;_=65535&r|(e>>>16)-(l>>>16)-u<<16,_&=e-1}return o.__setDigit(a,_),o.__trim()}__digit(t){return this[t]}__unsignedDigit(t){return this[t]>>>0}__setDigit(t,e){this[t]=0|e}__setDigitGrow(t,e){this[t]=0|e}__halfDigitLength(){const t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}__halfDigit(t){return 65535&this[t>>>1]>>>((1&t)<<4)}__setHalfDigit(t,e){const r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}static __digitPow(t,e){let r=1;for(;0>>=1,t*=t;return r}}function d(t,e,r,n=[]){!function(t,e){if(!(e instanceof Object))throw new Error(t+" is not an object!")}(t,e);const i=Object.keys(e).sort(),o=r.length,s=r.length+n.length,a=`${t} does not have correct keys! Required keys: [${r.sort().join(", ")}], optional keys: [${n.sort().join(", ")}], actual keys: [${i.join(", ")}]`;if(i.lengths)throw new Error(a);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(a);if(u.find(t=>!n.includes(t)))throw new Error(a)}function p(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function b(t,e){if(p(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function m(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function y(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(d(r,t,["code_hash","hash_type","args"],[]),b(r+".code_hash",t.code_hash),p(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function w(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){d(r,t,["tx_hash","index"],[]),b(r+".tx_hash",t.tx_hash),m(r+".index",t.index)}function v(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){d(r,t,["since","previous_output"],[]),m(r+".since",t.since),e&&w(t.previous_output,{debugPath:r+".previous_output"})}function B(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){d(r,t,["capacity","lock"],["type"]),m(r+".capacity",t.capacity),e&&(y(t.lock,{debugPath:r+".lock"}),t.type&&y(t.type,{debugPath:r+".type"}))}function P(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(d(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&w(t.out_point,{debugPath:r+".out_point"})}function D(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=r.size;let i=void 0===n?0:n;var o=r.timeout;let a=void 0===o?0:o;null==t?t=null:W(t)?t=Buffer.from(t.toString()):J(t)||Buffer.isBuffer(t)||("[object ArrayBuffer]"===Object.prototype.toString.call(t)?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof s.default||(t=Buffer.from(String(t)))),this[V]={body:t,disturbed:!1,error:null},this.size=i,this.timeout=a,t instanceof s.default&&t.on("error",(function(t){const r="AbortError"===t.name?t:new q(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t);e[V].error=r}))}function G(){var t=this;if(this[V].disturbed)return F.Promise.reject(new TypeError("body used already for: "+this.url));if(this[V].disturbed=!0,this[V].error)return F.Promise.reject(this[V].error);let e=this.body;if(null===e)return F.Promise.resolve(Buffer.alloc(0));if(J(e)&&(e=e.stream()),Buffer.isBuffer(e))return F.Promise.resolve(e);if(!(e instanceof s.default))return F.Promise.resolve(Buffer.alloc(0));let r=[],n=0,i=!1;return new F.Promise((function(o,s){let a;t.timeout&&(a=setTimeout((function(){i=!0,s(new q(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))}),t.timeout)),e.on("error",(function(e){"AbortError"===e.name?(i=!0,s(e)):s(new q(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e))})),e.on("data",(function(e){if(!i&&null!==e){if(t.size&&n+e.length>t.size)return i=!0,void s(new q(`content size at ${t.url} over limit: ${t.size}`,"max-size"));n+=e.length,r.push(e)}})),e.on("end",(function(){if(!i){clearTimeout(a);try{o(Buffer.concat(r,n))}catch(e){s(new q(`Could not create Buffer from response body for ${t.url}: ${e.message}`,"system",e))}}}))}))}function W(t){return"object"==typeof t&&"function"==typeof t.append&&"function"==typeof t.delete&&"function"==typeof t.get&&"function"==typeof t.getAll&&"function"==typeof t.has&&"function"==typeof t.set&&("URLSearchParams"===t.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(t)||"function"==typeof t.sort)}function J(t){return"object"==typeof t&&"function"==typeof t.arrayBuffer&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function X(t){let e,r,n=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof s.default&&"function"!=typeof n.getBoundary&&(e=new H,r=new H,n.pipe(e),n.pipe(r),t[V].body=e,n=r),n}function Q(t){return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":W(t)?"application/x-www-form-urlencoded;charset=UTF-8":J(t)?t.type||null:Buffer.isBuffer(t)||"[object ArrayBuffer]"===Object.prototype.toString.call(t)||ArrayBuffer.isView(t)?null:"function"==typeof t.getBoundary?"multipart/form-data;boundary="+t.getBoundary():t instanceof s.default?null:"text/plain;charset=UTF-8"}function Z(t){const e=t.body;return null===e?0:J(e)?e.size:Buffer.isBuffer(e)?e.length:e&&"function"==typeof e.getLengthSync&&(e._lengthRetrievers&&0==e._lengthRetrievers.length||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}F.prototype={get body(){return this[V].body},get bodyUsed(){return this[V].disturbed},arrayBuffer(){return G.call(this).then((function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}))},blob(){let t=this.headers&&this.headers.get("content-type")||"";return G.call(this).then((function(e){return Object.assign(new $([],{type:t.toLowerCase()}),{[M]:e})}))},json(){var t=this;return G.call(this).then((function(e){try{return JSON.parse(e.toString())}catch(e){return F.Promise.reject(new q(`invalid json response body at ${t.url} reason: ${e.message}`,"invalid-json"))}}))},text(){return G.call(this).then((function(t){return t.toString()}))},buffer(){return G.call(this)},textConverted(){var t=this;return G.call(this).then((function(e){return function(t,e){if("function"!=typeof U)throw new Error("The package `encoding` must be installed to use the textConverted() function");const r=e.get("content-type");let n,i,o="utf-8";r&&(n=/charset=([^;]*)/i.exec(r));i=t.slice(0,1024).toString(),!n&&i&&(n=/0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[nt]=Object.create(null),t instanceof it){const e=t.raw(),r=Object.keys(e);for(const t of r)for(const r of e[t])this.append(t,r)}else if(null==t);else{if("object"!=typeof t)throw new TypeError("Provided initializer must be an object");{const e=t[Symbol.iterator];if(null!=e){if("function"!=typeof e)throw new TypeError("Header pairs must be iterable");const r=[];for(const e of t){if("object"!=typeof e||"function"!=typeof e[Symbol.iterator])throw new TypeError("Each header pair must be iterable");r.push(Array.from(e))}for(const t of r){if(2!==t.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(t[0],t[1])}}else for(const e of Object.keys(t)){const r=t[e];this.append(e,r)}}}}get(t){tt(t=""+t);const e=rt(this[nt],t);return void 0===e?null:this[nt][e].join(", ")}forEach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,r=ot(this),n=0;for(;n1&&void 0!==arguments[1]?arguments[1]:"key+value";const r=Object.keys(t[nt]).sort();return r.map("key"===e?function(t){return t.toLowerCase()}:"value"===e?function(e){return t[nt][e].join(", ")}:function(e){return[e.toLowerCase(),t[nt][e].join(", ")]})}it.prototype.entries=it.prototype[Symbol.iterator],Object.defineProperty(it.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(it.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const st=Symbol("internal");function at(t,e){const r=Object.create(ut);return r[st]={target:t,kind:e,index:0},r}const ut=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==ut)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[st];const e=t.target,r=t.kind,n=t.index,i=ot(e,r);return n>=i.length?{value:void 0,done:!0}:(this[st].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function lt(t){const e=Object.assign({__proto__:null},t[nt]),r=rt(t[nt],"Host");return void 0!==r&&(e[r]=e[r][0]),e}Object.defineProperty(ut,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const ct=Symbol("Response internals"),_t=a.default.STATUS_CODES;class ft{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};F.call(this,t,e);const r=e.status||200,n=new it(e.headers);if(null!=t&&!n.has("Content-Type")){const e=Q(t);e&&n.append("Content-Type",e)}this[ct]={url:e.url,status:r,statusText:e.statusText||_t[r],headers:n,counter:e.counter}}get url(){return this[ct].url||""}get status(){return this[ct].status}get ok(){return this[ct].status>=200&&this[ct].status<300}get redirected(){return this[ct].counter>0}get statusText(){return this[ct].statusText}get headers(){return this[ct].headers}clone(){return new ft(X(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}F.mixIn(ft.prototype),Object.defineProperties(ft.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(ft.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const ht=Symbol("Request internals"),gt=u.default.parse,dt=u.default.format,pt="destroy"in s.default.Readable.prototype;function bt(t){return"object"==typeof t&&"object"==typeof t[ht]}class mt{constructor(t){let e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bt(t)?e=gt(t.url):(e=t&&t.href?gt(t.href):gt(""+t),t={});let n=r.method||t.method||"GET";if(n=n.toUpperCase(),(null!=r.body||bt(t)&&null!==t.body)&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");let i=null!=r.body?r.body:bt(t)&&null!==t.body?X(t):null;F.call(this,i,{timeout:r.timeout||t.timeout||0,size:r.size||t.size||0});const o=new it(r.headers||t.headers||{});if(null!=i&&!o.has("Content-Type")){const t=Q(i);t&&o.append("Content-Type",t)}let s=bt(t)?t.signal:null;if("signal"in r&&(s=r.signal),null!=s&&!function(t){const e=t&&"object"==typeof t&&Object.getPrototypeOf(t);return!(!e||"AbortSignal"!==e.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[ht]={method:n,redirect:r.redirect||t.redirect||"follow",headers:o,parsedURL:e,signal:s},this.follow=void 0!==r.follow?r.follow:void 0!==t.follow?t.follow:20,this.compress=void 0!==r.compress?r.compress:void 0===t.compress||t.compress,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent}get method(){return this[ht].method}get url(){return dt(this[ht].parsedURL)}get headers(){return this[ht].headers}get redirect(){return this[ht].redirect}get signal(){return this[ht].signal}clone(){return new mt(this)}}function yt(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}F.mixIn(mt.prototype),Object.defineProperty(mt.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(mt.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),yt.prototype=Object.create(Error.prototype),yt.prototype.constructor=yt,yt.prototype.name="AbortError";const wt=s.default.PassThrough,vt=u.default.resolve;function Bt(t,e){if(!Bt.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return F.Promise=Bt.Promise,new Bt.Promise((function(r,n){const i=new mt(t,e),o=function(t){const e=t[ht].parsedURL,r=new it(t[ht].headers);if(r.has("Accept")||r.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof s.default.Readable&&!pt)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let n=null;if(null==t.body&&/^(POST|PUT)$/i.test(t.method)&&(n="0"),null!=t.body){const e=Z(t);"number"==typeof e&&(n=String(e))}n&&r.set("Content-Length",n),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=t.agent;return"function"==typeof i&&(i=i(e)),r.has("Connection")||i||r.set("Connection","close"),Object.assign({},e,{method:t.method,headers:lt(r),agent:i})}(i),u=("https:"===o.protocol?l.default:a.default).request,_=i.signal;let f=null;const h=function(){let t=new yt("The user aborted a request.");n(t),i.body&&i.body instanceof s.default.Readable&&i.body.destroy(t),f&&f.body&&f.body.emit("error",t)};if(_&&_.aborted)return void h();const g=function(){h(),b()},d=u(o);let p;function b(){d.abort(),_&&_.removeEventListener("abort",g),clearTimeout(p)}_&&_.addEventListener("abort",g),i.timeout&&d.once("socket",(function(t){p=setTimeout((function(){n(new q("network timeout at: "+i.url,"request-timeout")),b()}),i.timeout)})),d.on("error",(function(t){n(new q(`request to ${i.url} failed, reason: ${t.message}`,"system",t)),b()})),d.on("response",(function(t){clearTimeout(p);const e=function(t){const e=new it;for(const r of Object.keys(t))if(!K.test(r))if(Array.isArray(t[r]))for(const n of t[r])Y.test(n)||(void 0===e[nt][r]?e[nt][r]=[n]:e[nt][r].push(n));else Y.test(t[r])||(e[nt][r]=[t[r]]);return e}(t.headers);if(Bt.isRedirect(t.statusCode)){const o=e.get("Location"),s=null===o?null:vt(i.url,o);switch(i.redirect){case"error":return n(new q("uri requested responds with a redirect, redirect mode is set to error: "+i.url,"no-redirect")),void b();case"manual":if(null!==s)try{e.set("Location",s)}catch(t){n(t)}break;case"follow":if(null===s)break;if(i.counter>=i.follow)return n(new q("maximum redirect reached at: "+i.url,"max-redirect")),void b();const o={headers:new it(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:i.body,signal:i.signal,timeout:i.timeout,size:i.size};return 303!==t.statusCode&&i.body&&null===Z(i)?(n(new q("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void b()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==i.method)||(o.method="GET",o.body=void 0,o.headers.delete("content-length")),r(Bt(new mt(s,o))),void b())}}t.once("end",(function(){_&&_.removeEventListener("abort",g)}));let o=t.pipe(new wt);const s={url:i.url,status:t.statusCode,statusText:t.statusMessage,headers:e,size:i.size,timeout:i.timeout,counter:i.counter},a=e.get("Content-Encoding");if(!i.compress||"HEAD"===i.method||null===a||204===t.statusCode||304===t.statusCode)return f=new ft(o,s),void r(f);const u={flush:c.default.Z_SYNC_FLUSH,finishFlush:c.default.Z_SYNC_FLUSH};if("gzip"==a||"x-gzip"==a)return o=o.pipe(c.default.createGunzip(u)),f=new ft(o,s),void r(f);if("deflate"!=a&&"x-deflate"!=a){if("br"==a&&"function"==typeof c.default.createBrotliDecompress)return o=o.pipe(c.default.createBrotliDecompress()),f=new ft(o,s),void r(f);f=new ft(o,s),r(f)}else{t.pipe(new wt).once("data",(function(t){o=8==(15&t[0])?o.pipe(c.default.createInflate()):o.pipe(c.default.createInflateRaw()),f=new ft(o,s),r(f)}))}})),function(t,e){const r=e.body;null===r?t.end():J(r)?r.stream().pipe(t):Buffer.isBuffer(r)?(t.write(r),t.end()):r.pipe(t)}(d,i)}))}Bt.isRedirect=function(t){return 301===t||302===t||303===t||307===t||308===t},Bt.Promise=global.Promise;var Pt,Dt,St=Object.freeze({__proto__:null,default:Bt,Headers:it,Request:mt,Response:ft,FetchError:q}),Tt=(function(t,e){var r=St.default||St,n=function(t,e){return/^\/\//.test(t)&&(t="https:"+t),r.call(this,t,e)};t.exports=e=n,e.fetch=n,e.Headers=St.Headers,e.Request=St.Request,e.Response=St.Response,e.default=n}(Dt={path:Pt,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&Dt.path)}},Dt.exports),Dt.exports);function kt(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const xt={get:(t,e,r)=>"send"===e?async()=>{const e=await Tt(t.uri,kt({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},Ct={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},xt):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await Tt(t.uri,kt({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class Et{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,Ct)}static create(t){return new Et(t)}}function Ot(t){return g.BigInt(t)}function At(t){return"0x"+t.toString(16)}function jt(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=At(g.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function It(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function Rt(t,{debugPath:e="script"}={}){return It(e,t,{code_hash:zt(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:zt(-1)})}function Lt(t,{debugPath:e="out_point"}={}){return It(e,t,{tx_hash:zt(32),index:jt(4)})}function Mt(t){return function(e,r){return t(r,{debugPath:e})}}function Nt(t,{debugPath:e="cell_input"}={}){return It(e,t,{since:jt(8),previous_output:Mt(Lt)})}function $t(t,{debugPath:e="cell_output"}={}){const r=It(e,t,{capacity:jt(8),lock:Mt(Rt)});return t.type&&(r.type_=Rt(t.type,{debugPath:e+".type"})),r}function qt(t,{debugPath:e="cell_dep"}={}){return It(e,t,{out_point:Mt(Lt),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function Ut(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function Vt(t,{debugPath:e="raw_transaction"}={}){return It(e,t,{version:jt(4),cell_deps:Ut(Mt(qt)),header_deps:Ut(zt(32)),inputs:Ut(Mt(Nt)),outputs:Ut(Mt($t)),outputs_data:Ut(zt(-1))})}function Ht(t,{debugPath:e="transaction"}={}){const r=Vt(t,{debugPath:"(raw)"+e}),n=It(e,t,{witnesses:Ut(zt(-1))});return n.raw=r,n}function Ft(t,{debugPath:e="raw_header"}={}){return It(e,t,{version:jt(4),compact_target:jt(4),timestamp:jt(8),number:jt(8),epoch:jt(8),parent_hash:zt(32),transactions_root:zt(32),proposals_hash:zt(32),extra_hash:zt(32),dao:zt(32)})}function Gt(t,{debugPath:e="header"}={}){const r=Ft(t,{debugPath:"(raw)"+e}),n=It(e,t,{nonce:jt(16)});return n.raw=r,n}function Wt(t,{debugPath:e="uncle_block"}={}){return It(e,t,{header:Mt(Gt),proposals:Ut(zt(10))})}var Jt=Object.freeze({__proto__:null,NormalizeScript:Rt,NormalizeOutPoint:Lt,NormalizeCellInput:Nt,NormalizeCellOutput:$t,NormalizeCellDep:qt,NormalizeRawTransaction:Vt,NormalizeTransaction:Ht,NormalizeRawHeader:Ft,NormalizeHeader:Gt,NormalizeUncleBlock:Wt,NormalizeBlock:function(t,{debugPath:e="block"}={}){return It(e,t,{header:Mt(Gt),uncles:Ut(Mt(Wt)),transactions:Ut(Mt(Ht)),proposals:Ut(zt(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return It(e,t,{lock:Mt(Rt),message:zt(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=zt(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=zt(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=zt(-1)(e+".output_type",t.output_type)),r}});function Xt(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Qt(t,e,r){if(!((e=Xt(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function Zt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Qt(r,t,{code_hash:Xt,hash_type:Xt,args:Xt}),e&&y(t,{debugPath:"(transformed) "+r}),t}function Kt(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Qt(r,t,{tx_hash:Xt,index:Xt}),e&&w(t,{debugPath:"(transformed) "+r}),t}function Yt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function te(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Qt(r,t,{since:Xt,previous_output:Yt(Kt)}),e&&v(t,{debugPath:"(transformed) "+r}),t}function ee(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Qt(r,t,{capacity:Xt,lock:Yt(Zt),type:Yt(Zt)}),e&&B(t,{debugPath:"(transformed) "+r}),t}function re(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Qt(r,t,{out_point:Yt(Kt),dep_type:Xt}),e&&P(t,{debugPath:"(transformed) "+r}),t}function ne(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function ie(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Qt(r,t,{version:Xt,cell_deps:ne(Yt(re)),header_deps:ne(Xt),inputs:ne(Yt(te)),outputs:ne(Yt(ee)),outputs_data:ne(Xt),witnesses:ne(Xt)}),e&&x(t,{debugPath:"(transformed) "+r}),t}function oe(t,{validation:e=!0,debugPath:r="header"}={}){return t=Qt(r,t,{version:Xt,compact_target:Xt,timestamp:Xt,number:Xt,epoch:Xt,parent_hash:Xt,transactions_root:Xt,proposals_hash:Xt,extra_hash:Xt,dao:Xt,nonce:Xt}),e&&E(t,{debugPath:"(transformed) "+r}),t}function se(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Qt(r,t,{header:Yt(oe),proposals:ne(Xt)}),e&&A(t,{debugPath:"(transformed) "+r}),t}var ae=Object.freeze({__proto__:null,TransformScript:Zt,TransformOutPoint:Kt,TransformCellInput:te,TransformCellOutput:ee,TransformCellDep:re,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Qt(r,t,{version:Xt,cell_deps:ne(Yt(re)),header_deps:ne(Xt),inputs:ne(Yt(te)),outputs:ne(Yt(ee)),outputs_data:ne(Xt)}),e&&k(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:ie,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Qt(r,t,{version:Xt,compact_target:Xt,timestamp:Xt,number:Xt,epoch:Xt,parent_hash:Xt,transactions_root:Xt,proposals_hash:Xt,extra_hash:Xt,dao:Xt}),e&&C(t,{debugPath:"(transformed) "+r}),t},TransformHeader:oe,TransformUncleBlock:se,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Qt(r,t,{header:Yt(oe),uncles:ne(Yt(se)),transactions:ne(Yt(ie)),proposals:ne(Xt)}),e&&j(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Qt(r,t,{lock:Yt(Zt),message:Xt}),e&&z(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Qt(r,t,{lock:Xt,input_type:Xt,output_type:Xt}),e&&I(t,{debugPath:"(transformed) "+r}),t}});var ue=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:r=!0,loadData:n=!1,loadBlockNumber:i=!0}={}){this.rpc=t,this.lockHash=new h(e).serializeJson(),this.skipCellWithContent=r,this.loadData=n,this.loadBlockNumber=i}async*collect(){const t=Ot(await this.rpc.get_tip_block_number());let e=g.BigInt(0);for(;g.lessThanOrEqual(e,t);){let r=g.add(e,g.BigInt(100));g.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,At(e),At(r));for(const t of n){if(this.skipCellWithContent&&(t.type||g.greaterThan(Ot(t.output_data_len),g.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=g.add(r,g.BigInt(1))}}}});exports.BigIntToHexString=At,exports.HexStringToBigInt=Ot,exports.RPC=Et,exports.Reader=h,exports.TransactionDumper=class{constructor(t,{validateTransaction:e=!0,depGroupUnpacker:r=null}={}){this.rpc=t,this.validateTransaction=e,this.depGroupUnpacker=r}async dumpByHash(t){const e=(await this.rpc.get_transaction(t)).transaction;return delete e.hash,await this.dump(e)}async dump(t){this.validateTransaction&&x(t);const e=[];for(const r of t.inputs){const{output:t,data:n,header:i}=await this._resolveOutPoint(r.previous_output);e.push({input:r,output:t,data:n,header:i})}const r=[];for(const e of t.cell_deps){const{output:t,data:n,header:i}=await this._resolveOutPoint(e.out_point);if(r.push({cell_dep:e,output:t,data:n,header:i}),"dep_group"===e.dep_type){if(!this.depGroupUnpacker)throw new Error("depGroupUnpacker must be provided when the transaction contains dep_group!");const t=this.depGroupUnpacker(new h(n));for(const e of t){w(e);const{output:t,data:n,header:i}=await this._resolveOutPoint(e);r.push({cell_dep:{out_point:e,dep_type:"code"},output:t,data:n,header:i})}}}const n=[];for(const e of t.header_deps)n.push(await this.rpc.get_header(e));return JSON.stringify({mock_info:{inputs:e,cell_deps:r,header_deps:n},tx:t})}async _resolveOutPoint(t){const e=await this.rpc.get_transaction(t.tx_hash);if(!e||!e.transaction)throw new Error(`Transaction ${t.tx_hash} cannot be found!`);const r=e.transaction,n=g.toNumber(g.BigInt(t.index));if(n>=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}},exports.VERSION="0.10.2",exports.cell_collectors=ue,exports.normalizers=Jt,exports.transformers=ae,exports.validators=R; //# sourceMappingURL=ckb-js-toolkit.node.js.map diff --git a/dist/ckb-js-toolkit.node.js.map b/dist/ckb-js-toolkit.node.js.map index 4ad13b7..660c827 100644 --- a/dist/ckb-js-toolkit.node.js.map +++ b/dist/ckb-js-toolkit.node.js.map @@ -1 +1 @@ -{"version":3,"file":"ckb-js-toolkit.node.js","sources":["../src/reader.js","../node_modules/jsbi/dist/jsbi.mjs","../src/validators.js","../node_modules/node-fetch/lib/index.mjs","../node_modules/cross-fetch/dist/node-ponyfill.js","../src/rpc.js","../src/normalizers.js","../src/transformers.js","../src/cell_collectors/rpc_collector.js","../src/transaction_dumper.js","../src/index.js"],"sourcesContent":["class ArrayBufferReader {\n constructor(buffer) {\n this.view = new DataView(buffer);\n }\n\n length() {\n return this.view.byteLength;\n }\n\n indexAt(i) {\n return this.view.getUint8(i);\n }\n\n toArrayBuffer() {\n return this.view.buffer;\n }\n\n serializeJson() {\n return (\n \"0x\" +\n Array.prototype.map\n .call(new Uint8Array(this.view.buffer), x =>\n (\"00\" + x.toString(16)).slice(-2)\n )\n .join(\"\")\n );\n }\n}\n\nclass HexStringReader {\n constructor(string) {\n this.string = string;\n }\n\n length() {\n return this.string.length / 2 - 1;\n }\n\n indexAt(i) {\n return parseInt(this.string.substr(2 + i * 2, 2), 16);\n }\n\n toArrayBuffer() {\n const buffer = new ArrayBuffer(this.length());\n const view = new DataView(buffer);\n\n for (let i = 0; i < this.length(); i++) {\n view.setUint8(i, this.indexAt(i));\n }\n return buffer;\n }\n\n serializeJson() {\n return this.string;\n }\n}\n\nexport class Reader {\n constructor(input) {\n if (\n input instanceof HexStringReader ||\n input instanceof ArrayBufferReader\n ) {\n return input;\n }\n if (typeof input === \"string\") {\n if (!input.startsWith(\"0x\") || input.length % 2 != 0) {\n throw new Error(\n \"Hex string must start with 0x, and has even numbered length!\"\n );\n }\n return new HexStringReader(input);\n }\n if (input instanceof ArrayBuffer) {\n return new ArrayBufferReader(input);\n }\n throw new Error(\"Reader can only accept hex string or ArrayBuffer!\");\n }\n\n static fromRawString(string) {\n const buffer = new ArrayBuffer(string.length);\n const view = new DataView(buffer);\n\n for (let i = 0; i < string.length; i++) {\n const c = string.charCodeAt(i);\n if (c > 0xff) {\n throw new Error(\"fromRawString can only accept UTF-8 raw string!\");\n }\n view.setUint8(i, c);\n }\n return new ArrayBufferReader(buffer);\n }\n}\n","class JSBI extends Array{constructor(a,b){if(a>JSBI.__kMaxLength)throw new RangeError(\"Maximum BigInt size exceeded\");super(a),this.sign=b}static BigInt(a){var b=Math.floor,c=Number.isFinite;if(\"number\"==typeof a){if(0===a)return JSBI.__zero();if((0|a)===a)return 0>a?JSBI.__oneDigit(-a,!0):JSBI.__oneDigit(a,!1);if(!c(a)||b(a)!==a)throw new RangeError(\"The number \"+a+\" cannot be converted to BigInt because it is not an integer\");return JSBI.__fromDouble(a)}if(\"string\"==typeof a){const b=JSBI.__fromString(a);if(null===b)throw new SyntaxError(\"Cannot convert \"+a+\" to a BigInt\");return b}if(\"boolean\"==typeof a)return!0===a?JSBI.__oneDigit(1,!1):JSBI.__zero();if(\"object\"==typeof a){if(a.constructor===JSBI)return a;const b=JSBI.__toPrimitive(a);return JSBI.BigInt(b)}throw new TypeError(\"Cannot convert \"+a+\" to a BigInt\")}toDebugString(){const a=[\"BigInt[\"];for(const b of this)a.push((b?(b>>>0).toString(16):b)+\", \");return a.push(\"]\"),a.join(\"\")}toString(a=10){if(2>a||36>>=12;const l=j-12;let m=12<=j?0:h<<20+j,n=20+j;0>>32-l,m=h<>>32-n,n-=32);const o=JSBI.__decideRounding(a,n,i,h);if((1===o||0===o&&1==(1&m))&&(m=m+1>>>0,0==m&&(k++,0!=k>>>20&&(k=0,g++,1023=JSBI.__kMaxLengthBits)throw new RangeError(\"BigInt too big\");if(1===a.length&&2===a.__digit(0)){const b=1+(c>>>5),d=a.sign&&0!=(1&c),e=new JSBI(b,d);e.__initializeDigits();const f=1<<(31&c);return e.__setDigit(b-1,f),e}let d=null,e=a;for(0!=(1&c)&&(d=a),c>>=1;0!==c;c>>=1)e=JSBI.multiply(e,e),0!=(1&c)&&(null===d?d=e:d=JSBI.multiply(d,e));return d}static multiply(a,b){if(0===a.length)return a;if(0===b.length)return b;let c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;const d=new JSBI(c,a.sign!==b.sign);d.__initializeDigits();for(let c=0;cJSBI.__absoluteCompare(a,b))return JSBI.__zero();const c=a.sign!==b.sign,d=b.__unsignedDigit(0);let e;if(1===b.length&&65535>=d){if(1===d)return c===a.sign?a:JSBI.unaryMinus(a);e=JSBI.__absoluteDivSmall(a,d,null)}else e=JSBI.__absoluteDivLarge(a,b,!0,!1);return e.sign=c,e.__trim()}static remainder(a,b){if(0===b.length)throw new RangeError(\"Division by zero\");if(0>JSBI.__absoluteCompare(a,b))return a;const c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return JSBI.__zero();const b=JSBI.__absoluteModSmall(a,c);return 0===b?JSBI.__zero():JSBI.__oneDigit(b,a.sign)}const d=JSBI.__absoluteDivLarge(a,b,!1,!0);return d.sign=a.sign,d.__trim()}static add(a,b){const c=a.sign;return c===b.sign?JSBI.__absoluteAdd(a,b,c):0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c)}static subtract(a,b){const c=a.sign;return c===b.sign?0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c):JSBI.__absoluteAdd(a,b,c)}static leftShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__rightShiftByAbsolute(a,b):JSBI.__leftShiftByAbsolute(a,b)}static signedRightShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__leftShiftByAbsolute(a,b):JSBI.__rightShiftByAbsolute(a,b)}static unsignedRightShift(){throw new TypeError(\"BigInts have no unsigned right shift; use >> instead\")}static lessThan(a,b){return 0>JSBI.__compareToBigInt(a,b)}static lessThanOrEqual(a,b){return 0>=JSBI.__compareToBigInt(a,b)}static greaterThan(a,b){return 0=JSBI.__kMaxLengthBits)return b;const c=a+31>>>5;if(b.lengthJSBI.__kMaxLengthBits)throw new RangeError(\"BigInt too big\");return JSBI.__truncateAndSubFromPowerOfTwo(a,b,!1)}if(a>=JSBI.__kMaxLengthBits)return b;const c=a+31>>>5;if(b.length>>d)return b}return JSBI.__truncateToNBits(a,b)}static ADD(a,b){if(a=JSBI.__toPrimitive(a),b=JSBI.__toPrimitive(b),\"string\"==typeof a)return\"string\"!=typeof b&&(b=b.toString()),a+b;if(\"string\"==typeof b)return a.toString()+b;if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)&&JSBI.__isBigInt(b))return JSBI.add(a,b);if(\"number\"==typeof a&&\"number\"==typeof b)return a+b;throw new TypeError(\"Cannot mix BigInt and other types, use explicit conversions\")}static LT(a,b){return JSBI.__compare(a,b,0)}static LE(a,b){return JSBI.__compare(a,b,1)}static GT(a,b){return JSBI.__compare(a,b,2)}static GE(a,b){return JSBI.__compare(a,b,3)}static EQ(a,b){for(;;){if(JSBI.__isBigInt(a))return JSBI.__isBigInt(b)?JSBI.equal(a,b):JSBI.EQ(b,a);if(\"number\"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,a);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"string\"==typeof a){if(JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.equal(a,b);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"boolean\"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,+a);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"symbol\"==typeof a){if(JSBI.__isBigInt(b))return!1;if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"object\"==typeof a){if(\"object\"==typeof b&&b.constructor!==JSBI)return a==b;a=JSBI.__toPrimitive(a)}else return a==b}}static NE(a,b){return!JSBI.EQ(a,b)}static __zero(){return new JSBI(0,!1)}static __oneDigit(a,b){const c=new JSBI(1,b);return c.__setDigit(0,a),c}__copy(){const a=new JSBI(this.length,this.sign);for(let b=0;bb)e=-b-1;else{if(0===c)return-1;c--,d=a.__digit(c),e=31}let f=1<>>20,c=b-1023,d=(c>>>5)+1,e=new JSBI(d,0>a);let f=1048575&JSBI.__kBitConversionInts[1]|1048576,g=JSBI.__kBitConversionInts[0];const h=20,i=31&c;let j,k=0;if(i<20){const a=h-i;k=a+32,j=f>>>a,f=f<<32-a|g>>>a,g<<=32-a}else if(i===20)k=32,j=f,f=g;else{const a=i-h;k=32-a,j=f<>>32-a,f=g<=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}static __fromString(a,b=0){let c=0;const e=a.length;let f=0;if(f===e)return JSBI.__zero();let g=a.charCodeAt(f);for(;JSBI.__isWhitespace(g);){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}if(43===g){if(++f===e)return null;g=a.charCodeAt(f),c=1}else if(45===g){if(++f===e)return null;g=a.charCodeAt(f),c=-1}if(0===b){if(b=10,48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(b=16,++f===e)return null;g=a.charCodeAt(f)}else if(79===g||111===g){if(b=8,++f===e)return null;g=a.charCodeAt(f)}else if(66===g||98===g){if(b=2,++f===e)return null;g=a.charCodeAt(f)}}}else if(16===b&&48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(++f===e)return null;g=a.charCodeAt(f)}}for(;48===g;){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}const h=e-f;let i=JSBI.__kMaxBitsPerChar[b],j=JSBI.__kBitsPerCharTableMultiplier-1;if(h>1073741824/i)return null;const k=i*h+j>>>JSBI.__kBitsPerCharTableShift,l=new JSBI(k+31>>>5,!1),n=10>b?b:10,o=10>=JSBI.__kBitsPerCharTableShift;const b=[],c=[];let d=!1;do{let h=0,j=0;for(;;){let b;if(g-48>>>0>>0>>0>>0>>JSBI.__kBitsPerCharTableShift+5;l.__inplaceMultiplyAdd(p,k,q)}while(!c)}if(f!==e){if(!JSBI.__isWhitespace(g))return null;for(f++;f>>i-f)}if(0!==e){if(d>=a.length)throw new Error(\"implementation bug\");a.__setDigit(d++,e)}for(;d>>1)+(85&e),e=(51&e>>>2)+(51&e),e=(15&e>>>4)+(15&e);const f=e,g=b-1,h=a.__digit(d-1),i=c(h);let j=0|(32*d-i+f-1)/f;if(a.sign&&j++,268435456>>e,n=32-e;n>=f;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f,n-=f}const o=(m|h<>>f-n;0!==m;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f;if(a.sign&&(k[l--]=\"-\"),-1!=l)throw new Error(\"implementation bug\");return k.join(\"\")}static __toStringGeneric(a,b,c){var d=Math.clz32;const e=a.length;if(0===e)return\"\";if(1===e){let d=a.__unsignedDigit(0).toString(b);return!1===c&&a.sign&&(d=\"-\"+d),d}const f=32*e-d(a.__digit(e-1)),g=JSBI.__kMaxBitsPerChar[b],h=g-1;let i=f*JSBI.__kBitsPerCharTableMultiplier;i+=h-1,i=0|i/h;const j=i+1>>1,k=JSBI.exponentiate(JSBI.__oneDigit(b,!1),JSBI.__oneDigit(j,!1));let l,m;const n=k.__unsignedDigit(0);if(1===k.length&&65535>=n){l=new JSBI(a.length,!1),l.__initializeDigits();let c=0;for(let b=2*a.length-1;0<=b;b--){const d=c<<16|a.__halfDigit(b);l.__setHalfDigit(b,0|d/n),c=0|d%n}m=c.toString(b)}else{const c=JSBI.__absoluteDivLarge(a,k,!0,!0);l=c.quotient;const d=c.remainder.__trim();m=JSBI.__toStringGeneric(d,b,!0)}l.__trim();let o=JSBI.__toStringGeneric(l,b,!0);for(;m.lengthd?JSBI.__absoluteLess(c):0}static __compareToNumber(a,b){if(b|!0){const c=a.sign,d=0>b;if(c!==d)return JSBI.__unequalSign(c);if(0===a.length){if(d)throw new Error(\"implementation bug\");return 0===b?0:-1}if(1e?JSBI.__absoluteGreater(c):fb)return JSBI.__unequalSign(d);if(0===b)throw new Error(\"implementation bug: should be handled elsewhere\");if(0===a.length)return-1;JSBI.__kBitConversionDouble[0]=b;const e=2047&JSBI.__kBitConversionInts[1]>>>20;if(2047==e)throw new Error(\"implementation bug: handled elsewhere\");const f=e-1023;if(0>f)return JSBI.__absoluteGreater(d);const g=a.length;let h=a.__digit(g-1);const i=c(h),j=32*g-i,k=f+1;if(jk)return JSBI.__absoluteGreater(d);let l=1048576|1048575&JSBI.__kBitConversionInts[1],m=JSBI.__kBitConversionInts[0];const n=20,o=31-i;if(o!==(j-1)%31)throw new Error(\"implementation bug\");let p,q=0;if(20>o){const a=n-o;q=a+32,p=l>>>a,l=l<<32-a|m>>>a,m<<=32-a}else if(20===o)q=32,p=l,l=m;else{const a=o-n;q=32-a,p=l<>>32-a,l=m<>>=0,p>>>=0,h>p)return JSBI.__absoluteGreater(d);if(h>>0,l=m,m=0):p=0;const b=a.__unsignedDigit(c);if(b>p)return JSBI.__absoluteGreater(d);if(bb&&a.__unsignedDigit(0)===c(b):0===JSBI.__compareToDouble(a,b)}static __comparisonResultToBool(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0b;case 3:return a>=b;}if(JSBI.__isBigInt(a)&&\"string\"==typeof b)return b=JSBI.__fromString(b),null!==b&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(\"string\"==typeof a&&JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)){if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(\"number\"!=typeof b)throw new Error(\"implementation bug\");return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(a,b),c)}if(\"number\"!=typeof a)throw new Error(\"implementation bug\");if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(b,a),2^c);if(\"number\"!=typeof b)throw new Error(\"implementation bug\");return 0===c?ab:3===c?a>=b:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(a,b,c){if(a.length>>16)+(c>>>16)+(h>>>16);f=i>>>16,e.__setDigit(g,65535&h|i<<16)}for(;g>>16)+(c>>>16);f=d>>>16,e.__setDigit(g,65535&c|d<<16)}return g>>16;const i=(c>>>16)-(g>>>16)-e;e=1&i>>>16,d.__setDigit(f,65535&h|i<<16)}for(;f>>16;const g=(b>>>16)-e;e=1&g>>>16,d.__setDigit(f,65535&c|g<<16)}return d.__trim()}static __absoluteAddOne(a,b,c=null){const d=a.length;null===c?c=new JSBI(d,b):c.sign=b;let e=!0;for(let f,g=0;gd?0:a.__unsignedDigit(d)>b.__unsignedDigit(d)?1:-1}static __multiplyAccumulate(a,b,c,d){var e=Math.imul;if(0===b)return;const f=65535&b,g=b>>>16;let h=0,j=0,k=0;for(let l=0;l>>16;const n=a.__digit(l),o=65535&n,p=n>>>16,q=e(o,f),r=e(o,g),s=e(p,f),t=e(p,g);i+=j+(65535&q),m+=k+h+(i>>>16)+(q>>>16)+(65535&r)+(65535&s),h=m>>>16,j=(r>>>16)+(s>>>16)+(65535&t)+h,h=j>>>16,j&=65535,k=t>>>16,b=65535&i|m<<16,c.__setDigit(d,b)}for(;0!=h||0!==j||0!==k;d++){let a=c.__digit(d);const b=(65535&a)+j,e=(a>>>16)+(b>>>16)+k+h;j=0,k=0,h=e>>>16,a=65535&b|e<<16,c.__setDigit(d,a)}}static __internalMultiplyAdd(a,b,c,d,e){var f=Math.imul;let g=c,h=0;for(let j=0;j>>16;const k=f(c>>>16,b),l=(65535&k)+(d>>>16)+g;g=l>>>16,h=k>>>16,e.__setDigit(j,l<<16|65535&i)}if(e.length>d)for(e.__setDigit(d++,g+h);dthis.length&&(c=this.length);const f=65535&a,g=a>>>16;let h=0,j=65535&b,k=b>>>16;for(let l=0;l>>16,d=e(b,f),i=e(b,g),m=e(c,f),n=e(c,g),o=j+(65535&d),p=k+h+(o>>>16)+(d>>>16)+(65535&i)+(65535&m);j=(i>>>16)+(m>>>16)+(65535&n)+(p>>>16),h=j>>>16,j&=65535,k=n>>>16;this.__setDigit(l,65535&o|p<<16)}if(0!=h||0!==j||0!==k)throw new Error(\"implementation bug\")}static __absoluteDivSmall(a,b,c){null===c&&(c=new JSBI(a.length,!1));let d=0;for(let e,f=2*a.length-1;0<=f;f-=2){e=(d<<16|a.__halfDigit(f))>>>0;const g=0|e/b;d=0|e%b,e=(d<<16|a.__halfDigit(f-1))>>>0;const h=0|e/b;d=0|e%b,c.__setDigit(f>>>1,g<<16|h)}return c}static __absoluteModSmall(a,b){let c=0;for(let d=2*a.length-1;0<=d;d--){const e=(c<<16|a.__halfDigit(d))>>>0;c=0|e%b}return c}static __absoluteDivLarge(a,b,d,e){var f=Math.imul;const g=b.__halfDigitLength(),h=b.length,c=a.__halfDigitLength()-g;let i=null;d&&(i=new JSBI(c+2>>>1,!1),i.__initializeDigits());const k=new JSBI(g+2>>>1,!1);k.__initializeDigits();const l=JSBI.__clz16(b.__halfDigit(g-1));0>>0;l=0|c/n;let d=0|c%n;const e=b.__halfDigit(g-2),h=m.__halfDigit(p+g-2);for(;f(l,e)>>>0>(d<<16|h)>>>0&&(l--,d+=n,!(65535>>1,o|l))}return e?(m.__inplaceRightShift(l),d?{quotient:i,remainder:m}:m):d?i:void 0}static __clz16(a){return Math.clz32(a)-16}__inplaceAdd(a,b,c){let d=0;for(let e=0;e>>16,this.__setHalfDigit(b+e,c)}return d}__inplaceSub(a,b,c){let d=0;if(1&b){b>>=1;let e=this.__digit(b),f=65535&e,g=0;for(;g>>1;g++){const c=a.__digit(g),h=(e>>>16)-(65535&c)-d;d=1&h>>>16,this.__setDigit(b+g,h<<16|65535&f),e=this.__digit(b+g+1),f=(65535&e)-(c>>>16)-d,d=1&f>>>16}const h=a.__digit(g),i=(e>>>16)-(65535&h)-d;d=1&i>>>16,this.__setDigit(b+g,i<<16|65535&f);if(b+g+1>=this.length)throw new RangeError(\"out of bounds\");0==(1&c)&&(e=this.__digit(b+g+1),f=(65535&e)-(h>>>16)-d,d=1&f>>>16,this.__setDigit(b+a.length,4294901760&e|65535&f))}else{b>>=1;let e=0;for(;e>>16;const h=(c>>>16)-(f>>>16)-d;d=1&h>>>16,this.__setDigit(b+e,h<<16|65535&g)}const f=this.__digit(b+e),g=a.__digit(e),h=(65535&f)-(65535&g)-d;d=1&h>>>16;let i=0;0==(1&c)&&(i=(f>>>16)-(g>>>16)-d,d=1&i>>>16),this.__setDigit(b+e,i<<16|65535&h)}return d}__inplaceRightShift(a){if(0===a)return;let b=this.__digit(0)>>>a;const c=this.length-1;for(let e=0;e>>a}this.__setDigit(c,b)}static __specialLeftShift(a,b,c){const d=a.length,e=new JSBI(d+c,!1);if(0===b){for(let b=0;b>>32-b}return 0c)throw new RangeError(\"BigInt too big\");const e=c>>>5,f=31&c,g=a.length,h=0!==f&&0!=a.__digit(g-1)>>>32-f,j=g+e+(h?1:0),k=new JSBI(j,a.sign);if(0===f){let b=0;for(;b>>32-f}if(h)k.__setDigit(g+e,b);else if(0!=b)throw new Error(\"implementation bug\")}return k.__trim()}static __rightShiftByAbsolute(a,b){const c=a.length,d=a.sign,e=JSBI.__toShiftAmount(b);if(0>e)return JSBI.__rightShiftByMaximum(d);const f=e>>>5,g=31&e;let h=c-f;if(0>=h)return JSBI.__rightShiftByMaximum(d);let i=!1;if(d){if(0!=(a.__digit(f)&(1<>>g;const d=c-f-1;for(let c=0;c>>g}j.__setDigit(d,b)}return i&&(j=JSBI.__absoluteAddOne(j,!0,j)),j.__trim()}static __rightShiftByMaximum(a){return a?JSBI.__oneDigit(1,!0):JSBI.__zero()}static __toShiftAmount(a){if(1JSBI.__kMaxLengthBits?-1:b}static __toPrimitive(a,b=\"default\"){if(\"object\"!=typeof a)return a;if(a.constructor===JSBI)return a;const c=a[Symbol.toPrimitive];if(c){const a=c(b);if(\"object\"!=typeof a)return a;throw new TypeError(\"Cannot convert object to primitive value\")}const d=a.valueOf;if(d){const b=d.call(a);if(\"object\"!=typeof b)return b}const e=a.toString;if(e){const b=e.call(a);if(\"object\"!=typeof b)return b}throw new TypeError(\"Cannot convert object to primitive value\")}static __toNumeric(a){return JSBI.__isBigInt(a)?a:+a}static __isBigInt(a){return\"object\"==typeof a&&a.constructor===JSBI}static __truncateToNBits(a,b){const c=a+31>>>5,d=new JSBI(c,b.sign),e=c-1;for(let c=0;c>>b}return d.__setDigit(e,f),d.__trim()}static __truncateAndSubFromPowerOfTwo(a,b,c){var d=Math.min;const e=a+31>>>5,f=new JSBI(e,c);let g=0;const h=e-1;let j=0;for(const e=d(h,b.length);g>>16;const d=0-(a>>>16)-j;j=1&d>>>16,f.__setDigit(g,65535&c|d<<16)}for(;g>>16;const b=0-(k>>>16)-j;m=65535&a|b<<16}else{const a=32-l;k=k<>>a;const b=1<<32-a,c=(65535&b)-(65535&k)-j;j=1&c>>>16;const d=(b>>>16)-(k>>>16)-j;m=65535&c|d<<16,m&=b-1}return f.__setDigit(h,m),f.__trim()}__digit(a){return this[a]}__unsignedDigit(a){return this[a]>>>0}__setDigit(a,b){this[a]=0|b}__setDigitGrow(a,b){this[a]=0|b}__halfDigitLength(){const a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}__halfDigit(a){return 65535&this[a>>>1]>>>((1&a)<<4)}__setHalfDigit(a,b){const c=a>>>1,d=this.__digit(c),e=1&a?65535&d|b<<16:4294901760&d|65535&b;this.__setDigit(c,e)}static __digitPow(a,b){let c=1;for(;0>>=1,a*=a;return c}}JSBI.__kMaxLength=33554432,JSBI.__kMaxLengthBits=JSBI.__kMaxLength<<5,JSBI.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],JSBI.__kBitsPerCharTableShift=5,JSBI.__kBitsPerCharTableMultiplier=1< maximalLength\n ) {\n throw new Error(errorMessage);\n }\n let optionalProvidedKeys = providedKeys.filter(\n key => !expectedKeys.includes(key)\n );\n if (providedKeys.length - optionalProvidedKeys.length !== requiredLength) {\n throw new Error(errorMessage);\n }\n if (optionalProvidedKeys.find(key => !optionalKeys.includes(key))) {\n throw new Error(errorMessage);\n }\n}\n\nfunction assertHexString(debugPath, string) {\n if (!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(string)) {\n throw new Error(`${debugPath} must be a hex string!`);\n }\n}\n\nfunction assertHash(debugPath, hash) {\n assertHexString(debugPath, hash);\n if (hash.length !== 66) {\n throw new Error(`${debugPath} must be a hex string of 66 bytes long!`);\n }\n}\n\nfunction assertInteger(debugPath, i) {\n if (i === \"0x0\") {\n return;\n }\n if (!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(i)) {\n throw new Error(`${debugPath} must be a hex integer!`);\n }\n}\n\nexport function ValidateScript(\n script,\n { nestedValidation = true, debugPath = \"script\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n script,\n [\"code_hash\", \"hash_type\", \"args\"],\n []\n );\n assertHash(`${debugPath}.code_hash`, script.code_hash);\n assertHexString(`${debugPath}.args`, script.args);\n\n if (\n script.hash_type !== \"data\" &&\n script.hash_type !== \"type\" &&\n script.hash_type !== \"data1\"\n ) {\n throw new Error(`${debugPath}.hash_type must be either data or type!`);\n }\n}\n\nexport function ValidateOutPoint(\n outPoint,\n { nestedValidation = true, debugPath = \"out_point\" } = {}\n) {\n assertObjectWithKeys(debugPath, outPoint, [\"tx_hash\", \"index\"], []);\n assertHash(`${debugPath}.tx_hash`, outPoint.tx_hash);\n assertInteger(`${debugPath}.index`, outPoint.index);\n}\n\nexport function ValidateCellInput(\n cellInput,\n { nestedValidation = true, debugPath = \"cell_input\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellInput, [\"since\", \"previous_output\"], []);\n assertInteger(`${debugPath}.since`, cellInput.since);\n\n if (nestedValidation) {\n ValidateOutPoint(cellInput.previous_output, {\n debugPath: `${debugPath}.previous_output`\n });\n }\n}\n\nexport function ValidateCellOutput(\n cellOutput,\n { nestedValidation = true, debugPath = \"cell_output\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellOutput, [\"capacity\", \"lock\"], [\"type\"]);\n assertInteger(`${debugPath}.capacity`, cellOutput.capacity);\n\n if (nestedValidation) {\n ValidateScript(cellOutput.lock, {\n debugPath: `${debugPath}.lock`\n });\n if (cellOutput.type) {\n ValidateScript(cellOutput.type, {\n debugPath: `${debugPath}.type`\n });\n }\n }\n}\n\nexport function ValidateCellDep(\n cellDep,\n { nestedValidation = true, debugPath = \"cell_dep\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellDep, [\"out_point\", \"dep_type\"], []);\n if (cellDep.dep_type !== \"code\" && cellDep.dep_type !== \"dep_group\") {\n throw new Error(`${debugPath}.dep_type must be either code or dep_group!`);\n }\n\n if (nestedValidation) {\n ValidateOutPoint(cellDep.out_point, {\n debugPath: `${debugPath}.out_point`\n });\n }\n}\n\nfunction assertArray(debugPath, array, validateFunction, nestedValidation) {\n if (!Array.isArray(array)) {\n throw new Error(`${debugPath} is not an array!`);\n }\n if (nestedValidation) {\n for (let i = 0; i < array.length; i++) {\n validateFunction(`${debugPath}[${i}]`, array[i]);\n }\n }\n}\n\nfunction toAssert(validateFunction, nestedValidation) {\n return function(debugPath, value) {\n validateFunction(value, {\n nestedValidation: nestedValidation,\n debugPath: debugPath\n });\n };\n}\n\nfunction assertCommonTransaction(debugPath, rawTransaction, nestedValidation) {\n assertInteger(`${debugPath}.version`, rawTransaction.version);\n assertArray(\n `${debugPath}.cell_deps`,\n rawTransaction.cell_deps,\n toAssert(ValidateCellDep, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.header_deps`,\n rawTransaction.header_deps,\n assertHash,\n nestedValidation\n );\n assertArray(\n `${debugPath}.inputs`,\n rawTransaction.inputs,\n toAssert(ValidateCellInput, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.outputs`,\n rawTransaction.outputs,\n toAssert(ValidateCellOutput, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.outputs_data`,\n rawTransaction.outputs_data,\n assertHexString,\n nestedValidation\n );\n}\n\nexport function ValidateRawTransaction(\n rawTransaction,\n { nestedValidation = true, debugPath = \"raw_transaction\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n rawTransaction,\n [\n \"version\",\n \"cell_deps\",\n \"header_deps\",\n \"inputs\",\n \"outputs\",\n \"outputs_data\"\n ],\n []\n );\n assertCommonTransaction(debugPath, rawTransaction, nestedValidation);\n}\n\nexport function ValidateTransaction(\n transaction,\n { nestedValidation = true, debugPath = \"transaction\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n transaction,\n [\n \"version\",\n \"cell_deps\",\n \"header_deps\",\n \"inputs\",\n \"outputs\",\n \"outputs_data\",\n \"witnesses\"\n ],\n []\n );\n assertCommonTransaction(debugPath, transaction, nestedValidation);\n assertArray(\n `${debugPath}.witnesses`,\n transaction.witnesses,\n assertHexString,\n nestedValidation\n );\n}\n\nfunction assertCommonHeader(debugPath, rawHeader) {\n assertInteger(`${debugPath}.version`, rawHeader.version);\n assertInteger(`${debugPath}.compact_target`, rawHeader.compact_target);\n assertInteger(`${debugPath}.timestamp`, rawHeader.timestamp);\n assertInteger(`${debugPath}.number`, rawHeader.number);\n assertInteger(`${debugPath}.epoch`, rawHeader.epoch);\n assertHash(`${debugPath}.parent_hash`, rawHeader.parent_hash);\n assertHash(`${debugPath}.transactions_root`, rawHeader.transactions_root);\n assertHash(`${debugPath}.proposals_hash`, rawHeader.proposals_hash);\n assertHash(`${debugPath}.uncles_hash`, rawHeader.uncles_hash);\n assertHash(`${debugPath}.dao`, rawHeader.dao);\n}\n\nexport function ValidateRawHeader(\n rawHeader,\n { nestedValidation = true, debugPath = \"raw_header\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n rawHeader,\n [\n \"version\",\n \"compact_target\",\n \"timestamp\",\n \"number\",\n \"epoch\",\n \"parent_hash\",\n \"transactions_root\",\n \"proposals_hash\",\n \"uncles_hash\",\n \"dao\"\n ],\n []\n );\n assertCommonHeader(debugPath, rawHeader);\n}\n\nexport function ValidateHeader(\n header,\n { nestedValidation = true, debugPath = \"header\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n header,\n [\n \"version\",\n \"compact_target\",\n \"timestamp\",\n \"number\",\n \"epoch\",\n \"parent_hash\",\n \"transactions_root\",\n \"proposals_hash\",\n \"uncles_hash\",\n \"dao\",\n \"nonce\"\n ],\n []\n );\n assertHexString(`${debugPath}.nonce`, header.nonce);\n if (header.nonce.length !== 34) {\n throw new Error(\n `${debugPath}.nonce must be a hex string of 34 bytes long!`\n );\n }\n}\n\nfunction assertProposalShortId(debugPath, shortId) {\n assertHexString(debugPath, shortId);\n if (shortId.length !== 22) {\n throw new Error(`${debugPath} must be a hex string of 22 bytes long!`);\n }\n}\n\nexport function ValidateUncleBlock(\n uncleBlock,\n { nestedValidation = true, debugPath = \"uncle_block\" } = {}\n) {\n assertObjectWithKeys(debugPath, uncleBlock, [\"header\", \"proposals\"], []);\n\n if (nestedValidation) {\n ValidateHeader(uncleBlock.header, {\n debugPath: `${debugPath}.header`\n });\n }\n assertArray(\n `${debugPath}.proposals`,\n uncleBlock.proposals,\n assertProposalShortId,\n nestedValidation\n );\n}\n\nexport function ValidateBlock(\n block,\n { nestedValidation = true, debugPath = \"block\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n block,\n [\"header\", \"uncles\", \"transactions\", \"proposals\"],\n []\n );\n\n if (nestedValidation) {\n ValidateHeader(block.header, {\n debugPath: `${debugPath}.header`\n });\n }\n assertArray(\n `${debugPath}.uncles`,\n block.uncles,\n toAssert(ValidateUncleBlock, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.transactions`,\n block.transactions,\n toAssert(ValidateTransaction, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.proposals`,\n block.proposals,\n assertProposalShortId,\n nestedValidation\n );\n}\n\nexport function ValidateCellbaseWitness(\n cellbaseWitness,\n { nestedValidation = true, debugPath = \"cellbase_witness\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellbaseWitness, [\"lock\", \"message\"], []);\n assertHexString(`${debugPath}.message`, cellbaseWitness.message);\n\n if (nestedValidation) {\n ValidateScript(cellbaseWitness.lock, {\n debugPath: `${debugPath}.lock`\n });\n }\n}\n\nexport function ValidateWitnessArgs(\n witnessArgs,\n { nestedValidation = true, debugPath = \"witness_args\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n witnessArgs,\n [],\n [\"lock\", \"input_type\", \"output_type\"]\n );\n\n if (witnessArgs.lock) {\n assertHexString(`${debugPath}.lock`, witnessArgs.lock);\n }\n if (witnessArgs.input_type) {\n assertHexString(`${debugPath}.input_type`, witnessArgs.input_type);\n }\n if (witnessArgs.output_type) {\n assertHexString(`${debugPath}.output_type`, witnessArgs.output_type);\n }\n}\n","import Stream from 'stream';\nimport http from 'http';\nimport Url from 'url';\nimport https from 'https';\nimport zlib from 'zlib';\n\n// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js\n\n// fix for \"Readable\" isn't a named export issue\nconst Readable = Stream.Readable;\n\nconst BUFFER = Symbol('buffer');\nconst TYPE = Symbol('type');\n\nclass Blob {\n\tconstructor() {\n\t\tthis[TYPE] = '';\n\n\t\tconst blobParts = arguments[0];\n\t\tconst options = arguments[1];\n\n\t\tconst buffers = [];\n\t\tlet size = 0;\n\n\t\tif (blobParts) {\n\t\t\tconst a = blobParts;\n\t\t\tconst length = Number(a.length);\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\tconst element = a[i];\n\t\t\t\tlet buffer;\n\t\t\t\tif (element instanceof Buffer) {\n\t\t\t\t\tbuffer = element;\n\t\t\t\t} else if (ArrayBuffer.isView(element)) {\n\t\t\t\t\tbuffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);\n\t\t\t\t} else if (element instanceof ArrayBuffer) {\n\t\t\t\t\tbuffer = Buffer.from(element);\n\t\t\t\t} else if (element instanceof Blob) {\n\t\t\t\t\tbuffer = element[BUFFER];\n\t\t\t\t} else {\n\t\t\t\t\tbuffer = Buffer.from(typeof element === 'string' ? element : String(element));\n\t\t\t\t}\n\t\t\t\tsize += buffer.length;\n\t\t\t\tbuffers.push(buffer);\n\t\t\t}\n\t\t}\n\n\t\tthis[BUFFER] = Buffer.concat(buffers);\n\n\t\tlet type = options && options.type !== undefined && String(options.type).toLowerCase();\n\t\tif (type && !/[^\\u0020-\\u007E]/.test(type)) {\n\t\t\tthis[TYPE] = type;\n\t\t}\n\t}\n\tget size() {\n\t\treturn this[BUFFER].length;\n\t}\n\tget type() {\n\t\treturn this[TYPE];\n\t}\n\ttext() {\n\t\treturn Promise.resolve(this[BUFFER].toString());\n\t}\n\tarrayBuffer() {\n\t\tconst buf = this[BUFFER];\n\t\tconst ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n\t\treturn Promise.resolve(ab);\n\t}\n\tstream() {\n\t\tconst readable = new Readable();\n\t\treadable._read = function () {};\n\t\treadable.push(this[BUFFER]);\n\t\treadable.push(null);\n\t\treturn readable;\n\t}\n\ttoString() {\n\t\treturn '[object Blob]';\n\t}\n\tslice() {\n\t\tconst size = this.size;\n\n\t\tconst start = arguments[0];\n\t\tconst end = arguments[1];\n\t\tlet relativeStart, relativeEnd;\n\t\tif (start === undefined) {\n\t\t\trelativeStart = 0;\n\t\t} else if (start < 0) {\n\t\t\trelativeStart = Math.max(size + start, 0);\n\t\t} else {\n\t\t\trelativeStart = Math.min(start, size);\n\t\t}\n\t\tif (end === undefined) {\n\t\t\trelativeEnd = size;\n\t\t} else if (end < 0) {\n\t\t\trelativeEnd = Math.max(size + end, 0);\n\t\t} else {\n\t\t\trelativeEnd = Math.min(end, size);\n\t\t}\n\t\tconst span = Math.max(relativeEnd - relativeStart, 0);\n\n\t\tconst buffer = this[BUFFER];\n\t\tconst slicedBuffer = buffer.slice(relativeStart, relativeStart + span);\n\t\tconst blob = new Blob([], { type: arguments[2] });\n\t\tblob[BUFFER] = slicedBuffer;\n\t\treturn blob;\n\t}\n}\n\nObject.defineProperties(Blob.prototype, {\n\tsize: { enumerable: true },\n\ttype: { enumerable: true },\n\tslice: { enumerable: true }\n});\n\nObject.defineProperty(Blob.prototype, Symbol.toStringTag, {\n\tvalue: 'Blob',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\n/**\n * fetch-error.js\n *\n * FetchError interface for operational errors\n */\n\n/**\n * Create FetchError instance\n *\n * @param String message Error message for human\n * @param String type Error type for machine\n * @param String systemError For Node.js system error\n * @return FetchError\n */\nfunction FetchError(message, type, systemError) {\n Error.call(this, message);\n\n this.message = message;\n this.type = type;\n\n // when err.type is `system`, err.code contains system error code\n if (systemError) {\n this.code = this.errno = systemError.code;\n }\n\n // hide custom error implementation details from end-users\n Error.captureStackTrace(this, this.constructor);\n}\n\nFetchError.prototype = Object.create(Error.prototype);\nFetchError.prototype.constructor = FetchError;\nFetchError.prototype.name = 'FetchError';\n\nlet convert;\ntry {\n\tconvert = require('encoding').convert;\n} catch (e) {}\n\nconst INTERNALS = Symbol('Body internals');\n\n// fix an issue where \"PassThrough\" isn't a named export for node <10\nconst PassThrough = Stream.PassThrough;\n\n/**\n * Body mixin\n *\n * Ref: https://fetch.spec.whatwg.org/#body\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nfunction Body(body) {\n\tvar _this = this;\n\n\tvar _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n\t _ref$size = _ref.size;\n\n\tlet size = _ref$size === undefined ? 0 : _ref$size;\n\tvar _ref$timeout = _ref.timeout;\n\tlet timeout = _ref$timeout === undefined ? 0 : _ref$timeout;\n\n\tif (body == null) {\n\t\t// body is undefined or null\n\t\tbody = null;\n\t} else if (isURLSearchParams(body)) {\n\t\t// body is a URLSearchParams\n\t\tbody = Buffer.from(body.toString());\n\t} else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {\n\t\t// body is ArrayBuffer\n\t\tbody = Buffer.from(body);\n\t} else if (ArrayBuffer.isView(body)) {\n\t\t// body is ArrayBufferView\n\t\tbody = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n\t} else if (body instanceof Stream) ; else {\n\t\t// none of the above\n\t\t// coerce to string then buffer\n\t\tbody = Buffer.from(String(body));\n\t}\n\tthis[INTERNALS] = {\n\t\tbody,\n\t\tdisturbed: false,\n\t\terror: null\n\t};\n\tthis.size = size;\n\tthis.timeout = timeout;\n\n\tif (body instanceof Stream) {\n\t\tbody.on('error', function (err) {\n\t\t\tconst error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);\n\t\t\t_this[INTERNALS].error = error;\n\t\t});\n\t}\n}\n\nBody.prototype = {\n\tget body() {\n\t\treturn this[INTERNALS].body;\n\t},\n\n\tget bodyUsed() {\n\t\treturn this[INTERNALS].disturbed;\n\t},\n\n\t/**\n * Decode response as ArrayBuffer\n *\n * @return Promise\n */\n\tarrayBuffer() {\n\t\treturn consumeBody.call(this).then(function (buf) {\n\t\t\treturn buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n\t\t});\n\t},\n\n\t/**\n * Return raw response as Blob\n *\n * @return Promise\n */\n\tblob() {\n\t\tlet ct = this.headers && this.headers.get('content-type') || '';\n\t\treturn consumeBody.call(this).then(function (buf) {\n\t\t\treturn Object.assign(\n\t\t\t// Prevent copying\n\t\t\tnew Blob([], {\n\t\t\t\ttype: ct.toLowerCase()\n\t\t\t}), {\n\t\t\t\t[BUFFER]: buf\n\t\t\t});\n\t\t});\n\t},\n\n\t/**\n * Decode response as json\n *\n * @return Promise\n */\n\tjson() {\n\t\tvar _this2 = this;\n\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\ttry {\n\t\t\t\treturn JSON.parse(buffer.toString());\n\t\t\t} catch (err) {\n\t\t\t\treturn Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));\n\t\t\t}\n\t\t});\n\t},\n\n\t/**\n * Decode response as text\n *\n * @return Promise\n */\n\ttext() {\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\treturn buffer.toString();\n\t\t});\n\t},\n\n\t/**\n * Decode response as buffer (non-spec api)\n *\n * @return Promise\n */\n\tbuffer() {\n\t\treturn consumeBody.call(this);\n\t},\n\n\t/**\n * Decode response as text, while automatically detecting the encoding and\n * trying to decode to UTF-8 (non-spec api)\n *\n * @return Promise\n */\n\ttextConverted() {\n\t\tvar _this3 = this;\n\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\treturn convertBody(buffer, _this3.headers);\n\t\t});\n\t}\n};\n\n// In browsers, all properties are enumerable.\nObject.defineProperties(Body.prototype, {\n\tbody: { enumerable: true },\n\tbodyUsed: { enumerable: true },\n\tarrayBuffer: { enumerable: true },\n\tblob: { enumerable: true },\n\tjson: { enumerable: true },\n\ttext: { enumerable: true }\n});\n\nBody.mixIn = function (proto) {\n\tfor (const name of Object.getOwnPropertyNames(Body.prototype)) {\n\t\t// istanbul ignore else: future proof\n\t\tif (!(name in proto)) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(Body.prototype, name);\n\t\t\tObject.defineProperty(proto, name, desc);\n\t\t}\n\t}\n};\n\n/**\n * Consume and convert an entire Body to a Buffer.\n *\n * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body\n *\n * @return Promise\n */\nfunction consumeBody() {\n\tvar _this4 = this;\n\n\tif (this[INTERNALS].disturbed) {\n\t\treturn Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));\n\t}\n\n\tthis[INTERNALS].disturbed = true;\n\n\tif (this[INTERNALS].error) {\n\t\treturn Body.Promise.reject(this[INTERNALS].error);\n\t}\n\n\tlet body = this.body;\n\n\t// body is null\n\tif (body === null) {\n\t\treturn Body.Promise.resolve(Buffer.alloc(0));\n\t}\n\n\t// body is blob\n\tif (isBlob(body)) {\n\t\tbody = body.stream();\n\t}\n\n\t// body is buffer\n\tif (Buffer.isBuffer(body)) {\n\t\treturn Body.Promise.resolve(body);\n\t}\n\n\t// istanbul ignore if: should never happen\n\tif (!(body instanceof Stream)) {\n\t\treturn Body.Promise.resolve(Buffer.alloc(0));\n\t}\n\n\t// body is stream\n\t// get ready to actually consume the body\n\tlet accum = [];\n\tlet accumBytes = 0;\n\tlet abort = false;\n\n\treturn new Body.Promise(function (resolve, reject) {\n\t\tlet resTimeout;\n\n\t\t// allow timeout on slow response body\n\t\tif (_this4.timeout) {\n\t\t\tresTimeout = setTimeout(function () {\n\t\t\t\tabort = true;\n\t\t\t\treject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));\n\t\t\t}, _this4.timeout);\n\t\t}\n\n\t\t// handle stream errors\n\t\tbody.on('error', function (err) {\n\t\t\tif (err.name === 'AbortError') {\n\t\t\t\t// if the request was aborted, reject with this Error\n\t\t\t\tabort = true;\n\t\t\t\treject(err);\n\t\t\t} else {\n\t\t\t\t// other errors, such as incorrect content-encoding\n\t\t\t\treject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));\n\t\t\t}\n\t\t});\n\n\t\tbody.on('data', function (chunk) {\n\t\t\tif (abort || chunk === null) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (_this4.size && accumBytes + chunk.length > _this4.size) {\n\t\t\t\tabort = true;\n\t\t\t\treject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\taccumBytes += chunk.length;\n\t\t\taccum.push(chunk);\n\t\t});\n\n\t\tbody.on('end', function () {\n\t\t\tif (abort) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tclearTimeout(resTimeout);\n\n\t\t\ttry {\n\t\t\t\tresolve(Buffer.concat(accum, accumBytes));\n\t\t\t} catch (err) {\n\t\t\t\t// handle streams that have accumulated too much data (issue #414)\n\t\t\t\treject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Detect buffer encoding and convert to target encoding\n * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding\n *\n * @param Buffer buffer Incoming buffer\n * @param String encoding Target encoding\n * @return String\n */\nfunction convertBody(buffer, headers) {\n\tif (typeof convert !== 'function') {\n\t\tthrow new Error('The package `encoding` must be installed to use the textConverted() function');\n\t}\n\n\tconst ct = headers.get('content-type');\n\tlet charset = 'utf-8';\n\tlet res, str;\n\n\t// header\n\tif (ct) {\n\t\tres = /charset=([^;]*)/i.exec(ct);\n\t}\n\n\t// no charset in content type, peek at response body for at most 1024 bytes\n\tstr = buffer.slice(0, 1024).toString();\n\n\t// html5\n\tif (!res && str) {\n\t\tres = / 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n\n\t\tthis[MAP] = Object.create(null);\n\n\t\tif (init instanceof Headers) {\n\t\t\tconst rawHeaders = init.raw();\n\t\t\tconst headerNames = Object.keys(rawHeaders);\n\n\t\t\tfor (const headerName of headerNames) {\n\t\t\t\tfor (const value of rawHeaders[headerName]) {\n\t\t\t\t\tthis.append(headerName, value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't worry about converting prop to ByteString here as append()\n\t\t// will handle it.\n\t\tif (init == null) ; else if (typeof init === 'object') {\n\t\t\tconst method = init[Symbol.iterator];\n\t\t\tif (method != null) {\n\t\t\t\tif (typeof method !== 'function') {\n\t\t\t\t\tthrow new TypeError('Header pairs must be iterable');\n\t\t\t\t}\n\n\t\t\t\t// sequence>\n\t\t\t\t// Note: per spec we have to first exhaust the lists then process them\n\t\t\t\tconst pairs = [];\n\t\t\t\tfor (const pair of init) {\n\t\t\t\t\tif (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {\n\t\t\t\t\t\tthrow new TypeError('Each header pair must be iterable');\n\t\t\t\t\t}\n\t\t\t\t\tpairs.push(Array.from(pair));\n\t\t\t\t}\n\n\t\t\t\tfor (const pair of pairs) {\n\t\t\t\t\tif (pair.length !== 2) {\n\t\t\t\t\t\tthrow new TypeError('Each header pair must be a name/value tuple');\n\t\t\t\t\t}\n\t\t\t\t\tthis.append(pair[0], pair[1]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// record\n\t\t\t\tfor (const key of Object.keys(init)) {\n\t\t\t\t\tconst value = init[key];\n\t\t\t\t\tthis.append(key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new TypeError('Provided initializer must be an object');\n\t\t}\n\t}\n\n\t/**\n * Return combined header value given name\n *\n * @param String name Header name\n * @return Mixed\n */\n\tget(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key === undefined) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this[MAP][key].join(', ');\n\t}\n\n\t/**\n * Iterate over all headers\n *\n * @param Function callback Executed for each item with parameters (value, name, thisArg)\n * @param Boolean thisArg `this` context for callback function\n * @return Void\n */\n\tforEach(callback) {\n\t\tlet thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n\t\tlet pairs = getHeaders(this);\n\t\tlet i = 0;\n\t\twhile (i < pairs.length) {\n\t\t\tvar _pairs$i = pairs[i];\n\t\t\tconst name = _pairs$i[0],\n\t\t\t value = _pairs$i[1];\n\n\t\t\tcallback.call(thisArg, value, name, this);\n\t\t\tpairs = getHeaders(this);\n\t\t\ti++;\n\t\t}\n\t}\n\n\t/**\n * Overwrite header values given name\n *\n * @param String name Header name\n * @param String value Header value\n * @return Void\n */\n\tset(name, value) {\n\t\tname = `${name}`;\n\t\tvalue = `${value}`;\n\t\tvalidateName(name);\n\t\tvalidateValue(value);\n\t\tconst key = find(this[MAP], name);\n\t\tthis[MAP][key !== undefined ? key : name] = [value];\n\t}\n\n\t/**\n * Append a value onto existing header\n *\n * @param String name Header name\n * @param String value Header value\n * @return Void\n */\n\tappend(name, value) {\n\t\tname = `${name}`;\n\t\tvalue = `${value}`;\n\t\tvalidateName(name);\n\t\tvalidateValue(value);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key !== undefined) {\n\t\t\tthis[MAP][key].push(value);\n\t\t} else {\n\t\t\tthis[MAP][name] = [value];\n\t\t}\n\t}\n\n\t/**\n * Check for header name existence\n *\n * @param String name Header name\n * @return Boolean\n */\n\thas(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\treturn find(this[MAP], name) !== undefined;\n\t}\n\n\t/**\n * Delete all header values given name\n *\n * @param String name Header name\n * @return Void\n */\n\tdelete(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key !== undefined) {\n\t\t\tdelete this[MAP][key];\n\t\t}\n\t}\n\n\t/**\n * Return raw headers (non-spec api)\n *\n * @return Object\n */\n\traw() {\n\t\treturn this[MAP];\n\t}\n\n\t/**\n * Get an iterator on keys.\n *\n * @return Iterator\n */\n\tkeys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}\n\n\t/**\n * Get an iterator on values.\n *\n * @return Iterator\n */\n\tvalues() {\n\t\treturn createHeadersIterator(this, 'value');\n\t}\n\n\t/**\n * Get an iterator on entries.\n *\n * This is the default iterator of the Headers object.\n *\n * @return Iterator\n */\n\t[Symbol.iterator]() {\n\t\treturn createHeadersIterator(this, 'key+value');\n\t}\n}\nHeaders.prototype.entries = Headers.prototype[Symbol.iterator];\n\nObject.defineProperty(Headers.prototype, Symbol.toStringTag, {\n\tvalue: 'Headers',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nObject.defineProperties(Headers.prototype, {\n\tget: { enumerable: true },\n\tforEach: { enumerable: true },\n\tset: { enumerable: true },\n\tappend: { enumerable: true },\n\thas: { enumerable: true },\n\tdelete: { enumerable: true },\n\tkeys: { enumerable: true },\n\tvalues: { enumerable: true },\n\tentries: { enumerable: true }\n});\n\nfunction getHeaders(headers) {\n\tlet kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';\n\n\tconst keys = Object.keys(headers[MAP]).sort();\n\treturn keys.map(kind === 'key' ? function (k) {\n\t\treturn k.toLowerCase();\n\t} : kind === 'value' ? function (k) {\n\t\treturn headers[MAP][k].join(', ');\n\t} : function (k) {\n\t\treturn [k.toLowerCase(), headers[MAP][k].join(', ')];\n\t});\n}\n\nconst INTERNAL = Symbol('internal');\n\nfunction createHeadersIterator(target, kind) {\n\tconst iterator = Object.create(HeadersIteratorPrototype);\n\titerator[INTERNAL] = {\n\t\ttarget,\n\t\tkind,\n\t\tindex: 0\n\t};\n\treturn iterator;\n}\n\nconst HeadersIteratorPrototype = Object.setPrototypeOf({\n\tnext() {\n\t\t// istanbul ignore if\n\t\tif (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {\n\t\t\tthrow new TypeError('Value of `this` is not a HeadersIterator');\n\t\t}\n\n\t\tvar _INTERNAL = this[INTERNAL];\n\t\tconst target = _INTERNAL.target,\n\t\t kind = _INTERNAL.kind,\n\t\t index = _INTERNAL.index;\n\n\t\tconst values = getHeaders(target, kind);\n\t\tconst len = values.length;\n\t\tif (index >= len) {\n\t\t\treturn {\n\t\t\t\tvalue: undefined,\n\t\t\t\tdone: true\n\t\t\t};\n\t\t}\n\n\t\tthis[INTERNAL].index = index + 1;\n\n\t\treturn {\n\t\t\tvalue: values[index],\n\t\t\tdone: false\n\t\t};\n\t}\n}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));\n\nObject.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {\n\tvalue: 'HeadersIterator',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\n/**\n * Export the Headers object in a form that Node.js can consume.\n *\n * @param Headers headers\n * @return Object\n */\nfunction exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}\n\n/**\n * Create a Headers object from an object of headers, ignoring those that do\n * not conform to HTTP grammar productions.\n *\n * @param Object obj Object of headers\n * @return Headers\n */\nfunction createHeadersLenient(obj) {\n\tconst headers = new Headers();\n\tfor (const name of Object.keys(obj)) {\n\t\tif (invalidTokenRegex.test(name)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(obj[name])) {\n\t\t\tfor (const val of obj[name]) {\n\t\t\t\tif (invalidHeaderCharRegex.test(val)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (headers[MAP][name] === undefined) {\n\t\t\t\t\theaders[MAP][name] = [val];\n\t\t\t\t} else {\n\t\t\t\t\theaders[MAP][name].push(val);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!invalidHeaderCharRegex.test(obj[name])) {\n\t\t\theaders[MAP][name] = [obj[name]];\n\t\t}\n\t}\n\treturn headers;\n}\n\nconst INTERNALS$1 = Symbol('Response internals');\n\n// fix an issue where \"STATUS_CODES\" aren't a named export for node <10\nconst STATUS_CODES = http.STATUS_CODES;\n\n/**\n * Response class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nclass Response {\n\tconstructor() {\n\t\tlet body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\t\tlet opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\t\tBody.call(this, body, opts);\n\n\t\tconst status = opts.status || 200;\n\t\tconst headers = new Headers(opts.headers);\n\n\t\tif (body != null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS$1] = {\n\t\t\turl: opts.url,\n\t\t\tstatus,\n\t\t\tstatusText: opts.statusText || STATUS_CODES[status],\n\t\t\theaders,\n\t\t\tcounter: opts.counter\n\t\t};\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS$1].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS$1].status;\n\t}\n\n\t/**\n * Convenience property representing if the request ended normally\n */\n\tget ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS$1].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS$1].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS$1].headers;\n\t}\n\n\t/**\n * Clone this response\n *\n * @return Response\n */\n\tclone() {\n\t\treturn new Response(clone(this), {\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected\n\t\t});\n\t}\n}\n\nBody.mixIn(Response.prototype);\n\nObject.defineProperties(Response.prototype, {\n\turl: { enumerable: true },\n\tstatus: { enumerable: true },\n\tok: { enumerable: true },\n\tredirected: { enumerable: true },\n\tstatusText: { enumerable: true },\n\theaders: { enumerable: true },\n\tclone: { enumerable: true }\n});\n\nObject.defineProperty(Response.prototype, Symbol.toStringTag, {\n\tvalue: 'Response',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nconst INTERNALS$2 = Symbol('Request internals');\n\n// fix an issue where \"format\", \"parse\" aren't a named export for node <10\nconst parse_url = Url.parse;\nconst format_url = Url.format;\n\nconst streamDestructionSupported = 'destroy' in Stream.Readable.prototype;\n\n/**\n * Check if a value is an instance of Request.\n *\n * @param Mixed input\n * @return Boolean\n */\nfunction isRequest(input) {\n\treturn typeof input === 'object' && typeof input[INTERNALS$2] === 'object';\n}\n\nfunction isAbortSignal(signal) {\n\tconst proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);\n\treturn !!(proto && proto.constructor.name === 'AbortSignal');\n}\n\n/**\n * Request class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nclass Request {\n\tconstructor(input) {\n\t\tlet init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\t\tlet parsedURL;\n\n\t\t// normalize input\n\t\tif (!isRequest(input)) {\n\t\t\tif (input && input.href) {\n\t\t\t\t// in order to support Node.js' Url objects; though WHATWG's URL objects\n\t\t\t\t// will fall into this branch also (since their `toString()` will return\n\t\t\t\t// `href` property anyway)\n\t\t\t\tparsedURL = parse_url(input.href);\n\t\t\t} else {\n\t\t\t\t// coerce input to a string before attempting to parse\n\t\t\t\tparsedURL = parse_url(`${input}`);\n\t\t\t}\n\t\t\tinput = {};\n\t\t} else {\n\t\t\tparsedURL = parse_url(input.url);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tmethod = method.toUpperCase();\n\n\t\tif ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tlet inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;\n\n\t\tBody.call(this, inputBody, {\n\t\t\ttimeout: init.timeout || input.timeout || 0,\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody != null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ? input.signal : null;\n\t\tif ('signal' in init) signal = init.signal;\n\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal');\n\t\t}\n\n\t\tthis[INTERNALS$2] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal\n\t\t};\n\n\t\t// node-fetch-only options\n\t\tthis.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;\n\t\tthis.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t}\n\n\tget method() {\n\t\treturn this[INTERNALS$2].method;\n\t}\n\n\tget url() {\n\t\treturn format_url(this[INTERNALS$2].parsedURL);\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS$2].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS$2].redirect;\n\t}\n\n\tget signal() {\n\t\treturn this[INTERNALS$2].signal;\n\t}\n\n\t/**\n * Clone this request\n *\n * @return Request\n */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n}\n\nBody.mixIn(Request.prototype);\n\nObject.defineProperty(Request.prototype, Symbol.toStringTag, {\n\tvalue: 'Request',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nObject.defineProperties(Request.prototype, {\n\tmethod: { enumerable: true },\n\turl: { enumerable: true },\n\theaders: { enumerable: true },\n\tredirect: { enumerable: true },\n\tclone: { enumerable: true },\n\tsignal: { enumerable: true }\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param Request A Request instance\n * @return Object The options object to be passed to http.request\n */\nfunction getNodeRequestOptions(request) {\n\tconst parsedURL = request[INTERNALS$2].parsedURL;\n\tconst headers = new Headers(request[INTERNALS$2].headers);\n\n\t// fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// Basic fetch\n\tif (!parsedURL.protocol || !parsedURL.hostname) {\n\t\tthrow new TypeError('Only absolute URLs are supported');\n\t}\n\n\tif (!/^https?:$/.test(parsedURL.protocol)) {\n\t\tthrow new TypeError('Only HTTP(S) protocols are supported');\n\t}\n\n\tif (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) {\n\t\tthrow new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body == null && /^(POST|PUT)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\tif (request.body != null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\tif (typeof totalBytes === 'number') {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip,deflate');\n\t}\n\n\tlet agent = request.agent;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\tif (!headers.has('Connection') && !agent) {\n\t\theaders.set('Connection', 'close');\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\treturn Object.assign({}, parsedURL, {\n\t\tmethod: request.method,\n\t\theaders: exportNodeCompatibleHeaders(headers),\n\t\tagent\n\t});\n}\n\n/**\n * abort-error.js\n *\n * AbortError interface for cancelled requests\n */\n\n/**\n * Create AbortError instance\n *\n * @param String message Error message for human\n * @return AbortError\n */\nfunction AbortError(message) {\n Error.call(this, message);\n\n this.type = 'aborted';\n this.message = message;\n\n // hide custom error implementation details from end-users\n Error.captureStackTrace(this, this.constructor);\n}\n\nAbortError.prototype = Object.create(Error.prototype);\nAbortError.prototype.constructor = AbortError;\nAbortError.prototype.name = 'AbortError';\n\n// fix an issue where \"PassThrough\", \"resolve\" aren't a named export for node <10\nconst PassThrough$1 = Stream.PassThrough;\nconst resolve_url = Url.resolve;\n\n/**\n * Fetch function\n *\n * @param Mixed url Absolute url or Request instance\n * @param Object opts Fetch options\n * @return Promise\n */\nfunction fetch(url, opts) {\n\n\t// allow custom promise\n\tif (!fetch.Promise) {\n\t\tthrow new Error('native promise missing, set fetch.Promise to your favorite alternative');\n\t}\n\n\tBody.Promise = fetch.Promise;\n\n\t// wrap http.request into fetch\n\treturn new fetch.Promise(function (resolve, reject) {\n\t\t// build request object\n\t\tconst request = new Request(url, opts);\n\t\tconst options = getNodeRequestOptions(request);\n\n\t\tconst send = (options.protocol === 'https:' ? https : http).request;\n\t\tconst signal = request.signal;\n\n\t\tlet response = null;\n\n\t\tconst abort = function abort() {\n\t\t\tlet error = new AbortError('The user aborted a request.');\n\t\t\treject(error);\n\t\t\tif (request.body && request.body instanceof Stream.Readable) {\n\t\t\t\trequest.body.destroy(error);\n\t\t\t}\n\t\t\tif (!response || !response.body) return;\n\t\t\tresponse.body.emit('error', error);\n\t\t};\n\n\t\tif (signal && signal.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\n\t\tconst abortAndFinalize = function abortAndFinalize() {\n\t\t\tabort();\n\t\t\tfinalize();\n\t\t};\n\n\t\t// send request\n\t\tconst req = send(options);\n\t\tlet reqTimeout;\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', abortAndFinalize);\n\t\t}\n\n\t\tfunction finalize() {\n\t\t\treq.abort();\n\t\t\tif (signal) signal.removeEventListener('abort', abortAndFinalize);\n\t\t\tclearTimeout(reqTimeout);\n\t\t}\n\n\t\tif (request.timeout) {\n\t\t\treq.once('socket', function (socket) {\n\t\t\t\treqTimeout = setTimeout(function () {\n\t\t\t\t\treject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));\n\t\t\t\t\tfinalize();\n\t\t\t\t}, request.timeout);\n\t\t\t});\n\t\t}\n\n\t\treq.on('error', function (err) {\n\t\t\treject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));\n\t\t\tfinalize();\n\t\t});\n\n\t\treq.on('response', function (res) {\n\t\t\tclearTimeout(reqTimeout);\n\n\t\t\tconst headers = createHeadersLenient(res.headers);\n\n\t\t\t// HTTP fetch step 5\n\t\t\tif (fetch.isRedirect(res.statusCode)) {\n\t\t\t\t// HTTP fetch step 5.2\n\t\t\t\tconst location = headers.get('Location');\n\n\t\t\t\t// HTTP fetch step 5.3\n\t\t\t\tconst locationURL = location === null ? null : resolve_url(request.url, location);\n\n\t\t\t\t// HTTP fetch step 5.5\n\t\t\t\tswitch (request.redirect) {\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase 'manual':\n\t\t\t\t\t\t// node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.\n\t\t\t\t\t\tif (locationURL !== null) {\n\t\t\t\t\t\t\t// handle corrupted header\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\theaders.set('Location', locationURL);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t// istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request\n\t\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'follow':\n\t\t\t\t\t\t// HTTP-redirect fetch step 2\n\t\t\t\t\t\tif (locationURL === null) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 5\n\t\t\t\t\t\tif (request.counter >= request.follow) {\n\t\t\t\t\t\t\treject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 6 (counter increment)\n\t\t\t\t\t\t// Create a new Request object.\n\t\t\t\t\t\tconst requestOpts = {\n\t\t\t\t\t\t\theaders: new Headers(request.headers),\n\t\t\t\t\t\t\tfollow: request.follow,\n\t\t\t\t\t\t\tcounter: request.counter + 1,\n\t\t\t\t\t\t\tagent: request.agent,\n\t\t\t\t\t\t\tcompress: request.compress,\n\t\t\t\t\t\t\tmethod: request.method,\n\t\t\t\t\t\t\tbody: request.body,\n\t\t\t\t\t\t\tsignal: request.signal,\n\t\t\t\t\t\t\ttimeout: request.timeout,\n\t\t\t\t\t\t\tsize: request.size\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 9\n\t\t\t\t\t\tif (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {\n\t\t\t\t\t\t\treject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 11\n\t\t\t\t\t\tif (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {\n\t\t\t\t\t\t\trequestOpts.method = 'GET';\n\t\t\t\t\t\t\trequestOpts.body = undefined;\n\t\t\t\t\t\t\trequestOpts.headers.delete('content-length');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 15\n\t\t\t\t\t\tresolve(fetch(new Request(locationURL, requestOpts)));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// prepare response\n\t\t\tres.once('end', function () {\n\t\t\t\tif (signal) signal.removeEventListener('abort', abortAndFinalize);\n\t\t\t});\n\t\t\tlet body = res.pipe(new PassThrough$1());\n\n\t\t\tconst response_options = {\n\t\t\t\turl: request.url,\n\t\t\t\tstatus: res.statusCode,\n\t\t\t\tstatusText: res.statusMessage,\n\t\t\t\theaders: headers,\n\t\t\t\tsize: request.size,\n\t\t\t\ttimeout: request.timeout,\n\t\t\t\tcounter: request.counter\n\t\t\t};\n\n\t\t\t// HTTP-network fetch step 12.1.1.3\n\t\t\tconst codings = headers.get('Content-Encoding');\n\n\t\t\t// HTTP-network fetch step 12.1.1.4: handle content codings\n\n\t\t\t// in following scenarios we ignore compression support\n\t\t\t// 1. compression support is disabled\n\t\t\t// 2. HEAD request\n\t\t\t// 3. no Content-Encoding header\n\t\t\t// 4. no content response (204)\n\t\t\t// 5. content not modified response (304)\n\t\t\tif (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For Node v6+\n\t\t\t// Be less strict when decoding compressed responses, since sometimes\n\t\t\t// servers send slightly invalid responses that are still accepted\n\t\t\t// by common browsers.\n\t\t\t// Always using Z_SYNC_FLUSH is what cURL does.\n\t\t\tconst zlibOptions = {\n\t\t\t\tflush: zlib.Z_SYNC_FLUSH,\n\t\t\t\tfinishFlush: zlib.Z_SYNC_FLUSH\n\t\t\t};\n\n\t\t\t// for gzip\n\t\t\tif (codings == 'gzip' || codings == 'x-gzip') {\n\t\t\t\tbody = body.pipe(zlib.createGunzip(zlibOptions));\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// for deflate\n\t\t\tif (codings == 'deflate' || codings == 'x-deflate') {\n\t\t\t\t// handle the infamous raw deflate response from old servers\n\t\t\t\t// a hack for old IIS and Apache servers\n\t\t\t\tconst raw = res.pipe(new PassThrough$1());\n\t\t\t\traw.once('data', function (chunk) {\n\t\t\t\t\t// see http://stackoverflow.com/questions/37519828\n\t\t\t\t\tif ((chunk[0] & 0x0F) === 0x08) {\n\t\t\t\t\t\tbody = body.pipe(zlib.createInflate());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbody = body.pipe(zlib.createInflateRaw());\n\t\t\t\t\t}\n\t\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\t\tresolve(response);\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// for br\n\t\t\tif (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') {\n\t\t\t\tbody = body.pipe(zlib.createBrotliDecompress());\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// otherwise, use response as-is\n\t\t\tresponse = new Response(body, response_options);\n\t\t\tresolve(response);\n\t\t});\n\n\t\twriteToStream(req, request);\n\t});\n}\n/**\n * Redirect code matching\n *\n * @param Number code Status code\n * @return Boolean\n */\nfetch.isRedirect = function (code) {\n\treturn code === 301 || code === 302 || code === 303 || code === 307 || code === 308;\n};\n\n// expose Promise\nfetch.Promise = global.Promise;\n\nexport default fetch;\nexport { Headers, Request, Response, FetchError };\n","var nodeFetch = require('node-fetch')\nvar realFetch = nodeFetch.default || nodeFetch\n\nvar fetch = function (url, options) {\n // Support schemaless URIs on the server for parity with the browser.\n // Ex: //github.com/ -> https://github.com/\n if (/^\\/\\//.test(url)) {\n url = 'https:' + url\n }\n return realFetch.call(this, url, options)\n}\n\nmodule.exports = exports = fetch\nexports.fetch = fetch\nexports.Headers = nodeFetch.Headers\nexports.Request = nodeFetch.Request\nexports.Response = nodeFetch.Response\n\n// Needed for TypeScript consumers without esModuleInterop.\nexports.default = fetch\n","import fetch from \"cross-fetch\";\nimport JSBI from \"jsbi\";\n\nfunction mergeOptions(overrideOptions, defaultOptions) {\n defaultOptions = defaultOptions || {};\n const headers = Object.assign(\n {},\n defaultOptions.headers || {},\n overrideOptions.headers || {}\n );\n return Object.assign({}, defaultOptions, overrideOptions, {\n headers: headers\n });\n}\n\nconst batchHandler = {\n get: (target, method, receiver) => {\n if (method === \"send\") {\n return async () => {\n const response = await fetch(\n target.uri,\n mergeOptions(\n {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(target.payload)\n },\n target.defaultOptions\n )\n );\n return await response.json();\n };\n }\n return (...params) => {\n const id = target.id;\n target.id = target.id + 1;\n target.payload.push({\n jsonrpc: \"2.0\",\n id: id,\n method: method,\n params: params\n });\n return receiver;\n };\n }\n};\n\nconst handler = {\n get: (target, method) => {\n if (method === \"batch\") {\n return () => {\n return new Proxy(\n {\n id: Math.round(Math.random() * 10000000),\n payload: [],\n uri: target.uri,\n defaultOptions: target.defaultOptions\n },\n batchHandler\n );\n };\n }\n return async (...params) => {\n const id = Math.round(Math.random() * 10000000);\n const response = await fetch(\n target.uri,\n mergeOptions(\n {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: id,\n method: method,\n params: params\n })\n },\n target.defaultOptions\n )\n );\n const data = await response.json();\n if (data.id !== id) {\n throw new Error(\"JSONRPCError: response ID does not match request ID!\");\n }\n if (data.error) {\n throw new Error(\n `JSONRPCError: server error ${JSON.stringify(data.error)}`\n );\n }\n return data.result;\n };\n }\n};\n\nexport class RPC {\n constructor(uri, defaultOptions = {}) {\n this.uri = uri;\n this.defaultOptions = defaultOptions;\n return new Proxy(this, handler);\n }\n\n static create(uri) {\n return new RPC(uri);\n }\n}\n\nexport function HexStringToBigInt(hexString) {\n return JSBI.BigInt(hexString);\n}\n\nexport function BigIntToHexString(bigInt) {\n return \"0x\" + bigInt.toString(16);\n}\n","// This package provides normalizer functions. Even though CKB uses molecule\n// as the serialization layer. There is still CKB specific knowledge that does\n// not belong in molecule. For example, all numbers in CKB protocols are\n// serialized using little endian format. This package tries to encode such\n// knowledge. The goal here, is that you are free to use whatever types that\n// makes most sense to represent the values. As long as you pass your object\n// through the normalizers here, molecule should be able to serialize the values\n// into correct formats required by CKB.\n//\n// Note this is only used when you need to deal with CKB structures in molecule\n// format. If you are using RPCs or GraphQL to interact with CKB, chances are you\n// will not need this package.\nimport JSBI from \"jsbi\";\nimport { Reader } from \"./reader\";\nimport { BigIntToHexString } from \"./rpc\";\n\nfunction normalizeHexNumber(length) {\n return function(debugPath, value) {\n if (!(value instanceof ArrayBuffer)) {\n let intValue = BigIntToHexString(JSBI.BigInt(value)).substr(2);\n if (intValue.length % 2 !== 0) {\n intValue = \"0\" + intValue;\n }\n if (intValue.length / 2 > length) {\n throw new Error(\n `${debugPath} is ${intValue.length /\n 2} bytes long, expected length is ${length}!`\n );\n }\n const view = new DataView(new ArrayBuffer(length));\n for (let i = 0; i < intValue.length / 2; i++) {\n const start = intValue.length - (i + 1) * 2;\n view.setUint8(i, parseInt(intValue.substr(start, 2), 16));\n }\n value = view.buffer;\n }\n if (value.byteLength < length) {\n const array = new Uint8Array(length);\n array.set(new Uint8Array(value), 0);\n value = array.buffer;\n }\n return value;\n };\n}\n\nfunction normalizeRawData(length) {\n return function(debugPath, value) {\n value = new Reader(value).toArrayBuffer();\n if (length > 0 && value.byteLength !== length) {\n throw new Error(\n `${debugPath} has invalid length ${value.byteLength}, required: ${length}`\n );\n }\n return value;\n };\n}\n\nfunction normalizeObject(debugPath, object, keys) {\n const result = {};\n\n for (const [key, f] of Object.entries(keys)) {\n const value = object[key];\n if (!value) {\n throw new Error(`${debugPath} is missing ${key}!`);\n }\n result[key] = f(`${debugPath}.${key}`, value);\n }\n return result;\n}\n\nexport function NormalizeScript(script, { debugPath = \"script\" } = {}) {\n return normalizeObject(debugPath, script, {\n code_hash: normalizeRawData(32),\n hash_type: function(debugPath, value) {\n switch (value) {\n case \"data\":\n return 0;\n case \"type\":\n return 1;\n case \"data1\":\n return 2;\n case 0:\n return value;\n case 1:\n return value;\n case 2:\n return value;\n default:\n throw new Error(`${debugPath}.hash_type has invalid value: ${value}`);\n }\n },\n args: normalizeRawData(-1)\n });\n}\n\nexport function NormalizeOutPoint(outPoint, { debugPath = \"out_point\" } = {}) {\n return normalizeObject(debugPath, outPoint, {\n tx_hash: normalizeRawData(32),\n index: normalizeHexNumber(4)\n });\n}\n\nfunction toNormalize(normalize) {\n return function(debugPath, value) {\n return normalize(value, {\n debugPath\n });\n };\n}\n\nexport function NormalizeCellInput(\n cellInput,\n { debugPath = \"cell_input\" } = {}\n) {\n return normalizeObject(debugPath, cellInput, {\n since: normalizeHexNumber(8),\n previous_output: toNormalize(NormalizeOutPoint)\n });\n}\n\nexport function NormalizeCellOutput(\n cellOutput,\n { debugPath = \"cell_output\" } = {}\n) {\n const result = normalizeObject(debugPath, cellOutput, {\n capacity: normalizeHexNumber(8),\n lock: toNormalize(NormalizeScript)\n });\n if (cellOutput.type) {\n result.type_ = NormalizeScript(cellOutput.type, {\n debugPath: `${debugPath}.type`\n });\n }\n return result;\n}\n\nexport function NormalizeCellDep(cellDep, { debugPath = \"cell_dep\" } = {}) {\n return normalizeObject(debugPath, cellDep, {\n out_point: toNormalize(NormalizeOutPoint),\n dep_type: function(debugPath, value) {\n switch (value) {\n case \"code\":\n return 0;\n case \"dep_group\":\n return 1;\n case 0:\n return value;\n case 1:\n return value;\n default:\n throw new Error(`${debugPath}.dep_type has invalid value: ${value}`);\n }\n }\n });\n}\n\nfunction toNormalizeArray(normalizeFunction) {\n return function(debugPath, array) {\n return array.map((item, i) => {\n return normalizeFunction(`${debugPath}[${i}]`, item);\n });\n };\n}\n\nexport function NormalizeRawTransaction(\n rawTransaction,\n { debugPath = \"raw_transaction\" } = {}\n) {\n return normalizeObject(debugPath, rawTransaction, {\n version: normalizeHexNumber(4),\n cell_deps: toNormalizeArray(toNormalize(NormalizeCellDep)),\n header_deps: toNormalizeArray(normalizeRawData(32)),\n inputs: toNormalizeArray(toNormalize(NormalizeCellInput)),\n outputs: toNormalizeArray(toNormalize(NormalizeCellOutput)),\n outputs_data: toNormalizeArray(normalizeRawData(-1))\n });\n}\n\nexport function NormalizeTransaction(\n transaction,\n { debugPath = \"transaction\" } = {}\n) {\n const rawTransaction = NormalizeRawTransaction(transaction, {\n debugPath: `(raw)${debugPath}`\n });\n const result = normalizeObject(debugPath, transaction, {\n witnesses: toNormalizeArray(normalizeRawData(-1))\n });\n result.raw = rawTransaction;\n return result;\n}\n\nexport function NormalizeRawHeader(\n rawHeader,\n { debugPath = \"raw_header\" } = {}\n) {\n return normalizeObject(debugPath, rawHeader, {\n version: normalizeHexNumber(4),\n compact_target: normalizeHexNumber(4),\n timestamp: normalizeHexNumber(8),\n number: normalizeHexNumber(8),\n epoch: normalizeHexNumber(8),\n parent_hash: normalizeRawData(32),\n transactions_root: normalizeRawData(32),\n proposals_hash: normalizeRawData(32),\n uncles_hash: normalizeRawData(32),\n dao: normalizeRawData(32)\n });\n}\n\nexport function NormalizeHeader(header, { debugPath = \"header\" } = {}) {\n const rawHeader = NormalizeRawHeader(header, {\n debugPath: `(raw)${debugPath}`\n });\n const result = normalizeObject(debugPath, header, {\n nonce: normalizeHexNumber(16)\n });\n result.raw = rawHeader;\n return result;\n}\n\nexport function NormalizeUncleBlock(\n uncleBlock,\n { debugPath = \"uncle_block\" } = {}\n) {\n return normalizeObject(debugPath, uncleBlock, {\n header: toNormalize(NormalizeHeader),\n proposals: toNormalizeArray(normalizeRawData(10))\n });\n}\n\nexport function NormalizeBlock(block, { debugPath = \"block\" } = {}) {\n return normalizeObject(debugPath, block, {\n header: toNormalize(NormalizeHeader),\n uncles: toNormalizeArray(toNormalize(NormalizeUncleBlock)),\n transactions: toNormalizeArray(toNormalize(NormalizeTransaction)),\n proposals: toNormalizeArray(normalizeRawData(10))\n });\n}\n\nexport function NormalizeCellbaseWitness(\n cellbaseWitness,\n { debugPath = \"cellbase_witness\" } = {}\n) {\n return normalizeObject(debugPath, cellbaseWitness, {\n lock: toNormalize(NormalizeScript),\n message: normalizeRawData(-1)\n });\n}\n\nexport function NormalizeWitnessArgs(\n witnessArgs,\n { debugPath = \"witness_args\" } = {}\n) {\n const result = {};\n if (witnessArgs.lock) {\n result.lock = normalizeRawData(-1)(`${debugPath}.lock`, witnessArgs.lock);\n }\n if (witnessArgs.input_type) {\n result.input_type = normalizeRawData(-1)(\n `${debugPath}.input_type`,\n witnessArgs.input_type\n );\n }\n if (witnessArgs.output_type) {\n result.output_type = normalizeRawData(-1)(\n `${debugPath}.output_type`,\n witnessArgs.output_type\n );\n }\n return result;\n}\n","// This package provides transformer functions that transform JavaScript objects\n// into JSON ready objects that can be passed to RPC. It following the following\n// rules:\n//\n// 1. If the specified object has a serializeJson method, it would invoke this\n// method and use the result to replace current object.\n// 2. It then restricts the keys of the object to keys required by the specified\n// entity(i.e., a Script would only have code_hash, hash_type, args keys),for each\n// sub-field, it then recursively perform the steps here from step 1.\n// 3. It then optionally run validator functions to ensure the resulting object\n// follows specified rules.\n//\n// Note rule 1 here provides the flexibility in defining your own structures: you\n// could define a class containing custom data structures, then provide a\n// serializeJson that transforms the custom one into the rigid data structure\n// required by CKB. You can also leverage the Reader class we provide as much as\n// possible. Since Reader class does provide serializeJson methods, transformers\n// here will transform them to valid hex strings required by CKB.\nimport * as validators from \"./validators\";\n\nfunction invokeSerializeJson(debugPath, value) {\n if (value instanceof Object && value.serializeJson instanceof Function) {\n return value.serializeJson.call(value);\n }\n return value;\n}\n\nfunction transformObject(debugPath, object, keys) {\n object = invokeSerializeJson(debugPath, object);\n if (!(object instanceof Object)) {\n throw new Error(`Transformed ${debugPath} is not an object!`);\n }\n const result = {};\n\n for (const [key, f] of Object.entries(keys)) {\n let value = object[key];\n if (!value) {\n const camelKey = key.replace(/(_[a-z])/g, group =>\n group.toUpperCase().replace(\"_\", \"\")\n );\n value = object[camelKey];\n }\n if (value) {\n result[key] = f(`${debugPath}.${key}`, value);\n }\n }\n return result;\n}\n\nexport function TransformScript(\n script,\n { validation = true, debugPath = \"script\" } = {}\n) {\n script = transformObject(debugPath, script, {\n code_hash: invokeSerializeJson,\n hash_type: invokeSerializeJson,\n args: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateScript(script, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return script;\n}\n\nexport function TransformOutPoint(\n outPoint,\n { validation = true, debugPath = \"out_point\" } = {}\n) {\n outPoint = transformObject(debugPath, outPoint, {\n tx_hash: invokeSerializeJson,\n index: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateOutPoint(outPoint, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return outPoint;\n}\n\nfunction toInvoke(transform) {\n return function(debugPath, value) {\n return transform(value, {\n validation: false,\n debugPath\n });\n };\n}\n\nexport function TransformCellInput(\n cellInput,\n { validation = true, debugPath = \"cell_input\" } = {}\n) {\n cellInput = transformObject(debugPath, cellInput, {\n since: invokeSerializeJson,\n previous_output: toInvoke(TransformOutPoint)\n });\n\n if (validation) {\n validators.ValidateCellInput(cellInput, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellInput;\n}\n\nexport function TransformCellOutput(\n cellOutput,\n { validation = true, debugPath = \"cell_output\" } = {}\n) {\n cellOutput = transformObject(debugPath, cellOutput, {\n capacity: invokeSerializeJson,\n lock: toInvoke(TransformScript),\n type: toInvoke(TransformScript)\n });\n\n if (validation) {\n validators.ValidateCellOutput(cellOutput, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellOutput;\n}\n\nexport function TransformCellDep(\n cellDep,\n { validation = true, debugPath = \"cell_dep\" } = {}\n) {\n cellDep = transformObject(debugPath, cellDep, {\n out_point: toInvoke(TransformOutPoint),\n dep_type: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateCellDep(cellDep, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellDep;\n}\n\nfunction toInvokeArray(invokeFunction) {\n return function(debugPath, array) {\n return array.map((item, i) => {\n return invokeFunction(`${debugPath}[${i}]`, item);\n });\n };\n}\n\nexport function TransformRawTransaction(\n rawTransaction,\n { validation = true, debugPath = \"raw_transaction\" } = {}\n) {\n rawTransaction = transformObject(debugPath, rawTransaction, {\n version: invokeSerializeJson,\n cell_deps: toInvokeArray(toInvoke(TransformCellDep)),\n header_deps: toInvokeArray(invokeSerializeJson),\n inputs: toInvokeArray(toInvoke(TransformCellInput)),\n outputs: toInvokeArray(toInvoke(TransformCellOutput)),\n outputs_data: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateRawTransaction(rawTransaction, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return rawTransaction;\n}\n\nexport function TransformTransaction(\n transaction,\n { validation = true, debugPath = \"transaction\" } = {}\n) {\n transaction = transformObject(debugPath, transaction, {\n version: invokeSerializeJson,\n cell_deps: toInvokeArray(toInvoke(TransformCellDep)),\n header_deps: toInvokeArray(invokeSerializeJson),\n inputs: toInvokeArray(toInvoke(TransformCellInput)),\n outputs: toInvokeArray(toInvoke(TransformCellOutput)),\n outputs_data: toInvokeArray(invokeSerializeJson),\n witnesses: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateTransaction(transaction, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return transaction;\n}\n\nexport function TransformRawHeader(\n rawHeader,\n { validation = true, debugPath = \"raw_header\" } = {}\n) {\n rawHeader = transformObject(debugPath, rawHeader, {\n version: invokeSerializeJson,\n compact_target: invokeSerializeJson,\n timestamp: invokeSerializeJson,\n number: invokeSerializeJson,\n epoch: invokeSerializeJson,\n parent_hash: invokeSerializeJson,\n transactions_root: invokeSerializeJson,\n proposals_hash: invokeSerializeJson,\n uncles_hash: invokeSerializeJson,\n dao: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateRawHeader(rawHeader, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return rawHeader;\n}\n\nexport function TransformHeader(\n header,\n { validation = true, debugPath = \"header\" } = {}\n) {\n header = transformObject(debugPath, header, {\n version: invokeSerializeJson,\n compact_target: invokeSerializeJson,\n timestamp: invokeSerializeJson,\n number: invokeSerializeJson,\n epoch: invokeSerializeJson,\n parent_hash: invokeSerializeJson,\n transactions_root: invokeSerializeJson,\n proposals_hash: invokeSerializeJson,\n uncles_hash: invokeSerializeJson,\n dao: invokeSerializeJson,\n nonce: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateHeader(header, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return header;\n}\n\nexport function TransformUncleBlock(\n uncleBlock,\n { validation = true, debugPath = \"uncle_block\" } = {}\n) {\n uncleBlock = transformObject(debugPath, uncleBlock, {\n header: toInvoke(TransformHeader),\n proposals: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateUncleBlock(uncleBlock, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return uncleBlock;\n}\n\nexport function TransformBlock(\n block,\n { validation = true, debugPath = \"block\" } = {}\n) {\n block = transformObject(debugPath, block, {\n header: toInvoke(TransformHeader),\n uncles: toInvokeArray(toInvoke(TransformUncleBlock)),\n transactions: toInvokeArray(toInvoke(TransformTransaction)),\n proposals: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateBlock(block, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return block;\n}\n\nexport function TransformCellbaseWitness(\n cellbaseWitness,\n { validation = true, debugPath = \"cellbase_witness\" } = {}\n) {\n cellbaseWitness = transformObject(debugPath, cellbaseWitness, {\n lock: toInvoke(TransformScript),\n message: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateCellbaseWitness(cellbaseWitness, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellbaseWitness;\n}\n\nexport function TransformWitnessArgs(\n witnessArgs,\n { validation = true, debugPath = \"witness_args\" } = {}\n) {\n witnessArgs = transformObject(debugPath, witnessArgs, {\n lock: invokeSerializeJson,\n input_type: invokeSerializeJson,\n output_type: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateWitnessArgs(witnessArgs, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return witnessArgs;\n}\n","import JSBI from \"jsbi\";\nimport { Reader } from \"../reader\";\nimport { HexStringToBigInt, BigIntToHexString } from \"../rpc\";\n\nexport class RPCCollector {\n constructor(\n rpc,\n lockHash,\n {\n skipCellWithContent = true,\n loadData = false,\n loadBlockNumber = true\n } = {}\n ) {\n this.rpc = rpc;\n this.lockHash = new Reader(lockHash).serializeJson();\n this.skipCellWithContent = skipCellWithContent;\n this.loadData = loadData;\n this.loadBlockNumber = loadBlockNumber;\n }\n\n async *collect() {\n const to = HexStringToBigInt(await this.rpc.get_tip_block_number());\n let currentFrom = JSBI.BigInt(0);\n while (JSBI.lessThanOrEqual(currentFrom, to)) {\n let currentTo = JSBI.add(currentFrom, JSBI.BigInt(100));\n if (JSBI.greaterThan(currentTo, to)) {\n currentTo = to;\n }\n const cells = await this.rpc.get_cells_by_lock_hash(\n this.lockHash,\n BigIntToHexString(currentFrom),\n BigIntToHexString(currentTo)\n );\n for (const cell of cells) {\n if (this.skipCellWithContent) {\n if (\n cell.type ||\n JSBI.greaterThan(\n HexStringToBigInt(cell.output_data_len),\n JSBI.BigInt(100)\n )\n ) {\n continue;\n }\n }\n let data = null;\n if (this.loadData) {\n const cellWithData = await this.rpc.get_live_cell(\n cell.out_point,\n true\n );\n data = cellWithData.cell.data.content;\n }\n let block_number = null;\n if (this.loadBlockNumber) {\n const header = await this.rpc.get_header(cell.block_hash);\n block_number = header.number;\n }\n yield {\n cellbase: cell.cellbase,\n cell_output: {\n capacity: cell.capacity,\n lock: cell.lock,\n type: cell.type\n },\n out_point: cell.out_point,\n block_hash: cell.block_hash,\n data: data,\n output_data_len: cell.output_data_len,\n block_number\n };\n }\n currentFrom = JSBI.add(currentTo, JSBI.BigInt(1));\n }\n }\n}\n","import JSBI from \"jsbi\";\nimport { Reader } from \"./reader\";\nimport { ValidateTransaction, ValidateOutPoint } from \"./validators\";\n\nexport class TransactionDumper {\n constructor(\n rpc,\n { validateTransaction = true, depGroupUnpacker = null } = {}\n ) {\n this.rpc = rpc;\n this.validateTransaction = validateTransaction;\n this.depGroupUnpacker = depGroupUnpacker;\n }\n\n async dumpByHash(txHash) {\n const tx = (await this.rpc.get_transaction(txHash)).transaction;\n delete tx.hash;\n return await this.dump(tx);\n }\n\n async dump(tx) {\n if (this.validateTransaction) {\n ValidateTransaction(tx);\n }\n const mockInputs = [];\n for (const input of tx.inputs) {\n const { output, data, header } = await this._resolveOutPoint(\n input.previous_output\n );\n mockInputs.push({ input, output, data, header });\n }\n const mockCellDeps = [];\n for (const cellDep of tx.cell_deps) {\n const { output, data, header } = await this._resolveOutPoint(\n cellDep.out_point\n );\n mockCellDeps.push({\n cell_dep: cellDep,\n output,\n data,\n header\n });\n if (cellDep.dep_type === \"dep_group\") {\n if (!this.depGroupUnpacker) {\n throw new Error(\n \"depGroupUnpacker must be provided when the transaction contains dep_group!\"\n );\n }\n const outPoints = this.depGroupUnpacker(new Reader(data));\n for (const outPoint of outPoints) {\n ValidateOutPoint(outPoint);\n const { output, data, header } = await this._resolveOutPoint(\n outPoint\n );\n mockCellDeps.push({\n cell_dep: {\n out_point: outPoint,\n dep_type: \"code\"\n },\n output,\n data,\n header\n });\n }\n }\n }\n const mockHeaderDeps = [];\n for (const headerDep of tx.header_deps) {\n mockHeaderDeps.push(await this.rpc.get_header(headerDep));\n }\n return JSON.stringify({\n mock_info: {\n inputs: mockInputs,\n cell_deps: mockCellDeps,\n header_deps: mockHeaderDeps\n },\n tx\n });\n }\n\n async _resolveOutPoint(out_point) {\n const txStatus = await this.rpc.get_transaction(out_point.tx_hash);\n if (!txStatus || !txStatus.transaction) {\n throw new Error(`Transaction ${out_point.tx_hash} cannot be found!`);\n }\n const tx = txStatus.transaction;\n const index = JSBI.toNumber(JSBI.BigInt(out_point.index));\n if (index >= tx.outputs.length) {\n throw new Error(\n `Transaction ${out_point.tx_hash} does not have output ${index}!`\n );\n }\n const data = {\n output: tx.outputs[index],\n data: tx.outputs_data[index]\n };\n if (txStatus.tx_status.status === \"committed\") {\n data.header = txStatus.tx_status.block_hash;\n }\n return data;\n }\n}\n","export { Reader } from \"./reader.js\";\nexport { TransactionDumper } from \"./transaction_dumper.js\";\nexport { RPC, HexStringToBigInt, BigIntToHexString } from \"./rpc.js\";\nexport * as normalizers from \"./normalizers\";\nexport * as transformers from \"./transformers\";\nexport * as validators from \"./validators\";\nexport * as cell_collectors from \"./cell_collectors\";\nexport const VERSION = \"__development_build__\";\n"],"names":["ArrayBufferReader","[object Object]","buffer","this","view","DataView","byteLength","i","getUint8","Array","prototype","map","call","Uint8Array","x","toString","slice","join","HexStringReader","string","length","parseInt","substr","ArrayBuffer","setUint8","indexAt","Reader","input","startsWith","Error","c","charCodeAt","JSBI","a","b","__kMaxLength","RangeError","super","sign","Math","floor","Number","isFinite","__zero","__oneDigit","__fromDouble","__fromString","SyntaxError","constructor","__toPrimitive","BigInt","TypeError","push","__toStringBasePowerOfTwo","__toStringGeneric","clz32","__unsignedDigit","d","__digit","e","f","Infinity","g","h","j","k","l","m","n","o","__decideRounding","p","__kBitConversionInts","__kBitConversionDouble","__copy","__absoluteSubOne","__trim","__absoluteAddOne","unaryMinus","__kMaxLengthBits","__initializeDigits","__setDigit","multiply","__clzmsd","__multiplyAccumulate","__absoluteCompare","__absoluteDivSmall","__absoluteDivLarge","__absoluteModSmall","__absoluteAdd","__absoluteSub","__rightShiftByAbsolute","__leftShiftByAbsolute","__compareToBigInt","equal","max","__absoluteAnd","__absoluteOr","__absoluteAndNot","__absoluteXor","__truncateToNBits","__truncateAndSubFromPowerOfTwo","__toNumeric","__isBigInt","add","__compare","EQ","__equalToNumber","pop","__isWhitespace","__kMaxBitsPerChar","__kBitsPerCharTableMultiplier","__kBitsPerCharTableShift","__fillFromParts","q","__inplaceMultiplyAdd","__kConversionChars","exponentiate","__halfDigit","__setHalfDigit","quotient","remainder","__unequalSign","__absoluteGreater","__absoluteLess","abs","__compareToDouble","__comparisonResultToBool","__compareToNumber","__setDigitGrow","imul","r","s","t","__halfDigitLength","__clz16","__specialLeftShift","__internalMultiplyAdd","__inplaceSub","__inplaceAdd","__inplaceRightShift","__toShiftAmount","__rightShiftByMaximum","Symbol","toPrimitive","valueOf","min","assertObjectWithKeys","debugPath","object","expectedKeys","optionalKeys","Object","assertObject","providedKeys","keys","sort","requiredLength","maximalLength","errorMessage","optionalProvidedKeys","filter","key","includes","find","assertHexString","test","assertHash","hash","assertInteger","ValidateScript","script","nestedValidation","code_hash","args","hash_type","ValidateOutPoint","outPoint","tx_hash","index","ValidateCellInput","cellInput","since","previous_output","ValidateCellOutput","cellOutput","capacity","lock","type","ValidateCellDep","cellDep","dep_type","out_point","assertArray","array","validateFunction","isArray","toAssert","value","assertCommonTransaction","rawTransaction","version","cell_deps","header_deps","inputs","outputs","outputs_data","ValidateRawTransaction","ValidateTransaction","transaction","witnesses","ValidateRawHeader","rawHeader","compact_target","timestamp","number","epoch","parent_hash","transactions_root","proposals_hash","uncles_hash","dao","assertCommonHeader","ValidateHeader","header","nonce","assertProposalShortId","shortId","ValidateUncleBlock","uncleBlock","proposals","ValidateBlock","block","uncles","transactions","ValidateCellbaseWitness","cellbaseWitness","message","ValidateWitnessArgs","witnessArgs","input_type","output_type","__kBitConversionBuffer","Float64Array","Int32Array","Readable","Stream","BUFFER","TYPE","Blob","blobParts","arguments","options","buffers","size","element","Buffer","isView","from","byteOffset","String","concat","undefined","toLowerCase","Promise","resolve","buf","ab","readable","_read","start","end","relativeStart","relativeEnd","span","slicedBuffer","blob","FetchError","systemError","code","errno","captureStackTrace","convert","defineProperties","enumerable","defineProperty","toStringTag","writable","configurable","create","name","require","INTERNALS","PassThrough","Body","body","_this","_ref","_ref$size","_ref$timeout","timeout","isURLSearchParams","isBlob","isBuffer","disturbed","error","on","err","url","consumeBody","_this4","reject","alloc","stream","accum","accumBytes","abort","resTimeout","setTimeout","chunk","clearTimeout","obj","append","delete","get","getAll","has","set","arrayBuffer","clone","instance","p1","p2","bodyUsed","getBoundary","pipe","extractContentType","getTotalBytes","getLengthSync","_lengthRetrievers","hasKnownLength","then","ct","headers","assign","_this2","JSON","parse","_this3","res","str","charset","exec","convertBody","json","text","mixIn","proto","getOwnPropertyNames","desc","getOwnPropertyDescriptor","global","invalidTokenRegex","invalidHeaderCharRegex","validateName","validateValue","MAP","Headers","init","rawHeaders","raw","headerNames","headerName","method","iterator","pairs","pair","callback","thisArg","getHeaders","_pairs$i","createHeadersIterator","kind","entries","forEach","values","INTERNAL","target","HeadersIteratorPrototype","setPrototypeOf","getPrototypeOf","_INTERNAL","done","exportNodeCompatibleHeaders","__proto__","hostHeaderKey","INTERNALS$1","STATUS_CODES","http","Response","opts","status","contentType","statusText","counter","ok","redirected","INTERNALS$2","parse_url","Url","format_url","format","streamDestructionSupported","isRequest","Request","parsedURL","href","toUpperCase","inputBody","signal","isAbortSignal","redirect","follow","compress","agent","AbortError","PassThrough$1","resolve_url","fetch","request","protocol","hostname","contentLengthValue","totalBytes","getNodeRequestOptions","send","https","response","destroy","emit","aborted","abortAndFinalize","finalize","req","reqTimeout","removeEventListener","addEventListener","once","socket","val","createHeadersLenient","isRedirect","statusCode","location","locationURL","requestOpts","response_options","statusMessage","codings","zlibOptions","flush","zlib","Z_SYNC_FLUSH","finishFlush","createGunzip","createBrotliDecompress","createInflate","createInflateRaw","dest","write","writeToStream","realFetch","nodeFetch","default","module","exports","mergeOptions","overrideOptions","defaultOptions","batchHandler","receiver","async","uri","Content-Type","stringify","payload","params","id","jsonrpc","handler","Proxy","round","random","data","result","RPC","HexStringToBigInt","hexString","BigIntToHexString","bigInt","normalizeHexNumber","intValue","normalizeRawData","toArrayBuffer","normalizeObject","NormalizeScript","NormalizeOutPoint","toNormalize","normalize","NormalizeCellInput","NormalizeCellOutput","type_","NormalizeCellDep","toNormalizeArray","normalizeFunction","item","NormalizeRawTransaction","NormalizeTransaction","NormalizeRawHeader","NormalizeHeader","NormalizeUncleBlock","invokeSerializeJson","serializeJson","Function","transformObject","replace","group","TransformScript","validation","validators.ValidateScript","TransformOutPoint","validators.ValidateOutPoint","toInvoke","transform","TransformCellInput","validators.ValidateCellInput","TransformCellOutput","validators.ValidateCellOutput","TransformCellDep","validators.ValidateCellDep","toInvokeArray","invokeFunction","TransformTransaction","validators.ValidateTransaction","TransformHeader","validators.ValidateHeader","TransformUncleBlock","validators.ValidateUncleBlock","validators.ValidateRawTransaction","validators.ValidateRawHeader","validators.ValidateBlock","validators.ValidateCellbaseWitness","validators.ValidateWitnessArgs","rpc","lockHash","skipCellWithContent","loadData","loadBlockNumber","to","get_tip_block_number","currentFrom","lessThanOrEqual","currentTo","greaterThan","cells","get_cells_by_lock_hash","cell","output_data_len","get_live_cell","content","block_number","get_header","block_hash","cellbase","cell_output","validateTransaction","depGroupUnpacker","txHash","tx","get_transaction","dump","mockInputs","output","_resolveOutPoint","mockCellDeps","cell_dep","outPoints","mockHeaderDeps","headerDep","mock_info","txStatus","toNumber","tx_status"],"mappings":"mRAAA,MAAMA,EACJC,YAAYC,GACVC,KAA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X7X,YAAagY,GAEfT,GAAAA,IAIJjkB,uBAAuB+L,GACrB,MAAM8Y,QAAiB3kB,KAAKsiB,IAAI0B,gBAAgBnY,EAAUd,SAC1D,IAAK4Z,IAAaA,EAAS7X,YACzB,MAAM,IAAIpL,MAAM,eAAemK,EAAUd,4BAE3C,MAAMgZ,EAAKY,EAAS7X,YACd9B,EAAQnJ,EAAK+iB,SAAS/iB,EAAKkB,OAAO8I,EAAUb,QAClD,GAAIA,GAAS+Y,EAAGrX,QAAQzL,OACtB,MAAM,IAAIS,MACR,eAAemK,EAAUd,gCAAgCC,MAG7D,MAAM0T,EAAO,CACXyF,OAAQJ,EAAGrX,QAAQ1B,GACnB0T,KAAMqF,EAAGpX,aAAa3B,IAKxB,MAHkC,cAA9B2Z,EAASE,UAAU/L,SACrB4F,EAAK7Q,OAAS8W,EAASE,UAAUpB,YAE5B/E,oBC5FY"} \ No newline at end of file +{"version":3,"file":"ckb-js-toolkit.node.js","sources":["../src/reader.js","../node_modules/jsbi/dist/jsbi.mjs","../src/validators.js","../node_modules/node-fetch/lib/index.mjs","../node_modules/cross-fetch/dist/node-ponyfill.js","../src/rpc.js","../src/normalizers.js","../src/transformers.js","../src/cell_collectors/rpc_collector.js","../src/transaction_dumper.js","../src/index.js"],"sourcesContent":["class ArrayBufferReader {\n constructor(buffer) {\n this.view = new DataView(buffer);\n }\n\n length() {\n return this.view.byteLength;\n }\n\n indexAt(i) {\n return this.view.getUint8(i);\n }\n\n toArrayBuffer() {\n return this.view.buffer;\n }\n\n serializeJson() {\n return (\n \"0x\" +\n Array.prototype.map\n .call(new Uint8Array(this.view.buffer), x =>\n (\"00\" + x.toString(16)).slice(-2)\n )\n .join(\"\")\n );\n }\n}\n\nclass HexStringReader {\n constructor(string) {\n this.string = string;\n }\n\n length() {\n return this.string.length / 2 - 1;\n }\n\n indexAt(i) {\n return parseInt(this.string.substr(2 + i * 2, 2), 16);\n }\n\n toArrayBuffer() {\n const buffer = new ArrayBuffer(this.length());\n const view = new DataView(buffer);\n\n for (let i = 0; i < this.length(); i++) {\n view.setUint8(i, this.indexAt(i));\n }\n return buffer;\n }\n\n serializeJson() {\n return this.string;\n }\n}\n\nexport class Reader {\n constructor(input) {\n if (\n input instanceof HexStringReader ||\n input instanceof ArrayBufferReader\n ) {\n return input;\n }\n if (typeof input === \"string\") {\n if (!input.startsWith(\"0x\") || input.length % 2 != 0) {\n throw new Error(\n \"Hex string must start with 0x, and has even numbered length!\"\n );\n }\n return new HexStringReader(input);\n }\n if (input instanceof ArrayBuffer) {\n return new ArrayBufferReader(input);\n }\n throw new Error(\"Reader can only accept hex string or ArrayBuffer!\");\n }\n\n static fromRawString(string) {\n const buffer = new ArrayBuffer(string.length);\n const view = new DataView(buffer);\n\n for (let i = 0; i < string.length; i++) {\n const c = string.charCodeAt(i);\n if (c > 0xff) {\n throw new Error(\"fromRawString can only accept UTF-8 raw string!\");\n }\n view.setUint8(i, c);\n }\n return new ArrayBufferReader(buffer);\n }\n}\n","class JSBI extends Array{constructor(a,b){if(a>JSBI.__kMaxLength)throw new RangeError(\"Maximum BigInt size exceeded\");super(a),this.sign=b}static BigInt(a){var b=Math.floor,c=Number.isFinite;if(\"number\"==typeof a){if(0===a)return JSBI.__zero();if((0|a)===a)return 0>a?JSBI.__oneDigit(-a,!0):JSBI.__oneDigit(a,!1);if(!c(a)||b(a)!==a)throw new RangeError(\"The number \"+a+\" cannot be converted to BigInt because it is not an integer\");return JSBI.__fromDouble(a)}if(\"string\"==typeof a){const b=JSBI.__fromString(a);if(null===b)throw new SyntaxError(\"Cannot convert \"+a+\" to a BigInt\");return b}if(\"boolean\"==typeof a)return!0===a?JSBI.__oneDigit(1,!1):JSBI.__zero();if(\"object\"==typeof a){if(a.constructor===JSBI)return a;const b=JSBI.__toPrimitive(a);return JSBI.BigInt(b)}throw new TypeError(\"Cannot convert \"+a+\" to a BigInt\")}toDebugString(){const a=[\"BigInt[\"];for(const b of this)a.push((b?(b>>>0).toString(16):b)+\", \");return a.push(\"]\"),a.join(\"\")}toString(a=10){if(2>a||36>>=12;const l=j-12;let m=12<=j?0:h<<20+j,n=20+j;0>>32-l,m=h<>>32-n,n-=32);const o=JSBI.__decideRounding(a,n,i,h);if((1===o||0===o&&1==(1&m))&&(m=m+1>>>0,0==m&&(k++,0!=k>>>20&&(k=0,g++,1023=JSBI.__kMaxLengthBits)throw new RangeError(\"BigInt too big\");if(1===a.length&&2===a.__digit(0)){const b=1+(c>>>5),d=a.sign&&0!=(1&c),e=new JSBI(b,d);e.__initializeDigits();const f=1<<(31&c);return e.__setDigit(b-1,f),e}let d=null,e=a;for(0!=(1&c)&&(d=a),c>>=1;0!==c;c>>=1)e=JSBI.multiply(e,e),0!=(1&c)&&(null===d?d=e:d=JSBI.multiply(d,e));return d}static multiply(a,b){if(0===a.length)return a;if(0===b.length)return b;let c=a.length+b.length;32<=a.__clzmsd()+b.__clzmsd()&&c--;const d=new JSBI(c,a.sign!==b.sign);d.__initializeDigits();for(let c=0;cJSBI.__absoluteCompare(a,b))return JSBI.__zero();const c=a.sign!==b.sign,d=b.__unsignedDigit(0);let e;if(1===b.length&&65535>=d){if(1===d)return c===a.sign?a:JSBI.unaryMinus(a);e=JSBI.__absoluteDivSmall(a,d,null)}else e=JSBI.__absoluteDivLarge(a,b,!0,!1);return e.sign=c,e.__trim()}static remainder(a,b){if(0===b.length)throw new RangeError(\"Division by zero\");if(0>JSBI.__absoluteCompare(a,b))return a;const c=b.__unsignedDigit(0);if(1===b.length&&65535>=c){if(1===c)return JSBI.__zero();const b=JSBI.__absoluteModSmall(a,c);return 0===b?JSBI.__zero():JSBI.__oneDigit(b,a.sign)}const d=JSBI.__absoluteDivLarge(a,b,!1,!0);return d.sign=a.sign,d.__trim()}static add(a,b){const c=a.sign;return c===b.sign?JSBI.__absoluteAdd(a,b,c):0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c)}static subtract(a,b){const c=a.sign;return c===b.sign?0<=JSBI.__absoluteCompare(a,b)?JSBI.__absoluteSub(a,b,c):JSBI.__absoluteSub(b,a,!c):JSBI.__absoluteAdd(a,b,c)}static leftShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__rightShiftByAbsolute(a,b):JSBI.__leftShiftByAbsolute(a,b)}static signedRightShift(a,b){return 0===b.length||0===a.length?a:b.sign?JSBI.__leftShiftByAbsolute(a,b):JSBI.__rightShiftByAbsolute(a,b)}static unsignedRightShift(){throw new TypeError(\"BigInts have no unsigned right shift; use >> instead\")}static lessThan(a,b){return 0>JSBI.__compareToBigInt(a,b)}static lessThanOrEqual(a,b){return 0>=JSBI.__compareToBigInt(a,b)}static greaterThan(a,b){return 0=JSBI.__kMaxLengthBits)return b;const c=a+31>>>5;if(b.lengthJSBI.__kMaxLengthBits)throw new RangeError(\"BigInt too big\");return JSBI.__truncateAndSubFromPowerOfTwo(a,b,!1)}if(a>=JSBI.__kMaxLengthBits)return b;const c=a+31>>>5;if(b.length>>d)return b}return JSBI.__truncateToNBits(a,b)}static ADD(a,b){if(a=JSBI.__toPrimitive(a),b=JSBI.__toPrimitive(b),\"string\"==typeof a)return\"string\"!=typeof b&&(b=b.toString()),a+b;if(\"string\"==typeof b)return a.toString()+b;if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)&&JSBI.__isBigInt(b))return JSBI.add(a,b);if(\"number\"==typeof a&&\"number\"==typeof b)return a+b;throw new TypeError(\"Cannot mix BigInt and other types, use explicit conversions\")}static LT(a,b){return JSBI.__compare(a,b,0)}static LE(a,b){return JSBI.__compare(a,b,1)}static GT(a,b){return JSBI.__compare(a,b,2)}static GE(a,b){return JSBI.__compare(a,b,3)}static EQ(a,b){for(;;){if(JSBI.__isBigInt(a))return JSBI.__isBigInt(b)?JSBI.equal(a,b):JSBI.EQ(b,a);if(\"number\"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,a);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"string\"==typeof a){if(JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.equal(a,b);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"boolean\"==typeof a){if(JSBI.__isBigInt(b))return JSBI.__equalToNumber(b,+a);if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"symbol\"==typeof a){if(JSBI.__isBigInt(b))return!1;if(\"object\"!=typeof b)return a==b;b=JSBI.__toPrimitive(b)}else if(\"object\"==typeof a){if(\"object\"==typeof b&&b.constructor!==JSBI)return a==b;a=JSBI.__toPrimitive(a)}else return a==b}}static NE(a,b){return!JSBI.EQ(a,b)}static __zero(){return new JSBI(0,!1)}static __oneDigit(a,b){const c=new JSBI(1,b);return c.__setDigit(0,a),c}__copy(){const a=new JSBI(this.length,this.sign);for(let b=0;bb)e=-b-1;else{if(0===c)return-1;c--,d=a.__digit(c),e=31}let f=1<>>20,c=b-1023,d=(c>>>5)+1,e=new JSBI(d,0>a);let f=1048575&JSBI.__kBitConversionInts[1]|1048576,g=JSBI.__kBitConversionInts[0];const h=20,i=31&c;let j,k=0;if(i<20){const a=h-i;k=a+32,j=f>>>a,f=f<<32-a|g>>>a,g<<=32-a}else if(i===20)k=32,j=f,f=g;else{const a=i-h;k=32-a,j=f<>>32-a,f=g<=a&&9<=a)||(159>=a?32==a:131071>=a?160==a||5760==a:196607>=a?(a&=131071,10>=a||40==a||41==a||47==a||95==a||4096==a):65279==a)}static __fromString(a,b=0){let c=0;const e=a.length;let f=0;if(f===e)return JSBI.__zero();let g=a.charCodeAt(f);for(;JSBI.__isWhitespace(g);){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}if(43===g){if(++f===e)return null;g=a.charCodeAt(f),c=1}else if(45===g){if(++f===e)return null;g=a.charCodeAt(f),c=-1}if(0===b){if(b=10,48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(b=16,++f===e)return null;g=a.charCodeAt(f)}else if(79===g||111===g){if(b=8,++f===e)return null;g=a.charCodeAt(f)}else if(66===g||98===g){if(b=2,++f===e)return null;g=a.charCodeAt(f)}}}else if(16===b&&48===g){if(++f===e)return JSBI.__zero();if(g=a.charCodeAt(f),88===g||120===g){if(++f===e)return null;g=a.charCodeAt(f)}}for(;48===g;){if(++f===e)return JSBI.__zero();g=a.charCodeAt(f)}const h=e-f;let i=JSBI.__kMaxBitsPerChar[b],j=JSBI.__kBitsPerCharTableMultiplier-1;if(h>1073741824/i)return null;const k=i*h+j>>>JSBI.__kBitsPerCharTableShift,l=new JSBI(k+31>>>5,!1),n=10>b?b:10,o=10>=JSBI.__kBitsPerCharTableShift;const b=[],c=[];let d=!1;do{let h=0,j=0;for(;;){let b;if(g-48>>>0>>0>>0>>0>>JSBI.__kBitsPerCharTableShift+5;l.__inplaceMultiplyAdd(p,k,q)}while(!c)}if(f!==e){if(!JSBI.__isWhitespace(g))return null;for(f++;f>>i-f)}if(0!==e){if(d>=a.length)throw new Error(\"implementation bug\");a.__setDigit(d++,e)}for(;d>>1)+(85&e),e=(51&e>>>2)+(51&e),e=(15&e>>>4)+(15&e);const f=e,g=b-1,h=a.__digit(d-1),i=c(h);let j=0|(32*d-i+f-1)/f;if(a.sign&&j++,268435456>>e,n=32-e;n>=f;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f,n-=f}const o=(m|h<>>f-n;0!==m;)k[l--]=JSBI.__kConversionChars[m&g],m>>>=f;if(a.sign&&(k[l--]=\"-\"),-1!=l)throw new Error(\"implementation bug\");return k.join(\"\")}static __toStringGeneric(a,b,c){var d=Math.clz32;const e=a.length;if(0===e)return\"\";if(1===e){let d=a.__unsignedDigit(0).toString(b);return!1===c&&a.sign&&(d=\"-\"+d),d}const f=32*e-d(a.__digit(e-1)),g=JSBI.__kMaxBitsPerChar[b],h=g-1;let i=f*JSBI.__kBitsPerCharTableMultiplier;i+=h-1,i=0|i/h;const j=i+1>>1,k=JSBI.exponentiate(JSBI.__oneDigit(b,!1),JSBI.__oneDigit(j,!1));let l,m;const n=k.__unsignedDigit(0);if(1===k.length&&65535>=n){l=new JSBI(a.length,!1),l.__initializeDigits();let c=0;for(let b=2*a.length-1;0<=b;b--){const d=c<<16|a.__halfDigit(b);l.__setHalfDigit(b,0|d/n),c=0|d%n}m=c.toString(b)}else{const c=JSBI.__absoluteDivLarge(a,k,!0,!0);l=c.quotient;const d=c.remainder.__trim();m=JSBI.__toStringGeneric(d,b,!0)}l.__trim();let o=JSBI.__toStringGeneric(l,b,!0);for(;m.lengthd?JSBI.__absoluteLess(c):0}static __compareToNumber(a,b){if(b|!0){const c=a.sign,d=0>b;if(c!==d)return JSBI.__unequalSign(c);if(0===a.length){if(d)throw new Error(\"implementation bug\");return 0===b?0:-1}if(1e?JSBI.__absoluteGreater(c):fb)return JSBI.__unequalSign(d);if(0===b)throw new Error(\"implementation bug: should be handled elsewhere\");if(0===a.length)return-1;JSBI.__kBitConversionDouble[0]=b;const e=2047&JSBI.__kBitConversionInts[1]>>>20;if(2047==e)throw new Error(\"implementation bug: handled elsewhere\");const f=e-1023;if(0>f)return JSBI.__absoluteGreater(d);const g=a.length;let h=a.__digit(g-1);const i=c(h),j=32*g-i,k=f+1;if(jk)return JSBI.__absoluteGreater(d);let l=1048576|1048575&JSBI.__kBitConversionInts[1],m=JSBI.__kBitConversionInts[0];const n=20,o=31-i;if(o!==(j-1)%31)throw new Error(\"implementation bug\");let p,q=0;if(20>o){const a=n-o;q=a+32,p=l>>>a,l=l<<32-a|m>>>a,m<<=32-a}else if(20===o)q=32,p=l,l=m;else{const a=o-n;q=32-a,p=l<>>32-a,l=m<>>=0,p>>>=0,h>p)return JSBI.__absoluteGreater(d);if(h>>0,l=m,m=0):p=0;const b=a.__unsignedDigit(c);if(b>p)return JSBI.__absoluteGreater(d);if(bb&&a.__unsignedDigit(0)===c(b):0===JSBI.__compareToDouble(a,b)}static __comparisonResultToBool(a,b){switch(b){case 0:return 0>a;case 1:return 0>=a;case 2:return 0b;case 3:return a>=b;}if(JSBI.__isBigInt(a)&&\"string\"==typeof b)return b=JSBI.__fromString(b),null!==b&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(\"string\"==typeof a&&JSBI.__isBigInt(b))return a=JSBI.__fromString(a),null!==a&&JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(a=JSBI.__toNumeric(a),b=JSBI.__toNumeric(b),JSBI.__isBigInt(a)){if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToBigInt(a,b),c);if(\"number\"!=typeof b)throw new Error(\"implementation bug\");return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(a,b),c)}if(\"number\"!=typeof a)throw new Error(\"implementation bug\");if(JSBI.__isBigInt(b))return JSBI.__comparisonResultToBool(JSBI.__compareToNumber(b,a),2^c);if(\"number\"!=typeof b)throw new Error(\"implementation bug\");return 0===c?ab:3===c?a>=b:void 0}__clzmsd(){return Math.clz32(this[this.length-1])}static __absoluteAdd(a,b,c){if(a.length>>16)+(c>>>16)+(h>>>16);f=i>>>16,e.__setDigit(g,65535&h|i<<16)}for(;g>>16)+(c>>>16);f=d>>>16,e.__setDigit(g,65535&c|d<<16)}return g>>16;const i=(c>>>16)-(g>>>16)-e;e=1&i>>>16,d.__setDigit(f,65535&h|i<<16)}for(;f>>16;const g=(b>>>16)-e;e=1&g>>>16,d.__setDigit(f,65535&c|g<<16)}return d.__trim()}static __absoluteAddOne(a,b,c=null){const d=a.length;null===c?c=new JSBI(d,b):c.sign=b;let e=!0;for(let f,g=0;gd?0:a.__unsignedDigit(d)>b.__unsignedDigit(d)?1:-1}static __multiplyAccumulate(a,b,c,d){var e=Math.imul;if(0===b)return;const f=65535&b,g=b>>>16;let h=0,j=0,k=0;for(let l=0;l>>16;const n=a.__digit(l),o=65535&n,p=n>>>16,q=e(o,f),r=e(o,g),s=e(p,f),t=e(p,g);i+=j+(65535&q),m+=k+h+(i>>>16)+(q>>>16)+(65535&r)+(65535&s),h=m>>>16,j=(r>>>16)+(s>>>16)+(65535&t)+h,h=j>>>16,j&=65535,k=t>>>16,b=65535&i|m<<16,c.__setDigit(d,b)}for(;0!=h||0!==j||0!==k;d++){let a=c.__digit(d);const b=(65535&a)+j,e=(a>>>16)+(b>>>16)+k+h;j=0,k=0,h=e>>>16,a=65535&b|e<<16,c.__setDigit(d,a)}}static __internalMultiplyAdd(a,b,c,d,e){var f=Math.imul;let g=c,h=0;for(let j=0;j>>16;const k=f(c>>>16,b),l=(65535&k)+(d>>>16)+g;g=l>>>16,h=k>>>16,e.__setDigit(j,l<<16|65535&i)}if(e.length>d)for(e.__setDigit(d++,g+h);dthis.length&&(c=this.length);const f=65535&a,g=a>>>16;let h=0,j=65535&b,k=b>>>16;for(let l=0;l>>16,d=e(b,f),i=e(b,g),m=e(c,f),n=e(c,g),o=j+(65535&d),p=k+h+(o>>>16)+(d>>>16)+(65535&i)+(65535&m);j=(i>>>16)+(m>>>16)+(65535&n)+(p>>>16),h=j>>>16,j&=65535,k=n>>>16;this.__setDigit(l,65535&o|p<<16)}if(0!=h||0!==j||0!==k)throw new Error(\"implementation bug\")}static __absoluteDivSmall(a,b,c){null===c&&(c=new JSBI(a.length,!1));let d=0;for(let e,f=2*a.length-1;0<=f;f-=2){e=(d<<16|a.__halfDigit(f))>>>0;const g=0|e/b;d=0|e%b,e=(d<<16|a.__halfDigit(f-1))>>>0;const h=0|e/b;d=0|e%b,c.__setDigit(f>>>1,g<<16|h)}return c}static __absoluteModSmall(a,b){let c=0;for(let d=2*a.length-1;0<=d;d--){const e=(c<<16|a.__halfDigit(d))>>>0;c=0|e%b}return c}static __absoluteDivLarge(a,b,d,e){var f=Math.imul;const g=b.__halfDigitLength(),h=b.length,c=a.__halfDigitLength()-g;let i=null;d&&(i=new JSBI(c+2>>>1,!1),i.__initializeDigits());const k=new JSBI(g+2>>>1,!1);k.__initializeDigits();const l=JSBI.__clz16(b.__halfDigit(g-1));0>>0;l=0|c/n;let d=0|c%n;const e=b.__halfDigit(g-2),h=m.__halfDigit(p+g-2);for(;f(l,e)>>>0>(d<<16|h)>>>0&&(l--,d+=n,!(65535>>1,o|l))}return e?(m.__inplaceRightShift(l),d?{quotient:i,remainder:m}:m):d?i:void 0}static __clz16(a){return Math.clz32(a)-16}__inplaceAdd(a,b,c){let d=0;for(let e=0;e>>16,this.__setHalfDigit(b+e,c)}return d}__inplaceSub(a,b,c){let d=0;if(1&b){b>>=1;let e=this.__digit(b),f=65535&e,g=0;for(;g>>1;g++){const c=a.__digit(g),h=(e>>>16)-(65535&c)-d;d=1&h>>>16,this.__setDigit(b+g,h<<16|65535&f),e=this.__digit(b+g+1),f=(65535&e)-(c>>>16)-d,d=1&f>>>16}const h=a.__digit(g),i=(e>>>16)-(65535&h)-d;d=1&i>>>16,this.__setDigit(b+g,i<<16|65535&f);if(b+g+1>=this.length)throw new RangeError(\"out of bounds\");0==(1&c)&&(e=this.__digit(b+g+1),f=(65535&e)-(h>>>16)-d,d=1&f>>>16,this.__setDigit(b+a.length,4294901760&e|65535&f))}else{b>>=1;let e=0;for(;e>>16;const h=(c>>>16)-(f>>>16)-d;d=1&h>>>16,this.__setDigit(b+e,h<<16|65535&g)}const f=this.__digit(b+e),g=a.__digit(e),h=(65535&f)-(65535&g)-d;d=1&h>>>16;let i=0;0==(1&c)&&(i=(f>>>16)-(g>>>16)-d,d=1&i>>>16),this.__setDigit(b+e,i<<16|65535&h)}return d}__inplaceRightShift(a){if(0===a)return;let b=this.__digit(0)>>>a;const c=this.length-1;for(let e=0;e>>a}this.__setDigit(c,b)}static __specialLeftShift(a,b,c){const d=a.length,e=new JSBI(d+c,!1);if(0===b){for(let b=0;b>>32-b}return 0c)throw new RangeError(\"BigInt too big\");const e=c>>>5,f=31&c,g=a.length,h=0!==f&&0!=a.__digit(g-1)>>>32-f,j=g+e+(h?1:0),k=new JSBI(j,a.sign);if(0===f){let b=0;for(;b>>32-f}if(h)k.__setDigit(g+e,b);else if(0!=b)throw new Error(\"implementation bug\")}return k.__trim()}static __rightShiftByAbsolute(a,b){const c=a.length,d=a.sign,e=JSBI.__toShiftAmount(b);if(0>e)return JSBI.__rightShiftByMaximum(d);const f=e>>>5,g=31&e;let h=c-f;if(0>=h)return JSBI.__rightShiftByMaximum(d);let i=!1;if(d){if(0!=(a.__digit(f)&(1<>>g;const d=c-f-1;for(let c=0;c>>g}j.__setDigit(d,b)}return i&&(j=JSBI.__absoluteAddOne(j,!0,j)),j.__trim()}static __rightShiftByMaximum(a){return a?JSBI.__oneDigit(1,!0):JSBI.__zero()}static __toShiftAmount(a){if(1JSBI.__kMaxLengthBits?-1:b}static __toPrimitive(a,b=\"default\"){if(\"object\"!=typeof a)return a;if(a.constructor===JSBI)return a;const c=a[Symbol.toPrimitive];if(c){const a=c(b);if(\"object\"!=typeof a)return a;throw new TypeError(\"Cannot convert object to primitive value\")}const d=a.valueOf;if(d){const b=d.call(a);if(\"object\"!=typeof b)return b}const e=a.toString;if(e){const b=e.call(a);if(\"object\"!=typeof b)return b}throw new TypeError(\"Cannot convert object to primitive value\")}static __toNumeric(a){return JSBI.__isBigInt(a)?a:+a}static __isBigInt(a){return\"object\"==typeof a&&a.constructor===JSBI}static __truncateToNBits(a,b){const c=a+31>>>5,d=new JSBI(c,b.sign),e=c-1;for(let c=0;c>>b}return d.__setDigit(e,f),d.__trim()}static __truncateAndSubFromPowerOfTwo(a,b,c){var d=Math.min;const e=a+31>>>5,f=new JSBI(e,c);let g=0;const h=e-1;let j=0;for(const e=d(h,b.length);g>>16;const d=0-(a>>>16)-j;j=1&d>>>16,f.__setDigit(g,65535&c|d<<16)}for(;g>>16;const b=0-(k>>>16)-j;m=65535&a|b<<16}else{const a=32-l;k=k<>>a;const b=1<<32-a,c=(65535&b)-(65535&k)-j;j=1&c>>>16;const d=(b>>>16)-(k>>>16)-j;m=65535&c|d<<16,m&=b-1}return f.__setDigit(h,m),f.__trim()}__digit(a){return this[a]}__unsignedDigit(a){return this[a]>>>0}__setDigit(a,b){this[a]=0|b}__setDigitGrow(a,b){this[a]=0|b}__halfDigitLength(){const a=this.length;return 65535>=this.__unsignedDigit(a-1)?2*a-1:2*a}__halfDigit(a){return 65535&this[a>>>1]>>>((1&a)<<4)}__setHalfDigit(a,b){const c=a>>>1,d=this.__digit(c),e=1&a?65535&d|b<<16:4294901760&d|65535&b;this.__setDigit(c,e)}static __digitPow(a,b){let c=1;for(;0>>=1,a*=a;return c}}JSBI.__kMaxLength=33554432,JSBI.__kMaxLengthBits=JSBI.__kMaxLength<<5,JSBI.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],JSBI.__kBitsPerCharTableShift=5,JSBI.__kBitsPerCharTableMultiplier=1< maximalLength\n ) {\n throw new Error(errorMessage);\n }\n let optionalProvidedKeys = providedKeys.filter(\n key => !expectedKeys.includes(key)\n );\n if (providedKeys.length - optionalProvidedKeys.length !== requiredLength) {\n throw new Error(errorMessage);\n }\n if (optionalProvidedKeys.find(key => !optionalKeys.includes(key))) {\n throw new Error(errorMessage);\n }\n}\n\nfunction assertHexString(debugPath, string) {\n if (!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(string)) {\n throw new Error(`${debugPath} must be a hex string!`);\n }\n}\n\nfunction assertHash(debugPath, hash) {\n assertHexString(debugPath, hash);\n if (hash.length !== 66) {\n throw new Error(`${debugPath} must be a hex string of 66 bytes long!`);\n }\n}\n\nfunction assertInteger(debugPath, i) {\n if (i === \"0x0\") {\n return;\n }\n if (!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(i)) {\n throw new Error(`${debugPath} must be a hex integer!`);\n }\n}\n\nexport function ValidateScript(\n script,\n { nestedValidation = true, debugPath = \"script\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n script,\n [\"code_hash\", \"hash_type\", \"args\"],\n []\n );\n assertHash(`${debugPath}.code_hash`, script.code_hash);\n assertHexString(`${debugPath}.args`, script.args);\n\n if (\n script.hash_type !== \"data\" &&\n script.hash_type !== \"type\" &&\n script.hash_type !== \"data1\"\n ) {\n throw new Error(`${debugPath}.hash_type must be either data or type!`);\n }\n}\n\nexport function ValidateOutPoint(\n outPoint,\n { nestedValidation = true, debugPath = \"out_point\" } = {}\n) {\n assertObjectWithKeys(debugPath, outPoint, [\"tx_hash\", \"index\"], []);\n assertHash(`${debugPath}.tx_hash`, outPoint.tx_hash);\n assertInteger(`${debugPath}.index`, outPoint.index);\n}\n\nexport function ValidateCellInput(\n cellInput,\n { nestedValidation = true, debugPath = \"cell_input\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellInput, [\"since\", \"previous_output\"], []);\n assertInteger(`${debugPath}.since`, cellInput.since);\n\n if (nestedValidation) {\n ValidateOutPoint(cellInput.previous_output, {\n debugPath: `${debugPath}.previous_output`\n });\n }\n}\n\nexport function ValidateCellOutput(\n cellOutput,\n { nestedValidation = true, debugPath = \"cell_output\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellOutput, [\"capacity\", \"lock\"], [\"type\"]);\n assertInteger(`${debugPath}.capacity`, cellOutput.capacity);\n\n if (nestedValidation) {\n ValidateScript(cellOutput.lock, {\n debugPath: `${debugPath}.lock`\n });\n if (cellOutput.type) {\n ValidateScript(cellOutput.type, {\n debugPath: `${debugPath}.type`\n });\n }\n }\n}\n\nexport function ValidateCellDep(\n cellDep,\n { nestedValidation = true, debugPath = \"cell_dep\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellDep, [\"out_point\", \"dep_type\"], []);\n if (cellDep.dep_type !== \"code\" && cellDep.dep_type !== \"dep_group\") {\n throw new Error(`${debugPath}.dep_type must be either code or dep_group!`);\n }\n\n if (nestedValidation) {\n ValidateOutPoint(cellDep.out_point, {\n debugPath: `${debugPath}.out_point`\n });\n }\n}\n\nfunction assertArray(debugPath, array, validateFunction, nestedValidation) {\n if (!Array.isArray(array)) {\n throw new Error(`${debugPath} is not an array!`);\n }\n if (nestedValidation) {\n for (let i = 0; i < array.length; i++) {\n validateFunction(`${debugPath}[${i}]`, array[i]);\n }\n }\n}\n\nfunction toAssert(validateFunction, nestedValidation) {\n return function(debugPath, value) {\n validateFunction(value, {\n nestedValidation: nestedValidation,\n debugPath: debugPath\n });\n };\n}\n\nfunction assertCommonTransaction(debugPath, rawTransaction, nestedValidation) {\n assertInteger(`${debugPath}.version`, rawTransaction.version);\n assertArray(\n `${debugPath}.cell_deps`,\n rawTransaction.cell_deps,\n toAssert(ValidateCellDep, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.header_deps`,\n rawTransaction.header_deps,\n assertHash,\n nestedValidation\n );\n assertArray(\n `${debugPath}.inputs`,\n rawTransaction.inputs,\n toAssert(ValidateCellInput, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.outputs`,\n rawTransaction.outputs,\n toAssert(ValidateCellOutput, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.outputs_data`,\n rawTransaction.outputs_data,\n assertHexString,\n nestedValidation\n );\n}\n\nexport function ValidateRawTransaction(\n rawTransaction,\n { nestedValidation = true, debugPath = \"raw_transaction\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n rawTransaction,\n [\n \"version\",\n \"cell_deps\",\n \"header_deps\",\n \"inputs\",\n \"outputs\",\n \"outputs_data\"\n ],\n []\n );\n assertCommonTransaction(debugPath, rawTransaction, nestedValidation);\n}\n\nexport function ValidateTransaction(\n transaction,\n { nestedValidation = true, debugPath = \"transaction\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n transaction,\n [\n \"version\",\n \"cell_deps\",\n \"header_deps\",\n \"inputs\",\n \"outputs\",\n \"outputs_data\",\n \"witnesses\"\n ],\n []\n );\n assertCommonTransaction(debugPath, transaction, nestedValidation);\n assertArray(\n `${debugPath}.witnesses`,\n transaction.witnesses,\n assertHexString,\n nestedValidation\n );\n}\n\nfunction assertCommonHeader(debugPath, rawHeader) {\n assertInteger(`${debugPath}.version`, rawHeader.version);\n assertInteger(`${debugPath}.compact_target`, rawHeader.compact_target);\n assertInteger(`${debugPath}.timestamp`, rawHeader.timestamp);\n assertInteger(`${debugPath}.number`, rawHeader.number);\n assertInteger(`${debugPath}.epoch`, rawHeader.epoch);\n assertHash(`${debugPath}.parent_hash`, rawHeader.parent_hash);\n assertHash(`${debugPath}.transactions_root`, rawHeader.transactions_root);\n assertHash(`${debugPath}.proposals_hash`, rawHeader.proposals_hash);\n assertHash(`${debugPath}.extra_hash`, rawHeader.extra_hash);\n assertHash(`${debugPath}.dao`, rawHeader.dao);\n}\n\nexport function ValidateRawHeader(\n rawHeader,\n { nestedValidation = true, debugPath = \"raw_header\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n rawHeader,\n [\n \"version\",\n \"compact_target\",\n \"timestamp\",\n \"number\",\n \"epoch\",\n \"parent_hash\",\n \"transactions_root\",\n \"proposals_hash\",\n \"extra_hash\",\n \"dao\"\n ],\n []\n );\n assertCommonHeader(debugPath, rawHeader);\n}\n\nexport function ValidateHeader(\n header,\n { nestedValidation = true, debugPath = \"header\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n header,\n [\n \"version\",\n \"compact_target\",\n \"timestamp\",\n \"number\",\n \"epoch\",\n \"parent_hash\",\n \"transactions_root\",\n \"proposals_hash\",\n \"extra_hash\",\n \"dao\",\n \"nonce\"\n ],\n []\n );\n assertHexString(`${debugPath}.nonce`, header.nonce);\n if (header.nonce.length !== 34) {\n throw new Error(\n `${debugPath}.nonce must be a hex string of 34 bytes long!`\n );\n }\n}\n\nfunction assertProposalShortId(debugPath, shortId) {\n assertHexString(debugPath, shortId);\n if (shortId.length !== 22) {\n throw new Error(`${debugPath} must be a hex string of 22 bytes long!`);\n }\n}\n\nexport function ValidateUncleBlock(\n uncleBlock,\n { nestedValidation = true, debugPath = \"uncle_block\" } = {}\n) {\n assertObjectWithKeys(debugPath, uncleBlock, [\"header\", \"proposals\"], []);\n\n if (nestedValidation) {\n ValidateHeader(uncleBlock.header, {\n debugPath: `${debugPath}.header`\n });\n }\n assertArray(\n `${debugPath}.proposals`,\n uncleBlock.proposals,\n assertProposalShortId,\n nestedValidation\n );\n}\n\nexport function ValidateBlock(\n block,\n { nestedValidation = true, debugPath = \"block\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n block,\n [\"header\", \"uncles\", \"transactions\", \"proposals\"],\n []\n );\n\n if (nestedValidation) {\n ValidateHeader(block.header, {\n debugPath: `${debugPath}.header`\n });\n }\n assertArray(\n `${debugPath}.uncles`,\n block.uncles,\n toAssert(ValidateUncleBlock, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.transactions`,\n block.transactions,\n toAssert(ValidateTransaction, nestedValidation),\n nestedValidation\n );\n assertArray(\n `${debugPath}.proposals`,\n block.proposals,\n assertProposalShortId,\n nestedValidation\n );\n}\n\nexport function ValidateCellbaseWitness(\n cellbaseWitness,\n { nestedValidation = true, debugPath = \"cellbase_witness\" } = {}\n) {\n assertObjectWithKeys(debugPath, cellbaseWitness, [\"lock\", \"message\"], []);\n assertHexString(`${debugPath}.message`, cellbaseWitness.message);\n\n if (nestedValidation) {\n ValidateScript(cellbaseWitness.lock, {\n debugPath: `${debugPath}.lock`\n });\n }\n}\n\nexport function ValidateWitnessArgs(\n witnessArgs,\n { nestedValidation = true, debugPath = \"witness_args\" } = {}\n) {\n assertObjectWithKeys(\n debugPath,\n witnessArgs,\n [],\n [\"lock\", \"input_type\", \"output_type\"]\n );\n\n if (witnessArgs.lock) {\n assertHexString(`${debugPath}.lock`, witnessArgs.lock);\n }\n if (witnessArgs.input_type) {\n assertHexString(`${debugPath}.input_type`, witnessArgs.input_type);\n }\n if (witnessArgs.output_type) {\n assertHexString(`${debugPath}.output_type`, witnessArgs.output_type);\n }\n}\n","import Stream from 'stream';\nimport http from 'http';\nimport Url from 'url';\nimport https from 'https';\nimport zlib from 'zlib';\n\n// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js\n\n// fix for \"Readable\" isn't a named export issue\nconst Readable = Stream.Readable;\n\nconst BUFFER = Symbol('buffer');\nconst TYPE = Symbol('type');\n\nclass Blob {\n\tconstructor() {\n\t\tthis[TYPE] = '';\n\n\t\tconst blobParts = arguments[0];\n\t\tconst options = arguments[1];\n\n\t\tconst buffers = [];\n\t\tlet size = 0;\n\n\t\tif (blobParts) {\n\t\t\tconst a = blobParts;\n\t\t\tconst length = Number(a.length);\n\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\tconst element = a[i];\n\t\t\t\tlet buffer;\n\t\t\t\tif (element instanceof Buffer) {\n\t\t\t\t\tbuffer = element;\n\t\t\t\t} else if (ArrayBuffer.isView(element)) {\n\t\t\t\t\tbuffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);\n\t\t\t\t} else if (element instanceof ArrayBuffer) {\n\t\t\t\t\tbuffer = Buffer.from(element);\n\t\t\t\t} else if (element instanceof Blob) {\n\t\t\t\t\tbuffer = element[BUFFER];\n\t\t\t\t} else {\n\t\t\t\t\tbuffer = Buffer.from(typeof element === 'string' ? element : String(element));\n\t\t\t\t}\n\t\t\t\tsize += buffer.length;\n\t\t\t\tbuffers.push(buffer);\n\t\t\t}\n\t\t}\n\n\t\tthis[BUFFER] = Buffer.concat(buffers);\n\n\t\tlet type = options && options.type !== undefined && String(options.type).toLowerCase();\n\t\tif (type && !/[^\\u0020-\\u007E]/.test(type)) {\n\t\t\tthis[TYPE] = type;\n\t\t}\n\t}\n\tget size() {\n\t\treturn this[BUFFER].length;\n\t}\n\tget type() {\n\t\treturn this[TYPE];\n\t}\n\ttext() {\n\t\treturn Promise.resolve(this[BUFFER].toString());\n\t}\n\tarrayBuffer() {\n\t\tconst buf = this[BUFFER];\n\t\tconst ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n\t\treturn Promise.resolve(ab);\n\t}\n\tstream() {\n\t\tconst readable = new Readable();\n\t\treadable._read = function () {};\n\t\treadable.push(this[BUFFER]);\n\t\treadable.push(null);\n\t\treturn readable;\n\t}\n\ttoString() {\n\t\treturn '[object Blob]';\n\t}\n\tslice() {\n\t\tconst size = this.size;\n\n\t\tconst start = arguments[0];\n\t\tconst end = arguments[1];\n\t\tlet relativeStart, relativeEnd;\n\t\tif (start === undefined) {\n\t\t\trelativeStart = 0;\n\t\t} else if (start < 0) {\n\t\t\trelativeStart = Math.max(size + start, 0);\n\t\t} else {\n\t\t\trelativeStart = Math.min(start, size);\n\t\t}\n\t\tif (end === undefined) {\n\t\t\trelativeEnd = size;\n\t\t} else if (end < 0) {\n\t\t\trelativeEnd = Math.max(size + end, 0);\n\t\t} else {\n\t\t\trelativeEnd = Math.min(end, size);\n\t\t}\n\t\tconst span = Math.max(relativeEnd - relativeStart, 0);\n\n\t\tconst buffer = this[BUFFER];\n\t\tconst slicedBuffer = buffer.slice(relativeStart, relativeStart + span);\n\t\tconst blob = new Blob([], { type: arguments[2] });\n\t\tblob[BUFFER] = slicedBuffer;\n\t\treturn blob;\n\t}\n}\n\nObject.defineProperties(Blob.prototype, {\n\tsize: { enumerable: true },\n\ttype: { enumerable: true },\n\tslice: { enumerable: true }\n});\n\nObject.defineProperty(Blob.prototype, Symbol.toStringTag, {\n\tvalue: 'Blob',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\n/**\n * fetch-error.js\n *\n * FetchError interface for operational errors\n */\n\n/**\n * Create FetchError instance\n *\n * @param String message Error message for human\n * @param String type Error type for machine\n * @param String systemError For Node.js system error\n * @return FetchError\n */\nfunction FetchError(message, type, systemError) {\n Error.call(this, message);\n\n this.message = message;\n this.type = type;\n\n // when err.type is `system`, err.code contains system error code\n if (systemError) {\n this.code = this.errno = systemError.code;\n }\n\n // hide custom error implementation details from end-users\n Error.captureStackTrace(this, this.constructor);\n}\n\nFetchError.prototype = Object.create(Error.prototype);\nFetchError.prototype.constructor = FetchError;\nFetchError.prototype.name = 'FetchError';\n\nlet convert;\ntry {\n\tconvert = require('encoding').convert;\n} catch (e) {}\n\nconst INTERNALS = Symbol('Body internals');\n\n// fix an issue where \"PassThrough\" isn't a named export for node <10\nconst PassThrough = Stream.PassThrough;\n\n/**\n * Body mixin\n *\n * Ref: https://fetch.spec.whatwg.org/#body\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nfunction Body(body) {\n\tvar _this = this;\n\n\tvar _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n\t _ref$size = _ref.size;\n\n\tlet size = _ref$size === undefined ? 0 : _ref$size;\n\tvar _ref$timeout = _ref.timeout;\n\tlet timeout = _ref$timeout === undefined ? 0 : _ref$timeout;\n\n\tif (body == null) {\n\t\t// body is undefined or null\n\t\tbody = null;\n\t} else if (isURLSearchParams(body)) {\n\t\t// body is a URLSearchParams\n\t\tbody = Buffer.from(body.toString());\n\t} else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') {\n\t\t// body is ArrayBuffer\n\t\tbody = Buffer.from(body);\n\t} else if (ArrayBuffer.isView(body)) {\n\t\t// body is ArrayBufferView\n\t\tbody = Buffer.from(body.buffer, body.byteOffset, body.byteLength);\n\t} else if (body instanceof Stream) ; else {\n\t\t// none of the above\n\t\t// coerce to string then buffer\n\t\tbody = Buffer.from(String(body));\n\t}\n\tthis[INTERNALS] = {\n\t\tbody,\n\t\tdisturbed: false,\n\t\terror: null\n\t};\n\tthis.size = size;\n\tthis.timeout = timeout;\n\n\tif (body instanceof Stream) {\n\t\tbody.on('error', function (err) {\n\t\t\tconst error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err);\n\t\t\t_this[INTERNALS].error = error;\n\t\t});\n\t}\n}\n\nBody.prototype = {\n\tget body() {\n\t\treturn this[INTERNALS].body;\n\t},\n\n\tget bodyUsed() {\n\t\treturn this[INTERNALS].disturbed;\n\t},\n\n\t/**\n * Decode response as ArrayBuffer\n *\n * @return Promise\n */\n\tarrayBuffer() {\n\t\treturn consumeBody.call(this).then(function (buf) {\n\t\t\treturn buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);\n\t\t});\n\t},\n\n\t/**\n * Return raw response as Blob\n *\n * @return Promise\n */\n\tblob() {\n\t\tlet ct = this.headers && this.headers.get('content-type') || '';\n\t\treturn consumeBody.call(this).then(function (buf) {\n\t\t\treturn Object.assign(\n\t\t\t// Prevent copying\n\t\t\tnew Blob([], {\n\t\t\t\ttype: ct.toLowerCase()\n\t\t\t}), {\n\t\t\t\t[BUFFER]: buf\n\t\t\t});\n\t\t});\n\t},\n\n\t/**\n * Decode response as json\n *\n * @return Promise\n */\n\tjson() {\n\t\tvar _this2 = this;\n\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\ttry {\n\t\t\t\treturn JSON.parse(buffer.toString());\n\t\t\t} catch (err) {\n\t\t\t\treturn Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));\n\t\t\t}\n\t\t});\n\t},\n\n\t/**\n * Decode response as text\n *\n * @return Promise\n */\n\ttext() {\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\treturn buffer.toString();\n\t\t});\n\t},\n\n\t/**\n * Decode response as buffer (non-spec api)\n *\n * @return Promise\n */\n\tbuffer() {\n\t\treturn consumeBody.call(this);\n\t},\n\n\t/**\n * Decode response as text, while automatically detecting the encoding and\n * trying to decode to UTF-8 (non-spec api)\n *\n * @return Promise\n */\n\ttextConverted() {\n\t\tvar _this3 = this;\n\n\t\treturn consumeBody.call(this).then(function (buffer) {\n\t\t\treturn convertBody(buffer, _this3.headers);\n\t\t});\n\t}\n};\n\n// In browsers, all properties are enumerable.\nObject.defineProperties(Body.prototype, {\n\tbody: { enumerable: true },\n\tbodyUsed: { enumerable: true },\n\tarrayBuffer: { enumerable: true },\n\tblob: { enumerable: true },\n\tjson: { enumerable: true },\n\ttext: { enumerable: true }\n});\n\nBody.mixIn = function (proto) {\n\tfor (const name of Object.getOwnPropertyNames(Body.prototype)) {\n\t\t// istanbul ignore else: future proof\n\t\tif (!(name in proto)) {\n\t\t\tconst desc = Object.getOwnPropertyDescriptor(Body.prototype, name);\n\t\t\tObject.defineProperty(proto, name, desc);\n\t\t}\n\t}\n};\n\n/**\n * Consume and convert an entire Body to a Buffer.\n *\n * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body\n *\n * @return Promise\n */\nfunction consumeBody() {\n\tvar _this4 = this;\n\n\tif (this[INTERNALS].disturbed) {\n\t\treturn Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));\n\t}\n\n\tthis[INTERNALS].disturbed = true;\n\n\tif (this[INTERNALS].error) {\n\t\treturn Body.Promise.reject(this[INTERNALS].error);\n\t}\n\n\tlet body = this.body;\n\n\t// body is null\n\tif (body === null) {\n\t\treturn Body.Promise.resolve(Buffer.alloc(0));\n\t}\n\n\t// body is blob\n\tif (isBlob(body)) {\n\t\tbody = body.stream();\n\t}\n\n\t// body is buffer\n\tif (Buffer.isBuffer(body)) {\n\t\treturn Body.Promise.resolve(body);\n\t}\n\n\t// istanbul ignore if: should never happen\n\tif (!(body instanceof Stream)) {\n\t\treturn Body.Promise.resolve(Buffer.alloc(0));\n\t}\n\n\t// body is stream\n\t// get ready to actually consume the body\n\tlet accum = [];\n\tlet accumBytes = 0;\n\tlet abort = false;\n\n\treturn new Body.Promise(function (resolve, reject) {\n\t\tlet resTimeout;\n\n\t\t// allow timeout on slow response body\n\t\tif (_this4.timeout) {\n\t\t\tresTimeout = setTimeout(function () {\n\t\t\t\tabort = true;\n\t\t\t\treject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout'));\n\t\t\t}, _this4.timeout);\n\t\t}\n\n\t\t// handle stream errors\n\t\tbody.on('error', function (err) {\n\t\t\tif (err.name === 'AbortError') {\n\t\t\t\t// if the request was aborted, reject with this Error\n\t\t\t\tabort = true;\n\t\t\t\treject(err);\n\t\t\t} else {\n\t\t\t\t// other errors, such as incorrect content-encoding\n\t\t\t\treject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err));\n\t\t\t}\n\t\t});\n\n\t\tbody.on('data', function (chunk) {\n\t\t\tif (abort || chunk === null) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (_this4.size && accumBytes + chunk.length > _this4.size) {\n\t\t\t\tabort = true;\n\t\t\t\treject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size'));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\taccumBytes += chunk.length;\n\t\t\taccum.push(chunk);\n\t\t});\n\n\t\tbody.on('end', function () {\n\t\t\tif (abort) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tclearTimeout(resTimeout);\n\n\t\t\ttry {\n\t\t\t\tresolve(Buffer.concat(accum, accumBytes));\n\t\t\t} catch (err) {\n\t\t\t\t// handle streams that have accumulated too much data (issue #414)\n\t\t\t\treject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err));\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Detect buffer encoding and convert to target encoding\n * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding\n *\n * @param Buffer buffer Incoming buffer\n * @param String encoding Target encoding\n * @return String\n */\nfunction convertBody(buffer, headers) {\n\tif (typeof convert !== 'function') {\n\t\tthrow new Error('The package `encoding` must be installed to use the textConverted() function');\n\t}\n\n\tconst ct = headers.get('content-type');\n\tlet charset = 'utf-8';\n\tlet res, str;\n\n\t// header\n\tif (ct) {\n\t\tres = /charset=([^;]*)/i.exec(ct);\n\t}\n\n\t// no charset in content type, peek at response body for at most 1024 bytes\n\tstr = buffer.slice(0, 1024).toString();\n\n\t// html5\n\tif (!res && str) {\n\t\tres = / 0 && arguments[0] !== undefined ? arguments[0] : undefined;\n\n\t\tthis[MAP] = Object.create(null);\n\n\t\tif (init instanceof Headers) {\n\t\t\tconst rawHeaders = init.raw();\n\t\t\tconst headerNames = Object.keys(rawHeaders);\n\n\t\t\tfor (const headerName of headerNames) {\n\t\t\t\tfor (const value of rawHeaders[headerName]) {\n\t\t\t\t\tthis.append(headerName, value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// We don't worry about converting prop to ByteString here as append()\n\t\t// will handle it.\n\t\tif (init == null) ; else if (typeof init === 'object') {\n\t\t\tconst method = init[Symbol.iterator];\n\t\t\tif (method != null) {\n\t\t\t\tif (typeof method !== 'function') {\n\t\t\t\t\tthrow new TypeError('Header pairs must be iterable');\n\t\t\t\t}\n\n\t\t\t\t// sequence>\n\t\t\t\t// Note: per spec we have to first exhaust the lists then process them\n\t\t\t\tconst pairs = [];\n\t\t\t\tfor (const pair of init) {\n\t\t\t\t\tif (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') {\n\t\t\t\t\t\tthrow new TypeError('Each header pair must be iterable');\n\t\t\t\t\t}\n\t\t\t\t\tpairs.push(Array.from(pair));\n\t\t\t\t}\n\n\t\t\t\tfor (const pair of pairs) {\n\t\t\t\t\tif (pair.length !== 2) {\n\t\t\t\t\t\tthrow new TypeError('Each header pair must be a name/value tuple');\n\t\t\t\t\t}\n\t\t\t\t\tthis.append(pair[0], pair[1]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// record\n\t\t\t\tfor (const key of Object.keys(init)) {\n\t\t\t\t\tconst value = init[key];\n\t\t\t\t\tthis.append(key, value);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new TypeError('Provided initializer must be an object');\n\t\t}\n\t}\n\n\t/**\n * Return combined header value given name\n *\n * @param String name Header name\n * @return Mixed\n */\n\tget(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key === undefined) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this[MAP][key].join(', ');\n\t}\n\n\t/**\n * Iterate over all headers\n *\n * @param Function callback Executed for each item with parameters (value, name, thisArg)\n * @param Boolean thisArg `this` context for callback function\n * @return Void\n */\n\tforEach(callback) {\n\t\tlet thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;\n\n\t\tlet pairs = getHeaders(this);\n\t\tlet i = 0;\n\t\twhile (i < pairs.length) {\n\t\t\tvar _pairs$i = pairs[i];\n\t\t\tconst name = _pairs$i[0],\n\t\t\t value = _pairs$i[1];\n\n\t\t\tcallback.call(thisArg, value, name, this);\n\t\t\tpairs = getHeaders(this);\n\t\t\ti++;\n\t\t}\n\t}\n\n\t/**\n * Overwrite header values given name\n *\n * @param String name Header name\n * @param String value Header value\n * @return Void\n */\n\tset(name, value) {\n\t\tname = `${name}`;\n\t\tvalue = `${value}`;\n\t\tvalidateName(name);\n\t\tvalidateValue(value);\n\t\tconst key = find(this[MAP], name);\n\t\tthis[MAP][key !== undefined ? key : name] = [value];\n\t}\n\n\t/**\n * Append a value onto existing header\n *\n * @param String name Header name\n * @param String value Header value\n * @return Void\n */\n\tappend(name, value) {\n\t\tname = `${name}`;\n\t\tvalue = `${value}`;\n\t\tvalidateName(name);\n\t\tvalidateValue(value);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key !== undefined) {\n\t\t\tthis[MAP][key].push(value);\n\t\t} else {\n\t\t\tthis[MAP][name] = [value];\n\t\t}\n\t}\n\n\t/**\n * Check for header name existence\n *\n * @param String name Header name\n * @return Boolean\n */\n\thas(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\treturn find(this[MAP], name) !== undefined;\n\t}\n\n\t/**\n * Delete all header values given name\n *\n * @param String name Header name\n * @return Void\n */\n\tdelete(name) {\n\t\tname = `${name}`;\n\t\tvalidateName(name);\n\t\tconst key = find(this[MAP], name);\n\t\tif (key !== undefined) {\n\t\t\tdelete this[MAP][key];\n\t\t}\n\t}\n\n\t/**\n * Return raw headers (non-spec api)\n *\n * @return Object\n */\n\traw() {\n\t\treturn this[MAP];\n\t}\n\n\t/**\n * Get an iterator on keys.\n *\n * @return Iterator\n */\n\tkeys() {\n\t\treturn createHeadersIterator(this, 'key');\n\t}\n\n\t/**\n * Get an iterator on values.\n *\n * @return Iterator\n */\n\tvalues() {\n\t\treturn createHeadersIterator(this, 'value');\n\t}\n\n\t/**\n * Get an iterator on entries.\n *\n * This is the default iterator of the Headers object.\n *\n * @return Iterator\n */\n\t[Symbol.iterator]() {\n\t\treturn createHeadersIterator(this, 'key+value');\n\t}\n}\nHeaders.prototype.entries = Headers.prototype[Symbol.iterator];\n\nObject.defineProperty(Headers.prototype, Symbol.toStringTag, {\n\tvalue: 'Headers',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nObject.defineProperties(Headers.prototype, {\n\tget: { enumerable: true },\n\tforEach: { enumerable: true },\n\tset: { enumerable: true },\n\tappend: { enumerable: true },\n\thas: { enumerable: true },\n\tdelete: { enumerable: true },\n\tkeys: { enumerable: true },\n\tvalues: { enumerable: true },\n\tentries: { enumerable: true }\n});\n\nfunction getHeaders(headers) {\n\tlet kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value';\n\n\tconst keys = Object.keys(headers[MAP]).sort();\n\treturn keys.map(kind === 'key' ? function (k) {\n\t\treturn k.toLowerCase();\n\t} : kind === 'value' ? function (k) {\n\t\treturn headers[MAP][k].join(', ');\n\t} : function (k) {\n\t\treturn [k.toLowerCase(), headers[MAP][k].join(', ')];\n\t});\n}\n\nconst INTERNAL = Symbol('internal');\n\nfunction createHeadersIterator(target, kind) {\n\tconst iterator = Object.create(HeadersIteratorPrototype);\n\titerator[INTERNAL] = {\n\t\ttarget,\n\t\tkind,\n\t\tindex: 0\n\t};\n\treturn iterator;\n}\n\nconst HeadersIteratorPrototype = Object.setPrototypeOf({\n\tnext() {\n\t\t// istanbul ignore if\n\t\tif (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {\n\t\t\tthrow new TypeError('Value of `this` is not a HeadersIterator');\n\t\t}\n\n\t\tvar _INTERNAL = this[INTERNAL];\n\t\tconst target = _INTERNAL.target,\n\t\t kind = _INTERNAL.kind,\n\t\t index = _INTERNAL.index;\n\n\t\tconst values = getHeaders(target, kind);\n\t\tconst len = values.length;\n\t\tif (index >= len) {\n\t\t\treturn {\n\t\t\t\tvalue: undefined,\n\t\t\t\tdone: true\n\t\t\t};\n\t\t}\n\n\t\tthis[INTERNAL].index = index + 1;\n\n\t\treturn {\n\t\t\tvalue: values[index],\n\t\t\tdone: false\n\t\t};\n\t}\n}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));\n\nObject.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {\n\tvalue: 'HeadersIterator',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\n/**\n * Export the Headers object in a form that Node.js can consume.\n *\n * @param Headers headers\n * @return Object\n */\nfunction exportNodeCompatibleHeaders(headers) {\n\tconst obj = Object.assign({ __proto__: null }, headers[MAP]);\n\n\t// http.request() only supports string as Host header. This hack makes\n\t// specifying custom Host header possible.\n\tconst hostHeaderKey = find(headers[MAP], 'Host');\n\tif (hostHeaderKey !== undefined) {\n\t\tobj[hostHeaderKey] = obj[hostHeaderKey][0];\n\t}\n\n\treturn obj;\n}\n\n/**\n * Create a Headers object from an object of headers, ignoring those that do\n * not conform to HTTP grammar productions.\n *\n * @param Object obj Object of headers\n * @return Headers\n */\nfunction createHeadersLenient(obj) {\n\tconst headers = new Headers();\n\tfor (const name of Object.keys(obj)) {\n\t\tif (invalidTokenRegex.test(name)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (Array.isArray(obj[name])) {\n\t\t\tfor (const val of obj[name]) {\n\t\t\t\tif (invalidHeaderCharRegex.test(val)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (headers[MAP][name] === undefined) {\n\t\t\t\t\theaders[MAP][name] = [val];\n\t\t\t\t} else {\n\t\t\t\t\theaders[MAP][name].push(val);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!invalidHeaderCharRegex.test(obj[name])) {\n\t\t\theaders[MAP][name] = [obj[name]];\n\t\t}\n\t}\n\treturn headers;\n}\n\nconst INTERNALS$1 = Symbol('Response internals');\n\n// fix an issue where \"STATUS_CODES\" aren't a named export for node <10\nconst STATUS_CODES = http.STATUS_CODES;\n\n/**\n * Response class\n *\n * @param Stream body Readable stream\n * @param Object opts Response options\n * @return Void\n */\nclass Response {\n\tconstructor() {\n\t\tlet body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\t\tlet opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\t\tBody.call(this, body, opts);\n\n\t\tconst status = opts.status || 200;\n\t\tconst headers = new Headers(opts.headers);\n\n\t\tif (body != null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(body);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tthis[INTERNALS$1] = {\n\t\t\turl: opts.url,\n\t\t\tstatus,\n\t\t\tstatusText: opts.statusText || STATUS_CODES[status],\n\t\t\theaders,\n\t\t\tcounter: opts.counter\n\t\t};\n\t}\n\n\tget url() {\n\t\treturn this[INTERNALS$1].url || '';\n\t}\n\n\tget status() {\n\t\treturn this[INTERNALS$1].status;\n\t}\n\n\t/**\n * Convenience property representing if the request ended normally\n */\n\tget ok() {\n\t\treturn this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;\n\t}\n\n\tget redirected() {\n\t\treturn this[INTERNALS$1].counter > 0;\n\t}\n\n\tget statusText() {\n\t\treturn this[INTERNALS$1].statusText;\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS$1].headers;\n\t}\n\n\t/**\n * Clone this response\n *\n * @return Response\n */\n\tclone() {\n\t\treturn new Response(clone(this), {\n\t\t\turl: this.url,\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t\theaders: this.headers,\n\t\t\tok: this.ok,\n\t\t\tredirected: this.redirected\n\t\t});\n\t}\n}\n\nBody.mixIn(Response.prototype);\n\nObject.defineProperties(Response.prototype, {\n\turl: { enumerable: true },\n\tstatus: { enumerable: true },\n\tok: { enumerable: true },\n\tredirected: { enumerable: true },\n\tstatusText: { enumerable: true },\n\theaders: { enumerable: true },\n\tclone: { enumerable: true }\n});\n\nObject.defineProperty(Response.prototype, Symbol.toStringTag, {\n\tvalue: 'Response',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nconst INTERNALS$2 = Symbol('Request internals');\n\n// fix an issue where \"format\", \"parse\" aren't a named export for node <10\nconst parse_url = Url.parse;\nconst format_url = Url.format;\n\nconst streamDestructionSupported = 'destroy' in Stream.Readable.prototype;\n\n/**\n * Check if a value is an instance of Request.\n *\n * @param Mixed input\n * @return Boolean\n */\nfunction isRequest(input) {\n\treturn typeof input === 'object' && typeof input[INTERNALS$2] === 'object';\n}\n\nfunction isAbortSignal(signal) {\n\tconst proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal);\n\treturn !!(proto && proto.constructor.name === 'AbortSignal');\n}\n\n/**\n * Request class\n *\n * @param Mixed input Url or Request instance\n * @param Object init Custom options\n * @return Void\n */\nclass Request {\n\tconstructor(input) {\n\t\tlet init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n\t\tlet parsedURL;\n\n\t\t// normalize input\n\t\tif (!isRequest(input)) {\n\t\t\tif (input && input.href) {\n\t\t\t\t// in order to support Node.js' Url objects; though WHATWG's URL objects\n\t\t\t\t// will fall into this branch also (since their `toString()` will return\n\t\t\t\t// `href` property anyway)\n\t\t\t\tparsedURL = parse_url(input.href);\n\t\t\t} else {\n\t\t\t\t// coerce input to a string before attempting to parse\n\t\t\t\tparsedURL = parse_url(`${input}`);\n\t\t\t}\n\t\t\tinput = {};\n\t\t} else {\n\t\t\tparsedURL = parse_url(input.url);\n\t\t}\n\n\t\tlet method = init.method || input.method || 'GET';\n\t\tmethod = method.toUpperCase();\n\n\t\tif ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) {\n\t\t\tthrow new TypeError('Request with GET/HEAD method cannot have body');\n\t\t}\n\n\t\tlet inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;\n\n\t\tBody.call(this, inputBody, {\n\t\t\ttimeout: init.timeout || input.timeout || 0,\n\t\t\tsize: init.size || input.size || 0\n\t\t});\n\n\t\tconst headers = new Headers(init.headers || input.headers || {});\n\n\t\tif (inputBody != null && !headers.has('Content-Type')) {\n\t\t\tconst contentType = extractContentType(inputBody);\n\t\t\tif (contentType) {\n\t\t\t\theaders.append('Content-Type', contentType);\n\t\t\t}\n\t\t}\n\n\t\tlet signal = isRequest(input) ? input.signal : null;\n\t\tif ('signal' in init) signal = init.signal;\n\n\t\tif (signal != null && !isAbortSignal(signal)) {\n\t\t\tthrow new TypeError('Expected signal to be an instanceof AbortSignal');\n\t\t}\n\n\t\tthis[INTERNALS$2] = {\n\t\t\tmethod,\n\t\t\tredirect: init.redirect || input.redirect || 'follow',\n\t\t\theaders,\n\t\t\tparsedURL,\n\t\t\tsignal\n\t\t};\n\n\t\t// node-fetch-only options\n\t\tthis.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20;\n\t\tthis.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;\n\t\tthis.counter = init.counter || input.counter || 0;\n\t\tthis.agent = init.agent || input.agent;\n\t}\n\n\tget method() {\n\t\treturn this[INTERNALS$2].method;\n\t}\n\n\tget url() {\n\t\treturn format_url(this[INTERNALS$2].parsedURL);\n\t}\n\n\tget headers() {\n\t\treturn this[INTERNALS$2].headers;\n\t}\n\n\tget redirect() {\n\t\treturn this[INTERNALS$2].redirect;\n\t}\n\n\tget signal() {\n\t\treturn this[INTERNALS$2].signal;\n\t}\n\n\t/**\n * Clone this request\n *\n * @return Request\n */\n\tclone() {\n\t\treturn new Request(this);\n\t}\n}\n\nBody.mixIn(Request.prototype);\n\nObject.defineProperty(Request.prototype, Symbol.toStringTag, {\n\tvalue: 'Request',\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: true\n});\n\nObject.defineProperties(Request.prototype, {\n\tmethod: { enumerable: true },\n\turl: { enumerable: true },\n\theaders: { enumerable: true },\n\tredirect: { enumerable: true },\n\tclone: { enumerable: true },\n\tsignal: { enumerable: true }\n});\n\n/**\n * Convert a Request to Node.js http request options.\n *\n * @param Request A Request instance\n * @return Object The options object to be passed to http.request\n */\nfunction getNodeRequestOptions(request) {\n\tconst parsedURL = request[INTERNALS$2].parsedURL;\n\tconst headers = new Headers(request[INTERNALS$2].headers);\n\n\t// fetch step 1.3\n\tif (!headers.has('Accept')) {\n\t\theaders.set('Accept', '*/*');\n\t}\n\n\t// Basic fetch\n\tif (!parsedURL.protocol || !parsedURL.hostname) {\n\t\tthrow new TypeError('Only absolute URLs are supported');\n\t}\n\n\tif (!/^https?:$/.test(parsedURL.protocol)) {\n\t\tthrow new TypeError('Only HTTP(S) protocols are supported');\n\t}\n\n\tif (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) {\n\t\tthrow new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8');\n\t}\n\n\t// HTTP-network-or-cache fetch steps 2.4-2.7\n\tlet contentLengthValue = null;\n\tif (request.body == null && /^(POST|PUT)$/i.test(request.method)) {\n\t\tcontentLengthValue = '0';\n\t}\n\tif (request.body != null) {\n\t\tconst totalBytes = getTotalBytes(request);\n\t\tif (typeof totalBytes === 'number') {\n\t\t\tcontentLengthValue = String(totalBytes);\n\t\t}\n\t}\n\tif (contentLengthValue) {\n\t\theaders.set('Content-Length', contentLengthValue);\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.11\n\tif (!headers.has('User-Agent')) {\n\t\theaders.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)');\n\t}\n\n\t// HTTP-network-or-cache fetch step 2.15\n\tif (request.compress && !headers.has('Accept-Encoding')) {\n\t\theaders.set('Accept-Encoding', 'gzip,deflate');\n\t}\n\n\tlet agent = request.agent;\n\tif (typeof agent === 'function') {\n\t\tagent = agent(parsedURL);\n\t}\n\n\tif (!headers.has('Connection') && !agent) {\n\t\theaders.set('Connection', 'close');\n\t}\n\n\t// HTTP-network fetch step 4.2\n\t// chunked encoding is handled by Node.js\n\n\treturn Object.assign({}, parsedURL, {\n\t\tmethod: request.method,\n\t\theaders: exportNodeCompatibleHeaders(headers),\n\t\tagent\n\t});\n}\n\n/**\n * abort-error.js\n *\n * AbortError interface for cancelled requests\n */\n\n/**\n * Create AbortError instance\n *\n * @param String message Error message for human\n * @return AbortError\n */\nfunction AbortError(message) {\n Error.call(this, message);\n\n this.type = 'aborted';\n this.message = message;\n\n // hide custom error implementation details from end-users\n Error.captureStackTrace(this, this.constructor);\n}\n\nAbortError.prototype = Object.create(Error.prototype);\nAbortError.prototype.constructor = AbortError;\nAbortError.prototype.name = 'AbortError';\n\n// fix an issue where \"PassThrough\", \"resolve\" aren't a named export for node <10\nconst PassThrough$1 = Stream.PassThrough;\nconst resolve_url = Url.resolve;\n\n/**\n * Fetch function\n *\n * @param Mixed url Absolute url or Request instance\n * @param Object opts Fetch options\n * @return Promise\n */\nfunction fetch(url, opts) {\n\n\t// allow custom promise\n\tif (!fetch.Promise) {\n\t\tthrow new Error('native promise missing, set fetch.Promise to your favorite alternative');\n\t}\n\n\tBody.Promise = fetch.Promise;\n\n\t// wrap http.request into fetch\n\treturn new fetch.Promise(function (resolve, reject) {\n\t\t// build request object\n\t\tconst request = new Request(url, opts);\n\t\tconst options = getNodeRequestOptions(request);\n\n\t\tconst send = (options.protocol === 'https:' ? https : http).request;\n\t\tconst signal = request.signal;\n\n\t\tlet response = null;\n\n\t\tconst abort = function abort() {\n\t\t\tlet error = new AbortError('The user aborted a request.');\n\t\t\treject(error);\n\t\t\tif (request.body && request.body instanceof Stream.Readable) {\n\t\t\t\trequest.body.destroy(error);\n\t\t\t}\n\t\t\tif (!response || !response.body) return;\n\t\t\tresponse.body.emit('error', error);\n\t\t};\n\n\t\tif (signal && signal.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\n\t\tconst abortAndFinalize = function abortAndFinalize() {\n\t\t\tabort();\n\t\t\tfinalize();\n\t\t};\n\n\t\t// send request\n\t\tconst req = send(options);\n\t\tlet reqTimeout;\n\n\t\tif (signal) {\n\t\t\tsignal.addEventListener('abort', abortAndFinalize);\n\t\t}\n\n\t\tfunction finalize() {\n\t\t\treq.abort();\n\t\t\tif (signal) signal.removeEventListener('abort', abortAndFinalize);\n\t\t\tclearTimeout(reqTimeout);\n\t\t}\n\n\t\tif (request.timeout) {\n\t\t\treq.once('socket', function (socket) {\n\t\t\t\treqTimeout = setTimeout(function () {\n\t\t\t\t\treject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout'));\n\t\t\t\t\tfinalize();\n\t\t\t\t}, request.timeout);\n\t\t\t});\n\t\t}\n\n\t\treq.on('error', function (err) {\n\t\t\treject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));\n\t\t\tfinalize();\n\t\t});\n\n\t\treq.on('response', function (res) {\n\t\t\tclearTimeout(reqTimeout);\n\n\t\t\tconst headers = createHeadersLenient(res.headers);\n\n\t\t\t// HTTP fetch step 5\n\t\t\tif (fetch.isRedirect(res.statusCode)) {\n\t\t\t\t// HTTP fetch step 5.2\n\t\t\t\tconst location = headers.get('Location');\n\n\t\t\t\t// HTTP fetch step 5.3\n\t\t\t\tconst locationURL = location === null ? null : resolve_url(request.url, location);\n\n\t\t\t\t// HTTP fetch step 5.5\n\t\t\t\tswitch (request.redirect) {\n\t\t\t\t\tcase 'error':\n\t\t\t\t\t\treject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase 'manual':\n\t\t\t\t\t\t// node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL.\n\t\t\t\t\t\tif (locationURL !== null) {\n\t\t\t\t\t\t\t// handle corrupted header\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\theaders.set('Location', locationURL);\n\t\t\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\t\t\t// istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request\n\t\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'follow':\n\t\t\t\t\t\t// HTTP-redirect fetch step 2\n\t\t\t\t\t\tif (locationURL === null) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 5\n\t\t\t\t\t\tif (request.counter >= request.follow) {\n\t\t\t\t\t\t\treject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 6 (counter increment)\n\t\t\t\t\t\t// Create a new Request object.\n\t\t\t\t\t\tconst requestOpts = {\n\t\t\t\t\t\t\theaders: new Headers(request.headers),\n\t\t\t\t\t\t\tfollow: request.follow,\n\t\t\t\t\t\t\tcounter: request.counter + 1,\n\t\t\t\t\t\t\tagent: request.agent,\n\t\t\t\t\t\t\tcompress: request.compress,\n\t\t\t\t\t\t\tmethod: request.method,\n\t\t\t\t\t\t\tbody: request.body,\n\t\t\t\t\t\t\tsignal: request.signal,\n\t\t\t\t\t\t\ttimeout: request.timeout,\n\t\t\t\t\t\t\tsize: request.size\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 9\n\t\t\t\t\t\tif (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {\n\t\t\t\t\t\t\treject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));\n\t\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 11\n\t\t\t\t\t\tif (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') {\n\t\t\t\t\t\t\trequestOpts.method = 'GET';\n\t\t\t\t\t\t\trequestOpts.body = undefined;\n\t\t\t\t\t\t\trequestOpts.headers.delete('content-length');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// HTTP-redirect fetch step 15\n\t\t\t\t\t\tresolve(fetch(new Request(locationURL, requestOpts)));\n\t\t\t\t\t\tfinalize();\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// prepare response\n\t\t\tres.once('end', function () {\n\t\t\t\tif (signal) signal.removeEventListener('abort', abortAndFinalize);\n\t\t\t});\n\t\t\tlet body = res.pipe(new PassThrough$1());\n\n\t\t\tconst response_options = {\n\t\t\t\turl: request.url,\n\t\t\t\tstatus: res.statusCode,\n\t\t\t\tstatusText: res.statusMessage,\n\t\t\t\theaders: headers,\n\t\t\t\tsize: request.size,\n\t\t\t\ttimeout: request.timeout,\n\t\t\t\tcounter: request.counter\n\t\t\t};\n\n\t\t\t// HTTP-network fetch step 12.1.1.3\n\t\t\tconst codings = headers.get('Content-Encoding');\n\n\t\t\t// HTTP-network fetch step 12.1.1.4: handle content codings\n\n\t\t\t// in following scenarios we ignore compression support\n\t\t\t// 1. compression support is disabled\n\t\t\t// 2. HEAD request\n\t\t\t// 3. no Content-Encoding header\n\t\t\t// 4. no content response (204)\n\t\t\t// 5. content not modified response (304)\n\t\t\tif (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) {\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// For Node v6+\n\t\t\t// Be less strict when decoding compressed responses, since sometimes\n\t\t\t// servers send slightly invalid responses that are still accepted\n\t\t\t// by common browsers.\n\t\t\t// Always using Z_SYNC_FLUSH is what cURL does.\n\t\t\tconst zlibOptions = {\n\t\t\t\tflush: zlib.Z_SYNC_FLUSH,\n\t\t\t\tfinishFlush: zlib.Z_SYNC_FLUSH\n\t\t\t};\n\n\t\t\t// for gzip\n\t\t\tif (codings == 'gzip' || codings == 'x-gzip') {\n\t\t\t\tbody = body.pipe(zlib.createGunzip(zlibOptions));\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// for deflate\n\t\t\tif (codings == 'deflate' || codings == 'x-deflate') {\n\t\t\t\t// handle the infamous raw deflate response from old servers\n\t\t\t\t// a hack for old IIS and Apache servers\n\t\t\t\tconst raw = res.pipe(new PassThrough$1());\n\t\t\t\traw.once('data', function (chunk) {\n\t\t\t\t\t// see http://stackoverflow.com/questions/37519828\n\t\t\t\t\tif ((chunk[0] & 0x0F) === 0x08) {\n\t\t\t\t\t\tbody = body.pipe(zlib.createInflate());\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbody = body.pipe(zlib.createInflateRaw());\n\t\t\t\t\t}\n\t\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\t\tresolve(response);\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// for br\n\t\t\tif (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') {\n\t\t\t\tbody = body.pipe(zlib.createBrotliDecompress());\n\t\t\t\tresponse = new Response(body, response_options);\n\t\t\t\tresolve(response);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// otherwise, use response as-is\n\t\t\tresponse = new Response(body, response_options);\n\t\t\tresolve(response);\n\t\t});\n\n\t\twriteToStream(req, request);\n\t});\n}\n/**\n * Redirect code matching\n *\n * @param Number code Status code\n * @return Boolean\n */\nfetch.isRedirect = function (code) {\n\treturn code === 301 || code === 302 || code === 303 || code === 307 || code === 308;\n};\n\n// expose Promise\nfetch.Promise = global.Promise;\n\nexport default fetch;\nexport { Headers, Request, Response, FetchError };\n","var nodeFetch = require('node-fetch')\nvar realFetch = nodeFetch.default || nodeFetch\n\nvar fetch = function (url, options) {\n // Support schemaless URIs on the server for parity with the browser.\n // Ex: //github.com/ -> https://github.com/\n if (/^\\/\\//.test(url)) {\n url = 'https:' + url\n }\n return realFetch.call(this, url, options)\n}\n\nmodule.exports = exports = fetch\nexports.fetch = fetch\nexports.Headers = nodeFetch.Headers\nexports.Request = nodeFetch.Request\nexports.Response = nodeFetch.Response\n\n// Needed for TypeScript consumers without esModuleInterop.\nexports.default = fetch\n","import fetch from \"cross-fetch\";\nimport JSBI from \"jsbi\";\n\nfunction mergeOptions(overrideOptions, defaultOptions) {\n defaultOptions = defaultOptions || {};\n const headers = Object.assign(\n {},\n defaultOptions.headers || {},\n overrideOptions.headers || {}\n );\n return Object.assign({}, defaultOptions, overrideOptions, {\n headers: headers\n });\n}\n\nconst batchHandler = {\n get: (target, method, receiver) => {\n if (method === \"send\") {\n return async () => {\n const response = await fetch(\n target.uri,\n mergeOptions(\n {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(target.payload)\n },\n target.defaultOptions\n )\n );\n return await response.json();\n };\n }\n return (...params) => {\n const id = target.id;\n target.id = target.id + 1;\n target.payload.push({\n jsonrpc: \"2.0\",\n id: id,\n method: method,\n params: params\n });\n return receiver;\n };\n }\n};\n\nconst handler = {\n get: (target, method) => {\n if (method === \"batch\") {\n return () => {\n return new Proxy(\n {\n id: Math.round(Math.random() * 10000000),\n payload: [],\n uri: target.uri,\n defaultOptions: target.defaultOptions\n },\n batchHandler\n );\n };\n }\n return async (...params) => {\n const id = Math.round(Math.random() * 10000000);\n const response = await fetch(\n target.uri,\n mergeOptions(\n {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: id,\n method: method,\n params: params\n })\n },\n target.defaultOptions\n )\n );\n const data = await response.json();\n if (data.id !== id) {\n throw new Error(\"JSONRPCError: response ID does not match request ID!\");\n }\n if (data.error) {\n throw new Error(\n `JSONRPCError: server error ${JSON.stringify(data.error)}`\n );\n }\n return data.result;\n };\n }\n};\n\nexport class RPC {\n constructor(uri, defaultOptions = {}) {\n this.uri = uri;\n this.defaultOptions = defaultOptions;\n return new Proxy(this, handler);\n }\n\n static create(uri) {\n return new RPC(uri);\n }\n}\n\nexport function HexStringToBigInt(hexString) {\n return JSBI.BigInt(hexString);\n}\n\nexport function BigIntToHexString(bigInt) {\n return \"0x\" + bigInt.toString(16);\n}\n","// This package provides normalizer functions. Even though CKB uses molecule\n// as the serialization layer. There is still CKB specific knowledge that does\n// not belong in molecule. For example, all numbers in CKB protocols are\n// serialized using little endian format. This package tries to encode such\n// knowledge. The goal here, is that you are free to use whatever types that\n// makes most sense to represent the values. As long as you pass your object\n// through the normalizers here, molecule should be able to serialize the values\n// into correct formats required by CKB.\n//\n// Note this is only used when you need to deal with CKB structures in molecule\n// format. If you are using RPCs or GraphQL to interact with CKB, chances are you\n// will not need this package.\nimport JSBI from \"jsbi\";\nimport { Reader } from \"./reader\";\nimport { BigIntToHexString } from \"./rpc\";\n\nfunction normalizeHexNumber(length) {\n return function(debugPath, value) {\n if (!(value instanceof ArrayBuffer)) {\n let intValue = BigIntToHexString(JSBI.BigInt(value)).substr(2);\n if (intValue.length % 2 !== 0) {\n intValue = \"0\" + intValue;\n }\n if (intValue.length / 2 > length) {\n throw new Error(\n `${debugPath} is ${intValue.length /\n 2} bytes long, expected length is ${length}!`\n );\n }\n const view = new DataView(new ArrayBuffer(length));\n for (let i = 0; i < intValue.length / 2; i++) {\n const start = intValue.length - (i + 1) * 2;\n view.setUint8(i, parseInt(intValue.substr(start, 2), 16));\n }\n value = view.buffer;\n }\n if (value.byteLength < length) {\n const array = new Uint8Array(length);\n array.set(new Uint8Array(value), 0);\n value = array.buffer;\n }\n return value;\n };\n}\n\nfunction normalizeRawData(length) {\n return function(debugPath, value) {\n value = new Reader(value).toArrayBuffer();\n if (length > 0 && value.byteLength !== length) {\n throw new Error(\n `${debugPath} has invalid length ${value.byteLength}, required: ${length}`\n );\n }\n return value;\n };\n}\n\nfunction normalizeObject(debugPath, object, keys) {\n const result = {};\n\n for (const [key, f] of Object.entries(keys)) {\n const value = object[key];\n if (!value) {\n throw new Error(`${debugPath} is missing ${key}!`);\n }\n result[key] = f(`${debugPath}.${key}`, value);\n }\n return result;\n}\n\nexport function NormalizeScript(script, { debugPath = \"script\" } = {}) {\n return normalizeObject(debugPath, script, {\n code_hash: normalizeRawData(32),\n hash_type: function(debugPath, value) {\n switch (value) {\n case \"data\":\n return 0;\n case \"type\":\n return 1;\n case \"data1\":\n return 2;\n case 0:\n return value;\n case 1:\n return value;\n case 2:\n return value;\n default:\n throw new Error(`${debugPath}.hash_type has invalid value: ${value}`);\n }\n },\n args: normalizeRawData(-1)\n });\n}\n\nexport function NormalizeOutPoint(outPoint, { debugPath = \"out_point\" } = {}) {\n return normalizeObject(debugPath, outPoint, {\n tx_hash: normalizeRawData(32),\n index: normalizeHexNumber(4)\n });\n}\n\nfunction toNormalize(normalize) {\n return function(debugPath, value) {\n return normalize(value, {\n debugPath\n });\n };\n}\n\nexport function NormalizeCellInput(\n cellInput,\n { debugPath = \"cell_input\" } = {}\n) {\n return normalizeObject(debugPath, cellInput, {\n since: normalizeHexNumber(8),\n previous_output: toNormalize(NormalizeOutPoint)\n });\n}\n\nexport function NormalizeCellOutput(\n cellOutput,\n { debugPath = \"cell_output\" } = {}\n) {\n const result = normalizeObject(debugPath, cellOutput, {\n capacity: normalizeHexNumber(8),\n lock: toNormalize(NormalizeScript)\n });\n if (cellOutput.type) {\n result.type_ = NormalizeScript(cellOutput.type, {\n debugPath: `${debugPath}.type`\n });\n }\n return result;\n}\n\nexport function NormalizeCellDep(cellDep, { debugPath = \"cell_dep\" } = {}) {\n return normalizeObject(debugPath, cellDep, {\n out_point: toNormalize(NormalizeOutPoint),\n dep_type: function(debugPath, value) {\n switch (value) {\n case \"code\":\n return 0;\n case \"dep_group\":\n return 1;\n case 0:\n return value;\n case 1:\n return value;\n default:\n throw new Error(`${debugPath}.dep_type has invalid value: ${value}`);\n }\n }\n });\n}\n\nfunction toNormalizeArray(normalizeFunction) {\n return function(debugPath, array) {\n return array.map((item, i) => {\n return normalizeFunction(`${debugPath}[${i}]`, item);\n });\n };\n}\n\nexport function NormalizeRawTransaction(\n rawTransaction,\n { debugPath = \"raw_transaction\" } = {}\n) {\n return normalizeObject(debugPath, rawTransaction, {\n version: normalizeHexNumber(4),\n cell_deps: toNormalizeArray(toNormalize(NormalizeCellDep)),\n header_deps: toNormalizeArray(normalizeRawData(32)),\n inputs: toNormalizeArray(toNormalize(NormalizeCellInput)),\n outputs: toNormalizeArray(toNormalize(NormalizeCellOutput)),\n outputs_data: toNormalizeArray(normalizeRawData(-1))\n });\n}\n\nexport function NormalizeTransaction(\n transaction,\n { debugPath = \"transaction\" } = {}\n) {\n const rawTransaction = NormalizeRawTransaction(transaction, {\n debugPath: `(raw)${debugPath}`\n });\n const result = normalizeObject(debugPath, transaction, {\n witnesses: toNormalizeArray(normalizeRawData(-1))\n });\n result.raw = rawTransaction;\n return result;\n}\n\nexport function NormalizeRawHeader(\n rawHeader,\n { debugPath = \"raw_header\" } = {}\n) {\n return normalizeObject(debugPath, rawHeader, {\n version: normalizeHexNumber(4),\n compact_target: normalizeHexNumber(4),\n timestamp: normalizeHexNumber(8),\n number: normalizeHexNumber(8),\n epoch: normalizeHexNumber(8),\n parent_hash: normalizeRawData(32),\n transactions_root: normalizeRawData(32),\n proposals_hash: normalizeRawData(32),\n extra_hash: normalizeRawData(32),\n dao: normalizeRawData(32)\n });\n}\n\nexport function NormalizeHeader(header, { debugPath = \"header\" } = {}) {\n const rawHeader = NormalizeRawHeader(header, {\n debugPath: `(raw)${debugPath}`\n });\n const result = normalizeObject(debugPath, header, {\n nonce: normalizeHexNumber(16)\n });\n result.raw = rawHeader;\n return result;\n}\n\nexport function NormalizeUncleBlock(\n uncleBlock,\n { debugPath = \"uncle_block\" } = {}\n) {\n return normalizeObject(debugPath, uncleBlock, {\n header: toNormalize(NormalizeHeader),\n proposals: toNormalizeArray(normalizeRawData(10))\n });\n}\n\nexport function NormalizeBlock(block, { debugPath = \"block\" } = {}) {\n return normalizeObject(debugPath, block, {\n header: toNormalize(NormalizeHeader),\n uncles: toNormalizeArray(toNormalize(NormalizeUncleBlock)),\n transactions: toNormalizeArray(toNormalize(NormalizeTransaction)),\n proposals: toNormalizeArray(normalizeRawData(10))\n });\n}\n\nexport function NormalizeCellbaseWitness(\n cellbaseWitness,\n { debugPath = \"cellbase_witness\" } = {}\n) {\n return normalizeObject(debugPath, cellbaseWitness, {\n lock: toNormalize(NormalizeScript),\n message: normalizeRawData(-1)\n });\n}\n\nexport function NormalizeWitnessArgs(\n witnessArgs,\n { debugPath = \"witness_args\" } = {}\n) {\n const result = {};\n if (witnessArgs.lock) {\n result.lock = normalizeRawData(-1)(`${debugPath}.lock`, witnessArgs.lock);\n }\n if (witnessArgs.input_type) {\n result.input_type = normalizeRawData(-1)(\n `${debugPath}.input_type`,\n witnessArgs.input_type\n );\n }\n if (witnessArgs.output_type) {\n result.output_type = normalizeRawData(-1)(\n `${debugPath}.output_type`,\n witnessArgs.output_type\n );\n }\n return result;\n}\n","// This package provides transformer functions that transform JavaScript objects\n// into JSON ready objects that can be passed to RPC. It following the following\n// rules:\n//\n// 1. If the specified object has a serializeJson method, it would invoke this\n// method and use the result to replace current object.\n// 2. It then restricts the keys of the object to keys required by the specified\n// entity(i.e., a Script would only have code_hash, hash_type, args keys),for each\n// sub-field, it then recursively perform the steps here from step 1.\n// 3. It then optionally run validator functions to ensure the resulting object\n// follows specified rules.\n//\n// Note rule 1 here provides the flexibility in defining your own structures: you\n// could define a class containing custom data structures, then provide a\n// serializeJson that transforms the custom one into the rigid data structure\n// required by CKB. You can also leverage the Reader class we provide as much as\n// possible. Since Reader class does provide serializeJson methods, transformers\n// here will transform them to valid hex strings required by CKB.\nimport * as validators from \"./validators\";\n\nfunction invokeSerializeJson(debugPath, value) {\n if (value instanceof Object && value.serializeJson instanceof Function) {\n return value.serializeJson.call(value);\n }\n return value;\n}\n\nfunction transformObject(debugPath, object, keys) {\n object = invokeSerializeJson(debugPath, object);\n if (!(object instanceof Object)) {\n throw new Error(`Transformed ${debugPath} is not an object!`);\n }\n const result = {};\n\n for (const [key, f] of Object.entries(keys)) {\n let value = object[key];\n if (!value) {\n const camelKey = key.replace(/(_[a-z])/g, group =>\n group.toUpperCase().replace(\"_\", \"\")\n );\n value = object[camelKey];\n }\n if (value) {\n result[key] = f(`${debugPath}.${key}`, value);\n }\n }\n return result;\n}\n\nexport function TransformScript(\n script,\n { validation = true, debugPath = \"script\" } = {}\n) {\n script = transformObject(debugPath, script, {\n code_hash: invokeSerializeJson,\n hash_type: invokeSerializeJson,\n args: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateScript(script, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return script;\n}\n\nexport function TransformOutPoint(\n outPoint,\n { validation = true, debugPath = \"out_point\" } = {}\n) {\n outPoint = transformObject(debugPath, outPoint, {\n tx_hash: invokeSerializeJson,\n index: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateOutPoint(outPoint, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return outPoint;\n}\n\nfunction toInvoke(transform) {\n return function(debugPath, value) {\n return transform(value, {\n validation: false,\n debugPath\n });\n };\n}\n\nexport function TransformCellInput(\n cellInput,\n { validation = true, debugPath = \"cell_input\" } = {}\n) {\n cellInput = transformObject(debugPath, cellInput, {\n since: invokeSerializeJson,\n previous_output: toInvoke(TransformOutPoint)\n });\n\n if (validation) {\n validators.ValidateCellInput(cellInput, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellInput;\n}\n\nexport function TransformCellOutput(\n cellOutput,\n { validation = true, debugPath = \"cell_output\" } = {}\n) {\n cellOutput = transformObject(debugPath, cellOutput, {\n capacity: invokeSerializeJson,\n lock: toInvoke(TransformScript),\n type: toInvoke(TransformScript)\n });\n\n if (validation) {\n validators.ValidateCellOutput(cellOutput, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellOutput;\n}\n\nexport function TransformCellDep(\n cellDep,\n { validation = true, debugPath = \"cell_dep\" } = {}\n) {\n cellDep = transformObject(debugPath, cellDep, {\n out_point: toInvoke(TransformOutPoint),\n dep_type: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateCellDep(cellDep, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellDep;\n}\n\nfunction toInvokeArray(invokeFunction) {\n return function(debugPath, array) {\n return array.map((item, i) => {\n return invokeFunction(`${debugPath}[${i}]`, item);\n });\n };\n}\n\nexport function TransformRawTransaction(\n rawTransaction,\n { validation = true, debugPath = \"raw_transaction\" } = {}\n) {\n rawTransaction = transformObject(debugPath, rawTransaction, {\n version: invokeSerializeJson,\n cell_deps: toInvokeArray(toInvoke(TransformCellDep)),\n header_deps: toInvokeArray(invokeSerializeJson),\n inputs: toInvokeArray(toInvoke(TransformCellInput)),\n outputs: toInvokeArray(toInvoke(TransformCellOutput)),\n outputs_data: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateRawTransaction(rawTransaction, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return rawTransaction;\n}\n\nexport function TransformTransaction(\n transaction,\n { validation = true, debugPath = \"transaction\" } = {}\n) {\n transaction = transformObject(debugPath, transaction, {\n version: invokeSerializeJson,\n cell_deps: toInvokeArray(toInvoke(TransformCellDep)),\n header_deps: toInvokeArray(invokeSerializeJson),\n inputs: toInvokeArray(toInvoke(TransformCellInput)),\n outputs: toInvokeArray(toInvoke(TransformCellOutput)),\n outputs_data: toInvokeArray(invokeSerializeJson),\n witnesses: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateTransaction(transaction, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return transaction;\n}\n\nexport function TransformRawHeader(\n rawHeader,\n { validation = true, debugPath = \"raw_header\" } = {}\n) {\n rawHeader = transformObject(debugPath, rawHeader, {\n version: invokeSerializeJson,\n compact_target: invokeSerializeJson,\n timestamp: invokeSerializeJson,\n number: invokeSerializeJson,\n epoch: invokeSerializeJson,\n parent_hash: invokeSerializeJson,\n transactions_root: invokeSerializeJson,\n proposals_hash: invokeSerializeJson,\n extra_hash: invokeSerializeJson,\n dao: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateRawHeader(rawHeader, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return rawHeader;\n}\n\nexport function TransformHeader(\n header,\n { validation = true, debugPath = \"header\" } = {}\n) {\n header = transformObject(debugPath, header, {\n version: invokeSerializeJson,\n compact_target: invokeSerializeJson,\n timestamp: invokeSerializeJson,\n number: invokeSerializeJson,\n epoch: invokeSerializeJson,\n parent_hash: invokeSerializeJson,\n transactions_root: invokeSerializeJson,\n proposals_hash: invokeSerializeJson,\n extra_hash: invokeSerializeJson,\n dao: invokeSerializeJson,\n nonce: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateHeader(header, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return header;\n}\n\nexport function TransformUncleBlock(\n uncleBlock,\n { validation = true, debugPath = \"uncle_block\" } = {}\n) {\n uncleBlock = transformObject(debugPath, uncleBlock, {\n header: toInvoke(TransformHeader),\n proposals: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateUncleBlock(uncleBlock, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return uncleBlock;\n}\n\nexport function TransformBlock(\n block,\n { validation = true, debugPath = \"block\" } = {}\n) {\n block = transformObject(debugPath, block, {\n header: toInvoke(TransformHeader),\n uncles: toInvokeArray(toInvoke(TransformUncleBlock)),\n transactions: toInvokeArray(toInvoke(TransformTransaction)),\n proposals: toInvokeArray(invokeSerializeJson)\n });\n\n if (validation) {\n validators.ValidateBlock(block, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return block;\n}\n\nexport function TransformCellbaseWitness(\n cellbaseWitness,\n { validation = true, debugPath = \"cellbase_witness\" } = {}\n) {\n cellbaseWitness = transformObject(debugPath, cellbaseWitness, {\n lock: toInvoke(TransformScript),\n message: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateCellbaseWitness(cellbaseWitness, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return cellbaseWitness;\n}\n\nexport function TransformWitnessArgs(\n witnessArgs,\n { validation = true, debugPath = \"witness_args\" } = {}\n) {\n witnessArgs = transformObject(debugPath, witnessArgs, {\n lock: invokeSerializeJson,\n input_type: invokeSerializeJson,\n output_type: invokeSerializeJson\n });\n\n if (validation) {\n validators.ValidateWitnessArgs(witnessArgs, {\n debugPath: `(transformed) ${debugPath}`\n });\n }\n return witnessArgs;\n}\n","import JSBI from \"jsbi\";\nimport { Reader } from \"../reader\";\nimport { HexStringToBigInt, BigIntToHexString } from \"../rpc\";\n\nexport class RPCCollector {\n constructor(\n rpc,\n lockHash,\n {\n skipCellWithContent = true,\n loadData = false,\n loadBlockNumber = true\n } = {}\n ) {\n this.rpc = rpc;\n this.lockHash = new Reader(lockHash).serializeJson();\n this.skipCellWithContent = skipCellWithContent;\n this.loadData = loadData;\n this.loadBlockNumber = loadBlockNumber;\n }\n\n async *collect() {\n const to = HexStringToBigInt(await this.rpc.get_tip_block_number());\n let currentFrom = JSBI.BigInt(0);\n while (JSBI.lessThanOrEqual(currentFrom, to)) {\n let currentTo = JSBI.add(currentFrom, JSBI.BigInt(100));\n if (JSBI.greaterThan(currentTo, to)) {\n currentTo = to;\n }\n const cells = await this.rpc.get_cells_by_lock_hash(\n this.lockHash,\n BigIntToHexString(currentFrom),\n BigIntToHexString(currentTo)\n );\n for (const cell of cells) {\n if (this.skipCellWithContent) {\n if (\n cell.type ||\n JSBI.greaterThan(\n HexStringToBigInt(cell.output_data_len),\n JSBI.BigInt(100)\n )\n ) {\n continue;\n }\n }\n let data = null;\n if (this.loadData) {\n const cellWithData = await this.rpc.get_live_cell(\n cell.out_point,\n true\n );\n data = cellWithData.cell.data.content;\n }\n let block_number = null;\n if (this.loadBlockNumber) {\n const header = await this.rpc.get_header(cell.block_hash);\n block_number = header.number;\n }\n yield {\n cellbase: cell.cellbase,\n cell_output: {\n capacity: cell.capacity,\n lock: cell.lock,\n type: cell.type\n },\n out_point: cell.out_point,\n block_hash: cell.block_hash,\n data: data,\n output_data_len: cell.output_data_len,\n block_number\n };\n }\n currentFrom = JSBI.add(currentTo, JSBI.BigInt(1));\n }\n }\n}\n","import JSBI from \"jsbi\";\nimport { Reader } from \"./reader\";\nimport { ValidateTransaction, ValidateOutPoint } from \"./validators\";\n\nexport class TransactionDumper {\n constructor(\n rpc,\n { validateTransaction = true, depGroupUnpacker = null } = {}\n ) {\n this.rpc = rpc;\n this.validateTransaction = validateTransaction;\n this.depGroupUnpacker = depGroupUnpacker;\n }\n\n async dumpByHash(txHash) {\n const tx = (await this.rpc.get_transaction(txHash)).transaction;\n delete tx.hash;\n return await this.dump(tx);\n }\n\n async dump(tx) {\n if (this.validateTransaction) {\n ValidateTransaction(tx);\n }\n const mockInputs = [];\n for (const input of tx.inputs) {\n const { output, data, header } = await this._resolveOutPoint(\n input.previous_output\n );\n mockInputs.push({ input, output, data, header });\n }\n const mockCellDeps = [];\n for (const cellDep of tx.cell_deps) {\n const { output, data, header } = await this._resolveOutPoint(\n cellDep.out_point\n );\n mockCellDeps.push({\n cell_dep: cellDep,\n output,\n data,\n header\n });\n if (cellDep.dep_type === \"dep_group\") {\n if (!this.depGroupUnpacker) {\n throw new Error(\n \"depGroupUnpacker must be provided when the transaction contains dep_group!\"\n );\n }\n const outPoints = this.depGroupUnpacker(new Reader(data));\n for (const outPoint of outPoints) {\n ValidateOutPoint(outPoint);\n const { output, data, header } = await this._resolveOutPoint(\n outPoint\n );\n mockCellDeps.push({\n cell_dep: {\n out_point: outPoint,\n dep_type: \"code\"\n },\n output,\n data,\n header\n });\n }\n }\n }\n const mockHeaderDeps = [];\n for (const headerDep of tx.header_deps) {\n mockHeaderDeps.push(await this.rpc.get_header(headerDep));\n }\n return JSON.stringify({\n mock_info: {\n inputs: mockInputs,\n cell_deps: mockCellDeps,\n header_deps: mockHeaderDeps\n },\n tx\n });\n }\n\n async _resolveOutPoint(out_point) {\n const txStatus = await this.rpc.get_transaction(out_point.tx_hash);\n if (!txStatus || !txStatus.transaction) {\n throw new Error(`Transaction ${out_point.tx_hash} cannot be found!`);\n }\n const tx = txStatus.transaction;\n const index = JSBI.toNumber(JSBI.BigInt(out_point.index));\n if (index >= tx.outputs.length) {\n throw new Error(\n `Transaction ${out_point.tx_hash} does not have output ${index}!`\n );\n }\n const data = {\n output: tx.outputs[index],\n data: tx.outputs_data[index]\n };\n if (txStatus.tx_status.status === \"committed\") {\n data.header = txStatus.tx_status.block_hash;\n }\n return data;\n }\n}\n","export { Reader } from \"./reader.js\";\nexport { TransactionDumper } from \"./transaction_dumper.js\";\nexport { RPC, HexStringToBigInt, BigIntToHexString } from \"./rpc.js\";\nexport * as normalizers from \"./normalizers\";\nexport * as transformers from \"./transformers\";\nexport * as validators from \"./validators\";\nexport * as cell_collectors from \"./cell_collectors\";\nexport const VERSION = \"__development_build__\";\n"],"names":["ArrayBufferReader","[object Object]","buffer","this","view","DataView","byteLength","i","getUint8","Array","prototype","map","call","Uint8Array","x","toString","slice","join","HexStringReader","string","length","parseInt","substr","ArrayBuffer","setUint8","indexAt","Reader","input","startsWith","Error","c","charCodeAt","JSBI","a","b","__kMaxLength","RangeError","super","sign","Math","floor","Number","isFinite","__zero","__oneDigit","__fromDouble","__fromString","SyntaxError","constructor","__toPrimitive","BigInt","TypeError","push","__toStringBasePowerOfTwo","__toStringGeneric","clz32","__unsignedDigit","d","__digit","e","f","Infinity","g","h","j","k","l","m","n","o","__decideRounding","p","__kBitConversionInts","__kBitConversionDouble","__copy","__absoluteSubOne","__trim","__absoluteAddOne","unaryMinus","__kMaxLengthBits","__initializeDigits","__setDigit","multiply","__clzmsd","__multiplyAccumulate","__absoluteCompare","__absoluteDivSmall","__absoluteDivLarge","__absoluteModSmall","__absoluteAdd","__absoluteSub","__rightShiftByAbsolute","__leftShiftByAbsolute","__compareToBigInt","equal","max","__absoluteAnd","__absoluteOr","__absoluteAndNot","__absoluteXor","__truncateToNBits","__truncateAndSubFromPowerOfTwo","__toNumeric","__isBigInt","add","__compare","EQ","__equalToNumber","pop","__isWhitespace","__kMaxBitsPerChar","__kBitsPerCharTableMultiplier","__kBitsPerCharTableShift","__fillFromParts","q","__inplaceMultiplyAdd","__kConversionChars","exponentiate","__halfDigit","__setHalfDigit","quotient","remainder","__unequalSign","__absoluteGreater","__absoluteLess","abs","__compareToDouble","__comparisonResultToBool","__compareToNumber","__setDigitGrow","imul","r","s","t","__halfDigitLength","__clz16","__specialLeftShift","__internalMultiplyAdd","__inplaceSub","__inplaceAdd","__inplaceRightShift","__toShiftAmount","__rightShiftByMaximum","Symbol","toPrimitive","valueOf","min","assertObjectWithKeys","debugPath","object","expectedKeys","optionalKeys","Object","assertObject","providedKeys","keys","sort","requiredLength","maximalLength","errorMessage","optionalProvidedKeys","filter","key","includes","find","assertHexString","test","assertHash","hash","assertInteger","ValidateScript","script","nestedValidation","code_hash","args","hash_type","ValidateOutPoint","outPoint","tx_hash","index","ValidateCellInput","cellInput","since","previous_output","ValidateCellOutput","cellOutput","capacity","lock","type","ValidateCellDep","cellDep","dep_type","out_point","assertArray","array","validateFunction","isArray","toAssert","value","assertCommonTransaction","rawTransaction","version","cell_deps","header_deps","inputs","outputs","outputs_data","ValidateRawTransaction","ValidateTransaction","transaction","witnesses","ValidateRawHeader","rawHeader","compact_target","timestamp","number","epoch","parent_hash","transactions_root","proposals_hash","extra_hash","dao","assertCommonHeader","ValidateHeader","header","nonce","assertProposalShortId","shortId","ValidateUncleBlock","uncleBlock","proposals","ValidateBlock","block","uncles","transactions","ValidateCellbaseWitness","cellbaseWitness","message","ValidateWitnessArgs","witnessArgs","input_type","output_type","__kBitConversionBuffer","Float64Array","Int32Array","Readable","Stream","BUFFER","TYPE","Blob","blobParts","arguments","options","buffers","size","element","Buffer","isView","from","byteOffset","String","concat","undefined","toLowerCase","Promise","resolve","buf","ab","readable","_read","start","end","relativeStart","relativeEnd","span","slicedBuffer","blob","FetchError","systemError","code","errno","captureStackTrace","convert","defineProperties","enumerable","defineProperty","toStringTag","writable","configurable","create","name","require","INTERNALS","PassThrough","Body","body","_this","_ref","_ref$size","_ref$timeout","timeout","isURLSearchParams","isBlob","isBuffer","disturbed","error","on","err","url","consumeBody","_this4","reject","alloc","stream","accum","accumBytes","abort","resTimeout","setTimeout","chunk","clearTimeout","obj","append","delete","get","getAll","has","set","arrayBuffer","clone","instance","p1","p2","bodyUsed","getBoundary","pipe","extractContentType","getTotalBytes","getLengthSync","_lengthRetrievers","hasKnownLength","then","ct","headers","assign","_this2","JSON","parse","_this3","res","str","charset","exec","convertBody","json","text","mixIn","proto","getOwnPropertyNames","desc","getOwnPropertyDescriptor","global","invalidTokenRegex","invalidHeaderCharRegex","validateName","validateValue","MAP","Headers","init","rawHeaders","raw","headerNames","headerName","method","iterator","pairs","pair","callback","thisArg","getHeaders","_pairs$i","createHeadersIterator","kind","entries","forEach","values","INTERNAL","target","HeadersIteratorPrototype","setPrototypeOf","getPrototypeOf","_INTERNAL","done","exportNodeCompatibleHeaders","__proto__","hostHeaderKey","INTERNALS$1","STATUS_CODES","http","Response","opts","status","contentType","statusText","counter","ok","redirected","INTERNALS$2","parse_url","Url","format_url","format","streamDestructionSupported","isRequest","Request","parsedURL","href","toUpperCase","inputBody","signal","isAbortSignal","redirect","follow","compress","agent","AbortError","PassThrough$1","resolve_url","fetch","request","protocol","hostname","contentLengthValue","totalBytes","getNodeRequestOptions","send","https","response","destroy","emit","aborted","abortAndFinalize","finalize","req","reqTimeout","removeEventListener","addEventListener","once","socket","val","createHeadersLenient","isRedirect","statusCode","location","locationURL","requestOpts","response_options","statusMessage","codings","zlibOptions","flush","zlib","Z_SYNC_FLUSH","finishFlush","createGunzip","createBrotliDecompress","createInflate","createInflateRaw","dest","write","writeToStream","realFetch","nodeFetch","default","module","exports","mergeOptions","overrideOptions","defaultOptions","batchHandler","receiver","async","uri","Content-Type","stringify","payload","params","id","jsonrpc","handler","Proxy","round","random","data","result","RPC","HexStringToBigInt","hexString","BigIntToHexString","bigInt","normalizeHexNumber","intValue","normalizeRawData","toArrayBuffer","normalizeObject","NormalizeScript","NormalizeOutPoint","toNormalize","normalize","NormalizeCellInput","NormalizeCellOutput","type_","NormalizeCellDep","toNormalizeArray","normalizeFunction","item","NormalizeRawTransaction","NormalizeTransaction","NormalizeRawHeader","NormalizeHeader","NormalizeUncleBlock","invokeSerializeJson","serializeJson","Function","transformObject","replace","group","TransformScript","validation","validators.ValidateScript","TransformOutPoint","validators.ValidateOutPoint","toInvoke","transform","TransformCellInput","validators.ValidateCellInput","TransformCellOutput","validators.ValidateCellOutput","TransformCellDep","validators.ValidateCellDep","toInvokeArray","invokeFunction","TransformTransaction","validators.ValidateTransaction","TransformHeader","validators.ValidateHeader","TransformUncleBlock","validators.ValidateUncleBlock","validators.ValidateRawTransaction","validators.ValidateRawHeader","validators.ValidateBlock","validators.ValidateCellbaseWitness","validators.ValidateWitnessArgs","rpc","lockHash","skipCellWithContent","loadData","loadBlockNumber","to","get_tip_block_number","currentFrom","lessThanOrEqual","currentTo","greaterThan","cells","get_cells_by_lock_hash","cell","output_data_len","get_live_cell","content","block_number","get_header","block_hash","cellbase","cell_output","validateTransaction","depGroupUnpacker","txHash","tx","get_transaction","dump","mockInputs","output","_resolveOutPoint","mockCellDeps","cell_dep","outPoints","mockHeaderDeps","headerDep","mock_info","txStatus","toNumber","tx_status"],"mappings":"mRAAA,MAAMA,EACJC,YAAYC,GACVC,KAAKC,KAAO,IAAIC,SAASH,GAG3BD,SACE,OAAOE,KAAK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,GACrB,MAAM8Y,QAAiB3kB,KAAKsiB,IAAI0B,gBAAgBnY,EAAUd,SAC1D,IAAK4Z,IAAaA,EAAS7X,YACzB,MAAM,IAAIpL,MAAM,eAAemK,EAAUd,4BAE3C,MAAMgZ,EAAKY,EAAS7X,YACd9B,EAAQnJ,EAAK+iB,SAAS/iB,EAAKkB,OAAO8I,EAAUb,QAClD,GAAIA,GAAS+Y,EAAGrX,QAAQzL,OACtB,MAAM,IAAIS,MACR,eAAemK,EAAUd,gCAAgCC,MAG7D,MAAM0T,EAAO,CACXyF,OAAQJ,EAAGrX,QAAQ1B,GACnB0T,KAAMqF,EAAGpX,aAAa3B,IAKxB,MAHkC,cAA9B2Z,EAASE,UAAU/L,SACrB4F,EAAK7Q,OAAS8W,EAASE,UAAUpB,YAE5B/E,oBC5FY"} \ No newline at end of file diff --git a/dist/ckb-js-toolkit.umd.js b/dist/ckb-js-toolkit.umd.js index 464dec4..2e6a628 100644 --- a/dist/ckb-js-toolkit.umd.js +++ b/dist/ckb-js-toolkit.umd.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CKBJSToolkit={})}(this,(function(t){"use strict";class e{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class r{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(e,r)}return new e(r)}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var a=o((function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r,n=0;nl.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=h(this,o(l).call(this,t))).sign=r,n}return i(l,r),n(l,[{key:"toDebugString",value:function(){var t=["BigInt["],e=!0,r=!1,n=void 0;try{for(var i,o,a=this[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)o=i.value,t.push((o?(o>>>0).toString(16):o)+", ")}catch(t){r=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw n}}return t.push("]"),t.join("")}},{key:"toString",value:function(){var t=0t||36this.length&&(r=this.length);for(var n=65535&t,i=t>>>16,o=0,a=65535&e,s=e>>>16,_=0;_>>16,c=u(f,n),g=u(f,i),d=u(h,n),p=u(h,i),v=a+(65535&c),y=s+o+(v>>>16)+(c>>>16)+(65535&g)+(65535&d);o=(a=(g>>>16)+(d>>>16)+(65535&p)+(y>>>16))>>>16,a&=65535,s=p>>>16,this.__setDigit(_,65535&v|y<<16)}if(0!==o||0!==a||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(t,e,r){for(var n,i=0,o=0;o>>16,this.__setHalfDigit(e+o,n);return i}},{key:"__inplaceSub",value:function(t,e,r){var n=0;if(1&e){e>>=1;for(var i=this.__digit(e),o=65535&i,a=0;a>>1;a++){var s=t.__digit(a),u=(i>>>16)-(65535&s)-n;n=1&u>>>16,this.__setDigit(e+a,u<<16|65535&o),n=1&(o=(65535&(i=this.__digit(e+a+1)))-(s>>>16)-n)>>>16}var _=t.__digit(a),l=(i>>>16)-(65535&_)-n;if(n=1&l>>>16,this.__setDigit(e+a,l<<16|65535&o),e+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(65535&(i=this.__digit(e+a+1)))-(_>>>16)-n)>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;for(var f=0;f>>16)-(c>>>16)-(n=1&g>>>16);n=1&d>>>16,this.__setDigit(e+f,d<<16|65535&g)}var p=this.__digit(e+f),v=t.__digit(f),y=(65535&p)-(65535&v)-n;n=1&y>>>16;var b=0;0==(1&r)&&(n=1&(b=(p>>>16)-(v>>>16)-n)>>>16),this.__setDigit(e+f,b<<16|65535&y)}return n}},{key:"__inplaceRightShift",value:function(t){if(0!==t){for(var e,r=this.__digit(0)>>>t,n=this.length-1,i=0;i>>t;this.__setDigit(n,r)}}},{key:"__digit",value:function(t){return this[t]}},{key:"__unsignedDigit",value:function(t){return this[t]>>>0}},{key:"__setDigit",value:function(t,e){this[t]=0|e}},{key:"__setDigitGrow",value:function(t,e){this[t]=0|e}},{key:"__halfDigitLength",value:function(){var t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}},{key:"__halfDigit",value:function(t){return 65535&this[t>>>1]>>>((1&t)<<4)}},{key:"__setHalfDigit",value:function(t,e){var r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}}],[{key:"BigInt",value:function(e){var r=Math.floor,n=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if((0|e)===e)return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!n(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var i=l.__fromString(e);if(null===i)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return i}if("boolean"==typeof e)return!0===e?l.__oneDigit(1,!1):l.__zero();if("object"===t(e)){if(e.constructor===l)return e;var o=l.__toPrimitive(e);return l.BigInt(o)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(t){var e=t.length;if(0===e)return 0;if(1===e){var r=t.__unsignedDigit(0);return t.sign?-r:r}var n=t.__digit(e-1),i=_(n),o=32*e-i;if(1024>>=12;var c=f-12,g=12<=f?0:s<<20+f,d=20+f;0>>32-c,g=s<>>32-d,d-=32);var p=l.__decideRounding(t,d,u,s);if((1===p||0===p&&1==(1&g))&&0==(g=g+1>>>0)&&0!=++h>>>20&&(h=0,1023<++a))return t.sign?-1/0:1/0;var v=t.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=v|a|h,l.__kBitConversionInts[0]=g,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(t){if(0===t.length)return t;var e=t.__copy();return e.sign=!t.sign,e}},{key:"bitwiseNot",value:function(t){return t.sign?l.__absoluteSubOne(t).__trim():l.__absoluteAddOne(t,!0)}},{key:"exponentiate",value:function(t,e){if(e.sign)throw new RangeError("Exponent must be positive");if(0===e.length)return l.__oneDigit(1,!1);if(0===t.length)return t;if(1===t.length&&1===t.__digit(0))return t.sign&&0==(1&e.__digit(0))?l.unaryMinus(t):t;if(1=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){var n=1+(r>>>5),i=new l(n,t.sign&&0!=(1&r));i.__initializeDigits();var o=1<<(31&r);return i.__setDigit(n-1,o),i}var a=null,s=t;for(0!=(1&r)&&(a=t),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(t,e){if(0===t.length)return t;if(0===e.length)return e;var r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;var n=new l(r,t.sign!==e.sign);n.__initializeDigits();for(var i=0;il.__absoluteCompare(t,e))return l.__zero();var r,n=t.sign!==e.sign,i=e.__unsignedDigit(0);if(1===e.length&&65535>=i){if(1===i)return n===t.sign?t:l.unaryMinus(t);r=l.__absoluteDivSmall(t,i,null)}else r=l.__absoluteDivLarge(t,e,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(t,e))return t;var r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(t,r);return 0===n?l.__zero():l.__oneDigit(n,t.sign)}var i=l.__absoluteDivLarge(t,e,!1,!0);return i.sign=t.sign,i.__trim()}},{key:"add",value:function(t,e){var r=t.sign;return r===e.sign?l.__absoluteAdd(t,e,r):0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r)}},{key:"subtract",value:function(t,e){var r=t.sign;return r===e.sign?0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r):l.__absoluteAdd(t,e,r)}},{key:"leftShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__rightShiftByAbsolute(t,e):l.__leftShiftByAbsolute(t,e)}},{key:"signedRightShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__leftShiftByAbsolute(t,e):l.__rightShiftByAbsolute(t,e)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(t,e){return 0>l.__compareToBigInt(t,e)}},{key:"lessThanOrEqual",value:function(t,e){return 0>=l.__compareToBigInt(t,e)}},{key:"greaterThan",value:function(t,e){return 0=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.lengthl.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.length>>n)return e}return l.__truncateToNBits(t,e)}},{key:"ADD",value:function(t,e){if(t=l.__toPrimitive(t),e=l.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)&&l.__isBigInt(e))return l.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(t,e){return l.__compare(t,e,0)}},{key:"LE",value:function(t,e){return l.__compare(t,e,1)}},{key:"GT",value:function(t,e){return l.__compare(t,e,2)}},{key:"GE",value:function(t,e){return l.__compare(t,e,3)}},{key:"EQ",value:function(e,r){for(;;){if(l.__isBigInt(e))return l.__isBigInt(r)?l.equal(e,r):l.EQ(r,e);if("number"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("string"==typeof e){if(l.__isBigInt(r))return null!==(e=l.__fromString(e))&&l.equal(e,r);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("boolean"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,+e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("symbol"===t(e)){if(l.__isBigInt(r))return!1;if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else{if("object"!==t(e))return e==r;if("object"===t(r)&&r.constructor!==l)return e==r;e=l.__toPrimitive(e)}}}},{key:"NE",value:function(t,e){return!l.EQ(t,e)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(t,e){var r=new l(1,e);return r.__setDigit(0,t),r}},{key:"__decideRounding",value:function(t,e,r,n){if(0e)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}var o=1<>>20)-1023,n=1+(r>>>5),i=new l(n,0>t),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&r,_=0;if(u>>f,o=o<<32-f|a>>>f,a<<=32-f}else if(u===s)_=32,e=o,o=a;else{var h=u-s;_=32-h,e=o<>>32-h,o=a<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}},{key:"__fromString",value:function(t){var e=11073741824/s)return null;var _=new l(31+(s*a+u>>>l.__kBitsPerCharTableShift)>>>5,!1),f=10>e?e:10,h=10>=l.__kBitsPerCharTableShift;var c=[],g=[],d=!1;do{for(var p,v=0,y=0;;){if(p=void 0,o-48>>>0>>0>>0>>0>>l.__kBitsPerCharTableShift+5;_.__inplaceMultiplyAdd(D,k,P)}while(!b)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i>>u-(o-=32))}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=e-1,a=t.__digit(r-1),s=0|(32*r-_(a)+i-1)/i;if(t.sign&&s++,268435456>>v,c=32-v;c>=i;)u[f--]=l.__kConversionChars[h&o],h>>>=i,c-=i}var y=(h|a<>>i-c;0!==h;)u[f--]=l.__kConversionChars[h&o],h>>>=i;if(t.sign&&(u[f--]="-"),-1!==f)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(t,e,r){var n=t.length;if(0===n)return"";if(1===n){var i=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(i="-"+i),i}var o,a,s=32*n-_(t.__digit(n-1)),u=l.__kMaxBitsPerChar[e]-1,f=s*l.__kBitsPerCharTableMultiplier,h=1+(f=0|(f+=u-1)/u)>>1,c=l.exponentiate(l.__oneDigit(e,!1),l.__oneDigit(h,!1)),g=c.__unsignedDigit(0);if(1===c.length&&65535>=g){(o=new l(t.length,!1)).__initializeDigits();for(var d,p=0,v=2*t.length-1;0<=v;v--)d=p<<16|t.__halfDigit(v),o.__setHalfDigit(v,0|d/g),p=0|d%g;a=p.toString(e)}else{var y=l.__absoluteDivLarge(t,c,!0,!0);o=y.quotient;var b=y.remainder.__trim();a=l.__toStringGeneric(b,e,!0)}o.__trim();for(var m=l.__toStringGeneric(o,e,!0);a.lengthn?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(t,e){if(!0|e){var r=t.sign,n=0>e;if(r!==n)return l.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?l.__absoluteGreater(r):oe)return l.__unequalSign(r);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;l.__kBitConversionDouble[0]=e;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=t.length,a=t.__digit(o-1),s=_(a),u=32*o-s,f=i+1;if(uf)return l.__absoluteGreater(r);var h=1048576|1048575&l.__kBitConversionInts[1],c=l.__kBitConversionInts[0],g=20,d=31-s;if(d!==(u-1)%31)throw new Error("implementation bug");var p,v=0;if(d>>y,h=h<<32-y|c>>>y,c<<=32-y}else if(d===g)v=32,p=h,h=c;else{var b=d-g;v=32-b,p=h<>>32-b,h=c<>>=0)>(p>>>=0))return l.__absoluteGreater(r);if(a>>0,h=c,c=0):p=0;var w=t.__unsignedDigit(m);if(w>p)return l.__absoluteGreater(r);if(we&&t.__unsignedDigit(0)===a(e):0===l.__compareToDouble(t,e)}},{key:"__comparisonResultToBool",value:function(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(l.__isBigInt(t)&&"string"==typeof e)return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("string"==typeof t&&l.__isBigInt(e))return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)){if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}},{key:"__absoluteAdd",value:function(t,e,r){if(t.length>>16)+(s>>>16)+(_>>>16);o=f>>>16,i.__setDigit(a,65535&_|f<<16)}for(;a>>16)+(c>>>16);o=g>>>16,i.__setDigit(a,65535&c|g<<16)}return a>>16)-(s>>>16)-(i=1&u>>>16);i=1&_>>>16,n.__setDigit(o,65535&u|_<<16)}for(;o>>16)-(i=1&h>>>16);i=1&c>>>16,n.__setDigit(o,65535&h|c<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(t,e){var r=2n?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(t,e,r,n){if(0!==e){for(var i=65535&e,o=e>>>16,a=0,s=0,_=0,l=0;l>>16,g=t.__digit(l),d=65535&g,p=g>>>16,v=u(d,i),y=u(d,o),b=u(p,i),m=u(p,o);a=(s=(y>>>16)+(b>>>16)+(65535&m)+(a=(c+=_+a+((h+=s+(65535&v))>>>16)+(v>>>16)+(65535&y)+(65535&b))>>>16))>>>16,s&=65535,_=m>>>16,f=65535&h|c<<16,r.__setDigit(n,f)}for(;0!==a||0!==s||0!==_;n++){var w=r.__digit(n),k=(65535&w)+s,D=(w>>>16)+(k>>>16)+_+a;s=0,_=0,a=D>>>16,w=65535&k|D<<16,r.__setDigit(n,w)}}}},{key:"__internalMultiplyAdd",value:function(t,e,r,n,i){for(var o=r,a=0,s=0;s>>16;var h=u(_>>>16,e),c=(65535&h)+(l>>>16)+o;o=c>>>16,a=h>>>16,i.__setDigit(s,c<<16|65535&f)}if(i.length>n)for(i.__setDigit(n++,o+a);n>>0,a=0|o/e,s=0|(o=((n=0|o%e)<<16|t.__halfDigit(i-1))>>>0)/e;n=0|o%e,r.__setDigit(i>>>1,a<<16|s)}return r}},{key:"__absoluteModSmall",value:function(t,e){for(var r=0,n=2*t.length-1;0<=n;n--)r=0|((r<<16|t.__halfDigit(n))>>>0)%e;return r}},{key:"__absoluteDivLarge",value:function(t,e,r,n){var i=e.__halfDigitLength(),o=e.length,a=t.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var _=new l(i+2>>>1,!1);_.__initializeDigits();var f=l.__clz16(e.__halfDigit(i-1));0>>0;p=0|y/c;for(var b=0|y%c,m=e.__halfDigit(i-2),w=h.__halfDigit(d+i-2);u(p,m)>>>0>(b<<16|w)>>>0&&(p--,!(65535<(b+=c))););}l.__internalMultiplyAdd(e,p,0,o,_);var k=h.__inplaceSub(_,d,i+1);0!==k&&(k=h.__inplaceAdd(e,d,i),h.__setHalfDigit(d+i,h.__halfDigit(d+i)+k),p--),r&&(1&d?g=p<<16:s.__setDigit(d>>>1,g|p))}return n?(h.__inplaceRightShift(f),r?{quotient:s,remainder:h}:h):r?s:void 0}},{key:"__clz16",value:function(t){return _(t)-16}},{key:"__specialLeftShift",value:function(t,e,r){var n=t.length,i=new l(n+r,!1);if(0===e){for(var o=0;o>>32-e;return 0r)throw new RangeError("BigInt too big");var n=r>>>5,i=31&r,o=t.length,a=0!==i&&0!=t.__digit(o-1)>>>32-i,s=o+n+(a?1:0),u=new l(s,t.sign);if(0===i){for(var _=0;_>>32-i;if(a)u.__setDigit(o+n,f);else if(0!==f)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(t,e){var r=t.length,n=t.sign,i=l.__toShiftAmount(e);if(0>i)return l.__rightShiftByMaximum(n);var o=i>>>5,a=31&i,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(t.__digit(o)&(1<>>a,d=r-o-1,p=0;p>>a;f.__setDigit(d,g)}return u&&(f=l.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:"__rightShiftByMaximum",value:function(t){return t?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(t){if(1l.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(e){var r=1>>5,n=new l(r,e.sign),i=r-1,o=0;o>>s}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(t,e,r){for(var n=Math.min,i=t+31>>>5,o=new l(i,r),a=0,s=i-1,u=0,_=n(s,e.length);a<_;a++){var f=e.__digit(a),h=0-(65535&f)-u,c=0-(f>>>16)-(u=1&h>>>16);u=1&c>>>16,o.__setDigit(a,65535&h|c<<16)}for(;a>>16)-(u=1&v>>>16)<<16}else{var y=32-p,b=1<<32-y,m=(65535&b)-(65535&(d=d<>>y))-u;g=65535&m|(b>>>16)-(d>>>16)-(u=1&m>>>16)<<16,g&=b-1}return o.__setDigit(s,g),o.__trim()}},{key:"__digitPow",value:function(t,e){for(var r=1;0>>=1,t*=t;return r}}]),l}(l(Array));return c.__kMaxLength=33554432,c.__kMaxLengthBits=c.__kMaxLength<<5,c.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],c.__kBitsPerCharTableShift=5,c.__kBitsPerCharTableMultiplier=1<a)throw new Error(s);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(s);if(u.find(t=>!n.includes(t)))throw new Error(s)}function u(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function _(t,e){if(u(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function l(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function f(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(s(r,t,["code_hash","hash_type","args"],[]),_(r+".code_hash",t.code_hash),u(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function h(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){s(r,t,["tx_hash","index"],[]),_(r+".tx_hash",t.tx_hash),l(r+".index",t.index)}function c(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){s(r,t,["since","previous_output"],[]),l(r+".since",t.since),e&&h(t.previous_output,{debugPath:r+".previous_output"})}function g(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){s(r,t,["capacity","lock"],["type"]),l(r+".capacity",t.capacity),e&&(f(t.lock,{debugPath:r+".lock"}),t.type&&f(t.type,{debugPath:r+".type"}))}function d(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(s(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&h(t.out_point,{debugPath:r+".out_point"})}function p(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n-1};function _(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];w.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function D(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}D.polyfill=!0,t.fetch||(t.fetch=D,t.Headers=h,t.Request=b,t.Response=w),e.Headers=h,e.Request=b,e.Response=w,e.fetch=D}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}));function x(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const O={get:(t,e,r)=>"send"===e?async()=>{const e=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},C={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},O):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class I{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,C)}static create(t){return new I(t)}}function j(t){return a.BigInt(t)}function R(t){return"0x"+t.toString(16)}function z(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=R(a.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function N(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function L(t,{debugPath:e="script"}={}){return N(e,t,{code_hash:M(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:M(-1)})}function U(t,{debugPath:e="out_point"}={}){return N(e,t,{tx_hash:M(32),index:z(4)})}function V(t){return function(e,r){return t(r,{debugPath:e})}}function q(t,{debugPath:e="cell_input"}={}){return N(e,t,{since:z(8),previous_output:V(U)})}function $(t,{debugPath:e="cell_output"}={}){const r=N(e,t,{capacity:z(8),lock:V(L)});return t.type&&(r.type_=L(t.type,{debugPath:e+".type"})),r}function F(t,{debugPath:e="cell_dep"}={}){return N(e,t,{out_point:V(U),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function H(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function G(t,{debugPath:e="raw_transaction"}={}){return N(e,t,{version:z(4),cell_deps:H(V(F)),header_deps:H(M(32)),inputs:H(V(q)),outputs:H(V($)),outputs_data:H(M(-1))})}function W(t,{debugPath:e="transaction"}={}){const r=G(t,{debugPath:"(raw)"+e}),n=N(e,t,{witnesses:H(M(-1))});return n.raw=r,n}function J(t,{debugPath:e="raw_header"}={}){return N(e,t,{version:z(4),compact_target:z(4),timestamp:z(8),number:z(8),epoch:z(8),parent_hash:M(32),transactions_root:M(32),proposals_hash:M(32),uncles_hash:M(32),dao:M(32)})}function X(t,{debugPath:e="header"}={}){const r=J(t,{debugPath:"(raw)"+e}),n=N(e,t,{nonce:z(16)});return n.raw=r,n}function Q(t,{debugPath:e="uncle_block"}={}){return N(e,t,{header:V(X),proposals:H(M(10))})}var K=Object.freeze({__proto__:null,NormalizeScript:L,NormalizeOutPoint:U,NormalizeCellInput:q,NormalizeCellOutput:$,NormalizeCellDep:F,NormalizeRawTransaction:G,NormalizeTransaction:W,NormalizeRawHeader:J,NormalizeHeader:X,NormalizeUncleBlock:Q,NormalizeBlock:function(t,{debugPath:e="block"}={}){return N(e,t,{header:V(X),uncles:H(V(Q)),transactions:H(V(W)),proposals:H(M(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return N(e,t,{lock:V(L),message:M(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=M(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=M(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=M(-1)(e+".output_type",t.output_type)),r}});function Y(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Z(t,e,r){if(!((e=Y(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function tt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Z(r,t,{code_hash:Y,hash_type:Y,args:Y}),e&&f(t,{debugPath:"(transformed) "+r}),t}function et(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Z(r,t,{tx_hash:Y,index:Y}),e&&h(t,{debugPath:"(transformed) "+r}),t}function rt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function nt(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Z(r,t,{since:Y,previous_output:rt(et)}),e&&c(t,{debugPath:"(transformed) "+r}),t}function it(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Z(r,t,{capacity:Y,lock:rt(tt),type:rt(tt)}),e&&g(t,{debugPath:"(transformed) "+r}),t}function ot(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Z(r,t,{out_point:rt(et),dep_type:Y}),e&&d(t,{debugPath:"(transformed) "+r}),t}function at(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function st(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y),witnesses:at(Y)}),e&&m(t,{debugPath:"(transformed) "+r}),t}function ut(t,{validation:e=!0,debugPath:r="header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y,nonce:Y}),e&&k(t,{debugPath:"(transformed) "+r}),t}function _t(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Z(r,t,{header:rt(ut),proposals:at(Y)}),e&&B(t,{debugPath:"(transformed) "+r}),t}var lt=Object.freeze({__proto__:null,TransformScript:tt,TransformOutPoint:et,TransformCellInput:nt,TransformCellOutput:it,TransformCellDep:ot,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y)}),e&&b(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:st,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,uncles_hash:Y,dao:Y}),e&&w(t,{debugPath:"(transformed) "+r}),t},TransformHeader:ut,TransformUncleBlock:_t,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Z(r,t,{header:rt(ut),uncles:at(rt(_t)),transactions:at(rt(st)),proposals:at(Y)}),e&&P(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Z(r,t,{lock:rt(tt),message:Y}),e&&T(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Z(r,t,{lock:Y,input_type:Y,output_type:Y}),e&&A(t,{debugPath:"(transformed) "+r}),t}});var ft=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:r=!0,loadData:i=!1,loadBlockNumber:o=!0}={}){this.rpc=t,this.lockHash=new n(e).serializeJson(),this.skipCellWithContent=r,this.loadData=i,this.loadBlockNumber=o}async*collect(){const t=j(await this.rpc.get_tip_block_number());let e=a.BigInt(0);for(;a.lessThanOrEqual(e,t);){let r=a.add(e,a.BigInt(100));a.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,R(e),R(r));for(const t of n){if(this.skipCellWithContent&&(t.type||a.greaterThan(j(t.output_data_len),a.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=a.add(r,a.BigInt(1))}}}});t.BigIntToHexString=R,t.HexStringToBigInt=j,t.RPC=I,t.Reader=n,t.TransactionDumper=class{constructor(t,{validateTransaction:e=!0,depGroupUnpacker:r=null}={}){this.rpc=t,this.validateTransaction=e,this.depGroupUnpacker=r}async dumpByHash(t){const e=(await this.rpc.get_transaction(t)).transaction;return delete e.hash,await this.dump(e)}async dump(t){this.validateTransaction&&m(t);const e=[];for(const r of t.inputs){const{output:t,data:n,header:i}=await this._resolveOutPoint(r.previous_output);e.push({input:r,output:t,data:n,header:i})}const r=[];for(const e of t.cell_deps){const{output:t,data:i,header:o}=await this._resolveOutPoint(e.out_point);if(r.push({cell_dep:e,output:t,data:i,header:o}),"dep_group"===e.dep_type){if(!this.depGroupUnpacker)throw new Error("depGroupUnpacker must be provided when the transaction contains dep_group!");const t=this.depGroupUnpacker(new n(i));for(const e of t){h(e);const{output:t,data:n,header:i}=await this._resolveOutPoint(e);r.push({cell_dep:{out_point:e,dep_type:"code"},output:t,data:n,header:i})}}}const i=[];for(const e of t.header_deps)i.push(await this.rpc.get_header(e));return JSON.stringify({mock_info:{inputs:e,cell_deps:r,header_deps:i},tx:t})}async _resolveOutPoint(t){const e=await this.rpc.get_transaction(t.tx_hash);if(!e||!e.transaction)throw new Error(`Transaction ${t.tx_hash} cannot be found!`);const r=e.transaction,n=a.toNumber(a.BigInt(t.index));if(n>=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}},t.VERSION="0.10.2",t.cell_collectors=ft,t.normalizers=K,t.transformers=lt,t.validators=E,Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CKBJSToolkit={})}(this,(function(t){"use strict";class e{constructor(t){this.view=new DataView(t)}length(){return this.view.byteLength}indexAt(t){return this.view.getUint8(t)}toArrayBuffer(){return this.view.buffer}serializeJson(){return"0x"+Array.prototype.map.call(new Uint8Array(this.view.buffer),t=>("00"+t.toString(16)).slice(-2)).join("")}}class r{constructor(t){this.string=t}length(){return this.string.length/2-1}indexAt(t){return parseInt(this.string.substr(2+2*t,2),16)}toArrayBuffer(){const t=new ArrayBuffer(this.length()),e=new DataView(t);for(let t=0;t255)throw new Error("fromRawString can only accept UTF-8 raw string!");n.setUint8(e,r)}return new e(r)}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var a=o((function(t,e){t.exports=function(){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r,n=0;nl.__kMaxLength)throw new RangeError("Maximum BigInt size exceeded");return(n=h(this,o(l).call(this,t))).sign=r,n}return i(l,r),n(l,[{key:"toDebugString",value:function(){var t=["BigInt["],e=!0,r=!1,n=void 0;try{for(var i,o,a=this[Symbol.iterator]();!(e=(i=a.next()).done);e=!0)o=i.value,t.push((o?(o>>>0).toString(16):o)+", ")}catch(t){r=!0,n=t}finally{try{e||null==a.return||a.return()}finally{if(r)throw n}}return t.push("]"),t.join("")}},{key:"toString",value:function(){var t=0t||36this.length&&(r=this.length);for(var n=65535&t,i=t>>>16,o=0,a=65535&e,s=e>>>16,_=0;_>>16,c=u(f,n),g=u(f,i),d=u(h,n),p=u(h,i),v=a+(65535&c),y=s+o+(v>>>16)+(c>>>16)+(65535&g)+(65535&d);o=(a=(g>>>16)+(d>>>16)+(65535&p)+(y>>>16))>>>16,a&=65535,s=p>>>16,this.__setDigit(_,65535&v|y<<16)}if(0!==o||0!==a||0!==s)throw new Error("implementation bug")}},{key:"__inplaceAdd",value:function(t,e,r){for(var n,i=0,o=0;o>>16,this.__setHalfDigit(e+o,n);return i}},{key:"__inplaceSub",value:function(t,e,r){var n=0;if(1&e){e>>=1;for(var i=this.__digit(e),o=65535&i,a=0;a>>1;a++){var s=t.__digit(a),u=(i>>>16)-(65535&s)-n;n=1&u>>>16,this.__setDigit(e+a,u<<16|65535&o),n=1&(o=(65535&(i=this.__digit(e+a+1)))-(s>>>16)-n)>>>16}var _=t.__digit(a),l=(i>>>16)-(65535&_)-n;if(n=1&l>>>16,this.__setDigit(e+a,l<<16|65535&o),e+a+1>=this.length)throw new RangeError("out of bounds");0==(1&r)&&(n=1&(o=(65535&(i=this.__digit(e+a+1)))-(_>>>16)-n)>>>16,this.__setDigit(e+t.length,4294901760&i|65535&o))}else{e>>=1;for(var f=0;f>>16)-(c>>>16)-(n=1&g>>>16);n=1&d>>>16,this.__setDigit(e+f,d<<16|65535&g)}var p=this.__digit(e+f),v=t.__digit(f),y=(65535&p)-(65535&v)-n;n=1&y>>>16;var b=0;0==(1&r)&&(n=1&(b=(p>>>16)-(v>>>16)-n)>>>16),this.__setDigit(e+f,b<<16|65535&y)}return n}},{key:"__inplaceRightShift",value:function(t){if(0!==t){for(var e,r=this.__digit(0)>>>t,n=this.length-1,i=0;i>>t;this.__setDigit(n,r)}}},{key:"__digit",value:function(t){return this[t]}},{key:"__unsignedDigit",value:function(t){return this[t]>>>0}},{key:"__setDigit",value:function(t,e){this[t]=0|e}},{key:"__setDigitGrow",value:function(t,e){this[t]=0|e}},{key:"__halfDigitLength",value:function(){var t=this.length;return 65535>=this.__unsignedDigit(t-1)?2*t-1:2*t}},{key:"__halfDigit",value:function(t){return 65535&this[t>>>1]>>>((1&t)<<4)}},{key:"__setHalfDigit",value:function(t,e){var r=t>>>1,n=this.__digit(r),i=1&t?65535&n|e<<16:4294901760&n|65535&e;this.__setDigit(r,i)}}],[{key:"BigInt",value:function(e){var r=Math.floor,n=Number.isFinite;if("number"==typeof e){if(0===e)return l.__zero();if((0|e)===e)return 0>e?l.__oneDigit(-e,!0):l.__oneDigit(e,!1);if(!n(e)||r(e)!==e)throw new RangeError("The number "+e+" cannot be converted to BigInt because it is not an integer");return l.__fromDouble(e)}if("string"==typeof e){var i=l.__fromString(e);if(null===i)throw new SyntaxError("Cannot convert "+e+" to a BigInt");return i}if("boolean"==typeof e)return!0===e?l.__oneDigit(1,!1):l.__zero();if("object"===t(e)){if(e.constructor===l)return e;var o=l.__toPrimitive(e);return l.BigInt(o)}throw new TypeError("Cannot convert "+e+" to a BigInt")}},{key:"toNumber",value:function(t){var e=t.length;if(0===e)return 0;if(1===e){var r=t.__unsignedDigit(0);return t.sign?-r:r}var n=t.__digit(e-1),i=_(n),o=32*e-i;if(1024>>=12;var c=f-12,g=12<=f?0:s<<20+f,d=20+f;0>>32-c,g=s<>>32-d,d-=32);var p=l.__decideRounding(t,d,u,s);if((1===p||0===p&&1==(1&g))&&0==(g=g+1>>>0)&&0!=++h>>>20&&(h=0,1023<++a))return t.sign?-1/0:1/0;var v=t.sign?-2147483648:0;return a=a+1023<<20,l.__kBitConversionInts[1]=v|a|h,l.__kBitConversionInts[0]=g,l.__kBitConversionDouble[0]}},{key:"unaryMinus",value:function(t){if(0===t.length)return t;var e=t.__copy();return e.sign=!t.sign,e}},{key:"bitwiseNot",value:function(t){return t.sign?l.__absoluteSubOne(t).__trim():l.__absoluteAddOne(t,!0)}},{key:"exponentiate",value:function(t,e){if(e.sign)throw new RangeError("Exponent must be positive");if(0===e.length)return l.__oneDigit(1,!1);if(0===t.length)return t;if(1===t.length&&1===t.__digit(0))return t.sign&&0==(1&e.__digit(0))?l.unaryMinus(t):t;if(1=l.__kMaxLengthBits)throw new RangeError("BigInt too big");if(1===t.length&&2===t.__digit(0)){var n=1+(r>>>5),i=new l(n,t.sign&&0!=(1&r));i.__initializeDigits();var o=1<<(31&r);return i.__setDigit(n-1,o),i}var a=null,s=t;for(0!=(1&r)&&(a=t),r>>=1;0!==r;r>>=1)s=l.multiply(s,s),0!=(1&r)&&(a=null===a?s:l.multiply(a,s));return a}},{key:"multiply",value:function(t,e){if(0===t.length)return t;if(0===e.length)return e;var r=t.length+e.length;32<=t.__clzmsd()+e.__clzmsd()&&r--;var n=new l(r,t.sign!==e.sign);n.__initializeDigits();for(var i=0;il.__absoluteCompare(t,e))return l.__zero();var r,n=t.sign!==e.sign,i=e.__unsignedDigit(0);if(1===e.length&&65535>=i){if(1===i)return n===t.sign?t:l.unaryMinus(t);r=l.__absoluteDivSmall(t,i,null)}else r=l.__absoluteDivLarge(t,e,!0,!1);return r.sign=n,r.__trim()}},{key:"remainder",value:function(t,e){if(0===e.length)throw new RangeError("Division by zero");if(0>l.__absoluteCompare(t,e))return t;var r=e.__unsignedDigit(0);if(1===e.length&&65535>=r){if(1===r)return l.__zero();var n=l.__absoluteModSmall(t,r);return 0===n?l.__zero():l.__oneDigit(n,t.sign)}var i=l.__absoluteDivLarge(t,e,!1,!0);return i.sign=t.sign,i.__trim()}},{key:"add",value:function(t,e){var r=t.sign;return r===e.sign?l.__absoluteAdd(t,e,r):0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r)}},{key:"subtract",value:function(t,e){var r=t.sign;return r===e.sign?0<=l.__absoluteCompare(t,e)?l.__absoluteSub(t,e,r):l.__absoluteSub(e,t,!r):l.__absoluteAdd(t,e,r)}},{key:"leftShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__rightShiftByAbsolute(t,e):l.__leftShiftByAbsolute(t,e)}},{key:"signedRightShift",value:function(t,e){return 0===e.length||0===t.length?t:e.sign?l.__leftShiftByAbsolute(t,e):l.__rightShiftByAbsolute(t,e)}},{key:"unsignedRightShift",value:function(){throw new TypeError("BigInts have no unsigned right shift; use >> instead")}},{key:"lessThan",value:function(t,e){return 0>l.__compareToBigInt(t,e)}},{key:"lessThanOrEqual",value:function(t,e){return 0>=l.__compareToBigInt(t,e)}},{key:"greaterThan",value:function(t,e){return 0=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.lengthl.__kMaxLengthBits)throw new RangeError("BigInt too big");return l.__truncateAndSubFromPowerOfTwo(t,e,!1)}if(t>=l.__kMaxLengthBits)return e;var r=t+31>>>5;if(e.length>>n)return e}return l.__truncateToNBits(t,e)}},{key:"ADD",value:function(t,e){if(t=l.__toPrimitive(t),e=l.__toPrimitive(e),"string"==typeof t)return"string"!=typeof e&&(e=e.toString()),t+e;if("string"==typeof e)return t.toString()+e;if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)&&l.__isBigInt(e))return l.add(t,e);if("number"==typeof t&&"number"==typeof e)return t+e;throw new TypeError("Cannot mix BigInt and other types, use explicit conversions")}},{key:"LT",value:function(t,e){return l.__compare(t,e,0)}},{key:"LE",value:function(t,e){return l.__compare(t,e,1)}},{key:"GT",value:function(t,e){return l.__compare(t,e,2)}},{key:"GE",value:function(t,e){return l.__compare(t,e,3)}},{key:"EQ",value:function(e,r){for(;;){if(l.__isBigInt(e))return l.__isBigInt(r)?l.equal(e,r):l.EQ(r,e);if("number"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("string"==typeof e){if(l.__isBigInt(r))return null!==(e=l.__fromString(e))&&l.equal(e,r);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("boolean"==typeof e){if(l.__isBigInt(r))return l.__equalToNumber(r,+e);if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else if("symbol"===t(e)){if(l.__isBigInt(r))return!1;if("object"!==t(r))return e==r;r=l.__toPrimitive(r)}else{if("object"!==t(e))return e==r;if("object"===t(r)&&r.constructor!==l)return e==r;e=l.__toPrimitive(e)}}}},{key:"NE",value:function(t,e){return!l.EQ(t,e)}},{key:"__zero",value:function(){return new l(0,!1)}},{key:"__oneDigit",value:function(t,e){var r=new l(1,e);return r.__setDigit(0,t),r}},{key:"__decideRounding",value:function(t,e,r,n){if(0e)i=-e-1;else{if(0===r)return-1;r--,n=t.__digit(r),i=31}var o=1<>>20)-1023,n=1+(r>>>5),i=new l(n,0>t),o=1048575&l.__kBitConversionInts[1]|1048576,a=l.__kBitConversionInts[0],s=20,u=31&r,_=0;if(u>>f,o=o<<32-f|a>>>f,a<<=32-f}else if(u===s)_=32,e=o,o=a;else{var h=u-s;_=32-h,e=o<>>32-h,o=a<=t&&9<=t)||(159>=t?32==t:131071>=t?160==t||5760==t:196607>=t?10>=(t&=131071)||40==t||41==t||47==t||95==t||4096==t:65279==t)}},{key:"__fromString",value:function(t){var e=11073741824/s)return null;var _=new l(31+(s*a+u>>>l.__kBitsPerCharTableShift)>>>5,!1),f=10>e?e:10,h=10>=l.__kBitsPerCharTableShift;var c=[],g=[],d=!1;do{for(var p,v=0,y=0;;){if(p=void 0,o-48>>>0>>0>>0>>0>>l.__kBitsPerCharTableShift+5;_.__inplaceMultiplyAdd(D,k,P)}while(!b)}if(i!==n){if(!l.__isWhitespace(o))return null;for(i++;i>>u-(o-=32))}if(0!==i){if(n>=t.length)throw new Error("implementation bug");t.__setDigit(n++,i)}for(;n>>1)+(85&n))>>>2)+(51&n))>>>4)+(15&n),o=e-1,a=t.__digit(r-1),s=0|(32*r-_(a)+i-1)/i;if(t.sign&&s++,268435456>>v,c=32-v;c>=i;)u[f--]=l.__kConversionChars[h&o],h>>>=i,c-=i}var y=(h|a<>>i-c;0!==h;)u[f--]=l.__kConversionChars[h&o],h>>>=i;if(t.sign&&(u[f--]="-"),-1!==f)throw new Error("implementation bug");return u.join("")}},{key:"__toStringGeneric",value:function(t,e,r){var n=t.length;if(0===n)return"";if(1===n){var i=t.__unsignedDigit(0).toString(e);return!1===r&&t.sign&&(i="-"+i),i}var o,a,s=32*n-_(t.__digit(n-1)),u=l.__kMaxBitsPerChar[e]-1,f=s*l.__kBitsPerCharTableMultiplier,h=1+(f=0|(f+=u-1)/u)>>1,c=l.exponentiate(l.__oneDigit(e,!1),l.__oneDigit(h,!1)),g=c.__unsignedDigit(0);if(1===c.length&&65535>=g){(o=new l(t.length,!1)).__initializeDigits();for(var d,p=0,v=2*t.length-1;0<=v;v--)d=p<<16|t.__halfDigit(v),o.__setHalfDigit(v,0|d/g),p=0|d%g;a=p.toString(e)}else{var y=l.__absoluteDivLarge(t,c,!0,!0);o=y.quotient;var b=y.remainder.__trim();a=l.__toStringGeneric(b,e,!0)}o.__trim();for(var m=l.__toStringGeneric(o,e,!0);a.lengthn?l.__absoluteLess(r):0}},{key:"__compareToNumber",value:function(t,e){if(!0|e){var r=t.sign,n=0>e;if(r!==n)return l.__unequalSign(r);if(0===t.length){if(n)throw new Error("implementation bug");return 0===e?0:-1}if(1i?l.__absoluteGreater(r):oe)return l.__unequalSign(r);if(0===e)throw new Error("implementation bug: should be handled elsewhere");if(0===t.length)return-1;l.__kBitConversionDouble[0]=e;var n=2047&l.__kBitConversionInts[1]>>>20;if(2047==n)throw new Error("implementation bug: handled elsewhere");var i=n-1023;if(0>i)return l.__absoluteGreater(r);var o=t.length,a=t.__digit(o-1),s=_(a),u=32*o-s,f=i+1;if(uf)return l.__absoluteGreater(r);var h=1048576|1048575&l.__kBitConversionInts[1],c=l.__kBitConversionInts[0],g=20,d=31-s;if(d!==(u-1)%31)throw new Error("implementation bug");var p,v=0;if(d>>y,h=h<<32-y|c>>>y,c<<=32-y}else if(d===g)v=32,p=h,h=c;else{var b=d-g;v=32-b,p=h<>>32-b,h=c<>>=0)>(p>>>=0))return l.__absoluteGreater(r);if(a>>0,h=c,c=0):p=0;var w=t.__unsignedDigit(m);if(w>p)return l.__absoluteGreater(r);if(we&&t.__unsignedDigit(0)===a(e):0===l.__compareToDouble(t,e)}},{key:"__comparisonResultToBool",value:function(t,e){switch(e){case 0:return 0>t;case 1:return 0>=t;case 2:return 0e;case 3:return t>=e}if(l.__isBigInt(t)&&"string"==typeof e)return null!==(e=l.__fromString(e))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("string"==typeof t&&l.__isBigInt(e))return null!==(t=l.__fromString(t))&&l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if(t=l.__toNumeric(t),e=l.__toNumeric(e),l.__isBigInt(t)){if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToBigInt(t,e),r);if("number"!=typeof e)throw new Error("implementation bug");return l.__comparisonResultToBool(l.__compareToNumber(t,e),r)}if("number"!=typeof t)throw new Error("implementation bug");if(l.__isBigInt(e))return l.__comparisonResultToBool(l.__compareToNumber(e,t),2^r);if("number"!=typeof e)throw new Error("implementation bug");return 0===r?te:3===r?t>=e:void 0}},{key:"__absoluteAdd",value:function(t,e,r){if(t.length>>16)+(s>>>16)+(_>>>16);o=f>>>16,i.__setDigit(a,65535&_|f<<16)}for(;a>>16)+(c>>>16);o=g>>>16,i.__setDigit(a,65535&c|g<<16)}return a>>16)-(s>>>16)-(i=1&u>>>16);i=1&_>>>16,n.__setDigit(o,65535&u|_<<16)}for(;o>>16)-(i=1&h>>>16);i=1&c>>>16,n.__setDigit(o,65535&h|c<<16)}return n.__trim()}},{key:"__absoluteAddOne",value:function(t,e){var r=2n?0:t.__unsignedDigit(n)>e.__unsignedDigit(n)?1:-1}},{key:"__multiplyAccumulate",value:function(t,e,r,n){if(0!==e){for(var i=65535&e,o=e>>>16,a=0,s=0,_=0,l=0;l>>16,g=t.__digit(l),d=65535&g,p=g>>>16,v=u(d,i),y=u(d,o),b=u(p,i),m=u(p,o);a=(s=(y>>>16)+(b>>>16)+(65535&m)+(a=(c+=_+a+((h+=s+(65535&v))>>>16)+(v>>>16)+(65535&y)+(65535&b))>>>16))>>>16,s&=65535,_=m>>>16,f=65535&h|c<<16,r.__setDigit(n,f)}for(;0!==a||0!==s||0!==_;n++){var w=r.__digit(n),k=(65535&w)+s,D=(w>>>16)+(k>>>16)+_+a;s=0,_=0,a=D>>>16,w=65535&k|D<<16,r.__setDigit(n,w)}}}},{key:"__internalMultiplyAdd",value:function(t,e,r,n,i){for(var o=r,a=0,s=0;s>>16;var h=u(_>>>16,e),c=(65535&h)+(l>>>16)+o;o=c>>>16,a=h>>>16,i.__setDigit(s,c<<16|65535&f)}if(i.length>n)for(i.__setDigit(n++,o+a);n>>0,a=0|o/e,s=0|(o=((n=0|o%e)<<16|t.__halfDigit(i-1))>>>0)/e;n=0|o%e,r.__setDigit(i>>>1,a<<16|s)}return r}},{key:"__absoluteModSmall",value:function(t,e){for(var r=0,n=2*t.length-1;0<=n;n--)r=0|((r<<16|t.__halfDigit(n))>>>0)%e;return r}},{key:"__absoluteDivLarge",value:function(t,e,r,n){var i=e.__halfDigitLength(),o=e.length,a=t.__halfDigitLength()-i,s=null;r&&(s=new l(a+2>>>1,!1)).__initializeDigits();var _=new l(i+2>>>1,!1);_.__initializeDigits();var f=l.__clz16(e.__halfDigit(i-1));0>>0;p=0|y/c;for(var b=0|y%c,m=e.__halfDigit(i-2),w=h.__halfDigit(d+i-2);u(p,m)>>>0>(b<<16|w)>>>0&&(p--,!(65535<(b+=c))););}l.__internalMultiplyAdd(e,p,0,o,_);var k=h.__inplaceSub(_,d,i+1);0!==k&&(k=h.__inplaceAdd(e,d,i),h.__setHalfDigit(d+i,h.__halfDigit(d+i)+k),p--),r&&(1&d?g=p<<16:s.__setDigit(d>>>1,g|p))}return n?(h.__inplaceRightShift(f),r?{quotient:s,remainder:h}:h):r?s:void 0}},{key:"__clz16",value:function(t){return _(t)-16}},{key:"__specialLeftShift",value:function(t,e,r){var n=t.length,i=new l(n+r,!1);if(0===e){for(var o=0;o>>32-e;return 0r)throw new RangeError("BigInt too big");var n=r>>>5,i=31&r,o=t.length,a=0!==i&&0!=t.__digit(o-1)>>>32-i,s=o+n+(a?1:0),u=new l(s,t.sign);if(0===i){for(var _=0;_>>32-i;if(a)u.__setDigit(o+n,f);else if(0!==f)throw new Error("implementation bug")}return u.__trim()}},{key:"__rightShiftByAbsolute",value:function(t,e){var r=t.length,n=t.sign,i=l.__toShiftAmount(e);if(0>i)return l.__rightShiftByMaximum(n);var o=i>>>5,a=31&i,s=r-o;if(0>=s)return l.__rightShiftByMaximum(n);var u=!1;if(n)if(0!=(t.__digit(o)&(1<>>a,d=r-o-1,p=0;p>>a;f.__setDigit(d,g)}return u&&(f=l.__absoluteAddOne(f,!0,f)),f.__trim()}},{key:"__rightShiftByMaximum",value:function(t){return t?l.__oneDigit(1,!0):l.__zero()}},{key:"__toShiftAmount",value:function(t){if(1l.__kMaxLengthBits?-1:e}},{key:"__toPrimitive",value:function(e){var r=1>>5,n=new l(r,e.sign),i=r-1,o=0;o>>s}return n.__setDigit(i,a),n.__trim()}},{key:"__truncateAndSubFromPowerOfTwo",value:function(t,e,r){for(var n=Math.min,i=t+31>>>5,o=new l(i,r),a=0,s=i-1,u=0,_=n(s,e.length);a<_;a++){var f=e.__digit(a),h=0-(65535&f)-u,c=0-(f>>>16)-(u=1&h>>>16);u=1&c>>>16,o.__setDigit(a,65535&h|c<<16)}for(;a>>16)-(u=1&v>>>16)<<16}else{var y=32-p,b=1<<32-y,m=(65535&b)-(65535&(d=d<>>y))-u;g=65535&m|(b>>>16)-(d>>>16)-(u=1&m>>>16)<<16,g&=b-1}return o.__setDigit(s,g),o.__trim()}},{key:"__digitPow",value:function(t,e){for(var r=1;0>>=1,t*=t;return r}}]),l}(l(Array));return c.__kMaxLength=33554432,c.__kMaxLengthBits=c.__kMaxLength<<5,c.__kMaxBitsPerChar=[0,0,32,51,64,75,83,90,96,102,107,111,115,119,122,126,128,131,134,136,139,141,143,145,147,149,151,153,154,156,158,159,160,162,163,165,166],c.__kBitsPerCharTableShift=5,c.__kBitsPerCharTableMultiplier=1<a)throw new Error(s);let u=i.filter(t=>!r.includes(t));if(i.length-u.length!==o)throw new Error(s);if(u.find(t=>!n.includes(t)))throw new Error(s)}function u(t,e){if(!/^0x([0-9a-fA-F][0-9a-fA-F])*$/.test(e))throw new Error(t+" must be a hex string!")}function _(t,e){if(u(t,e),66!==e.length)throw new Error(t+" must be a hex string of 66 bytes long!")}function l(t,e){if("0x0"!==e&&!/^0x[1-9a-fA-F][0-9a-fA-F]*$/.test(e))throw new Error(t+" must be a hex integer!")}function f(t,{nestedValidation:e=!0,debugPath:r="script"}={}){if(s(r,t,["code_hash","hash_type","args"],[]),_(r+".code_hash",t.code_hash),u(r+".args",t.args),"data"!==t.hash_type&&"type"!==t.hash_type&&"data1"!==t.hash_type)throw new Error(r+".hash_type must be either data or type!")}function h(t,{nestedValidation:e=!0,debugPath:r="out_point"}={}){s(r,t,["tx_hash","index"],[]),_(r+".tx_hash",t.tx_hash),l(r+".index",t.index)}function c(t,{nestedValidation:e=!0,debugPath:r="cell_input"}={}){s(r,t,["since","previous_output"],[]),l(r+".since",t.since),e&&h(t.previous_output,{debugPath:r+".previous_output"})}function g(t,{nestedValidation:e=!0,debugPath:r="cell_output"}={}){s(r,t,["capacity","lock"],["type"]),l(r+".capacity",t.capacity),e&&(f(t.lock,{debugPath:r+".lock"}),t.type&&f(t.type,{debugPath:r+".type"}))}function d(t,{nestedValidation:e=!0,debugPath:r="cell_dep"}={}){if(s(r,t,["out_point","dep_type"],[]),"code"!==t.dep_type&&"dep_group"!==t.dep_type)throw new Error(r+".dep_type must be either code or dep_group!");e&&h(t.out_point,{debugPath:r+".out_point"})}function p(t,e,r,n){if(!Array.isArray(e))throw new Error(t+" is not an array!");if(n)for(let n=0;n-1};function _(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function f(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function h(t){this.map={},t instanceof h?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function g(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=g(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():a&&i&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,r,n=c(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=g(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function m(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new h(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},v.call(b.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];w.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function D(t,r){return new Promise((function(n,o){var a=new b(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();e.append(n,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",u)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}D.polyfill=!0,t.fetch||(t.fetch=D,t.Headers=h,t.Request=b,t.Response=w),e.Headers=h,e.Request=b,e.Response=w,e.fetch=D}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}));function x(t,e){e=e||{};const r=Object.assign({},e.headers||{},t.headers||{});return Object.assign({},e,t,{headers:r})}const O={get:(t,e,r)=>"send"===e?async()=>{const e=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(t.payload)},t.defaultOptions));return await e.json()}:(...n)=>{const i=t.id;return t.id=t.id+1,t.payload.push({jsonrpc:"2.0",id:i,method:e,params:n}),r}},C={get:(t,e)=>"batch"===e?()=>new Proxy({id:Math.round(1e7*Math.random()),payload:[],uri:t.uri,defaultOptions:t.defaultOptions},O):async(...r)=>{const n=Math.round(1e7*Math.random()),i=await S(t.uri,x({method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:n,method:e,params:r})},t.defaultOptions)),o=await i.json();if(o.id!==n)throw new Error("JSONRPCError: response ID does not match request ID!");if(o.error)throw new Error("JSONRPCError: server error "+JSON.stringify(o.error));return o.result}};class I{constructor(t,e={}){return this.uri=t,this.defaultOptions=e,new Proxy(this,C)}static create(t){return new I(t)}}function j(t){return a.BigInt(t)}function R(t){return"0x"+t.toString(16)}function z(t){return function(e,r){if(!(r instanceof ArrayBuffer)){let n=R(a.BigInt(r)).substr(2);if(n.length%2!=0&&(n="0"+n),n.length/2>t)throw new Error(`${e} is ${n.length/2} bytes long, expected length is ${t}!`);const i=new DataView(new ArrayBuffer(t));for(let t=0;t0&&r.byteLength!==t)throw new Error(`${e} has invalid length ${r.byteLength}, required: ${t}`);return r}}function N(t,e,r){const n={};for(const[i,o]of Object.entries(r)){const r=e[i];if(!r)throw new Error(`${t} is missing ${i}!`);n[i]=o(`${t}.${i}`,r)}return n}function L(t,{debugPath:e="script"}={}){return N(e,t,{code_hash:M(32),hash_type:function(t,e){switch(e){case"data":return 0;case"type":return 1;case"data1":return 2;case 0:case 1:case 2:return e;default:throw new Error(`${t}.hash_type has invalid value: ${e}`)}},args:M(-1)})}function U(t,{debugPath:e="out_point"}={}){return N(e,t,{tx_hash:M(32),index:z(4)})}function V(t){return function(e,r){return t(r,{debugPath:e})}}function q(t,{debugPath:e="cell_input"}={}){return N(e,t,{since:z(8),previous_output:V(U)})}function $(t,{debugPath:e="cell_output"}={}){const r=N(e,t,{capacity:z(8),lock:V(L)});return t.type&&(r.type_=L(t.type,{debugPath:e+".type"})),r}function F(t,{debugPath:e="cell_dep"}={}){return N(e,t,{out_point:V(U),dep_type:function(t,e){switch(e){case"code":return 0;case"dep_group":return 1;case 0:case 1:return e;default:throw new Error(`${t}.dep_type has invalid value: ${e}`)}}})}function H(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function G(t,{debugPath:e="raw_transaction"}={}){return N(e,t,{version:z(4),cell_deps:H(V(F)),header_deps:H(M(32)),inputs:H(V(q)),outputs:H(V($)),outputs_data:H(M(-1))})}function W(t,{debugPath:e="transaction"}={}){const r=G(t,{debugPath:"(raw)"+e}),n=N(e,t,{witnesses:H(M(-1))});return n.raw=r,n}function J(t,{debugPath:e="raw_header"}={}){return N(e,t,{version:z(4),compact_target:z(4),timestamp:z(8),number:z(8),epoch:z(8),parent_hash:M(32),transactions_root:M(32),proposals_hash:M(32),extra_hash:M(32),dao:M(32)})}function X(t,{debugPath:e="header"}={}){const r=J(t,{debugPath:"(raw)"+e}),n=N(e,t,{nonce:z(16)});return n.raw=r,n}function Q(t,{debugPath:e="uncle_block"}={}){return N(e,t,{header:V(X),proposals:H(M(10))})}var K=Object.freeze({__proto__:null,NormalizeScript:L,NormalizeOutPoint:U,NormalizeCellInput:q,NormalizeCellOutput:$,NormalizeCellDep:F,NormalizeRawTransaction:G,NormalizeTransaction:W,NormalizeRawHeader:J,NormalizeHeader:X,NormalizeUncleBlock:Q,NormalizeBlock:function(t,{debugPath:e="block"}={}){return N(e,t,{header:V(X),uncles:H(V(Q)),transactions:H(V(W)),proposals:H(M(10))})},NormalizeCellbaseWitness:function(t,{debugPath:e="cellbase_witness"}={}){return N(e,t,{lock:V(L),message:M(-1)})},NormalizeWitnessArgs:function(t,{debugPath:e="witness_args"}={}){const r={};return t.lock&&(r.lock=M(-1)(e+".lock",t.lock)),t.input_type&&(r.input_type=M(-1)(e+".input_type",t.input_type)),t.output_type&&(r.output_type=M(-1)(e+".output_type",t.output_type)),r}});function Y(t,e){return e instanceof Object&&e.serializeJson instanceof Function?e.serializeJson.call(e):e}function Z(t,e,r){if(!((e=Y(0,e))instanceof Object))throw new Error(`Transformed ${t} is not an object!`);const n={};for(const[i,o]of Object.entries(r)){let r=e[i];if(!r){r=e[i.replace(/(_[a-z])/g,t=>t.toUpperCase().replace("_",""))]}r&&(n[i]=o(`${t}.${i}`,r))}return n}function tt(t,{validation:e=!0,debugPath:r="script"}={}){return t=Z(r,t,{code_hash:Y,hash_type:Y,args:Y}),e&&f(t,{debugPath:"(transformed) "+r}),t}function et(t,{validation:e=!0,debugPath:r="out_point"}={}){return t=Z(r,t,{tx_hash:Y,index:Y}),e&&h(t,{debugPath:"(transformed) "+r}),t}function rt(t){return function(e,r){return t(r,{validation:!1,debugPath:e})}}function nt(t,{validation:e=!0,debugPath:r="cell_input"}={}){return t=Z(r,t,{since:Y,previous_output:rt(et)}),e&&c(t,{debugPath:"(transformed) "+r}),t}function it(t,{validation:e=!0,debugPath:r="cell_output"}={}){return t=Z(r,t,{capacity:Y,lock:rt(tt),type:rt(tt)}),e&&g(t,{debugPath:"(transformed) "+r}),t}function ot(t,{validation:e=!0,debugPath:r="cell_dep"}={}){return t=Z(r,t,{out_point:rt(et),dep_type:Y}),e&&d(t,{debugPath:"(transformed) "+r}),t}function at(t){return function(e,r){return r.map((r,n)=>t(`${e}[${n}]`,r))}}function st(t,{validation:e=!0,debugPath:r="transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y),witnesses:at(Y)}),e&&m(t,{debugPath:"(transformed) "+r}),t}function ut(t,{validation:e=!0,debugPath:r="header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,extra_hash:Y,dao:Y,nonce:Y}),e&&k(t,{debugPath:"(transformed) "+r}),t}function _t(t,{validation:e=!0,debugPath:r="uncle_block"}={}){return t=Z(r,t,{header:rt(ut),proposals:at(Y)}),e&&B(t,{debugPath:"(transformed) "+r}),t}var lt=Object.freeze({__proto__:null,TransformScript:tt,TransformOutPoint:et,TransformCellInput:nt,TransformCellOutput:it,TransformCellDep:ot,TransformRawTransaction:function(t,{validation:e=!0,debugPath:r="raw_transaction"}={}){return t=Z(r,t,{version:Y,cell_deps:at(rt(ot)),header_deps:at(Y),inputs:at(rt(nt)),outputs:at(rt(it)),outputs_data:at(Y)}),e&&b(t,{debugPath:"(transformed) "+r}),t},TransformTransaction:st,TransformRawHeader:function(t,{validation:e=!0,debugPath:r="raw_header"}={}){return t=Z(r,t,{version:Y,compact_target:Y,timestamp:Y,number:Y,epoch:Y,parent_hash:Y,transactions_root:Y,proposals_hash:Y,extra_hash:Y,dao:Y}),e&&w(t,{debugPath:"(transformed) "+r}),t},TransformHeader:ut,TransformUncleBlock:_t,TransformBlock:function(t,{validation:e=!0,debugPath:r="block"}={}){return t=Z(r,t,{header:rt(ut),uncles:at(rt(_t)),transactions:at(rt(st)),proposals:at(Y)}),e&&P(t,{debugPath:"(transformed) "+r}),t},TransformCellbaseWitness:function(t,{validation:e=!0,debugPath:r="cellbase_witness"}={}){return t=Z(r,t,{lock:rt(tt),message:Y}),e&&T(t,{debugPath:"(transformed) "+r}),t},TransformWitnessArgs:function(t,{validation:e=!0,debugPath:r="witness_args"}={}){return t=Z(r,t,{lock:Y,input_type:Y,output_type:Y}),e&&A(t,{debugPath:"(transformed) "+r}),t}});var ft=Object.freeze({__proto__:null,RPCCollector:class{constructor(t,e,{skipCellWithContent:r=!0,loadData:i=!1,loadBlockNumber:o=!0}={}){this.rpc=t,this.lockHash=new n(e).serializeJson(),this.skipCellWithContent=r,this.loadData=i,this.loadBlockNumber=o}async*collect(){const t=j(await this.rpc.get_tip_block_number());let e=a.BigInt(0);for(;a.lessThanOrEqual(e,t);){let r=a.add(e,a.BigInt(100));a.greaterThan(r,t)&&(r=t);const n=await this.rpc.get_cells_by_lock_hash(this.lockHash,R(e),R(r));for(const t of n){if(this.skipCellWithContent&&(t.type||a.greaterThan(j(t.output_data_len),a.BigInt(100))))continue;let e=null;if(this.loadData){e=(await this.rpc.get_live_cell(t.out_point,!0)).cell.data.content}let r=null;if(this.loadBlockNumber){r=(await this.rpc.get_header(t.block_hash)).number}yield{cellbase:t.cellbase,cell_output:{capacity:t.capacity,lock:t.lock,type:t.type},out_point:t.out_point,block_hash:t.block_hash,data:e,output_data_len:t.output_data_len,block_number:r}}e=a.add(r,a.BigInt(1))}}}});t.BigIntToHexString=R,t.HexStringToBigInt=j,t.RPC=I,t.Reader=n,t.TransactionDumper=class{constructor(t,{validateTransaction:e=!0,depGroupUnpacker:r=null}={}){this.rpc=t,this.validateTransaction=e,this.depGroupUnpacker=r}async dumpByHash(t){const e=(await this.rpc.get_transaction(t)).transaction;return delete e.hash,await this.dump(e)}async dump(t){this.validateTransaction&&m(t);const e=[];for(const r of t.inputs){const{output:t,data:n,header:i}=await this._resolveOutPoint(r.previous_output);e.push({input:r,output:t,data:n,header:i})}const r=[];for(const e of t.cell_deps){const{output:t,data:i,header:o}=await this._resolveOutPoint(e.out_point);if(r.push({cell_dep:e,output:t,data:i,header:o}),"dep_group"===e.dep_type){if(!this.depGroupUnpacker)throw new Error("depGroupUnpacker must be provided when the transaction contains dep_group!");const t=this.depGroupUnpacker(new n(i));for(const e of t){h(e);const{output:t,data:n,header:i}=await this._resolveOutPoint(e);r.push({cell_dep:{out_point:e,dep_type:"code"},output:t,data:n,header:i})}}}const i=[];for(const e of t.header_deps)i.push(await this.rpc.get_header(e));return JSON.stringify({mock_info:{inputs:e,cell_deps:r,header_deps:i},tx:t})}async _resolveOutPoint(t){const e=await this.rpc.get_transaction(t.tx_hash);if(!e||!e.transaction)throw new Error(`Transaction ${t.tx_hash} cannot be found!`);const r=e.transaction,n=a.toNumber(a.BigInt(t.index));if(n>=r.outputs.length)throw new Error(`Transaction ${t.tx_hash} does not have output ${n}!`);const i={output:r.outputs[n],data:r.outputs_data[n]};return"committed"===e.tx_status.status&&(i.header=e.tx_status.block_hash),i}},t.VERSION="0.10.2",t.cell_collectors=ft,t.normalizers=K,t.transformers=lt,t.validators=E,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/package.json b/package.json index 6ff824e..291fe87 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "dist": "rollup -c --environment BUILD:production", "test": "rollup -c --environment BUILD:development && ava", "fmt": "prettier --write \"{src,tests}/**/*.js\" index.d.ts", - "update-test-files": "curl -L https://raw.githubusercontent.com/nervosnetwork/ckb/27c36a55e6358fd04153ec3da4638b6e10660da6/util/types/schemas/blockchain.mol -o testfiles/blockchain.mol && moleculec --language - --schema-file testfiles/blockchain.mol --format json > testfiles/blockchain.json && moleculec-es -inputFile testfiles/blockchain.json -outputFile testfiles/blockchain.esm.js && rollup -f umd -i testfiles/blockchain.esm.js -o testfiles/blockchain.umd.js --name Blockchain && rm testfiles/blockchain.mol testfiles/blockchain.json testfiles/blockchain.esm.js" + "update-test-files": "curl -L https://raw.githubusercontent.com/nervosnetwork/ckb/5a7efe7a0b720de79ff3761dc6e8424b8d5b22ea/util/types/schemas/blockchain.mol -o testfiles/blockchain.mol && moleculec --language - --schema-file testfiles/blockchain.mol --format json > testfiles/blockchain.json && moleculec-es -inputFile testfiles/blockchain.json -outputFile testfiles/blockchain.esm.js && rollup -f umd -i testfiles/blockchain.esm.js -o testfiles/blockchain.umd.js --name Blockchain && rm testfiles/blockchain.mol testfiles/blockchain.json testfiles/blockchain.esm.js" }, "author": "Xuejie Xiao", "license": "MIT", diff --git a/src/normalizers.js b/src/normalizers.js index 5409b95..93e0472 100644 --- a/src/normalizers.js +++ b/src/normalizers.js @@ -203,7 +203,7 @@ export function NormalizeRawHeader( parent_hash: normalizeRawData(32), transactions_root: normalizeRawData(32), proposals_hash: normalizeRawData(32), - uncles_hash: normalizeRawData(32), + extra_hash: normalizeRawData(32), dao: normalizeRawData(32) }); } diff --git a/src/transformers.js b/src/transformers.js index ccab151..0748cef 100644 --- a/src/transformers.js +++ b/src/transformers.js @@ -207,7 +207,7 @@ export function TransformRawHeader( parent_hash: invokeSerializeJson, transactions_root: invokeSerializeJson, proposals_hash: invokeSerializeJson, - uncles_hash: invokeSerializeJson, + extra_hash: invokeSerializeJson, dao: invokeSerializeJson }); @@ -232,7 +232,7 @@ export function TransformHeader( parent_hash: invokeSerializeJson, transactions_root: invokeSerializeJson, proposals_hash: invokeSerializeJson, - uncles_hash: invokeSerializeJson, + extra_hash: invokeSerializeJson, dao: invokeSerializeJson, nonce: invokeSerializeJson }); diff --git a/src/validators.js b/src/validators.js index 976ab58..00b8794 100644 --- a/src/validators.js +++ b/src/validators.js @@ -252,7 +252,7 @@ function assertCommonHeader(debugPath, rawHeader) { assertHash(`${debugPath}.parent_hash`, rawHeader.parent_hash); assertHash(`${debugPath}.transactions_root`, rawHeader.transactions_root); assertHash(`${debugPath}.proposals_hash`, rawHeader.proposals_hash); - assertHash(`${debugPath}.uncles_hash`, rawHeader.uncles_hash); + assertHash(`${debugPath}.extra_hash`, rawHeader.extra_hash); assertHash(`${debugPath}.dao`, rawHeader.dao); } @@ -272,7 +272,7 @@ export function ValidateRawHeader( "parent_hash", "transactions_root", "proposals_hash", - "uncles_hash", + "extra_hash", "dao" ], [] @@ -296,7 +296,7 @@ export function ValidateHeader( "parent_hash", "transactions_root", "proposals_hash", - "uncles_hash", + "extra_hash", "dao", "nonce" ], diff --git a/testfiles/blockchain.umd.js b/testfiles/blockchain.umd.js index 5992167..d70b72c 100644 --- a/testfiles/blockchain.umd.js +++ b/testfiles/blockchain.umd.js @@ -1,7 +1,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.Blockchain = {})); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Blockchain = {})); }(this, (function (exports) { 'use strict'; function dataLengthError(actual, required) { @@ -84,6 +84,7 @@ } return buffer; } + class Uint32 { constructor(reader, { validate = true } = {}) { this.view = new DataView(assertArrayBuffer(reader)); @@ -143,14 +144,6 @@ return this.view.buffer; } - toBigEndianBigUint64() { - return this.view.getBigUint64(0, false); - } - - toLittleEndianBigUint64() { - return this.view.getUint64(0, true); - } - static size() { return 8; } @@ -751,15 +744,15 @@ } getTxHash() { - return new Byte32(this.view.buffer.slice(0, Byte32.size()), { validate: false }); + return new Byte32(this.view.buffer.slice(0, 0 + Byte32.size()), { validate: false }); } getIndex() { - return new Uint32(this.view.buffer.slice(0 + Byte32.size(), Uint32.size()), { validate: false }); + return new Uint32(this.view.buffer.slice(0 + Byte32.size(), 0 + Byte32.size() + Uint32.size()), { validate: false }); } validate(compatible = false) { - assertDataLength(this.view.byteLength, this.size()); + assertDataLength(this.view.byteLength, OutPoint.size()); this.getTxHash().validate(compatible); this.getIndex().validate(compatible); } @@ -784,15 +777,15 @@ } getSince() { - return new Uint64(this.view.buffer.slice(0, Uint64.size()), { validate: false }); + return new Uint64(this.view.buffer.slice(0, 0 + Uint64.size()), { validate: false }); } getPreviousOutput() { - return new OutPoint(this.view.buffer.slice(0 + Uint64.size(), OutPoint.size()), { validate: false }); + return new OutPoint(this.view.buffer.slice(0 + Uint64.size(), 0 + Uint64.size() + OutPoint.size()), { validate: false }); } validate(compatible = false) { - assertDataLength(this.view.byteLength, this.size()); + assertDataLength(this.view.byteLength, CellInput.size()); this.getSince().validate(compatible); this.getPreviousOutput().validate(compatible); } @@ -862,7 +855,7 @@ } getOutPoint() { - return new OutPoint(this.view.buffer.slice(0, OutPoint.size()), { validate: false }); + return new OutPoint(this.view.buffer.slice(0, 0 + OutPoint.size()), { validate: false }); } getDepType() { @@ -870,7 +863,7 @@ } validate(compatible = false) { - assertDataLength(this.view.byteLength, this.size()); + assertDataLength(this.view.byteLength, CellDep.size()); this.getOutPoint().validate(compatible); } static size() { @@ -1003,47 +996,47 @@ } getVersion() { - return new Uint32(this.view.buffer.slice(0, Uint32.size()), { validate: false }); + return new Uint32(this.view.buffer.slice(0, 0 + Uint32.size()), { validate: false }); } getCompactTarget() { - return new Uint32(this.view.buffer.slice(0 + Uint32.size(), Uint32.size()), { validate: false }); + return new Uint32(this.view.buffer.slice(0 + Uint32.size(), 0 + Uint32.size() + Uint32.size()), { validate: false }); } getTimestamp() { - return new Uint64(this.view.buffer.slice(0 + Uint32.size() + Uint32.size(), Uint64.size()), { validate: false }); + return new Uint64(this.view.buffer.slice(0 + Uint32.size() + Uint32.size(), 0 + Uint32.size() + Uint32.size() + Uint64.size()), { validate: false }); } getNumber() { - return new Uint64(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size(), Uint64.size()), { validate: false }); + return new Uint64(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size(), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size()), { validate: false }); } getEpoch() { - return new Uint64(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size(), Uint64.size()), { validate: false }); + return new Uint64(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size(), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size()), { validate: false }); } getParentHash() { - return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size(), Byte32.size()), { validate: false }); + return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size(), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size()), { validate: false }); } getTransactionsRoot() { - return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size(), Byte32.size()), { validate: false }); + return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size(), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size()), { validate: false }); } getProposalsHash() { - return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size(), Byte32.size()), { validate: false }); + return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size(), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size()), { validate: false }); } - getUnclesHash() { - return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size(), Byte32.size()), { validate: false }); + getExtraHash() { + return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size(), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size() + Byte32.size()), { validate: false }); } getDao() { - return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size() + Byte32.size(), Byte32.size()), { validate: false }); + return new Byte32(this.view.buffer.slice(0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size() + Byte32.size(), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size() + Byte32.size() + Byte32.size()), { validate: false }); } validate(compatible = false) { - assertDataLength(this.view.byteLength, this.size()); + assertDataLength(this.view.byteLength, RawHeader.size()); this.getVersion().validate(compatible); this.getCompactTarget().validate(compatible); this.getTimestamp().validate(compatible); @@ -1052,7 +1045,7 @@ this.getParentHash().validate(compatible); this.getTransactionsRoot().validate(compatible); this.getProposalsHash().validate(compatible); - this.getUnclesHash().validate(compatible); + this.getExtraHash().validate(compatible); this.getDao().validate(compatible); } static size() { @@ -1070,7 +1063,7 @@ array.set(new Uint8Array(SerializeByte32(value.parent_hash)), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size()); array.set(new Uint8Array(SerializeByte32(value.transactions_root)), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size()); array.set(new Uint8Array(SerializeByte32(value.proposals_hash)), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size()); - array.set(new Uint8Array(SerializeByte32(value.uncles_hash)), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size()); + array.set(new Uint8Array(SerializeByte32(value.extra_hash)), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size()); array.set(new Uint8Array(SerializeByte32(value.dao)), 0 + Uint32.size() + Uint32.size() + Uint64.size() + Uint64.size() + Uint64.size() + Byte32.size() + Byte32.size() + Byte32.size() + Byte32.size()); return array.buffer; } @@ -1084,15 +1077,15 @@ } getRaw() { - return new RawHeader(this.view.buffer.slice(0, RawHeader.size()), { validate: false }); + return new RawHeader(this.view.buffer.slice(0, 0 + RawHeader.size()), { validate: false }); } getNonce() { - return new Uint128(this.view.buffer.slice(0 + RawHeader.size(), Uint128.size()), { validate: false }); + return new Uint128(this.view.buffer.slice(0 + RawHeader.size(), 0 + RawHeader.size() + Uint128.size()), { validate: false }); } validate(compatible = false) { - assertDataLength(this.view.byteLength, this.size()); + assertDataLength(this.view.byteLength, Header.size()); this.getRaw().validate(compatible); this.getNonce().validate(compatible); } @@ -1198,6 +1191,69 @@ return serializeTable(buffers); } + class BlockV1 { + constructor(reader, { validate = true } = {}) { + this.view = new DataView(assertArrayBuffer(reader)); + if (validate) { + this.validate(); + } + } + + validate(compatible = false) { + const offsets = verifyAndExtractOffsets(this.view, 0, true); + new Header(this.view.buffer.slice(offsets[0], offsets[1]), { validate: false }).validate(); + new UncleBlockVec(this.view.buffer.slice(offsets[1], offsets[2]), { validate: false }).validate(); + new TransactionVec(this.view.buffer.slice(offsets[2], offsets[3]), { validate: false }).validate(); + new ProposalShortIdVec(this.view.buffer.slice(offsets[3], offsets[4]), { validate: false }).validate(); + new Bytes(this.view.buffer.slice(offsets[4], offsets[5]), { validate: false }).validate(); + } + + getHeader() { + const start = 4; + const offset = this.view.getUint32(start, true); + const offset_end = this.view.getUint32(start + 4, true); + return new Header(this.view.buffer.slice(offset, offset_end), { validate: false }); + } + + getUncles() { + const start = 8; + const offset = this.view.getUint32(start, true); + const offset_end = this.view.getUint32(start + 4, true); + return new UncleBlockVec(this.view.buffer.slice(offset, offset_end), { validate: false }); + } + + getTransactions() { + const start = 12; + const offset = this.view.getUint32(start, true); + const offset_end = this.view.getUint32(start + 4, true); + return new TransactionVec(this.view.buffer.slice(offset, offset_end), { validate: false }); + } + + getProposals() { + const start = 16; + const offset = this.view.getUint32(start, true); + const offset_end = this.view.getUint32(start + 4, true); + return new ProposalShortIdVec(this.view.buffer.slice(offset, offset_end), { validate: false }); + } + + getExtension() { + const start = 20; + const offset = this.view.getUint32(start, true); + const offset_end = this.view.byteLength; + return new Bytes(this.view.buffer.slice(offset, offset_end), { validate: false }); + } + } + + function SerializeBlockV1(value) { + const buffers = []; + buffers.push(SerializeHeader(value.header)); + buffers.push(SerializeUncleBlockVec(value.uncles)); + buffers.push(SerializeTransactionVec(value.transactions)); + buffers.push(SerializeProposalShortIdVec(value.proposals)); + buffers.push(SerializeBytes(value.extension)); + return serializeTable(buffers); + } + class CellbaseWitness { constructor(reader, { validate = true } = {}) { this.view = new DataView(assertArrayBuffer(reader)); @@ -1280,6 +1336,7 @@ } exports.Block = Block; + exports.BlockV1 = BlockV1; exports.Byte32 = Byte32; exports.Byte32Vec = Byte32Vec; exports.Bytes = Bytes; @@ -1301,6 +1358,7 @@ exports.Script = Script; exports.ScriptOpt = ScriptOpt; exports.SerializeBlock = SerializeBlock; + exports.SerializeBlockV1 = SerializeBlockV1; exports.SerializeByte32 = SerializeByte32; exports.SerializeByte32Vec = SerializeByte32Vec; exports.SerializeBytes = SerializeBytes; diff --git a/tests/serializers.js b/tests/serializers.js index 5ab3f2e..09b0b7a 100644 --- a/tests/serializers.js +++ b/tests/serializers.js @@ -282,7 +282,7 @@ test("normalize and serialize header", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -310,7 +310,7 @@ test("normalize and serialize uncle block", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -340,7 +340,7 @@ test("normalize and serialize block", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", diff --git a/tests/transformers.js b/tests/transformers.js index 8c85e58..84be571 100644 --- a/tests/transformers.js +++ b/tests/transformers.js @@ -412,7 +412,7 @@ test("correct header", t => { ), proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -430,7 +430,7 @@ test("correct header", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -451,7 +451,7 @@ test("invalid header", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287a", @@ -473,7 +473,7 @@ test("correct block", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -541,7 +541,7 @@ test("correct block", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", diff --git a/tests/validators.js b/tests/validators.js index f5e82c1..21796c1 100644 --- a/tests/validators.js +++ b/tests/validators.js @@ -404,7 +404,7 @@ test("correct header", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -426,7 +426,7 @@ test("invalid header", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -448,7 +448,7 @@ test("invalid raw header", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -470,7 +470,7 @@ test("validate uncle block", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -495,7 +495,7 @@ test("validate invalid uncle block", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", @@ -531,7 +531,7 @@ test("validate block", t => { "0x68a83c880eb942396d22020aa83343906986f66418e9b8a4488f2866ecc4e86a", proposals_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", - uncles_hash: + extra_hash: "0x0000000000000000000000000000000000000000000000000000000000000000", version: "0x0", epoch: "0x7080612000287", From f2999c7f92faecbd2e3c2cd47c124d7638f1a608 Mon Sep 17 00:00:00 2001 From: homura Date: Mon, 1 Nov 2021 11:16:11 +0800 Subject: [PATCH 5/6] fix: supported bigint --- package.json | 2 +- testfiles/blockchain.umd.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 291fe87..3ff65e5 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "dist": "rollup -c --environment BUILD:production", "test": "rollup -c --environment BUILD:development && ava", "fmt": "prettier --write \"{src,tests}/**/*.js\" index.d.ts", - "update-test-files": "curl -L https://raw.githubusercontent.com/nervosnetwork/ckb/5a7efe7a0b720de79ff3761dc6e8424b8d5b22ea/util/types/schemas/blockchain.mol -o testfiles/blockchain.mol && moleculec --language - --schema-file testfiles/blockchain.mol --format json > testfiles/blockchain.json && moleculec-es -inputFile testfiles/blockchain.json -outputFile testfiles/blockchain.esm.js && rollup -f umd -i testfiles/blockchain.esm.js -o testfiles/blockchain.umd.js --name Blockchain && rm testfiles/blockchain.mol testfiles/blockchain.json testfiles/blockchain.esm.js" + "update-test-files": "curl -L https://raw.githubusercontent.com/nervosnetwork/ckb/5a7efe7a0b720de79ff3761dc6e8424b8d5b22ea/util/types/schemas/blockchain.mol -o testfiles/blockchain.mol && moleculec --language - --schema-file testfiles/blockchain.mol --format json > testfiles/blockchain.json && moleculec-es -hasBigInt -inputFile testfiles/blockchain.json -outputFile testfiles/blockchain.esm.js && rollup -f umd -i testfiles/blockchain.esm.js -o testfiles/blockchain.umd.js --name Blockchain && rm testfiles/blockchain.mol testfiles/blockchain.json testfiles/blockchain.esm.js" }, "author": "Xuejie Xiao", "license": "MIT", diff --git a/testfiles/blockchain.umd.js b/testfiles/blockchain.umd.js index d70b72c..8ff8ff2 100644 --- a/testfiles/blockchain.umd.js +++ b/testfiles/blockchain.umd.js @@ -144,6 +144,14 @@ return this.view.buffer; } + toBigEndianBigUint64() { + return this.view.getBigUint64(0, false); + } + + toLittleEndianBigUint64() { + return this.view.getBigUint64(0, true); + } + static size() { return 8; } @@ -326,7 +334,7 @@ validate(compatible = false) { const offsets = verifyAndExtractOffsets(this.view, 0, true); - for (let i = 0; i < len(offsets) - 1; i++) { + for (let i = 0; i < offsets.length - 1; i++) { new Bytes(this.view.buffer.slice(offsets[i], offsets[i + 1]), { validate: false }).validate(); } } @@ -465,7 +473,7 @@ validate(compatible = false) { const offsets = verifyAndExtractOffsets(this.view, 0, true); - for (let i = 0; i < len(offsets) - 1; i++) { + for (let i = 0; i < offsets.length - 1; i++) { new UncleBlock(this.view.buffer.slice(offsets[i], offsets[i + 1]), { validate: false }).validate(); } } @@ -503,7 +511,7 @@ validate(compatible = false) { const offsets = verifyAndExtractOffsets(this.view, 0, true); - for (let i = 0; i < len(offsets) - 1; i++) { + for (let i = 0; i < offsets.length - 1; i++) { new Transaction(this.view.buffer.slice(offsets[i], offsets[i + 1]), { validate: false }).validate(); } } @@ -658,7 +666,7 @@ validate(compatible = false) { const offsets = verifyAndExtractOffsets(this.view, 0, true); - for (let i = 0; i < len(offsets) - 1; i++) { + for (let i = 0; i < offsets.length - 1; i++) { new CellOutput(this.view.buffer.slice(offsets[i], offsets[i + 1]), { validate: false }).validate(); } } From a008eaf5edd6fa94e7a59a5aa82091ca0c4b87ad Mon Sep 17 00:00:00 2001 From: homura Date: Mon, 8 Nov 2021 11:18:32 +0800 Subject: [PATCH 6/6] chore: ignore some dot files --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b38db2f..36ed29e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ node_modules/ build/ + +# ignore ide configurations +.idea +.vscode \ No newline at end of file