From 46bee80d529b7f1c9c53881141f931a2131d4a4b Mon Sep 17 00:00:00 2001 From: Julian Gonzalez Date: Sun, 27 Nov 2022 07:22:49 +0100 Subject: [PATCH] release v5.2.3 --- dist/koinos.js | 33 ++++++++++++++++++++++----------- dist/koinos.min.js | 2 +- package.json | 2 +- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/dist/koinos.js b/dist/koinos.js index 038fe7f..ed75ee0 100644 --- a/dist/koinos.js +++ b/dist/koinos.js @@ -10395,8 +10395,8 @@ class Provider { } /** * Function to call "chain.get_account_nonce" to return the number of - * transactions for a particular account. This call is used - * when creating new transactions. + * transactions for a particular account. If you are creating a new + * transaction consider using [[Provider.getNextNonce]]. * @param account - account address * @param deserialize - If set true it will deserialize the nonce * and return it as number (default). If set false it will return @@ -10417,6 +10417,25 @@ class Provider { // todo: consider the case where nonce is greater than max safe integer return Number(object.uint64_value); } + /** + * Function to call "chain.get_account_nonce" (number of + * transactions for a particular account) and return the next nonce. + * This call is used when creating new transactions. The result is + * encoded in base64url + * @param account - account address + * @returns Nonce + */ + async getNextNonce(account) { + const oldNonce = (await this.getNonce(account)); + const message = protocol_proto_js_1.koinos.chain.value_type.create({ + // todo: consider using bigint for big nonces + uint64_value: String(oldNonce + 1), + }); + const nonceEncoded = protocol_proto_js_1.koinos.chain.value_type + .encode(message) + .finish(); + return (0, utils_1.encodeBase64url)(nonceEncoded); + } async getAccountRc(account) { const { rc } = await this.call("chain.get_account_rc", { account, @@ -11397,15 +11416,7 @@ class Signer { if (tx.header.nonce === undefined) { if (!this.provider) throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the transaction header"); - const oldNonce = (await this.provider.getNonce(payee || payer)); - const message = protocol_proto_js_1.koinos.chain.value_type.create({ - // todo: consider using bigint for big nonces - uint64_value: String(oldNonce + 1), - }); - const nonceEncoded = protocol_proto_js_1.koinos.chain.value_type - .encode(message) - .finish(); - nonce = (0, utils_1.encodeBase64url)(nonceEncoded); + nonce = await this.provider.getNextNonce(payee || payer); } else { nonce = tx.header.nonce; diff --git a/dist/koinos.min.js b/dist/koinos.min.js index a9f9c9a..dc71fc0 100644 --- a/dist/koinos.min.js +++ b/dist/koinos.min.js @@ -1,2 +1,2 @@ /*! For license information please see koinos.min.js.LICENSE.txt */ -(()=>{var __webpack_modules__={8820:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(i);e[r];){var u=t[e.charCodeAt(r)];if(255===u)return;for(var p=0,d=i-1;(0!==u||p>>0,l[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");o=p,r++}if(" "!==e[r]){for(var f=i-o;f!==i&&0===l[f];)f++;for(var h=new Uint8Array(n+(i-f)),y=n;f!==i;)h[y++]=l[f++];return h}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var c=(i-o)*l+1>>>0,u=new Uint8Array(c);o!==i;){for(var p=t[o],d=0,f=c-1;(0!==p||d>>0,u[f]=p%s>>>0,p=p/s>>>0;if(0!==p)throw new Error("Non-zero carry");n=d,o++}for(var h=c-n;h!==c&&0===u[h];)h++;for(var y=a.repeat(r);h{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function o(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){o(e);const r=t.outputLen;if(e.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const n=r(7320),o=r(8089);class i extends o.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,o.createView)(this.buffer)}update(e){n.default.exists(this);const{view:t,buffer:r,blockLen:i}=this,s=(e=(0,o.toBytes)(e)).length;for(let n=0;ni-a&&(this.process(r,0),a=0);for(let e=a;e>o&i),a=Number(r&i),c=n?4:0,l=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+l,a,n)}(r,i-8,BigInt(8*this.length),s),this.process(r,0);const c=(0,o.createView)(e);this.get().forEach(((e,t)=>c.setUint32(4*t,e,s)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return e.length=n,e.pos=s,e.finished=o,e.destroyed=i,n%t&&e.buffer.set(r),e}}t.SHA2=i},4421:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},830:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=void 0;const n=r(7505),o=r(8089),i=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),s=Uint8Array.from({length:16},((e,t)=>t)),a=s.map((e=>(9*e+5)%16));let c=[s],l=[a];for(let e=0;e<4;e++)for(let t of[c,l])t.push(t[e].map((e=>i[e])));const u=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((e=>new Uint8Array(e))),p=c.map(((e,t)=>e.map((e=>u[t][e])))),d=l.map(((e,t)=>e.map((e=>u[t][e])))),f=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),h=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),y=(e,t)=>e<>>32-t;function _(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const g=new Uint32Array(16);class b extends n.SHA2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:o}=this;return[e,t,r,n,o]}set(e,t,r,n,o){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|o}process(e,t){for(let r=0;r<16;r++,t+=4)g[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,o=0|this.h1,i=o,s=0|this.h2,a=s,u=0|this.h3,b=u,m=0|this.h4,v=m;for(let e=0;e<5;e++){const t=4-e,w=f[e],k=h[e],O=c[e],x=l[e],S=p[e],A=d[e];for(let t=0;t<16;t++){const n=y(r+_(e,o,s,u)+g[O[t]]+w,S[t])+m|0;r=m,m=u,u=0|y(s,10),s=o,o=n}for(let e=0;e<16;e++){const r=y(n+_(t,i,a,b)+g[x[e]]+k,A[e])+v|0;n=v,v=b,b=0|y(a,10),a=i,i=r}}this.set(this.h1+s+b|0,this.h2+u+v|0,this.h3+m+n|0,this.h4+r+i|0,this.h0+o+a|0)}roundClean(){g.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}t.RIPEMD160=b,t.ripemd160=(0,o.wrapConstructor)((()=>new b))},3061:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const n=r(7505),o=r(8089),i=(e,t,r)=>e&t^e&r^t&r,s=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class l extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[e,t,r,n,o,i,s,a]}set(e,t,r,n,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=c[e-15],r=c[e-2],n=(0,o.rotr)(t,7)^(0,o.rotr)(t,18)^t>>>3,i=(0,o.rotr)(r,17)^(0,o.rotr)(r,19)^r>>>10;c[e]=i+c[e-7]+n+c[e-16]|0}let{A:r,B:n,C:a,D:l,E:u,F:p,G:d,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,o.rotr)(u,6)^(0,o.rotr)(u,11)^(0,o.rotr)(u,25))+((h=u)&p^~h&d)+s[e]+c[e]|0,y=((0,o.rotr)(r,2)^(0,o.rotr)(r,13)^(0,o.rotr)(r,22))+i(r,n,a)|0;f=d,d=p,p=u,u=l+t|0,l=a,a=n,n=r,r=t+y|0}var h;r=r+this.A|0,n=n+this.B|0,a=a+this.C|0,l=l+this.D|0,u=u+this.E|0,p=p+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(r,n,a,l,u,p,d,f)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}t.sha256=(0,o.wrapConstructor)((()=>new l))},8089:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const n=r(4421);if(t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function i(e){if("string"!=typeof e)throw new TypeError("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}function s(e){if("string"==typeof e&&(e=i(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}t.bytesToHex=function(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r{},t.asyncLoop=async function(e,r,n){let o=Date.now();for(let i=0;i=0&&ee instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;te().update(s(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(s(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto.web)return n.crypto.web.getRandomValues(new Uint8Array(e));if(n.crypto.node)return new Uint8Array(n.crypto.node.randomBytes(e).buffer);throw new Error("The environment doesn't have randomBytes function")}},9656:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.schnorr=t.verify=t.signSync=t.sign=t.getSharedSecret=t.recoverPublicKey=t.getPublicKey=t.Signature=t.Point=t.CURVE=void 0;const n=r(9159),o=BigInt(0),i=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(8),l=s**BigInt(256),u={a:o,b:BigInt(7),P:l-s**BigInt(32)-BigInt(977),n:l-BigInt("432420386565659656852420866394968145599"),h:i,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function p(e){const{a:t,b:r}=u,n=T(e*e),o=T(n*e);return T(o+t*e+r)}t.CURVE=u;const d=u.a===o;class f{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof y))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new f(e.x,e.y,i)}static toAffineBatch(e){const t=function(e,t=u.P){const r=new Array(e.length),n=I(e.reduce(((e,n,i)=>n===o?e:(r[i]=e,T(e*n,t))),i),t);return e.reduceRight(((e,n,i)=>n===o?e:(r[i]=T(e*r[i],t),T(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return f.toAffineBatch(e).map(f.fromAffine)}equals(e){if(!(e instanceof f))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:o,y:i,z:a}=e,c=T(n**s),l=T(a**s),u=T(t*l),p=T(o*c),d=T(T(r*a)*l),h=T(T(i*n)*c);return u===p&&d===h}negate(){return new f(this.x,T(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=T(e**s),o=T(t**s),i=T(o**s),l=T(s*(T((e+o)**s)-n-i)),u=T(a*n),p=T(u**s),d=T(p-s*l),h=T(u*(l-d)-c*i),y=T(s*t*r);return new f(d,h,y)}add(e){if(!(e instanceof f))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:i,y:a,z:c}=e;if(i===o||a===o)return this;if(t===o||r===o)return e;const l=T(n**s),u=T(c**s),p=T(t*u),d=T(i*l),h=T(T(r*c)*u),y=T(T(a*n)*l),_=T(d-p),g=T(y-h);if(_===o)return g===o?this.double():f.ZERO;const b=T(_**s),m=T(_*b),v=T(p*b),w=T(g**s-m-s*v),k=T(g*(v-w)-h*m),O=T(n*c*_);return new f(w,k,O)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=f.ZERO;if("bigint"==typeof e&&e===o)return t;let r=P(e);if(r===i)return this;if(!d){let e=t,n=this;for(;r>o;)r&i&&(e=e.add(n)),n=n.double(),r>>=i;return e}let{k1neg:n,k1:s,k2neg:a,k2:c}=U(r),l=t,p=t,h=this;for(;s>o||c>o;)s&i&&(l=l.add(h)),c&i&&(p=p.add(h)),h=h.double(),s>>=i,c>>=i;return n&&(l=l.negate()),a&&(p=p.negate()),p=new f(T(p.x*u.beta),p.y,p.z),l.add(p)}precomputeWindow(e){const t=d?128/e+1:256/e+1,r=[];let n=this,o=n;for(let i=0;i>=p,a>c&&(a-=u,e+=i),0===a){let e=n[r];t%2&&(e=e.negate()),s=s.add(e)}else{let e=n[r+Math.abs(a)-1];a<0&&(e=e.negate()),o=o.add(e)}}return{p:o,f:s}}multiply(e,t){let r,n,o=P(e);if(d){const{k1neg:e,k1:i,k2neg:s,k2:a}=U(o);let{p:c,f:l}=this.wNAF(i,t),{p,f:d}=this.wNAF(a,t);e&&(c=c.negate()),s&&(p=p.negate()),p=new f(T(p.x*u.beta),p.y,p.z),r=c.add(p),n=l.add(d)}else{const{p:e,f:i}=this.wNAF(o,t);r=e,n=i}return f.normalizeZ([r,n])[0]}toAffine(e=I(this.z)){const{x:t,y:r,z:n}=this,o=e,s=T(o*o),a=T(s*o),c=T(t*s),l=T(r*a);if(T(n*o)!==i)throw new Error("invZ was invalid");return new y(c,l)}}f.BASE=new f(u.Gx,u.Gy,i),f.ZERO=new f(o,i,o);const h=new WeakMap;class y{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,h.delete(this)}static fromCompressedHex(e){const t=32===e.length,r=E(t?e:e.subarray(1));if(!J(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=u,r=BigInt(6),n=BigInt(11),o=BigInt(22),i=BigInt(23),c=BigInt(44),l=BigInt(88),p=e*e*e%t,d=p*p*e%t,f=N(d,a)*d%t,h=N(f,a)*d%t,y=N(h,s)*p%t,_=N(y,n)*y%t,g=N(_,o)*_%t,b=N(g,c)*g%t,m=N(b,l)*b%t,v=N(m,c)*g%t,w=N(v,a)*d%t,k=N(w,i)*_%t,O=N(k,r)*p%t;return N(O,s)}(p(r));const o=(n&i)===i;t?o&&(n=T(-n)):1==(1&e[0])!==o&&(n=T(-n));const c=new y(r,n);return c.assertValidity(),c}static fromUncompressedHex(e){const t=E(e.subarray(1,33)),r=E(e.subarray(33,65)),n=new y(t,r);return n.assertValidity(),n}static fromHex(e){const t=B(e),r=t.length,n=t[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(t);if(65===r&&4===n)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(e){return y.BASE.multiply(H(e))}static fromSignature(e,t,r){const n=R(e=B(e)),{r:o,s:i}=F(t);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");const s=1&r?"03":"02",a=y.fromHex(s+O(o)),{n:c}=u,l=I(o,c),p=T(-n*l,c),d=T(i*l,c),f=y.BASE.multiplyAndAddUnsafe(a,p,d);if(!f)throw new Error("Cannot recover signature: point at infinify");return f.assertValidity(),f}toRawBytes(e=!1){return j(this.toHex(e))}toHex(e=!1){const t=O(this.x);return e?`${this.y&i?"03":"02"}${t}`:`04${t}${O(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:r}=this;if(!J(t)||!J(r))throw new Error(e);const n=T(r*r);if(T(n-p(t))!==o)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new y(this.x,T(-this.y))}double(){return f.fromAffine(this).double().toAffine()}add(e){return f.fromAffine(this).add(f.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return f.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const n=f.fromAffine(this),s=t===o||t===i||this!==y.BASE?n.multiplyUnsafe(t):n.multiply(t),a=f.fromAffine(e).multiplyUnsafe(r),c=s.add(a);return c.equals(f.ZERO)?void 0:c.toAffine()}}function _(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function g(e){if(e.length<2||2!==e[0])throw new Error(`Invalid signature integer tag: ${k(e)}`);const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:E(r),left:e.subarray(t+2)}}t.Point=y,y.BASE=new y(u.Gx,u.Gy),y.ZERO=new y(o,o);class b{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=v(e),r="Signature.fromCompact";if("string"!=typeof e&&!t)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=t?k(e):e;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new b(A(n.slice(0,64)),A(n.slice(64,128)))}static fromDER(e){const t=v(e);if("string"!=typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(e){if(e.length<2||48!=e[0])throw new Error(`Invalid signature tag: ${k(e)}`);if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=g(e.subarray(2)),{data:n,left:o}=g(r);if(o.length)throw new Error(`Invalid signature: left bytes after parsing: ${k(o)}`);return{r:t,s:n}}(t?e:j(e));return new b(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!C(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!C(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=u.n>>i;return this.s>e}normalizeS(){return this.hasHighS()?new b(this.r,u.n-this.s):this}toDERRawBytes(e=!1){return j(this.toDERHex(e))}toDERHex(e=!1){const t=_(S(this.s));if(e)return t;const r=_(S(this.r)),n=S(r.length/2),o=S(t.length/2);return`30${S(r.length/2+t.length/2+4)}02${n}${r}02${o}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return j(this.toCompactHex())}toCompactHex(){return O(this.r)+O(this.s)}}function m(...e){if(!e.every(v))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;tt.toString(16).padStart(2,"0")));function k(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;rl)throw new Error("Expected number < 2^256");return e.toString(16).padStart(64,"0")}function x(e){return j(O(e))}function S(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function A(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt(`0x${e}`)}function j(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let r=0;r0)return BigInt(e);if("bigint"==typeof e&&C(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function T(e,t=u.P){const r=e%t;return r>=o?r:t+r}function N(e,t){const{P:r}=u;let n=e;for(;t-- >o;)n*=n,n%=r;return n}function I(e,t=u.P){if(e===o||t<=o)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=T(e,t),n=t,s=o,a=i,c=i,l=o;for(;r!==o;){const e=n/r,t=n%r,o=s-c*e,i=a-l*e;n=r,r=t,s=c,a=l,c=o,l=i}if(n!==i)throw new Error("invert: does not exist");return T(s,t)}const L=(e,t)=>(e+t/s)/t,D=s**BigInt(128);function U(e){const{n:t}=u,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-i*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,a=L(s*e,t),c=L(-n*e,t);let l=T(e-a*r-c*o,t),p=T(-a*n-c*s,t);const d=l>D,f=p>D;if(d&&(l=t-l),f&&(p=t-p),l>D||p>D)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:f,k2:p}}function R(e){const{n:t}=u,r=8*e.length-256;let n=E(e);return r>0&&(n>>=BigInt(r)),n>=t&&(n-=t),n}class z{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...e){return t.utils.hmacSha256(this.k,...e)}hmacSync(...e){if("function"!=typeof t.utils.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");const r=t.utils.hmacSha256Sync(this.k,...e);if(r instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return r}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(e=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(e=new Uint8Array){this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function C(e){return o0)t=BigInt(e);else if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");t=A(e)}else{if(!v(e))throw new TypeError("Expected valid private key");if(32!==e.length)throw new Error("Expected 32 bytes of private key");t=E(e)}if(!C(t))throw new Error("Expected private key: 0 < key < n");return t}function M(e){return e instanceof y?(e.assertValidity(),e):y.fromHex(e)}function F(e){if(e instanceof b)return e.assertValidity(),e;try{return b.fromDER(e)}catch(t){return b.fromCompact(e)}}function q(e){const t=v(e),r="string"==typeof e,n=(t||r)&&e.length;return t?33===n||65===n:r?66===n||130===n:e instanceof y}function V(e){return E(e.length>32?e.slice(0,32):e)}function K(e){const t=V(e),r=T(t,u.n);return G(rx(T(H(e)+H(t),u.n)),privateNegate:e=>{const t=H(e);return x(u.n-t)},pointAddScalar:(e,t,r)=>{const n=y.fromHex(e),o=H(t),s=y.BASE.multiplyAndAddUnsafe(n,o,i);if(!s)throw new Error("Tweaked point at infinity");return s.toRawBytes(r)},pointMultiply:(e,t,r)=>{const n=y.fromHex(e),o=E(B(t));return n.multiply(o).toRawBytes(r)},hashToPrivateKey:e=>{if((e=B(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return x(T(E(e),u.n-i)+i)},randomBytes:(e=32)=>{if(le.web)return le.web.getRandomValues(new Uint8Array(e));if(le.node){const{randomBytes:t}=le.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>t.utils.hashToPrivateKey(t.utils.randomBytes(40)),bytesToHex:k,hexToBytes:j,concatBytes:m,mod:T,invert:I,sha256:async(...e)=>{if(le.web){const t=await le.web.subtle.digest("SHA-256",m(...e));return new Uint8Array(t)}if(le.node){const{createHash:t}=le.node,r=t("sha256");return e.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(e,...t)=>{if(le.web){const r=await le.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=m(...t),o=await le.web.subtle.sign("HMAC",r,n);return new Uint8Array(o)}if(le.node){const{createHmac:r}=le.node,n=r("sha256",e);return t.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(e,...r)=>{let n=pe[e];if(void 0===n){const r=await t.utils.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));n=m(r,r),pe[e]=n}return t.utils.sha256(n,...r)},taggedHashSync:(e,...r)=>{if("function"!=typeof t.utils.sha256Sync)throw new Error("utils.sha256Sync is undefined, you need to set it");let n=pe[e];if(void 0===n){const r=t.utils.sha256Sync(Uint8Array.from(e,(e=>e.charCodeAt(0))));n=m(r,r),pe[e]=n}return t.utils.sha256Sync(n,...r)},precompute(e=8,t=y.BASE){const r=t===y.BASE?t:new y(t.x,t.y);return r._setWindowSize(e),r.multiply(a),r}}},4537:e=>{"use strict";e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,o=2,i=!0;o{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),o=new Array(123),i=0;i<64;)o[n[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;r.encode=function(e,t,r){for(var o,i=null,s=[],a=0,c=0;t>2],o=(3&l)<<4,c=1;break;case 1:s[a++]=n[o|l>>4],o=(15&l)<<2,c=2;break;case 2:s[a++]=n[o|l>>6],s[a++]=n[63&l],c=0}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=n[o],s[a++]=61,1===c&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";r.decode=function(e,t,r){for(var n,i=r,a=0,c=0;c1)break;if(void 0===(l=o[l]))throw Error(s);switch(a){case 0:n=l,a=1;break;case 1:t[r++]=n<<2|(48&l)>>4,n=l,a=2;break;case 2:t[r++]=(15&n)<<4|(60&l)>>2,n=l,a=3;break;case 3:t[r++]=(3&n)<<6|l,a=0}}if(1===a)throw Error(s);return r-i},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},5124:e=>{"use strict";function t(e,r){"string"==typeof e&&(r=e,e=void 0);var n=[];function o(e){if("string"!=typeof e){var r=i();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var s=Object.keys(e),a=new Array(s.length+1),c=new Array(s.length),l=0;l{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n{"use strict";e.exports=i;var n=r(4537),o=r(7199)("fs");function i(e,t,r){return"function"==typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&o&&o.readFile?o.readFile(e,(function(n,o){return n&&"undefined"!=typeof XMLHttpRequest?i.xhr(e,t,r):n?r(n):r(null,t.binary?o:o.toString("utf8"))})):i.xhr(e,t,r):n(i,this,e,t)}i.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var o=0;o{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function i(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:i,e.writeFloatBE=n?i:o,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var i=Math.floor(Math.log(t)/Math.LN2);e((o<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),o=2*(n>>31)+1,i=n>>>23&255,s=8388607&n;return 255===i?s?NaN:o*(1/0):0===i?1401298464324817e-60*o*s:o*Math.pow(2,i-150)*(s+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=s.bind(null,o),e.readFloatBE=s.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function i(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:i,e.writeDoubleBE=n?i:o,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,o,i){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,o,i+t),e(1/n>0?0:2147483648,o,i+r);else if(isNaN(n))e(0,o,i+t),e(2146959360,o,i+r);else if(n>17976931348623157e292)e(0,o,i+t),e((s<<31|2146435072)>>>0,o,i+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,o,i+t),e((s<<31|a/4294967296)>>>0,o,i+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,o,i+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,o,i+r)}}}function s(e,t,r,n,o){var i=e(n,o+t),s=e(n,o+r),a=2*(s>>31)+1,c=s>>>20&2047,l=4294967296*(1048575&s)+i;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=s.bind(null,o,0,4),e.readDoubleBE=s.bind(null,i,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function i(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},7199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},8626:(e,t)=>{"use strict";var r=t,n=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},o=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),o="";r&&(o=t.shift()+"/");for(var i=0;i0&&".."!==t[i-1]?t.splice(--i,2):r?t.splice(i,1):++i:"."===t[i]?t.splice(i,1):++i;return o+t.join("/")};r.resolve=function(e,t,r){return r||(t=o(t)),n(t)?t:(r||(e=o(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?o(e+"/"+t):t)}},6662:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,o=n>>>1,i=null,s=n;return function(r){if(r<1||r>o)return e(r);s+r>n&&(i=e(n),s=0);var a=t.call(i,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},4997:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n191&&n<224?i[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[s++]=55296+(n>>10),i[s++]=56320+(1023&n)):i[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))},r.write=function(e,t,r){for(var n,o,i=r,s=0;s>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&o),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-i}},556:(e,t,r)=>{"use strict";const{encodeText:n}=r(2413);e.exports=class{constructor(e,t,r,o){this.name=e,this.code=t,this.codeBuf=n(this.code),this.alphabet=o,this.codec=r(o)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}}},5077:(e,t,r)=>{"use strict";const n=r(8820),o=r(556),{rfc4648:i}=r(6727),{decodeText:s,encodeText:a}=r(2413),c=[["identity","\0",()=>({encode:s,decode:a}),""],["base2","0",i(1),"01"],["base8","7",i(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",i(4),"0123456789abcdef"],["base16upper","F",i(4),"0123456789ABCDEF"],["base32hex","v",i(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",i(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",i(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",i(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",i(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],l=c.reduce(((e,t)=>(e[t[0]]=new o(t[0],t[1],t[2],t[3]),e)),{}),u=c.reduce(((e,t)=>(e[t[1]]=l[t[0]],e)),{});e.exports={names:l,codes:u}},6957:(e,t,r)=>{"use strict";const n=r(5077),{encodeText:o,decodeText:i,concat:s}=r(2413);function a(e){if(Object.prototype.hasOwnProperty.call(n.names,e))return n.names[e];if(Object.prototype.hasOwnProperty.call(n.codes,e))return n.codes[e];throw new Error(`Unsupported encoding: ${e}`)}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:n}=a(e);return function(e,t){a(e).decode(i(t))}(r,t),s([n,t],n.length+t.length)}).encode=function(e,t){const r=a(e),n=o(r.encode(t));return s([r.codeBuf,n],r.codeBuf.length+n.length)},t.decode=function(e){e instanceof Uint8Array&&(e=i(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),a(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=i(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return a(e[0]).name}catch(e){return!1}},t.encoding=a,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=i(e)),a(e[0])};const c=Object.freeze(n.names),l=Object.freeze(n.codes);t.names=c,t.codes=l},6727:e=>{"use strict";e.exports={rfc4648:e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],o=(1<r;)s-=r,i+=t[o&a>>s];if(s&&(i+=t[o&a<((e,t,r)=>{const n={};for(let e=0;e=8&&(s-=8,i[c++]=255&a>>s)}if(s>=r||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return i})(r,t,e)})}},2413:e=>{"use strict";const t=new TextDecoder,r=new TextEncoder;e.exports={decodeText:e=>t.decode(e),encodeText:e=>r.encode(e),concat:function(e,t){const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}}},4492:(e,t,r)=>{"use strict";e.exports=r(8836)},2100:(e,t,r)=>{"use strict";e.exports=r(9482)},3996:(e,t,r)=>{"use strict";var n=t,o=r(7025),i=r(9935);function s(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof o){e("switch(d%s){",n);for(var i=t.resolvedType.values,s=Object.keys(i),a=0;a>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof o?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var i=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":i=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,i?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,r=i.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var n=0;n{"use strict";e.exports=function(e){var t=i.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos>>3){");for(var r=0;r>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===o.basic[c]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",c),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==o.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==o.packed[c]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{"use strict";e.exports=function(e){for(var t,r=i.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(i.compareFieldsById),c=0;c>>0,8|o.mapKey[l.keyType],l.keyType),void 0===d?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,p,t),r("}")("}")):l.repeated?(r("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==o.packed[p]?r("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",p,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===d?s(r,l,u,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(l.id<<3|d)>>>0,p,t)),r("}")):(l.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===d?s(r,l,u,t):r("w.uint32(%i).%s(%s)",(l.id<<3|d)>>>0,p,t))}return r("return w")};var n=r(7025),o=r(7063),i=r(9935);function s(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},7025:(e,t,r)=>{"use strict";e.exports=s;var n=r(3243);((s.prototype=Object.create(n.prototype)).constructor=s).className="Enum";var o=r(9313),i=r(9935);function s(e,t,r,o,i){if(n.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=i||{},this.reserved=void 0,t)for(var s=Object.keys(t),a=0;a{"use strict";e.exports=l;var n=r(3243);((l.prototype=Object.create(n.prototype)).constructor=l).className="Field";var o,i=r(7025),s=r(7063),a=r(9935),c=/^required|optional|repeated$/;function l(e,t,r,o,i,l,u){if(a.isObject(o)?(u=i,l=o,o=i=void 0):a.isObject(i)&&(u=l,l=i,i=void 0),n.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==o&&!c.test(o=o.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==i&&!a.isString(i))throw TypeError("extend must be a string");"proto3_optional"===o&&(o="optional"),this.rule=o&&"optional"!==o?o:void 0,this.type=r,this.id=t,this.extend=i||void 0,this.required="required"===o,this.optional=!this.required,this.repeated="repeated"===o,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==s.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),n.prototype.setOption.call(this,e,t,r)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},l.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=s.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof o?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof i&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof i)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof o&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},l.d=function(e,t,r,n){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(o,i){a.decorateType(o.constructor).add(new l(i,e,t,r,{default:n}))}},l._configure=function(e){o=e}},8836:(e,t,r)=>{"use strict";var n=e.exports=r(9482);n.build="light",n.load=function(e,t,r){return"function"==typeof t?(r=t,t=new n.Root):t||(t=new n.Root),t.load(e,r)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=r(4928),n.decoder=r(5305),n.verifier=r(4497),n.converter=r(3996),n.ReflectionObject=r(3243),n.Namespace=r(9313),n.Root=r(9424),n.Enum=r(7025),n.Type=r(7645),n.Field=r(3548),n.OneOf=r(7598),n.MapField=r(6039),n.Service=r(7513),n.Method=r(4429),n.Message=r(8368),n.wrappers=r(1667),n.types=r(7063),n.util=r(9935),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},9482:(e,t,r)=>{"use strict";var n=t;function o(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(1173),n.BufferWriter=r(3155),n.Reader=r(1408),n.BufferReader=r(593),n.util=r(9693),n.rpc=r(5994),n.roots=r(5054),n.configure=o,o()},6039:(e,t,r)=>{"use strict";e.exports=s;var n=r(3548);((s.prototype=Object.create(n.prototype)).constructor=s).className="MapField";var o=r(7063),i=r(9935);function s(e,t,r,o,s,a){if(n.call(this,e,t,o,void 0,void 0,s,a),!i.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===o.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},s.d=function(e,t,r){return"function"==typeof r?r=i.decorateType(r).name:r&&"object"==typeof r&&(r=i.decorateEnum(r).name),function(n,o){i.decorateType(n.constructor).add(new s(o,e,t,r))}}},8368:(e,t,r)=>{"use strict";e.exports=o;var n=r(9693);function o(e){if(e)for(var t=Object.keys(e),r=0;r{"use strict";e.exports=i;var n=r(3243);((i.prototype=Object.create(n.prototype)).constructor=i).className="Method";var o=r(9935);function i(e,t,r,i,s,a,c,l,u){if(o.isObject(s)?(c=s,s=a=void 0):o.isObject(a)&&(c=a,a=void 0),void 0!==t&&!o.isString(t))throw TypeError("type must be a string");if(!o.isString(r))throw TypeError("requestType must be a string");if(!o.isString(i))throw TypeError("responseType must be a string");n.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=i,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}i.fromJSON=function(e,t){return new i(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},i.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},i.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},9313:(e,t,r)=>{"use strict";e.exports=u;var n=r(3243);((u.prototype=Object.create(n.prototype)).constructor=u).className="Namespace";var o,i,s,a=r(3548),c=r(9935);function l(e,t){if(e&&e.length){for(var r={},n=0;nt)return!0;return!1},u.isReservedName=function(e,t){if(e)for(var r=0;r0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof u))throw Error("path conflicts with non-namespace objects")}else r.add(r=new u(n))}return t&&r.addJSON(t),r},u.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t-1)return n}else if(n instanceof u&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var o=0;o{"use strict";e.exports=i,i.className="ReflectionObject";var n,o=r(9935);function i(e,t){if(!o.isString(e))throw TypeError("name must be a string");if(t&&!o.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(i.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),i.prototype.toJSON=function(){throw Error()},i.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof n&&t._handleAdd(this)},i.prototype.onRemove=function(e){var t=e.root;t instanceof n&&t._handleRemove(this),this.parent=null,this.resolved=!1},i.prototype.resolve=function(){return this.resolved||this.root instanceof n&&(this.resolved=!0),this},i.prototype.getOption=function(e){if(this.options)return this.options[e]},i.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},i.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var i=n.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(i){var s=i[e];o.setProperty(s,r,t)}else(i={})[e]=o.setProperty({},r,t),n.push(i)}else{var a={};a[e]=t,n.push(a)}return this},i.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n{"use strict";e.exports=s;var n=r(3243);((s.prototype=Object.create(n.prototype)).constructor=s).className="OneOf";var o=r(3548),i=r(9935);function s(e,t,r,o){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=o}function a(e){if(e.parent)for(var t=0;t-1&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t{"use strict";e.exports=c;var n,o=r(9693),i=o.LongBits,s=o.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},p=function(){return o.Buffer?function(e){return(c.create=function(e){return o.Buffer.isBuffer(e)?new n(e):u(e)})(e)}:u};function d(){var e=new i(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw a(this,8);return new i(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}c.create=p(),c.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return l}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=p(),n._configure();var t=o.Long?"toLong":"toNumber";o.merge(c.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},593:(e,t,r)=>{"use strict";e.exports=i;var n=r(1408);(i.prototype=Object.create(n.prototype)).constructor=i;var o=r(9693);function i(e){n.call(this,e)}i._configure=function(){o.Buffer&&(i.prototype._slice=o.Buffer.prototype.slice)},i.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},i._configure()},9424:(e,t,r)=>{"use strict";e.exports=p;var n=r(9313);((p.prototype=Object.create(n.prototype)).constructor=p).className="Root";var o,i,s,a=r(3548),c=r(7025),l=r(7598),u=r(9935);function p(e){n.call(this,"",e),this.deferred=[],this.files=[]}function d(){}p.fromJSON=function(e,t){return t||(t=new p),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},p.prototype.resolvePath=u.path.resolve,p.prototype.fetch=u.fetch,p.prototype.load=function e(t,r,n){"function"==typeof r&&(n=r,r=void 0);var o=this;if(!n)return u.asPromise(e,o,t,r);var a=n===d;function c(e,t){if(n){var r=n;if(n=null,a)throw e;r(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in s)return r}return null}function p(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){i.filename=e;var n,s=i(t,o,r),p=0;if(s.imports)for(;p-1))if(o.files.push(e),e in s)a?p(e,s[e]):(++h,setTimeout((function(){--h,p(e,s[e])})));else if(a){var r;try{r=u.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||c(e))}p(e,r)}else++h,o.fetch(e,(function(r,i){--h,n&&(r?t?h||c(null,o):c(r):p(e,i))}))}var h=0;u.isString(t)&&(t=[t]);for(var y,_=0;_-1&&this.deferred.splice(t,1)}}else if(e instanceof c)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r{"use strict";e.exports={}},5994:(e,t,r)=>{"use strict";t.Service=r(7948)},7948:(e,t,r)=>{"use strict";e.exports=o;var n=r(9693);function o(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(o.prototype=Object.create(n.EventEmitter.prototype)).constructor=o,o.prototype.rpcCall=function e(t,r,o,i,s){if(!i)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,o,i);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof o))try{r=o[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},o.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},7513:(e,t,r)=>{"use strict";e.exports=a;var n=r(9313);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var o=r(4429),i=r(9935),s=r(5994);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),i=0;i{"use strict";e.exports=b;var n=r(9313);((b.prototype=Object.create(n.prototype)).constructor=b).className="Type";var o=r(7025),i=r(7598),s=r(3548),a=r(6039),c=r(7513),l=r(8368),u=r(1408),p=r(1173),d=r(9935),f=r(4928),h=r(5305),y=r(4497),_=r(3996),g=r(1667);function b(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function m(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(b.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t{"use strict";var n=t,o=r(9935),i=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var r=0,n={};for(t|=0;r{"use strict";var n,o,i=e.exports=r(9693),s=r(5054);i.codegen=r(5124),i.fetch=r(9054),i.path=r(8626),i.fs=i.inquire("fs"),i.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n0)t[o]=e(t[o]||{},r,n);else{var i=t[o];i&&(n=[].concat(i).concat(n)),t[o]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(i,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(r(9424)))}})},1945:(e,t,r)=>{"use strict";e.exports=o;var n=r(9693);function o(e,t){this.lo=e>>>0,this.hi=t>>>0}var i=o.zero=new o(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var s=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(e){if(0===e)return i;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new o(r,n)},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(n.isString(e)){if(!n.Long)return o.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):i},o.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;o.fromHash=function(e){return e===s?i:new o((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},9693:function(e,t,r){"use strict";var n=t;function o(e,t,r){for(var n=Object.keys(t),o=0;oe,set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(4537),n.base64=r(7419),n.EventEmitter=r(9211),n.float=r(945),n.inquire=r(7199),n.utf8=r(4997),n.pool=r(6662),n.LongBits=r(1945),n.isNode=Boolean(void 0!==r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=o,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=i,n.ProtocolError=i("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r{"use strict";e.exports=function(e){var t=o.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r={};e.oneofsArray.length&&t("var p={}");for(var n=0;n{"use strict";var n=t,o=r(8368);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var i=this.lookup(n);i&&(e=i.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof o){var s=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),n=r+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),s["@type"]=n,s}return this.toObject(e,t)}}},1173:(e,t,r)=>{"use strict";e.exports=p;var n,o=r(9693),i=o.LongBits,s=o.base64,a=o.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function p(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return o.Buffer?function(){return(p.create=function(){return new n})()}:function(){return new p}};function f(e,t,r){t[r]=255&e}function h(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function _(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}p.create=d(),p.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(p.alloc=o.pool(p.alloc,o.Array.prototype.subarray)),p.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},h.prototype=Object.create(c.prototype),h.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},p.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new h((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},p.prototype.int32=function(e){return e<0?this._push(y,10,i.fromNumber(e)):this.uint32(e)},p.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},p.prototype.uint64=function(e){var t=i.from(e);return this._push(y,t.length(),t)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(e){var t=i.from(e).zzEncode();return this._push(y,t.length(),t)},p.prototype.bool=function(e){return this._push(f,1,e?1:0)},p.prototype.fixed32=function(e){return this._push(_,4,e>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(e){var t=i.from(e);return this._push(_,4,t.lo)._push(_,4,t.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},p.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var g=o.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;if(!t)return this._push(f,1,0);if(o.isString(e)){var r=p.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(g,t,e)},p.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},p.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},p.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},p.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},p._configure=function(e){n=e,p.create=d(),n._configure()}},3155:(e,t,r)=>{"use strict";e.exports=i;var n=r(1173);(i.prototype=Object.create(n.prototype)).constructor=i;var o=r(9693);function i(){n.call(this)}function s(e,t,r){e.length<40?o.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}i._configure=function(){i.alloc=o._Buffer_allocUnsafe,i.writeBytesBuffer=o.Buffer&&o.Buffer.prototype instanceof Uint8Array&&"set"===o.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(i.writeBytesBuffer,t,e),this},i.prototype.string=function(e){var t=o.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},i._configure()},9822:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Contract=void 0;const n=r(7187),o=r(8593);class i{constructor(e){var t;e.id&&(this.id=(0,o.decodeBase58)(e.id)),this.signer=e.signer,this.provider=e.provider||(null===(t=e.signer)||void 0===t?void 0:t.provider),this.abi=e.abi,this.bytecode=e.bytecode,e.serializer?this.serializer=e.serializer:e.abi&&e.abi.koilib_types&&(this.serializer=new n.Serializer(e.abi.koilib_types)),this.options={signTransaction:!0,sendTransaction:!0,broadcast:!0,sendAbis:!0,...e.options},this.functions={},this.abi&&this.abi.methods&&Object.keys(this.abi.methods).forEach((e=>{this.functions[e]=async(t={},r)=>{if(!this.provider)throw new Error("provider not found");if(!this.abi||!this.abi.methods)throw new Error("Methods are not defined");if(!this.abi.methods[e])throw new Error(`Method ${e} not defined in the ABI`);const n={...this.options,...r},{read_only:i,return:s,default_output:a,preformat_argument:c,preformat_return:l}=this.abi.methods[e];let u;u="function"==typeof c?c(t):t;const p=await this.encodeOperation({name:e,args:u});if(n.onlyOperation)return{operation:p};if(i){if(!s)throw new Error(`No output defined for ${e}`);const{result:t}=await this.provider.readContract(p.call_contract);let r=a;return t&&(r=await this.serializer.deserialize(t,s)),"function"==typeof l&&(r=l(r)),{operation:p,result:r}}if(!this.signer)throw new Error("signer not found");let d=await this.signer.prepareTransaction({header:{...n.chainId&&{chain_id:n.chainId},...n.rcLimit&&{rc_limit:n.rcLimit},...n.nonce&&{nonce:n.nonce},...n.payer&&{payer:n.payer},...n.payee&&{payee:n.payee}},operations:[...n.previousOperations?n.previousOperations:[],p,...n.nextOperations?n.nextOperations:[]]});const f={broadcast:n.broadcast,beforeSend:n.beforeSend};if(n.sendAbis){f.abis={};const e=(0,o.encodeBase58)(this.id);f.abis[e]=this.abi}if(!n.sendTransaction){const e=()=>{throw new Error("This transaction was not broadcasted")};return n.signTransaction&&(d=await this.signer.signTransaction(d,f.abis)),{operation:p,transaction:{...d,wait:e}}}const{transaction:h,receipt:y}=await this.signer.sendTransaction(d,f);return{operation:p,transaction:h,receipt:y}}}))}getId(){if(!this.id)throw new Error("id is not defined");return(0,o.encodeBase58)(this.id)}async deploy(e){if(!this.signer)throw new Error("signer not found");if(!this.bytecode)throw new Error("bytecode not found");const t={...this.options,...e},r={upload_contract:{contract_id:this.id?(0,o.encodeBase58)(this.id):this.signer.getAddress(),bytecode:(0,o.encodeBase64url)(this.bytecode),...t.abi&&{abi:t.abi},...t.authorizesCallContract&&{authorizes_call_contract:t.authorizesCallContract},...t.authorizesTransactionApplication&&{authorizes_transaction_application:t.authorizesTransactionApplication},...t.authorizesUploadContract&&{authorizes_upload_contract:t.authorizesUploadContract}}};if(t.onlyOperation)return{operation:r};let n=await this.signer.prepareTransaction({header:{...t.chainId&&{chain_id:t.chainId},...t.rcLimit&&{rc_limit:t.rcLimit},...t.nonce&&{nonce:t.nonce},...t.payer&&{payer:t.payer},...t.payee&&{payee:t.payee}},operations:[...t.previousOperations?t.previousOperations:[],r,...t.nextOperations?t.nextOperations:[]]});const i={broadcast:t.broadcast,beforeSend:t.beforeSend};if(!t.sendTransaction){const e=()=>{throw new Error("This transaction was not broadcasted")};return t.signTransaction&&(n=await this.signer.signTransaction(n)),{operation:r,transaction:{...n,wait:e}}}const{transaction:s,receipt:a}=await this.signer.sendTransaction(n,i);return{operation:r,transaction:s,receipt:a}}async encodeOperation(e){if(!this.abi||!this.abi.methods||!this.abi.methods[e.name])throw new Error(`Operation ${e.name} unknown`);if(!this.serializer)throw new Error("Serializer is not defined");if(!this.id)throw new Error("Contract id is not defined");const t=this.abi.methods[e.name];let r=new Uint8Array(0);if(t.argument){if(!e.args)throw new Error(`No arguments defined for type '${t.argument}'`);r=await this.serializer.serialize(e.args,t.argument)}return{call_contract:{contract_id:(0,o.encodeBase58)(this.id),entry_point:t.entry_point,args:(0,o.encodeBase64url)(r)}}}async decodeOperation(e){if(!this.id)throw new Error("Contract id is not defined");if(!this.abi||!this.abi.methods)throw new Error("Methods are not defined");if(!this.serializer)throw new Error("Serializer is not defined");if(!e.call_contract)throw new Error("Operation is not CallContractOperation");if(e.call_contract.contract_id!==(0,o.encodeBase58)(this.id))throw new Error(`Invalid contract id. Expected: ${(0,o.encodeBase58)(this.id)}. Received: ${e.call_contract.contract_id}`);for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=void 0;const n=r(9104),o=r(8593);async function i(e){return new Promise((t=>setTimeout(t,e)))}class s{constructor(e){Array.isArray(e)?this.rpcNodes=e:this.rpcNodes=[e],this.currentNodeId=0,this.onError=()=>!0}async call(e,t){for(;;)try{const r={id:Math.round(1e3*Math.random()),jsonrpc:"2.0",method:e,params:t},n=this.rpcNodes[this.currentNodeId],o=await fetch(n,{method:"POST",body:JSON.stringify(r)}),i=await o.json();if(void 0!==i.result)return i.result;if(!i.error)throw new Error("undefined error");const{message:s,data:a}=i.error;if(!a)throw new Error(s);let c;try{c=JSON.parse(a)}catch(e){c={data:a}}throw new Error(JSON.stringify({...s&&{error:s},...c}))}catch(e){const t=this.rpcNodes[this.currentNodeId];this.currentNodeId=(this.currentNodeId+1)%this.rpcNodes.length;const r=this.rpcNodes[this.currentNodeId];if(this.onError(e,t,r))throw e}}async getNonce(e,t=!0){const{nonce:r}=await this.call("chain.get_account_nonce",{account:e});if(!t)return r;const i=(0,o.decodeBase64url)(r),s=n.koinos.chain.value_type.decode(i),a=n.koinos.chain.value_type.toObject(s,{longs:String,defaults:!0});return Number(a.uint64_value)}async getAccountRc(e){const{rc:t}=await this.call("chain.get_account_rc",{account:e});return t||"0"}async getTransactionsById(e){return this.call("transaction_store.get_transactions_by_id",{transaction_ids:e})}async getBlocksById(e){return this.call("block_store.get_blocks_by_id",{block_ids:e,return_block:!0,return_receipt:!1})}async getHeadInfo(){return this.call("chain.get_head_info",{})}async getChainId(){const{chain_id:e}=await this.call("chain.get_chain_id",{});return e}async getBlocks(e,t=1,r){let n=r;return n||(n=(await this.getHeadInfo()).head_topology.id),(await this.call("block_store.get_blocks_by_height",{head_block_id:n,ancestor_start_height:e,num_blocks:t,return_block:!0,return_receipt:!1})).block_items}async getBlock(e){return(await this.getBlocks(e,1))[0]}async wait(e,t="byBlock",r=15e3){const n=Date.now();if("byTransactionId"===t){for(;Date.now(){const o=await this.getBlocks(t,r,n);let i=0,s="";o.forEach((t=>{t&&t.block&&t.block_id&&t.block.transactions&&t.block.transactions.find((t=>t.id===e))&&(i=Number(t.block_height),s=t.block_id)}));const a=o[o.length-1].block_id;return[i,s,a]};let s=0,a=0,c="";for(;Date.now()Number(e.height))continue;const[t,r,n]=await o(s,1,e.id);if(t)return{blockId:r,blockNumber:t};c||(c=n),s+=1}throw new Error(`Transaction not mined after ${r} ms. Blocks checked from ${a} to ${s}`)}async sendTransaction(e,t=!0){const r=await this.call("chain.submit_transaction",{transaction:e,broadcast:t});return e.wait=async(t="byBlock",r=15e3)=>this.wait(e.id,t,r),{...r,transaction:e}}async submitBlock(e){return this.call("chain.submit_block",{block:e})}async readContract(e){return this.call("chain.read_contract",e)}}t.Provider=s,t.default=s},7187:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Serializer=void 0;const n=r(4492),o=r(8593),i="(koinos.btype)",s=["double","float","int32","int64","uint32","uint64","sint32","sint64","fixed32","fixed64","sfixed32","sfixed64","bool","string","bytes"];class a{constructor(e,t){this.bytesConversion=!0,this.verifyChecksum={serialize:!0,deserialize:!1},this.types=e,this.root=n.Root.fromJSON(this.types),(null==t?void 0:t.defaultTypeName)&&(this.defaultType=this.root.lookupType(t.defaultTypeName)),t&&void 0!==t.bytesConversion&&(this.bytesConversion=t.bytesConversion)}btypeDecode(e,t,r){const n={};return Object.keys(t.fields).forEach((a=>{const{options:c,name:l,type:u,rule:p}=t.fields[a];if(!e[l])return;const d={type:u};if(c&&(c["(btype)"]?d.btype=c["(btype)"]:c[i]&&(d.btype=c[i])),"repeated"!==p){if(!s.includes(u)){const t=this.root.lookupTypeOrEnum(u);return t.fields?void(n[l]=this.btypeDecode(e[l],t,r)):void(n[l]=e[l])}n[l]=(0,o.btypeDecodeValue)(e[l],d,r)}else n[l]=e[l].map((e=>{if(!s.includes(u)){const t=this.root.lookupTypeOrEnum(u);return t.fields?this.btypeDecode(e,t,r):e}return(0,o.btypeDecodeValue)(e,d,r)}))})),n}btypeEncode(e,t,r){const n={};return Object.keys(t.fields).forEach((a=>{const{options:c,name:l,type:u,rule:p}=t.fields[a];if(!e[l])return;const d={type:u};if(c&&(c["(btype)"]?d.btype=c["(btype)"]:c[i]&&(d.btype=c[i])),"repeated"!==p){if(!s.includes(u)){const t=this.root.lookupTypeOrEnum(u);return t.fields?void(n[l]=this.btypeEncode(e[l],t,r)):void(n[l]=e[l])}n[l]=(0,o.btypeEncodeValue)(e[l],d,r)}else n[l]=e[l].map((e=>{if(!s.includes(u)){const t=this.root.lookupTypeOrEnum(u);return t.fields?this.btypeEncode(e,t,r):e}return(0,o.btypeEncodeValue)(e,d,r)}))})),n}async serialize(e,t,r){const n=this.defaultType||this.root.lookupType(t);let o={};const i=void 0===(null==r?void 0:r.bytesConversion)?this.bytesConversion:r.bytesConversion,s=void 0===(null==r?void 0:r.verifyChecksum)?this.verifyChecksum.serialize:r.verifyChecksum;o=i?this.btypeDecode(e,n,s):e;const a=n.create(o);return n.encode(a).finish()}async deserialize(e,t,r){const n="string"==typeof e?(0,o.decodeBase64url)(e):e,i=this.defaultType||this.root.lookupType(t),s=i.decode(n),a=i.toObject(s,{longs:String,defaults:!0}),c=void 0===(null==r?void 0:r.bytesConversion)?this.bytesConversion:r.bytesConversion,l=void 0===(null==r?void 0:r.verifyChecksum)?this.verifyChecksum.deserialize:r.verifyChecksum;return c?this.btypeEncode(a,i,l):a}}t.Serializer=a,t.default=a},6991:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Signer=void 0;const s=r(3061),a=i(r(9656)),c=r(8593),l=r(9104),u={previous:{type:"bytes",btype:"BLOCK_ID"},height:{type:"uint64"},timestamp:{type:"uint64"},previous_state_merkle_root:{type:"bytes"},transaction_merkle_root:{type:"bytes"},signer:{type:"bytes",btype:"ADDRESS"}},p={chain_id:{type:"bytes"},rc_limit:{type:"uint64"},nonce:{type:"bytes"},operation_merkle_root:{type:"bytes"},payer:{type:"bytes",btype:"ADDRESS"},payee:{type:"bytes",btype:"ADDRESS"}},d={upload_contract:{type:"object",subtypes:{contract_id:{type:"bytes",btype:"CONTRACT_ID"},bytecode:{type:"bytes"},abi:{type:"string"},authorizes_call_contract:{type:"bool"},authorizes_transaction_application:{type:"bool"},authorizes_upload_contract:{type:"bool"}}},call_contract:{type:"object",subtypes:{contract_id:{type:"bytes",btype:"CONTRACT_ID"},entry_point:{type:"uint32"},args:{type:"bytes"}}},set_system_call:{type:"object",subtypes:{call_id:{type:"uint32"},target:{type:"object",subtypes:{thunk_id:{type:"uint32"},system_call_bundle:{type:"object",subtypes:{contract_id:{type:"bytes",btype:"CONTRACT_ID"},entry_point:{type:"uint32"}}}}}}},set_system_contract:{type:"object",subtypes:{contract_id:{type:"bytes",btype:"CONTRACT_ID"},system_contract:{type:"bool"}}}};class f{constructor(e){this.chainId="",this.compressed=void 0===e.compressed||e.compressed,this.privateKey=e.privateKey,this.provider=e.provider,e.privateKey,this.publicKey=a.getPublicKey(e.privateKey,this.compressed),this.address=(0,c.bitcoinAddress)(this.publicKey),e.chainId&&(this.chainId=e.chainId),this.sendOptions={broadcast:!0,...e.sendOptions}}static fromWif(e,t=!0){const r=void 0===t?"5"!==e[0]:t,n=(0,c.bitcoinDecode)(e);return new f({privateKey:(0,c.toHexString)(n),compressed:r})}static fromSeed(e,t=!0){const r=(0,s.sha256)(e);return new f({privateKey:r,compressed:t})}getAddress(e=!0){if("string"==typeof this.privateKey){const t=a.getPublicKey(this.privateKey,e);return(0,c.bitcoinAddress)(t)}const t=a.getPublicKey(this.privateKey,e);return(0,c.bitcoinAddress)(t)}getPrivateKey(e="hex",t=!1){let r;r=this.privateKey instanceof Uint8Array?(0,c.toHexString)(this.privateKey):"string"==typeof this.privateKey?this.privateKey:BigInt(this.privateKey).toString(16).padStart(64,"0");const n=void 0===t?this.compressed:t;switch(e){case"hex":return r;case"wif":return(0,c.bitcoinEncode)((0,c.toUint8Array)(r),"private",n);default:throw new Error(`Invalid format ${e}`)}}async signHash(e){const[t,r]=await a.sign(e,this.privateKey,{recovered:!0,canonical:!0,der:!1}),n=new Uint8Array(65);return n.set([r+31],0),n.set(t,1),n}async signMessage(e){return this.signHash((0,s.sha256)(e))}async signTransaction(e,t){if(!e.id)throw new Error("Missing transaction id");const r=(0,c.toUint8Array)(e.id.slice(6)),n=await this.signHash(r);return e.signatures||(e.signatures=[]),e.signatures.push((0,c.encodeBase64url)(n)),e}async signBlock(e){if(!e.id)throw new Error("Missing block id");const t=(0,c.toUint8Array)(e.id.slice(6)),r=await this.signHash(t);return e.signature=(0,c.encodeBase64url)(r),e}async sendTransaction(e,t){var r;if(e.signatures&&(null===(r=e.signatures)||void 0===r?void 0:r.length)||(e=await this.signTransaction(e)),!this.provider)throw new Error("provider is undefined");const n={...this.sendOptions,...t};return n.beforeSend&&await n.beforeSend(e),this.provider.sendTransaction(e,n.broadcast)}static recoverPublicKey(e,t,r=!0){const n=(0,c.toHexString)(t),o=Number(`0x${n.slice(0,2)}`)-31,i=n.slice(2,66),s=n.slice(66),l=BigInt(`0x${i}`),u=BigInt(`0x${s}`),p=new a.Signature(l,u),d=a.recoverPublicKey((0,c.toHexString)(e),p.toHex(),o);if(!d)throw new Error("Public key cannot be recovered");return r?a.Point.fromHex(d).toHex(!0):(0,c.toHexString)(d)}static recoverAddress(e,t,r=!0){return(0,c.bitcoinAddress)((0,c.toUint8Array)(f.recoverPublicKey(e,t,r)))}async recoverPublicKeys(e,t){let r=!0;t&&void 0!==t.compressed&&(r=t.compressed);let n,o=[];const i=e;if(i.signature){if(!i.header)throw new Error("Missing block header");if(!i.signature)throw new Error("Missing block signature");o=[i.signature];const e=(0,c.btypeDecode)(i.header,u,!1),t=l.koinos.protocol.block_header.create(e);n=l.koinos.protocol.block_header.encode(t).finish()}else{const t=e;if(!t.header)throw new Error("Missing transaction header");if(!t.signatures)throw new Error("Missing transaction signatures");o=t.signatures;const r=(0,c.btypeDecode)(t.header,p,!1),i=l.koinos.protocol.transaction_header.create(r);n=l.koinos.protocol.transaction_header.encode(i).finish()}const a=(0,s.sha256)(n);return Promise.all(o.map((async e=>(t&&"function"==typeof t.transformSignature&&(e=await t.transformSignature(e)),f.recoverPublicKey(a,(0,c.decodeBase64url)(e),r)))))}async recoverAddresses(e,t){return(await this.recoverPublicKeys(e,t)).map((e=>(0,c.bitcoinAddress)((0,c.toUint8Array)(e))))}async prepareTransaction(e){var t,r;e.header||(e.header={});const n=null!==(t=e.header.payer)&&void 0!==t?t:this.address,{payee:o}=e.header;let i,a;if(void 0===e.header.nonce){if(!this.provider)throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the transaction header");const e=await this.provider.getNonce(o||n),t=l.koinos.chain.value_type.create({uint64_value:String(e+1)}),r=l.koinos.chain.value_type.encode(t).finish();i=(0,c.encodeBase64url)(r)}else i=e.header.nonce;if(void 0===e.header.rc_limit){if(!this.provider)throw new Error("Cannot get the rc_limit because provider is undefined. To skip this call set a rc_limit in the transaction header");a=await this.provider.getAccountRc(n)}else a=e.header.rc_limit;let u=e.header.chain_id||this.chainId;if(!u){if(!this.provider)throw new Error("Cannot get the chain_id because provider is undefined. To skip this call set a chain_id in the Signer");u=await this.provider.getChainId(),this.chainId=u}const f=[];if(e.operations)for(let t=0;t<(null===(r=e.operations)||void 0===r?void 0:r.length);t+=1){const r=(0,c.btypeDecode)(e.operations[t],d,!1),n=l.koinos.protocol.operation.create(r),o=l.koinos.protocol.operation.encode(n).finish();f.push((0,s.sha256)(o))}const h=(0,c.encodeBase64url)(new Uint8Array([18,32,...(0,c.calculateMerkleRoot)(f)]));e.header={chain_id:u,rc_limit:a,nonce:i,operation_merkle_root:h,payer:n,...o&&{payee:o}};const y=(0,c.btypeDecode)(e.header,p,!1),_=l.koinos.protocol.transaction_header.create(y),g=l.koinos.protocol.transaction_header.encode(_).finish(),b=(0,s.sha256)(g);return e.id=`0x1220${(0,c.toHexString)(b)}`,e}async prepareBlock(e){var t;e.header||(e.header={});const r=[];if(e.transactions)for(let n=0;n{d=new Uint8Array([...d,...(0,c.decodeBase64url)(e)])})),r.push((0,s.sha256)(d))}let{height:n,previous:o,previous_state_merkle_root:i}=e.header;if(!n||!o||!i){if(!this.provider)throw new Error("Cannot get the head info because provider is undefined.");const e=await this.provider.getHeadInfo();n=n||`${Number(e.head_topology.height)+1}`,o=o||e.head_topology.id,i=i||e.head_state_merkle_root}e.header={height:n,previous:o,previous_state_merkle_root:i,timestamp:e.header.timestamp||`${Date.now()}`,transaction_merkle_root:(0,c.encodeBase64url)(new Uint8Array([18,32,...(0,c.calculateMerkleRoot)(r)])),signer:this.address};const a=(0,c.btypeDecode)(e.header,u,!1),d=l.koinos.protocol.block_header.create(a),f=l.koinos.protocol.block_header.encode(d).finish(),h=(0,s.sha256)(f);return e.id=`0x1220${(0,c.toHexString)(h)}`,e}}t.Signer=f,t.default=f},5738:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const s=i(r(8593)),a=r(9822),c=r(6991),l=r(5635),u=r(7187);window.utils=s,window.Contract=a.Contract,window.Signer=c.Signer,window.Provider=l.Provider,window.Serializer=u.Serializer},8593:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.tokenAbi=t.btypeEncode=t.btypeDecode=t.btypeEncodeValue=t.btypeDecodeValue=t.parseUnits=t.formatUnits=t.isChecksumWif=t.isChecksumAddress=t.isChecksum=t.bitcoinAddress=t.bitcoinDecode=t.bitcoinEncode=t.calculateMerkleRoot=t.decodeBase64=t.multihash=t.encodeBase64=t.decodeBase64url=t.encodeBase64url=t.decodeBase58=t.encodeBase58=t.toHexString=t.toUint8Array=void 0;const a=i(r(6957)),c=r(3061),l=r(830),u=s(r(6567));function p(e){const t=e.match(/[\dA-F]{2}/gi);if(!t)throw new Error("Invalid hex");return new Uint8Array(t.map((e=>parseInt(e,16))))}function d(e){return Array.from(e).map((e=>`0${Number(e).toString(16)}`.slice(-2))).join("")}function f(e){return(new TextDecoder).decode(a.encode("z",e)).slice(1)}function h(e){return a.decode(`z${e}`)}function y(e){return(new TextDecoder).decode(a.encode("U",e)).slice(1)}function _(e){return a.decode(`U${e}`)}function g(e,t,r=!1){let n,o,i;"public"===t?(n=new Uint8Array(25),o=new Uint8Array(21),n[0]=0,o[0]=0,i=21):(r?(n=new Uint8Array(38),o=new Uint8Array(34),i=34,n[33]=1,o[33]=1):(n=new Uint8Array(37),o=new Uint8Array(33),i=33),n[0]=128,o[0]=128),o.set(e,1);const s=(0,c.sha256)(o),a=(0,c.sha256)(s),l=new Uint8Array(4);return l.set(a.slice(0,4)),n.set(e,1),n.set(l,i),f(n)}function b(e){const t=e.length-4,r=new Uint8Array(t);r.set(e.slice(0,t));const n=new Uint8Array(4);n.set(e.slice(t));const o=(0,c.sha256)((0,c.sha256)(r));for(let e=0;e<4;e+=1)if(n[e]!==o[e])return!1;return!0}function m(e){const t="string"==typeof e?h(e):e;return 25===t.length&&0===t[0]&&b(t)}function v(e){return"string"==typeof e||"number"==typeof e?e:JSON.parse(JSON.stringify(e))}function w(e,t,r){if("bytes"!==t.type)return v(e);const n=e;if(!t.btype)return _(n);switch(t.btype){case"BASE58":return h(n);case"CONTRACT_ID":case"ADDRESS":const e=h(n);if(r&&!m(e))throw new Error(`${n} is an invalid address`);return e;case"BASE64":return _(n);case"HEX":case"BLOCK_ID":case"TRANSACTION_ID":return p(n.slice(2));default:throw new Error(`unknown btype ${t.btype}`)}}function k(e,t,r){if("bytes"!==t.type)return v(e);const n=e;if(!t.btype)return y(n);switch(t.btype){case"BASE58":return f(n);case"CONTRACT_ID":case"ADDRESS":const e=f(n);if(r&&!m(n))throw new Error(`${e} is an invalid address`);return e;case"BASE64":return y(n);case"HEX":case"BLOCK_ID":case"TRANSACTION_ID":return`0x${d(n)}`;default:throw new Error(`unknown btype ${t.btype}`)}}t.toUint8Array=p,t.toHexString=d,t.encodeBase58=f,t.decodeBase58=h,t.encodeBase64url=y,t.decodeBase64url=_,t.encodeBase64=function(e){return(new TextDecoder).decode(a.encode("M",e)).slice(1)},t.multihash=function(e,t="sha2-256"){switch(t){case"sha2-256":return new Uint8Array([18,e.length,...e]);default:throw new Error(`multihash code ${t} not supported`)}},t.decodeBase64=function(e){return a.decode(`M${e}`)},t.calculateMerkleRoot=function(e){if(!e.length)return(0,c.sha256)(new Uint8Array);for(;e.length>1;){for(let t=0;t{t[i]&&("repeated"===r[i].rule?o[i]=t[i].map((t=>r[i].subtypes?e(t,r[i].subtypes,n):w(t,r[i],n))):r[i].subtypes?o[i]=e(t[i],r[i].subtypes,n):o[i]=w(t[i],r[i],n))})),o},t.btypeEncode=function e(t,r,n){if("object"!=typeof t)return t;const o={};return Object.keys(r).forEach((i=>{t[i]&&("repeated"===r[i].rule?o[i]=t[i].map((t=>r[i].subtypes?e(t,r[i].subtypes,n):k(t,r[i],n))):r[i].subtypes?o[i]=e(t[i],r[i].subtypes,n):o[i]=k(t[i],r[i],n))})),o},t.tokenAbi={methods:{name:{entry_point:2191741823,argument:"name_arguments",return:"name_result",read_only:!0},symbol:{entry_point:3077209249,argument:"symbol_arguments",return:"symbol_result",read_only:!0},decimals:{entry_point:4001430831,argument:"decimals_arguments",return:"decimals_result",read_only:!0},totalSupply:{entry_point:2967091508,argument:"total_supply_arguments",return:"total_supply_result",read_only:!0},balanceOf:{entry_point:1550980247,argument:"balance_of_arguments",return:"balance_of_result",read_only:!0,default_output:{value:"0"}},transfer:{entry_point:670398154,argument:"transfer_arguments",return:"transfer_result"},mint:{entry_point:3698268091,argument:"mint_arguments",return:"mint_result"},burn:{entry_point:2241834181,argument:"burn_arguments",return:"burn_result"}},koilib_types:u.default}},9104:function(e,t,r){var n,o,i;o=[r(2100)],void 0===(i="function"==typeof(n=function(e){"use strict";var t,r,n,o,i,s=e.Reader,a=e.Writer,c=e.util,l=e.roots.default||(e.roots.default={});return l.koinos=((i={}).protocol=((n={}).event_data=function(){function t(e){if(this.impacted=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.sequence=e.uint32();break;case 2:n.source=e.bytes();break;case 3:n.name=e.string();break;case 4:n.data=e.bytes();break;case 5:n.impacted&&n.impacted.length||(n.impacted=[]),n.impacted.push(e.bytes());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.sequence&&e.hasOwnProperty("sequence")&&!c.isInteger(e.sequence))return"sequence: integer expected";if(null!=e.source&&e.hasOwnProperty("source")&&!(e.source&&"number"==typeof e.source.length||c.isString(e.source)))return"source: buffer expected";if(null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name))return"name: string expected";if(null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||c.isString(e.data)))return"data: buffer expected";if(null!=e.impacted&&e.hasOwnProperty("impacted")){if(!Array.isArray(e.impacted))return"impacted: array expected";for(var t=0;t>>0),null!=e.source&&("string"==typeof e.source?c.base64.decode(e.source,t.source=c.newBuffer(c.base64.length(e.source)),0):e.source.length>=0&&(t.source=e.source)),null!=e.name&&(t.name=String(e.name)),null!=e.data&&("string"==typeof e.data?c.base64.decode(e.data,t.data=c.newBuffer(c.base64.length(e.data)),0):e.data.length>=0&&(t.data=e.data)),e.impacted){if(!Array.isArray(e.impacted))throw TypeError(".koinos.protocol.event_data.impacted: array expected");t.impacted=[];for(var r=0;r=0&&(t.impacted[r]=e.impacted[r])}return t},t.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.impacted=[]),t.defaults&&(r.sequence=0,t.bytes===String?r.source="":(r.source=[],t.bytes!==Array&&(r.source=c.newBuffer(r.source))),r.name="",t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=c.newBuffer(r.data)))),null!=e.sequence&&e.hasOwnProperty("sequence")&&(r.sequence=e.sequence),null!=e.source&&e.hasOwnProperty("source")&&(r.source=t.bytes===String?c.base64.encode(e.source,0,e.source.length):t.bytes===Array?Array.prototype.slice.call(e.source):e.source),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?c.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),e.impacted&&e.impacted.length){r.impacted=[];for(var n=0;n>>3){case 1:n.contract_id=e.bytes();break;case 2:n.entry_point=e.uint32();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.contract_id&&e.hasOwnProperty("contract_id")&&!(e.contract_id&&"number"==typeof e.contract_id.length||c.isString(e.contract_id))?"contract_id: buffer expected":null!=e.entry_point&&e.hasOwnProperty("entry_point")&&!c.isInteger(e.entry_point)?"entry_point: integer expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.contract_call_bundle)return e;var t=new l.koinos.protocol.contract_call_bundle;return null!=e.contract_id&&("string"==typeof e.contract_id?c.base64.decode(e.contract_id,t.contract_id=c.newBuffer(c.base64.length(e.contract_id)),0):e.contract_id.length>=0&&(t.contract_id=e.contract_id)),null!=e.entry_point&&(t.entry_point=e.entry_point>>>0),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.contract_id="":(r.contract_id=[],t.bytes!==Array&&(r.contract_id=c.newBuffer(r.contract_id))),r.entry_point=0),null!=e.contract_id&&e.hasOwnProperty("contract_id")&&(r.contract_id=t.bytes===String?c.base64.encode(e.contract_id,0,e.contract_id.length):t.bytes===Array?Array.prototype.slice.call(e.contract_id):e.contract_id),null!=e.entry_point&&e.hasOwnProperty("entry_point")&&(r.entry_point=e.entry_point),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.contract_call_bundle"},t}(),n.system_call_target=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.thunk_id=e.uint32();break;case 2:n.system_call_bundle=l.koinos.protocol.contract_call_bundle.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.thunk_id&&e.hasOwnProperty("thunk_id")&&(t.target=1,!c.isInteger(e.thunk_id)))return"thunk_id: integer expected";if(null!=e.system_call_bundle&&e.hasOwnProperty("system_call_bundle")){if(1===t.target)return"target: multiple values";t.target=1;var r=l.koinos.protocol.contract_call_bundle.verify(e.system_call_bundle);if(r)return"system_call_bundle."+r}return null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.system_call_target)return e;var t=new l.koinos.protocol.system_call_target;if(null!=e.thunk_id&&(t.thunk_id=e.thunk_id>>>0),null!=e.system_call_bundle){if("object"!=typeof e.system_call_bundle)throw TypeError(".koinos.protocol.system_call_target.system_call_bundle: object expected");t.system_call_bundle=l.koinos.protocol.contract_call_bundle.fromObject(e.system_call_bundle)}return t},t.toObject=function(e,t){t||(t={});var r={};return null!=e.thunk_id&&e.hasOwnProperty("thunk_id")&&(r.thunk_id=e.thunk_id,t.oneofs&&(r.target="thunk_id")),null!=e.system_call_bundle&&e.hasOwnProperty("system_call_bundle")&&(r.system_call_bundle=l.koinos.protocol.contract_call_bundle.toObject(e.system_call_bundle,t),t.oneofs&&(r.target="system_call_bundle")),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.system_call_target"},t}(),n.upload_contract_operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.contract_id=e.bytes();break;case 2:n.bytecode=e.bytes();break;case 3:n.abi=e.string();break;case 4:n.authorizes_call_contract=e.bool();break;case 5:n.authorizes_transaction_application=e.bool();break;case 6:n.authorizes_upload_contract=e.bool();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.contract_id&&e.hasOwnProperty("contract_id")&&!(e.contract_id&&"number"==typeof e.contract_id.length||c.isString(e.contract_id))?"contract_id: buffer expected":null!=e.bytecode&&e.hasOwnProperty("bytecode")&&!(e.bytecode&&"number"==typeof e.bytecode.length||c.isString(e.bytecode))?"bytecode: buffer expected":null!=e.abi&&e.hasOwnProperty("abi")&&!c.isString(e.abi)?"abi: string expected":null!=e.authorizes_call_contract&&e.hasOwnProperty("authorizes_call_contract")&&"boolean"!=typeof e.authorizes_call_contract?"authorizes_call_contract: boolean expected":null!=e.authorizes_transaction_application&&e.hasOwnProperty("authorizes_transaction_application")&&"boolean"!=typeof e.authorizes_transaction_application?"authorizes_transaction_application: boolean expected":null!=e.authorizes_upload_contract&&e.hasOwnProperty("authorizes_upload_contract")&&"boolean"!=typeof e.authorizes_upload_contract?"authorizes_upload_contract: boolean expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.upload_contract_operation)return e;var t=new l.koinos.protocol.upload_contract_operation;return null!=e.contract_id&&("string"==typeof e.contract_id?c.base64.decode(e.contract_id,t.contract_id=c.newBuffer(c.base64.length(e.contract_id)),0):e.contract_id.length>=0&&(t.contract_id=e.contract_id)),null!=e.bytecode&&("string"==typeof e.bytecode?c.base64.decode(e.bytecode,t.bytecode=c.newBuffer(c.base64.length(e.bytecode)),0):e.bytecode.length>=0&&(t.bytecode=e.bytecode)),null!=e.abi&&(t.abi=String(e.abi)),null!=e.authorizes_call_contract&&(t.authorizes_call_contract=Boolean(e.authorizes_call_contract)),null!=e.authorizes_transaction_application&&(t.authorizes_transaction_application=Boolean(e.authorizes_transaction_application)),null!=e.authorizes_upload_contract&&(t.authorizes_upload_contract=Boolean(e.authorizes_upload_contract)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.contract_id="":(r.contract_id=[],t.bytes!==Array&&(r.contract_id=c.newBuffer(r.contract_id))),t.bytes===String?r.bytecode="":(r.bytecode=[],t.bytes!==Array&&(r.bytecode=c.newBuffer(r.bytecode))),r.abi="",r.authorizes_call_contract=!1,r.authorizes_transaction_application=!1,r.authorizes_upload_contract=!1),null!=e.contract_id&&e.hasOwnProperty("contract_id")&&(r.contract_id=t.bytes===String?c.base64.encode(e.contract_id,0,e.contract_id.length):t.bytes===Array?Array.prototype.slice.call(e.contract_id):e.contract_id),null!=e.bytecode&&e.hasOwnProperty("bytecode")&&(r.bytecode=t.bytes===String?c.base64.encode(e.bytecode,0,e.bytecode.length):t.bytes===Array?Array.prototype.slice.call(e.bytecode):e.bytecode),null!=e.abi&&e.hasOwnProperty("abi")&&(r.abi=e.abi),null!=e.authorizes_call_contract&&e.hasOwnProperty("authorizes_call_contract")&&(r.authorizes_call_contract=e.authorizes_call_contract),null!=e.authorizes_transaction_application&&e.hasOwnProperty("authorizes_transaction_application")&&(r.authorizes_transaction_application=e.authorizes_transaction_application),null!=e.authorizes_upload_contract&&e.hasOwnProperty("authorizes_upload_contract")&&(r.authorizes_upload_contract=e.authorizes_upload_contract),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.upload_contract_operation"},t}(),n.call_contract_operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.contract_id=e.bytes();break;case 2:n.entry_point=e.uint32();break;case 3:n.args=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.contract_id&&e.hasOwnProperty("contract_id")&&!(e.contract_id&&"number"==typeof e.contract_id.length||c.isString(e.contract_id))?"contract_id: buffer expected":null!=e.entry_point&&e.hasOwnProperty("entry_point")&&!c.isInteger(e.entry_point)?"entry_point: integer expected":null!=e.args&&e.hasOwnProperty("args")&&!(e.args&&"number"==typeof e.args.length||c.isString(e.args))?"args: buffer expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.call_contract_operation)return e;var t=new l.koinos.protocol.call_contract_operation;return null!=e.contract_id&&("string"==typeof e.contract_id?c.base64.decode(e.contract_id,t.contract_id=c.newBuffer(c.base64.length(e.contract_id)),0):e.contract_id.length>=0&&(t.contract_id=e.contract_id)),null!=e.entry_point&&(t.entry_point=e.entry_point>>>0),null!=e.args&&("string"==typeof e.args?c.base64.decode(e.args,t.args=c.newBuffer(c.base64.length(e.args)),0):e.args.length>=0&&(t.args=e.args)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.contract_id="":(r.contract_id=[],t.bytes!==Array&&(r.contract_id=c.newBuffer(r.contract_id))),r.entry_point=0,t.bytes===String?r.args="":(r.args=[],t.bytes!==Array&&(r.args=c.newBuffer(r.args)))),null!=e.contract_id&&e.hasOwnProperty("contract_id")&&(r.contract_id=t.bytes===String?c.base64.encode(e.contract_id,0,e.contract_id.length):t.bytes===Array?Array.prototype.slice.call(e.contract_id):e.contract_id),null!=e.entry_point&&e.hasOwnProperty("entry_point")&&(r.entry_point=e.entry_point),null!=e.args&&e.hasOwnProperty("args")&&(r.args=t.bytes===String?c.base64.encode(e.args,0,e.args.length):t.bytes===Array?Array.prototype.slice.call(e.args):e.args),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.call_contract_operation"},t}(),n.set_system_call_operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.call_id=e.uint32();break;case 2:n.target=l.koinos.protocol.system_call_target.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.call_id&&e.hasOwnProperty("call_id")&&!c.isInteger(e.call_id))return"call_id: integer expected";if(null!=e.target&&e.hasOwnProperty("target")){var t=l.koinos.protocol.system_call_target.verify(e.target);if(t)return"target."+t}return null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.set_system_call_operation)return e;var t=new l.koinos.protocol.set_system_call_operation;if(null!=e.call_id&&(t.call_id=e.call_id>>>0),null!=e.target){if("object"!=typeof e.target)throw TypeError(".koinos.protocol.set_system_call_operation.target: object expected");t.target=l.koinos.protocol.system_call_target.fromObject(e.target)}return t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.call_id=0,r.target=null),null!=e.call_id&&e.hasOwnProperty("call_id")&&(r.call_id=e.call_id),null!=e.target&&e.hasOwnProperty("target")&&(r.target=l.koinos.protocol.system_call_target.toObject(e.target,t)),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.set_system_call_operation"},t}(),n.set_system_contract_operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.contract_id=e.bytes();break;case 2:n.system_contract=e.bool();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.contract_id&&e.hasOwnProperty("contract_id")&&!(e.contract_id&&"number"==typeof e.contract_id.length||c.isString(e.contract_id))?"contract_id: buffer expected":null!=e.system_contract&&e.hasOwnProperty("system_contract")&&"boolean"!=typeof e.system_contract?"system_contract: boolean expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.set_system_contract_operation)return e;var t=new l.koinos.protocol.set_system_contract_operation;return null!=e.contract_id&&("string"==typeof e.contract_id?c.base64.decode(e.contract_id,t.contract_id=c.newBuffer(c.base64.length(e.contract_id)),0):e.contract_id.length>=0&&(t.contract_id=e.contract_id)),null!=e.system_contract&&(t.system_contract=Boolean(e.system_contract)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.contract_id="":(r.contract_id=[],t.bytes!==Array&&(r.contract_id=c.newBuffer(r.contract_id))),r.system_contract=!1),null!=e.contract_id&&e.hasOwnProperty("contract_id")&&(r.contract_id=t.bytes===String?c.base64.encode(e.contract_id,0,e.contract_id.length):t.bytes===Array?Array.prototype.slice.call(e.contract_id):e.contract_id),null!=e.system_contract&&e.hasOwnProperty("system_contract")&&(r.system_contract=e.system_contract),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.set_system_contract_operation"},t}(),n.operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.upload_contract=l.koinos.protocol.upload_contract_operation.decode(e,e.uint32());break;case 2:n.call_contract=l.koinos.protocol.call_contract_operation.decode(e,e.uint32());break;case 3:n.set_system_call=l.koinos.protocol.set_system_call_operation.decode(e,e.uint32());break;case 4:n.set_system_contract=l.koinos.protocol.set_system_contract_operation.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.upload_contract&&e.hasOwnProperty("upload_contract")&&(t.op=1,r=l.koinos.protocol.upload_contract_operation.verify(e.upload_contract)))return"upload_contract."+r;if(null!=e.call_contract&&e.hasOwnProperty("call_contract")){if(1===t.op)return"op: multiple values";if(t.op=1,r=l.koinos.protocol.call_contract_operation.verify(e.call_contract))return"call_contract."+r}if(null!=e.set_system_call&&e.hasOwnProperty("set_system_call")){if(1===t.op)return"op: multiple values";if(t.op=1,r=l.koinos.protocol.set_system_call_operation.verify(e.set_system_call))return"set_system_call."+r}if(null!=e.set_system_contract&&e.hasOwnProperty("set_system_contract")){if(1===t.op)return"op: multiple values";var r;if(t.op=1,r=l.koinos.protocol.set_system_contract_operation.verify(e.set_system_contract))return"set_system_contract."+r}return null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.operation)return e;var t=new l.koinos.protocol.operation;if(null!=e.upload_contract){if("object"!=typeof e.upload_contract)throw TypeError(".koinos.protocol.operation.upload_contract: object expected");t.upload_contract=l.koinos.protocol.upload_contract_operation.fromObject(e.upload_contract)}if(null!=e.call_contract){if("object"!=typeof e.call_contract)throw TypeError(".koinos.protocol.operation.call_contract: object expected");t.call_contract=l.koinos.protocol.call_contract_operation.fromObject(e.call_contract)}if(null!=e.set_system_call){if("object"!=typeof e.set_system_call)throw TypeError(".koinos.protocol.operation.set_system_call: object expected");t.set_system_call=l.koinos.protocol.set_system_call_operation.fromObject(e.set_system_call)}if(null!=e.set_system_contract){if("object"!=typeof e.set_system_contract)throw TypeError(".koinos.protocol.operation.set_system_contract: object expected");t.set_system_contract=l.koinos.protocol.set_system_contract_operation.fromObject(e.set_system_contract)}return t},t.toObject=function(e,t){t||(t={});var r={};return null!=e.upload_contract&&e.hasOwnProperty("upload_contract")&&(r.upload_contract=l.koinos.protocol.upload_contract_operation.toObject(e.upload_contract,t),t.oneofs&&(r.op="upload_contract")),null!=e.call_contract&&e.hasOwnProperty("call_contract")&&(r.call_contract=l.koinos.protocol.call_contract_operation.toObject(e.call_contract,t),t.oneofs&&(r.op="call_contract")),null!=e.set_system_call&&e.hasOwnProperty("set_system_call")&&(r.set_system_call=l.koinos.protocol.set_system_call_operation.toObject(e.set_system_call,t),t.oneofs&&(r.op="set_system_call")),null!=e.set_system_contract&&e.hasOwnProperty("set_system_contract")&&(r.set_system_contract=l.koinos.protocol.set_system_contract_operation.toObject(e.set_system_contract,t),t.oneofs&&(r.op="set_system_contract")),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.operation"},t}(),n.transaction_header=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.chain_id=e.bytes();break;case 2:n.rc_limit=e.uint64();break;case 3:n.nonce=e.bytes();break;case 4:n.operation_merkle_root=e.bytes();break;case 5:n.payer=e.bytes();break;case 6:n.payee=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.chain_id&&e.hasOwnProperty("chain_id")&&!(e.chain_id&&"number"==typeof e.chain_id.length||c.isString(e.chain_id))?"chain_id: buffer expected":null!=e.rc_limit&&e.hasOwnProperty("rc_limit")&&!(c.isInteger(e.rc_limit)||e.rc_limit&&c.isInteger(e.rc_limit.low)&&c.isInteger(e.rc_limit.high))?"rc_limit: integer|Long expected":null!=e.nonce&&e.hasOwnProperty("nonce")&&!(e.nonce&&"number"==typeof e.nonce.length||c.isString(e.nonce))?"nonce: buffer expected":null!=e.operation_merkle_root&&e.hasOwnProperty("operation_merkle_root")&&!(e.operation_merkle_root&&"number"==typeof e.operation_merkle_root.length||c.isString(e.operation_merkle_root))?"operation_merkle_root: buffer expected":null!=e.payer&&e.hasOwnProperty("payer")&&!(e.payer&&"number"==typeof e.payer.length||c.isString(e.payer))?"payer: buffer expected":null!=e.payee&&e.hasOwnProperty("payee")&&!(e.payee&&"number"==typeof e.payee.length||c.isString(e.payee))?"payee: buffer expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.transaction_header)return e;var t=new l.koinos.protocol.transaction_header;return null!=e.chain_id&&("string"==typeof e.chain_id?c.base64.decode(e.chain_id,t.chain_id=c.newBuffer(c.base64.length(e.chain_id)),0):e.chain_id.length>=0&&(t.chain_id=e.chain_id)),null!=e.rc_limit&&(c.Long?(t.rc_limit=c.Long.fromValue(e.rc_limit)).unsigned=!0:"string"==typeof e.rc_limit?t.rc_limit=parseInt(e.rc_limit,10):"number"==typeof e.rc_limit?t.rc_limit=e.rc_limit:"object"==typeof e.rc_limit&&(t.rc_limit=new c.LongBits(e.rc_limit.low>>>0,e.rc_limit.high>>>0).toNumber(!0))),null!=e.nonce&&("string"==typeof e.nonce?c.base64.decode(e.nonce,t.nonce=c.newBuffer(c.base64.length(e.nonce)),0):e.nonce.length>=0&&(t.nonce=e.nonce)),null!=e.operation_merkle_root&&("string"==typeof e.operation_merkle_root?c.base64.decode(e.operation_merkle_root,t.operation_merkle_root=c.newBuffer(c.base64.length(e.operation_merkle_root)),0):e.operation_merkle_root.length>=0&&(t.operation_merkle_root=e.operation_merkle_root)),null!=e.payer&&("string"==typeof e.payer?c.base64.decode(e.payer,t.payer=c.newBuffer(c.base64.length(e.payer)),0):e.payer.length>=0&&(t.payer=e.payer)),null!=e.payee&&("string"==typeof e.payee?c.base64.decode(e.payee,t.payee=c.newBuffer(c.base64.length(e.payee)),0):e.payee.length>=0&&(t.payee=e.payee)),t},t.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if(t.bytes===String?r.chain_id="":(r.chain_id=[],t.bytes!==Array&&(r.chain_id=c.newBuffer(r.chain_id))),c.Long){var n=new c.Long(0,0,!0);r.rc_limit=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.rc_limit=t.longs===String?"0":0;t.bytes===String?r.nonce="":(r.nonce=[],t.bytes!==Array&&(r.nonce=c.newBuffer(r.nonce))),t.bytes===String?r.operation_merkle_root="":(r.operation_merkle_root=[],t.bytes!==Array&&(r.operation_merkle_root=c.newBuffer(r.operation_merkle_root))),t.bytes===String?r.payer="":(r.payer=[],t.bytes!==Array&&(r.payer=c.newBuffer(r.payer))),t.bytes===String?r.payee="":(r.payee=[],t.bytes!==Array&&(r.payee=c.newBuffer(r.payee)))}return null!=e.chain_id&&e.hasOwnProperty("chain_id")&&(r.chain_id=t.bytes===String?c.base64.encode(e.chain_id,0,e.chain_id.length):t.bytes===Array?Array.prototype.slice.call(e.chain_id):e.chain_id),null!=e.rc_limit&&e.hasOwnProperty("rc_limit")&&("number"==typeof e.rc_limit?r.rc_limit=t.longs===String?String(e.rc_limit):e.rc_limit:r.rc_limit=t.longs===String?c.Long.prototype.toString.call(e.rc_limit):t.longs===Number?new c.LongBits(e.rc_limit.low>>>0,e.rc_limit.high>>>0).toNumber(!0):e.rc_limit),null!=e.nonce&&e.hasOwnProperty("nonce")&&(r.nonce=t.bytes===String?c.base64.encode(e.nonce,0,e.nonce.length):t.bytes===Array?Array.prototype.slice.call(e.nonce):e.nonce),null!=e.operation_merkle_root&&e.hasOwnProperty("operation_merkle_root")&&(r.operation_merkle_root=t.bytes===String?c.base64.encode(e.operation_merkle_root,0,e.operation_merkle_root.length):t.bytes===Array?Array.prototype.slice.call(e.operation_merkle_root):e.operation_merkle_root),null!=e.payer&&e.hasOwnProperty("payer")&&(r.payer=t.bytes===String?c.base64.encode(e.payer,0,e.payer.length):t.bytes===Array?Array.prototype.slice.call(e.payer):e.payer),null!=e.payee&&e.hasOwnProperty("payee")&&(r.payee=t.bytes===String?c.base64.encode(e.payee,0,e.payee.length):t.bytes===Array?Array.prototype.slice.call(e.payee):e.payee),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.transaction_header"},t}(),n.transaction=function(){function t(e){if(this.operations=[],this.signatures=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.id=e.bytes();break;case 2:n.header=l.koinos.protocol.transaction_header.decode(e,e.uint32());break;case 3:n.operations&&n.operations.length||(n.operations=[]),n.operations.push(l.koinos.protocol.operation.decode(e,e.uint32()));break;case 4:n.signatures&&n.signatures.length||(n.signatures=[]),n.signatures.push(e.bytes());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!(e.id&&"number"==typeof e.id.length||c.isString(e.id)))return"id: buffer expected";if(null!=e.header&&e.hasOwnProperty("header")&&(r=l.koinos.protocol.transaction_header.verify(e.header)))return"header."+r;if(null!=e.operations&&e.hasOwnProperty("operations")){if(!Array.isArray(e.operations))return"operations: array expected";for(var t=0;t=0&&(t.id=e.id)),null!=e.header){if("object"!=typeof e.header)throw TypeError(".koinos.protocol.transaction.header: object expected");t.header=l.koinos.protocol.transaction_header.fromObject(e.header)}if(e.operations){if(!Array.isArray(e.operations))throw TypeError(".koinos.protocol.transaction.operations: array expected");t.operations=[];for(var r=0;r=0&&(t.signatures[r]=e.signatures[r])}return t},t.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.operations=[],r.signatures=[]),t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=c.newBuffer(r.id))),r.header=null),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?c.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.header&&e.hasOwnProperty("header")&&(r.header=l.koinos.protocol.transaction_header.toObject(e.header,t)),e.operations&&e.operations.length){r.operations=[];for(var n=0;n>>3){case 1:n.id=e.bytes();break;case 2:n.payer=e.bytes();break;case 3:n.max_payer_rc=e.uint64();break;case 4:n.rc_limit=e.uint64();break;case 5:n.rc_used=e.uint64();break;case 6:n.disk_storage_used=e.uint64();break;case 7:n.network_bandwidth_used=e.uint64();break;case 8:n.compute_bandwidth_used=e.uint64();break;case 9:n.reverted=e.bool();break;case 10:n.events&&n.events.length||(n.events=[]),n.events.push(l.koinos.protocol.event_data.decode(e,e.uint32()));break;case 11:n.logs&&n.logs.length||(n.logs=[]),n.logs.push(e.string());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!(e.id&&"number"==typeof e.id.length||c.isString(e.id)))return"id: buffer expected";if(null!=e.payer&&e.hasOwnProperty("payer")&&!(e.payer&&"number"==typeof e.payer.length||c.isString(e.payer)))return"payer: buffer expected";if(null!=e.max_payer_rc&&e.hasOwnProperty("max_payer_rc")&&!(c.isInteger(e.max_payer_rc)||e.max_payer_rc&&c.isInteger(e.max_payer_rc.low)&&c.isInteger(e.max_payer_rc.high)))return"max_payer_rc: integer|Long expected";if(null!=e.rc_limit&&e.hasOwnProperty("rc_limit")&&!(c.isInteger(e.rc_limit)||e.rc_limit&&c.isInteger(e.rc_limit.low)&&c.isInteger(e.rc_limit.high)))return"rc_limit: integer|Long expected";if(null!=e.rc_used&&e.hasOwnProperty("rc_used")&&!(c.isInteger(e.rc_used)||e.rc_used&&c.isInteger(e.rc_used.low)&&c.isInteger(e.rc_used.high)))return"rc_used: integer|Long expected";if(null!=e.disk_storage_used&&e.hasOwnProperty("disk_storage_used")&&!(c.isInteger(e.disk_storage_used)||e.disk_storage_used&&c.isInteger(e.disk_storage_used.low)&&c.isInteger(e.disk_storage_used.high)))return"disk_storage_used: integer|Long expected";if(null!=e.network_bandwidth_used&&e.hasOwnProperty("network_bandwidth_used")&&!(c.isInteger(e.network_bandwidth_used)||e.network_bandwidth_used&&c.isInteger(e.network_bandwidth_used.low)&&c.isInteger(e.network_bandwidth_used.high)))return"network_bandwidth_used: integer|Long expected";if(null!=e.compute_bandwidth_used&&e.hasOwnProperty("compute_bandwidth_used")&&!(c.isInteger(e.compute_bandwidth_used)||e.compute_bandwidth_used&&c.isInteger(e.compute_bandwidth_used.low)&&c.isInteger(e.compute_bandwidth_used.high)))return"compute_bandwidth_used: integer|Long expected";if(null!=e.reverted&&e.hasOwnProperty("reverted")&&"boolean"!=typeof e.reverted)return"reverted: boolean expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(var t=0;t=0&&(t.id=e.id)),null!=e.payer&&("string"==typeof e.payer?c.base64.decode(e.payer,t.payer=c.newBuffer(c.base64.length(e.payer)),0):e.payer.length>=0&&(t.payer=e.payer)),null!=e.max_payer_rc&&(c.Long?(t.max_payer_rc=c.Long.fromValue(e.max_payer_rc)).unsigned=!0:"string"==typeof e.max_payer_rc?t.max_payer_rc=parseInt(e.max_payer_rc,10):"number"==typeof e.max_payer_rc?t.max_payer_rc=e.max_payer_rc:"object"==typeof e.max_payer_rc&&(t.max_payer_rc=new c.LongBits(e.max_payer_rc.low>>>0,e.max_payer_rc.high>>>0).toNumber(!0))),null!=e.rc_limit&&(c.Long?(t.rc_limit=c.Long.fromValue(e.rc_limit)).unsigned=!0:"string"==typeof e.rc_limit?t.rc_limit=parseInt(e.rc_limit,10):"number"==typeof e.rc_limit?t.rc_limit=e.rc_limit:"object"==typeof e.rc_limit&&(t.rc_limit=new c.LongBits(e.rc_limit.low>>>0,e.rc_limit.high>>>0).toNumber(!0))),null!=e.rc_used&&(c.Long?(t.rc_used=c.Long.fromValue(e.rc_used)).unsigned=!0:"string"==typeof e.rc_used?t.rc_used=parseInt(e.rc_used,10):"number"==typeof e.rc_used?t.rc_used=e.rc_used:"object"==typeof e.rc_used&&(t.rc_used=new c.LongBits(e.rc_used.low>>>0,e.rc_used.high>>>0).toNumber(!0))),null!=e.disk_storage_used&&(c.Long?(t.disk_storage_used=c.Long.fromValue(e.disk_storage_used)).unsigned=!0:"string"==typeof e.disk_storage_used?t.disk_storage_used=parseInt(e.disk_storage_used,10):"number"==typeof e.disk_storage_used?t.disk_storage_used=e.disk_storage_used:"object"==typeof e.disk_storage_used&&(t.disk_storage_used=new c.LongBits(e.disk_storage_used.low>>>0,e.disk_storage_used.high>>>0).toNumber(!0))),null!=e.network_bandwidth_used&&(c.Long?(t.network_bandwidth_used=c.Long.fromValue(e.network_bandwidth_used)).unsigned=!0:"string"==typeof e.network_bandwidth_used?t.network_bandwidth_used=parseInt(e.network_bandwidth_used,10):"number"==typeof e.network_bandwidth_used?t.network_bandwidth_used=e.network_bandwidth_used:"object"==typeof e.network_bandwidth_used&&(t.network_bandwidth_used=new c.LongBits(e.network_bandwidth_used.low>>>0,e.network_bandwidth_used.high>>>0).toNumber(!0))),null!=e.compute_bandwidth_used&&(c.Long?(t.compute_bandwidth_used=c.Long.fromValue(e.compute_bandwidth_used)).unsigned=!0:"string"==typeof e.compute_bandwidth_used?t.compute_bandwidth_used=parseInt(e.compute_bandwidth_used,10):"number"==typeof e.compute_bandwidth_used?t.compute_bandwidth_used=e.compute_bandwidth_used:"object"==typeof e.compute_bandwidth_used&&(t.compute_bandwidth_used=new c.LongBits(e.compute_bandwidth_used.low>>>0,e.compute_bandwidth_used.high>>>0).toNumber(!0))),null!=e.reverted&&(t.reverted=Boolean(e.reverted)),e.events){if(!Array.isArray(e.events))throw TypeError(".koinos.protocol.transaction_receipt.events: array expected");t.events=[];for(var r=0;r>>0,e.max_payer_rc.high>>>0).toNumber(!0):e.max_payer_rc),null!=e.rc_limit&&e.hasOwnProperty("rc_limit")&&("number"==typeof e.rc_limit?r.rc_limit=t.longs===String?String(e.rc_limit):e.rc_limit:r.rc_limit=t.longs===String?c.Long.prototype.toString.call(e.rc_limit):t.longs===Number?new c.LongBits(e.rc_limit.low>>>0,e.rc_limit.high>>>0).toNumber(!0):e.rc_limit),null!=e.rc_used&&e.hasOwnProperty("rc_used")&&("number"==typeof e.rc_used?r.rc_used=t.longs===String?String(e.rc_used):e.rc_used:r.rc_used=t.longs===String?c.Long.prototype.toString.call(e.rc_used):t.longs===Number?new c.LongBits(e.rc_used.low>>>0,e.rc_used.high>>>0).toNumber(!0):e.rc_used),null!=e.disk_storage_used&&e.hasOwnProperty("disk_storage_used")&&("number"==typeof e.disk_storage_used?r.disk_storage_used=t.longs===String?String(e.disk_storage_used):e.disk_storage_used:r.disk_storage_used=t.longs===String?c.Long.prototype.toString.call(e.disk_storage_used):t.longs===Number?new c.LongBits(e.disk_storage_used.low>>>0,e.disk_storage_used.high>>>0).toNumber(!0):e.disk_storage_used),null!=e.network_bandwidth_used&&e.hasOwnProperty("network_bandwidth_used")&&("number"==typeof e.network_bandwidth_used?r.network_bandwidth_used=t.longs===String?String(e.network_bandwidth_used):e.network_bandwidth_used:r.network_bandwidth_used=t.longs===String?c.Long.prototype.toString.call(e.network_bandwidth_used):t.longs===Number?new c.LongBits(e.network_bandwidth_used.low>>>0,e.network_bandwidth_used.high>>>0).toNumber(!0):e.network_bandwidth_used),null!=e.compute_bandwidth_used&&e.hasOwnProperty("compute_bandwidth_used")&&("number"==typeof e.compute_bandwidth_used?r.compute_bandwidth_used=t.longs===String?String(e.compute_bandwidth_used):e.compute_bandwidth_used:r.compute_bandwidth_used=t.longs===String?c.Long.prototype.toString.call(e.compute_bandwidth_used):t.longs===Number?new c.LongBits(e.compute_bandwidth_used.low>>>0,e.compute_bandwidth_used.high>>>0).toNumber(!0):e.compute_bandwidth_used),null!=e.reverted&&e.hasOwnProperty("reverted")&&(r.reverted=e.reverted),e.events&&e.events.length){r.events=[];for(var o=0;o>>3){case 1:n.previous=e.bytes();break;case 2:n.height=e.uint64();break;case 3:n.timestamp=e.uint64();break;case 4:n.previous_state_merkle_root=e.bytes();break;case 5:n.transaction_merkle_root=e.bytes();break;case 6:n.signer=e.bytes();break;case 7:n.approved_proposals&&n.approved_proposals.length||(n.approved_proposals=[]),n.approved_proposals.push(e.bytes());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.previous&&e.hasOwnProperty("previous")&&!(e.previous&&"number"==typeof e.previous.length||c.isString(e.previous)))return"previous: buffer expected";if(null!=e.height&&e.hasOwnProperty("height")&&!(c.isInteger(e.height)||e.height&&c.isInteger(e.height.low)&&c.isInteger(e.height.high)))return"height: integer|Long expected";if(null!=e.timestamp&&e.hasOwnProperty("timestamp")&&!(c.isInteger(e.timestamp)||e.timestamp&&c.isInteger(e.timestamp.low)&&c.isInteger(e.timestamp.high)))return"timestamp: integer|Long expected";if(null!=e.previous_state_merkle_root&&e.hasOwnProperty("previous_state_merkle_root")&&!(e.previous_state_merkle_root&&"number"==typeof e.previous_state_merkle_root.length||c.isString(e.previous_state_merkle_root)))return"previous_state_merkle_root: buffer expected";if(null!=e.transaction_merkle_root&&e.hasOwnProperty("transaction_merkle_root")&&!(e.transaction_merkle_root&&"number"==typeof e.transaction_merkle_root.length||c.isString(e.transaction_merkle_root)))return"transaction_merkle_root: buffer expected";if(null!=e.signer&&e.hasOwnProperty("signer")&&!(e.signer&&"number"==typeof e.signer.length||c.isString(e.signer)))return"signer: buffer expected";if(null!=e.approved_proposals&&e.hasOwnProperty("approved_proposals")){if(!Array.isArray(e.approved_proposals))return"approved_proposals: array expected";for(var t=0;t=0&&(t.previous=e.previous)),null!=e.height&&(c.Long?(t.height=c.Long.fromValue(e.height)).unsigned=!0:"string"==typeof e.height?t.height=parseInt(e.height,10):"number"==typeof e.height?t.height=e.height:"object"==typeof e.height&&(t.height=new c.LongBits(e.height.low>>>0,e.height.high>>>0).toNumber(!0))),null!=e.timestamp&&(c.Long?(t.timestamp=c.Long.fromValue(e.timestamp)).unsigned=!0:"string"==typeof e.timestamp?t.timestamp=parseInt(e.timestamp,10):"number"==typeof e.timestamp?t.timestamp=e.timestamp:"object"==typeof e.timestamp&&(t.timestamp=new c.LongBits(e.timestamp.low>>>0,e.timestamp.high>>>0).toNumber(!0))),null!=e.previous_state_merkle_root&&("string"==typeof e.previous_state_merkle_root?c.base64.decode(e.previous_state_merkle_root,t.previous_state_merkle_root=c.newBuffer(c.base64.length(e.previous_state_merkle_root)),0):e.previous_state_merkle_root.length>=0&&(t.previous_state_merkle_root=e.previous_state_merkle_root)),null!=e.transaction_merkle_root&&("string"==typeof e.transaction_merkle_root?c.base64.decode(e.transaction_merkle_root,t.transaction_merkle_root=c.newBuffer(c.base64.length(e.transaction_merkle_root)),0):e.transaction_merkle_root.length>=0&&(t.transaction_merkle_root=e.transaction_merkle_root)),null!=e.signer&&("string"==typeof e.signer?c.base64.decode(e.signer,t.signer=c.newBuffer(c.base64.length(e.signer)),0):e.signer.length>=0&&(t.signer=e.signer)),e.approved_proposals){if(!Array.isArray(e.approved_proposals))throw TypeError(".koinos.protocol.block_header.approved_proposals: array expected");t.approved_proposals=[];for(var r=0;r=0&&(t.approved_proposals[r]=e.approved_proposals[r])}return t},t.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.approved_proposals=[]),t.defaults){if(t.bytes===String?r.previous="":(r.previous=[],t.bytes!==Array&&(r.previous=c.newBuffer(r.previous))),c.Long){var n=new c.Long(0,0,!0);r.height=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.height=t.longs===String?"0":0;c.Long?(n=new c.Long(0,0,!0),r.timestamp=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):r.timestamp=t.longs===String?"0":0,t.bytes===String?r.previous_state_merkle_root="":(r.previous_state_merkle_root=[],t.bytes!==Array&&(r.previous_state_merkle_root=c.newBuffer(r.previous_state_merkle_root))),t.bytes===String?r.transaction_merkle_root="":(r.transaction_merkle_root=[],t.bytes!==Array&&(r.transaction_merkle_root=c.newBuffer(r.transaction_merkle_root))),t.bytes===String?r.signer="":(r.signer=[],t.bytes!==Array&&(r.signer=c.newBuffer(r.signer)))}if(null!=e.previous&&e.hasOwnProperty("previous")&&(r.previous=t.bytes===String?c.base64.encode(e.previous,0,e.previous.length):t.bytes===Array?Array.prototype.slice.call(e.previous):e.previous),null!=e.height&&e.hasOwnProperty("height")&&("number"==typeof e.height?r.height=t.longs===String?String(e.height):e.height:r.height=t.longs===String?c.Long.prototype.toString.call(e.height):t.longs===Number?new c.LongBits(e.height.low>>>0,e.height.high>>>0).toNumber(!0):e.height),null!=e.timestamp&&e.hasOwnProperty("timestamp")&&("number"==typeof e.timestamp?r.timestamp=t.longs===String?String(e.timestamp):e.timestamp:r.timestamp=t.longs===String?c.Long.prototype.toString.call(e.timestamp):t.longs===Number?new c.LongBits(e.timestamp.low>>>0,e.timestamp.high>>>0).toNumber(!0):e.timestamp),null!=e.previous_state_merkle_root&&e.hasOwnProperty("previous_state_merkle_root")&&(r.previous_state_merkle_root=t.bytes===String?c.base64.encode(e.previous_state_merkle_root,0,e.previous_state_merkle_root.length):t.bytes===Array?Array.prototype.slice.call(e.previous_state_merkle_root):e.previous_state_merkle_root),null!=e.transaction_merkle_root&&e.hasOwnProperty("transaction_merkle_root")&&(r.transaction_merkle_root=t.bytes===String?c.base64.encode(e.transaction_merkle_root,0,e.transaction_merkle_root.length):t.bytes===Array?Array.prototype.slice.call(e.transaction_merkle_root):e.transaction_merkle_root),null!=e.signer&&e.hasOwnProperty("signer")&&(r.signer=t.bytes===String?c.base64.encode(e.signer,0,e.signer.length):t.bytes===Array?Array.prototype.slice.call(e.signer):e.signer),e.approved_proposals&&e.approved_proposals.length){r.approved_proposals=[];for(var o=0;o>>3){case 1:n.id=e.bytes();break;case 2:n.header=l.koinos.protocol.block_header.decode(e,e.uint32());break;case 3:n.transactions&&n.transactions.length||(n.transactions=[]),n.transactions.push(l.koinos.protocol.transaction.decode(e,e.uint32()));break;case 4:n.signature=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!(e.id&&"number"==typeof e.id.length||c.isString(e.id)))return"id: buffer expected";if(null!=e.header&&e.hasOwnProperty("header")&&(r=l.koinos.protocol.block_header.verify(e.header)))return"header."+r;if(null!=e.transactions&&e.hasOwnProperty("transactions")){if(!Array.isArray(e.transactions))return"transactions: array expected";for(var t=0;t=0&&(t.id=e.id)),null!=e.header){if("object"!=typeof e.header)throw TypeError(".koinos.protocol.block.header: object expected");t.header=l.koinos.protocol.block_header.fromObject(e.header)}if(e.transactions){if(!Array.isArray(e.transactions))throw TypeError(".koinos.protocol.block.transactions: array expected");t.transactions=[];for(var r=0;r=0&&(t.signature=e.signature)),t},t.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.transactions=[]),t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=c.newBuffer(r.id))),r.header=null,t.bytes===String?r.signature="":(r.signature=[],t.bytes!==Array&&(r.signature=c.newBuffer(r.signature)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?c.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.header&&e.hasOwnProperty("header")&&(r.header=l.koinos.protocol.block_header.toObject(e.header,t)),e.transactions&&e.transactions.length){r.transactions=[];for(var n=0;n>>3){case 1:n.id=e.bytes();break;case 2:n.height=e.uint64();break;case 3:n.disk_storage_used=e.uint64();break;case 4:n.network_bandwidth_used=e.uint64();break;case 5:n.compute_bandwidth_used=e.uint64();break;case 6:n.state_merkle_root=e.bytes();break;case 7:n.events&&n.events.length||(n.events=[]),n.events.push(l.koinos.protocol.event_data.decode(e,e.uint32()));break;case 8:n.transaction_receipts&&n.transaction_receipts.length||(n.transaction_receipts=[]),n.transaction_receipts.push(l.koinos.protocol.transaction_receipt.decode(e,e.uint32()));break;case 9:n.logs&&n.logs.length||(n.logs=[]),n.logs.push(e.string());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!(e.id&&"number"==typeof e.id.length||c.isString(e.id)))return"id: buffer expected";if(null!=e.height&&e.hasOwnProperty("height")&&!(c.isInteger(e.height)||e.height&&c.isInteger(e.height.low)&&c.isInteger(e.height.high)))return"height: integer|Long expected";if(null!=e.disk_storage_used&&e.hasOwnProperty("disk_storage_used")&&!(c.isInteger(e.disk_storage_used)||e.disk_storage_used&&c.isInteger(e.disk_storage_used.low)&&c.isInteger(e.disk_storage_used.high)))return"disk_storage_used: integer|Long expected";if(null!=e.network_bandwidth_used&&e.hasOwnProperty("network_bandwidth_used")&&!(c.isInteger(e.network_bandwidth_used)||e.network_bandwidth_used&&c.isInteger(e.network_bandwidth_used.low)&&c.isInteger(e.network_bandwidth_used.high)))return"network_bandwidth_used: integer|Long expected";if(null!=e.compute_bandwidth_used&&e.hasOwnProperty("compute_bandwidth_used")&&!(c.isInteger(e.compute_bandwidth_used)||e.compute_bandwidth_used&&c.isInteger(e.compute_bandwidth_used.low)&&c.isInteger(e.compute_bandwidth_used.high)))return"compute_bandwidth_used: integer|Long expected";if(null!=e.state_merkle_root&&e.hasOwnProperty("state_merkle_root")&&!(e.state_merkle_root&&"number"==typeof e.state_merkle_root.length||c.isString(e.state_merkle_root)))return"state_merkle_root: buffer expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(var t=0;t=0&&(t.id=e.id)),null!=e.height&&(c.Long?(t.height=c.Long.fromValue(e.height)).unsigned=!0:"string"==typeof e.height?t.height=parseInt(e.height,10):"number"==typeof e.height?t.height=e.height:"object"==typeof e.height&&(t.height=new c.LongBits(e.height.low>>>0,e.height.high>>>0).toNumber(!0))),null!=e.disk_storage_used&&(c.Long?(t.disk_storage_used=c.Long.fromValue(e.disk_storage_used)).unsigned=!0:"string"==typeof e.disk_storage_used?t.disk_storage_used=parseInt(e.disk_storage_used,10):"number"==typeof e.disk_storage_used?t.disk_storage_used=e.disk_storage_used:"object"==typeof e.disk_storage_used&&(t.disk_storage_used=new c.LongBits(e.disk_storage_used.low>>>0,e.disk_storage_used.high>>>0).toNumber(!0))),null!=e.network_bandwidth_used&&(c.Long?(t.network_bandwidth_used=c.Long.fromValue(e.network_bandwidth_used)).unsigned=!0:"string"==typeof e.network_bandwidth_used?t.network_bandwidth_used=parseInt(e.network_bandwidth_used,10):"number"==typeof e.network_bandwidth_used?t.network_bandwidth_used=e.network_bandwidth_used:"object"==typeof e.network_bandwidth_used&&(t.network_bandwidth_used=new c.LongBits(e.network_bandwidth_used.low>>>0,e.network_bandwidth_used.high>>>0).toNumber(!0))),null!=e.compute_bandwidth_used&&(c.Long?(t.compute_bandwidth_used=c.Long.fromValue(e.compute_bandwidth_used)).unsigned=!0:"string"==typeof e.compute_bandwidth_used?t.compute_bandwidth_used=parseInt(e.compute_bandwidth_used,10):"number"==typeof e.compute_bandwidth_used?t.compute_bandwidth_used=e.compute_bandwidth_used:"object"==typeof e.compute_bandwidth_used&&(t.compute_bandwidth_used=new c.LongBits(e.compute_bandwidth_used.low>>>0,e.compute_bandwidth_used.high>>>0).toNumber(!0))),null!=e.state_merkle_root&&("string"==typeof e.state_merkle_root?c.base64.decode(e.state_merkle_root,t.state_merkle_root=c.newBuffer(c.base64.length(e.state_merkle_root)),0):e.state_merkle_root.length>=0&&(t.state_merkle_root=e.state_merkle_root)),e.events){if(!Array.isArray(e.events))throw TypeError(".koinos.protocol.block_receipt.events: array expected");t.events=[];for(var r=0;r>>0,e.height.high>>>0).toNumber(!0):e.height),null!=e.disk_storage_used&&e.hasOwnProperty("disk_storage_used")&&("number"==typeof e.disk_storage_used?r.disk_storage_used=t.longs===String?String(e.disk_storage_used):e.disk_storage_used:r.disk_storage_used=t.longs===String?c.Long.prototype.toString.call(e.disk_storage_used):t.longs===Number?new c.LongBits(e.disk_storage_used.low>>>0,e.disk_storage_used.high>>>0).toNumber(!0):e.disk_storage_used),null!=e.network_bandwidth_used&&e.hasOwnProperty("network_bandwidth_used")&&("number"==typeof e.network_bandwidth_used?r.network_bandwidth_used=t.longs===String?String(e.network_bandwidth_used):e.network_bandwidth_used:r.network_bandwidth_used=t.longs===String?c.Long.prototype.toString.call(e.network_bandwidth_used):t.longs===Number?new c.LongBits(e.network_bandwidth_used.low>>>0,e.network_bandwidth_used.high>>>0).toNumber(!0):e.network_bandwidth_used),null!=e.compute_bandwidth_used&&e.hasOwnProperty("compute_bandwidth_used")&&("number"==typeof e.compute_bandwidth_used?r.compute_bandwidth_used=t.longs===String?String(e.compute_bandwidth_used):e.compute_bandwidth_used:r.compute_bandwidth_used=t.longs===String?c.Long.prototype.toString.call(e.compute_bandwidth_used):t.longs===Number?new c.LongBits(e.compute_bandwidth_used.low>>>0,e.compute_bandwidth_used.high>>>0).toNumber(!0):e.compute_bandwidth_used),null!=e.state_merkle_root&&e.hasOwnProperty("state_merkle_root")&&(r.state_merkle_root=t.bytes===String?c.base64.encode(e.state_merkle_root,0,e.state_merkle_root.length):t.bytes===Array?Array.prototype.slice.call(e.state_merkle_root):e.state_merkle_root),e.events&&e.events.length){r.events=[];for(var o=0;o>>3){case 1:n.message_value=l.google.protobuf.Any.decode(e,e.uint32());break;case 2:n.int32_value=e.int32();break;case 3:n.int64_value=e.int64();break;case 4:n.uint32_value=e.uint32();break;case 5:n.uint64_value=e.uint64();break;case 6:n.sint32_value=e.sint32();break;case 7:n.sint64_value=e.sint64();break;case 8:n.fixed32_value=e.fixed32();break;case 9:n.fixed64_value=e.fixed64();break;case 10:n.sfixed32_value=e.sfixed32();break;case 11:n.sfixed64_value=e.sfixed64();break;case 12:n.bool_value=e.bool();break;case 13:n.string_value=e.string();break;case 14:n.bytes_value=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.message_value&&e.hasOwnProperty("message_value")){t.kind=1;var r=l.google.protobuf.Any.verify(e.message_value);if(r)return"message_value."+r}if(null!=e.int32_value&&e.hasOwnProperty("int32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.int32_value))return"int32_value: integer expected"}if(null!=e.int64_value&&e.hasOwnProperty("int64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.int64_value)||e.int64_value&&c.isInteger(e.int64_value.low)&&c.isInteger(e.int64_value.high)))return"int64_value: integer|Long expected"}if(null!=e.uint32_value&&e.hasOwnProperty("uint32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.uint32_value))return"uint32_value: integer expected"}if(null!=e.uint64_value&&e.hasOwnProperty("uint64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.uint64_value)||e.uint64_value&&c.isInteger(e.uint64_value.low)&&c.isInteger(e.uint64_value.high)))return"uint64_value: integer|Long expected"}if(null!=e.sint32_value&&e.hasOwnProperty("sint32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.sint32_value))return"sint32_value: integer expected"}if(null!=e.sint64_value&&e.hasOwnProperty("sint64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.sint64_value)||e.sint64_value&&c.isInteger(e.sint64_value.low)&&c.isInteger(e.sint64_value.high)))return"sint64_value: integer|Long expected"}if(null!=e.fixed32_value&&e.hasOwnProperty("fixed32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.fixed32_value))return"fixed32_value: integer expected"}if(null!=e.fixed64_value&&e.hasOwnProperty("fixed64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.fixed64_value)||e.fixed64_value&&c.isInteger(e.fixed64_value.low)&&c.isInteger(e.fixed64_value.high)))return"fixed64_value: integer|Long expected"}if(null!=e.sfixed32_value&&e.hasOwnProperty("sfixed32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.sfixed32_value))return"sfixed32_value: integer expected"}if(null!=e.sfixed64_value&&e.hasOwnProperty("sfixed64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.sfixed64_value)||e.sfixed64_value&&c.isInteger(e.sfixed64_value.low)&&c.isInteger(e.sfixed64_value.high)))return"sfixed64_value: integer|Long expected"}if(null!=e.bool_value&&e.hasOwnProperty("bool_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,"boolean"!=typeof e.bool_value)return"bool_value: boolean expected"}if(null!=e.string_value&&e.hasOwnProperty("string_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isString(e.string_value))return"string_value: string expected"}if(null!=e.bytes_value&&e.hasOwnProperty("bytes_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(e.bytes_value&&"number"==typeof e.bytes_value.length||c.isString(e.bytes_value)))return"bytes_value: buffer expected"}return null},t.fromObject=function(e){if(e instanceof l.koinos.chain.value_type)return e;var t=new l.koinos.chain.value_type;if(null!=e.message_value){if("object"!=typeof e.message_value)throw TypeError(".koinos.chain.value_type.message_value: object expected");t.message_value=l.google.protobuf.Any.fromObject(e.message_value)}return null!=e.int32_value&&(t.int32_value=0|e.int32_value),null!=e.int64_value&&(c.Long?(t.int64_value=c.Long.fromValue(e.int64_value)).unsigned=!1:"string"==typeof e.int64_value?t.int64_value=parseInt(e.int64_value,10):"number"==typeof e.int64_value?t.int64_value=e.int64_value:"object"==typeof e.int64_value&&(t.int64_value=new c.LongBits(e.int64_value.low>>>0,e.int64_value.high>>>0).toNumber())),null!=e.uint32_value&&(t.uint32_value=e.uint32_value>>>0),null!=e.uint64_value&&(c.Long?(t.uint64_value=c.Long.fromValue(e.uint64_value)).unsigned=!0:"string"==typeof e.uint64_value?t.uint64_value=parseInt(e.uint64_value,10):"number"==typeof e.uint64_value?t.uint64_value=e.uint64_value:"object"==typeof e.uint64_value&&(t.uint64_value=new c.LongBits(e.uint64_value.low>>>0,e.uint64_value.high>>>0).toNumber(!0))),null!=e.sint32_value&&(t.sint32_value=0|e.sint32_value),null!=e.sint64_value&&(c.Long?(t.sint64_value=c.Long.fromValue(e.sint64_value)).unsigned=!1:"string"==typeof e.sint64_value?t.sint64_value=parseInt(e.sint64_value,10):"number"==typeof e.sint64_value?t.sint64_value=e.sint64_value:"object"==typeof e.sint64_value&&(t.sint64_value=new c.LongBits(e.sint64_value.low>>>0,e.sint64_value.high>>>0).toNumber())),null!=e.fixed32_value&&(t.fixed32_value=e.fixed32_value>>>0),null!=e.fixed64_value&&(c.Long?(t.fixed64_value=c.Long.fromValue(e.fixed64_value)).unsigned=!1:"string"==typeof e.fixed64_value?t.fixed64_value=parseInt(e.fixed64_value,10):"number"==typeof e.fixed64_value?t.fixed64_value=e.fixed64_value:"object"==typeof e.fixed64_value&&(t.fixed64_value=new c.LongBits(e.fixed64_value.low>>>0,e.fixed64_value.high>>>0).toNumber())),null!=e.sfixed32_value&&(t.sfixed32_value=0|e.sfixed32_value),null!=e.sfixed64_value&&(c.Long?(t.sfixed64_value=c.Long.fromValue(e.sfixed64_value)).unsigned=!1:"string"==typeof e.sfixed64_value?t.sfixed64_value=parseInt(e.sfixed64_value,10):"number"==typeof e.sfixed64_value?t.sfixed64_value=e.sfixed64_value:"object"==typeof e.sfixed64_value&&(t.sfixed64_value=new c.LongBits(e.sfixed64_value.low>>>0,e.sfixed64_value.high>>>0).toNumber())),null!=e.bool_value&&(t.bool_value=Boolean(e.bool_value)),null!=e.string_value&&(t.string_value=String(e.string_value)),null!=e.bytes_value&&("string"==typeof e.bytes_value?c.base64.decode(e.bytes_value,t.bytes_value=c.newBuffer(c.base64.length(e.bytes_value)),0):e.bytes_value.length>=0&&(t.bytes_value=e.bytes_value)),t},t.toObject=function(e,t){t||(t={});var r={};return null!=e.message_value&&e.hasOwnProperty("message_value")&&(r.message_value=l.google.protobuf.Any.toObject(e.message_value,t),t.oneofs&&(r.kind="message_value")),null!=e.int32_value&&e.hasOwnProperty("int32_value")&&(r.int32_value=e.int32_value,t.oneofs&&(r.kind="int32_value")),null!=e.int64_value&&e.hasOwnProperty("int64_value")&&("number"==typeof e.int64_value?r.int64_value=t.longs===String?String(e.int64_value):e.int64_value:r.int64_value=t.longs===String?c.Long.prototype.toString.call(e.int64_value):t.longs===Number?new c.LongBits(e.int64_value.low>>>0,e.int64_value.high>>>0).toNumber():e.int64_value,t.oneofs&&(r.kind="int64_value")),null!=e.uint32_value&&e.hasOwnProperty("uint32_value")&&(r.uint32_value=e.uint32_value,t.oneofs&&(r.kind="uint32_value")),null!=e.uint64_value&&e.hasOwnProperty("uint64_value")&&("number"==typeof e.uint64_value?r.uint64_value=t.longs===String?String(e.uint64_value):e.uint64_value:r.uint64_value=t.longs===String?c.Long.prototype.toString.call(e.uint64_value):t.longs===Number?new c.LongBits(e.uint64_value.low>>>0,e.uint64_value.high>>>0).toNumber(!0):e.uint64_value,t.oneofs&&(r.kind="uint64_value")),null!=e.sint32_value&&e.hasOwnProperty("sint32_value")&&(r.sint32_value=e.sint32_value,t.oneofs&&(r.kind="sint32_value")),null!=e.sint64_value&&e.hasOwnProperty("sint64_value")&&("number"==typeof e.sint64_value?r.sint64_value=t.longs===String?String(e.sint64_value):e.sint64_value:r.sint64_value=t.longs===String?c.Long.prototype.toString.call(e.sint64_value):t.longs===Number?new c.LongBits(e.sint64_value.low>>>0,e.sint64_value.high>>>0).toNumber():e.sint64_value,t.oneofs&&(r.kind="sint64_value")),null!=e.fixed32_value&&e.hasOwnProperty("fixed32_value")&&(r.fixed32_value=e.fixed32_value,t.oneofs&&(r.kind="fixed32_value")),null!=e.fixed64_value&&e.hasOwnProperty("fixed64_value")&&("number"==typeof e.fixed64_value?r.fixed64_value=t.longs===String?String(e.fixed64_value):e.fixed64_value:r.fixed64_value=t.longs===String?c.Long.prototype.toString.call(e.fixed64_value):t.longs===Number?new c.LongBits(e.fixed64_value.low>>>0,e.fixed64_value.high>>>0).toNumber():e.fixed64_value,t.oneofs&&(r.kind="fixed64_value")),null!=e.sfixed32_value&&e.hasOwnProperty("sfixed32_value")&&(r.sfixed32_value=e.sfixed32_value,t.oneofs&&(r.kind="sfixed32_value")),null!=e.sfixed64_value&&e.hasOwnProperty("sfixed64_value")&&("number"==typeof e.sfixed64_value?r.sfixed64_value=t.longs===String?String(e.sfixed64_value):e.sfixed64_value:r.sfixed64_value=t.longs===String?c.Long.prototype.toString.call(e.sfixed64_value):t.longs===Number?new c.LongBits(e.sfixed64_value.low>>>0,e.sfixed64_value.high>>>0).toNumber():e.sfixed64_value,t.oneofs&&(r.kind="sfixed64_value")),null!=e.bool_value&&e.hasOwnProperty("bool_value")&&(r.bool_value=e.bool_value,t.oneofs&&(r.kind="bool_value")),null!=e.string_value&&e.hasOwnProperty("string_value")&&(r.string_value=e.string_value,t.oneofs&&(r.kind="string_value")),null!=e.bytes_value&&e.hasOwnProperty("bytes_value")&&(r.bytes_value=t.bytes===String?c.base64.encode(e.bytes_value,0,e.bytes_value.length):t.bytes===Array?Array.prototype.slice.call(e.bytes_value):e.bytes_value,t.oneofs&&(r.kind="bytes_value")),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.chain.value_type"},t}(),o.enum_type=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.name=e.string();break;case 2:n.number=e.int32();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name)?"name: string expected":null!=e.number&&e.hasOwnProperty("number")&&!c.isInteger(e.number)?"number: integer expected":null},t.fromObject=function(e){if(e instanceof l.koinos.chain.enum_type)return e;var t=new l.koinos.chain.enum_type;return null!=e.name&&(t.name=String(e.name)),null!=e.number&&(t.number=0|e.number),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.name="",r.number=0),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.number&&e.hasOwnProperty("number")&&(r.number=e.number),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.chain.enum_type"},t}(),o.list_type=function(){function t(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.values&&n.values.length||(n.values=[]),n.values.push(l.koinos.chain.value_type.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t>>3){case 1:n.type_url=e.string();break;case 2:n.value=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.type_url&&e.hasOwnProperty("type_url")&&!c.isString(e.type_url)?"type_url: string expected":null!=e.value&&e.hasOwnProperty("value")&&!(e.value&&"number"==typeof e.value.length||c.isString(e.value))?"value: buffer expected":null},t.fromObject=function(e){if(e instanceof l.google.protobuf.Any)return e;var t=new l.google.protobuf.Any;return null!=e.type_url&&(t.type_url=String(e.type_url)),null!=e.value&&("string"==typeof e.value?c.base64.decode(e.value,t.value=c.newBuffer(c.base64.length(e.value)),0):e.value.length>=0&&(t.value=e.value)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.type_url="",t.bytes===String?r.value="":(r.value=[],t.bytes!==Array&&(r.value=c.newBuffer(r.value)))),null!=e.type_url&&e.hasOwnProperty("type_url")&&(r.type_url=e.type_url),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.bytes===String?c.base64.encode(e.value,0,e.value.length):t.bytes===Array?Array.prototype.slice.call(e.value):e.value),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.Any"},t}(),t),r),l})?n.apply(t,o):n)||(e.exports=i)},9159:()=>{},6567:e=>{"use strict";e.exports=JSON.parse('{"nested":{"koinos":{"nested":{"contracts":{"nested":{"token":{"options":{"go_package":"github.com/koinos/koinos-proto-golang/koinos/contracts/token"},"nested":{"name_arguments":{"fields":{}},"name_result":{"fields":{"value":{"type":"string","id":1}}},"symbol_arguments":{"fields":{}},"symbol_result":{"fields":{"value":{"type":"string","id":1}}},"decimals_arguments":{"fields":{}},"decimals_result":{"fields":{"value":{"type":"uint32","id":1}}},"total_supply_arguments":{"fields":{}},"total_supply_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"balance_of_arguments":{"fields":{"owner":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}}}},"balance_of_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"transfer_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}},"transfer_result":{"fields":{}},"mint_arguments":{"fields":{"to":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"mint_result":{"fields":{}},"burn_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"burn_result":{"fields":{}},"balance_object":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"mana_balance_object":{"fields":{"balance":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}},"mana":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}},"last_mana_update":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}},"burn_event":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"mint_event":{"fields":{"to":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"transfer_event":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}}}}}}}}}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var __webpack_exports__=__webpack_require__(5738)})(); \ No newline at end of file +(()=>{var __webpack_modules__={8820:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(i);e[r];){var u=t[e.charCodeAt(r)];if(255===u)return;for(var p=0,d=i-1;(0!==u||p>>0,l[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");o=p,r++}if(" "!==e[r]){for(var f=i-o;f!==i&&0===l[f];)f++;for(var h=new Uint8Array(n+(i-f)),y=n;f!==i;)h[y++]=l[f++];return h}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var c=(i-o)*l+1>>>0,u=new Uint8Array(c);o!==i;){for(var p=t[o],d=0,f=c-1;(0!==p||d>>0,u[f]=p%s>>>0,p=p/s>>>0;if(0!==p)throw new Error("Non-zero carry");n=d,o++}for(var h=c-n;h!==c&&0===u[h];)h++;for(var y=a.repeat(r);h{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function o(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function i(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){o(e);const r=t.outputLen;if(e.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const n=r(7320),o=r(8089);class i extends o.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,o.createView)(this.buffer)}update(e){n.default.exists(this);const{view:t,buffer:r,blockLen:i}=this,s=(e=(0,o.toBytes)(e)).length;for(let n=0;ni-a&&(this.process(r,0),a=0);for(let e=a;e>o&i),a=Number(r&i),c=n?4:0,l=n?0:4;e.setUint32(t+c,s,n),e.setUint32(t+l,a,n)}(r,i-8,BigInt(8*this.length),s),this.process(r,0);const c=(0,o.createView)(e);this.get().forEach(((e,t)=>c.setUint32(4*t,e,s)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return e.length=n,e.pos=s,e.finished=o,e.destroyed=i,n%t&&e.buffer.set(r),e}}t.SHA2=i},4421:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},830:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=void 0;const n=r(7505),o=r(8089),i=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),s=Uint8Array.from({length:16},((e,t)=>t)),a=s.map((e=>(9*e+5)%16));let c=[s],l=[a];for(let e=0;e<4;e++)for(let t of[c,l])t.push(t[e].map((e=>i[e])));const u=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((e=>new Uint8Array(e))),p=c.map(((e,t)=>e.map((e=>u[t][e])))),d=l.map(((e,t)=>e.map((e=>u[t][e])))),f=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),h=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),y=(e,t)=>e<>>32-t;function _(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const g=new Uint32Array(16);class b extends n.SHA2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:o}=this;return[e,t,r,n,o]}set(e,t,r,n,o){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|o}process(e,t){for(let r=0;r<16;r++,t+=4)g[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,o=0|this.h1,i=o,s=0|this.h2,a=s,u=0|this.h3,b=u,m=0|this.h4,v=m;for(let e=0;e<5;e++){const t=4-e,w=f[e],k=h[e],O=c[e],x=l[e],S=p[e],A=d[e];for(let t=0;t<16;t++){const n=y(r+_(e,o,s,u)+g[O[t]]+w,S[t])+m|0;r=m,m=u,u=0|y(s,10),s=o,o=n}for(let e=0;e<16;e++){const r=y(n+_(t,i,a,b)+g[x[e]]+k,A[e])+v|0;n=v,v=b,b=0|y(a,10),a=i,i=r}}this.set(this.h1+s+b|0,this.h2+u+v|0,this.h3+m+n|0,this.h4+r+i|0,this.h0+o+a|0)}roundClean(){g.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}t.RIPEMD160=b,t.ripemd160=(0,o.wrapConstructor)((()=>new b))},3061:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const n=r(7505),o=r(8089),i=(e,t,r)=>e&t^e&r^t&r,s=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint32Array(64);class l extends n.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:a}=this;return[e,t,r,n,o,i,s,a]}set(e,t,r,n,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=c[e-15],r=c[e-2],n=(0,o.rotr)(t,7)^(0,o.rotr)(t,18)^t>>>3,i=(0,o.rotr)(r,17)^(0,o.rotr)(r,19)^r>>>10;c[e]=i+c[e-7]+n+c[e-16]|0}let{A:r,B:n,C:a,D:l,E:u,F:p,G:d,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,o.rotr)(u,6)^(0,o.rotr)(u,11)^(0,o.rotr)(u,25))+((h=u)&p^~h&d)+s[e]+c[e]|0,y=((0,o.rotr)(r,2)^(0,o.rotr)(r,13)^(0,o.rotr)(r,22))+i(r,n,a)|0;f=d,d=p,p=u,u=l+t|0,l=a,a=n,n=r,r=t+y|0}var h;r=r+this.A|0,n=n+this.B|0,a=a+this.C|0,l=l+this.D|0,u=u+this.E|0,p=p+this.F|0,d=d+this.G|0,f=f+this.H|0,this.set(r,n,a,l,u,p,d,f)}roundClean(){c.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}t.sha256=(0,o.wrapConstructor)((()=>new l))},8089:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const n=r(4421);if(t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function i(e){if("string"!=typeof e)throw new TypeError("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}function s(e){if("string"==typeof e&&(e=i(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}t.bytesToHex=function(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r{},t.asyncLoop=async function(e,r,n){let o=Date.now();for(let i=0;i=0&&ee instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;te().update(s(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(s(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto.web)return n.crypto.web.getRandomValues(new Uint8Array(e));if(n.crypto.node)return new Uint8Array(n.crypto.node.randomBytes(e).buffer);throw new Error("The environment doesn't have randomBytes function")}},9656:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.schnorr=t.verify=t.signSync=t.sign=t.getSharedSecret=t.recoverPublicKey=t.getPublicKey=t.Signature=t.Point=t.CURVE=void 0;const n=r(9159),o=BigInt(0),i=BigInt(1),s=BigInt(2),a=BigInt(3),c=BigInt(8),l=s**BigInt(256),u={a:o,b:BigInt(7),P:l-s**BigInt(32)-BigInt(977),n:l-BigInt("432420386565659656852420866394968145599"),h:i,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function p(e){const{a:t,b:r}=u,n=T(e*e),o=T(n*e);return T(o+t*e+r)}t.CURVE=u;const d=u.a===o;class f{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof y))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new f(e.x,e.y,i)}static toAffineBatch(e){const t=function(e,t=u.P){const r=new Array(e.length),n=I(e.reduce(((e,n,i)=>n===o?e:(r[i]=e,T(e*n,t))),i),t);return e.reduceRight(((e,n,i)=>n===o?e:(r[i]=T(e*r[i],t),T(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return f.toAffineBatch(e).map(f.fromAffine)}equals(e){if(!(e instanceof f))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:o,y:i,z:a}=e,c=T(n**s),l=T(a**s),u=T(t*l),p=T(o*c),d=T(T(r*a)*l),h=T(T(i*n)*c);return u===p&&d===h}negate(){return new f(this.x,T(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=T(e**s),o=T(t**s),i=T(o**s),l=T(s*(T((e+o)**s)-n-i)),u=T(a*n),p=T(u**s),d=T(p-s*l),h=T(u*(l-d)-c*i),y=T(s*t*r);return new f(d,h,y)}add(e){if(!(e instanceof f))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:i,y:a,z:c}=e;if(i===o||a===o)return this;if(t===o||r===o)return e;const l=T(n**s),u=T(c**s),p=T(t*u),d=T(i*l),h=T(T(r*c)*u),y=T(T(a*n)*l),_=T(d-p),g=T(y-h);if(_===o)return g===o?this.double():f.ZERO;const b=T(_**s),m=T(_*b),v=T(p*b),w=T(g**s-m-s*v),k=T(g*(v-w)-h*m),O=T(n*c*_);return new f(w,k,O)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=f.ZERO;if("bigint"==typeof e&&e===o)return t;let r=P(e);if(r===i)return this;if(!d){let e=t,n=this;for(;r>o;)r&i&&(e=e.add(n)),n=n.double(),r>>=i;return e}let{k1neg:n,k1:s,k2neg:a,k2:c}=U(r),l=t,p=t,h=this;for(;s>o||c>o;)s&i&&(l=l.add(h)),c&i&&(p=p.add(h)),h=h.double(),s>>=i,c>>=i;return n&&(l=l.negate()),a&&(p=p.negate()),p=new f(T(p.x*u.beta),p.y,p.z),l.add(p)}precomputeWindow(e){const t=d?128/e+1:256/e+1,r=[];let n=this,o=n;for(let i=0;i>=p,a>c&&(a-=u,e+=i),0===a){let e=n[r];t%2&&(e=e.negate()),s=s.add(e)}else{let e=n[r+Math.abs(a)-1];a<0&&(e=e.negate()),o=o.add(e)}}return{p:o,f:s}}multiply(e,t){let r,n,o=P(e);if(d){const{k1neg:e,k1:i,k2neg:s,k2:a}=U(o);let{p:c,f:l}=this.wNAF(i,t),{p,f:d}=this.wNAF(a,t);e&&(c=c.negate()),s&&(p=p.negate()),p=new f(T(p.x*u.beta),p.y,p.z),r=c.add(p),n=l.add(d)}else{const{p:e,f:i}=this.wNAF(o,t);r=e,n=i}return f.normalizeZ([r,n])[0]}toAffine(e=I(this.z)){const{x:t,y:r,z:n}=this,o=e,s=T(o*o),a=T(s*o),c=T(t*s),l=T(r*a);if(T(n*o)!==i)throw new Error("invZ was invalid");return new y(c,l)}}f.BASE=new f(u.Gx,u.Gy,i),f.ZERO=new f(o,i,o);const h=new WeakMap;class y{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,h.delete(this)}static fromCompressedHex(e){const t=32===e.length,r=E(t?e:e.subarray(1));if(!J(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=u,r=BigInt(6),n=BigInt(11),o=BigInt(22),i=BigInt(23),c=BigInt(44),l=BigInt(88),p=e*e*e%t,d=p*p*e%t,f=N(d,a)*d%t,h=N(f,a)*d%t,y=N(h,s)*p%t,_=N(y,n)*y%t,g=N(_,o)*_%t,b=N(g,c)*g%t,m=N(b,l)*b%t,v=N(m,c)*g%t,w=N(v,a)*d%t,k=N(w,i)*_%t,O=N(k,r)*p%t;return N(O,s)}(p(r));const o=(n&i)===i;t?o&&(n=T(-n)):1==(1&e[0])!==o&&(n=T(-n));const c=new y(r,n);return c.assertValidity(),c}static fromUncompressedHex(e){const t=E(e.subarray(1,33)),r=E(e.subarray(33,65)),n=new y(t,r);return n.assertValidity(),n}static fromHex(e){const t=B(e),r=t.length,n=t[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(t);if(65===r&&4===n)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r}`)}static fromPrivateKey(e){return y.BASE.multiply(H(e))}static fromSignature(e,t,r){const n=R(e=B(e)),{r:o,s:i}=F(t);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");const s=1&r?"03":"02",a=y.fromHex(s+O(o)),{n:c}=u,l=I(o,c),p=T(-n*l,c),d=T(i*l,c),f=y.BASE.multiplyAndAddUnsafe(a,p,d);if(!f)throw new Error("Cannot recover signature: point at infinify");return f.assertValidity(),f}toRawBytes(e=!1){return j(this.toHex(e))}toHex(e=!1){const t=O(this.x);return e?`${this.y&i?"03":"02"}${t}`:`04${t}${O(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:r}=this;if(!J(t)||!J(r))throw new Error(e);const n=T(r*r);if(T(n-p(t))!==o)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new y(this.x,T(-this.y))}double(){return f.fromAffine(this).double().toAffine()}add(e){return f.fromAffine(this).add(f.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return f.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const n=f.fromAffine(this),s=t===o||t===i||this!==y.BASE?n.multiplyUnsafe(t):n.multiply(t),a=f.fromAffine(e).multiplyUnsafe(r),c=s.add(a);return c.equals(f.ZERO)?void 0:c.toAffine()}}function _(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function g(e){if(e.length<2||2!==e[0])throw new Error(`Invalid signature integer tag: ${k(e)}`);const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:E(r),left:e.subarray(t+2)}}t.Point=y,y.BASE=new y(u.Gx,u.Gy),y.ZERO=new y(o,o);class b{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=v(e),r="Signature.fromCompact";if("string"!=typeof e&&!t)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=t?k(e):e;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new b(A(n.slice(0,64)),A(n.slice(64,128)))}static fromDER(e){const t=v(e);if("string"!=typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(e){if(e.length<2||48!=e[0])throw new Error(`Invalid signature tag: ${k(e)}`);if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=g(e.subarray(2)),{data:n,left:o}=g(r);if(o.length)throw new Error(`Invalid signature: left bytes after parsing: ${k(o)}`);return{r:t,s:n}}(t?e:j(e));return new b(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!C(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!C(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=u.n>>i;return this.s>e}normalizeS(){return this.hasHighS()?new b(this.r,u.n-this.s):this}toDERRawBytes(e=!1){return j(this.toDERHex(e))}toDERHex(e=!1){const t=_(S(this.s));if(e)return t;const r=_(S(this.r)),n=S(r.length/2),o=S(t.length/2);return`30${S(r.length/2+t.length/2+4)}02${n}${r}02${o}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return j(this.toCompactHex())}toCompactHex(){return O(this.r)+O(this.s)}}function m(...e){if(!e.every(v))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;tt.toString(16).padStart(2,"0")));function k(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;rl)throw new Error("Expected number < 2^256");return e.toString(16).padStart(64,"0")}function x(e){return j(O(e))}function S(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function A(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt(`0x${e}`)}function j(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let r=0;r0)return BigInt(e);if("bigint"==typeof e&&C(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function T(e,t=u.P){const r=e%t;return r>=o?r:t+r}function N(e,t){const{P:r}=u;let n=e;for(;t-- >o;)n*=n,n%=r;return n}function I(e,t=u.P){if(e===o||t<=o)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=T(e,t),n=t,s=o,a=i,c=i,l=o;for(;r!==o;){const e=n/r,t=n%r,o=s-c*e,i=a-l*e;n=r,r=t,s=c,a=l,c=o,l=i}if(n!==i)throw new Error("invert: does not exist");return T(s,t)}const L=(e,t)=>(e+t/s)/t,D=s**BigInt(128);function U(e){const{n:t}=u,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-i*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,a=L(s*e,t),c=L(-n*e,t);let l=T(e-a*r-c*o,t),p=T(-a*n-c*s,t);const d=l>D,f=p>D;if(d&&(l=t-l),f&&(p=t-p),l>D||p>D)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:f,k2:p}}function R(e){const{n:t}=u,r=8*e.length-256;let n=E(e);return r>0&&(n>>=BigInt(r)),n>=t&&(n-=t),n}class z{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(...e){return t.utils.hmacSha256(this.k,...e)}hmacSync(...e){if("function"!=typeof t.utils.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");const r=t.utils.hmacSha256Sync(this.k,...e);if(r instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return r}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(e=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(e=new Uint8Array){this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function C(e){return o0)t=BigInt(e);else if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");t=A(e)}else{if(!v(e))throw new TypeError("Expected valid private key");if(32!==e.length)throw new Error("Expected 32 bytes of private key");t=E(e)}if(!C(t))throw new Error("Expected private key: 0 < key < n");return t}function M(e){return e instanceof y?(e.assertValidity(),e):y.fromHex(e)}function F(e){if(e instanceof b)return e.assertValidity(),e;try{return b.fromDER(e)}catch(t){return b.fromCompact(e)}}function q(e){const t=v(e),r="string"==typeof e,n=(t||r)&&e.length;return t?33===n||65===n:r?66===n||130===n:e instanceof y}function V(e){return E(e.length>32?e.slice(0,32):e)}function K(e){const t=V(e),r=T(t,u.n);return G(rx(T(H(e)+H(t),u.n)),privateNegate:e=>{const t=H(e);return x(u.n-t)},pointAddScalar:(e,t,r)=>{const n=y.fromHex(e),o=H(t),s=y.BASE.multiplyAndAddUnsafe(n,o,i);if(!s)throw new Error("Tweaked point at infinity");return s.toRawBytes(r)},pointMultiply:(e,t,r)=>{const n=y.fromHex(e),o=E(B(t));return n.multiply(o).toRawBytes(r)},hashToPrivateKey:e=>{if((e=B(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");return x(T(E(e),u.n-i)+i)},randomBytes:(e=32)=>{if(le.web)return le.web.getRandomValues(new Uint8Array(e));if(le.node){const{randomBytes:t}=le.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>t.utils.hashToPrivateKey(t.utils.randomBytes(40)),bytesToHex:k,hexToBytes:j,concatBytes:m,mod:T,invert:I,sha256:async(...e)=>{if(le.web){const t=await le.web.subtle.digest("SHA-256",m(...e));return new Uint8Array(t)}if(le.node){const{createHash:t}=le.node,r=t("sha256");return e.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(e,...t)=>{if(le.web){const r=await le.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=m(...t),o=await le.web.subtle.sign("HMAC",r,n);return new Uint8Array(o)}if(le.node){const{createHmac:r}=le.node,n=r("sha256",e);return t.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(e,...r)=>{let n=pe[e];if(void 0===n){const r=await t.utils.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));n=m(r,r),pe[e]=n}return t.utils.sha256(n,...r)},taggedHashSync:(e,...r)=>{if("function"!=typeof t.utils.sha256Sync)throw new Error("utils.sha256Sync is undefined, you need to set it");let n=pe[e];if(void 0===n){const r=t.utils.sha256Sync(Uint8Array.from(e,(e=>e.charCodeAt(0))));n=m(r,r),pe[e]=n}return t.utils.sha256Sync(n,...r)},precompute(e=8,t=y.BASE){const r=t===y.BASE?t:new y(t.x,t.y);return r._setWindowSize(e),r.multiply(a),r}}},4537:e=>{"use strict";e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,o=2,i=!0;o{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),o=new Array(123),i=0;i<64;)o[n[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;r.encode=function(e,t,r){for(var o,i=null,s=[],a=0,c=0;t>2],o=(3&l)<<4,c=1;break;case 1:s[a++]=n[o|l>>4],o=(15&l)<<2,c=2;break;case 2:s[a++]=n[o|l>>6],s[a++]=n[63&l],c=0}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=n[o],s[a++]=61,1===c&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";r.decode=function(e,t,r){for(var n,i=r,a=0,c=0;c1)break;if(void 0===(l=o[l]))throw Error(s);switch(a){case 0:n=l,a=1;break;case 1:t[r++]=n<<2|(48&l)>>4,n=l,a=2;break;case 2:t[r++]=(15&n)<<4|(60&l)>>2,n=l,a=3;break;case 3:t[r++]=(3&n)<<6|l,a=0}}if(1===a)throw Error(s);return r-i},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},5124:e=>{"use strict";function t(e,r){"string"==typeof e&&(r=e,e=void 0);var n=[];function o(e){if("string"!=typeof e){var r=i();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var s=Object.keys(e),a=new Array(s.length+1),c=new Array(s.length),l=0;l{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n{"use strict";e.exports=i;var n=r(4537),o=r(7199)("fs");function i(e,t,r){return"function"==typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&o&&o.readFile?o.readFile(e,(function(n,o){return n&&"undefined"!=typeof XMLHttpRequest?i.xhr(e,t,r):n?r(n):r(null,t.binary?o:o.toString("utf8"))})):i.xhr(e,t,r):n(i,this,e,t)}i.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var o=0;o{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3]}function i(e,n,o){t[0]=e,n[o]=r[3],n[o+1]=r[2],n[o+2]=r[1],n[o+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?o:i,e.writeFloatBE=n?i:o,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var o=t<0?1:0;if(o&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((o<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((o<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var i=Math.floor(Math.log(t)/Math.LN2);e((o<<31|i+127<<23|8388607&Math.round(t*Math.pow(2,-i)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),o=2*(n>>31)+1,i=n>>>23&255,s=8388607&n;return 255===i?s?NaN:o*(1/0):0===i?1401298464324817e-60*o*s:o*Math.pow(2,i-150)*(s+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=s.bind(null,o),e.readFloatBE=s.bind(null,i)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function o(e,n,o){t[0]=e,n[o]=r[0],n[o+1]=r[1],n[o+2]=r[2],n[o+3]=r[3],n[o+4]=r[4],n[o+5]=r[5],n[o+6]=r[6],n[o+7]=r[7]}function i(e,n,o){t[0]=e,n[o]=r[7],n[o+1]=r[6],n[o+2]=r[5],n[o+3]=r[4],n[o+4]=r[3],n[o+5]=r[2],n[o+6]=r[1],n[o+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?o:i,e.writeDoubleBE=n?i:o,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,o,i){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,o,i+t),e(1/n>0?0:2147483648,o,i+r);else if(isNaN(n))e(0,o,i+t),e(2146959360,o,i+r);else if(n>17976931348623157e292)e(0,o,i+t),e((s<<31|2146435072)>>>0,o,i+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,o,i+t),e((s<<31|a/4294967296)>>>0,o,i+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,o,i+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,o,i+r)}}}function s(e,t,r,n,o){var i=e(n,o+t),s=e(n,o+r),a=2*(s>>31)+1,c=s>>>20&2047,l=4294967296*(1048575&s)+i;return 2047===c?l?NaN:a*(1/0):0===c?5e-324*a*l:a*Math.pow(2,c-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=s.bind(null,o,0,4),e.readDoubleBE=s.bind(null,i,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function i(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},7199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},8626:(e,t)=>{"use strict";var r=t,n=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},o=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),o="";r&&(o=t.shift()+"/");for(var i=0;i0&&".."!==t[i-1]?t.splice(--i,2):r?t.splice(i,1):++i:"."===t[i]?t.splice(i,1):++i;return o+t.join("/")};r.resolve=function(e,t,r){return r||(t=o(t)),n(t)?t:(r||(e=o(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?o(e+"/"+t):t)}},6662:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,o=n>>>1,i=null,s=n;return function(r){if(r<1||r>o)return e(r);s+r>n&&(i=e(n),s=0);var a=t.call(i,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},4997:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n191&&n<224?i[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,i[s++]=55296+(n>>10),i[s++]=56320+(1023&n)):i[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o?(s&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))},r.write=function(e,t,r){for(var n,o,i=r,s=0;s>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&o),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-i}},556:(e,t,r)=>{"use strict";const{encodeText:n}=r(2413);e.exports=class{constructor(e,t,r,o){this.name=e,this.code=t,this.codeBuf=n(this.code),this.alphabet=o,this.codec=r(o)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}}},5077:(e,t,r)=>{"use strict";const n=r(8820),o=r(556),{rfc4648:i}=r(6727),{decodeText:s,encodeText:a}=r(2413),c=[["identity","\0",()=>({encode:s,decode:a}),""],["base2","0",i(1),"01"],["base8","7",i(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",i(4),"0123456789abcdef"],["base16upper","F",i(4),"0123456789ABCDEF"],["base32hex","v",i(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",i(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",i(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",i(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",i(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],l=c.reduce(((e,t)=>(e[t[0]]=new o(t[0],t[1],t[2],t[3]),e)),{}),u=c.reduce(((e,t)=>(e[t[1]]=l[t[0]],e)),{});e.exports={names:l,codes:u}},6957:(e,t,r)=>{"use strict";const n=r(5077),{encodeText:o,decodeText:i,concat:s}=r(2413);function a(e){if(Object.prototype.hasOwnProperty.call(n.names,e))return n.names[e];if(Object.prototype.hasOwnProperty.call(n.codes,e))return n.codes[e];throw new Error(`Unsupported encoding: ${e}`)}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:n}=a(e);return function(e,t){a(e).decode(i(t))}(r,t),s([n,t],n.length+t.length)}).encode=function(e,t){const r=a(e),n=o(r.encode(t));return s([r.codeBuf,n],r.codeBuf.length+n.length)},t.decode=function(e){e instanceof Uint8Array&&(e=i(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),a(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=i(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return a(e[0]).name}catch(e){return!1}},t.encoding=a,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=i(e)),a(e[0])};const c=Object.freeze(n.names),l=Object.freeze(n.codes);t.names=c,t.codes=l},6727:e=>{"use strict";e.exports={rfc4648:e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],o=(1<r;)s-=r,i+=t[o&a>>s];if(s&&(i+=t[o&a<((e,t,r)=>{const n={};for(let e=0;e=8&&(s-=8,i[c++]=255&a>>s)}if(s>=r||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return i})(r,t,e)})}},2413:e=>{"use strict";const t=new TextDecoder,r=new TextEncoder;e.exports={decodeText:e=>t.decode(e),encodeText:e=>r.encode(e),concat:function(e,t){const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}}},4492:(e,t,r)=>{"use strict";e.exports=r(8836)},2100:(e,t,r)=>{"use strict";e.exports=r(9482)},3996:(e,t,r)=>{"use strict";var n=t,o=r(7025),i=r(9935);function s(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof o){e("switch(d%s){",n);for(var i=t.resolvedType.values,s=Object.keys(i),a=0;a>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof o?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var i=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":i=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,i?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,r=i.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var n=0;n{"use strict";e.exports=function(e){var t=i.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos>>3){");for(var r=0;r>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===o.basic[c]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",c),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==o.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',l):t("%s[k]=value",l)):a.repeated?(t("if(!(%s&&%s.length))",l,l)("%s=[]",l),void 0!==o.packed[c]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos{"use strict";e.exports=function(e){for(var t,r=i.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(i.compareFieldsById),c=0;c>>0,8|o.mapKey[l.keyType],l.keyType),void 0===d?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",u,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,p,t),r("}")("}")):l.repeated?(r("if(%s!=null&&%s.length){",t,t),l.packed&&void 0!==o.packed[p]?r("w.uint32(%i).fork()",(l.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",p,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===d?s(r,l,u,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(l.id<<3|d)>>>0,p,t)),r("}")):(l.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,l.name),void 0===d?s(r,l,u,t):r("w.uint32(%i).%s(%s)",(l.id<<3|d)>>>0,p,t))}return r("return w")};var n=r(7025),o=r(7063),i=r(9935);function s(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},7025:(e,t,r)=>{"use strict";e.exports=s;var n=r(3243);((s.prototype=Object.create(n.prototype)).constructor=s).className="Enum";var o=r(9313),i=r(9935);function s(e,t,r,o,i){if(n.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=i||{},this.reserved=void 0,t)for(var s=Object.keys(t),a=0;a{"use strict";e.exports=l;var n=r(3243);((l.prototype=Object.create(n.prototype)).constructor=l).className="Field";var o,i=r(7025),s=r(7063),a=r(9935),c=/^required|optional|repeated$/;function l(e,t,r,o,i,l,u){if(a.isObject(o)?(u=i,l=o,o=i=void 0):a.isObject(i)&&(u=l,l=i,i=void 0),n.call(this,e,l),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==o&&!c.test(o=o.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==i&&!a.isString(i))throw TypeError("extend must be a string");"proto3_optional"===o&&(o="optional"),this.rule=o&&"optional"!==o?o:void 0,this.type=r,this.id=t,this.extend=i||void 0,this.required="required"===o,this.optional=!this.required,this.repeated="repeated"===o,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==s.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=u}l.fromJSON=function(e,t){return new l(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(l.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),l.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),n.prototype.setOption.call(this,e,t,r)},l.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},l.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=s.defaults[this.type])?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof o?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof i&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof i)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof o&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},l.d=function(e,t,r,n){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(o,i){a.decorateType(o.constructor).add(new l(i,e,t,r,{default:n}))}},l._configure=function(e){o=e}},8836:(e,t,r)=>{"use strict";var n=e.exports=r(9482);n.build="light",n.load=function(e,t,r){return"function"==typeof t?(r=t,t=new n.Root):t||(t=new n.Root),t.load(e,r)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=r(4928),n.decoder=r(5305),n.verifier=r(4497),n.converter=r(3996),n.ReflectionObject=r(3243),n.Namespace=r(9313),n.Root=r(9424),n.Enum=r(7025),n.Type=r(7645),n.Field=r(3548),n.OneOf=r(7598),n.MapField=r(6039),n.Service=r(7513),n.Method=r(4429),n.Message=r(8368),n.wrappers=r(1667),n.types=r(7063),n.util=r(9935),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},9482:(e,t,r)=>{"use strict";var n=t;function o(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(1173),n.BufferWriter=r(3155),n.Reader=r(1408),n.BufferReader=r(593),n.util=r(9693),n.rpc=r(5994),n.roots=r(5054),n.configure=o,o()},6039:(e,t,r)=>{"use strict";e.exports=s;var n=r(3548);((s.prototype=Object.create(n.prototype)).constructor=s).className="MapField";var o=r(7063),i=r(9935);function s(e,t,r,o,s,a){if(n.call(this,e,t,o,void 0,void 0,s,a),!i.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}s.fromJSON=function(e,t){return new s(e,t.id,t.keyType,t.type,t.options,t.comment)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},s.prototype.resolve=function(){if(this.resolved)return this;if(void 0===o.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},s.d=function(e,t,r){return"function"==typeof r?r=i.decorateType(r).name:r&&"object"==typeof r&&(r=i.decorateEnum(r).name),function(n,o){i.decorateType(n.constructor).add(new s(o,e,t,r))}}},8368:(e,t,r)=>{"use strict";e.exports=o;var n=r(9693);function o(e){if(e)for(var t=Object.keys(e),r=0;r{"use strict";e.exports=i;var n=r(3243);((i.prototype=Object.create(n.prototype)).constructor=i).className="Method";var o=r(9935);function i(e,t,r,i,s,a,c,l,u){if(o.isObject(s)?(c=s,s=a=void 0):o.isObject(a)&&(c=a,a=void 0),void 0!==t&&!o.isString(t))throw TypeError("type must be a string");if(!o.isString(r))throw TypeError("requestType must be a string");if(!o.isString(i))throw TypeError("responseType must be a string");n.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!s||void 0,this.responseType=i,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=l,this.parsedOptions=u}i.fromJSON=function(e,t){return new i(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},i.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},i.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},9313:(e,t,r)=>{"use strict";e.exports=u;var n=r(3243);((u.prototype=Object.create(n.prototype)).constructor=u).className="Namespace";var o,i,s,a=r(3548),c=r(9935);function l(e,t){if(e&&e.length){for(var r={},n=0;nt)return!0;return!1},u.isReservedName=function(e,t){if(e)for(var r=0;r0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof u))throw Error("path conflicts with non-namespace objects")}else r.add(r=new u(n))}return t&&r.addJSON(t),r},u.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t-1)return n}else if(n instanceof u&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var o=0;o{"use strict";e.exports=i,i.className="ReflectionObject";var n,o=r(9935);function i(e,t){if(!o.isString(e))throw TypeError("name must be a string");if(t&&!o.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(i.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),i.prototype.toJSON=function(){throw Error()},i.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof n&&t._handleAdd(this)},i.prototype.onRemove=function(e){var t=e.root;t instanceof n&&t._handleRemove(this),this.parent=null,this.resolved=!1},i.prototype.resolve=function(){return this.resolved||this.root instanceof n&&(this.resolved=!0),this},i.prototype.getOption=function(e){if(this.options)return this.options[e]},i.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},i.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var i=n.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(i){var s=i[e];o.setProperty(s,r,t)}else(i={})[e]=o.setProperty({},r,t),n.push(i)}else{var a={};a[e]=t,n.push(a)}return this},i.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n{"use strict";e.exports=s;var n=r(3243);((s.prototype=Object.create(n.prototype)).constructor=s).className="OneOf";var o=r(3548),i=r(9935);function s(e,t,r,o){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=o}function a(e){if(e.parent)for(var t=0;t-1&&this.oneof.splice(t,1),e.partOf=null,this},s.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t{"use strict";e.exports=c;var n,o=r(9693),i=o.LongBits,s=o.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var l,u="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},p=function(){return o.Buffer?function(e){return(c.create=function(e){return o.Buffer.isBuffer(e)?new n(e):u(e)})(e)}:u};function d(){var e=new i(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function h(){if(this.pos+8>this.len)throw a(this,8);return new i(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}c.create=p(),c.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return l}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=p(),n._configure();var t=o.Long?"toLong":"toNumber";o.merge(c.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return h.call(this)[t](!0)},sfixed64:function(){return h.call(this)[t](!1)}})}},593:(e,t,r)=>{"use strict";e.exports=i;var n=r(1408);(i.prototype=Object.create(n.prototype)).constructor=i;var o=r(9693);function i(e){n.call(this,e)}i._configure=function(){o.Buffer&&(i.prototype._slice=o.Buffer.prototype.slice)},i.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},i._configure()},9424:(e,t,r)=>{"use strict";e.exports=p;var n=r(9313);((p.prototype=Object.create(n.prototype)).constructor=p).className="Root";var o,i,s,a=r(3548),c=r(7025),l=r(7598),u=r(9935);function p(e){n.call(this,"",e),this.deferred=[],this.files=[]}function d(){}p.fromJSON=function(e,t){return t||(t=new p),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},p.prototype.resolvePath=u.path.resolve,p.prototype.fetch=u.fetch,p.prototype.load=function e(t,r,n){"function"==typeof r&&(n=r,r=void 0);var o=this;if(!n)return u.asPromise(e,o,t,r);var a=n===d;function c(e,t){if(n){var r=n;if(n=null,a)throw e;r(e,t)}}function l(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in s)return r}return null}function p(e,t){try{if(u.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),u.isString(t)){i.filename=e;var n,s=i(t,o,r),p=0;if(s.imports)for(;p-1))if(o.files.push(e),e in s)a?p(e,s[e]):(++h,setTimeout((function(){--h,p(e,s[e])})));else if(a){var r;try{r=u.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||c(e))}p(e,r)}else++h,o.fetch(e,(function(r,i){--h,n&&(r?t?h||c(null,o):c(r):p(e,i))}))}var h=0;u.isString(t)&&(t=[t]);for(var y,_=0;_-1&&this.deferred.splice(t,1)}}else if(e instanceof c)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r{"use strict";e.exports={}},5994:(e,t,r)=>{"use strict";t.Service=r(7948)},7948:(e,t,r)=>{"use strict";e.exports=o;var n=r(9693);function o(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(o.prototype=Object.create(n.EventEmitter.prototype)).constructor=o,o.prototype.rpcCall=function e(t,r,o,i,s){if(!i)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,o,i);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof o))try{r=o[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},o.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},7513:(e,t,r)=>{"use strict";e.exports=a;var n=r(9313);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var o=r(4429),i=r(9935),s=r(5994);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),i=0;i{"use strict";e.exports=b;var n=r(9313);((b.prototype=Object.create(n.prototype)).constructor=b).className="Type";var o=r(7025),i=r(7598),s=r(3548),a=r(6039),c=r(7513),l=r(8368),u=r(1408),p=r(1173),d=r(9935),f=r(4928),h=r(5305),y=r(4497),_=r(3996),g=r(1667);function b(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function m(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(b.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t{"use strict";var n=t,o=r(9935),i=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function s(e,t){var r=0,n={};for(t|=0;r{"use strict";var n,o,i=e.exports=r(9693),s=r(5054);i.codegen=r(5124),i.fetch=r(9054),i.path=r(8626),i.fs=i.inquire("fs"),i.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n0)t[o]=e(t[o]||{},r,n);else{var i=t[o];i&&(n=[].concat(i).concat(n)),t[o]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(i,"decorateRoot",{get:function(){return s.decorated||(s.decorated=new(r(9424)))}})},1945:(e,t,r)=>{"use strict";e.exports=o;var n=r(9693);function o(e,t){this.lo=e>>>0,this.hi=t>>>0}var i=o.zero=new o(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var s=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(e){if(0===e)return i;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new o(r,n)},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(n.isString(e)){if(!n.Long)return o.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):i},o.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;o.fromHash=function(e){return e===s?i:new o((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},9693:function(e,t,r){"use strict";var n=t;function o(e,t,r){for(var n=Object.keys(t),o=0;oe,set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}n.asPromise=r(4537),n.base64=r(7419),n.EventEmitter=r(9211),n.float=r(945),n.inquire=r(7199),n.utf8=r(4997),n.pool=r(6662),n.LongBits=r(1945),n.isNode=Boolean(void 0!==r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=o,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=i,n.ProtocolError=i("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r{"use strict";e.exports=function(e){var t=o.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r={};e.oneofsArray.length&&t("var p={}");for(var n=0;n{"use strict";var n=t,o=r(8368);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].slice(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var i=this.lookup(n);i&&(e=i.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof o){var s=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),n=r+("."===e.$type.fullName[0]?e.$type.fullName.slice(1):e.$type.fullName),s["@type"]=n,s}return this.toObject(e,t)}}},1173:(e,t,r)=>{"use strict";e.exports=p;var n,o=r(9693),i=o.LongBits,s=o.base64,a=o.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function l(){}function u(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function p(){this.len=0,this.head=new c(l,0,0),this.tail=this.head,this.states=null}var d=function(){return o.Buffer?function(){return(p.create=function(){return new n})()}:function(){return new p}};function f(e,t,r){t[r]=255&e}function h(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function _(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}p.create=d(),p.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(p.alloc=o.pool(p.alloc,o.Array.prototype.subarray)),p.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},h.prototype=Object.create(c.prototype),h.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},p.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new h((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},p.prototype.int32=function(e){return e<0?this._push(y,10,i.fromNumber(e)):this.uint32(e)},p.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},p.prototype.uint64=function(e){var t=i.from(e);return this._push(y,t.length(),t)},p.prototype.int64=p.prototype.uint64,p.prototype.sint64=function(e){var t=i.from(e).zzEncode();return this._push(y,t.length(),t)},p.prototype.bool=function(e){return this._push(f,1,e?1:0)},p.prototype.fixed32=function(e){return this._push(_,4,e>>>0)},p.prototype.sfixed32=p.prototype.fixed32,p.prototype.fixed64=function(e){var t=i.from(e);return this._push(_,4,t.lo)._push(_,4,t.hi)},p.prototype.sfixed64=p.prototype.fixed64,p.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},p.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var g=o.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;if(!t)return this._push(f,1,0);if(o.isString(e)){var r=p.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(g,t,e)},p.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},p.prototype.fork=function(){return this.states=new u(this),this.head=this.tail=new c(l,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(l,0,0),this.len=0),this},p.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},p.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},p._configure=function(e){n=e,p.create=d(),n._configure()}},3155:(e,t,r)=>{"use strict";e.exports=i;var n=r(1173);(i.prototype=Object.create(n.prototype)).constructor=i;var o=r(9693);function i(){n.call(this)}function s(e,t,r){e.length<40?o.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}i._configure=function(){i.alloc=o._Buffer_allocUnsafe,i.writeBytesBuffer=o.Buffer&&o.Buffer.prototype instanceof Uint8Array&&"set"===o.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(i.writeBytesBuffer,t,e),this},i.prototype.string=function(e){var t=o.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},i._configure()},9822:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Contract=void 0;const n=r(7187),o=r(8593);class i{constructor(e){var t;e.id&&(this.id=(0,o.decodeBase58)(e.id)),this.signer=e.signer,this.provider=e.provider||(null===(t=e.signer)||void 0===t?void 0:t.provider),this.abi=e.abi,this.bytecode=e.bytecode,e.serializer?this.serializer=e.serializer:e.abi&&e.abi.koilib_types&&(this.serializer=new n.Serializer(e.abi.koilib_types)),this.options={signTransaction:!0,sendTransaction:!0,broadcast:!0,sendAbis:!0,...e.options},this.functions={},this.abi&&this.abi.methods&&Object.keys(this.abi.methods).forEach((e=>{this.functions[e]=async(t={},r)=>{if(!this.provider)throw new Error("provider not found");if(!this.abi||!this.abi.methods)throw new Error("Methods are not defined");if(!this.abi.methods[e])throw new Error(`Method ${e} not defined in the ABI`);const n={...this.options,...r},{read_only:i,return:s,default_output:a,preformat_argument:c,preformat_return:l}=this.abi.methods[e];let u;u="function"==typeof c?c(t):t;const p=await this.encodeOperation({name:e,args:u});if(n.onlyOperation)return{operation:p};if(i){if(!s)throw new Error(`No output defined for ${e}`);const{result:t}=await this.provider.readContract(p.call_contract);let r=a;return t&&(r=await this.serializer.deserialize(t,s)),"function"==typeof l&&(r=l(r)),{operation:p,result:r}}if(!this.signer)throw new Error("signer not found");let d=await this.signer.prepareTransaction({header:{...n.chainId&&{chain_id:n.chainId},...n.rcLimit&&{rc_limit:n.rcLimit},...n.nonce&&{nonce:n.nonce},...n.payer&&{payer:n.payer},...n.payee&&{payee:n.payee}},operations:[...n.previousOperations?n.previousOperations:[],p,...n.nextOperations?n.nextOperations:[]]});const f={broadcast:n.broadcast,beforeSend:n.beforeSend};if(n.sendAbis){f.abis={};const e=(0,o.encodeBase58)(this.id);f.abis[e]=this.abi}if(!n.sendTransaction){const e=()=>{throw new Error("This transaction was not broadcasted")};return n.signTransaction&&(d=await this.signer.signTransaction(d,f.abis)),{operation:p,transaction:{...d,wait:e}}}const{transaction:h,receipt:y}=await this.signer.sendTransaction(d,f);return{operation:p,transaction:h,receipt:y}}}))}getId(){if(!this.id)throw new Error("id is not defined");return(0,o.encodeBase58)(this.id)}async deploy(e){if(!this.signer)throw new Error("signer not found");if(!this.bytecode)throw new Error("bytecode not found");const t={...this.options,...e},r={upload_contract:{contract_id:this.id?(0,o.encodeBase58)(this.id):this.signer.getAddress(),bytecode:(0,o.encodeBase64url)(this.bytecode),...t.abi&&{abi:t.abi},...t.authorizesCallContract&&{authorizes_call_contract:t.authorizesCallContract},...t.authorizesTransactionApplication&&{authorizes_transaction_application:t.authorizesTransactionApplication},...t.authorizesUploadContract&&{authorizes_upload_contract:t.authorizesUploadContract}}};if(t.onlyOperation)return{operation:r};let n=await this.signer.prepareTransaction({header:{...t.chainId&&{chain_id:t.chainId},...t.rcLimit&&{rc_limit:t.rcLimit},...t.nonce&&{nonce:t.nonce},...t.payer&&{payer:t.payer},...t.payee&&{payee:t.payee}},operations:[...t.previousOperations?t.previousOperations:[],r,...t.nextOperations?t.nextOperations:[]]});const i={broadcast:t.broadcast,beforeSend:t.beforeSend};if(!t.sendTransaction){const e=()=>{throw new Error("This transaction was not broadcasted")};return t.signTransaction&&(n=await this.signer.signTransaction(n)),{operation:r,transaction:{...n,wait:e}}}const{transaction:s,receipt:a}=await this.signer.sendTransaction(n,i);return{operation:r,transaction:s,receipt:a}}async encodeOperation(e){if(!this.abi||!this.abi.methods||!this.abi.methods[e.name])throw new Error(`Operation ${e.name} unknown`);if(!this.serializer)throw new Error("Serializer is not defined");if(!this.id)throw new Error("Contract id is not defined");const t=this.abi.methods[e.name];let r=new Uint8Array(0);if(t.argument){if(!e.args)throw new Error(`No arguments defined for type '${t.argument}'`);r=await this.serializer.serialize(e.args,t.argument)}return{call_contract:{contract_id:(0,o.encodeBase58)(this.id),entry_point:t.entry_point,args:(0,o.encodeBase64url)(r)}}}async decodeOperation(e){if(!this.id)throw new Error("Contract id is not defined");if(!this.abi||!this.abi.methods)throw new Error("Methods are not defined");if(!this.serializer)throw new Error("Serializer is not defined");if(!e.call_contract)throw new Error("Operation is not CallContractOperation");if(e.call_contract.contract_id!==(0,o.encodeBase58)(this.id))throw new Error(`Invalid contract id. Expected: ${(0,o.encodeBase58)(this.id)}. Received: ${e.call_contract.contract_id}`);for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Provider=void 0;const n=r(9104),o=r(8593);async function i(e){return new Promise((t=>setTimeout(t,e)))}class s{constructor(e){Array.isArray(e)?this.rpcNodes=e:this.rpcNodes=[e],this.currentNodeId=0,this.onError=()=>!0}async call(e,t){for(;;)try{const r={id:Math.round(1e3*Math.random()),jsonrpc:"2.0",method:e,params:t},n=this.rpcNodes[this.currentNodeId],o=await fetch(n,{method:"POST",body:JSON.stringify(r)}),i=await o.json();if(void 0!==i.result)return i.result;if(!i.error)throw new Error("undefined error");const{message:s,data:a}=i.error;if(!a)throw new Error(s);let c;try{c=JSON.parse(a)}catch(e){c={data:a}}throw new Error(JSON.stringify({...s&&{error:s},...c}))}catch(e){const t=this.rpcNodes[this.currentNodeId];this.currentNodeId=(this.currentNodeId+1)%this.rpcNodes.length;const r=this.rpcNodes[this.currentNodeId];if(this.onError(e,t,r))throw e}}async getNonce(e,t=!0){const{nonce:r}=await this.call("chain.get_account_nonce",{account:e});if(!t)return r;const i=(0,o.decodeBase64url)(r),s=n.koinos.chain.value_type.decode(i),a=n.koinos.chain.value_type.toObject(s,{longs:String,defaults:!0});return Number(a.uint64_value)}async getNextNonce(e){const t=await this.getNonce(e),r=n.koinos.chain.value_type.create({uint64_value:String(t+1)}),i=n.koinos.chain.value_type.encode(r).finish();return(0,o.encodeBase64url)(i)}async getAccountRc(e){const{rc:t}=await this.call("chain.get_account_rc",{account:e});return t||"0"}async getTransactionsById(e){return this.call("transaction_store.get_transactions_by_id",{transaction_ids:e})}async getBlocksById(e){return this.call("block_store.get_blocks_by_id",{block_ids:e,return_block:!0,return_receipt:!1})}async getHeadInfo(){return this.call("chain.get_head_info",{})}async getChainId(){const{chain_id:e}=await this.call("chain.get_chain_id",{});return e}async getBlocks(e,t=1,r){let n=r;return n||(n=(await this.getHeadInfo()).head_topology.id),(await this.call("block_store.get_blocks_by_height",{head_block_id:n,ancestor_start_height:e,num_blocks:t,return_block:!0,return_receipt:!1})).block_items}async getBlock(e){return(await this.getBlocks(e,1))[0]}async wait(e,t="byBlock",r=15e3){const n=Date.now();if("byTransactionId"===t){for(;Date.now(){const o=await this.getBlocks(t,r,n);let i=0,s="";o.forEach((t=>{t&&t.block&&t.block_id&&t.block.transactions&&t.block.transactions.find((t=>t.id===e))&&(i=Number(t.block_height),s=t.block_id)}));const a=o[o.length-1].block_id;return[i,s,a]};let s=0,a=0,c="";for(;Date.now()Number(e.height))continue;const[t,r,n]=await o(s,1,e.id);if(t)return{blockId:r,blockNumber:t};c||(c=n),s+=1}throw new Error(`Transaction not mined after ${r} ms. Blocks checked from ${a} to ${s}`)}async sendTransaction(e,t=!0){const r=await this.call("chain.submit_transaction",{transaction:e,broadcast:t});return e.wait=async(t="byBlock",r=15e3)=>this.wait(e.id,t,r),{...r,transaction:e}}async submitBlock(e){return this.call("chain.submit_block",{block:e})}async readContract(e){return this.call("chain.read_contract",e)}}t.Provider=s,t.default=s},7187:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Serializer=void 0;const n=r(4492),o=r(8593),i="(koinos.btype)",s=["double","float","int32","int64","uint32","uint64","sint32","sint64","fixed32","fixed64","sfixed32","sfixed64","bool","string","bytes"];class a{constructor(e,t){this.bytesConversion=!0,this.verifyChecksum={serialize:!0,deserialize:!1},this.types=e,this.root=n.Root.fromJSON(this.types),(null==t?void 0:t.defaultTypeName)&&(this.defaultType=this.root.lookupType(t.defaultTypeName)),t&&void 0!==t.bytesConversion&&(this.bytesConversion=t.bytesConversion)}btypeDecode(e,t,r){const n={};return Object.keys(t.fields).forEach((a=>{const{options:c,name:l,type:u,rule:p}=t.fields[a];if(!e[l])return;const d={type:u};if(c&&(c["(btype)"]?d.btype=c["(btype)"]:c[i]&&(d.btype=c[i])),"repeated"!==p){if(!s.includes(u)){const t=this.root.lookupTypeOrEnum(u);return t.fields?void(n[l]=this.btypeDecode(e[l],t,r)):void(n[l]=e[l])}n[l]=(0,o.btypeDecodeValue)(e[l],d,r)}else n[l]=e[l].map((e=>{if(!s.includes(u)){const t=this.root.lookupTypeOrEnum(u);return t.fields?this.btypeDecode(e,t,r):e}return(0,o.btypeDecodeValue)(e,d,r)}))})),n}btypeEncode(e,t,r){const n={};return Object.keys(t.fields).forEach((a=>{const{options:c,name:l,type:u,rule:p}=t.fields[a];if(!e[l])return;const d={type:u};if(c&&(c["(btype)"]?d.btype=c["(btype)"]:c[i]&&(d.btype=c[i])),"repeated"!==p){if(!s.includes(u)){const t=this.root.lookupTypeOrEnum(u);return t.fields?void(n[l]=this.btypeEncode(e[l],t,r)):void(n[l]=e[l])}n[l]=(0,o.btypeEncodeValue)(e[l],d,r)}else n[l]=e[l].map((e=>{if(!s.includes(u)){const t=this.root.lookupTypeOrEnum(u);return t.fields?this.btypeEncode(e,t,r):e}return(0,o.btypeEncodeValue)(e,d,r)}))})),n}async serialize(e,t,r){const n=this.defaultType||this.root.lookupType(t);let o={};const i=void 0===(null==r?void 0:r.bytesConversion)?this.bytesConversion:r.bytesConversion,s=void 0===(null==r?void 0:r.verifyChecksum)?this.verifyChecksum.serialize:r.verifyChecksum;o=i?this.btypeDecode(e,n,s):e;const a=n.create(o);return n.encode(a).finish()}async deserialize(e,t,r){const n="string"==typeof e?(0,o.decodeBase64url)(e):e,i=this.defaultType||this.root.lookupType(t),s=i.decode(n),a=i.toObject(s,{longs:String,defaults:!0}),c=void 0===(null==r?void 0:r.bytesConversion)?this.bytesConversion:r.bytesConversion,l=void 0===(null==r?void 0:r.verifyChecksum)?this.verifyChecksum.deserialize:r.verifyChecksum;return c?this.btypeEncode(a,i,l):a}}t.Serializer=a,t.default=a},6991:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Signer=void 0;const s=r(3061),a=i(r(9656)),c=r(8593),l=r(9104),u={previous:{type:"bytes",btype:"BLOCK_ID"},height:{type:"uint64"},timestamp:{type:"uint64"},previous_state_merkle_root:{type:"bytes"},transaction_merkle_root:{type:"bytes"},signer:{type:"bytes",btype:"ADDRESS"}},p={chain_id:{type:"bytes"},rc_limit:{type:"uint64"},nonce:{type:"bytes"},operation_merkle_root:{type:"bytes"},payer:{type:"bytes",btype:"ADDRESS"},payee:{type:"bytes",btype:"ADDRESS"}},d={upload_contract:{type:"object",subtypes:{contract_id:{type:"bytes",btype:"CONTRACT_ID"},bytecode:{type:"bytes"},abi:{type:"string"},authorizes_call_contract:{type:"bool"},authorizes_transaction_application:{type:"bool"},authorizes_upload_contract:{type:"bool"}}},call_contract:{type:"object",subtypes:{contract_id:{type:"bytes",btype:"CONTRACT_ID"},entry_point:{type:"uint32"},args:{type:"bytes"}}},set_system_call:{type:"object",subtypes:{call_id:{type:"uint32"},target:{type:"object",subtypes:{thunk_id:{type:"uint32"},system_call_bundle:{type:"object",subtypes:{contract_id:{type:"bytes",btype:"CONTRACT_ID"},entry_point:{type:"uint32"}}}}}}},set_system_contract:{type:"object",subtypes:{contract_id:{type:"bytes",btype:"CONTRACT_ID"},system_contract:{type:"bool"}}}};class f{constructor(e){this.chainId="",this.compressed=void 0===e.compressed||e.compressed,this.privateKey=e.privateKey,this.provider=e.provider,e.privateKey,this.publicKey=a.getPublicKey(e.privateKey,this.compressed),this.address=(0,c.bitcoinAddress)(this.publicKey),e.chainId&&(this.chainId=e.chainId),this.sendOptions={broadcast:!0,...e.sendOptions}}static fromWif(e,t=!0){const r=void 0===t?"5"!==e[0]:t,n=(0,c.bitcoinDecode)(e);return new f({privateKey:(0,c.toHexString)(n),compressed:r})}static fromSeed(e,t=!0){const r=(0,s.sha256)(e);return new f({privateKey:r,compressed:t})}getAddress(e=!0){if("string"==typeof this.privateKey){const t=a.getPublicKey(this.privateKey,e);return(0,c.bitcoinAddress)(t)}const t=a.getPublicKey(this.privateKey,e);return(0,c.bitcoinAddress)(t)}getPrivateKey(e="hex",t=!1){let r;r=this.privateKey instanceof Uint8Array?(0,c.toHexString)(this.privateKey):"string"==typeof this.privateKey?this.privateKey:BigInt(this.privateKey).toString(16).padStart(64,"0");const n=void 0===t?this.compressed:t;switch(e){case"hex":return r;case"wif":return(0,c.bitcoinEncode)((0,c.toUint8Array)(r),"private",n);default:throw new Error(`Invalid format ${e}`)}}async signHash(e){const[t,r]=await a.sign(e,this.privateKey,{recovered:!0,canonical:!0,der:!1}),n=new Uint8Array(65);return n.set([r+31],0),n.set(t,1),n}async signMessage(e){return this.signHash((0,s.sha256)(e))}async signTransaction(e,t){if(!e.id)throw new Error("Missing transaction id");const r=(0,c.toUint8Array)(e.id.slice(6)),n=await this.signHash(r);return e.signatures||(e.signatures=[]),e.signatures.push((0,c.encodeBase64url)(n)),e}async signBlock(e){if(!e.id)throw new Error("Missing block id");const t=(0,c.toUint8Array)(e.id.slice(6)),r=await this.signHash(t);return e.signature=(0,c.encodeBase64url)(r),e}async sendTransaction(e,t){var r;if(e.signatures&&(null===(r=e.signatures)||void 0===r?void 0:r.length)||(e=await this.signTransaction(e)),!this.provider)throw new Error("provider is undefined");const n={...this.sendOptions,...t};return n.beforeSend&&await n.beforeSend(e),this.provider.sendTransaction(e,n.broadcast)}static recoverPublicKey(e,t,r=!0){const n=(0,c.toHexString)(t),o=Number(`0x${n.slice(0,2)}`)-31,i=n.slice(2,66),s=n.slice(66),l=BigInt(`0x${i}`),u=BigInt(`0x${s}`),p=new a.Signature(l,u),d=a.recoverPublicKey((0,c.toHexString)(e),p.toHex(),o);if(!d)throw new Error("Public key cannot be recovered");return r?a.Point.fromHex(d).toHex(!0):(0,c.toHexString)(d)}static recoverAddress(e,t,r=!0){return(0,c.bitcoinAddress)((0,c.toUint8Array)(f.recoverPublicKey(e,t,r)))}async recoverPublicKeys(e,t){let r=!0;t&&void 0!==t.compressed&&(r=t.compressed);let n,o=[];const i=e;if(i.signature){if(!i.header)throw new Error("Missing block header");if(!i.signature)throw new Error("Missing block signature");o=[i.signature];const e=(0,c.btypeDecode)(i.header,u,!1),t=l.koinos.protocol.block_header.create(e);n=l.koinos.protocol.block_header.encode(t).finish()}else{const t=e;if(!t.header)throw new Error("Missing transaction header");if(!t.signatures)throw new Error("Missing transaction signatures");o=t.signatures;const r=(0,c.btypeDecode)(t.header,p,!1),i=l.koinos.protocol.transaction_header.create(r);n=l.koinos.protocol.transaction_header.encode(i).finish()}const a=(0,s.sha256)(n);return Promise.all(o.map((async e=>(t&&"function"==typeof t.transformSignature&&(e=await t.transformSignature(e)),f.recoverPublicKey(a,(0,c.decodeBase64url)(e),r)))))}async recoverAddresses(e,t){return(await this.recoverPublicKeys(e,t)).map((e=>(0,c.bitcoinAddress)((0,c.toUint8Array)(e))))}async prepareTransaction(e){var t,r;e.header||(e.header={});const n=null!==(t=e.header.payer)&&void 0!==t?t:this.address,{payee:o}=e.header;let i,a;if(void 0===e.header.nonce){if(!this.provider)throw new Error("Cannot get the nonce because provider is undefined. To skip this call set a nonce in the transaction header");i=await this.provider.getNextNonce(o||n)}else i=e.header.nonce;if(void 0===e.header.rc_limit){if(!this.provider)throw new Error("Cannot get the rc_limit because provider is undefined. To skip this call set a rc_limit in the transaction header");a=await this.provider.getAccountRc(n)}else a=e.header.rc_limit;let u=e.header.chain_id||this.chainId;if(!u){if(!this.provider)throw new Error("Cannot get the chain_id because provider is undefined. To skip this call set a chain_id in the Signer");u=await this.provider.getChainId(),this.chainId=u}const f=[];if(e.operations)for(let t=0;t<(null===(r=e.operations)||void 0===r?void 0:r.length);t+=1){const r=(0,c.btypeDecode)(e.operations[t],d,!1),n=l.koinos.protocol.operation.create(r),o=l.koinos.protocol.operation.encode(n).finish();f.push((0,s.sha256)(o))}const h=(0,c.encodeBase64url)(new Uint8Array([18,32,...(0,c.calculateMerkleRoot)(f)]));e.header={chain_id:u,rc_limit:a,nonce:i,operation_merkle_root:h,payer:n,...o&&{payee:o}};const y=(0,c.btypeDecode)(e.header,p,!1),_=l.koinos.protocol.transaction_header.create(y),g=l.koinos.protocol.transaction_header.encode(_).finish(),b=(0,s.sha256)(g);return e.id=`0x1220${(0,c.toHexString)(b)}`,e}async prepareBlock(e){var t;e.header||(e.header={});const r=[];if(e.transactions)for(let n=0;n{d=new Uint8Array([...d,...(0,c.decodeBase64url)(e)])})),r.push((0,s.sha256)(d))}let{height:n,previous:o,previous_state_merkle_root:i}=e.header;if(!n||!o||!i){if(!this.provider)throw new Error("Cannot get the head info because provider is undefined.");const e=await this.provider.getHeadInfo();n=n||`${Number(e.head_topology.height)+1}`,o=o||e.head_topology.id,i=i||e.head_state_merkle_root}e.header={height:n,previous:o,previous_state_merkle_root:i,timestamp:e.header.timestamp||`${Date.now()}`,transaction_merkle_root:(0,c.encodeBase64url)(new Uint8Array([18,32,...(0,c.calculateMerkleRoot)(r)])),signer:this.address};const a=(0,c.btypeDecode)(e.header,u,!1),d=l.koinos.protocol.block_header.create(a),f=l.koinos.protocol.block_header.encode(d).finish(),h=(0,s.sha256)(f);return e.id=`0x1220${(0,c.toHexString)(h)}`,e}}t.Signer=f,t.default=f},5738:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const s=i(r(8593)),a=r(9822),c=r(6991),l=r(5635),u=r(7187);window.utils=s,window.Contract=a.Contract,window.Signer=c.Signer,window.Provider=l.Provider,window.Serializer=u.Serializer},8593:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.tokenAbi=t.btypeEncode=t.btypeDecode=t.btypeEncodeValue=t.btypeDecodeValue=t.parseUnits=t.formatUnits=t.isChecksumWif=t.isChecksumAddress=t.isChecksum=t.bitcoinAddress=t.bitcoinDecode=t.bitcoinEncode=t.calculateMerkleRoot=t.decodeBase64=t.multihash=t.encodeBase64=t.decodeBase64url=t.encodeBase64url=t.decodeBase58=t.encodeBase58=t.toHexString=t.toUint8Array=void 0;const a=i(r(6957)),c=r(3061),l=r(830),u=s(r(6567));function p(e){const t=e.match(/[\dA-F]{2}/gi);if(!t)throw new Error("Invalid hex");return new Uint8Array(t.map((e=>parseInt(e,16))))}function d(e){return Array.from(e).map((e=>`0${Number(e).toString(16)}`.slice(-2))).join("")}function f(e){return(new TextDecoder).decode(a.encode("z",e)).slice(1)}function h(e){return a.decode(`z${e}`)}function y(e){return(new TextDecoder).decode(a.encode("U",e)).slice(1)}function _(e){return a.decode(`U${e}`)}function g(e,t,r=!1){let n,o,i;"public"===t?(n=new Uint8Array(25),o=new Uint8Array(21),n[0]=0,o[0]=0,i=21):(r?(n=new Uint8Array(38),o=new Uint8Array(34),i=34,n[33]=1,o[33]=1):(n=new Uint8Array(37),o=new Uint8Array(33),i=33),n[0]=128,o[0]=128),o.set(e,1);const s=(0,c.sha256)(o),a=(0,c.sha256)(s),l=new Uint8Array(4);return l.set(a.slice(0,4)),n.set(e,1),n.set(l,i),f(n)}function b(e){const t=e.length-4,r=new Uint8Array(t);r.set(e.slice(0,t));const n=new Uint8Array(4);n.set(e.slice(t));const o=(0,c.sha256)((0,c.sha256)(r));for(let e=0;e<4;e+=1)if(n[e]!==o[e])return!1;return!0}function m(e){const t="string"==typeof e?h(e):e;return 25===t.length&&0===t[0]&&b(t)}function v(e){return"string"==typeof e||"number"==typeof e?e:JSON.parse(JSON.stringify(e))}function w(e,t,r){if("bytes"!==t.type)return v(e);const n=e;if(!t.btype)return _(n);switch(t.btype){case"BASE58":return h(n);case"CONTRACT_ID":case"ADDRESS":const e=h(n);if(r&&!m(e))throw new Error(`${n} is an invalid address`);return e;case"BASE64":return _(n);case"HEX":case"BLOCK_ID":case"TRANSACTION_ID":return p(n.slice(2));default:throw new Error(`unknown btype ${t.btype}`)}}function k(e,t,r){if("bytes"!==t.type)return v(e);const n=e;if(!t.btype)return y(n);switch(t.btype){case"BASE58":return f(n);case"CONTRACT_ID":case"ADDRESS":const e=f(n);if(r&&!m(n))throw new Error(`${e} is an invalid address`);return e;case"BASE64":return y(n);case"HEX":case"BLOCK_ID":case"TRANSACTION_ID":return`0x${d(n)}`;default:throw new Error(`unknown btype ${t.btype}`)}}t.toUint8Array=p,t.toHexString=d,t.encodeBase58=f,t.decodeBase58=h,t.encodeBase64url=y,t.decodeBase64url=_,t.encodeBase64=function(e){return(new TextDecoder).decode(a.encode("M",e)).slice(1)},t.multihash=function(e,t="sha2-256"){switch(t){case"sha2-256":return new Uint8Array([18,e.length,...e]);default:throw new Error(`multihash code ${t} not supported`)}},t.decodeBase64=function(e){return a.decode(`M${e}`)},t.calculateMerkleRoot=function(e){if(!e.length)return(0,c.sha256)(new Uint8Array);for(;e.length>1;){for(let t=0;t{t[i]&&("repeated"===r[i].rule?o[i]=t[i].map((t=>r[i].subtypes?e(t,r[i].subtypes,n):w(t,r[i],n))):r[i].subtypes?o[i]=e(t[i],r[i].subtypes,n):o[i]=w(t[i],r[i],n))})),o},t.btypeEncode=function e(t,r,n){if("object"!=typeof t)return t;const o={};return Object.keys(r).forEach((i=>{t[i]&&("repeated"===r[i].rule?o[i]=t[i].map((t=>r[i].subtypes?e(t,r[i].subtypes,n):k(t,r[i],n))):r[i].subtypes?o[i]=e(t[i],r[i].subtypes,n):o[i]=k(t[i],r[i],n))})),o},t.tokenAbi={methods:{name:{entry_point:2191741823,argument:"name_arguments",return:"name_result",read_only:!0},symbol:{entry_point:3077209249,argument:"symbol_arguments",return:"symbol_result",read_only:!0},decimals:{entry_point:4001430831,argument:"decimals_arguments",return:"decimals_result",read_only:!0},totalSupply:{entry_point:2967091508,argument:"total_supply_arguments",return:"total_supply_result",read_only:!0},balanceOf:{entry_point:1550980247,argument:"balance_of_arguments",return:"balance_of_result",read_only:!0,default_output:{value:"0"}},transfer:{entry_point:670398154,argument:"transfer_arguments",return:"transfer_result"},mint:{entry_point:3698268091,argument:"mint_arguments",return:"mint_result"},burn:{entry_point:2241834181,argument:"burn_arguments",return:"burn_result"}},koilib_types:u.default}},9104:function(e,t,r){var n,o,i;o=[r(2100)],void 0===(i="function"==typeof(n=function(e){"use strict";var t,r,n,o,i,s=e.Reader,a=e.Writer,c=e.util,l=e.roots.default||(e.roots.default={});return l.koinos=((i={}).protocol=((n={}).event_data=function(){function t(e){if(this.impacted=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.sequence=e.uint32();break;case 2:n.source=e.bytes();break;case 3:n.name=e.string();break;case 4:n.data=e.bytes();break;case 5:n.impacted&&n.impacted.length||(n.impacted=[]),n.impacted.push(e.bytes());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.sequence&&e.hasOwnProperty("sequence")&&!c.isInteger(e.sequence))return"sequence: integer expected";if(null!=e.source&&e.hasOwnProperty("source")&&!(e.source&&"number"==typeof e.source.length||c.isString(e.source)))return"source: buffer expected";if(null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name))return"name: string expected";if(null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||c.isString(e.data)))return"data: buffer expected";if(null!=e.impacted&&e.hasOwnProperty("impacted")){if(!Array.isArray(e.impacted))return"impacted: array expected";for(var t=0;t>>0),null!=e.source&&("string"==typeof e.source?c.base64.decode(e.source,t.source=c.newBuffer(c.base64.length(e.source)),0):e.source.length>=0&&(t.source=e.source)),null!=e.name&&(t.name=String(e.name)),null!=e.data&&("string"==typeof e.data?c.base64.decode(e.data,t.data=c.newBuffer(c.base64.length(e.data)),0):e.data.length>=0&&(t.data=e.data)),e.impacted){if(!Array.isArray(e.impacted))throw TypeError(".koinos.protocol.event_data.impacted: array expected");t.impacted=[];for(var r=0;r=0&&(t.impacted[r]=e.impacted[r])}return t},t.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.impacted=[]),t.defaults&&(r.sequence=0,t.bytes===String?r.source="":(r.source=[],t.bytes!==Array&&(r.source=c.newBuffer(r.source))),r.name="",t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=c.newBuffer(r.data)))),null!=e.sequence&&e.hasOwnProperty("sequence")&&(r.sequence=e.sequence),null!=e.source&&e.hasOwnProperty("source")&&(r.source=t.bytes===String?c.base64.encode(e.source,0,e.source.length):t.bytes===Array?Array.prototype.slice.call(e.source):e.source),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?c.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),e.impacted&&e.impacted.length){r.impacted=[];for(var n=0;n>>3){case 1:n.contract_id=e.bytes();break;case 2:n.entry_point=e.uint32();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.contract_id&&e.hasOwnProperty("contract_id")&&!(e.contract_id&&"number"==typeof e.contract_id.length||c.isString(e.contract_id))?"contract_id: buffer expected":null!=e.entry_point&&e.hasOwnProperty("entry_point")&&!c.isInteger(e.entry_point)?"entry_point: integer expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.contract_call_bundle)return e;var t=new l.koinos.protocol.contract_call_bundle;return null!=e.contract_id&&("string"==typeof e.contract_id?c.base64.decode(e.contract_id,t.contract_id=c.newBuffer(c.base64.length(e.contract_id)),0):e.contract_id.length>=0&&(t.contract_id=e.contract_id)),null!=e.entry_point&&(t.entry_point=e.entry_point>>>0),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.contract_id="":(r.contract_id=[],t.bytes!==Array&&(r.contract_id=c.newBuffer(r.contract_id))),r.entry_point=0),null!=e.contract_id&&e.hasOwnProperty("contract_id")&&(r.contract_id=t.bytes===String?c.base64.encode(e.contract_id,0,e.contract_id.length):t.bytes===Array?Array.prototype.slice.call(e.contract_id):e.contract_id),null!=e.entry_point&&e.hasOwnProperty("entry_point")&&(r.entry_point=e.entry_point),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.contract_call_bundle"},t}(),n.system_call_target=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.thunk_id=e.uint32();break;case 2:n.system_call_bundle=l.koinos.protocol.contract_call_bundle.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.thunk_id&&e.hasOwnProperty("thunk_id")&&(t.target=1,!c.isInteger(e.thunk_id)))return"thunk_id: integer expected";if(null!=e.system_call_bundle&&e.hasOwnProperty("system_call_bundle")){if(1===t.target)return"target: multiple values";t.target=1;var r=l.koinos.protocol.contract_call_bundle.verify(e.system_call_bundle);if(r)return"system_call_bundle."+r}return null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.system_call_target)return e;var t=new l.koinos.protocol.system_call_target;if(null!=e.thunk_id&&(t.thunk_id=e.thunk_id>>>0),null!=e.system_call_bundle){if("object"!=typeof e.system_call_bundle)throw TypeError(".koinos.protocol.system_call_target.system_call_bundle: object expected");t.system_call_bundle=l.koinos.protocol.contract_call_bundle.fromObject(e.system_call_bundle)}return t},t.toObject=function(e,t){t||(t={});var r={};return null!=e.thunk_id&&e.hasOwnProperty("thunk_id")&&(r.thunk_id=e.thunk_id,t.oneofs&&(r.target="thunk_id")),null!=e.system_call_bundle&&e.hasOwnProperty("system_call_bundle")&&(r.system_call_bundle=l.koinos.protocol.contract_call_bundle.toObject(e.system_call_bundle,t),t.oneofs&&(r.target="system_call_bundle")),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.system_call_target"},t}(),n.upload_contract_operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.contract_id=e.bytes();break;case 2:n.bytecode=e.bytes();break;case 3:n.abi=e.string();break;case 4:n.authorizes_call_contract=e.bool();break;case 5:n.authorizes_transaction_application=e.bool();break;case 6:n.authorizes_upload_contract=e.bool();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.contract_id&&e.hasOwnProperty("contract_id")&&!(e.contract_id&&"number"==typeof e.contract_id.length||c.isString(e.contract_id))?"contract_id: buffer expected":null!=e.bytecode&&e.hasOwnProperty("bytecode")&&!(e.bytecode&&"number"==typeof e.bytecode.length||c.isString(e.bytecode))?"bytecode: buffer expected":null!=e.abi&&e.hasOwnProperty("abi")&&!c.isString(e.abi)?"abi: string expected":null!=e.authorizes_call_contract&&e.hasOwnProperty("authorizes_call_contract")&&"boolean"!=typeof e.authorizes_call_contract?"authorizes_call_contract: boolean expected":null!=e.authorizes_transaction_application&&e.hasOwnProperty("authorizes_transaction_application")&&"boolean"!=typeof e.authorizes_transaction_application?"authorizes_transaction_application: boolean expected":null!=e.authorizes_upload_contract&&e.hasOwnProperty("authorizes_upload_contract")&&"boolean"!=typeof e.authorizes_upload_contract?"authorizes_upload_contract: boolean expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.upload_contract_operation)return e;var t=new l.koinos.protocol.upload_contract_operation;return null!=e.contract_id&&("string"==typeof e.contract_id?c.base64.decode(e.contract_id,t.contract_id=c.newBuffer(c.base64.length(e.contract_id)),0):e.contract_id.length>=0&&(t.contract_id=e.contract_id)),null!=e.bytecode&&("string"==typeof e.bytecode?c.base64.decode(e.bytecode,t.bytecode=c.newBuffer(c.base64.length(e.bytecode)),0):e.bytecode.length>=0&&(t.bytecode=e.bytecode)),null!=e.abi&&(t.abi=String(e.abi)),null!=e.authorizes_call_contract&&(t.authorizes_call_contract=Boolean(e.authorizes_call_contract)),null!=e.authorizes_transaction_application&&(t.authorizes_transaction_application=Boolean(e.authorizes_transaction_application)),null!=e.authorizes_upload_contract&&(t.authorizes_upload_contract=Boolean(e.authorizes_upload_contract)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.contract_id="":(r.contract_id=[],t.bytes!==Array&&(r.contract_id=c.newBuffer(r.contract_id))),t.bytes===String?r.bytecode="":(r.bytecode=[],t.bytes!==Array&&(r.bytecode=c.newBuffer(r.bytecode))),r.abi="",r.authorizes_call_contract=!1,r.authorizes_transaction_application=!1,r.authorizes_upload_contract=!1),null!=e.contract_id&&e.hasOwnProperty("contract_id")&&(r.contract_id=t.bytes===String?c.base64.encode(e.contract_id,0,e.contract_id.length):t.bytes===Array?Array.prototype.slice.call(e.contract_id):e.contract_id),null!=e.bytecode&&e.hasOwnProperty("bytecode")&&(r.bytecode=t.bytes===String?c.base64.encode(e.bytecode,0,e.bytecode.length):t.bytes===Array?Array.prototype.slice.call(e.bytecode):e.bytecode),null!=e.abi&&e.hasOwnProperty("abi")&&(r.abi=e.abi),null!=e.authorizes_call_contract&&e.hasOwnProperty("authorizes_call_contract")&&(r.authorizes_call_contract=e.authorizes_call_contract),null!=e.authorizes_transaction_application&&e.hasOwnProperty("authorizes_transaction_application")&&(r.authorizes_transaction_application=e.authorizes_transaction_application),null!=e.authorizes_upload_contract&&e.hasOwnProperty("authorizes_upload_contract")&&(r.authorizes_upload_contract=e.authorizes_upload_contract),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.upload_contract_operation"},t}(),n.call_contract_operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.contract_id=e.bytes();break;case 2:n.entry_point=e.uint32();break;case 3:n.args=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.contract_id&&e.hasOwnProperty("contract_id")&&!(e.contract_id&&"number"==typeof e.contract_id.length||c.isString(e.contract_id))?"contract_id: buffer expected":null!=e.entry_point&&e.hasOwnProperty("entry_point")&&!c.isInteger(e.entry_point)?"entry_point: integer expected":null!=e.args&&e.hasOwnProperty("args")&&!(e.args&&"number"==typeof e.args.length||c.isString(e.args))?"args: buffer expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.call_contract_operation)return e;var t=new l.koinos.protocol.call_contract_operation;return null!=e.contract_id&&("string"==typeof e.contract_id?c.base64.decode(e.contract_id,t.contract_id=c.newBuffer(c.base64.length(e.contract_id)),0):e.contract_id.length>=0&&(t.contract_id=e.contract_id)),null!=e.entry_point&&(t.entry_point=e.entry_point>>>0),null!=e.args&&("string"==typeof e.args?c.base64.decode(e.args,t.args=c.newBuffer(c.base64.length(e.args)),0):e.args.length>=0&&(t.args=e.args)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.contract_id="":(r.contract_id=[],t.bytes!==Array&&(r.contract_id=c.newBuffer(r.contract_id))),r.entry_point=0,t.bytes===String?r.args="":(r.args=[],t.bytes!==Array&&(r.args=c.newBuffer(r.args)))),null!=e.contract_id&&e.hasOwnProperty("contract_id")&&(r.contract_id=t.bytes===String?c.base64.encode(e.contract_id,0,e.contract_id.length):t.bytes===Array?Array.prototype.slice.call(e.contract_id):e.contract_id),null!=e.entry_point&&e.hasOwnProperty("entry_point")&&(r.entry_point=e.entry_point),null!=e.args&&e.hasOwnProperty("args")&&(r.args=t.bytes===String?c.base64.encode(e.args,0,e.args.length):t.bytes===Array?Array.prototype.slice.call(e.args):e.args),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.call_contract_operation"},t}(),n.set_system_call_operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.call_id=e.uint32();break;case 2:n.target=l.koinos.protocol.system_call_target.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.call_id&&e.hasOwnProperty("call_id")&&!c.isInteger(e.call_id))return"call_id: integer expected";if(null!=e.target&&e.hasOwnProperty("target")){var t=l.koinos.protocol.system_call_target.verify(e.target);if(t)return"target."+t}return null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.set_system_call_operation)return e;var t=new l.koinos.protocol.set_system_call_operation;if(null!=e.call_id&&(t.call_id=e.call_id>>>0),null!=e.target){if("object"!=typeof e.target)throw TypeError(".koinos.protocol.set_system_call_operation.target: object expected");t.target=l.koinos.protocol.system_call_target.fromObject(e.target)}return t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.call_id=0,r.target=null),null!=e.call_id&&e.hasOwnProperty("call_id")&&(r.call_id=e.call_id),null!=e.target&&e.hasOwnProperty("target")&&(r.target=l.koinos.protocol.system_call_target.toObject(e.target,t)),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.set_system_call_operation"},t}(),n.set_system_contract_operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.contract_id=e.bytes();break;case 2:n.system_contract=e.bool();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.contract_id&&e.hasOwnProperty("contract_id")&&!(e.contract_id&&"number"==typeof e.contract_id.length||c.isString(e.contract_id))?"contract_id: buffer expected":null!=e.system_contract&&e.hasOwnProperty("system_contract")&&"boolean"!=typeof e.system_contract?"system_contract: boolean expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.set_system_contract_operation)return e;var t=new l.koinos.protocol.set_system_contract_operation;return null!=e.contract_id&&("string"==typeof e.contract_id?c.base64.decode(e.contract_id,t.contract_id=c.newBuffer(c.base64.length(e.contract_id)),0):e.contract_id.length>=0&&(t.contract_id=e.contract_id)),null!=e.system_contract&&(t.system_contract=Boolean(e.system_contract)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.contract_id="":(r.contract_id=[],t.bytes!==Array&&(r.contract_id=c.newBuffer(r.contract_id))),r.system_contract=!1),null!=e.contract_id&&e.hasOwnProperty("contract_id")&&(r.contract_id=t.bytes===String?c.base64.encode(e.contract_id,0,e.contract_id.length):t.bytes===Array?Array.prototype.slice.call(e.contract_id):e.contract_id),null!=e.system_contract&&e.hasOwnProperty("system_contract")&&(r.system_contract=e.system_contract),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.set_system_contract_operation"},t}(),n.operation=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.upload_contract=l.koinos.protocol.upload_contract_operation.decode(e,e.uint32());break;case 2:n.call_contract=l.koinos.protocol.call_contract_operation.decode(e,e.uint32());break;case 3:n.set_system_call=l.koinos.protocol.set_system_call_operation.decode(e,e.uint32());break;case 4:n.set_system_contract=l.koinos.protocol.set_system_contract_operation.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.upload_contract&&e.hasOwnProperty("upload_contract")&&(t.op=1,r=l.koinos.protocol.upload_contract_operation.verify(e.upload_contract)))return"upload_contract."+r;if(null!=e.call_contract&&e.hasOwnProperty("call_contract")){if(1===t.op)return"op: multiple values";if(t.op=1,r=l.koinos.protocol.call_contract_operation.verify(e.call_contract))return"call_contract."+r}if(null!=e.set_system_call&&e.hasOwnProperty("set_system_call")){if(1===t.op)return"op: multiple values";if(t.op=1,r=l.koinos.protocol.set_system_call_operation.verify(e.set_system_call))return"set_system_call."+r}if(null!=e.set_system_contract&&e.hasOwnProperty("set_system_contract")){if(1===t.op)return"op: multiple values";var r;if(t.op=1,r=l.koinos.protocol.set_system_contract_operation.verify(e.set_system_contract))return"set_system_contract."+r}return null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.operation)return e;var t=new l.koinos.protocol.operation;if(null!=e.upload_contract){if("object"!=typeof e.upload_contract)throw TypeError(".koinos.protocol.operation.upload_contract: object expected");t.upload_contract=l.koinos.protocol.upload_contract_operation.fromObject(e.upload_contract)}if(null!=e.call_contract){if("object"!=typeof e.call_contract)throw TypeError(".koinos.protocol.operation.call_contract: object expected");t.call_contract=l.koinos.protocol.call_contract_operation.fromObject(e.call_contract)}if(null!=e.set_system_call){if("object"!=typeof e.set_system_call)throw TypeError(".koinos.protocol.operation.set_system_call: object expected");t.set_system_call=l.koinos.protocol.set_system_call_operation.fromObject(e.set_system_call)}if(null!=e.set_system_contract){if("object"!=typeof e.set_system_contract)throw TypeError(".koinos.protocol.operation.set_system_contract: object expected");t.set_system_contract=l.koinos.protocol.set_system_contract_operation.fromObject(e.set_system_contract)}return t},t.toObject=function(e,t){t||(t={});var r={};return null!=e.upload_contract&&e.hasOwnProperty("upload_contract")&&(r.upload_contract=l.koinos.protocol.upload_contract_operation.toObject(e.upload_contract,t),t.oneofs&&(r.op="upload_contract")),null!=e.call_contract&&e.hasOwnProperty("call_contract")&&(r.call_contract=l.koinos.protocol.call_contract_operation.toObject(e.call_contract,t),t.oneofs&&(r.op="call_contract")),null!=e.set_system_call&&e.hasOwnProperty("set_system_call")&&(r.set_system_call=l.koinos.protocol.set_system_call_operation.toObject(e.set_system_call,t),t.oneofs&&(r.op="set_system_call")),null!=e.set_system_contract&&e.hasOwnProperty("set_system_contract")&&(r.set_system_contract=l.koinos.protocol.set_system_contract_operation.toObject(e.set_system_contract,t),t.oneofs&&(r.op="set_system_contract")),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.operation"},t}(),n.transaction_header=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.chain_id=e.bytes();break;case 2:n.rc_limit=e.uint64();break;case 3:n.nonce=e.bytes();break;case 4:n.operation_merkle_root=e.bytes();break;case 5:n.payer=e.bytes();break;case 6:n.payee=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.chain_id&&e.hasOwnProperty("chain_id")&&!(e.chain_id&&"number"==typeof e.chain_id.length||c.isString(e.chain_id))?"chain_id: buffer expected":null!=e.rc_limit&&e.hasOwnProperty("rc_limit")&&!(c.isInteger(e.rc_limit)||e.rc_limit&&c.isInteger(e.rc_limit.low)&&c.isInteger(e.rc_limit.high))?"rc_limit: integer|Long expected":null!=e.nonce&&e.hasOwnProperty("nonce")&&!(e.nonce&&"number"==typeof e.nonce.length||c.isString(e.nonce))?"nonce: buffer expected":null!=e.operation_merkle_root&&e.hasOwnProperty("operation_merkle_root")&&!(e.operation_merkle_root&&"number"==typeof e.operation_merkle_root.length||c.isString(e.operation_merkle_root))?"operation_merkle_root: buffer expected":null!=e.payer&&e.hasOwnProperty("payer")&&!(e.payer&&"number"==typeof e.payer.length||c.isString(e.payer))?"payer: buffer expected":null!=e.payee&&e.hasOwnProperty("payee")&&!(e.payee&&"number"==typeof e.payee.length||c.isString(e.payee))?"payee: buffer expected":null},t.fromObject=function(e){if(e instanceof l.koinos.protocol.transaction_header)return e;var t=new l.koinos.protocol.transaction_header;return null!=e.chain_id&&("string"==typeof e.chain_id?c.base64.decode(e.chain_id,t.chain_id=c.newBuffer(c.base64.length(e.chain_id)),0):e.chain_id.length>=0&&(t.chain_id=e.chain_id)),null!=e.rc_limit&&(c.Long?(t.rc_limit=c.Long.fromValue(e.rc_limit)).unsigned=!0:"string"==typeof e.rc_limit?t.rc_limit=parseInt(e.rc_limit,10):"number"==typeof e.rc_limit?t.rc_limit=e.rc_limit:"object"==typeof e.rc_limit&&(t.rc_limit=new c.LongBits(e.rc_limit.low>>>0,e.rc_limit.high>>>0).toNumber(!0))),null!=e.nonce&&("string"==typeof e.nonce?c.base64.decode(e.nonce,t.nonce=c.newBuffer(c.base64.length(e.nonce)),0):e.nonce.length>=0&&(t.nonce=e.nonce)),null!=e.operation_merkle_root&&("string"==typeof e.operation_merkle_root?c.base64.decode(e.operation_merkle_root,t.operation_merkle_root=c.newBuffer(c.base64.length(e.operation_merkle_root)),0):e.operation_merkle_root.length>=0&&(t.operation_merkle_root=e.operation_merkle_root)),null!=e.payer&&("string"==typeof e.payer?c.base64.decode(e.payer,t.payer=c.newBuffer(c.base64.length(e.payer)),0):e.payer.length>=0&&(t.payer=e.payer)),null!=e.payee&&("string"==typeof e.payee?c.base64.decode(e.payee,t.payee=c.newBuffer(c.base64.length(e.payee)),0):e.payee.length>=0&&(t.payee=e.payee)),t},t.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if(t.bytes===String?r.chain_id="":(r.chain_id=[],t.bytes!==Array&&(r.chain_id=c.newBuffer(r.chain_id))),c.Long){var n=new c.Long(0,0,!0);r.rc_limit=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.rc_limit=t.longs===String?"0":0;t.bytes===String?r.nonce="":(r.nonce=[],t.bytes!==Array&&(r.nonce=c.newBuffer(r.nonce))),t.bytes===String?r.operation_merkle_root="":(r.operation_merkle_root=[],t.bytes!==Array&&(r.operation_merkle_root=c.newBuffer(r.operation_merkle_root))),t.bytes===String?r.payer="":(r.payer=[],t.bytes!==Array&&(r.payer=c.newBuffer(r.payer))),t.bytes===String?r.payee="":(r.payee=[],t.bytes!==Array&&(r.payee=c.newBuffer(r.payee)))}return null!=e.chain_id&&e.hasOwnProperty("chain_id")&&(r.chain_id=t.bytes===String?c.base64.encode(e.chain_id,0,e.chain_id.length):t.bytes===Array?Array.prototype.slice.call(e.chain_id):e.chain_id),null!=e.rc_limit&&e.hasOwnProperty("rc_limit")&&("number"==typeof e.rc_limit?r.rc_limit=t.longs===String?String(e.rc_limit):e.rc_limit:r.rc_limit=t.longs===String?c.Long.prototype.toString.call(e.rc_limit):t.longs===Number?new c.LongBits(e.rc_limit.low>>>0,e.rc_limit.high>>>0).toNumber(!0):e.rc_limit),null!=e.nonce&&e.hasOwnProperty("nonce")&&(r.nonce=t.bytes===String?c.base64.encode(e.nonce,0,e.nonce.length):t.bytes===Array?Array.prototype.slice.call(e.nonce):e.nonce),null!=e.operation_merkle_root&&e.hasOwnProperty("operation_merkle_root")&&(r.operation_merkle_root=t.bytes===String?c.base64.encode(e.operation_merkle_root,0,e.operation_merkle_root.length):t.bytes===Array?Array.prototype.slice.call(e.operation_merkle_root):e.operation_merkle_root),null!=e.payer&&e.hasOwnProperty("payer")&&(r.payer=t.bytes===String?c.base64.encode(e.payer,0,e.payer.length):t.bytes===Array?Array.prototype.slice.call(e.payer):e.payer),null!=e.payee&&e.hasOwnProperty("payee")&&(r.payee=t.bytes===String?c.base64.encode(e.payee,0,e.payee.length):t.bytes===Array?Array.prototype.slice.call(e.payee):e.payee),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.protocol.transaction_header"},t}(),n.transaction=function(){function t(e){if(this.operations=[],this.signatures=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.id=e.bytes();break;case 2:n.header=l.koinos.protocol.transaction_header.decode(e,e.uint32());break;case 3:n.operations&&n.operations.length||(n.operations=[]),n.operations.push(l.koinos.protocol.operation.decode(e,e.uint32()));break;case 4:n.signatures&&n.signatures.length||(n.signatures=[]),n.signatures.push(e.bytes());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!(e.id&&"number"==typeof e.id.length||c.isString(e.id)))return"id: buffer expected";if(null!=e.header&&e.hasOwnProperty("header")&&(r=l.koinos.protocol.transaction_header.verify(e.header)))return"header."+r;if(null!=e.operations&&e.hasOwnProperty("operations")){if(!Array.isArray(e.operations))return"operations: array expected";for(var t=0;t=0&&(t.id=e.id)),null!=e.header){if("object"!=typeof e.header)throw TypeError(".koinos.protocol.transaction.header: object expected");t.header=l.koinos.protocol.transaction_header.fromObject(e.header)}if(e.operations){if(!Array.isArray(e.operations))throw TypeError(".koinos.protocol.transaction.operations: array expected");t.operations=[];for(var r=0;r=0&&(t.signatures[r]=e.signatures[r])}return t},t.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.operations=[],r.signatures=[]),t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=c.newBuffer(r.id))),r.header=null),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?c.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.header&&e.hasOwnProperty("header")&&(r.header=l.koinos.protocol.transaction_header.toObject(e.header,t)),e.operations&&e.operations.length){r.operations=[];for(var n=0;n>>3){case 1:n.id=e.bytes();break;case 2:n.payer=e.bytes();break;case 3:n.max_payer_rc=e.uint64();break;case 4:n.rc_limit=e.uint64();break;case 5:n.rc_used=e.uint64();break;case 6:n.disk_storage_used=e.uint64();break;case 7:n.network_bandwidth_used=e.uint64();break;case 8:n.compute_bandwidth_used=e.uint64();break;case 9:n.reverted=e.bool();break;case 10:n.events&&n.events.length||(n.events=[]),n.events.push(l.koinos.protocol.event_data.decode(e,e.uint32()));break;case 11:n.logs&&n.logs.length||(n.logs=[]),n.logs.push(e.string());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!(e.id&&"number"==typeof e.id.length||c.isString(e.id)))return"id: buffer expected";if(null!=e.payer&&e.hasOwnProperty("payer")&&!(e.payer&&"number"==typeof e.payer.length||c.isString(e.payer)))return"payer: buffer expected";if(null!=e.max_payer_rc&&e.hasOwnProperty("max_payer_rc")&&!(c.isInteger(e.max_payer_rc)||e.max_payer_rc&&c.isInteger(e.max_payer_rc.low)&&c.isInteger(e.max_payer_rc.high)))return"max_payer_rc: integer|Long expected";if(null!=e.rc_limit&&e.hasOwnProperty("rc_limit")&&!(c.isInteger(e.rc_limit)||e.rc_limit&&c.isInteger(e.rc_limit.low)&&c.isInteger(e.rc_limit.high)))return"rc_limit: integer|Long expected";if(null!=e.rc_used&&e.hasOwnProperty("rc_used")&&!(c.isInteger(e.rc_used)||e.rc_used&&c.isInteger(e.rc_used.low)&&c.isInteger(e.rc_used.high)))return"rc_used: integer|Long expected";if(null!=e.disk_storage_used&&e.hasOwnProperty("disk_storage_used")&&!(c.isInteger(e.disk_storage_used)||e.disk_storage_used&&c.isInteger(e.disk_storage_used.low)&&c.isInteger(e.disk_storage_used.high)))return"disk_storage_used: integer|Long expected";if(null!=e.network_bandwidth_used&&e.hasOwnProperty("network_bandwidth_used")&&!(c.isInteger(e.network_bandwidth_used)||e.network_bandwidth_used&&c.isInteger(e.network_bandwidth_used.low)&&c.isInteger(e.network_bandwidth_used.high)))return"network_bandwidth_used: integer|Long expected";if(null!=e.compute_bandwidth_used&&e.hasOwnProperty("compute_bandwidth_used")&&!(c.isInteger(e.compute_bandwidth_used)||e.compute_bandwidth_used&&c.isInteger(e.compute_bandwidth_used.low)&&c.isInteger(e.compute_bandwidth_used.high)))return"compute_bandwidth_used: integer|Long expected";if(null!=e.reverted&&e.hasOwnProperty("reverted")&&"boolean"!=typeof e.reverted)return"reverted: boolean expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(var t=0;t=0&&(t.id=e.id)),null!=e.payer&&("string"==typeof e.payer?c.base64.decode(e.payer,t.payer=c.newBuffer(c.base64.length(e.payer)),0):e.payer.length>=0&&(t.payer=e.payer)),null!=e.max_payer_rc&&(c.Long?(t.max_payer_rc=c.Long.fromValue(e.max_payer_rc)).unsigned=!0:"string"==typeof e.max_payer_rc?t.max_payer_rc=parseInt(e.max_payer_rc,10):"number"==typeof e.max_payer_rc?t.max_payer_rc=e.max_payer_rc:"object"==typeof e.max_payer_rc&&(t.max_payer_rc=new c.LongBits(e.max_payer_rc.low>>>0,e.max_payer_rc.high>>>0).toNumber(!0))),null!=e.rc_limit&&(c.Long?(t.rc_limit=c.Long.fromValue(e.rc_limit)).unsigned=!0:"string"==typeof e.rc_limit?t.rc_limit=parseInt(e.rc_limit,10):"number"==typeof e.rc_limit?t.rc_limit=e.rc_limit:"object"==typeof e.rc_limit&&(t.rc_limit=new c.LongBits(e.rc_limit.low>>>0,e.rc_limit.high>>>0).toNumber(!0))),null!=e.rc_used&&(c.Long?(t.rc_used=c.Long.fromValue(e.rc_used)).unsigned=!0:"string"==typeof e.rc_used?t.rc_used=parseInt(e.rc_used,10):"number"==typeof e.rc_used?t.rc_used=e.rc_used:"object"==typeof e.rc_used&&(t.rc_used=new c.LongBits(e.rc_used.low>>>0,e.rc_used.high>>>0).toNumber(!0))),null!=e.disk_storage_used&&(c.Long?(t.disk_storage_used=c.Long.fromValue(e.disk_storage_used)).unsigned=!0:"string"==typeof e.disk_storage_used?t.disk_storage_used=parseInt(e.disk_storage_used,10):"number"==typeof e.disk_storage_used?t.disk_storage_used=e.disk_storage_used:"object"==typeof e.disk_storage_used&&(t.disk_storage_used=new c.LongBits(e.disk_storage_used.low>>>0,e.disk_storage_used.high>>>0).toNumber(!0))),null!=e.network_bandwidth_used&&(c.Long?(t.network_bandwidth_used=c.Long.fromValue(e.network_bandwidth_used)).unsigned=!0:"string"==typeof e.network_bandwidth_used?t.network_bandwidth_used=parseInt(e.network_bandwidth_used,10):"number"==typeof e.network_bandwidth_used?t.network_bandwidth_used=e.network_bandwidth_used:"object"==typeof e.network_bandwidth_used&&(t.network_bandwidth_used=new c.LongBits(e.network_bandwidth_used.low>>>0,e.network_bandwidth_used.high>>>0).toNumber(!0))),null!=e.compute_bandwidth_used&&(c.Long?(t.compute_bandwidth_used=c.Long.fromValue(e.compute_bandwidth_used)).unsigned=!0:"string"==typeof e.compute_bandwidth_used?t.compute_bandwidth_used=parseInt(e.compute_bandwidth_used,10):"number"==typeof e.compute_bandwidth_used?t.compute_bandwidth_used=e.compute_bandwidth_used:"object"==typeof e.compute_bandwidth_used&&(t.compute_bandwidth_used=new c.LongBits(e.compute_bandwidth_used.low>>>0,e.compute_bandwidth_used.high>>>0).toNumber(!0))),null!=e.reverted&&(t.reverted=Boolean(e.reverted)),e.events){if(!Array.isArray(e.events))throw TypeError(".koinos.protocol.transaction_receipt.events: array expected");t.events=[];for(var r=0;r>>0,e.max_payer_rc.high>>>0).toNumber(!0):e.max_payer_rc),null!=e.rc_limit&&e.hasOwnProperty("rc_limit")&&("number"==typeof e.rc_limit?r.rc_limit=t.longs===String?String(e.rc_limit):e.rc_limit:r.rc_limit=t.longs===String?c.Long.prototype.toString.call(e.rc_limit):t.longs===Number?new c.LongBits(e.rc_limit.low>>>0,e.rc_limit.high>>>0).toNumber(!0):e.rc_limit),null!=e.rc_used&&e.hasOwnProperty("rc_used")&&("number"==typeof e.rc_used?r.rc_used=t.longs===String?String(e.rc_used):e.rc_used:r.rc_used=t.longs===String?c.Long.prototype.toString.call(e.rc_used):t.longs===Number?new c.LongBits(e.rc_used.low>>>0,e.rc_used.high>>>0).toNumber(!0):e.rc_used),null!=e.disk_storage_used&&e.hasOwnProperty("disk_storage_used")&&("number"==typeof e.disk_storage_used?r.disk_storage_used=t.longs===String?String(e.disk_storage_used):e.disk_storage_used:r.disk_storage_used=t.longs===String?c.Long.prototype.toString.call(e.disk_storage_used):t.longs===Number?new c.LongBits(e.disk_storage_used.low>>>0,e.disk_storage_used.high>>>0).toNumber(!0):e.disk_storage_used),null!=e.network_bandwidth_used&&e.hasOwnProperty("network_bandwidth_used")&&("number"==typeof e.network_bandwidth_used?r.network_bandwidth_used=t.longs===String?String(e.network_bandwidth_used):e.network_bandwidth_used:r.network_bandwidth_used=t.longs===String?c.Long.prototype.toString.call(e.network_bandwidth_used):t.longs===Number?new c.LongBits(e.network_bandwidth_used.low>>>0,e.network_bandwidth_used.high>>>0).toNumber(!0):e.network_bandwidth_used),null!=e.compute_bandwidth_used&&e.hasOwnProperty("compute_bandwidth_used")&&("number"==typeof e.compute_bandwidth_used?r.compute_bandwidth_used=t.longs===String?String(e.compute_bandwidth_used):e.compute_bandwidth_used:r.compute_bandwidth_used=t.longs===String?c.Long.prototype.toString.call(e.compute_bandwidth_used):t.longs===Number?new c.LongBits(e.compute_bandwidth_used.low>>>0,e.compute_bandwidth_used.high>>>0).toNumber(!0):e.compute_bandwidth_used),null!=e.reverted&&e.hasOwnProperty("reverted")&&(r.reverted=e.reverted),e.events&&e.events.length){r.events=[];for(var o=0;o>>3){case 1:n.previous=e.bytes();break;case 2:n.height=e.uint64();break;case 3:n.timestamp=e.uint64();break;case 4:n.previous_state_merkle_root=e.bytes();break;case 5:n.transaction_merkle_root=e.bytes();break;case 6:n.signer=e.bytes();break;case 7:n.approved_proposals&&n.approved_proposals.length||(n.approved_proposals=[]),n.approved_proposals.push(e.bytes());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.previous&&e.hasOwnProperty("previous")&&!(e.previous&&"number"==typeof e.previous.length||c.isString(e.previous)))return"previous: buffer expected";if(null!=e.height&&e.hasOwnProperty("height")&&!(c.isInteger(e.height)||e.height&&c.isInteger(e.height.low)&&c.isInteger(e.height.high)))return"height: integer|Long expected";if(null!=e.timestamp&&e.hasOwnProperty("timestamp")&&!(c.isInteger(e.timestamp)||e.timestamp&&c.isInteger(e.timestamp.low)&&c.isInteger(e.timestamp.high)))return"timestamp: integer|Long expected";if(null!=e.previous_state_merkle_root&&e.hasOwnProperty("previous_state_merkle_root")&&!(e.previous_state_merkle_root&&"number"==typeof e.previous_state_merkle_root.length||c.isString(e.previous_state_merkle_root)))return"previous_state_merkle_root: buffer expected";if(null!=e.transaction_merkle_root&&e.hasOwnProperty("transaction_merkle_root")&&!(e.transaction_merkle_root&&"number"==typeof e.transaction_merkle_root.length||c.isString(e.transaction_merkle_root)))return"transaction_merkle_root: buffer expected";if(null!=e.signer&&e.hasOwnProperty("signer")&&!(e.signer&&"number"==typeof e.signer.length||c.isString(e.signer)))return"signer: buffer expected";if(null!=e.approved_proposals&&e.hasOwnProperty("approved_proposals")){if(!Array.isArray(e.approved_proposals))return"approved_proposals: array expected";for(var t=0;t=0&&(t.previous=e.previous)),null!=e.height&&(c.Long?(t.height=c.Long.fromValue(e.height)).unsigned=!0:"string"==typeof e.height?t.height=parseInt(e.height,10):"number"==typeof e.height?t.height=e.height:"object"==typeof e.height&&(t.height=new c.LongBits(e.height.low>>>0,e.height.high>>>0).toNumber(!0))),null!=e.timestamp&&(c.Long?(t.timestamp=c.Long.fromValue(e.timestamp)).unsigned=!0:"string"==typeof e.timestamp?t.timestamp=parseInt(e.timestamp,10):"number"==typeof e.timestamp?t.timestamp=e.timestamp:"object"==typeof e.timestamp&&(t.timestamp=new c.LongBits(e.timestamp.low>>>0,e.timestamp.high>>>0).toNumber(!0))),null!=e.previous_state_merkle_root&&("string"==typeof e.previous_state_merkle_root?c.base64.decode(e.previous_state_merkle_root,t.previous_state_merkle_root=c.newBuffer(c.base64.length(e.previous_state_merkle_root)),0):e.previous_state_merkle_root.length>=0&&(t.previous_state_merkle_root=e.previous_state_merkle_root)),null!=e.transaction_merkle_root&&("string"==typeof e.transaction_merkle_root?c.base64.decode(e.transaction_merkle_root,t.transaction_merkle_root=c.newBuffer(c.base64.length(e.transaction_merkle_root)),0):e.transaction_merkle_root.length>=0&&(t.transaction_merkle_root=e.transaction_merkle_root)),null!=e.signer&&("string"==typeof e.signer?c.base64.decode(e.signer,t.signer=c.newBuffer(c.base64.length(e.signer)),0):e.signer.length>=0&&(t.signer=e.signer)),e.approved_proposals){if(!Array.isArray(e.approved_proposals))throw TypeError(".koinos.protocol.block_header.approved_proposals: array expected");t.approved_proposals=[];for(var r=0;r=0&&(t.approved_proposals[r]=e.approved_proposals[r])}return t},t.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.approved_proposals=[]),t.defaults){if(t.bytes===String?r.previous="":(r.previous=[],t.bytes!==Array&&(r.previous=c.newBuffer(r.previous))),c.Long){var n=new c.Long(0,0,!0);r.height=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.height=t.longs===String?"0":0;c.Long?(n=new c.Long(0,0,!0),r.timestamp=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):r.timestamp=t.longs===String?"0":0,t.bytes===String?r.previous_state_merkle_root="":(r.previous_state_merkle_root=[],t.bytes!==Array&&(r.previous_state_merkle_root=c.newBuffer(r.previous_state_merkle_root))),t.bytes===String?r.transaction_merkle_root="":(r.transaction_merkle_root=[],t.bytes!==Array&&(r.transaction_merkle_root=c.newBuffer(r.transaction_merkle_root))),t.bytes===String?r.signer="":(r.signer=[],t.bytes!==Array&&(r.signer=c.newBuffer(r.signer)))}if(null!=e.previous&&e.hasOwnProperty("previous")&&(r.previous=t.bytes===String?c.base64.encode(e.previous,0,e.previous.length):t.bytes===Array?Array.prototype.slice.call(e.previous):e.previous),null!=e.height&&e.hasOwnProperty("height")&&("number"==typeof e.height?r.height=t.longs===String?String(e.height):e.height:r.height=t.longs===String?c.Long.prototype.toString.call(e.height):t.longs===Number?new c.LongBits(e.height.low>>>0,e.height.high>>>0).toNumber(!0):e.height),null!=e.timestamp&&e.hasOwnProperty("timestamp")&&("number"==typeof e.timestamp?r.timestamp=t.longs===String?String(e.timestamp):e.timestamp:r.timestamp=t.longs===String?c.Long.prototype.toString.call(e.timestamp):t.longs===Number?new c.LongBits(e.timestamp.low>>>0,e.timestamp.high>>>0).toNumber(!0):e.timestamp),null!=e.previous_state_merkle_root&&e.hasOwnProperty("previous_state_merkle_root")&&(r.previous_state_merkle_root=t.bytes===String?c.base64.encode(e.previous_state_merkle_root,0,e.previous_state_merkle_root.length):t.bytes===Array?Array.prototype.slice.call(e.previous_state_merkle_root):e.previous_state_merkle_root),null!=e.transaction_merkle_root&&e.hasOwnProperty("transaction_merkle_root")&&(r.transaction_merkle_root=t.bytes===String?c.base64.encode(e.transaction_merkle_root,0,e.transaction_merkle_root.length):t.bytes===Array?Array.prototype.slice.call(e.transaction_merkle_root):e.transaction_merkle_root),null!=e.signer&&e.hasOwnProperty("signer")&&(r.signer=t.bytes===String?c.base64.encode(e.signer,0,e.signer.length):t.bytes===Array?Array.prototype.slice.call(e.signer):e.signer),e.approved_proposals&&e.approved_proposals.length){r.approved_proposals=[];for(var o=0;o>>3){case 1:n.id=e.bytes();break;case 2:n.header=l.koinos.protocol.block_header.decode(e,e.uint32());break;case 3:n.transactions&&n.transactions.length||(n.transactions=[]),n.transactions.push(l.koinos.protocol.transaction.decode(e,e.uint32()));break;case 4:n.signature=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!(e.id&&"number"==typeof e.id.length||c.isString(e.id)))return"id: buffer expected";if(null!=e.header&&e.hasOwnProperty("header")&&(r=l.koinos.protocol.block_header.verify(e.header)))return"header."+r;if(null!=e.transactions&&e.hasOwnProperty("transactions")){if(!Array.isArray(e.transactions))return"transactions: array expected";for(var t=0;t=0&&(t.id=e.id)),null!=e.header){if("object"!=typeof e.header)throw TypeError(".koinos.protocol.block.header: object expected");t.header=l.koinos.protocol.block_header.fromObject(e.header)}if(e.transactions){if(!Array.isArray(e.transactions))throw TypeError(".koinos.protocol.block.transactions: array expected");t.transactions=[];for(var r=0;r=0&&(t.signature=e.signature)),t},t.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.transactions=[]),t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=c.newBuffer(r.id))),r.header=null,t.bytes===String?r.signature="":(r.signature=[],t.bytes!==Array&&(r.signature=c.newBuffer(r.signature)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?c.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.header&&e.hasOwnProperty("header")&&(r.header=l.koinos.protocol.block_header.toObject(e.header,t)),e.transactions&&e.transactions.length){r.transactions=[];for(var n=0;n>>3){case 1:n.id=e.bytes();break;case 2:n.height=e.uint64();break;case 3:n.disk_storage_used=e.uint64();break;case 4:n.network_bandwidth_used=e.uint64();break;case 5:n.compute_bandwidth_used=e.uint64();break;case 6:n.state_merkle_root=e.bytes();break;case 7:n.events&&n.events.length||(n.events=[]),n.events.push(l.koinos.protocol.event_data.decode(e,e.uint32()));break;case 8:n.transaction_receipts&&n.transaction_receipts.length||(n.transaction_receipts=[]),n.transaction_receipts.push(l.koinos.protocol.transaction_receipt.decode(e,e.uint32()));break;case 9:n.logs&&n.logs.length||(n.logs=[]),n.logs.push(e.string());break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.id&&e.hasOwnProperty("id")&&!(e.id&&"number"==typeof e.id.length||c.isString(e.id)))return"id: buffer expected";if(null!=e.height&&e.hasOwnProperty("height")&&!(c.isInteger(e.height)||e.height&&c.isInteger(e.height.low)&&c.isInteger(e.height.high)))return"height: integer|Long expected";if(null!=e.disk_storage_used&&e.hasOwnProperty("disk_storage_used")&&!(c.isInteger(e.disk_storage_used)||e.disk_storage_used&&c.isInteger(e.disk_storage_used.low)&&c.isInteger(e.disk_storage_used.high)))return"disk_storage_used: integer|Long expected";if(null!=e.network_bandwidth_used&&e.hasOwnProperty("network_bandwidth_used")&&!(c.isInteger(e.network_bandwidth_used)||e.network_bandwidth_used&&c.isInteger(e.network_bandwidth_used.low)&&c.isInteger(e.network_bandwidth_used.high)))return"network_bandwidth_used: integer|Long expected";if(null!=e.compute_bandwidth_used&&e.hasOwnProperty("compute_bandwidth_used")&&!(c.isInteger(e.compute_bandwidth_used)||e.compute_bandwidth_used&&c.isInteger(e.compute_bandwidth_used.low)&&c.isInteger(e.compute_bandwidth_used.high)))return"compute_bandwidth_used: integer|Long expected";if(null!=e.state_merkle_root&&e.hasOwnProperty("state_merkle_root")&&!(e.state_merkle_root&&"number"==typeof e.state_merkle_root.length||c.isString(e.state_merkle_root)))return"state_merkle_root: buffer expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(var t=0;t=0&&(t.id=e.id)),null!=e.height&&(c.Long?(t.height=c.Long.fromValue(e.height)).unsigned=!0:"string"==typeof e.height?t.height=parseInt(e.height,10):"number"==typeof e.height?t.height=e.height:"object"==typeof e.height&&(t.height=new c.LongBits(e.height.low>>>0,e.height.high>>>0).toNumber(!0))),null!=e.disk_storage_used&&(c.Long?(t.disk_storage_used=c.Long.fromValue(e.disk_storage_used)).unsigned=!0:"string"==typeof e.disk_storage_used?t.disk_storage_used=parseInt(e.disk_storage_used,10):"number"==typeof e.disk_storage_used?t.disk_storage_used=e.disk_storage_used:"object"==typeof e.disk_storage_used&&(t.disk_storage_used=new c.LongBits(e.disk_storage_used.low>>>0,e.disk_storage_used.high>>>0).toNumber(!0))),null!=e.network_bandwidth_used&&(c.Long?(t.network_bandwidth_used=c.Long.fromValue(e.network_bandwidth_used)).unsigned=!0:"string"==typeof e.network_bandwidth_used?t.network_bandwidth_used=parseInt(e.network_bandwidth_used,10):"number"==typeof e.network_bandwidth_used?t.network_bandwidth_used=e.network_bandwidth_used:"object"==typeof e.network_bandwidth_used&&(t.network_bandwidth_used=new c.LongBits(e.network_bandwidth_used.low>>>0,e.network_bandwidth_used.high>>>0).toNumber(!0))),null!=e.compute_bandwidth_used&&(c.Long?(t.compute_bandwidth_used=c.Long.fromValue(e.compute_bandwidth_used)).unsigned=!0:"string"==typeof e.compute_bandwidth_used?t.compute_bandwidth_used=parseInt(e.compute_bandwidth_used,10):"number"==typeof e.compute_bandwidth_used?t.compute_bandwidth_used=e.compute_bandwidth_used:"object"==typeof e.compute_bandwidth_used&&(t.compute_bandwidth_used=new c.LongBits(e.compute_bandwidth_used.low>>>0,e.compute_bandwidth_used.high>>>0).toNumber(!0))),null!=e.state_merkle_root&&("string"==typeof e.state_merkle_root?c.base64.decode(e.state_merkle_root,t.state_merkle_root=c.newBuffer(c.base64.length(e.state_merkle_root)),0):e.state_merkle_root.length>=0&&(t.state_merkle_root=e.state_merkle_root)),e.events){if(!Array.isArray(e.events))throw TypeError(".koinos.protocol.block_receipt.events: array expected");t.events=[];for(var r=0;r>>0,e.height.high>>>0).toNumber(!0):e.height),null!=e.disk_storage_used&&e.hasOwnProperty("disk_storage_used")&&("number"==typeof e.disk_storage_used?r.disk_storage_used=t.longs===String?String(e.disk_storage_used):e.disk_storage_used:r.disk_storage_used=t.longs===String?c.Long.prototype.toString.call(e.disk_storage_used):t.longs===Number?new c.LongBits(e.disk_storage_used.low>>>0,e.disk_storage_used.high>>>0).toNumber(!0):e.disk_storage_used),null!=e.network_bandwidth_used&&e.hasOwnProperty("network_bandwidth_used")&&("number"==typeof e.network_bandwidth_used?r.network_bandwidth_used=t.longs===String?String(e.network_bandwidth_used):e.network_bandwidth_used:r.network_bandwidth_used=t.longs===String?c.Long.prototype.toString.call(e.network_bandwidth_used):t.longs===Number?new c.LongBits(e.network_bandwidth_used.low>>>0,e.network_bandwidth_used.high>>>0).toNumber(!0):e.network_bandwidth_used),null!=e.compute_bandwidth_used&&e.hasOwnProperty("compute_bandwidth_used")&&("number"==typeof e.compute_bandwidth_used?r.compute_bandwidth_used=t.longs===String?String(e.compute_bandwidth_used):e.compute_bandwidth_used:r.compute_bandwidth_used=t.longs===String?c.Long.prototype.toString.call(e.compute_bandwidth_used):t.longs===Number?new c.LongBits(e.compute_bandwidth_used.low>>>0,e.compute_bandwidth_used.high>>>0).toNumber(!0):e.compute_bandwidth_used),null!=e.state_merkle_root&&e.hasOwnProperty("state_merkle_root")&&(r.state_merkle_root=t.bytes===String?c.base64.encode(e.state_merkle_root,0,e.state_merkle_root.length):t.bytes===Array?Array.prototype.slice.call(e.state_merkle_root):e.state_merkle_root),e.events&&e.events.length){r.events=[];for(var o=0;o>>3){case 1:n.message_value=l.google.protobuf.Any.decode(e,e.uint32());break;case 2:n.int32_value=e.int32();break;case 3:n.int64_value=e.int64();break;case 4:n.uint32_value=e.uint32();break;case 5:n.uint64_value=e.uint64();break;case 6:n.sint32_value=e.sint32();break;case 7:n.sint64_value=e.sint64();break;case 8:n.fixed32_value=e.fixed32();break;case 9:n.fixed64_value=e.fixed64();break;case 10:n.sfixed32_value=e.sfixed32();break;case 11:n.sfixed64_value=e.sfixed64();break;case 12:n.bool_value=e.bool();break;case 13:n.string_value=e.string();break;case 14:n.bytes_value=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.message_value&&e.hasOwnProperty("message_value")){t.kind=1;var r=l.google.protobuf.Any.verify(e.message_value);if(r)return"message_value."+r}if(null!=e.int32_value&&e.hasOwnProperty("int32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.int32_value))return"int32_value: integer expected"}if(null!=e.int64_value&&e.hasOwnProperty("int64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.int64_value)||e.int64_value&&c.isInteger(e.int64_value.low)&&c.isInteger(e.int64_value.high)))return"int64_value: integer|Long expected"}if(null!=e.uint32_value&&e.hasOwnProperty("uint32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.uint32_value))return"uint32_value: integer expected"}if(null!=e.uint64_value&&e.hasOwnProperty("uint64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.uint64_value)||e.uint64_value&&c.isInteger(e.uint64_value.low)&&c.isInteger(e.uint64_value.high)))return"uint64_value: integer|Long expected"}if(null!=e.sint32_value&&e.hasOwnProperty("sint32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.sint32_value))return"sint32_value: integer expected"}if(null!=e.sint64_value&&e.hasOwnProperty("sint64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.sint64_value)||e.sint64_value&&c.isInteger(e.sint64_value.low)&&c.isInteger(e.sint64_value.high)))return"sint64_value: integer|Long expected"}if(null!=e.fixed32_value&&e.hasOwnProperty("fixed32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.fixed32_value))return"fixed32_value: integer expected"}if(null!=e.fixed64_value&&e.hasOwnProperty("fixed64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.fixed64_value)||e.fixed64_value&&c.isInteger(e.fixed64_value.low)&&c.isInteger(e.fixed64_value.high)))return"fixed64_value: integer|Long expected"}if(null!=e.sfixed32_value&&e.hasOwnProperty("sfixed32_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isInteger(e.sfixed32_value))return"sfixed32_value: integer expected"}if(null!=e.sfixed64_value&&e.hasOwnProperty("sfixed64_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(c.isInteger(e.sfixed64_value)||e.sfixed64_value&&c.isInteger(e.sfixed64_value.low)&&c.isInteger(e.sfixed64_value.high)))return"sfixed64_value: integer|Long expected"}if(null!=e.bool_value&&e.hasOwnProperty("bool_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,"boolean"!=typeof e.bool_value)return"bool_value: boolean expected"}if(null!=e.string_value&&e.hasOwnProperty("string_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!c.isString(e.string_value))return"string_value: string expected"}if(null!=e.bytes_value&&e.hasOwnProperty("bytes_value")){if(1===t.kind)return"kind: multiple values";if(t.kind=1,!(e.bytes_value&&"number"==typeof e.bytes_value.length||c.isString(e.bytes_value)))return"bytes_value: buffer expected"}return null},t.fromObject=function(e){if(e instanceof l.koinos.chain.value_type)return e;var t=new l.koinos.chain.value_type;if(null!=e.message_value){if("object"!=typeof e.message_value)throw TypeError(".koinos.chain.value_type.message_value: object expected");t.message_value=l.google.protobuf.Any.fromObject(e.message_value)}return null!=e.int32_value&&(t.int32_value=0|e.int32_value),null!=e.int64_value&&(c.Long?(t.int64_value=c.Long.fromValue(e.int64_value)).unsigned=!1:"string"==typeof e.int64_value?t.int64_value=parseInt(e.int64_value,10):"number"==typeof e.int64_value?t.int64_value=e.int64_value:"object"==typeof e.int64_value&&(t.int64_value=new c.LongBits(e.int64_value.low>>>0,e.int64_value.high>>>0).toNumber())),null!=e.uint32_value&&(t.uint32_value=e.uint32_value>>>0),null!=e.uint64_value&&(c.Long?(t.uint64_value=c.Long.fromValue(e.uint64_value)).unsigned=!0:"string"==typeof e.uint64_value?t.uint64_value=parseInt(e.uint64_value,10):"number"==typeof e.uint64_value?t.uint64_value=e.uint64_value:"object"==typeof e.uint64_value&&(t.uint64_value=new c.LongBits(e.uint64_value.low>>>0,e.uint64_value.high>>>0).toNumber(!0))),null!=e.sint32_value&&(t.sint32_value=0|e.sint32_value),null!=e.sint64_value&&(c.Long?(t.sint64_value=c.Long.fromValue(e.sint64_value)).unsigned=!1:"string"==typeof e.sint64_value?t.sint64_value=parseInt(e.sint64_value,10):"number"==typeof e.sint64_value?t.sint64_value=e.sint64_value:"object"==typeof e.sint64_value&&(t.sint64_value=new c.LongBits(e.sint64_value.low>>>0,e.sint64_value.high>>>0).toNumber())),null!=e.fixed32_value&&(t.fixed32_value=e.fixed32_value>>>0),null!=e.fixed64_value&&(c.Long?(t.fixed64_value=c.Long.fromValue(e.fixed64_value)).unsigned=!1:"string"==typeof e.fixed64_value?t.fixed64_value=parseInt(e.fixed64_value,10):"number"==typeof e.fixed64_value?t.fixed64_value=e.fixed64_value:"object"==typeof e.fixed64_value&&(t.fixed64_value=new c.LongBits(e.fixed64_value.low>>>0,e.fixed64_value.high>>>0).toNumber())),null!=e.sfixed32_value&&(t.sfixed32_value=0|e.sfixed32_value),null!=e.sfixed64_value&&(c.Long?(t.sfixed64_value=c.Long.fromValue(e.sfixed64_value)).unsigned=!1:"string"==typeof e.sfixed64_value?t.sfixed64_value=parseInt(e.sfixed64_value,10):"number"==typeof e.sfixed64_value?t.sfixed64_value=e.sfixed64_value:"object"==typeof e.sfixed64_value&&(t.sfixed64_value=new c.LongBits(e.sfixed64_value.low>>>0,e.sfixed64_value.high>>>0).toNumber())),null!=e.bool_value&&(t.bool_value=Boolean(e.bool_value)),null!=e.string_value&&(t.string_value=String(e.string_value)),null!=e.bytes_value&&("string"==typeof e.bytes_value?c.base64.decode(e.bytes_value,t.bytes_value=c.newBuffer(c.base64.length(e.bytes_value)),0):e.bytes_value.length>=0&&(t.bytes_value=e.bytes_value)),t},t.toObject=function(e,t){t||(t={});var r={};return null!=e.message_value&&e.hasOwnProperty("message_value")&&(r.message_value=l.google.protobuf.Any.toObject(e.message_value,t),t.oneofs&&(r.kind="message_value")),null!=e.int32_value&&e.hasOwnProperty("int32_value")&&(r.int32_value=e.int32_value,t.oneofs&&(r.kind="int32_value")),null!=e.int64_value&&e.hasOwnProperty("int64_value")&&("number"==typeof e.int64_value?r.int64_value=t.longs===String?String(e.int64_value):e.int64_value:r.int64_value=t.longs===String?c.Long.prototype.toString.call(e.int64_value):t.longs===Number?new c.LongBits(e.int64_value.low>>>0,e.int64_value.high>>>0).toNumber():e.int64_value,t.oneofs&&(r.kind="int64_value")),null!=e.uint32_value&&e.hasOwnProperty("uint32_value")&&(r.uint32_value=e.uint32_value,t.oneofs&&(r.kind="uint32_value")),null!=e.uint64_value&&e.hasOwnProperty("uint64_value")&&("number"==typeof e.uint64_value?r.uint64_value=t.longs===String?String(e.uint64_value):e.uint64_value:r.uint64_value=t.longs===String?c.Long.prototype.toString.call(e.uint64_value):t.longs===Number?new c.LongBits(e.uint64_value.low>>>0,e.uint64_value.high>>>0).toNumber(!0):e.uint64_value,t.oneofs&&(r.kind="uint64_value")),null!=e.sint32_value&&e.hasOwnProperty("sint32_value")&&(r.sint32_value=e.sint32_value,t.oneofs&&(r.kind="sint32_value")),null!=e.sint64_value&&e.hasOwnProperty("sint64_value")&&("number"==typeof e.sint64_value?r.sint64_value=t.longs===String?String(e.sint64_value):e.sint64_value:r.sint64_value=t.longs===String?c.Long.prototype.toString.call(e.sint64_value):t.longs===Number?new c.LongBits(e.sint64_value.low>>>0,e.sint64_value.high>>>0).toNumber():e.sint64_value,t.oneofs&&(r.kind="sint64_value")),null!=e.fixed32_value&&e.hasOwnProperty("fixed32_value")&&(r.fixed32_value=e.fixed32_value,t.oneofs&&(r.kind="fixed32_value")),null!=e.fixed64_value&&e.hasOwnProperty("fixed64_value")&&("number"==typeof e.fixed64_value?r.fixed64_value=t.longs===String?String(e.fixed64_value):e.fixed64_value:r.fixed64_value=t.longs===String?c.Long.prototype.toString.call(e.fixed64_value):t.longs===Number?new c.LongBits(e.fixed64_value.low>>>0,e.fixed64_value.high>>>0).toNumber():e.fixed64_value,t.oneofs&&(r.kind="fixed64_value")),null!=e.sfixed32_value&&e.hasOwnProperty("sfixed32_value")&&(r.sfixed32_value=e.sfixed32_value,t.oneofs&&(r.kind="sfixed32_value")),null!=e.sfixed64_value&&e.hasOwnProperty("sfixed64_value")&&("number"==typeof e.sfixed64_value?r.sfixed64_value=t.longs===String?String(e.sfixed64_value):e.sfixed64_value:r.sfixed64_value=t.longs===String?c.Long.prototype.toString.call(e.sfixed64_value):t.longs===Number?new c.LongBits(e.sfixed64_value.low>>>0,e.sfixed64_value.high>>>0).toNumber():e.sfixed64_value,t.oneofs&&(r.kind="sfixed64_value")),null!=e.bool_value&&e.hasOwnProperty("bool_value")&&(r.bool_value=e.bool_value,t.oneofs&&(r.kind="bool_value")),null!=e.string_value&&e.hasOwnProperty("string_value")&&(r.string_value=e.string_value,t.oneofs&&(r.kind="string_value")),null!=e.bytes_value&&e.hasOwnProperty("bytes_value")&&(r.bytes_value=t.bytes===String?c.base64.encode(e.bytes_value,0,e.bytes_value.length):t.bytes===Array?Array.prototype.slice.call(e.bytes_value):e.bytes_value,t.oneofs&&(r.kind="bytes_value")),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.chain.value_type"},t}(),o.enum_type=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.name=e.string();break;case 2:n.number=e.int32();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.name&&e.hasOwnProperty("name")&&!c.isString(e.name)?"name: string expected":null!=e.number&&e.hasOwnProperty("number")&&!c.isInteger(e.number)?"number: integer expected":null},t.fromObject=function(e){if(e instanceof l.koinos.chain.enum_type)return e;var t=new l.koinos.chain.enum_type;return null!=e.name&&(t.name=String(e.name)),null!=e.number&&(t.number=0|e.number),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.name="",r.number=0),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.number&&e.hasOwnProperty("number")&&(r.number=e.number),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/koinos.chain.enum_type"},t}(),o.list_type=function(){function t(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.values&&n.values.length||(n.values=[]),n.values.push(l.koinos.chain.value_type.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t>>3){case 1:n.type_url=e.string();break;case 2:n.value=e.bytes();break;default:e.skipType(7&o)}}return n},t.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.type_url&&e.hasOwnProperty("type_url")&&!c.isString(e.type_url)?"type_url: string expected":null!=e.value&&e.hasOwnProperty("value")&&!(e.value&&"number"==typeof e.value.length||c.isString(e.value))?"value: buffer expected":null},t.fromObject=function(e){if(e instanceof l.google.protobuf.Any)return e;var t=new l.google.protobuf.Any;return null!=e.type_url&&(t.type_url=String(e.type_url)),null!=e.value&&("string"==typeof e.value?c.base64.decode(e.value,t.value=c.newBuffer(c.base64.length(e.value)),0):e.value.length>=0&&(t.value=e.value)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.type_url="",t.bytes===String?r.value="":(r.value=[],t.bytes!==Array&&(r.value=c.newBuffer(r.value)))),null!=e.type_url&&e.hasOwnProperty("type_url")&&(r.type_url=e.type_url),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.bytes===String?c.base64.encode(e.value,0,e.value.length):t.bytes===Array?Array.prototype.slice.call(e.value):e.value),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t.getTypeUrl=function(e){return void 0===e&&(e="type.googleapis.com"),e+"/google.protobuf.Any"},t}(),t),r),l})?n.apply(t,o):n)||(e.exports=i)},9159:()=>{},6567:e=>{"use strict";e.exports=JSON.parse('{"nested":{"koinos":{"nested":{"contracts":{"nested":{"token":{"options":{"go_package":"github.com/koinos/koinos-proto-golang/koinos/contracts/token"},"nested":{"name_arguments":{"fields":{}},"name_result":{"fields":{"value":{"type":"string","id":1}}},"symbol_arguments":{"fields":{}},"symbol_result":{"fields":{"value":{"type":"string","id":1}}},"decimals_arguments":{"fields":{}},"decimals_result":{"fields":{"value":{"type":"uint32","id":1}}},"total_supply_arguments":{"fields":{}},"total_supply_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"balance_of_arguments":{"fields":{"owner":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}}}},"balance_of_result":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"transfer_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}},"transfer_result":{"fields":{}},"mint_arguments":{"fields":{"to":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"mint_result":{"fields":{}},"burn_arguments":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"burn_result":{"fields":{}},"balance_object":{"fields":{"value":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}}}},"mana_balance_object":{"fields":{"balance":{"type":"uint64","id":1,"options":{"jstype":"JS_STRING"}},"mana":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}},"last_mana_update":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}},"burn_event":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"mint_event":{"fields":{"to":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":2,"options":{"jstype":"JS_STRING"}}}},"transfer_event":{"fields":{"from":{"type":"bytes","id":1,"options":{"(btype)":"ADDRESS"}},"to":{"type":"bytes","id":2,"options":{"(btype)":"ADDRESS"}},"value":{"type":"uint64","id":3,"options":{"jstype":"JS_STRING"}}}}}}}}}}}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var __webpack_exports__=__webpack_require__(5738)})(); \ No newline at end of file diff --git a/package.json b/package.json index 1d7f626..6c16564 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "koilib", - "version": "5.2.2", + "version": "5.2.3", "description": "JS Koinos Library", "author": "Julian Gonzalez", "repository": {