@stellar/stellar-sdk 12.1.0 → 12.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +1 -1
  3. package/dist/stellar-sdk.js +1336 -1101
  4. package/dist/stellar-sdk.min.js +1 -1
  5. package/lib/browser.d.ts +1 -1
  6. package/lib/browser.js +4 -4
  7. package/lib/config.js +5 -2
  8. package/lib/contract/assembled_transaction.d.ts +26 -30
  9. package/lib/contract/assembled_transaction.js +28 -36
  10. package/lib/contract/client.d.ts +0 -1
  11. package/lib/contract/client.js +2 -2
  12. package/lib/contract/index.d.ts +0 -1
  13. package/lib/contract/index.js +1 -18
  14. package/lib/contract/sent_transaction.d.ts +9 -10
  15. package/lib/contract/sent_transaction.js +2 -1
  16. package/lib/contract/spec.d.ts +1 -1
  17. package/lib/contract/spec.js +921 -956
  18. package/lib/contract/types.d.ts +5 -0
  19. package/lib/contract/types.js +4 -1
  20. package/lib/contract/utils.d.ts +0 -5
  21. package/lib/contract/utils.js +4 -18
  22. package/lib/errors.d.ts +4 -4
  23. package/lib/federation/server.d.ts +1 -1
  24. package/lib/horizon/account_call_builder.d.ts +2 -3
  25. package/lib/horizon/account_response.d.ts +1 -1
  26. package/lib/horizon/assets_call_builder.d.ts +2 -3
  27. package/lib/horizon/call_builder.d.ts +8 -8
  28. package/lib/horizon/call_builder.js +10 -13
  29. package/lib/horizon/claimable_balances_call_builder.d.ts +3 -4
  30. package/lib/horizon/effect_call_builder.d.ts +2 -3
  31. package/lib/horizon/friendbot_builder.d.ts +0 -1
  32. package/lib/horizon/horizon_api.d.ts +5 -1
  33. package/lib/horizon/horizon_axios_client.js +6 -6
  34. package/lib/horizon/ledger_call_builder.d.ts +2 -3
  35. package/lib/horizon/liquidity_pool_call_builder.d.ts +2 -4
  36. package/lib/horizon/offer_call_builder.d.ts +2 -3
  37. package/lib/horizon/operation_call_builder.d.ts +3 -4
  38. package/lib/horizon/orderbook_call_builder.d.ts +0 -1
  39. package/lib/horizon/path_call_builder.d.ts +1 -2
  40. package/lib/horizon/payment_call_builder.d.ts +2 -3
  41. package/lib/horizon/server.d.ts +29 -10
  42. package/lib/horizon/server.js +98 -55
  43. package/lib/horizon/strict_receive_path_call_builder.d.ts +1 -2
  44. package/lib/horizon/strict_send_path_call_builder.d.ts +1 -2
  45. package/lib/horizon/trade_aggregation_call_builder.d.ts +9 -10
  46. package/lib/horizon/trade_aggregation_call_builder.js +3 -7
  47. package/lib/horizon/trades_call_builder.d.ts +2 -3
  48. package/lib/horizon/transaction_call_builder.d.ts +3 -4
  49. package/lib/horizon/types/assets.d.ts +1 -1
  50. package/lib/horizon/types/effects.d.ts +1 -1
  51. package/lib/horizon/types/offer.d.ts +1 -1
  52. package/lib/index.d.ts +0 -1
  53. package/lib/rpc/api.d.ts +89 -11
  54. package/lib/rpc/browser.d.ts +1 -1
  55. package/lib/rpc/browser.js +4 -4
  56. package/lib/rpc/index.d.ts +0 -1
  57. package/lib/rpc/jsonrpc.js +3 -3
  58. package/lib/rpc/parsers.d.ts +5 -3
  59. package/lib/rpc/parsers.js +52 -23
  60. package/lib/rpc/server.d.ts +51 -18
  61. package/lib/rpc/server.js +200 -153
  62. package/lib/rpc/transaction.d.ts +3 -4
  63. package/lib/rpc/transaction.js +23 -25
  64. package/lib/webauth/utils.js +3 -3
  65. package/package.json +24 -24
@@ -15,7 +15,7 @@ return /******/ (() => { // webpackBootstrap
15
15
  /***/ (function(module) {
16
16
 
17
17
  /*! For license information please see xdr.js.LICENSE.txt */
18
- !function(t,e){ true?module.exports=e():0}(this,(()=>(()=>{var t={616:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});var n=r(287);n.hp.alloc(1).subarray(0,1)instanceof n.hp||(n.hp.prototype.subarray=function(t,e){const r=Uint8Array.prototype.subarray.call(this,t,e);return Object.setPrototypeOf(r,n.hp.prototype),r});const i=n.hp},281:(t,e,r)=>{const n=r(164);t.exports=n},164:(t,e,r)=>{"use strict";r.r(e),r.d(e,{Array:()=>j,Bool:()=>O,Double:()=>$,Enum:()=>X,Float:()=>T,Hyper:()=>I,Int:()=>B,LargeInt:()=>A,Opaque:()=>M,Option:()=>F,Quadruple:()=>L,Reference:()=>k,String:()=>N,Struct:()=>q,Union:()=>Y,UnsignedHyper:()=>R,UnsignedInt:()=>U,VarArray:()=>z,VarOpaque:()=>D,Void:()=>P,XdrReader:()=>u,XdrWriter:()=>c,config:()=>rt});class n extends TypeError{constructor(t){super(`XDR Write Error: ${t}`)}}class i extends TypeError{constructor(t){super(`XDR Read Error: ${t}`)}}class o extends TypeError{constructor(t){super(`XDR Type Definition Error: ${t}`)}}class s extends o{constructor(){super("method not implemented, it should be overloaded in the descendant class.")}}var f=r(616).A;class u{constructor(t){if(!f.isBuffer(t)){if(!(t instanceof Array||Array.isArray(t)||ArrayBuffer.isView(t)))throw new i(`source invalid: ${t}`);t=f.from(t)}this._buffer=t,this._length=t.length,this._index=0}_buffer;_length;_index;get eof(){return this._index===this._length}advance(t){const e=this._index;if(this._index+=t,this._length<this._index)throw new i("attempt to read outside the boundary of the buffer");const r=4-(t%4||4);if(r>0){for(let t=0;t<r;t++)if(0!==this._buffer[this._index+t])throw new i("invalid padding");this._index+=r}return e}rewind(){this._index=0}read(t){const e=this.advance(t);return this._buffer.subarray(e,e+t)}readInt32BE(){return this._buffer.readInt32BE(this.advance(4))}readUInt32BE(){return this._buffer.readUInt32BE(this.advance(4))}readBigInt64BE(){return this._buffer.readBigInt64BE(this.advance(8))}readBigUInt64BE(){return this._buffer.readBigUInt64BE(this.advance(8))}readFloatBE(){return this._buffer.readFloatBE(this.advance(4))}readDoubleBE(){return this._buffer.readDoubleBE(this.advance(8))}ensureInputConsumed(){if(this._index!==this._length)throw new i("invalid XDR contract typecast - source buffer not entirely consumed")}}var a=r(616).A;const h=8192;class c{constructor(t){"number"==typeof t?t=a.allocUnsafe(t):t instanceof a||(t=a.allocUnsafe(h)),this._buffer=t,this._length=t.length}_buffer;_length;_index=0;alloc(t){const e=this._index;return this._index+=t,this._length<this._index&&this.resize(this._index),e}resize(t){const e=Math.ceil(t/h)*h,r=a.allocUnsafe(e);this._buffer.copy(r,0,0,this._length),this._buffer=r,this._length=e}finalize(){return this._buffer.subarray(0,this._index)}toArray(){return[...this.finalize()]}write(t,e){if("string"==typeof t){const r=this.alloc(e);this._buffer.write(t,r,"utf8")}else{t instanceof a||(t=a.from(t));const r=this.alloc(e);t.copy(this._buffer,r,0,e)}const r=4-(e%4||4);if(r>0){const t=this.alloc(r);this._buffer.fill(0,t,this._index)}}writeInt32BE(t){const e=this.alloc(4);this._buffer.writeInt32BE(t,e)}writeUInt32BE(t){const e=this.alloc(4);this._buffer.writeUInt32BE(t,e)}writeBigInt64BE(t){const e=this.alloc(8);this._buffer.writeBigInt64BE(t,e)}writeBigUInt64BE(t){const e=this.alloc(8);this._buffer.writeBigUInt64BE(t,e)}writeFloatBE(t){const e=this.alloc(4);this._buffer.writeFloatBE(t,e)}writeDoubleBE(t){const e=this.alloc(8);this._buffer.writeDoubleBE(t,e)}static bufferChunkSize=h}var l=r(616).A;class p{toXDR(t="raw"){if(!this.write)return this.constructor.toXDR(this,t);const e=new c;return this.write(this,e),y(e.finalize(),t)}fromXDR(t,e="raw"){if(!this.read)return this.constructor.fromXDR(t,e);const r=new u(m(t,e)),n=this.read(r);return r.ensureInputConsumed(),n}validateXDR(t,e="raw"){try{return this.fromXDR(t,e),!0}catch(t){return!1}}static toXDR(t,e="raw"){const r=new c;return this.write(t,r),y(r.finalize(),e)}static fromXDR(t,e="raw"){const r=new u(m(t,e)),n=this.read(r);return r.ensureInputConsumed(),n}static validateXDR(t,e="raw"){try{return this.fromXDR(t,e),!0}catch(t){return!1}}}class d extends p{static read(t){throw new s}static write(t,e){throw new s}static isValid(t){return!1}}class g extends p{isValid(t){return!1}}class w extends TypeError{constructor(t){super(`Invalid format ${t}, must be one of "raw", "hex", "base64"`)}}function y(t,e){switch(e){case"raw":return t;case"hex":return t.toString("hex");case"base64":return t.toString("base64");default:throw new w(e)}}function m(t,e){switch(e){case"raw":return t;case"hex":return l.from(t,"hex");case"base64":return l.from(t,"base64");default:throw new w(e)}}const b=2147483647,_=-2147483648;class B extends d{static read(t){return t.readInt32BE()}static write(t,e){if("number"!=typeof t)throw new n("not a number");if((0|t)!==t)throw new n("invalid i32 value");e.writeInt32BE(t)}static isValid(t){return"number"==typeof t&&(0|t)===t&&(t>=_&&t<=b)}}function E(t,e,r){if("bigint"!=typeof t)throw new TypeError("Expected bigint 'value', got "+typeof t);const n=e/r;if(1===n)return[t];if(r<32||r>128||2!==n&&4!==n&&8!==n)throw new TypeError(`invalid bigint (${t}) and slice size (${e} -> ${r}) combination`);const i=BigInt(r),o=new Array(n);for(let e=0;e<n;e++)o[e]=BigInt.asIntN(r,t),t>>=i;return o}function v(t,e){if(e)return[0n,(1n<<BigInt(t))-1n];const r=1n<<BigInt(t-1);return[0n-r,r-1n]}B.MAX_VALUE=b,B.MIN_VALUE=2147483648;class A extends d{constructor(t){super(),this._value=function(t,e,r){t instanceof Array?t.length&&t[0]instanceof Array&&(t=t[0]):t=[t];const n=e/t.length;switch(n){case 32:case 64:case 128:case 256:break;default:throw new RangeError(`expected slices to fit in 32/64/128/256 bits, got ${t}`)}try{for(let e=0;e<t.length;e++)"bigint"!=typeof t[e]&&(t[e]=BigInt(t[e].valueOf()))}catch(e){throw new TypeError(`expected bigint-like values, got: ${t} (${e})`)}if(r&&1===t.length&&t[0]<0n)throw new RangeError(`expected a positive value, got: ${t}`);let i=BigInt.asUintN(n,t[0]);for(let e=1;e<t.length;e++)i|=BigInt.asUintN(n,t[e])<<BigInt(e*n);r||(i=BigInt.asIntN(e,i));const[o,s]=v(e,r);if(i>=o&&i<=s)return i;throw new TypeError(`bigint values [${t}] for ${function(t,e){return`${e?"u":"i"}${t}`}(e,r)} out of range [${o}, ${s}]: ${i}`)}(t,this.size,this.unsigned)}get unsigned(){throw new s}get size(){throw new s}slice(t){return E(this._value,this.size,t)}toString(){return this._value.toString()}toJSON(){return{_value:this._value.toString()}}toBigInt(){return BigInt(this._value)}static read(t){const{size:e}=this.prototype;return 64===e?new this(t.readBigUInt64BE()):new this(...Array.from({length:e/64},(()=>t.readBigUInt64BE())).reverse())}static write(t,e){if(t instanceof this)t=t._value;else if("bigint"!=typeof t||t>this.MAX_VALUE||t<this.MIN_VALUE)throw new n(`${t} is not a ${this.name}`);const{unsigned:r,size:i}=this.prototype;if(64===i)r?e.writeBigUInt64BE(t):e.writeBigInt64BE(t);else for(const n of E(t,i,64).reverse())r?e.writeBigUInt64BE(n):e.writeBigInt64BE(n)}static isValid(t){return"bigint"==typeof t||t instanceof this}static fromString(t){return new this(t)}static MAX_VALUE=0n;static MIN_VALUE=0n;static defineIntBoundaries(){const[t,e]=v(this.prototype.size,this.prototype.unsigned);this.MIN_VALUE=t,this.MAX_VALUE=e}}class I extends A{constructor(...t){super(t)}get low(){return Number(0xffffffffn&this._value)<<0}get high(){return Number(this._value>>32n)>>0}get size(){return 64}get unsigned(){return!1}static fromBits(t,e){return new this(t,e)}}I.defineIntBoundaries();const x=4294967295;class U extends d{static read(t){return t.readUInt32BE()}static write(t,e){if("number"!=typeof t||!(t>=0&&t<=x)||t%1!=0)throw new n("invalid u32 value");e.writeUInt32BE(t)}static isValid(t){return"number"==typeof t&&t%1==0&&(t>=0&&t<=x)}}U.MAX_VALUE=x,U.MIN_VALUE=0;class R extends A{constructor(...t){super(t)}get low(){return Number(0xffffffffn&this._value)<<0}get high(){return Number(this._value>>32n)>>0}get size(){return 64}get unsigned(){return!0}static fromBits(t,e){return new this(t,e)}}R.defineIntBoundaries();class T extends d{static read(t){return t.readFloatBE()}static write(t,e){if("number"!=typeof t)throw new n("not a number");e.writeFloatBE(t)}static isValid(t){return"number"==typeof t}}class $ extends d{static read(t){return t.readDoubleBE()}static write(t,e){if("number"!=typeof t)throw new n("not a number");e.writeDoubleBE(t)}static isValid(t){return"number"==typeof t}}class L extends d{static read(){throw new o("quadruple not supported")}static write(){throw new o("quadruple not supported")}static isValid(){return!1}}class O extends d{static read(t){const e=B.read(t);switch(e){case 0:return!1;case 1:return!0;default:throw new i(`got ${e} when trying to read a bool`)}}static write(t,e){const r=t?1:0;B.write(r,e)}static isValid(t){return"boolean"==typeof t}}var S=r(616).A;class N extends g{constructor(t=U.MAX_VALUE){super(),this._maxLength=t}read(t){const e=U.read(t);if(e>this._maxLength)throw new i(`saw ${e} length String, max allowed is ${this._maxLength}`);return t.read(e)}readString(t){return this.read(t).toString("utf8")}write(t,e){const r="string"==typeof t?S.byteLength(t,"utf8"):t.length;if(r>this._maxLength)throw new n(`got ${t.length} bytes, max allowed is ${this._maxLength}`);U.write(r,e),e.write(t,r)}isValid(t){return"string"==typeof t?S.byteLength(t,"utf8")<=this._maxLength:!!(t instanceof Array||S.isBuffer(t))&&t.length<=this._maxLength}}var V=r(616).A;class M extends g{constructor(t){super(),this._length=t}read(t){return t.read(this._length)}write(t,e){const{length:r}=t;if(r!==this._length)throw new n(`got ${t.length} bytes, expected ${this._length}`);e.write(t,r)}isValid(t){return V.isBuffer(t)&&t.length===this._length}}var C=r(616).A;class D extends g{constructor(t=U.MAX_VALUE){super(),this._maxLength=t}read(t){const e=U.read(t);if(e>this._maxLength)throw new i(`saw ${e} length VarOpaque, max allowed is ${this._maxLength}`);return t.read(e)}write(t,e){const{length:r}=t;if(t.length>this._maxLength)throw new n(`got ${t.length} bytes, max allowed is ${this._maxLength}`);U.write(r,e),e.write(t,r)}isValid(t){return C.isBuffer(t)&&t.length<=this._maxLength}}class j extends g{constructor(t,e){super(),this._childType=t,this._length=e}read(t){const e=new r.g.Array(this._length);for(let r=0;r<this._length;r++)e[r]=this._childType.read(t);return e}write(t,e){if(!(t instanceof r.g.Array))throw new n("value is not array");if(t.length!==this._length)throw new n(`got array of size ${t.length}, expected ${this._length}`);for(const r of t)this._childType.write(r,e)}isValid(t){if(!(t instanceof r.g.Array)||t.length!==this._length)return!1;for(const e of t)if(!this._childType.isValid(e))return!1;return!0}}class z extends g{constructor(t,e=U.MAX_VALUE){super(),this._childType=t,this._maxLength=e}read(t){const e=U.read(t);if(e>this._maxLength)throw new i(`saw ${e} length VarArray, max allowed is ${this._maxLength}`);const r=new Array(e);for(let n=0;n<e;n++)r[n]=this._childType.read(t);return r}write(t,e){if(!(t instanceof Array))throw new n("value is not array");if(t.length>this._maxLength)throw new n(`got array of size ${t.length}, max allowed is ${this._maxLength}`);U.write(t.length,e);for(const r of t)this._childType.write(r,e)}isValid(t){if(!(t instanceof Array)||t.length>this._maxLength)return!1;for(const e of t)if(!this._childType.isValid(e))return!1;return!0}}class F extends d{constructor(t){super(),this._childType=t}read(t){if(O.read(t))return this._childType.read(t)}write(t,e){const r=null!=t;O.write(r,e),r&&this._childType.write(t,e)}isValid(t){return null==t||this._childType.isValid(t)}}class P extends d{static read(){}static write(t){if(void 0!==t)throw new n("trying to write value to a void slot")}static isValid(t){return void 0===t}}class X extends d{constructor(t,e){super(),this.name=t,this.value=e}static read(t){const e=B.read(t),r=this._byValue[e];if(void 0===r)throw new i(`unknown ${this.enumName} member for value ${e}`);return r}static write(t,e){if(!(t instanceof this))throw new n(`unknown ${t} is not a ${this.enumName}`);B.write(t.value,e)}static isValid(t){return t instanceof this}static members(){return this._members}static values(){return Object.values(this._members)}static fromName(t){const e=this._members[t];if(!e)throw new TypeError(`${t} is not a member of ${this.enumName}`);return e}static fromValue(t){const e=this._byValue[t];if(void 0===e)throw new TypeError(`${t} is not a value of any member of ${this.enumName}`);return e}static create(t,e,r){const n=class extends X{};n.enumName=e,t.results[e]=n,n._members={},n._byValue={};for(const[t,e]of Object.entries(r)){const r=new n(t,e);n._members[t]=r,n._byValue[e]=r,n[t]=()=>r}return n}}class k extends d{resolve(){throw new o('"resolve" method should be implemented in the descendant class')}}class q extends d{constructor(t){super(),this._attributes=t||{}}static read(t){const e={};for(const[r,n]of this._fields)e[r]=n.read(t);return new this(e)}static write(t,e){if(!(t instanceof this))throw new n(`${t} is not a ${this.structName}`);for(const[r,n]of this._fields){const i=t._attributes[r];n.write(i,e)}}static isValid(t){return t instanceof this}static create(t,e,r){const n=class extends q{};n.structName=e,t.results[e]=n;const i=new Array(r.length);for(let e=0;e<r.length;e++){const o=r[e],s=o[0];let f=o[1];f instanceof k&&(f=f.resolve(t)),i[e]=[s,f],n.prototype[s]=G(s)}return n._fields=i,n}}function G(t){return function(e){return void 0!==e&&(this._attributes[t]=e),this._attributes[t]}}class Y extends g{constructor(t,e){super(),this.set(t,e)}set(t,e){"string"==typeof t&&(t=this.constructor._switchOn.fromName(t)),this._switch=t;const r=this.constructor.armForSwitch(this._switch);this._arm=r,this._armType=r===P?P:this.constructor._arms[r],this._value=e}get(t=this._arm){if(this._arm!==P&&this._arm!==t)throw new TypeError(`${t} not set`);return this._value}switch(){return this._switch}arm(){return this._arm}armType(){return this._armType}value(){return this._value}static armForSwitch(t){const e=this._switches.get(t);if(void 0!==e)return e;if(this._defaultArm)return this._defaultArm;throw new TypeError(`Bad union switch: ${t}`)}static armTypeForArm(t){return t===P?P:this._arms[t]}static read(t){const e=this._switchOn.read(t),r=this.armForSwitch(e),n=r===P?P:this._arms[r];let i;return i=void 0!==n?n.read(t):r.read(t),new this(e,i)}static write(t,e){if(!(t instanceof this))throw new n(`${t} is not a ${this.unionName}`);this._switchOn.write(t.switch(),e),t.armType().write(t.value(),e)}static isValid(t){return t instanceof this}static create(t,e,r){const n=class extends Y{};n.unionName=e,t.results[e]=n,r.switchOn instanceof k?n._switchOn=r.switchOn.resolve(t):n._switchOn=r.switchOn,n._switches=new Map,n._arms={};let i=r.defaultArm;i instanceof k&&(i=i.resolve(t)),n._defaultArm=i;for(const[t,e]of r.switches){const r="string"==typeof t?n._switchOn.fromName(t):t;n._switches.set(r,e)}if(void 0!==n._switchOn.values)for(const t of n._switchOn.values())n[t.name]=function(e){return new n(t,e)},n.prototype[t.name]=function(e){return this.set(t,e)};if(r.arms)for(const[e,i]of Object.entries(r.arms))n._arms[e]=i instanceof k?i.resolve(t):i,i!==P&&(n.prototype[e]=function(){return this.get(e)});return n}}class W extends k{constructor(t){super(),this.name=t}resolve(t){return t.definitions[this.name].resolve(t)}}class H extends k{constructor(t,e,r=!1){super(),this.childReference=t,this.length=e,this.variable=r}resolve(t){let e=this.childReference,r=this.length;return e instanceof k&&(e=e.resolve(t)),r instanceof k&&(r=r.resolve(t)),this.variable?new z(e,r):new j(e,r)}}class J extends k{constructor(t){super(),this.childReference=t,this.name=t.name}resolve(t){let e=this.childReference;return e instanceof k&&(e=e.resolve(t)),new F(e)}}class Q extends k{constructor(t,e){super(),this.sizedType=t,this.length=e}resolve(t){let e=this.length;return e instanceof k&&(e=e.resolve(t)),new this.sizedType(e)}}class Z{constructor(t,e,r){this.constructor=t,this.name=e,this.config=r}resolve(t){return this.name in t.results?t.results[this.name]:this.constructor(t,this.name,this.config)}}function K(t,e,r){return r instanceof k&&(r=r.resolve(t)),t.results[e]=r,r}function tt(t,e,r){return t.results[e]=r,r}class et{constructor(t){this._destination=t,this._definitions={}}enum(t,e){const r=new Z(X.create,t,e);this.define(t,r)}struct(t,e){const r=new Z(q.create,t,e);this.define(t,r)}union(t,e){const r=new Z(Y.create,t,e);this.define(t,r)}typedef(t,e){const r=new Z(K,t,e);this.define(t,r)}const(t,e){const r=new Z(tt,t,e);this.define(t,r)}void(){return P}bool(){return O}int(){return B}hyper(){return I}uint(){return U}uhyper(){return R}float(){return T}double(){return $}quadruple(){return L}string(t){return new Q(N,t)}opaque(t){return new Q(M,t)}varOpaque(t){return new Q(D,t)}array(t,e){return new H(t,e)}varArray(t,e){return new H(t,e,!0)}option(t){return new J(t)}define(t,e){if(void 0!==this._destination[t])throw new o(`${t} is already defined`);this._definitions[t]=e}lookup(t){return new W(t)}resolve(){for(const t of Object.values(this._definitions))t.resolve({definitions:this._definitions,results:this._destination})}}function rt(t,e={}){if(t){const r=new et(e);t(r),r.resolve()}return e}},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=f(t),s=o[0],u=o[1],a=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),h=0,c=u>0?s-4:s;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[h++]=e>>16&255,a[h++]=e>>8&255,a[h++]=255&e;2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[h++]=255&e);1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[h++]=e>>8&255,a[h++]=255&e);return a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,f=0,a=n-i;f<a;f+=s)o.push(u(t,f,f+s>a?a:f+s));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var i,o,s=[],f=e;f<n;f+=3)i=(t[f]<<16&16711680)+(t[f+1]<<8&65280)+(255&t[f+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},287:(t,e,r)=>{"use strict";const n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const s=2147483647;function f(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return a(t,e,r)}function a(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=f(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|d(t.length),r=f(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||J(t.length)?f(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),f(t<0?0:0|d(t))}function l(t){const e=t.length<0?0:0|d(t.length),r=f(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(i)return n?-1:G(t).length;e=(""+e).toLowerCase(),i=!0}}function w(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return $(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function y(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){let o,s=1,f=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,f/=2,u/=2,r/=2}function a(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<f;o++)if(a(t,o)===a(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>f&&(r=f-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(a(t,o+n)!==a(e,n)){r=!1;break}if(r)return o}return-1}function _(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(J(n))return s;t[r+s]=n}return s}function B(t,e,r,n){return W(G(e,t.length-r),t,r,n)}function E(t,e,r,n){return W(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function v(t,e,r,n){return W(Y(e),t,r,n)}function A(t,e,r,n){return W(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function I(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,f,u;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],f=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&f)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&f,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=U)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=U));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return a(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?f(t):void 0!==e?"string"==typeof r?f(t).fill(e,r):f(t).fill(e):f(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(H(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),H(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(H(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)y(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)y(this,e,e+3),y(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)y(this,e,e+7),y(this,e+1,e+6),y(this,e+2,e+5),y(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):w.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(H(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const f=Math.min(o,s),a=this.slice(n,i),h=t.slice(e,r);for(let t=0;t<f;++t)if(a[t]!==h[t]){o=a[t],s=h[t];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return B(this,t,e,r);case"ascii":case"latin1":case"binary":return E(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const U=4096;function R(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function $(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=Q[t[n]];return i}function L(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function S(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function N(t,e,r,n,i){P(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function V(t,e,r,n,i){P(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function M(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,o){return e=+e,r>>>=0,o||M(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return e=+e,r>>>=0,o||M(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Z((function(t){X(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||k(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=Z((function(t){X(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||k(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Z((function(t){X(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||k(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=Z((function(t){X(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||k(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){S(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){S(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=Z((function(t,e=0){return N(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Z((function(t,e=0){return V(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);S(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);S(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=Z((function(t,e=0){return N(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Z((function(t,e=0){return V(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,n),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s]}return this};const j={};function z(t,e,r){j[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function F(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function P(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){X(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||k(e,t.length-(r+1))}(n,i,o)}function X(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function k(t,e,r){if(Math.floor(t)!==t)throw X(t,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}z("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),z("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),z("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function W(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const Q=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?K:t}function K(){throw new Error("BigInt not supported")}},251:(t,e)=>{e.read=function(t,e,r,n,i){var o,s,f=8*i-n-1,u=(1<<f)-1,a=u>>1,h=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=f;h>0;o=256*o+t[e+c],c+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+c],c+=l,h-=8);if(0===o)o=1-a;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=a}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,f,u,a=8*o-i-1,h=(1<<a)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=h?(f=0,s=h):s+c>=1?(f=(e*u-1)*Math.pow(2,i),s+=c):(f=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&f,p+=d,f/=256,i-=8);for(s=s<<i|f,a+=i;a>0;t[r+p]=255&s,p+=d,s/=256,a-=8);t[r+p-d]|=128*g}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}return r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(281)})()));
18
+ !function(t,e){ true?module.exports=e():0}(this,(()=>(()=>{var t={616:(t,e,r)=>{"use strict";r.d(e,{A:()=>i});var n=r(287);n.hp.alloc(1).subarray(0,1)instanceof n.hp||(n.hp.prototype.subarray=function(t,e){const r=Uint8Array.prototype.subarray.call(this,t,e);return Object.setPrototypeOf(r,n.hp.prototype),r});const i=n.hp},281:(t,e,r)=>{const n=r(164);t.exports=n},164:(t,e,r)=>{"use strict";r.r(e),r.d(e,{Array:()=>F,Bool:()=>S,Double:()=>L,Enum:()=>q,Float:()=>O,Hyper:()=>U,Int:()=>v,LargeInt:()=>x,Opaque:()=>D,Option:()=>X,Quadruple:()=>N,Reference:()=>G,String:()=>M,Struct:()=>Y,Union:()=>W,UnsignedHyper:()=>T,UnsignedInt:()=>R,VarArray:()=>P,VarOpaque:()=>z,Void:()=>k,XdrReader:()=>f,XdrWriter:()=>c,config:()=>it});class n extends TypeError{constructor(t){super(`XDR Write Error: ${t}`)}}class i extends TypeError{constructor(t){super(`XDR Read Error: ${t}`)}}class o extends TypeError{constructor(t){super(`XDR Type Definition Error: ${t}`)}}class s extends o{constructor(){super("method not implemented, it should be overloaded in the descendant class.")}}var u=r(616).A;class f{constructor(t){if(!u.isBuffer(t)){if(!(t instanceof Array||Array.isArray(t)||ArrayBuffer.isView(t)))throw new i(`source invalid: ${t}`);t=u.from(t)}this._buffer=t,this._length=t.length,this._index=0}_buffer;_length;_index;get eof(){return this._index===this._length}advance(t){const e=this._index;if(this._index+=t,this._length<this._index)throw new i("attempt to read outside the boundary of the buffer");const r=4-(t%4||4);if(r>0){for(let t=0;t<r;t++)if(0!==this._buffer[this._index+t])throw new i("invalid padding");this._index+=r}return e}rewind(){this._index=0}read(t){const e=this.advance(t);return this._buffer.subarray(e,e+t)}readInt32BE(){return this._buffer.readInt32BE(this.advance(4))}readUInt32BE(){return this._buffer.readUInt32BE(this.advance(4))}readBigInt64BE(){return this._buffer.readBigInt64BE(this.advance(8))}readBigUInt64BE(){return this._buffer.readBigUInt64BE(this.advance(8))}readFloatBE(){return this._buffer.readFloatBE(this.advance(4))}readDoubleBE(){return this._buffer.readDoubleBE(this.advance(8))}ensureInputConsumed(){if(this._index!==this._length)throw new i("invalid XDR contract typecast - source buffer not entirely consumed")}}var a=r(616).A;const h=8192;class c{constructor(t){"number"==typeof t?t=a.allocUnsafe(t):t instanceof a||(t=a.allocUnsafe(h)),this._buffer=t,this._length=t.length}_buffer;_length;_index=0;alloc(t){const e=this._index;return this._index+=t,this._length<this._index&&this.resize(this._index),e}resize(t){const e=Math.ceil(t/h)*h,r=a.allocUnsafe(e);this._buffer.copy(r,0,0,this._length),this._buffer=r,this._length=e}finalize(){return this._buffer.subarray(0,this._index)}toArray(){return[...this.finalize()]}write(t,e){if("string"==typeof t){const r=this.alloc(e);this._buffer.write(t,r,"utf8")}else{t instanceof a||(t=a.from(t));const r=this.alloc(e);t.copy(this._buffer,r,0,e)}const r=4-(e%4||4);if(r>0){const t=this.alloc(r);this._buffer.fill(0,t,this._index)}}writeInt32BE(t){const e=this.alloc(4);this._buffer.writeInt32BE(t,e)}writeUInt32BE(t){const e=this.alloc(4);this._buffer.writeUInt32BE(t,e)}writeBigInt64BE(t){const e=this.alloc(8);this._buffer.writeBigInt64BE(t,e)}writeBigUInt64BE(t){const e=this.alloc(8);this._buffer.writeBigUInt64BE(t,e)}writeFloatBE(t){const e=this.alloc(4);this._buffer.writeFloatBE(t,e)}writeDoubleBE(t){const e=this.alloc(8);this._buffer.writeDoubleBE(t,e)}static bufferChunkSize=h}var l=r(616).A;class p{toXDR(t="raw"){if(!this.write)return this.constructor.toXDR(this,t);const e=new c;return this.write(this,e),w(e.finalize(),t)}fromXDR(t,e="raw"){if(!this.read)return this.constructor.fromXDR(t,e);const r=new f(m(t,e)),n=this.read(r);return r.ensureInputConsumed(),n}validateXDR(t,e="raw"){try{return this.fromXDR(t,e),!0}catch(t){return!1}}static toXDR(t,e="raw"){const r=new c;return this.write(t,r),w(r.finalize(),e)}static fromXDR(t,e="raw"){const r=new f(m(t,e)),n=this.read(r);return r.ensureInputConsumed(),n}static validateXDR(t,e="raw"){try{return this.fromXDR(t,e),!0}catch(t){return!1}}}class d extends p{static read(t){throw new s}static write(t,e){throw new s}static isValid(t){return!1}}class g extends p{isValid(t){return!1}}class y extends TypeError{constructor(t){super(`Invalid format ${t}, must be one of "raw", "hex", "base64"`)}}function w(t,e){switch(e){case"raw":return t;case"hex":return t.toString("hex");case"base64":return t.toString("base64");default:throw new y(e)}}function m(t,e){switch(e){case"raw":return t;case"hex":return l.from(t,"hex");case"base64":return l.from(t,"base64");default:throw new y(e)}}function b(t,e){return null!=t&&(t instanceof e||_(t,e)&&"function"==typeof t.constructor.read&&"function"==typeof t.constructor.write&&_(t,"XdrType"))}function _(t,e){do{if(t.constructor.name===e)return!0}while(t=Object.getPrototypeOf(t));return!1}const B=2147483647,E=-2147483648;class v extends d{static read(t){return t.readInt32BE()}static write(t,e){if("number"!=typeof t)throw new n("not a number");if((0|t)!==t)throw new n("invalid i32 value");e.writeInt32BE(t)}static isValid(t){return"number"==typeof t&&(0|t)===t&&(t>=E&&t<=B)}}function A(t,e,r){if("bigint"!=typeof t)throw new TypeError("Expected bigint 'value', got "+typeof t);const n=e/r;if(1===n)return[t];if(r<32||r>128||2!==n&&4!==n&&8!==n)throw new TypeError(`invalid bigint (${t}) and slice size (${e} -> ${r}) combination`);const i=BigInt(r),o=new Array(n);for(let e=0;e<n;e++)o[e]=BigInt.asIntN(r,t),t>>=i;return o}function I(t,e){if(e)return[0n,(1n<<BigInt(t))-1n];const r=1n<<BigInt(t-1);return[0n-r,r-1n]}v.MAX_VALUE=B,v.MIN_VALUE=2147483648;class x extends d{constructor(t){super(),this._value=function(t,e,r){t instanceof Array?t.length&&t[0]instanceof Array&&(t=t[0]):t=[t];const n=e/t.length;switch(n){case 32:case 64:case 128:case 256:break;default:throw new RangeError(`expected slices to fit in 32/64/128/256 bits, got ${t}`)}try{for(let e=0;e<t.length;e++)"bigint"!=typeof t[e]&&(t[e]=BigInt(t[e].valueOf()))}catch(e){throw new TypeError(`expected bigint-like values, got: ${t} (${e})`)}if(r&&1===t.length&&t[0]<0n)throw new RangeError(`expected a positive value, got: ${t}`);let i=BigInt.asUintN(n,t[0]);for(let e=1;e<t.length;e++)i|=BigInt.asUintN(n,t[e])<<BigInt(e*n);r||(i=BigInt.asIntN(e,i));const[o,s]=I(e,r);if(i>=o&&i<=s)return i;throw new TypeError(`bigint values [${t}] for ${function(t,e){return`${e?"u":"i"}${t}`}(e,r)} out of range [${o}, ${s}]: ${i}`)}(t,this.size,this.unsigned)}get unsigned(){throw new s}get size(){throw new s}slice(t){return A(this._value,this.size,t)}toString(){return this._value.toString()}toJSON(){return{_value:this._value.toString()}}toBigInt(){return BigInt(this._value)}static read(t){const{size:e}=this.prototype;return 64===e?new this(t.readBigUInt64BE()):new this(...Array.from({length:e/64},(()=>t.readBigUInt64BE())).reverse())}static write(t,e){if(t instanceof this)t=t._value;else if("bigint"!=typeof t||t>this.MAX_VALUE||t<this.MIN_VALUE)throw new n(`${t} is not a ${this.name}`);const{unsigned:r,size:i}=this.prototype;if(64===i)r?e.writeBigUInt64BE(t):e.writeBigInt64BE(t);else for(const n of A(t,i,64).reverse())r?e.writeBigUInt64BE(n):e.writeBigInt64BE(n)}static isValid(t){return"bigint"==typeof t||t instanceof this}static fromString(t){return new this(t)}static MAX_VALUE=0n;static MIN_VALUE=0n;static defineIntBoundaries(){const[t,e]=I(this.prototype.size,this.prototype.unsigned);this.MIN_VALUE=t,this.MAX_VALUE=e}}class U extends x{constructor(...t){super(t)}get low(){return Number(0xffffffffn&this._value)|0}get high(){return Number(this._value>>32n)|0}get size(){return 64}get unsigned(){return!1}static fromBits(t,e){return new this(t,e)}}U.defineIntBoundaries();const $=4294967295;class R extends d{static read(t){return t.readUInt32BE()}static write(t,e){if("number"!=typeof t||!(t>=0&&t<=$)||t%1!=0)throw new n("invalid u32 value");e.writeUInt32BE(t)}static isValid(t){return"number"==typeof t&&t%1==0&&(t>=0&&t<=$)}}R.MAX_VALUE=$,R.MIN_VALUE=0;class T extends x{constructor(...t){super(t)}get low(){return Number(0xffffffffn&this._value)|0}get high(){return Number(this._value>>32n)|0}get size(){return 64}get unsigned(){return!0}static fromBits(t,e){return new this(t,e)}}T.defineIntBoundaries();class O extends d{static read(t){return t.readFloatBE()}static write(t,e){if("number"!=typeof t)throw new n("not a number");e.writeFloatBE(t)}static isValid(t){return"number"==typeof t}}class L extends d{static read(t){return t.readDoubleBE()}static write(t,e){if("number"!=typeof t)throw new n("not a number");e.writeDoubleBE(t)}static isValid(t){return"number"==typeof t}}class N extends d{static read(){throw new o("quadruple not supported")}static write(){throw new o("quadruple not supported")}static isValid(){return!1}}class S extends d{static read(t){const e=v.read(t);switch(e){case 0:return!1;case 1:return!0;default:throw new i(`got ${e} when trying to read a bool`)}}static write(t,e){const r=t?1:0;v.write(r,e)}static isValid(t){return"boolean"==typeof t}}var V=r(616).A;class M extends g{constructor(t=R.MAX_VALUE){super(),this._maxLength=t}read(t){const e=R.read(t);if(e>this._maxLength)throw new i(`saw ${e} length String, max allowed is ${this._maxLength}`);return t.read(e)}readString(t){return this.read(t).toString("utf8")}write(t,e){const r="string"==typeof t?V.byteLength(t,"utf8"):t.length;if(r>this._maxLength)throw new n(`got ${t.length} bytes, max allowed is ${this._maxLength}`);R.write(r,e),e.write(t,r)}isValid(t){return"string"==typeof t?V.byteLength(t,"utf8")<=this._maxLength:!!(t instanceof Array||V.isBuffer(t))&&t.length<=this._maxLength}}var C=r(616).A;class D extends g{constructor(t){super(),this._length=t}read(t){return t.read(this._length)}write(t,e){const{length:r}=t;if(r!==this._length)throw new n(`got ${t.length} bytes, expected ${this._length}`);e.write(t,r)}isValid(t){return C.isBuffer(t)&&t.length===this._length}}var j=r(616).A;class z extends g{constructor(t=R.MAX_VALUE){super(),this._maxLength=t}read(t){const e=R.read(t);if(e>this._maxLength)throw new i(`saw ${e} length VarOpaque, max allowed is ${this._maxLength}`);return t.read(e)}write(t,e){const{length:r}=t;if(t.length>this._maxLength)throw new n(`got ${t.length} bytes, max allowed is ${this._maxLength}`);R.write(r,e),e.write(t,r)}isValid(t){return j.isBuffer(t)&&t.length<=this._maxLength}}class F extends g{constructor(t,e){super(),this._childType=t,this._length=e}read(t){const e=new r.g.Array(this._length);for(let r=0;r<this._length;r++)e[r]=this._childType.read(t);return e}write(t,e){if(!r.g.Array.isArray(t))throw new n("value is not array");if(t.length!==this._length)throw new n(`got array of size ${t.length}, expected ${this._length}`);for(const r of t)this._childType.write(r,e)}isValid(t){if(!(t instanceof r.g.Array)||t.length!==this._length)return!1;for(const e of t)if(!this._childType.isValid(e))return!1;return!0}}class P extends g{constructor(t,e=R.MAX_VALUE){super(),this._childType=t,this._maxLength=e}read(t){const e=R.read(t);if(e>this._maxLength)throw new i(`saw ${e} length VarArray, max allowed is ${this._maxLength}`);const r=new Array(e);for(let n=0;n<e;n++)r[n]=this._childType.read(t);return r}write(t,e){if(!(t instanceof Array))throw new n("value is not array");if(t.length>this._maxLength)throw new n(`got array of size ${t.length}, max allowed is ${this._maxLength}`);R.write(t.length,e);for(const r of t)this._childType.write(r,e)}isValid(t){if(!(t instanceof Array)||t.length>this._maxLength)return!1;for(const e of t)if(!this._childType.isValid(e))return!1;return!0}}class X extends d{constructor(t){super(),this._childType=t}read(t){if(S.read(t))return this._childType.read(t)}write(t,e){const r=null!=t;S.write(r,e),r&&this._childType.write(t,e)}isValid(t){return null==t||this._childType.isValid(t)}}class k extends d{static read(){}static write(t){if(void 0!==t)throw new n("trying to write value to a void slot")}static isValid(t){return void 0===t}}class q extends d{constructor(t,e){super(),this.name=t,this.value=e}static read(t){const e=v.read(t),r=this._byValue[e];if(void 0===r)throw new i(`unknown ${this.enumName} member for value ${e}`);return r}static write(t,e){if(!this.isValid(t))throw new n(`${t} has enum name ${t?.enumName}, not ${this.enumName}: ${JSON.stringify(t)}`);v.write(t.value,e)}static isValid(t){return t?.constructor?.enumName===this.enumName||b(t,this)}static members(){return this._members}static values(){return Object.values(this._members)}static fromName(t){const e=this._members[t];if(!e)throw new TypeError(`${t} is not a member of ${this.enumName}`);return e}static fromValue(t){const e=this._byValue[t];if(void 0===e)throw new TypeError(`${t} is not a value of any member of ${this.enumName}`);return e}static create(t,e,r){const n=class extends q{};n.enumName=e,t.results[e]=n,n._members={},n._byValue={};for(const[t,e]of Object.entries(r)){const r=new n(t,e);n._members[t]=r,n._byValue[e]=r,n[t]=()=>r}return n}}class G extends d{resolve(){throw new o('"resolve" method should be implemented in the descendant class')}}class Y extends g{constructor(t){super(),this._attributes=t||{}}static read(t){const e={};for(const[r,n]of this._fields)e[r]=n.read(t);return new this(e)}static write(t,e){if(!this.isValid(t))throw new n(`${t} has struct name ${t?.constructor?.structName}, not ${this.structName}: ${JSON.stringify(t)}`);for(const[r,n]of this._fields){const i=t._attributes[r];n.write(i,e)}}static isValid(t){return t?.constructor?.structName===this.structName||b(t,this)}static create(t,e,r){const n=class extends Y{};n.structName=e,t.results[e]=n;const i=new Array(r.length);for(let e=0;e<r.length;e++){const o=r[e],s=o[0];let u=o[1];u instanceof G&&(u=u.resolve(t)),i[e]=[s,u],n.prototype[s]=J(s)}return n._fields=i,n}}function J(t){return function(e){return void 0!==e&&(this._attributes[t]=e),this._attributes[t]}}class W extends g{constructor(t,e){super(),this.set(t,e)}set(t,e){"string"==typeof t&&(t=this.constructor._switchOn.fromName(t)),this._switch=t;const r=this.constructor.armForSwitch(this._switch);this._arm=r,this._armType=r===k?k:this.constructor._arms[r],this._value=e}get(t=this._arm){if(this._arm!==k&&this._arm!==t)throw new TypeError(`${t} not set`);return this._value}switch(){return this._switch}arm(){return this._arm}armType(){return this._armType}value(){return this._value}static armForSwitch(t){const e=this._switches.get(t);if(void 0!==e)return e;if(this._defaultArm)return this._defaultArm;throw new TypeError(`Bad union switch: ${t}`)}static armTypeForArm(t){return t===k?k:this._arms[t]}static read(t){const e=this._switchOn.read(t),r=this.armForSwitch(e),n=r===k?k:this._arms[r];let i;return i=void 0!==n?n.read(t):r.read(t),new this(e,i)}static write(t,e){if(!this.isValid(t))throw new n(`${t} has union name ${t?.unionName}, not ${this.unionName}: ${JSON.stringify(t)}`);this._switchOn.write(t.switch(),e),t.armType().write(t.value(),e)}static isValid(t){return t?.constructor?.unionName===this.unionName||b(t,this)}static create(t,e,r){const n=class extends W{};n.unionName=e,t.results[e]=n,r.switchOn instanceof G?n._switchOn=r.switchOn.resolve(t):n._switchOn=r.switchOn,n._switches=new Map,n._arms={};let i=r.defaultArm;i instanceof G&&(i=i.resolve(t)),n._defaultArm=i;for(const[t,e]of r.switches){const r="string"==typeof t?n._switchOn.fromName(t):t;n._switches.set(r,e)}if(void 0!==n._switchOn.values)for(const t of n._switchOn.values())n[t.name]=function(e){return new n(t,e)},n.prototype[t.name]=function(e){return this.set(t,e)};if(r.arms)for(const[e,i]of Object.entries(r.arms))n._arms[e]=i instanceof G?i.resolve(t):i,i!==k&&(n.prototype[e]=function(){return this.get(e)});return n}}class H extends G{constructor(t){super(),this.name=t}resolve(t){return t.definitions[this.name].resolve(t)}}class Q extends G{constructor(t,e,r=!1){super(),this.childReference=t,this.length=e,this.variable=r}resolve(t){let e=this.childReference,r=this.length;return e instanceof G&&(e=e.resolve(t)),r instanceof G&&(r=r.resolve(t)),this.variable?new P(e,r):new F(e,r)}}class Z extends G{constructor(t){super(),this.childReference=t,this.name=t.name}resolve(t){let e=this.childReference;return e instanceof G&&(e=e.resolve(t)),new X(e)}}class K extends G{constructor(t,e){super(),this.sizedType=t,this.length=e}resolve(t){let e=this.length;return e instanceof G&&(e=e.resolve(t)),new this.sizedType(e)}}class tt{constructor(t,e,r){this.constructor=t,this.name=e,this.config=r}resolve(t){return this.name in t.results?t.results[this.name]:this.constructor(t,this.name,this.config)}}function et(t,e,r){return r instanceof G&&(r=r.resolve(t)),t.results[e]=r,r}function rt(t,e,r){return t.results[e]=r,r}class nt{constructor(t){this._destination=t,this._definitions={}}enum(t,e){const r=new tt(q.create,t,e);this.define(t,r)}struct(t,e){const r=new tt(Y.create,t,e);this.define(t,r)}union(t,e){const r=new tt(W.create,t,e);this.define(t,r)}typedef(t,e){const r=new tt(et,t,e);this.define(t,r)}const(t,e){const r=new tt(rt,t,e);this.define(t,r)}void(){return k}bool(){return S}int(){return v}hyper(){return U}uint(){return R}uhyper(){return T}float(){return O}double(){return L}quadruple(){return N}string(t){return new K(M,t)}opaque(t){return new K(D,t)}varOpaque(t){return new K(z,t)}array(t,e){return new Q(t,e)}varArray(t,e){return new Q(t,e,!0)}option(t){return new Z(t)}define(t,e){if(void 0!==this._destination[t])throw new o(`${t} is already defined`);this._definitions[t]=e}lookup(t){return new H(t)}resolve(){for(const t of Object.values(this._definitions))t.resolve({definitions:this._definitions,results:this._destination})}}function it(t,e={}){if(t){const r=new nt(e);t(r),r.resolve()}return e}},526:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,o=u(t),s=o[0],f=o[1],a=new i(function(t,e,r){return 3*(e+r)/4-r}(0,s,f)),h=0,c=f>0?s-4:s;for(r=0;r<c;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],a[h++]=e>>16&255,a[h++]=e>>8&255,a[h++]=255&e;2===f&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,a[h++]=255&e);1===f&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,a[h++]=e>>8&255,a[h++]=255&e);return a},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=16383,u=0,a=n-i;u<a;u+=s)o.push(f(t,u,u+s>a?a:u+s));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,n){for(var i,o,s=[],u=e;u<n;u+=3)i=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},287:(t,e,r)=>{"use strict";const n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=f,e.IS=50;const s=2147483647;function u(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,f.prototype),e}function f(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return a(t,e,r)}function a(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=u(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(W(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return l(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return f.from(n,e,r);const i=function(t){if(f.isBuffer(t)){const e=0|d(t.length),r=u(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||H(t.length)?u(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return f.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function c(t){return h(t),u(t<0?0:0|d(t))}function l(t){const e=t.length<0?0:0|d(t.length),r=u(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,f.prototype),n}function d(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function g(t,e){if(f.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(i)return n?-1:G(t).length;e=(""+e).toLowerCase(),i=!0}}function y(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return $(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),H(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=f.from(e,n)),f.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){let o,s=1,u=t.length,f=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,f/=2,r/=2}function a(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let n=-1;for(o=r;o<u;o++)if(a(t,o)===a(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===f)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+f>u&&(r=u-f),o=r;o>=0;o--){let r=!0;for(let n=0;n<f;n++)if(a(t,o+n)!==a(e,n)){r=!1;break}if(r)return o}return-1}function _(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(H(n))return s;t[r+s]=n}return s}function B(t,e,r,n){return J(G(e,t.length-r),t,r,n)}function E(t,e,r,n){return J(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function v(t,e,r,n){return J(Y(e),t,r,n)}function A(t,e,r,n){return J(function(t,e){let r,n,i;const o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function I(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,s=e>239?4:e>223?3:e>191?2:1;if(i+s<=r){let r,n,u,f;switch(s){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(f=(31&e)<<6|63&r,f>127&&(o=f));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(f=(15&e)<<12|(63&r)<<6|63&n,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:r=t[i+1],n=t[i+2],u=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&u)&&(f=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&u,f>65535&&f<1114112&&(o=f))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){const e=t.length;if(e<=U)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=U));return r}(n)}f.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),f.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}}),f.poolSize=8192,f.from=function(t,e,r){return a(t,e,r)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array),f.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?u(t):void 0!==e?"string"==typeof r?u(t).fill(e,r):u(t).fill(e):u(t)}(t,e,r)},f.allocUnsafe=function(t){return c(t)},f.allocUnsafeSlow=function(t){return c(t)},f.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==f.prototype},f.compare=function(t,e){if(W(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),W(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=f.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(W(e,Uint8Array))i+e.length>n.length?(f.isBuffer(e)||(e=f.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!f.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},f.byteLength=g,f.prototype._isBuffer=!0,f.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)w(this,e,e+1);return this},f.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},f.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},f.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?x(this,0,t):y.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},o&&(f.prototype[o]=f.prototype.inspect),f.prototype.compare=function(t,e,r,n,i){if(W(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const u=Math.min(o,s),a=this.slice(n,i),h=t.slice(e,r);for(let t=0;t<u;++t)if(a[t]!==h[t]){o=a[t],s=h[t];break}return o<s?-1:s<o?1:0},f.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},f.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},f.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},f.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return B(this,t,e,r);case"ascii":case"latin1":case"binary":return E(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const U=4096;function $(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function R(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function T(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=Q[t[n]];return i}function O(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function L(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function S(t,e,r,n,i){P(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function V(t,e,r,n,i){P(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function M(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,o){return e=+e,r>>>=0,o||M(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return e=+e,r>>>=0,o||M(t,0,r,8),i.write(t,e,r,n,52,8),r+8}f.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,f.prototype),n},f.prototype.readUintLE=f.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},f.prototype.readUintBE=f.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},f.prototype.readUint8=f.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readBigUInt64LE=Z((function(t){X(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||k(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),f.prototype.readBigUInt64BE=Z((function(t){X(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||k(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),f.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},f.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},f.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},f.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readBigInt64LE=Z((function(t){X(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||k(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),f.prototype.readBigInt64BE=Z((function(t){X(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||k(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),f.prototype.readFloatLE=function(t,e){return t>>>=0,e||L(t,4,this.length),i.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),i.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!1,52,8)},f.prototype.writeUintLE=f.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},f.prototype.writeUintBE=f.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},f.prototype.writeUint8=f.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},f.prototype.writeBigUInt64LE=Z((function(t,e=0){return S(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeBigUInt64BE=Z((function(t,e=0){return V(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let i=0,o=1,s=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+r},f.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o|0)-s&255;return e+r},f.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},f.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},f.prototype.writeBigInt64LE=Z((function(t,e=0){return S(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeBigInt64BE=Z((function(t,e=0){return V(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},f.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},f.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},f.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},f.prototype.copy=function(t,e,r,n){if(!f.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},f.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=f.isBuffer(t)?t:f.from(t,n),s=o.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%s]}return this};const j={};function z(t,e,r){j[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function F(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function P(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){X(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||k(e,t.length-(r+1))}(n,i,o)}function X(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function k(t,e,r){if(Math.floor(t)!==t)throw X(t,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}z("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),z("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),z("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function G(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function H(t){return t!=t}const Q=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?K:t}function K(){throw new Error("BigInt not supported")}},251:(t,e)=>{e.read=function(t,e,r,n,i){var o,s,u=8*i-n-1,f=(1<<u)-1,a=f>>1,h=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=u;h>0;o=256*o+t[e+c],c+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+c],c+=l,h-=8);if(0===o)o=1-a;else{if(o===f)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=a}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,u,f,a=8*o-i-1,h=(1<<a)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),(e+=s+c>=1?l/f:l*Math.pow(2,1-c))*f>=2&&(s++,f/=2),s+c>=h?(u=0,s=h):s+c>=1?(u=(e*f-1)*Math.pow(2,i),s+=c):(u=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&u,p+=d,u/=256,i-=8);for(s=s<<i|u,a+=i;a>0;t[r+p]=255&s,p+=d,s/=256,a-=8);t[r+p-d]|=128*g}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}return r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(281)})()));
19
19
  //# sourceMappingURL=xdr.js.map
20
20
 
21
21
  /***/ }),
@@ -148,7 +148,7 @@ var Address = exports.Address = /*#__PURE__*/function () {
148
148
  this._type = 'contract';
149
149
  this._key = _strkey.StrKey.decodeContract(address);
150
150
  } else {
151
- throw new Error('Unsupported address type');
151
+ throw new Error("Unsupported address type: ".concat(address));
152
152
  }
153
153
  }
154
154
 
@@ -464,12 +464,12 @@ var Asset = exports.Asset = /*#__PURE__*/function () {
464
464
  }, {
465
465
  key: "getAssetType",
466
466
  value: function getAssetType() {
467
- switch (this.getRawAssetType()) {
468
- case _xdr["default"].AssetType.assetTypeNative():
467
+ switch (this.getRawAssetType().value) {
468
+ case _xdr["default"].AssetType.assetTypeNative().value:
469
469
  return 'native';
470
- case _xdr["default"].AssetType.assetTypeCreditAlphanum4():
470
+ case _xdr["default"].AssetType.assetTypeCreditAlphanum4().value:
471
471
  return 'credit_alphanum4';
472
- case _xdr["default"].AssetType.assetTypeCreditAlphanum12():
472
+ case _xdr["default"].AssetType.assetTypeCreditAlphanum12().value:
473
473
  return 'credit_alphanum12';
474
474
  default:
475
475
  return 'unknown';
@@ -534,7 +534,7 @@ var Asset = exports.Asset = /*#__PURE__*/function () {
534
534
  */
535
535
  }], [{
536
536
  key: "native",
537
- value: function native() {
537
+ value: function _native() {
538
538
  return new Asset('XLM');
539
539
  }
540
540
 
@@ -683,6 +683,10 @@ function _asyncToGenerator(n) { return function () { var t = this, e = arguments
683
683
  * authorization entry that you can pass along to
684
684
  * {@link Operation.invokeHostFunction}
685
685
  *
686
+ * @note If using the `SigningCallback` variation, the signer is assumed to be
687
+ * the entry's credential address. If you need a different key to sign the
688
+ * entry, you will need to use different method (e.g., fork this code).
689
+ *
686
690
  * @see authorizeInvocation
687
691
  * @example
688
692
  * import {
@@ -765,7 +769,7 @@ function authorizeEntry(_x, _x2, _x3) {
765
769
  * @see authorizeEntry
766
770
  */
767
771
  function _authorizeEntry() {
768
- _authorizeEntry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(entry, signer, validUntilLedgerSeq) {
772
+ _authorizeEntry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(entry, signer, validUntilLedgerSeq) {
769
773
  var networkPassphrase,
770
774
  clone,
771
775
  addrAuth,
@@ -799,7 +803,7 @@ function _authorizeEntry() {
799
803
  }));
800
804
  payload = (0, _hashing.hash)(preimage.toXDR());
801
805
  if (!(typeof signer === 'function')) {
802
- _context.next = 17;
806
+ _context.next = 18;
803
807
  break;
804
808
  }
805
809
  _context.t0 = Buffer;
@@ -808,18 +812,19 @@ function _authorizeEntry() {
808
812
  case 13:
809
813
  _context.t1 = _context.sent;
810
814
  signature = _context.t0.from.call(_context.t0, _context.t1);
811
- _context.next = 18;
815
+ publicKey = _address.Address.fromScAddress(addrAuth.address()).toString();
816
+ _context.next = 20;
812
817
  break;
813
- case 17:
814
- signature = Buffer.from(signer.sign(payload));
815
818
  case 18:
816
- publicKey = _address.Address.fromScAddress(addrAuth.address()).toString();
819
+ signature = Buffer.from(signer.sign(payload));
820
+ publicKey = signer.publicKey();
821
+ case 20:
817
822
  if (_keypair.Keypair.fromPublicKey(publicKey).verify(payload, signature)) {
818
- _context.next = 21;
823
+ _context.next = 22;
819
824
  break;
820
825
  }
821
826
  throw new Error("signature doesn't match payload");
822
- case 21:
827
+ case 22:
823
828
  // This structure is defined here:
824
829
  // https://soroban.stellar.org/docs/fundamentals-and-concepts/invoking-contracts-with-transactions#stellar-account-signatures
825
830
  //
@@ -836,7 +841,7 @@ function _authorizeEntry() {
836
841
  });
837
842
  addrAuth.signature(_xdr["default"].ScVal.scvVec([sigScVal]));
838
843
  return _context.abrupt("return", clone);
839
- case 24:
844
+ case 25:
840
845
  case "end":
841
846
  return _context.stop();
842
847
  }
@@ -1205,10 +1210,8 @@ Object.defineProperty(exports, "__esModule", ({
1205
1210
  value: true
1206
1211
  }));
1207
1212
  exports.humanizeEvents = humanizeEvents;
1208
- var _xdr = _interopRequireDefault(__webpack_require__(1918));
1209
1213
  var _strkey = __webpack_require__(7120);
1210
1214
  var _scval = __webpack_require__(7177);
1211
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
1212
1215
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1213
1216
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1214
1217
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -1231,14 +1234,16 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
1231
1234
  */
1232
1235
  function humanizeEvents(events) {
1233
1236
  return events.map(function (e) {
1234
- if (e instanceof _xdr["default"].DiagnosticEvent) {
1237
+ // A pseudo-instanceof check for xdr.DiagnosticEvent more reliable
1238
+ // in mixed SDK environments:
1239
+ if (e.inSuccessfulContractCall) {
1235
1240
  return extractEvent(e.event());
1236
1241
  }
1237
1242
  return extractEvent(e);
1238
1243
  });
1239
1244
  }
1240
1245
  function extractEvent(event) {
1241
- return _objectSpread(_objectSpread({}, event.contractId() != null && {
1246
+ return _objectSpread(_objectSpread({}, typeof event.contractId === 'function' && event.contractId() != null && {
1242
1247
  contractId: _strkey.StrKey.encodeContract(event.contractId())
1243
1248
  }), {}, {
1244
1249
  type: event.type().name,
@@ -10593,7 +10598,8 @@ function buildInvocationTree(root) {
10593
10598
  * @param {xdr.SorobanAuthorizedInvocation} [parent] this `node`s parent node,
10594
10599
  * if any (i.e. this doesn't exist at the root)
10595
10600
  *
10596
- * @returns {boolean?} returning `false` is a hint to stop exploring
10601
+ * @returns {boolean|null|void} returning exactly `false` is a hint to stop
10602
+ * exploring, other values are ignored
10597
10603
  */
10598
10604
 
10599
10605
  /**
@@ -15529,75 +15535,87 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
15529
15535
  * scValToNative(scv) == gigaMap; // true
15530
15536
  */
15531
15537
  function nativeToScVal(val) {
15532
- var _val$constructor$name, _val$constructor;
15533
15538
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15534
15539
  switch (_typeof(val)) {
15535
15540
  case 'object':
15536
- if (val === null) {
15537
- return _xdr["default"].ScVal.scvVoid();
15538
- }
15539
- if (val instanceof _xdr["default"].ScVal) {
15540
- return val; // should we copy?
15541
- }
15542
- if (val instanceof _address.Address) {
15543
- return val.toScVal();
15544
- }
15545
- if (val instanceof _contract.Contract) {
15546
- return val.address().toScVal();
15547
- }
15548
- if (val instanceof Uint8Array || Buffer.isBuffer(val)) {
15549
- var _opts$type;
15550
- var copy = Uint8Array.from(val);
15551
- switch ((_opts$type = opts === null || opts === void 0 ? void 0 : opts.type) !== null && _opts$type !== void 0 ? _opts$type : 'bytes') {
15552
- case 'bytes':
15553
- return _xdr["default"].ScVal.scvBytes(copy);
15554
- case 'symbol':
15555
- return _xdr["default"].ScVal.scvSymbol(copy);
15556
- case 'string':
15557
- return _xdr["default"].ScVal.scvString(copy);
15558
- default:
15559
- throw new TypeError("invalid type (".concat(opts.type, ") specified for bytes-like value"));
15541
+ {
15542
+ var _val$constructor$name, _val$constructor;
15543
+ if (val === null) {
15544
+ return _xdr["default"].ScVal.scvVoid();
15545
+ }
15546
+ if (val instanceof _xdr["default"].ScVal) {
15547
+ return val; // should we copy?
15548
+ }
15549
+ if (val instanceof _address.Address) {
15550
+ return val.toScVal();
15551
+ }
15552
+ if (val instanceof _contract.Contract) {
15553
+ return val.address().toScVal();
15554
+ }
15555
+ if (val instanceof Uint8Array || Buffer.isBuffer(val)) {
15556
+ var _opts$type;
15557
+ var copy = Uint8Array.from(val);
15558
+ switch ((_opts$type = opts === null || opts === void 0 ? void 0 : opts.type) !== null && _opts$type !== void 0 ? _opts$type : 'bytes') {
15559
+ case 'bytes':
15560
+ return _xdr["default"].ScVal.scvBytes(copy);
15561
+ case 'symbol':
15562
+ return _xdr["default"].ScVal.scvSymbol(copy);
15563
+ case 'string':
15564
+ return _xdr["default"].ScVal.scvString(copy);
15565
+ default:
15566
+ throw new TypeError("invalid type (".concat(opts.type, ") specified for bytes-like value"));
15567
+ }
15560
15568
  }
15561
- }
15562
- if (Array.isArray(val)) {
15563
- if (val.length > 0 && val.some(function (v) {
15564
- return _typeof(v) !== _typeof(val[0]);
15565
- })) {
15566
- throw new TypeError("array values (".concat(val, ") must have the same type (types: ").concat(val.map(function (v) {
15567
- return _typeof(v);
15568
- }).join(','), ")"));
15569
+ if (Array.isArray(val)) {
15570
+ if (val.length > 0 && val.some(function (v) {
15571
+ return _typeof(v) !== _typeof(val[0]);
15572
+ })) {
15573
+ throw new TypeError("array values (".concat(val, ") must have the same type (types: ").concat(val.map(function (v) {
15574
+ return _typeof(v);
15575
+ }).join(','), ")"));
15576
+ }
15577
+ return _xdr["default"].ScVal.scvVec(val.map(function (v) {
15578
+ return nativeToScVal(v, opts);
15579
+ }));
15569
15580
  }
15570
- return _xdr["default"].ScVal.scvVec(val.map(function (v) {
15571
- return nativeToScVal(v, opts);
15581
+ if (((_val$constructor$name = (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) !== null && _val$constructor$name !== void 0 ? _val$constructor$name : '') !== 'Object') {
15582
+ var _val$constructor2;
15583
+ throw new TypeError("cannot interpret ".concat((_val$constructor2 = val.constructor) === null || _val$constructor2 === void 0 ? void 0 : _val$constructor2.name, " value as ScVal (").concat(JSON.stringify(val), ")"));
15584
+ }
15585
+ return _xdr["default"].ScVal.scvMap(Object.entries(val)
15586
+ // The Soroban runtime expects maps to have their keys in sorted
15587
+ // order, so let's do that here as part of the conversion to prevent
15588
+ // confusing error messages on execution.
15589
+ .sort(function (_ref, _ref2) {
15590
+ var _ref3 = _slicedToArray(_ref, 1),
15591
+ key1 = _ref3[0];
15592
+ var _ref4 = _slicedToArray(_ref2, 1),
15593
+ key2 = _ref4[0];
15594
+ return key1.localeCompare(key2);
15595
+ }).map(function (_ref5) {
15596
+ var _k, _opts$type2;
15597
+ var _ref6 = _slicedToArray(_ref5, 2),
15598
+ k = _ref6[0],
15599
+ v = _ref6[1];
15600
+ // the type can be specified with an entry for the key and the value,
15601
+ // e.g. val = { 'hello': 1 } and opts.type = { hello: [ 'symbol',
15602
+ // 'u128' ]} or you can use `null` for the default interpretation
15603
+ var _ref7 = (_k = ((_opts$type2 = opts === null || opts === void 0 ? void 0 : opts.type) !== null && _opts$type2 !== void 0 ? _opts$type2 : {})[k]) !== null && _k !== void 0 ? _k : [null, null],
15604
+ _ref8 = _slicedToArray(_ref7, 2),
15605
+ keyType = _ref8[0],
15606
+ valType = _ref8[1];
15607
+ var keyOpts = keyType ? {
15608
+ type: keyType
15609
+ } : {};
15610
+ var valOpts = valType ? {
15611
+ type: valType
15612
+ } : {};
15613
+ return new _xdr["default"].ScMapEntry({
15614
+ key: nativeToScVal(k, keyOpts),
15615
+ val: nativeToScVal(v, valOpts)
15616
+ });
15572
15617
  }));
15573
15618
  }
15574
- if (((_val$constructor$name = (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) !== null && _val$constructor$name !== void 0 ? _val$constructor$name : '') !== 'Object') {
15575
- var _val$constructor2;
15576
- throw new TypeError("cannot interpret ".concat((_val$constructor2 = val.constructor) === null || _val$constructor2 === void 0 ? void 0 : _val$constructor2.name, " value as ScVal (").concat(JSON.stringify(val), ")"));
15577
- }
15578
- return _xdr["default"].ScVal.scvMap(Object.entries(val).map(function (_ref) {
15579
- var _k, _opts$type2;
15580
- var _ref2 = _slicedToArray(_ref, 2),
15581
- k = _ref2[0],
15582
- v = _ref2[1];
15583
- // the type can be specified with an entry for the key and the value,
15584
- // e.g. val = { 'hello': 1 } and opts.type = { hello: [ 'symbol',
15585
- // 'u128' ]} or you can use `null` for the default interpretation
15586
- var _ref3 = (_k = ((_opts$type2 = opts === null || opts === void 0 ? void 0 : opts.type) !== null && _opts$type2 !== void 0 ? _opts$type2 : {})[k]) !== null && _k !== void 0 ? _k : [null, null],
15587
- _ref4 = _slicedToArray(_ref3, 2),
15588
- keyType = _ref4[0],
15589
- valType = _ref4[1];
15590
- var keyOpts = keyType ? {
15591
- type: keyType
15592
- } : {};
15593
- var valOpts = valType ? {
15594
- type: valType
15595
- } : {};
15596
- return new _xdr["default"].ScMapEntry({
15597
- key: nativeToScVal(k, keyOpts),
15598
- val: nativeToScVal(v, valOpts)
15599
- });
15600
- }));
15601
15619
  case 'number':
15602
15620
  case 'bigint':
15603
15621
  switch (opts === null || opts === void 0 ? void 0 : opts.type) {
@@ -15622,6 +15640,10 @@ function nativeToScVal(val) {
15622
15640
  return _xdr["default"].ScVal.scvSymbol(val);
15623
15641
  case 'address':
15624
15642
  return new _address.Address(val).toScVal();
15643
+ case 'u32':
15644
+ return _xdr["default"].ScVal.scvU32(parseInt(val, 10));
15645
+ case 'i32':
15646
+ return _xdr["default"].ScVal.scvI32(parseInt(val, 10));
15625
15647
  default:
15626
15648
  if (_index.XdrLargeInt.isType(optType)) {
15627
15649
  return new _index.XdrLargeInt(optType, val).toScVal();
@@ -17544,6 +17566,21 @@ var TransactionBuilder = exports.TransactionBuilder = /*#__PURE__*/function () {
17544
17566
  return this;
17545
17567
  }
17546
17568
 
17569
+ /**
17570
+ * Adds an operation to the transaction at a specific index.
17571
+ *
17572
+ * @param {xdr.Operation} operation - The xdr operation object to add, use {@link Operation} static methods.
17573
+ * @param {number} index - The index at which to insert the operation.
17574
+ *
17575
+ * @returns {TransactionBuilder} - The TransactionBuilder instance for method chaining.
17576
+ */
17577
+ }, {
17578
+ key: "addOperationAt",
17579
+ value: function addOperationAt(operation, index) {
17580
+ this.operations.splice(index, 0, operation);
17581
+ return this;
17582
+ }
17583
+
17547
17584
  /**
17548
17585
  * Removes the operations from the builder (useful when cloning).
17549
17586
  * @returns {TransactionBuilder} this builder instance
@@ -17555,6 +17592,20 @@ var TransactionBuilder = exports.TransactionBuilder = /*#__PURE__*/function () {
17555
17592
  return this;
17556
17593
  }
17557
17594
 
17595
+ /**
17596
+ * Removes the operation at the specified index from the transaction.
17597
+ *
17598
+ * @param {number} index - The index of the operation to remove.
17599
+ *
17600
+ * @returns {TransactionBuilder} The TransactionBuilder instance for method chaining.
17601
+ */
17602
+ }, {
17603
+ key: "clearOperationAt",
17604
+ value: function clearOperationAt(index) {
17605
+ this.operations.splice(index, 1);
17606
+ return this;
17607
+ }
17608
+
17558
17609
  /**
17559
17610
  * Adds a memo to the transaction.
17560
17611
  * @param {Memo} memo {@link Memo} object
@@ -20770,13 +20821,13 @@ __webpack_require__.r(__webpack_exports__);
20770
20821
  /* harmony export */ axios: () => (/* reexport safe */ axios__WEBPACK_IMPORTED_MODULE_2__.A),
20771
20822
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20772
20823
  /* harmony export */ });
20824
+ /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1083);
20773
20825
  /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4356);
20774
20826
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
20775
20827
  /* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _index__WEBPACK_IMPORTED_MODULE_0__) if(["default","StellarBase","axios"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _index__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__]
20776
20828
  /* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
20777
20829
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(356);
20778
20830
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_1__);
20779
- /* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1083);
20780
20831
  /* module decorator */ module = __webpack_require__.hmd(module);
20781
20832
 
20782
20833
 
@@ -20798,13 +20849,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
20798
20849
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
20799
20850
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
20800
20851
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
20852
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20853
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
20854
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
20801
20855
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20802
20856
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20803
20857
  var defaultConfig = {
20804
20858
  allowHttp: false,
20805
20859
  timeout: 0
20806
20860
  };
20807
- var config = Object.assign({}, defaultConfig);
20861
+ var config = _objectSpread({}, defaultConfig);
20808
20862
  var Config = function () {
20809
20863
  function Config() {
20810
20864
  _classCallCheck(this, Config);
@@ -20832,7 +20886,7 @@ var Config = function () {
20832
20886
  }, {
20833
20887
  key: "setDefault",
20834
20888
  value: function setDefault() {
20835
- config = Object.assign({}, defaultConfig);
20889
+ config = _objectSpread({}, defaultConfig);
20836
20890
  }
20837
20891
  }]);
20838
20892
  }();
@@ -20840,7 +20894,7 @@ var Config = function () {
20840
20894
 
20841
20895
  /***/ }),
20842
20896
 
20843
- /***/ 145:
20897
+ /***/ 6299:
20844
20898
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20845
20899
 
20846
20900
  "use strict";
@@ -20929,6 +20983,9 @@ var Err = function () {
20929
20983
  }
20930
20984
  }]);
20931
20985
  }();
20986
+ ;// CONCATENATED MODULE: ./src/contract/types.ts
20987
+ var DEFAULT_TIMEOUT = 5 * 60;
20988
+ var NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
20932
20989
  ;// CONCATENATED MODULE: ./src/contract/utils.ts
20933
20990
  function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == utils_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(utils_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
20934
20991
  function utils_typeof(o) { "@babel/helpers - typeof"; return utils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, utils_typeof(o); }
@@ -20936,7 +20993,6 @@ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.
20936
20993
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
20937
20994
 
20938
20995
 
20939
- var DEFAULT_TIMEOUT = 5 * 60;
20940
20996
  function withExponentialBackoff(_x, _x2, _x3) {
20941
20997
  return _withExponentialBackoff.apply(this, arguments);
20942
20998
  }
@@ -21035,21 +21091,8 @@ function _getAccount() {
21035
21091
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
21036
21092
  while (1) switch (_context2.prev = _context2.next) {
21037
21093
  case 0:
21038
- if (!options.publicKey) {
21039
- _context2.next = 6;
21040
- break;
21041
- }
21042
- _context2.next = 3;
21043
- return server.getAccount(options.publicKey);
21044
- case 3:
21045
- _context2.t0 = _context2.sent;
21046
- _context2.next = 7;
21047
- break;
21048
- case 6:
21049
- _context2.t0 = new lib.Account(NULL_ACCOUNT, "0");
21050
- case 7:
21051
- return _context2.abrupt("return", _context2.t0);
21052
- case 8:
21094
+ return _context2.abrupt("return", options.publicKey ? server.getAccount(options.publicKey) : new lib.Account(NULL_ACCOUNT, "0"));
21095
+ case 1:
21053
21096
  case "end":
21054
21097
  return _context2.stop();
21055
21098
  }
@@ -21082,6 +21125,7 @@ function sent_transaction_toPrimitive(t, r) { if ("object" != sent_transaction_t
21082
21125
 
21083
21126
 
21084
21127
 
21128
+
21085
21129
  var SentTransaction = function () {
21086
21130
  function SentTransaction(_, assembled) {
21087
21131
  var _this = this,
@@ -21244,7 +21288,7 @@ function assembled_transaction_toPrimitive(t, r) { if ("object" != assembled_tra
21244
21288
 
21245
21289
 
21246
21290
 
21247
- var NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
21291
+
21248
21292
  var AssembledTransaction = function () {
21249
21293
  function AssembledTransaction(options) {
21250
21294
  var _this = this,
@@ -21408,33 +21452,11 @@ var AssembledTransaction = function () {
21408
21452
  }
21409
21453
  }, _callee3);
21410
21454
  })));
21411
- assembled_transaction_defineProperty(this, "getStorageExpiration", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee4() {
21412
- var entryRes;
21413
- return assembled_transaction_regeneratorRuntime().wrap(function _callee4$(_context4) {
21414
- while (1) switch (_context4.prev = _context4.next) {
21415
- case 0:
21416
- _context4.next = 2;
21417
- return _this.server.getLedgerEntries(new lib.Contract(_this.options.contractId).getFootprint());
21418
- case 2:
21419
- entryRes = _context4.sent;
21420
- if (!(!entryRes.entries || !entryRes.entries.length || !entryRes.entries[0].liveUntilLedgerSeq)) {
21421
- _context4.next = 5;
21422
- break;
21423
- }
21424
- throw new Error("failed to get ledger entry");
21425
- case 5:
21426
- return _context4.abrupt("return", entryRes.entries[0].liveUntilLedgerSeq);
21427
- case 6:
21428
- case "end":
21429
- return _context4.stop();
21430
- }
21431
- }, _callee4);
21432
- })));
21433
21455
  assembled_transaction_defineProperty(this, "needsNonInvokerSigningBy", function () {
21434
21456
  var _rawInvokeHostFunctio;
21435
- var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21436
- _ref8$includeAlreadyS = _ref8.includeAlreadySigned,
21437
- includeAlreadySigned = _ref8$includeAlreadyS === void 0 ? false : _ref8$includeAlreadyS;
21457
+ var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21458
+ _ref7$includeAlreadyS = _ref7.includeAlreadySigned,
21459
+ includeAlreadySigned = _ref7$includeAlreadyS === void 0 ? false : _ref7$includeAlreadyS;
21438
21460
  if (!_this.built) {
21439
21461
  throw new Error("Transaction has not yet been simulated");
21440
21462
  }
@@ -21450,12 +21472,12 @@ var AssembledTransaction = function () {
21450
21472
  });
21451
21473
  assembled_transaction_defineProperty(this, "signAuthEntries", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee6() {
21452
21474
  var _rawInvokeHostFunctio2;
21453
- var _ref10,
21454
- _ref10$expiration,
21475
+ var _ref9,
21476
+ _ref9$expiration,
21455
21477
  expiration,
21456
- _ref10$signAuthEntry,
21478
+ _ref9$signAuthEntry,
21457
21479
  signAuthEntry,
21458
- _ref10$publicKey,
21480
+ _ref9$publicKey,
21459
21481
  publicKey,
21460
21482
  needsNonInvokerSigningBy,
21461
21483
  rawInvokeHostFunctionOp,
@@ -21470,7 +21492,21 @@ var AssembledTransaction = function () {
21470
21492
  return assembled_transaction_regeneratorRuntime().wrap(function _callee6$(_context6) {
21471
21493
  while (1) switch (_context6.prev = _context6.next) {
21472
21494
  case 0:
21473
- _ref10 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref10$expiration = _ref10.expiration, expiration = _ref10$expiration === void 0 ? _this.getStorageExpiration() : _ref10$expiration, _ref10$signAuthEntry = _ref10.signAuthEntry, signAuthEntry = _ref10$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref10$signAuthEntry, _ref10$publicKey = _ref10.publicKey, publicKey = _ref10$publicKey === void 0 ? _this.options.publicKey : _ref10$publicKey;
21495
+ _ref9 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref9$expiration = _ref9.expiration, expiration = _ref9$expiration === void 0 ? assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee4() {
21496
+ return assembled_transaction_regeneratorRuntime().wrap(function _callee4$(_context4) {
21497
+ while (1) switch (_context4.prev = _context4.next) {
21498
+ case 0:
21499
+ _context4.next = 2;
21500
+ return _this.server.getLatestLedger();
21501
+ case 2:
21502
+ _context4.t0 = _context4.sent.sequence;
21503
+ return _context4.abrupt("return", _context4.t0 + 100);
21504
+ case 4:
21505
+ case "end":
21506
+ return _context4.stop();
21507
+ }
21508
+ }, _callee4);
21509
+ }))() : _ref9$expiration, _ref9$signAuthEntry = _ref9.signAuthEntry, signAuthEntry = _ref9$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref9$signAuthEntry, _ref9$publicKey = _ref9.publicKey, publicKey = _ref9$publicKey === void 0 ? _this.options.publicKey : _ref9$publicKey;
21474
21510
  if (_this.built) {
21475
21511
  _context6.next = 3;
21476
21512
  break;
@@ -21979,7 +22015,6 @@ var basicNodeSigner = function basicNodeSigner(keypair, networkPassphrase) {
21979
22015
  /* provided dependency */ var spec_Buffer = __webpack_require__(8287)["Buffer"];
21980
22016
  function spec_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21981
22017
  function spec_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? spec_ownKeys(Object(t), !0).forEach(function (r) { spec_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : spec_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21982
- function spec_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = spec_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
21983
22018
  function spec_typeof(o) { "@babel/helpers - typeof"; return spec_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, spec_typeof(o); }
21984
22019
  function spec_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
21985
22020
  function spec_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, spec_toPropertyKey(o.key), o); } }
@@ -21995,12 +22030,36 @@ function spec_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined
21995
22030
  function spec_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
21996
22031
 
21997
22032
 
22033
+ function enumToJsonSchema(udt) {
22034
+ var description = udt.doc().toString();
22035
+ var cases = udt.cases();
22036
+ var oneOf = [];
22037
+ cases.forEach(function (aCase) {
22038
+ var title = aCase.name().toString();
22039
+ var desc = aCase.doc().toString();
22040
+ oneOf.push({
22041
+ description: desc,
22042
+ title: title,
22043
+ enum: [aCase.value()],
22044
+ type: "number"
22045
+ });
22046
+ });
22047
+ var res = {
22048
+ oneOf: oneOf
22049
+ };
22050
+ if (description.length > 0) {
22051
+ res.description = description;
22052
+ }
22053
+ return res;
22054
+ }
22055
+ function isNumeric(field) {
22056
+ return /^\d+$/.test(field.name().toString());
22057
+ }
21998
22058
  function readObj(args, input) {
21999
22059
  var inputName = input.name().toString();
22000
22060
  var entry = Object.entries(args).find(function (_ref) {
22001
- var _ref2 = spec_slicedToArray(_ref, 2),
22002
- name = _ref2[0],
22003
- _ = _ref2[1];
22061
+ var _ref2 = spec_slicedToArray(_ref, 1),
22062
+ name = _ref2[0];
22004
22063
  return name === inputName;
22005
22064
  });
22006
22065
  if (!entry) {
@@ -22008,11 +22067,416 @@ function readObj(args, input) {
22008
22067
  }
22009
22068
  return entry[1];
22010
22069
  }
22070
+ function findCase(name) {
22071
+ return function matches(entry) {
22072
+ switch (entry.switch().value) {
22073
+ case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
22074
+ {
22075
+ var tuple = entry.tupleCase();
22076
+ return tuple.name().toString() === name;
22077
+ }
22078
+ case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
22079
+ {
22080
+ var voidCase = entry.voidCase();
22081
+ return voidCase.name().toString() === name;
22082
+ }
22083
+ default:
22084
+ return false;
22085
+ }
22086
+ };
22087
+ }
22088
+ function stringToScVal(str, ty) {
22089
+ switch (ty.value) {
22090
+ case lib.xdr.ScSpecType.scSpecTypeString().value:
22091
+ return lib.xdr.ScVal.scvString(str);
22092
+ case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
22093
+ return lib.xdr.ScVal.scvSymbol(str);
22094
+ case lib.xdr.ScSpecType.scSpecTypeAddress().value:
22095
+ {
22096
+ var addr = lib.Address.fromString(str);
22097
+ return lib.xdr.ScVal.scvAddress(addr.toScAddress());
22098
+ }
22099
+ case lib.xdr.ScSpecType.scSpecTypeU64().value:
22100
+ return new lib.XdrLargeInt("u64", str).toScVal();
22101
+ case lib.xdr.ScSpecType.scSpecTypeI64().value:
22102
+ return new lib.XdrLargeInt("i64", str).toScVal();
22103
+ case lib.xdr.ScSpecType.scSpecTypeU128().value:
22104
+ return new lib.XdrLargeInt("u128", str).toScVal();
22105
+ case lib.xdr.ScSpecType.scSpecTypeI128().value:
22106
+ return new lib.XdrLargeInt("i128", str).toScVal();
22107
+ case lib.xdr.ScSpecType.scSpecTypeU256().value:
22108
+ return new lib.XdrLargeInt("u256", str).toScVal();
22109
+ case lib.xdr.ScSpecType.scSpecTypeI256().value:
22110
+ return new lib.XdrLargeInt("i256", str).toScVal();
22111
+ case lib.xdr.ScSpecType.scSpecTypeBytes().value:
22112
+ case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
22113
+ return lib.xdr.ScVal.scvBytes(spec_Buffer.from(str, "base64"));
22114
+ default:
22115
+ throw new TypeError("invalid type ".concat(ty.name, " specified for string value"));
22116
+ }
22117
+ }
22118
+ var PRIMITIVE_DEFINITONS = {
22119
+ U32: {
22120
+ type: "integer",
22121
+ minimum: 0,
22122
+ maximum: 4294967295
22123
+ },
22124
+ I32: {
22125
+ type: "integer",
22126
+ minimum: -2147483648,
22127
+ maximum: 2147483647
22128
+ },
22129
+ U64: {
22130
+ type: "string",
22131
+ pattern: "^([1-9][0-9]*|0)$",
22132
+ minLength: 1,
22133
+ maxLength: 20
22134
+ },
22135
+ I64: {
22136
+ type: "string",
22137
+ pattern: "^(-?[1-9][0-9]*|0)$",
22138
+ minLength: 1,
22139
+ maxLength: 21
22140
+ },
22141
+ U128: {
22142
+ type: "string",
22143
+ pattern: "^([1-9][0-9]*|0)$",
22144
+ minLength: 1,
22145
+ maxLength: 39
22146
+ },
22147
+ I128: {
22148
+ type: "string",
22149
+ pattern: "^(-?[1-9][0-9]*|0)$",
22150
+ minLength: 1,
22151
+ maxLength: 40
22152
+ },
22153
+ U256: {
22154
+ type: "string",
22155
+ pattern: "^([1-9][0-9]*|0)$",
22156
+ minLength: 1,
22157
+ maxLength: 78
22158
+ },
22159
+ I256: {
22160
+ type: "string",
22161
+ pattern: "^(-?[1-9][0-9]*|0)$",
22162
+ minLength: 1,
22163
+ maxLength: 79
22164
+ },
22165
+ Address: {
22166
+ type: "string",
22167
+ format: "address",
22168
+ description: "Address can be a public key or contract id"
22169
+ },
22170
+ ScString: {
22171
+ type: "string",
22172
+ description: "ScString is a string"
22173
+ },
22174
+ ScSymbol: {
22175
+ type: "string",
22176
+ description: "ScString is a string"
22177
+ },
22178
+ DataUrl: {
22179
+ type: "string",
22180
+ pattern: "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$"
22181
+ }
22182
+ };
22183
+ function typeRef(typeDef) {
22184
+ var t = typeDef.switch();
22185
+ var value = t.value;
22186
+ var ref;
22187
+ switch (value) {
22188
+ case lib.xdr.ScSpecType.scSpecTypeVal().value:
22189
+ {
22190
+ ref = "Val";
22191
+ break;
22192
+ }
22193
+ case lib.xdr.ScSpecType.scSpecTypeBool().value:
22194
+ {
22195
+ return {
22196
+ type: "boolean"
22197
+ };
22198
+ }
22199
+ case lib.xdr.ScSpecType.scSpecTypeVoid().value:
22200
+ {
22201
+ return {
22202
+ type: "null"
22203
+ };
22204
+ }
22205
+ case lib.xdr.ScSpecType.scSpecTypeError().value:
22206
+ {
22207
+ ref = "Error";
22208
+ break;
22209
+ }
22210
+ case lib.xdr.ScSpecType.scSpecTypeU32().value:
22211
+ {
22212
+ ref = "U32";
22213
+ break;
22214
+ }
22215
+ case lib.xdr.ScSpecType.scSpecTypeI32().value:
22216
+ {
22217
+ ref = "I32";
22218
+ break;
22219
+ }
22220
+ case lib.xdr.ScSpecType.scSpecTypeU64().value:
22221
+ {
22222
+ ref = "U64";
22223
+ break;
22224
+ }
22225
+ case lib.xdr.ScSpecType.scSpecTypeI64().value:
22226
+ {
22227
+ ref = "I64";
22228
+ break;
22229
+ }
22230
+ case lib.xdr.ScSpecType.scSpecTypeTimepoint().value:
22231
+ {
22232
+ throw new Error("Timepoint type not supported");
22233
+ ref = "Timepoint";
22234
+ break;
22235
+ }
22236
+ case lib.xdr.ScSpecType.scSpecTypeDuration().value:
22237
+ {
22238
+ throw new Error("Duration not supported");
22239
+ ref = "Duration";
22240
+ break;
22241
+ }
22242
+ case lib.xdr.ScSpecType.scSpecTypeU128().value:
22243
+ {
22244
+ ref = "U128";
22245
+ break;
22246
+ }
22247
+ case lib.xdr.ScSpecType.scSpecTypeI128().value:
22248
+ {
22249
+ ref = "I128";
22250
+ break;
22251
+ }
22252
+ case lib.xdr.ScSpecType.scSpecTypeU256().value:
22253
+ {
22254
+ ref = "U256";
22255
+ break;
22256
+ }
22257
+ case lib.xdr.ScSpecType.scSpecTypeI256().value:
22258
+ {
22259
+ ref = "I256";
22260
+ break;
22261
+ }
22262
+ case lib.xdr.ScSpecType.scSpecTypeBytes().value:
22263
+ {
22264
+ ref = "DataUrl";
22265
+ break;
22266
+ }
22267
+ case lib.xdr.ScSpecType.scSpecTypeString().value:
22268
+ {
22269
+ ref = "ScString";
22270
+ break;
22271
+ }
22272
+ case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
22273
+ {
22274
+ ref = "ScSymbol";
22275
+ break;
22276
+ }
22277
+ case lib.xdr.ScSpecType.scSpecTypeAddress().value:
22278
+ {
22279
+ ref = "Address";
22280
+ break;
22281
+ }
22282
+ case lib.xdr.ScSpecType.scSpecTypeOption().value:
22283
+ {
22284
+ var opt = typeDef.option();
22285
+ return typeRef(opt.valueType());
22286
+ }
22287
+ case lib.xdr.ScSpecType.scSpecTypeResult().value:
22288
+ {
22289
+ break;
22290
+ }
22291
+ case lib.xdr.ScSpecType.scSpecTypeVec().value:
22292
+ {
22293
+ var arr = typeDef.vec();
22294
+ var reference = typeRef(arr.elementType());
22295
+ return {
22296
+ type: "array",
22297
+ items: reference
22298
+ };
22299
+ }
22300
+ case lib.xdr.ScSpecType.scSpecTypeMap().value:
22301
+ {
22302
+ var map = typeDef.map();
22303
+ var items = [typeRef(map.keyType()), typeRef(map.valueType())];
22304
+ return {
22305
+ type: "array",
22306
+ items: {
22307
+ type: "array",
22308
+ items: items,
22309
+ minItems: 2,
22310
+ maxItems: 2
22311
+ }
22312
+ };
22313
+ }
22314
+ case lib.xdr.ScSpecType.scSpecTypeTuple().value:
22315
+ {
22316
+ var tuple = typeDef.tuple();
22317
+ var minItems = tuple.valueTypes().length;
22318
+ var maxItems = minItems;
22319
+ var _items = tuple.valueTypes().map(typeRef);
22320
+ return {
22321
+ type: "array",
22322
+ items: _items,
22323
+ minItems: minItems,
22324
+ maxItems: maxItems
22325
+ };
22326
+ }
22327
+ case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
22328
+ {
22329
+ var _arr = typeDef.bytesN();
22330
+ return {
22331
+ $ref: "#/definitions/DataUrl",
22332
+ maxLength: _arr.n()
22333
+ };
22334
+ }
22335
+ case lib.xdr.ScSpecType.scSpecTypeUdt().value:
22336
+ {
22337
+ var udt = typeDef.udt();
22338
+ ref = udt.name().toString();
22339
+ break;
22340
+ }
22341
+ }
22342
+ return {
22343
+ $ref: "#/definitions/".concat(ref)
22344
+ };
22345
+ }
22346
+ function isRequired(typeDef) {
22347
+ return typeDef.switch().value !== lib.xdr.ScSpecType.scSpecTypeOption().value;
22348
+ }
22349
+ function argsAndRequired(input) {
22350
+ var properties = {};
22351
+ var required = [];
22352
+ input.forEach(function (arg) {
22353
+ var aType = arg.type();
22354
+ var name = arg.name().toString();
22355
+ properties[name] = typeRef(aType);
22356
+ if (isRequired(aType)) {
22357
+ required.push(name);
22358
+ }
22359
+ });
22360
+ var res = {
22361
+ properties: properties
22362
+ };
22363
+ if (required.length > 0) {
22364
+ res.required = required;
22365
+ }
22366
+ return res;
22367
+ }
22368
+ function structToJsonSchema(udt) {
22369
+ var fields = udt.fields();
22370
+ if (fields.some(isNumeric)) {
22371
+ if (!fields.every(isNumeric)) {
22372
+ throw new Error("mixed numeric and non-numeric field names are not allowed");
22373
+ }
22374
+ var items = fields.map(function (_, i) {
22375
+ return typeRef(fields[i].type());
22376
+ });
22377
+ return {
22378
+ type: "array",
22379
+ items: items,
22380
+ minItems: fields.length,
22381
+ maxItems: fields.length
22382
+ };
22383
+ }
22384
+ var description = udt.doc().toString();
22385
+ var _argsAndRequired = argsAndRequired(fields),
22386
+ properties = _argsAndRequired.properties,
22387
+ required = _argsAndRequired.required;
22388
+ properties.additionalProperties = false;
22389
+ return {
22390
+ description: description,
22391
+ properties: properties,
22392
+ required: required,
22393
+ type: "object"
22394
+ };
22395
+ }
22396
+ function functionToJsonSchema(func) {
22397
+ var _argsAndRequired2 = argsAndRequired(func.inputs()),
22398
+ properties = _argsAndRequired2.properties,
22399
+ required = _argsAndRequired2.required;
22400
+ var args = {
22401
+ additionalProperties: false,
22402
+ properties: properties,
22403
+ type: "object"
22404
+ };
22405
+ if ((required === null || required === void 0 ? void 0 : required.length) > 0) {
22406
+ args.required = required;
22407
+ }
22408
+ var input = {
22409
+ properties: {
22410
+ args: args
22411
+ }
22412
+ };
22413
+ var outputs = func.outputs();
22414
+ var output = outputs.length > 0 ? typeRef(outputs[0]) : typeRef(lib.xdr.ScSpecTypeDef.scSpecTypeVoid());
22415
+ var description = func.doc().toString();
22416
+ if (description.length > 0) {
22417
+ input.description = description;
22418
+ }
22419
+ input.additionalProperties = false;
22420
+ output.additionalProperties = false;
22421
+ return {
22422
+ input: input,
22423
+ output: output
22424
+ };
22425
+ }
22426
+ function unionToJsonSchema(udt) {
22427
+ var description = udt.doc().toString();
22428
+ var cases = udt.cases();
22429
+ var oneOf = [];
22430
+ cases.forEach(function (aCase) {
22431
+ switch (aCase.switch().value) {
22432
+ case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
22433
+ {
22434
+ var c = aCase.voidCase();
22435
+ var title = c.name().toString();
22436
+ oneOf.push({
22437
+ type: "object",
22438
+ title: title,
22439
+ properties: {
22440
+ tag: title
22441
+ },
22442
+ additionalProperties: false,
22443
+ required: ["tag"]
22444
+ });
22445
+ break;
22446
+ }
22447
+ case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
22448
+ {
22449
+ var _c = aCase.tupleCase();
22450
+ var _title = _c.name().toString();
22451
+ oneOf.push({
22452
+ type: "object",
22453
+ title: _title,
22454
+ properties: {
22455
+ tag: _title,
22456
+ values: {
22457
+ type: "array",
22458
+ items: _c.type().map(typeRef)
22459
+ }
22460
+ },
22461
+ required: ["tag", "values"],
22462
+ additionalProperties: false
22463
+ });
22464
+ }
22465
+ }
22466
+ });
22467
+ var res = {
22468
+ oneOf: oneOf
22469
+ };
22470
+ if (description.length > 0) {
22471
+ res.description = description;
22472
+ }
22473
+ return res;
22474
+ }
22011
22475
  var Spec = function () {
22012
22476
  function Spec(entries) {
22013
22477
  spec_classCallCheck(this, Spec);
22014
22478
  spec_defineProperty(this, "entries", []);
22015
- if (entries.length == 0) {
22479
+ if (entries.length === 0) {
22016
22480
  throw new Error("Contract spec must have at least one entry");
22017
22481
  }
22018
22482
  var entry = entries[0];
@@ -22076,8 +22540,8 @@ var Spec = function () {
22076
22540
  }, {
22077
22541
  key: "findEntry",
22078
22542
  value: function findEntry(name) {
22079
- var entry = this.entries.find(function (entry) {
22080
- return entry.value().name().toString() === name;
22543
+ var entry = this.entries.find(function (e) {
22544
+ return e.value().name().toString() === name;
22081
22545
  });
22082
22546
  if (!entry) {
22083
22547
  throw new Error("no such entry: ".concat(name));
@@ -22133,9 +22597,9 @@ var Spec = function () {
22133
22597
  switch (value) {
22134
22598
  case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
22135
22599
  {
22136
- var bytes_n = ty.bytesN();
22137
- if (copy.length !== bytes_n.n()) {
22138
- throw new TypeError("expected ".concat(bytes_n.n(), " bytes, but got ").concat(copy.length));
22600
+ var bytesN = ty.bytesN();
22601
+ if (copy.length !== bytesN.n()) {
22602
+ throw new TypeError("expected ".concat(bytesN.n(), " bytes, but got ").concat(copy.length));
22139
22603
  }
22140
22604
  return lib.xdr.ScVal.scvBytes(copy);
22141
22605
  }
@@ -22173,10 +22637,10 @@ var Spec = function () {
22173
22637
  var valueType = map.valueType();
22174
22638
  return lib.xdr.ScVal.scvMap(val.map(function (entry) {
22175
22639
  var key = _this2.nativeToScVal(entry[0], keyType);
22176
- var val = _this2.nativeToScVal(entry[1], valueType);
22640
+ var mapVal = _this2.nativeToScVal(entry[1], valueType);
22177
22641
  return new lib.xdr.ScMapEntry({
22178
22642
  key: key,
22179
- val: val
22643
+ val: mapVal
22180
22644
  });
22181
22645
  }));
22182
22646
  }
@@ -22198,10 +22662,10 @@ var Spec = function () {
22198
22662
  k = _res$value[0],
22199
22663
  v = _res$value[1];
22200
22664
  var key = this.nativeToScVal(k, scMap.keyType());
22201
- var _val = this.nativeToScVal(v, scMap.valueType());
22665
+ var mapval = this.nativeToScVal(v, scMap.valueType());
22202
22666
  entries.push(new lib.xdr.ScMapEntry({
22203
22667
  key: key,
22204
- val: _val
22668
+ val: mapval
22205
22669
  }));
22206
22670
  res = values.next();
22207
22671
  }
@@ -22285,25 +22749,25 @@ var Spec = function () {
22285
22749
  key: "nativeToUnion",
22286
22750
  value: function nativeToUnion(val, union_) {
22287
22751
  var _this3 = this;
22288
- var entry_name = val.tag;
22289
- var case_ = union_.cases().find(function (entry) {
22290
- var case_ = entry.value().name().toString();
22291
- return case_ === entry_name;
22752
+ var entryName = val.tag;
22753
+ var caseFound = union_.cases().find(function (entry) {
22754
+ var caseN = entry.value().name().toString();
22755
+ return caseN === entryName;
22292
22756
  });
22293
- if (!case_) {
22294
- throw new TypeError("no such enum entry: ".concat(entry_name, " in ").concat(union_));
22757
+ if (!caseFound) {
22758
+ throw new TypeError("no such enum entry: ".concat(entryName, " in ").concat(union_));
22295
22759
  }
22296
- var key = lib.xdr.ScVal.scvSymbol(entry_name);
22297
- switch (case_.switch()) {
22760
+ var key = lib.xdr.ScVal.scvSymbol(entryName);
22761
+ switch (caseFound.switch()) {
22298
22762
  case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0():
22299
22763
  {
22300
22764
  return lib.xdr.ScVal.scvVec([key]);
22301
22765
  }
22302
22766
  case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0():
22303
22767
  {
22304
- var types = case_.tupleCase().type();
22768
+ var types = caseFound.tupleCase().type();
22305
22769
  if (Array.isArray(val.values)) {
22306
- if (val.values.length != types.length) {
22770
+ if (val.values.length !== types.length) {
22307
22771
  throw new TypeError("union ".concat(union_, " expects ").concat(types.length, " values, but got ").concat(val.values.length));
22308
22772
  }
22309
22773
  var scvals = val.values.map(function (v, i) {
@@ -22312,7 +22776,7 @@ var Spec = function () {
22312
22776
  scvals.unshift(key);
22313
22777
  return lib.xdr.ScVal.scvVec(scvals);
22314
22778
  }
22315
- throw new Error("failed to parse union case ".concat(case_, " with ").concat(val));
22779
+ throw new Error("failed to parse union case ".concat(caseFound, " with ").concat(val));
22316
22780
  }
22317
22781
  default:
22318
22782
  throw new Error("failed to parse union ".concat(union_, " with ").concat(val));
@@ -22365,7 +22829,7 @@ var Spec = function () {
22365
22829
  }
22366
22830
  switch (scv.switch().value) {
22367
22831
  case lib.xdr.ScValType.scvVoid().value:
22368
- return void 0;
22832
+ return undefined;
22369
22833
  case lib.xdr.ScValType.scvU64().value:
22370
22834
  case lib.xdr.ScValType.scvI64().value:
22371
22835
  case lib.xdr.ScValType.scvU128().value:
@@ -22375,13 +22839,14 @@ var Spec = function () {
22375
22839
  return (0,lib.scValToBigInt)(scv);
22376
22840
  case lib.xdr.ScValType.scvVec().value:
22377
22841
  {
22378
- if (value == lib.xdr.ScSpecType.scSpecTypeVec().value) {
22842
+ if (value === lib.xdr.ScSpecType.scSpecTypeVec().value) {
22379
22843
  var _scv$vec;
22380
22844
  var vec = typeDef.vec();
22381
22845
  return ((_scv$vec = scv.vec()) !== null && _scv$vec !== void 0 ? _scv$vec : []).map(function (elm) {
22382
22846
  return _this5.scValToNative(elm, vec.elementType());
22383
22847
  });
22384
- } else if (value == lib.xdr.ScSpecType.scSpecTypeTuple().value) {
22848
+ }
22849
+ if (value === lib.xdr.ScSpecType.scSpecTypeTuple().value) {
22385
22850
  var _scv$vec2;
22386
22851
  var tuple = typeDef.tuple();
22387
22852
  var valTypes = tuple.valueTypes();
@@ -22397,10 +22862,10 @@ var Spec = function () {
22397
22862
  {
22398
22863
  var _scv$map;
22399
22864
  var map = (_scv$map = scv.map()) !== null && _scv$map !== void 0 ? _scv$map : [];
22400
- if (value == lib.xdr.ScSpecType.scSpecTypeMap().value) {
22401
- var type_ = typeDef.map();
22402
- var keyType = type_.keyType();
22403
- var valueType = type_.valueType();
22865
+ if (value === lib.xdr.ScSpecType.scSpecTypeMap().value) {
22866
+ var typed = typeDef.map();
22867
+ var keyType = typed.keyType();
22868
+ var valueType = typed.valueType();
22404
22869
  var res = map.map(function (entry) {
22405
22870
  return [_this5.scValToNative(entry.key(), keyType), _this5.scValToNative(entry.val(), valueType)];
22406
22871
  });
@@ -22456,7 +22921,7 @@ var Spec = function () {
22456
22921
  throw new Error("".concat(val, " has length 0, but the there are at least one case in the union"));
22457
22922
  }
22458
22923
  var name = vec[0].sym().toString();
22459
- if (vec[0].switch().value != lib.xdr.ScValType.scvSymbol().value) {
22924
+ if (vec[0].switch().value !== lib.xdr.ScValType.scvSymbol().value) {
22460
22925
  throw new Error("{vec[0]} is not a symbol");
22461
22926
  }
22462
22927
  var entry = udt.cases().find(findCase(name));
@@ -22469,8 +22934,8 @@ var Spec = function () {
22469
22934
  if (entry.switch().value === lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value) {
22470
22935
  var tuple = entry.tupleCase();
22471
22936
  var ty = tuple.type();
22472
- var values = ty.map(function (entry, i) {
22473
- return _this6.scValToNative(vec[i + 1], entry);
22937
+ var values = ty.map(function (e, i) {
22938
+ return _this6.scValToNative(vec[i + 1], e);
22474
22939
  });
22475
22940
  res.values = values;
22476
22941
  }
@@ -22518,514 +22983,50 @@ var Spec = function () {
22518
22983
  key: "jsonSchema",
22519
22984
  value: function jsonSchema(funcName) {
22520
22985
  var definitions = {};
22521
- var _iterator = spec_createForOfIteratorHelper(this.entries),
22522
- _step;
22523
- try {
22524
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
22525
- var entry = _step.value;
22526
- switch (entry.switch().value) {
22527
- case lib.xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0().value:
22528
- {
22529
- var _udt = entry.udtEnumV0();
22530
- definitions[_udt.name().toString()] = enumToJsonSchema(_udt);
22531
- break;
22532
- }
22533
- case lib.xdr.ScSpecEntryKind.scSpecEntryUdtStructV0().value:
22534
- {
22535
- var _udt2 = entry.udtStructV0();
22536
- definitions[_udt2.name().toString()] = structToJsonSchema(_udt2);
22537
- break;
22538
- }
22539
- case lib.xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0().value:
22540
- var udt = entry.udtUnionV0();
22541
- definitions[udt.name().toString()] = unionToJsonSchema(udt);
22986
+ this.entries.forEach(function (entry) {
22987
+ switch (entry.switch().value) {
22988
+ case lib.xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0().value:
22989
+ {
22990
+ var udt = entry.udtEnumV0();
22991
+ definitions[udt.name().toString()] = enumToJsonSchema(udt);
22542
22992
  break;
22543
- case lib.xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value:
22544
- {
22545
- var fn = entry.functionV0();
22546
- var fnName = fn.name().toString();
22547
- var _functionToJsonSchema = functionToJsonSchema(fn),
22548
- input = _functionToJsonSchema.input;
22549
- definitions[fnName] = input;
22550
- break;
22551
- }
22552
- case lib.xdr.ScSpecEntryKind.scSpecEntryUdtErrorEnumV0().value:
22553
- {}
22554
- }
22993
+ }
22994
+ case lib.xdr.ScSpecEntryKind.scSpecEntryUdtStructV0().value:
22995
+ {
22996
+ var _udt = entry.udtStructV0();
22997
+ definitions[_udt.name().toString()] = structToJsonSchema(_udt);
22998
+ break;
22999
+ }
23000
+ case lib.xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0().value:
23001
+ {
23002
+ var _udt2 = entry.udtUnionV0();
23003
+ definitions[_udt2.name().toString()] = unionToJsonSchema(_udt2);
23004
+ break;
23005
+ }
23006
+ case lib.xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value:
23007
+ {
23008
+ var fn = entry.functionV0();
23009
+ var fnName = fn.name().toString();
23010
+ var _functionToJsonSchema = functionToJsonSchema(fn),
23011
+ input = _functionToJsonSchema.input;
23012
+ definitions[fnName] = input;
23013
+ break;
23014
+ }
23015
+ case lib.xdr.ScSpecEntryKind.scSpecEntryUdtErrorEnumV0().value:
23016
+ {}
22555
23017
  }
22556
- } catch (err) {
22557
- _iterator.e(err);
22558
- } finally {
22559
- _iterator.f();
22560
- }
23018
+ });
22561
23019
  var res = {
22562
23020
  $schema: "http://json-schema.org/draft-07/schema#",
22563
23021
  definitions: spec_objectSpread(spec_objectSpread({}, PRIMITIVE_DEFINITONS), definitions)
22564
23022
  };
22565
23023
  if (funcName) {
22566
- res["$ref"] = "#/definitions/".concat(funcName);
23024
+ res.$ref = "#/definitions/".concat(funcName);
22567
23025
  }
22568
23026
  return res;
22569
23027
  }
22570
23028
  }]);
22571
23029
  }();
22572
- function stringToScVal(str, ty) {
22573
- switch (ty.value) {
22574
- case lib.xdr.ScSpecType.scSpecTypeString().value:
22575
- return lib.xdr.ScVal.scvString(str);
22576
- case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
22577
- return lib.xdr.ScVal.scvSymbol(str);
22578
- case lib.xdr.ScSpecType.scSpecTypeAddress().value:
22579
- {
22580
- var addr = lib.Address.fromString(str);
22581
- return lib.xdr.ScVal.scvAddress(addr.toScAddress());
22582
- }
22583
- case lib.xdr.ScSpecType.scSpecTypeU64().value:
22584
- return new lib.XdrLargeInt("u64", str).toScVal();
22585
- case lib.xdr.ScSpecType.scSpecTypeI64().value:
22586
- return new lib.XdrLargeInt("i64", str).toScVal();
22587
- case lib.xdr.ScSpecType.scSpecTypeU128().value:
22588
- return new lib.XdrLargeInt("u128", str).toScVal();
22589
- case lib.xdr.ScSpecType.scSpecTypeI128().value:
22590
- return new lib.XdrLargeInt("i128", str).toScVal();
22591
- case lib.xdr.ScSpecType.scSpecTypeU256().value:
22592
- return new lib.XdrLargeInt("u256", str).toScVal();
22593
- case lib.xdr.ScSpecType.scSpecTypeI256().value:
22594
- return new lib.XdrLargeInt("i256", str).toScVal();
22595
- case lib.xdr.ScSpecType.scSpecTypeBytes().value:
22596
- case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
22597
- return lib.xdr.ScVal.scvBytes(spec_Buffer.from(str, "base64"));
22598
- default:
22599
- throw new TypeError("invalid type ".concat(ty.name, " specified for string value"));
22600
- }
22601
- }
22602
- function isNumeric(field) {
22603
- return /^\d+$/.test(field.name().toString());
22604
- }
22605
- function findCase(name) {
22606
- return function matches(entry) {
22607
- switch (entry.switch().value) {
22608
- case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
22609
- {
22610
- var tuple = entry.tupleCase();
22611
- return tuple.name().toString() === name;
22612
- }
22613
- case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
22614
- {
22615
- var void_case = entry.voidCase();
22616
- return void_case.name().toString() === name;
22617
- }
22618
- default:
22619
- return false;
22620
- }
22621
- };
22622
- }
22623
- var PRIMITIVE_DEFINITONS = {
22624
- U32: {
22625
- type: "integer",
22626
- minimum: 0,
22627
- maximum: 4294967295
22628
- },
22629
- I32: {
22630
- type: "integer",
22631
- minimum: -2147483648,
22632
- maximum: 2147483647
22633
- },
22634
- U64: {
22635
- type: "string",
22636
- pattern: "^([1-9][0-9]*|0)$",
22637
- minLength: 1,
22638
- maxLength: 20
22639
- },
22640
- I64: {
22641
- type: "string",
22642
- pattern: "^(-?[1-9][0-9]*|0)$",
22643
- minLength: 1,
22644
- maxLength: 21
22645
- },
22646
- U128: {
22647
- type: "string",
22648
- pattern: "^([1-9][0-9]*|0)$",
22649
- minLength: 1,
22650
- maxLength: 39
22651
- },
22652
- I128: {
22653
- type: "string",
22654
- pattern: "^(-?[1-9][0-9]*|0)$",
22655
- minLength: 1,
22656
- maxLength: 40
22657
- },
22658
- U256: {
22659
- type: "string",
22660
- pattern: "^([1-9][0-9]*|0)$",
22661
- minLength: 1,
22662
- maxLength: 78
22663
- },
22664
- I256: {
22665
- type: "string",
22666
- pattern: "^(-?[1-9][0-9]*|0)$",
22667
- minLength: 1,
22668
- maxLength: 79
22669
- },
22670
- Address: {
22671
- type: "string",
22672
- format: "address",
22673
- description: "Address can be a public key or contract id"
22674
- },
22675
- ScString: {
22676
- type: "string",
22677
- description: "ScString is a string"
22678
- },
22679
- ScSymbol: {
22680
- type: "string",
22681
- description: "ScString is a string"
22682
- },
22683
- DataUrl: {
22684
- type: "string",
22685
- pattern: "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$"
22686
- }
22687
- };
22688
- function typeRef(typeDef) {
22689
- var t = typeDef.switch();
22690
- var value = t.value;
22691
- var ref;
22692
- switch (value) {
22693
- case lib.xdr.ScSpecType.scSpecTypeVal().value:
22694
- {
22695
- ref = "Val";
22696
- break;
22697
- }
22698
- case lib.xdr.ScSpecType.scSpecTypeBool().value:
22699
- {
22700
- return {
22701
- type: "boolean"
22702
- };
22703
- }
22704
- case lib.xdr.ScSpecType.scSpecTypeVoid().value:
22705
- {
22706
- return {
22707
- type: "null"
22708
- };
22709
- }
22710
- case lib.xdr.ScSpecType.scSpecTypeError().value:
22711
- {
22712
- ref = "Error";
22713
- break;
22714
- }
22715
- case lib.xdr.ScSpecType.scSpecTypeU32().value:
22716
- {
22717
- ref = "U32";
22718
- break;
22719
- }
22720
- case lib.xdr.ScSpecType.scSpecTypeI32().value:
22721
- {
22722
- ref = "I32";
22723
- break;
22724
- }
22725
- case lib.xdr.ScSpecType.scSpecTypeU64().value:
22726
- {
22727
- ref = "U64";
22728
- break;
22729
- }
22730
- case lib.xdr.ScSpecType.scSpecTypeI64().value:
22731
- {
22732
- ref = "I64";
22733
- break;
22734
- }
22735
- case lib.xdr.ScSpecType.scSpecTypeTimepoint().value:
22736
- {
22737
- throw new Error("Timepoint type not supported");
22738
- ref = "Timepoint";
22739
- break;
22740
- }
22741
- case lib.xdr.ScSpecType.scSpecTypeDuration().value:
22742
- {
22743
- throw new Error("Duration not supported");
22744
- ref = "Duration";
22745
- break;
22746
- }
22747
- case lib.xdr.ScSpecType.scSpecTypeU128().value:
22748
- {
22749
- ref = "U128";
22750
- break;
22751
- }
22752
- case lib.xdr.ScSpecType.scSpecTypeI128().value:
22753
- {
22754
- ref = "I128";
22755
- break;
22756
- }
22757
- case lib.xdr.ScSpecType.scSpecTypeU256().value:
22758
- {
22759
- ref = "U256";
22760
- break;
22761
- }
22762
- case lib.xdr.ScSpecType.scSpecTypeI256().value:
22763
- {
22764
- ref = "I256";
22765
- break;
22766
- }
22767
- case lib.xdr.ScSpecType.scSpecTypeBytes().value:
22768
- {
22769
- ref = "DataUrl";
22770
- break;
22771
- }
22772
- case lib.xdr.ScSpecType.scSpecTypeString().value:
22773
- {
22774
- ref = "ScString";
22775
- break;
22776
- }
22777
- case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
22778
- {
22779
- ref = "ScSymbol";
22780
- break;
22781
- }
22782
- case lib.xdr.ScSpecType.scSpecTypeAddress().value:
22783
- {
22784
- ref = "Address";
22785
- break;
22786
- }
22787
- case lib.xdr.ScSpecType.scSpecTypeOption().value:
22788
- {
22789
- var opt = typeDef.option();
22790
- return typeRef(opt.valueType());
22791
- }
22792
- case lib.xdr.ScSpecType.scSpecTypeResult().value:
22793
- {
22794
- break;
22795
- }
22796
- case lib.xdr.ScSpecType.scSpecTypeVec().value:
22797
- {
22798
- var arr = typeDef.vec();
22799
- var _ref3 = typeRef(arr.elementType());
22800
- return {
22801
- type: "array",
22802
- items: _ref3
22803
- };
22804
- }
22805
- case lib.xdr.ScSpecType.scSpecTypeMap().value:
22806
- {
22807
- var map = typeDef.map();
22808
- var items = [typeRef(map.keyType()), typeRef(map.valueType())];
22809
- return {
22810
- type: "array",
22811
- items: {
22812
- type: "array",
22813
- items: items,
22814
- minItems: 2,
22815
- maxItems: 2
22816
- }
22817
- };
22818
- }
22819
- case lib.xdr.ScSpecType.scSpecTypeTuple().value:
22820
- {
22821
- var tuple = typeDef.tuple();
22822
- var minItems = tuple.valueTypes().length;
22823
- var maxItems = minItems;
22824
- var _items = tuple.valueTypes().map(typeRef);
22825
- return {
22826
- type: "array",
22827
- items: _items,
22828
- minItems: minItems,
22829
- maxItems: maxItems
22830
- };
22831
- }
22832
- case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
22833
- {
22834
- var _arr = typeDef.bytesN();
22835
- return {
22836
- $ref: "#/definitions/DataUrl",
22837
- maxLength: _arr.n()
22838
- };
22839
- }
22840
- case lib.xdr.ScSpecType.scSpecTypeUdt().value:
22841
- {
22842
- var udt = typeDef.udt();
22843
- ref = udt.name().toString();
22844
- break;
22845
- }
22846
- }
22847
- return {
22848
- $ref: "#/definitions/".concat(ref)
22849
- };
22850
- }
22851
- function isRequired(typeDef) {
22852
- return typeDef.switch().value != lib.xdr.ScSpecType.scSpecTypeOption().value;
22853
- }
22854
- function structToJsonSchema(udt) {
22855
- var fields = udt.fields();
22856
- if (fields.some(isNumeric)) {
22857
- if (!fields.every(isNumeric)) {
22858
- throw new Error("mixed numeric and non-numeric field names are not allowed");
22859
- }
22860
- var items = fields.map(function (_, i) {
22861
- return typeRef(fields[i].type());
22862
- });
22863
- return {
22864
- type: "array",
22865
- items: items,
22866
- minItems: fields.length,
22867
- maxItems: fields.length
22868
- };
22869
- }
22870
- var description = udt.doc().toString();
22871
- var _args_and_required = args_and_required(fields),
22872
- properties = _args_and_required.properties,
22873
- required = _args_and_required.required;
22874
- properties["additionalProperties"] = false;
22875
- return {
22876
- description: description,
22877
- properties: properties,
22878
- required: required,
22879
- type: "object"
22880
- };
22881
- }
22882
- function args_and_required(input) {
22883
- var properties = {};
22884
- var required = [];
22885
- var _iterator2 = spec_createForOfIteratorHelper(input),
22886
- _step2;
22887
- try {
22888
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
22889
- var arg = _step2.value;
22890
- var type_ = arg.type();
22891
- var name = arg.name().toString();
22892
- properties[name] = typeRef(type_);
22893
- if (isRequired(type_)) {
22894
- required.push(name);
22895
- }
22896
- }
22897
- } catch (err) {
22898
- _iterator2.e(err);
22899
- } finally {
22900
- _iterator2.f();
22901
- }
22902
- var res = {
22903
- properties: properties
22904
- };
22905
- if (required.length > 0) {
22906
- res.required = required;
22907
- }
22908
- return res;
22909
- }
22910
- function functionToJsonSchema(func) {
22911
- var _args_and_required2 = args_and_required(func.inputs()),
22912
- properties = _args_and_required2.properties,
22913
- required = _args_and_required2.required;
22914
- var args = {
22915
- additionalProperties: false,
22916
- properties: properties,
22917
- type: "object"
22918
- };
22919
- if ((required === null || required === void 0 ? void 0 : required.length) > 0) {
22920
- args.required = required;
22921
- }
22922
- var input = {
22923
- properties: {
22924
- args: args
22925
- }
22926
- };
22927
- var outputs = func.outputs();
22928
- var output = outputs.length > 0 ? typeRef(outputs[0]) : typeRef(lib.xdr.ScSpecTypeDef.scSpecTypeVoid());
22929
- var description = func.doc().toString();
22930
- if (description.length > 0) {
22931
- input.description = description;
22932
- }
22933
- input.additionalProperties = false;
22934
- output.additionalProperties = false;
22935
- return {
22936
- input: input,
22937
- output: output
22938
- };
22939
- }
22940
- function unionToJsonSchema(udt) {
22941
- var description = udt.doc().toString();
22942
- var cases = udt.cases();
22943
- var oneOf = [];
22944
- var _iterator3 = spec_createForOfIteratorHelper(cases),
22945
- _step3;
22946
- try {
22947
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
22948
- var case_ = _step3.value;
22949
- switch (case_.switch().value) {
22950
- case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
22951
- {
22952
- var c = case_.voidCase();
22953
- var title = c.name().toString();
22954
- oneOf.push({
22955
- type: "object",
22956
- title: title,
22957
- properties: {
22958
- tag: title
22959
- },
22960
- additionalProperties: false,
22961
- required: ["tag"]
22962
- });
22963
- break;
22964
- }
22965
- case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
22966
- {
22967
- var _c = case_.tupleCase();
22968
- var _title = _c.name().toString();
22969
- oneOf.push({
22970
- type: "object",
22971
- title: _title,
22972
- properties: {
22973
- tag: _title,
22974
- values: {
22975
- type: "array",
22976
- items: _c.type().map(typeRef)
22977
- }
22978
- },
22979
- required: ["tag", "values"],
22980
- additionalProperties: false
22981
- });
22982
- }
22983
- }
22984
- }
22985
- } catch (err) {
22986
- _iterator3.e(err);
22987
- } finally {
22988
- _iterator3.f();
22989
- }
22990
- var res = {
22991
- oneOf: oneOf
22992
- };
22993
- if (description.length > 0) {
22994
- res.description = description;
22995
- }
22996
- return res;
22997
- }
22998
- function enumToJsonSchema(udt) {
22999
- var description = udt.doc().toString();
23000
- var cases = udt.cases();
23001
- var oneOf = [];
23002
- var _iterator4 = spec_createForOfIteratorHelper(cases),
23003
- _step4;
23004
- try {
23005
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
23006
- var case_ = _step4.value;
23007
- var title = case_.name().toString();
23008
- var _description = case_.doc().toString();
23009
- oneOf.push({
23010
- description: _description,
23011
- title: title,
23012
- enum: [case_.value()],
23013
- type: "number"
23014
- });
23015
- }
23016
- } catch (err) {
23017
- _iterator4.e(err);
23018
- } finally {
23019
- _iterator4.f();
23020
- }
23021
- var res = {
23022
- oneOf: oneOf
23023
- };
23024
- if (description.length > 0) {
23025
- res.description = description;
23026
- }
23027
- return res;
23028
- }
23029
23030
  // EXTERNAL MODULE: ./src/rpc/index.ts
23030
23031
  var rpc = __webpack_require__(1660);
23031
23032
  ;// CONCATENATED MODULE: ./src/contract/client.ts
@@ -23037,8 +23038,8 @@ function client_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c),
23037
23038
  function client_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { client_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
23038
23039
  function client_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23039
23040
  function client_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? client_ownKeys(Object(t), !0).forEach(function (r) { client_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : client_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23040
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
23041
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
23041
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
23042
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
23042
23043
  function client_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
23043
23044
  function client_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, client_toPropertyKey(o.key), o); } }
23044
23045
  function client_createClass(e, r, t) { return r && client_defineProperties(e.prototype, r), t && client_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -23213,7 +23214,6 @@ var Client = function () {
23213
23214
 
23214
23215
 
23215
23216
 
23216
-
23217
23217
  /***/ }),
23218
23218
 
23219
23219
  /***/ 5885:
@@ -26724,14 +26724,14 @@ var AxiosClient = axios/* default */.A.create({
26724
26724
  "X-Client-Version": version
26725
26725
  }
26726
26726
  });
26727
- function _toSeconds(ms) {
26727
+ function toSeconds(ms) {
26728
26728
  return Math.floor(ms / 1000);
26729
26729
  }
26730
- AxiosClient.interceptors.response.use(function interceptorHorizonResponse(response) {
26730
+ AxiosClient.interceptors.response.use(function (response) {
26731
26731
  var hostname = URI_default()(response.config.url).hostname();
26732
- var serverTime = _toSeconds(Date.parse(response.headers.date));
26733
- var localTimeRecorded = _toSeconds(new Date().getTime());
26734
- if (!isNaN(serverTime)) {
26732
+ var serverTime = toSeconds(Date.parse(response.headers.date));
26733
+ var localTimeRecorded = toSeconds(new Date().getTime());
26734
+ if (!Number.isNaN(serverTime)) {
26735
26735
  SERVER_TIME_MAP[hostname] = {
26736
26736
  serverTime: serverTime,
26737
26737
  localTimeRecorded: localTimeRecorded
@@ -26747,7 +26747,7 @@ function getCurrentServerTime(hostname) {
26747
26747
  }
26748
26748
  var serverTime = entry.serverTime,
26749
26749
  localTimeRecorded = entry.localTimeRecorded;
26750
- var currentTime = _toSeconds(new Date().getTime());
26750
+ var currentTime = toSeconds(new Date().getTime());
26751
26751
  if (currentTime - localTimeRecorded > 60 * 5) {
26752
26752
  return null;
26753
26753
  }
@@ -26803,10 +26803,10 @@ var CallBuilder = function () {
26803
26803
  timeout = setTimeout(function () {
26804
26804
  var _es;
26805
26805
  (_es = es) === null || _es === void 0 || _es.close();
26806
- es = createEventSource();
26806
+ es = _createEventSource();
26807
26807
  }, options.reconnectTimeout || 15 * 1000);
26808
26808
  };
26809
- var createEventSource = function createEventSource() {
26809
+ var _createEventSource = function createEventSource() {
26810
26810
  try {
26811
26811
  es = new EventSource(_this2.url.toString());
26812
26812
  } catch (err) {
@@ -26825,7 +26825,7 @@ var CallBuilder = function () {
26825
26825
  }
26826
26826
  clearTimeout(timeout);
26827
26827
  es.close();
26828
- createEventSource();
26828
+ _createEventSource();
26829
26829
  closed = true;
26830
26830
  };
26831
26831
  var onMessage = function onMessage(message) {
@@ -26858,7 +26858,7 @@ var CallBuilder = function () {
26858
26858
  }
26859
26859
  return es;
26860
26860
  };
26861
- createEventSource();
26861
+ _createEventSource();
26862
26862
  return function () {
26863
26863
  var _es2;
26864
26864
  clearTimeout(timeout);
@@ -26948,8 +26948,7 @@ var CallBuilder = function () {
26948
26948
  if (!json._links) {
26949
26949
  return json;
26950
26950
  }
26951
- var _loop = function _loop() {
26952
- var key = _Object$keys[_i];
26951
+ Object.keys(json._links).forEach(function (key) {
26953
26952
  var n = json._links[key];
26954
26953
  var included = false;
26955
26954
  if (typeof json[key] !== "undefined") {
@@ -26972,10 +26971,7 @@ var CallBuilder = function () {
26972
26971
  } else {
26973
26972
  json[key] = _this4._requestFnForLink(n);
26974
26973
  }
26975
- };
26976
- for (var _i = 0, _Object$keys = Object.keys(json._links); _i < _Object$keys.length; _i++) {
26977
- _loop();
26978
- }
26974
+ });
26979
26975
  return json;
26980
26976
  }
26981
26977
  }, {
@@ -27074,10 +27070,11 @@ var CallBuilder = function () {
27074
27070
  key: "_handleNetworkError",
27075
27071
  value: (function () {
27076
27072
  var _handleNetworkError2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee6(error) {
27073
+ var _error$response$statu, _error$response$statu2;
27077
27074
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
27078
27075
  while (1) switch (_context6.prev = _context6.next) {
27079
27076
  case 0:
27080
- if (!(error.response && error.response.status && error.response.statusText)) {
27077
+ if (!(error.response && error.response.status)) {
27081
27078
  _context6.next = 8;
27082
27079
  break;
27083
27080
  }
@@ -27085,9 +27082,9 @@ var CallBuilder = function () {
27085
27082
  _context6.next = _context6.t0 === 404 ? 4 : 5;
27086
27083
  break;
27087
27084
  case 4:
27088
- return _context6.abrupt("return", Promise.reject(new errors/* NotFoundError */.m_(error.response.statusText, error.response.data)));
27085
+ return _context6.abrupt("return", Promise.reject(new errors/* NotFoundError */.m_((_error$response$statu = error.response.statusText) !== null && _error$response$statu !== void 0 ? _error$response$statu : "Not Found", error.response.data)));
27089
27086
  case 5:
27090
- return _context6.abrupt("return", Promise.reject(new errors/* NetworkError */.Dr(error.response.statusText, error.response.data)));
27087
+ return _context6.abrupt("return", Promise.reject(new errors/* NetworkError */.Dr((_error$response$statu2 = error.response.statusText) !== null && _error$response$statu2 !== void 0 ? _error$response$statu2 : "Unknown", error.response.data)));
27091
27088
  case 6:
27092
27089
  _context6.next = 9;
27093
27090
  break;
@@ -27786,13 +27783,9 @@ var TradeAggregationCallBuilder = function (_CallBuilder) {
27786
27783
  return trade_aggregation_call_builder_createClass(TradeAggregationCallBuilder, [{
27787
27784
  key: "isValidResolution",
27788
27785
  value: function isValidResolution(resolution) {
27789
- for (var _i = 0, _allowedResolutions = allowedResolutions; _i < _allowedResolutions.length; _i++) {
27790
- var allowed = _allowedResolutions[_i];
27791
- if (allowed === resolution) {
27792
- return true;
27793
- }
27794
- }
27795
- return false;
27786
+ return allowedResolutions.some(function (allowed) {
27787
+ return allowed === resolution;
27788
+ });
27796
27789
  }
27797
27790
  }, {
27798
27791
  key: "isValidOffset",
@@ -27930,6 +27923,9 @@ var TransactionCallBuilder = function (_CallBuilder) {
27930
27923
  }(CallBuilder);
27931
27924
  ;// CONCATENATED MODULE: ./src/horizon/server.ts
27932
27925
  function server_typeof(o) { "@babel/helpers - typeof"; return server_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, server_typeof(o); }
27926
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
27927
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
27928
+ function _defineProperty(e, r, t) { return (r = server_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
27933
27929
  function server_regeneratorRuntime() { "use strict"; server_regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == server_typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(server_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
27934
27930
  function server_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
27935
27931
  function server_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { server_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { server_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
@@ -27965,7 +27961,7 @@ function server_toPrimitive(t, r) { if ("object" != server_typeof(t) || !t) retu
27965
27961
  var SUBMIT_TRANSACTION_TIMEOUT = 60 * 1000;
27966
27962
  var STROOPS_IN_LUMEN = 10000000;
27967
27963
  var ACCOUNT_REQUIRES_MEMO = "MQ==";
27968
- function _getAmountInLumens(amt) {
27964
+ function getAmountInLumens(amt) {
27969
27965
  return new bignumber(amt).div(STROOPS_IN_LUMEN).toString();
27970
27966
  }
27971
27967
  var Server = function () {
@@ -27984,6 +27980,9 @@ var Server = function () {
27984
27980
  if (opts.authToken) {
27985
27981
  customHeaders["X-Auth-Token"] = opts.authToken;
27986
27982
  }
27983
+ if (opts.headers) {
27984
+ Object.assign(customHeaders, opts.headers);
27985
+ }
27987
27986
  if (Object.keys(customHeaders).length > 0) {
27988
27987
  horizon_axios_client.interceptors.request.use(function (config) {
27989
27988
  config.headers = Object.assign(config.headers, customHeaders);
@@ -28027,11 +28026,8 @@ var Server = function () {
28027
28026
  _context.next = 8;
28028
28027
  return horizon_axios_client.get(URI_default()(this.serverURL).toString());
28029
28028
  case 8:
28030
- _context.next = 10;
28031
- return this.fetchTimebounds(seconds, true);
28032
- case 10:
28033
- return _context.abrupt("return", _context.sent);
28034
- case 11:
28029
+ return _context.abrupt("return", this.fetchTimebounds(seconds, true));
28030
+ case 9:
28035
28031
  case "end":
28036
28032
  return _context.stop();
28037
28033
  }
@@ -28139,7 +28135,7 @@ var Server = function () {
28139
28135
  sellerId = lib.StrKey.encodeEd25519PublicKey(offerClaimed.sellerId().ed25519());
28140
28136
  break;
28141
28137
  default:
28142
- throw new Error("Invalid offer result type: " + offerClaimedAtom.switch());
28138
+ throw new Error("Invalid offer result type: ".concat(offerClaimedAtom.switch()));
28143
28139
  }
28144
28140
  var claimedOfferAmountBought = new bignumber(offerClaimed.amountBought().toString());
28145
28141
  var claimedOfferAmountSold = new bignumber(offerClaimed.amountSold().toString());
@@ -28161,9 +28157,9 @@ var Server = function () {
28161
28157
  sellerId: sellerId,
28162
28158
  offerId: offerClaimed.offerId().toString(),
28163
28159
  assetSold: assetSold,
28164
- amountSold: _getAmountInLumens(claimedOfferAmountSold),
28160
+ amountSold: getAmountInLumens(claimedOfferAmountSold),
28165
28161
  assetBought: assetBought,
28166
- amountBought: _getAmountInLumens(claimedOfferAmountBought)
28162
+ amountBought: getAmountInLumens(claimedOfferAmountBought)
28167
28163
  };
28168
28164
  });
28169
28165
  var effect = offerSuccess.offer().switch().name;
@@ -28174,7 +28170,7 @@ var Server = function () {
28174
28170
  offerId: offerXDR.offerId().toString(),
28175
28171
  selling: {},
28176
28172
  buying: {},
28177
- amount: _getAmountInLumens(offerXDR.amount().toString()),
28173
+ amount: getAmountInLumens(offerXDR.amount().toString()),
28178
28174
  price: {
28179
28175
  n: offerXDR.price().n(),
28180
28176
  d: offerXDR.price().d()
@@ -28198,8 +28194,8 @@ var Server = function () {
28198
28194
  effect: effect,
28199
28195
  operationIndex: i,
28200
28196
  currentOffer: currentOffer,
28201
- amountBought: _getAmountInLumens(amountBought),
28202
- amountSold: _getAmountInLumens(amountSold),
28197
+ amountBought: getAmountInLumens(amountBought),
28198
+ amountSold: getAmountInLumens(amountSold),
28203
28199
  isFullyOpen: !offersClaimed.length && effect !== "manageOfferDeleted",
28204
28200
  wasPartiallyFilled: !!offersClaimed.length && effect !== "manageOfferDeleted",
28205
28201
  wasImmediatelyFilled: !!offersClaimed.length && effect === "manageOfferDeleted",
@@ -28209,7 +28205,7 @@ var Server = function () {
28209
28205
  return !!result;
28210
28206
  });
28211
28207
  }
28212
- return Object.assign({}, response.data, {
28208
+ return _objectSpread(_objectSpread({}, response.data), {}, {
28213
28209
  offerResults: hasManageOffer ? offerResults : undefined
28214
28210
  });
28215
28211
  }).catch(function (response) {
@@ -28229,6 +28225,46 @@ var Server = function () {
28229
28225
  }
28230
28226
  return submitTransaction;
28231
28227
  }())
28228
+ }, {
28229
+ key: "submitAsyncTransaction",
28230
+ value: (function () {
28231
+ var _submitAsyncTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee5(transaction) {
28232
+ var opts,
28233
+ tx,
28234
+ _args5 = arguments;
28235
+ return server_regeneratorRuntime().wrap(function _callee5$(_context5) {
28236
+ while (1) switch (_context5.prev = _context5.next) {
28237
+ case 0:
28238
+ opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {
28239
+ skipMemoRequiredCheck: false
28240
+ };
28241
+ if (opts.skipMemoRequiredCheck) {
28242
+ _context5.next = 4;
28243
+ break;
28244
+ }
28245
+ _context5.next = 4;
28246
+ return this.checkMemoRequired(transaction);
28247
+ case 4:
28248
+ tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
28249
+ return _context5.abrupt("return", horizon_axios_client.post(URI_default()(this.serverURL).segment("transactions_async").toString(), "tx=".concat(tx)).then(function (response) {
28250
+ return response.data;
28251
+ }).catch(function (response) {
28252
+ if (response instanceof Error) {
28253
+ return Promise.reject(response);
28254
+ }
28255
+ return Promise.reject(new errors/* BadResponseError */.nS("Transaction submission failed. Server responded: ".concat(response.status, " ").concat(response.statusText), response.data));
28256
+ }));
28257
+ case 6:
28258
+ case "end":
28259
+ return _context5.stop();
28260
+ }
28261
+ }, _callee5, this);
28262
+ }));
28263
+ function submitAsyncTransaction(_x3) {
28264
+ return _submitAsyncTransaction.apply(this, arguments);
28265
+ }
28266
+ return submitAsyncTransaction;
28267
+ }())
28232
28268
  }, {
28233
28269
  key: "accounts",
28234
28270
  value: function accounts() {
@@ -28307,23 +28343,23 @@ var Server = function () {
28307
28343
  }, {
28308
28344
  key: "loadAccount",
28309
28345
  value: (function () {
28310
- var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee5(accountId) {
28346
+ var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6(accountId) {
28311
28347
  var res;
28312
- return server_regeneratorRuntime().wrap(function _callee5$(_context5) {
28313
- while (1) switch (_context5.prev = _context5.next) {
28348
+ return server_regeneratorRuntime().wrap(function _callee6$(_context6) {
28349
+ while (1) switch (_context6.prev = _context6.next) {
28314
28350
  case 0:
28315
- _context5.next = 2;
28351
+ _context6.next = 2;
28316
28352
  return this.accounts().accountId(accountId).call();
28317
28353
  case 2:
28318
- res = _context5.sent;
28319
- return _context5.abrupt("return", new AccountResponse(res));
28354
+ res = _context6.sent;
28355
+ return _context6.abrupt("return", new AccountResponse(res));
28320
28356
  case 4:
28321
28357
  case "end":
28322
- return _context5.stop();
28358
+ return _context6.stop();
28323
28359
  }
28324
- }, _callee5, this);
28360
+ }, _callee6, this);
28325
28361
  }));
28326
- function loadAccount(_x3) {
28362
+ function loadAccount(_x4) {
28327
28363
  return _loadAccount.apply(this, arguments);
28328
28364
  }
28329
28365
  return loadAccount;
@@ -28336,90 +28372,90 @@ var Server = function () {
28336
28372
  }, {
28337
28373
  key: "checkMemoRequired",
28338
28374
  value: (function () {
28339
- var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6(transaction) {
28375
+ var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee7(transaction) {
28340
28376
  var destinations, i, operation, destination, account;
28341
- return server_regeneratorRuntime().wrap(function _callee6$(_context6) {
28342
- while (1) switch (_context6.prev = _context6.next) {
28377
+ return server_regeneratorRuntime().wrap(function _callee7$(_context7) {
28378
+ while (1) switch (_context7.prev = _context7.next) {
28343
28379
  case 0:
28344
28380
  if (transaction instanceof lib.FeeBumpTransaction) {
28345
28381
  transaction = transaction.innerTransaction;
28346
28382
  }
28347
28383
  if (!(transaction.memo.type !== "none")) {
28348
- _context6.next = 3;
28384
+ _context7.next = 3;
28349
28385
  break;
28350
28386
  }
28351
- return _context6.abrupt("return");
28387
+ return _context7.abrupt("return");
28352
28388
  case 3:
28353
28389
  destinations = new Set();
28354
28390
  i = 0;
28355
28391
  case 5:
28356
28392
  if (!(i < transaction.operations.length)) {
28357
- _context6.next = 36;
28393
+ _context7.next = 36;
28358
28394
  break;
28359
28395
  }
28360
28396
  operation = transaction.operations[i];
28361
- _context6.t0 = operation.type;
28362
- _context6.next = _context6.t0 === "payment" ? 10 : _context6.t0 === "pathPaymentStrictReceive" ? 10 : _context6.t0 === "pathPaymentStrictSend" ? 10 : _context6.t0 === "accountMerge" ? 10 : 11;
28397
+ _context7.t0 = operation.type;
28398
+ _context7.next = _context7.t0 === "payment" ? 10 : _context7.t0 === "pathPaymentStrictReceive" ? 10 : _context7.t0 === "pathPaymentStrictSend" ? 10 : _context7.t0 === "accountMerge" ? 10 : 11;
28363
28399
  break;
28364
28400
  case 10:
28365
- return _context6.abrupt("break", 12);
28401
+ return _context7.abrupt("break", 12);
28366
28402
  case 11:
28367
- return _context6.abrupt("continue", 33);
28403
+ return _context7.abrupt("continue", 33);
28368
28404
  case 12:
28369
28405
  destination = operation.destination;
28370
28406
  if (!destinations.has(destination)) {
28371
- _context6.next = 15;
28407
+ _context7.next = 15;
28372
28408
  break;
28373
28409
  }
28374
- return _context6.abrupt("continue", 33);
28410
+ return _context7.abrupt("continue", 33);
28375
28411
  case 15:
28376
28412
  destinations.add(destination);
28377
28413
  if (!destination.startsWith("M")) {
28378
- _context6.next = 18;
28414
+ _context7.next = 18;
28379
28415
  break;
28380
28416
  }
28381
- return _context6.abrupt("continue", 33);
28417
+ return _context7.abrupt("continue", 33);
28382
28418
  case 18:
28383
- _context6.prev = 18;
28384
- _context6.next = 21;
28419
+ _context7.prev = 18;
28420
+ _context7.next = 21;
28385
28421
  return this.loadAccount(destination);
28386
28422
  case 21:
28387
- account = _context6.sent;
28423
+ account = _context7.sent;
28388
28424
  if (!(account.data_attr["config.memo_required"] === ACCOUNT_REQUIRES_MEMO)) {
28389
- _context6.next = 24;
28425
+ _context7.next = 24;
28390
28426
  break;
28391
28427
  }
28392
28428
  throw new errors/* AccountRequiresMemoError */.Cu("account requires memo", destination, i);
28393
28429
  case 24:
28394
- _context6.next = 33;
28430
+ _context7.next = 33;
28395
28431
  break;
28396
28432
  case 26:
28397
- _context6.prev = 26;
28398
- _context6.t1 = _context6["catch"](18);
28399
- if (!(_context6.t1 instanceof errors/* AccountRequiresMemoError */.Cu)) {
28400
- _context6.next = 30;
28433
+ _context7.prev = 26;
28434
+ _context7.t1 = _context7["catch"](18);
28435
+ if (!(_context7.t1 instanceof errors/* AccountRequiresMemoError */.Cu)) {
28436
+ _context7.next = 30;
28401
28437
  break;
28402
28438
  }
28403
- throw _context6.t1;
28439
+ throw _context7.t1;
28404
28440
  case 30:
28405
- if (_context6.t1 instanceof errors/* NotFoundError */.m_) {
28406
- _context6.next = 32;
28441
+ if (_context7.t1 instanceof errors/* NotFoundError */.m_) {
28442
+ _context7.next = 32;
28407
28443
  break;
28408
28444
  }
28409
- throw _context6.t1;
28445
+ throw _context7.t1;
28410
28446
  case 32:
28411
- return _context6.abrupt("continue", 33);
28447
+ return _context7.abrupt("continue", 33);
28412
28448
  case 33:
28413
- i++;
28414
- _context6.next = 5;
28449
+ i += 1;
28450
+ _context7.next = 5;
28415
28451
  break;
28416
28452
  case 36:
28417
28453
  case "end":
28418
- return _context6.stop();
28454
+ return _context7.stop();
28419
28455
  }
28420
- }, _callee6, this, [[18, 26]]);
28456
+ }, _callee7, this, [[18, 26]]);
28421
28457
  }));
28422
- function checkMemoRequired(_x4) {
28458
+ function checkMemoRequired(_x5) {
28423
28459
  return _checkMemoRequired.apply(this, arguments);
28424
28460
  }
28425
28461
  return checkMemoRequired;
@@ -28469,7 +28505,7 @@ __webpack_require__.r(__webpack_exports__);
28469
28505
  /* harmony import */ var _friendbot__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8242);
28470
28506
  /* harmony import */ var _horizon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2731);
28471
28507
  /* harmony import */ var _rpc__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1660);
28472
- /* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(145);
28508
+ /* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(6299);
28473
28509
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(356);
28474
28510
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__);
28475
28511
  /* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
@@ -28594,8 +28630,10 @@ __webpack_require__.r(__webpack_exports__);
28594
28630
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
28595
28631
  /* harmony export */ $D: () => (/* binding */ parseRawLedgerEntries),
28596
28632
  /* harmony export */ Af: () => (/* binding */ parseRawSendTransaction),
28633
+ /* harmony export */ WC: () => (/* binding */ parseTransactionInfo),
28597
28634
  /* harmony export */ fG: () => (/* binding */ parseRawEvents),
28598
- /* harmony export */ jr: () => (/* binding */ parseRawSimulation)
28635
+ /* harmony export */ jr: () => (/* binding */ parseRawSimulation),
28636
+ /* harmony export */ tR: () => (/* binding */ parseRawTransactions)
28599
28637
  /* harmony export */ });
28600
28638
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(356);
28601
28639
  /* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__);
@@ -28613,7 +28651,7 @@ function parseRawSendTransaction(r) {
28613
28651
  diagnosticEventsXdr = r.diagnosticEventsXdr;
28614
28652
  delete r.errorResultXdr;
28615
28653
  delete r.diagnosticEventsXdr;
28616
- if (!!errorResultXdr) {
28654
+ if (errorResultXdr) {
28617
28655
  return _objectSpread(_objectSpread(_objectSpread({}, r), diagnosticEventsXdr !== undefined && diagnosticEventsXdr.length > 0 && {
28618
28656
  diagnosticEvents: diagnosticEventsXdr.map(function (evt) {
28619
28657
  return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
@@ -28624,6 +28662,33 @@ function parseRawSendTransaction(r) {
28624
28662
  }
28625
28663
  return _objectSpread({}, r);
28626
28664
  }
28665
+ function parseTransactionInfo(raw) {
28666
+ var meta = _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.TransactionMeta.fromXDR(raw.resultMetaXdr, 'base64');
28667
+ var info = {
28668
+ ledger: raw.ledger,
28669
+ createdAt: raw.createdAt,
28670
+ applicationOrder: raw.applicationOrder,
28671
+ feeBump: raw.feeBump,
28672
+ envelopeXdr: _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.TransactionEnvelope.fromXDR(raw.envelopeXdr, 'base64'),
28673
+ resultXdr: _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.TransactionResult.fromXDR(raw.resultXdr, 'base64'),
28674
+ resultMetaXdr: meta
28675
+ };
28676
+ if (meta.switch() === 3 && meta.v3().sorobanMeta() !== null) {
28677
+ var _meta$v3$sorobanMeta;
28678
+ info.returnValue = (_meta$v3$sorobanMeta = meta.v3().sorobanMeta()) === null || _meta$v3$sorobanMeta === void 0 ? void 0 : _meta$v3$sorobanMeta.returnValue();
28679
+ }
28680
+ if ('diagnosticEventsXdr' in raw && raw.diagnosticEventsXdr) {
28681
+ info.diagnosticEventsXdr = raw.diagnosticEventsXdr.map(function (diagnosticEvent) {
28682
+ return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(diagnosticEvent, 'base64');
28683
+ });
28684
+ }
28685
+ return info;
28686
+ }
28687
+ function parseRawTransactions(r) {
28688
+ return _objectSpread({
28689
+ status: r.status
28690
+ }, parseTransactionInfo(r));
28691
+ }
28627
28692
  function parseRawEvents(r) {
28628
28693
  var _r$events;
28629
28694
  return {
@@ -28660,27 +28725,6 @@ function parseRawLedgerEntries(raw) {
28660
28725
  })
28661
28726
  };
28662
28727
  }
28663
- function parseRawSimulation(sim) {
28664
- var _sim$events$map, _sim$events;
28665
- var looksRaw = _api__WEBPACK_IMPORTED_MODULE_1__/* .Api */ .j.isSimulationRaw(sim);
28666
- if (!looksRaw) {
28667
- return sim;
28668
- }
28669
- var base = {
28670
- _parsed: true,
28671
- id: sim.id,
28672
- latestLedger: sim.latestLedger,
28673
- events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
28674
- return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
28675
- })) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
28676
- };
28677
- if (typeof sim.error === 'string') {
28678
- return _objectSpread(_objectSpread({}, base), {}, {
28679
- error: sim.error
28680
- });
28681
- }
28682
- return parseSuccessful(sim, base);
28683
- }
28684
28728
  function parseSuccessful(sim, partial) {
28685
28729
  var _sim$results$length, _sim$results, _sim$stateChanges$len, _sim$stateChanges, _sim$stateChanges2;
28686
28730
  var success = _objectSpread(_objectSpread(_objectSpread({}, partial), {}, {
@@ -28694,7 +28738,7 @@ function parseSuccessful(sim, partial) {
28694
28738
  auth: ((_row$auth = row.auth) !== null && _row$auth !== void 0 ? _row$auth : []).map(function (entry) {
28695
28739
  return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64');
28696
28740
  }),
28697
- retval: !!row.xdr ? _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.ScVal.scvVoid()
28741
+ retval: row.xdr ? _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.ScVal.fromXDR(row.xdr, 'base64') : _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.ScVal.scvVoid()
28698
28742
  };
28699
28743
  })[0]
28700
28744
  }), ((_sim$stateChanges$len = (_sim$stateChanges = sim.stateChanges) === null || _sim$stateChanges === void 0 ? void 0 : _sim$stateChanges.length) !== null && _sim$stateChanges$len !== void 0 ? _sim$stateChanges$len : 0 > 0) && {
@@ -28717,6 +28761,27 @@ function parseSuccessful(sim, partial) {
28717
28761
  }
28718
28762
  });
28719
28763
  }
28764
+ function parseRawSimulation(sim) {
28765
+ var _sim$events$map, _sim$events;
28766
+ var looksRaw = _api__WEBPACK_IMPORTED_MODULE_1__/* .Api */ .j.isSimulationRaw(sim);
28767
+ if (!looksRaw) {
28768
+ return sim;
28769
+ }
28770
+ var base = {
28771
+ _parsed: true,
28772
+ id: sim.id,
28773
+ latestLedger: sim.latestLedger,
28774
+ events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
28775
+ return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
28776
+ })) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
28777
+ };
28778
+ if (typeof sim.error === 'string') {
28779
+ return _objectSpread(_objectSpread({}, base), {}, {
28780
+ error: sim.error
28781
+ });
28782
+ }
28783
+ return parseSuccessful(sim, base);
28784
+ }
28720
28785
 
28721
28786
  /***/ }),
28722
28787
 
@@ -28746,6 +28811,9 @@ function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _r
28746
28811
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
28747
28812
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
28748
28813
 
28814
+ function jsonrpc_hasOwnProperty(obj, prop) {
28815
+ return obj.hasOwnProperty(prop);
28816
+ }
28749
28817
  function postObject(_x, _x2) {
28750
28818
  return _postObject.apply(this, arguments);
28751
28819
  }
@@ -28783,9 +28851,6 @@ function _postObject() {
28783
28851
  }));
28784
28852
  return _postObject.apply(this, arguments);
28785
28853
  }
28786
- function jsonrpc_hasOwnProperty(obj, prop) {
28787
- return obj.hasOwnProperty(prop);
28788
- }
28789
28854
  // EXTERNAL MODULE: ./src/rpc/api.ts
28790
28855
  var api = __webpack_require__(4076);
28791
28856
  // EXTERNAL MODULE: ./src/rpc/transaction.ts
@@ -28795,9 +28860,6 @@ var parsers = __webpack_require__(784);
28795
28860
  ;// CONCATENATED MODULE: ./src/rpc/server.ts
28796
28861
  /* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"];
28797
28862
  function server_typeof(o) { "@babel/helpers - typeof"; return server_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, server_typeof(o); }
28798
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
28799
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
28800
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
28801
28863
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
28802
28864
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
28803
28865
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -28822,12 +28884,37 @@ var Durability = function (Durability) {
28822
28884
  Durability["Persistent"] = "persistent";
28823
28885
  return Durability;
28824
28886
  }({});
28887
+ function findCreatedAccountSequenceInTransactionMeta(meta) {
28888
+ var _operations$flatMap$f;
28889
+ var operations = [];
28890
+ switch (meta.switch()) {
28891
+ case 0:
28892
+ operations = meta.operations();
28893
+ break;
28894
+ case 1:
28895
+ case 2:
28896
+ case 3:
28897
+ operations = meta.value().operations();
28898
+ break;
28899
+ default:
28900
+ throw new Error('Unexpected transaction meta switch value');
28901
+ }
28902
+ var sequenceNumber = (_operations$flatMap$f = operations.flatMap(function (op) {
28903
+ return op.changes();
28904
+ }).find(function (c) {
28905
+ return c.switch() === lib.xdr.LedgerEntryChangeType.ledgerEntryCreated() && c.created().data().switch() === lib.xdr.LedgerEntryType.account();
28906
+ })) === null || _operations$flatMap$f === void 0 || (_operations$flatMap$f = _operations$flatMap$f.created()) === null || _operations$flatMap$f === void 0 || (_operations$flatMap$f = _operations$flatMap$f.data()) === null || _operations$flatMap$f === void 0 || (_operations$flatMap$f = _operations$flatMap$f.account()) === null || _operations$flatMap$f === void 0 || (_operations$flatMap$f = _operations$flatMap$f.seqNum()) === null || _operations$flatMap$f === void 0 ? void 0 : _operations$flatMap$f.toString();
28907
+ if (sequenceNumber) {
28908
+ return sequenceNumber;
28909
+ }
28910
+ throw new Error('No account created in transaction');
28911
+ }
28825
28912
  var Server = function () {
28826
28913
  function Server(serverURL) {
28827
28914
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28828
28915
  _classCallCheck(this, Server);
28829
28916
  this.serverURL = URI_default()(serverURL);
28830
- if (opts.headers && Object.keys(opts.headers).length === 0) {
28917
+ if (opts.headers && Object.keys(opts.headers).length !== 0) {
28831
28918
  axios/* default */.Ay.interceptors.request.use(function (config) {
28832
28919
  config.headers = Object.assign(config.headers, opts.headers);
28833
28920
  return config;
@@ -29110,19 +29197,7 @@ var Server = function () {
29110
29197
  return _context8.abrupt("return", this._getTransaction(hash).then(function (raw) {
29111
29198
  var foundInfo = {};
29112
29199
  if (raw.status !== api/* Api */.j.GetTransactionStatus.NOT_FOUND) {
29113
- var _meta$v3$sorobanMeta;
29114
- var meta = lib.xdr.TransactionMeta.fromXDR(raw.resultMetaXdr, 'base64');
29115
- foundInfo = _objectSpread({
29116
- ledger: raw.ledger,
29117
- createdAt: raw.createdAt,
29118
- applicationOrder: raw.applicationOrder,
29119
- feeBump: raw.feeBump,
29120
- envelopeXdr: lib.xdr.TransactionEnvelope.fromXDR(raw.envelopeXdr, 'base64'),
29121
- resultXdr: lib.xdr.TransactionResult.fromXDR(raw.resultXdr, 'base64'),
29122
- resultMetaXdr: meta
29123
- }, meta.switch() === 3 && meta.v3().sorobanMeta() !== null && raw.status === api/* Api */.j.GetTransactionStatus.SUCCESS && {
29124
- returnValue: (_meta$v3$sorobanMeta = meta.v3().sorobanMeta()) === null || _meta$v3$sorobanMeta === void 0 ? void 0 : _meta$v3$sorobanMeta.returnValue()
29125
- });
29200
+ Object.assign(foundInfo, (0,parsers/* parseTransactionInfo */.WC)(raw));
29126
29201
  }
29127
29202
  var result = _objectSpread({
29128
29203
  status: raw.status,
@@ -29166,20 +29241,68 @@ var Server = function () {
29166
29241
  return _getTransaction;
29167
29242
  }()
29168
29243
  }, {
29169
- key: "getEvents",
29244
+ key: "getTransactions",
29170
29245
  value: (function () {
29171
- var _getEvents2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee10(request) {
29246
+ var _getTransactions2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee10(request) {
29172
29247
  return server_regeneratorRuntime().wrap(function _callee10$(_context10) {
29173
29248
  while (1) switch (_context10.prev = _context10.next) {
29174
29249
  case 0:
29175
- return _context10.abrupt("return", this._getEvents(request).then(parsers/* parseRawEvents */.fG));
29250
+ return _context10.abrupt("return", this._getTransactions(request).then(function (raw) {
29251
+ var result = {
29252
+ transactions: raw.transactions.map(parsers/* parseRawTransactions */.tR),
29253
+ latestLedger: raw.latestLedger,
29254
+ latestLedgerCloseTimestamp: raw.latestLedgerCloseTimestamp,
29255
+ oldestLedger: raw.oldestLedger,
29256
+ oldestLedgerCloseTimestamp: raw.oldestLedgerCloseTimestamp,
29257
+ cursor: raw.cursor
29258
+ };
29259
+ return result;
29260
+ }));
29176
29261
  case 1:
29177
29262
  case "end":
29178
29263
  return _context10.stop();
29179
29264
  }
29180
29265
  }, _callee10, this);
29181
29266
  }));
29182
- function getEvents(_x8) {
29267
+ function getTransactions(_x8) {
29268
+ return _getTransactions2.apply(this, arguments);
29269
+ }
29270
+ return getTransactions;
29271
+ }())
29272
+ }, {
29273
+ key: "_getTransactions",
29274
+ value: function () {
29275
+ var _getTransactions3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee11(request) {
29276
+ return server_regeneratorRuntime().wrap(function _callee11$(_context11) {
29277
+ while (1) switch (_context11.prev = _context11.next) {
29278
+ case 0:
29279
+ return _context11.abrupt("return", postObject(this.serverURL.toString(), 'getTransactions', request));
29280
+ case 1:
29281
+ case "end":
29282
+ return _context11.stop();
29283
+ }
29284
+ }, _callee11, this);
29285
+ }));
29286
+ function _getTransactions(_x9) {
29287
+ return _getTransactions3.apply(this, arguments);
29288
+ }
29289
+ return _getTransactions;
29290
+ }()
29291
+ }, {
29292
+ key: "getEvents",
29293
+ value: (function () {
29294
+ var _getEvents2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee12(request) {
29295
+ return server_regeneratorRuntime().wrap(function _callee12$(_context12) {
29296
+ while (1) switch (_context12.prev = _context12.next) {
29297
+ case 0:
29298
+ return _context12.abrupt("return", this._getEvents(request).then(parsers/* parseRawEvents */.fG));
29299
+ case 1:
29300
+ case "end":
29301
+ return _context12.stop();
29302
+ }
29303
+ }, _callee12, this);
29304
+ }));
29305
+ function getEvents(_x10) {
29183
29306
  return _getEvents2.apply(this, arguments);
29184
29307
  }
29185
29308
  return getEvents;
@@ -29187,12 +29310,12 @@ var Server = function () {
29187
29310
  }, {
29188
29311
  key: "_getEvents",
29189
29312
  value: function () {
29190
- var _getEvents3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee11(request) {
29313
+ var _getEvents3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee13(request) {
29191
29314
  var _request$filters;
29192
- return server_regeneratorRuntime().wrap(function _callee11$(_context11) {
29193
- while (1) switch (_context11.prev = _context11.next) {
29315
+ return server_regeneratorRuntime().wrap(function _callee13$(_context13) {
29316
+ while (1) switch (_context13.prev = _context13.next) {
29194
29317
  case 0:
29195
- return _context11.abrupt("return", postObject(this.serverURL.toString(), 'getEvents', _objectSpread({
29318
+ return _context13.abrupt("return", postObject(this.serverURL.toString(), 'getEvents', _objectSpread({
29196
29319
  filters: (_request$filters = request.filters) !== null && _request$filters !== void 0 ? _request$filters : [],
29197
29320
  pagination: _objectSpread(_objectSpread({}, request.cursor && {
29198
29321
  cursor: request.cursor
@@ -29204,11 +29327,11 @@ var Server = function () {
29204
29327
  })));
29205
29328
  case 1:
29206
29329
  case "end":
29207
- return _context11.stop();
29330
+ return _context13.stop();
29208
29331
  }
29209
- }, _callee11, this);
29332
+ }, _callee13, this);
29210
29333
  }));
29211
- function _getEvents(_x9) {
29334
+ function _getEvents(_x11) {
29212
29335
  return _getEvents3.apply(this, arguments);
29213
29336
  }
29214
29337
  return _getEvents;
@@ -29216,19 +29339,16 @@ var Server = function () {
29216
29339
  }, {
29217
29340
  key: "getNetwork",
29218
29341
  value: (function () {
29219
- var _getNetwork = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee12() {
29220
- return server_regeneratorRuntime().wrap(function _callee12$(_context12) {
29221
- while (1) switch (_context12.prev = _context12.next) {
29342
+ var _getNetwork = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee14() {
29343
+ return server_regeneratorRuntime().wrap(function _callee14$(_context14) {
29344
+ while (1) switch (_context14.prev = _context14.next) {
29222
29345
  case 0:
29223
- _context12.next = 2;
29224
- return postObject(this.serverURL.toString(), 'getNetwork');
29225
- case 2:
29226
- return _context12.abrupt("return", _context12.sent);
29227
- case 3:
29346
+ return _context14.abrupt("return", postObject(this.serverURL.toString(), 'getNetwork'));
29347
+ case 1:
29228
29348
  case "end":
29229
- return _context12.stop();
29349
+ return _context14.stop();
29230
29350
  }
29231
- }, _callee12, this);
29351
+ }, _callee14, this);
29232
29352
  }));
29233
29353
  function getNetwork() {
29234
29354
  return _getNetwork.apply(this, arguments);
@@ -29238,16 +29358,16 @@ var Server = function () {
29238
29358
  }, {
29239
29359
  key: "getLatestLedger",
29240
29360
  value: (function () {
29241
- var _getLatestLedger = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee13() {
29242
- return server_regeneratorRuntime().wrap(function _callee13$(_context13) {
29243
- while (1) switch (_context13.prev = _context13.next) {
29361
+ var _getLatestLedger = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee15() {
29362
+ return server_regeneratorRuntime().wrap(function _callee15$(_context15) {
29363
+ while (1) switch (_context15.prev = _context15.next) {
29244
29364
  case 0:
29245
- return _context13.abrupt("return", postObject(this.serverURL.toString(), 'getLatestLedger'));
29365
+ return _context15.abrupt("return", postObject(this.serverURL.toString(), 'getLatestLedger'));
29246
29366
  case 1:
29247
29367
  case "end":
29248
- return _context13.stop();
29368
+ return _context15.stop();
29249
29369
  }
29250
- }, _callee13, this);
29370
+ }, _callee15, this);
29251
29371
  }));
29252
29372
  function getLatestLedger() {
29253
29373
  return _getLatestLedger.apply(this, arguments);
@@ -29257,18 +29377,18 @@ var Server = function () {
29257
29377
  }, {
29258
29378
  key: "simulateTransaction",
29259
29379
  value: (function () {
29260
- var _simulateTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee14(tx, addlResources) {
29261
- return server_regeneratorRuntime().wrap(function _callee14$(_context14) {
29262
- while (1) switch (_context14.prev = _context14.next) {
29380
+ var _simulateTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee16(tx, addlResources) {
29381
+ return server_regeneratorRuntime().wrap(function _callee16$(_context16) {
29382
+ while (1) switch (_context16.prev = _context16.next) {
29263
29383
  case 0:
29264
- return _context14.abrupt("return", this._simulateTransaction(tx, addlResources).then(parsers/* parseRawSimulation */.jr));
29384
+ return _context16.abrupt("return", this._simulateTransaction(tx, addlResources).then(parsers/* parseRawSimulation */.jr));
29265
29385
  case 1:
29266
29386
  case "end":
29267
- return _context14.stop();
29387
+ return _context16.stop();
29268
29388
  }
29269
- }, _callee14, this);
29389
+ }, _callee16, this);
29270
29390
  }));
29271
- function simulateTransaction(_x10, _x11) {
29391
+ function simulateTransaction(_x12, _x13) {
29272
29392
  return _simulateTransaction2.apply(this, arguments);
29273
29393
  }
29274
29394
  return simulateTransaction;
@@ -29276,11 +29396,11 @@ var Server = function () {
29276
29396
  }, {
29277
29397
  key: "_simulateTransaction",
29278
29398
  value: function () {
29279
- var _simulateTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee15(transaction, addlResources) {
29280
- return server_regeneratorRuntime().wrap(function _callee15$(_context15) {
29281
- while (1) switch (_context15.prev = _context15.next) {
29399
+ var _simulateTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee17(transaction, addlResources) {
29400
+ return server_regeneratorRuntime().wrap(function _callee17$(_context17) {
29401
+ while (1) switch (_context17.prev = _context17.next) {
29282
29402
  case 0:
29283
- return _context15.abrupt("return", postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
29403
+ return _context17.abrupt("return", postObject(this.serverURL.toString(), 'simulateTransaction', _objectSpread({
29284
29404
  transaction: transaction.toXDR()
29285
29405
  }, addlResources !== undefined && {
29286
29406
  resourceConfig: {
@@ -29289,11 +29409,11 @@ var Server = function () {
29289
29409
  })));
29290
29410
  case 1:
29291
29411
  case "end":
29292
- return _context15.stop();
29412
+ return _context17.stop();
29293
29413
  }
29294
- }, _callee15, this);
29414
+ }, _callee17, this);
29295
29415
  }));
29296
- function _simulateTransaction(_x12, _x13) {
29416
+ function _simulateTransaction(_x14, _x15) {
29297
29417
  return _simulateTransaction3.apply(this, arguments);
29298
29418
  }
29299
29419
  return _simulateTransaction;
@@ -29301,29 +29421,29 @@ var Server = function () {
29301
29421
  }, {
29302
29422
  key: "prepareTransaction",
29303
29423
  value: (function () {
29304
- var _prepareTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee16(tx) {
29424
+ var _prepareTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee18(tx) {
29305
29425
  var simResponse;
29306
- return server_regeneratorRuntime().wrap(function _callee16$(_context16) {
29307
- while (1) switch (_context16.prev = _context16.next) {
29426
+ return server_regeneratorRuntime().wrap(function _callee18$(_context18) {
29427
+ while (1) switch (_context18.prev = _context18.next) {
29308
29428
  case 0:
29309
- _context16.next = 2;
29429
+ _context18.next = 2;
29310
29430
  return this.simulateTransaction(tx);
29311
29431
  case 2:
29312
- simResponse = _context16.sent;
29432
+ simResponse = _context18.sent;
29313
29433
  if (!api/* Api */.j.isSimulationError(simResponse)) {
29314
- _context16.next = 5;
29434
+ _context18.next = 5;
29315
29435
  break;
29316
29436
  }
29317
- throw simResponse.error;
29437
+ throw new Error(simResponse.error);
29318
29438
  case 5:
29319
- return _context16.abrupt("return", (0,transaction/* assembleTransaction */.X)(tx, simResponse).build());
29439
+ return _context18.abrupt("return", (0,transaction/* assembleTransaction */.X)(tx, simResponse).build());
29320
29440
  case 6:
29321
29441
  case "end":
29322
- return _context16.stop();
29442
+ return _context18.stop();
29323
29443
  }
29324
- }, _callee16, this);
29444
+ }, _callee18, this);
29325
29445
  }));
29326
- function prepareTransaction(_x14) {
29446
+ function prepareTransaction(_x16) {
29327
29447
  return _prepareTransaction.apply(this, arguments);
29328
29448
  }
29329
29449
  return prepareTransaction;
@@ -29331,18 +29451,18 @@ var Server = function () {
29331
29451
  }, {
29332
29452
  key: "sendTransaction",
29333
29453
  value: (function () {
29334
- var _sendTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee17(transaction) {
29335
- return server_regeneratorRuntime().wrap(function _callee17$(_context17) {
29336
- while (1) switch (_context17.prev = _context17.next) {
29454
+ var _sendTransaction2 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee19(transaction) {
29455
+ return server_regeneratorRuntime().wrap(function _callee19$(_context19) {
29456
+ while (1) switch (_context19.prev = _context19.next) {
29337
29457
  case 0:
29338
- return _context17.abrupt("return", this._sendTransaction(transaction).then(parsers/* parseRawSendTransaction */.Af));
29458
+ return _context19.abrupt("return", this._sendTransaction(transaction).then(parsers/* parseRawSendTransaction */.Af));
29339
29459
  case 1:
29340
29460
  case "end":
29341
- return _context17.stop();
29461
+ return _context19.stop();
29342
29462
  }
29343
- }, _callee17, this);
29463
+ }, _callee19, this);
29344
29464
  }));
29345
- function sendTransaction(_x15) {
29465
+ function sendTransaction(_x17) {
29346
29466
  return _sendTransaction2.apply(this, arguments);
29347
29467
  }
29348
29468
  return sendTransaction;
@@ -29350,20 +29470,20 @@ var Server = function () {
29350
29470
  }, {
29351
29471
  key: "_sendTransaction",
29352
29472
  value: function () {
29353
- var _sendTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee18(transaction) {
29354
- return server_regeneratorRuntime().wrap(function _callee18$(_context18) {
29355
- while (1) switch (_context18.prev = _context18.next) {
29473
+ var _sendTransaction3 = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee20(transaction) {
29474
+ return server_regeneratorRuntime().wrap(function _callee20$(_context20) {
29475
+ while (1) switch (_context20.prev = _context20.next) {
29356
29476
  case 0:
29357
- return _context18.abrupt("return", postObject(this.serverURL.toString(), 'sendTransaction', {
29477
+ return _context20.abrupt("return", postObject(this.serverURL.toString(), 'sendTransaction', {
29358
29478
  transaction: transaction.toXDR()
29359
29479
  }));
29360
29480
  case 1:
29361
29481
  case "end":
29362
- return _context18.stop();
29482
+ return _context20.stop();
29363
29483
  }
29364
- }, _callee18, this);
29484
+ }, _callee20, this);
29365
29485
  }));
29366
- function _sendTransaction(_x16) {
29486
+ function _sendTransaction(_x18) {
29367
29487
  return _sendTransaction3.apply(this, arguments);
29368
29488
  }
29369
29489
  return _sendTransaction;
@@ -29371,110 +29491,102 @@ var Server = function () {
29371
29491
  }, {
29372
29492
  key: "requestAirdrop",
29373
29493
  value: (function () {
29374
- var _requestAirdrop = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee19(address, friendbotUrl) {
29494
+ var _requestAirdrop = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee21(address, friendbotUrl) {
29375
29495
  var account, response, meta, sequence, _error$response, _error$response$detai;
29376
- return server_regeneratorRuntime().wrap(function _callee19$(_context19) {
29377
- while (1) switch (_context19.prev = _context19.next) {
29496
+ return server_regeneratorRuntime().wrap(function _callee21$(_context21) {
29497
+ while (1) switch (_context21.prev = _context21.next) {
29378
29498
  case 0:
29379
29499
  account = typeof address === 'string' ? address : address.accountId();
29380
- _context19.t0 = friendbotUrl;
29381
- if (_context19.t0) {
29382
- _context19.next = 6;
29500
+ _context21.t0 = friendbotUrl;
29501
+ if (_context21.t0) {
29502
+ _context21.next = 6;
29383
29503
  break;
29384
29504
  }
29385
- _context19.next = 5;
29505
+ _context21.next = 5;
29386
29506
  return this.getNetwork();
29387
29507
  case 5:
29388
- _context19.t0 = _context19.sent.friendbotUrl;
29508
+ _context21.t0 = _context21.sent.friendbotUrl;
29389
29509
  case 6:
29390
- friendbotUrl = _context19.t0;
29510
+ friendbotUrl = _context21.t0;
29391
29511
  if (friendbotUrl) {
29392
- _context19.next = 9;
29512
+ _context21.next = 9;
29393
29513
  break;
29394
29514
  }
29395
29515
  throw new Error('No friendbot URL configured for current network');
29396
29516
  case 9:
29397
- _context19.prev = 9;
29398
- _context19.next = 12;
29517
+ _context21.prev = 9;
29518
+ _context21.next = 12;
29399
29519
  return axios/* default */.Ay.post("".concat(friendbotUrl, "?addr=").concat(encodeURIComponent(account)));
29400
29520
  case 12:
29401
- response = _context19.sent;
29521
+ response = _context21.sent;
29402
29522
  meta = lib.xdr.TransactionMeta.fromXDR(response.data.result_meta_xdr, 'base64');
29403
29523
  sequence = findCreatedAccountSequenceInTransactionMeta(meta);
29404
- return _context19.abrupt("return", new lib.Account(account, sequence));
29524
+ return _context21.abrupt("return", new lib.Account(account, sequence));
29405
29525
  case 18:
29406
- _context19.prev = 18;
29407
- _context19.t1 = _context19["catch"](9);
29408
- if (!(((_error$response = _context19.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
29409
- _context19.next = 23;
29526
+ _context21.prev = 18;
29527
+ _context21.t1 = _context21["catch"](9);
29528
+ if (!(((_error$response = _context21.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 400)) {
29529
+ _context21.next = 23;
29410
29530
  break;
29411
29531
  }
29412
- if (!((_error$response$detai = _context19.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
29413
- _context19.next = 23;
29532
+ if (!((_error$response$detai = _context21.t1.response.detail) !== null && _error$response$detai !== void 0 && _error$response$detai.includes('createAccountAlreadyExist'))) {
29533
+ _context21.next = 23;
29414
29534
  break;
29415
29535
  }
29416
- return _context19.abrupt("return", this.getAccount(account));
29536
+ return _context21.abrupt("return", this.getAccount(account));
29417
29537
  case 23:
29418
- throw _context19.t1;
29538
+ throw _context21.t1;
29419
29539
  case 24:
29420
29540
  case "end":
29421
- return _context19.stop();
29541
+ return _context21.stop();
29422
29542
  }
29423
- }, _callee19, this, [[9, 18]]);
29543
+ }, _callee21, this, [[9, 18]]);
29424
29544
  }));
29425
- function requestAirdrop(_x17, _x18) {
29545
+ function requestAirdrop(_x19, _x20) {
29426
29546
  return _requestAirdrop.apply(this, arguments);
29427
29547
  }
29428
29548
  return requestAirdrop;
29429
29549
  }())
29430
- }]);
29431
- }();
29432
- function findCreatedAccountSequenceInTransactionMeta(meta) {
29433
- var operations = [];
29434
- switch (meta.switch()) {
29435
- case 0:
29436
- operations = meta.operations();
29437
- break;
29438
- case 1:
29439
- case 2:
29440
- case 3:
29441
- operations = meta.value().operations();
29442
- break;
29443
- default:
29444
- throw new Error('Unexpected transaction meta switch value');
29445
- }
29446
- var _iterator = _createForOfIteratorHelper(operations),
29447
- _step;
29448
- try {
29449
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
29450
- var op = _step.value;
29451
- var _iterator2 = _createForOfIteratorHelper(op.changes()),
29452
- _step2;
29453
- try {
29454
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
29455
- var c = _step2.value;
29456
- if (c.switch() !== lib.xdr.LedgerEntryChangeType.ledgerEntryCreated()) {
29457
- continue;
29550
+ }, {
29551
+ key: "getFeeStats",
29552
+ value: (function () {
29553
+ var _getFeeStats = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee22() {
29554
+ return server_regeneratorRuntime().wrap(function _callee22$(_context22) {
29555
+ while (1) switch (_context22.prev = _context22.next) {
29556
+ case 0:
29557
+ return _context22.abrupt("return", postObject(this.serverURL.toString(), 'getFeeStats'));
29558
+ case 1:
29559
+ case "end":
29560
+ return _context22.stop();
29458
29561
  }
29459
- var data = c.created().data();
29460
- if (data.switch() !== lib.xdr.LedgerEntryType.account()) {
29461
- continue;
29562
+ }, _callee22, this);
29563
+ }));
29564
+ function getFeeStats() {
29565
+ return _getFeeStats.apply(this, arguments);
29566
+ }
29567
+ return getFeeStats;
29568
+ }())
29569
+ }, {
29570
+ key: "getVersionInfo",
29571
+ value: (function () {
29572
+ var _getVersionInfo = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee23() {
29573
+ return server_regeneratorRuntime().wrap(function _callee23$(_context23) {
29574
+ while (1) switch (_context23.prev = _context23.next) {
29575
+ case 0:
29576
+ return _context23.abrupt("return", postObject(this.serverURL.toString(), 'getVersionInfo'));
29577
+ case 1:
29578
+ case "end":
29579
+ return _context23.stop();
29462
29580
  }
29463
- return data.account().seqNum().toString();
29464
- }
29465
- } catch (err) {
29466
- _iterator2.e(err);
29467
- } finally {
29468
- _iterator2.f();
29581
+ }, _callee23, this);
29582
+ }));
29583
+ function getVersionInfo() {
29584
+ return _getVersionInfo.apply(this, arguments);
29469
29585
  }
29470
- }
29471
- } catch (err) {
29472
- _iterator.e(err);
29473
- } finally {
29474
- _iterator.f();
29475
- }
29476
- throw new Error('No account created in transaction');
29477
- }
29586
+ return getVersionInfo;
29587
+ }())
29588
+ }]);
29589
+ }();
29478
29590
 
29479
29591
  /***/ }),
29480
29592
 
@@ -29492,8 +29604,20 @@ function findCreatedAccountSequenceInTransactionMeta(meta) {
29492
29604
 
29493
29605
 
29494
29606
 
29607
+ function isSorobanTransaction(tx) {
29608
+ if (tx.operations.length !== 1) {
29609
+ return false;
29610
+ }
29611
+ switch (tx.operations[0].type) {
29612
+ case 'invokeHostFunction':
29613
+ case 'extendFootprintTtl':
29614
+ case 'restoreFootprint':
29615
+ return true;
29616
+ default:
29617
+ return false;
29618
+ }
29619
+ }
29495
29620
  function assembleTransaction(raw, simulation) {
29496
- var _invokeOp$auth;
29497
29621
  if ('innerTransaction' in raw) {
29498
29622
  return assembleTransaction(raw.innerTransaction, simulation);
29499
29623
  }
@@ -29511,33 +29635,19 @@ function assembleTransaction(raw, simulation) {
29511
29635
  sorobanData: success.transactionData.build(),
29512
29636
  networkPassphrase: raw.networkPassphrase
29513
29637
  });
29514
- switch (raw.operations[0].type) {
29515
- case 'invokeHostFunction':
29516
- txnBuilder.clearOperations();
29517
- var invokeOp = raw.operations[0];
29518
- var existingAuth = (_invokeOp$auth = invokeOp.auth) !== null && _invokeOp$auth !== void 0 ? _invokeOp$auth : [];
29519
- txnBuilder.addOperation(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.Operation.invokeHostFunction({
29520
- source: invokeOp.source,
29521
- func: invokeOp.func,
29522
- auth: existingAuth.length > 0 ? existingAuth : success.result.auth
29523
- }));
29524
- break;
29638
+ if (raw.operations[0].type === 'invokeHostFunction') {
29639
+ var _invokeOp$auth;
29640
+ txnBuilder.clearOperations();
29641
+ var invokeOp = raw.operations[0];
29642
+ var existingAuth = (_invokeOp$auth = invokeOp.auth) !== null && _invokeOp$auth !== void 0 ? _invokeOp$auth : [];
29643
+ txnBuilder.addOperation(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.Operation.invokeHostFunction({
29644
+ source: invokeOp.source,
29645
+ func: invokeOp.func,
29646
+ auth: existingAuth.length > 0 ? existingAuth : success.result.auth
29647
+ }));
29525
29648
  }
29526
29649
  return txnBuilder;
29527
29650
  }
29528
- function isSorobanTransaction(tx) {
29529
- if (tx.operations.length !== 1) {
29530
- return false;
29531
- }
29532
- switch (tx.operations[0].type) {
29533
- case 'invokeHostFunction':
29534
- case 'extendFootprintTtl':
29535
- case 'restoreFootprint':
29536
- return true;
29537
- default:
29538
- return false;
29539
- }
29540
- }
29541
29651
 
29542
29652
  /***/ }),
29543
29653
 
@@ -29925,7 +30035,7 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
29925
30035
  try {
29926
30036
  serverKP = lib.Keypair.fromPublicKey(serverAccountID);
29927
30037
  } catch (err) {
29928
- throw new Error("Couldn't infer keypair from the provided 'serverAccountID': " + err.message);
30038
+ throw new Error("Couldn't infer keypair from the provided 'serverAccountID': ".concat(err.message));
29929
30039
  }
29930
30040
  var clientSigners = new Set();
29931
30041
  var _iterator2 = _createForOfIteratorHelper(signers),
@@ -29984,7 +30094,7 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
29984
30094
  }
29985
30095
  }
29986
30096
  if (!serverSignatureFound) {
29987
- throw new InvalidChallengeError("Transaction not signed by server: '" + serverKP.publicKey() + "'");
30097
+ throw new InvalidChallengeError("Transaction not signed by server: '".concat(serverKP.publicKey(), "'"));
29988
30098
  }
29989
30099
  if (clientSigningKey && !clientSigningKeySignatureFound) {
29990
30100
  throw new InvalidChallengeError("Transaction not signed by the source account of the 'client_domain' " + "ManageData operation");
@@ -30020,7 +30130,7 @@ function gatherTxSigners(transaction, signers) {
30020
30130
  try {
30021
30131
  keypair = lib.Keypair.fromPublicKey(signer);
30022
30132
  } catch (err) {
30023
- throw new InvalidChallengeError("Signer is not a valid address: " + err.message);
30133
+ throw new InvalidChallengeError("Signer is not a valid address: ".concat(err.message));
30024
30134
  }
30025
30135
  for (var i = 0; i < txSignatures.length; i++) {
30026
30136
  var decSig = txSignatures[i];
@@ -38223,7 +38333,10 @@ module.exports = function inspect_(obj, options, depth, seen) {
38223
38333
  if (typeof window !== 'undefined' && obj === window) {
38224
38334
  return '{ [object Window] }';
38225
38335
  }
38226
- if (obj === __webpack_require__.g) {
38336
+ if (
38337
+ (typeof globalThis !== 'undefined' && obj === globalThis)
38338
+ || (typeof __webpack_require__.g !== 'undefined' && obj === __webpack_require__.g)
38339
+ ) {
38227
38340
  return '{ [object globalThis] }';
38228
38341
  }
38229
38342
  if (!isDate(obj) && !isRegExp(obj)) {
@@ -38609,6 +38722,7 @@ var defaults = {
38609
38722
  parameterLimit: 1000,
38610
38723
  parseArrays: true,
38611
38724
  plainObjects: false,
38725
+ strictDepth: false,
38612
38726
  strictNullHandling: false
38613
38727
  };
38614
38728
 
@@ -38640,6 +38754,7 @@ var parseValues = function parseQueryStringValues(str, options) {
38640
38754
  var obj = { __proto__: null };
38641
38755
 
38642
38756
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
38757
+ cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
38643
38758
  var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
38644
38759
  var parts = cleanStr.split(options.delimiter, limit);
38645
38760
  var skipIndex = -1; // Keep track of where the utf8 sentinel was found
@@ -38710,7 +38825,9 @@ var parseObject = function (chain, val, options, valuesParsed) {
38710
38825
  var root = chain[i];
38711
38826
 
38712
38827
  if (root === '[]' && options.parseArrays) {
38713
- obj = options.allowEmptyArrays && leaf === '' ? [] : [].concat(leaf);
38828
+ obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
38829
+ ? []
38830
+ : [].concat(leaf);
38714
38831
  } else {
38715
38832
  obj = options.plainObjects ? Object.create(null) : {};
38716
38833
  var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
@@ -38783,9 +38900,12 @@ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesPars
38783
38900
  keys.push(segment[1]);
38784
38901
  }
38785
38902
 
38786
- // If there's a remainder, just add whatever is left
38903
+ // If there's a remainder, check strictDepth option for throw, else just add whatever is left
38787
38904
 
38788
38905
  if (segment) {
38906
+ if (options.strictDepth === true) {
38907
+ throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
38908
+ }
38789
38909
  keys.push('[' + key.slice(segment.index) + ']');
38790
38910
  }
38791
38911
 
@@ -38842,6 +38962,7 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
38842
38962
  parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
38843
38963
  parseArrays: opts.parseArrays !== false,
38844
38964
  plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
38965
+ strictDepth: typeof opts.strictDepth === 'boolean' ? !!opts.strictDepth : defaults.strictDepth,
38845
38966
  strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
38846
38967
  };
38847
38968
  };
@@ -55248,6 +55369,7 @@ __webpack_require__.d(common_utils_namespaceObject, {
55248
55369
  hasBrowserEnv: () => (hasBrowserEnv),
55249
55370
  hasStandardBrowserEnv: () => (hasStandardBrowserEnv),
55250
55371
  hasStandardBrowserWebWorkerEnv: () => (hasStandardBrowserWebWorkerEnv),
55372
+ navigator: () => (_navigator),
55251
55373
  origin: () => (origin)
55252
55374
  });
55253
55375
 
@@ -55932,6 +56054,36 @@ const isAsyncFn = kindOfTest('AsyncFunction');
55932
56054
  const isThenable = (thing) =>
55933
56055
  thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
55934
56056
 
56057
+ // original code
56058
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
56059
+
56060
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
56061
+ if (setImmediateSupported) {
56062
+ return setImmediate;
56063
+ }
56064
+
56065
+ return postMessageSupported ? ((token, callbacks) => {
56066
+ _global.addEventListener("message", ({source, data}) => {
56067
+ if (source === _global && data === token) {
56068
+ callbacks.length && callbacks.shift()();
56069
+ }
56070
+ }, false);
56071
+
56072
+ return (cb) => {
56073
+ callbacks.push(cb);
56074
+ _global.postMessage(token, "*");
56075
+ }
56076
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
56077
+ })(
56078
+ typeof setImmediate === 'function',
56079
+ isFunction(_global.postMessage)
56080
+ );
56081
+
56082
+ const asap = typeof queueMicrotask !== 'undefined' ?
56083
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
56084
+
56085
+ // *********************
56086
+
55935
56087
  /* harmony default export */ const utils = ({
55936
56088
  isArray,
55937
56089
  isArrayBuffer,
@@ -55987,7 +56139,9 @@ const isThenable = (thing) =>
55987
56139
  isSpecCompliantForm,
55988
56140
  toJSONObject,
55989
56141
  isAsyncFn,
55990
- isThenable
56142
+ isThenable,
56143
+ setImmediate: _setImmediate,
56144
+ asap
55991
56145
  });
55992
56146
 
55993
56147
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/core/AxiosError.js
@@ -56020,7 +56174,10 @@ function AxiosError(message, code, config, request, response) {
56020
56174
  code && (this.code = code);
56021
56175
  config && (this.config = config);
56022
56176
  request && (this.request = request);
56023
- response && (this.response = response);
56177
+ if (response) {
56178
+ this.response = response;
56179
+ this.status = response.status ? response.status : null;
56180
+ }
56024
56181
  }
56025
56182
 
56026
56183
  utils.inherits(AxiosError, Error, {
@@ -56040,7 +56197,7 @@ utils.inherits(AxiosError, Error, {
56040
56197
  // Axios
56041
56198
  config: utils.toJSONObject(this.config),
56042
56199
  code: this.code,
56043
- status: this.response && this.response.status ? this.response.status : null
56200
+ status: this.status
56044
56201
  };
56045
56202
  }
56046
56203
  });
@@ -56559,6 +56716,8 @@ class InterceptorManager {
56559
56716
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/platform/common/utils.js
56560
56717
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
56561
56718
 
56719
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
56720
+
56562
56721
  /**
56563
56722
  * Determine if we're running in a standard browser environment
56564
56723
  *
@@ -56576,10 +56735,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
56576
56735
  *
56577
56736
  * @returns {boolean}
56578
56737
  */
56579
- const hasStandardBrowserEnv = (
56580
- (product) => {
56581
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
56582
- })(typeof navigator !== 'undefined' && navigator.product);
56738
+ const hasStandardBrowserEnv = hasBrowserEnv &&
56739
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
56583
56740
 
56584
56741
  /**
56585
56742
  * Determine if we're running in a standard browser webWorker environment
@@ -57412,8 +57569,6 @@ function speedometer(samplesCount, min) {
57412
57569
  /* harmony default export */ const helpers_speedometer = (speedometer);
57413
57570
 
57414
57571
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/throttle.js
57415
-
57416
-
57417
57572
  /**
57418
57573
  * Throttle decorator
57419
57574
  * @param {Function} fn
@@ -57422,28 +57577,39 @@ function speedometer(samplesCount, min) {
57422
57577
  */
57423
57578
  function throttle(fn, freq) {
57424
57579
  let timestamp = 0;
57425
- const threshold = 1000 / freq;
57426
- let timer = null;
57427
- return function throttled() {
57428
- const force = this === true;
57580
+ let threshold = 1000 / freq;
57581
+ let lastArgs;
57582
+ let timer;
57583
+
57584
+ const invoke = (args, now = Date.now()) => {
57585
+ timestamp = now;
57586
+ lastArgs = null;
57587
+ if (timer) {
57588
+ clearTimeout(timer);
57589
+ timer = null;
57590
+ }
57591
+ fn.apply(null, args);
57592
+ }
57429
57593
 
57594
+ const throttled = (...args) => {
57430
57595
  const now = Date.now();
57431
- if (force || now - timestamp > threshold) {
57432
- if (timer) {
57433
- clearTimeout(timer);
57434
- timer = null;
57596
+ const passed = now - timestamp;
57597
+ if ( passed >= threshold) {
57598
+ invoke(args, now);
57599
+ } else {
57600
+ lastArgs = args;
57601
+ if (!timer) {
57602
+ timer = setTimeout(() => {
57603
+ timer = null;
57604
+ invoke(lastArgs)
57605
+ }, threshold - passed);
57435
57606
  }
57436
- timestamp = now;
57437
- return fn.apply(null, arguments);
57438
57607
  }
57439
- if (!timer) {
57440
- timer = setTimeout(() => {
57441
- timer = null;
57442
- timestamp = Date.now();
57443
- return fn.apply(null, arguments);
57444
- }, threshold - (now - timestamp));
57445
- }
57446
- };
57608
+ }
57609
+
57610
+ const flush = () => lastArgs && invoke(lastArgs);
57611
+
57612
+ return [throttled, flush];
57447
57613
  }
57448
57614
 
57449
57615
  /* harmony default export */ const helpers_throttle = (throttle);
@@ -57452,7 +57618,8 @@ function throttle(fn, freq) {
57452
57618
 
57453
57619
 
57454
57620
 
57455
- /* harmony default export */ const progressEventReducer = ((listener, isDownloadStream, freq = 3) => {
57621
+
57622
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
57456
57623
  let bytesNotified = 0;
57457
57624
  const _speedometer = helpers_speedometer(50, 250);
57458
57625
 
@@ -57473,14 +57640,25 @@ function throttle(fn, freq) {
57473
57640
  rate: rate ? rate : undefined,
57474
57641
  estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
57475
57642
  event: e,
57476
- lengthComputable: total != null
57643
+ lengthComputable: total != null,
57644
+ [isDownloadStream ? 'download' : 'upload']: true
57477
57645
  };
57478
57646
 
57479
- data[isDownloadStream ? 'download' : 'upload'] = true;
57480
-
57481
57647
  listener(data);
57482
57648
  }, freq);
57483
- });
57649
+ }
57650
+
57651
+ const progressEventDecorator = (total, throttled) => {
57652
+ const lengthComputable = total != null;
57653
+
57654
+ return [(loaded) => throttled[0]({
57655
+ lengthComputable,
57656
+ total,
57657
+ loaded
57658
+ }), throttled[1]];
57659
+ }
57660
+
57661
+ const asyncDecorator = (fn) => (...args) => utils.asap(() => fn(...args));
57484
57662
 
57485
57663
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/isURLSameOrigin.js
57486
57664
 
@@ -57493,7 +57671,7 @@ function throttle(fn, freq) {
57493
57671
  // Standard browser envs have full support of the APIs needed to test
57494
57672
  // whether the request URL is of the same origin as current location.
57495
57673
  (function standardBrowserEnv() {
57496
- const msie = /(msie|trident)/i.test(navigator.userAgent);
57674
+ const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
57497
57675
  const urlParsingNode = document.createElement('a');
57498
57676
  let originURL;
57499
57677
 
@@ -57838,16 +58016,18 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57838
58016
  const _config = resolveConfig(config);
57839
58017
  let requestData = _config.data;
57840
58018
  const requestHeaders = core_AxiosHeaders.from(_config.headers).normalize();
57841
- let {responseType} = _config;
58019
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
57842
58020
  let onCanceled;
58021
+ let uploadThrottled, downloadThrottled;
58022
+ let flushUpload, flushDownload;
58023
+
57843
58024
  function done() {
57844
- if (_config.cancelToken) {
57845
- _config.cancelToken.unsubscribe(onCanceled);
57846
- }
58025
+ flushUpload && flushUpload(); // flush events
58026
+ flushDownload && flushDownload(); // flush events
57847
58027
 
57848
- if (_config.signal) {
57849
- _config.signal.removeEventListener('abort', onCanceled);
57850
- }
58028
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
58029
+
58030
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
57851
58031
  }
57852
58032
 
57853
58033
  let request = new XMLHttpRequest();
@@ -57917,7 +58097,7 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57917
58097
  return;
57918
58098
  }
57919
58099
 
57920
- reject(new core_AxiosError('Request aborted', core_AxiosError.ECONNABORTED, _config, request));
58100
+ reject(new core_AxiosError('Request aborted', core_AxiosError.ECONNABORTED, config, request));
57921
58101
 
57922
58102
  // Clean up request
57923
58103
  request = null;
@@ -57927,7 +58107,7 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57927
58107
  request.onerror = function handleError() {
57928
58108
  // Real errors are hidden from us by the browser
57929
58109
  // onerror should only fire if it's a network error
57930
- reject(new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, _config, request));
58110
+ reject(new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request));
57931
58111
 
57932
58112
  // Clean up request
57933
58113
  request = null;
@@ -57943,7 +58123,7 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57943
58123
  reject(new core_AxiosError(
57944
58124
  timeoutErrorMessage,
57945
58125
  transitional.clarifyTimeoutError ? core_AxiosError.ETIMEDOUT : core_AxiosError.ECONNABORTED,
57946
- _config,
58126
+ config,
57947
58127
  request));
57948
58128
 
57949
58129
  // Clean up request
@@ -57971,13 +58151,18 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
57971
58151
  }
57972
58152
 
57973
58153
  // Handle progress if needed
57974
- if (typeof _config.onDownloadProgress === 'function') {
57975
- request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));
58154
+ if (onDownloadProgress) {
58155
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
58156
+ request.addEventListener('progress', downloadThrottled);
57976
58157
  }
57977
58158
 
57978
58159
  // Not all browsers support upload events
57979
- if (typeof _config.onUploadProgress === 'function' && request.upload) {
57980
- request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));
58160
+ if (onUploadProgress && request.upload) {
58161
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
58162
+
58163
+ request.upload.addEventListener('progress', uploadThrottled);
58164
+
58165
+ request.upload.addEventListener('loadend', flushUpload);
57981
58166
  }
57982
58167
 
57983
58168
  if (_config.cancelToken || _config.signal) {
@@ -58015,53 +58200,54 @@ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
58015
58200
 
58016
58201
 
58017
58202
 
58203
+
58018
58204
  const composeSignals = (signals, timeout) => {
58019
- let controller = new AbortController();
58205
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
58020
58206
 
58021
- let aborted;
58207
+ if (timeout || length) {
58208
+ let controller = new AbortController();
58022
58209
 
58023
- const onabort = function (cancel) {
58024
- if (!aborted) {
58025
- aborted = true;
58026
- unsubscribe();
58027
- const err = cancel instanceof Error ? cancel : this.reason;
58028
- controller.abort(err instanceof core_AxiosError ? err : new cancel_CanceledError(err instanceof Error ? err.message : err));
58029
- }
58030
- }
58210
+ let aborted;
58031
58211
 
58032
- let timer = timeout && setTimeout(() => {
58033
- onabort(new core_AxiosError(`timeout ${timeout} of ms exceeded`, core_AxiosError.ETIMEDOUT))
58034
- }, timeout)
58212
+ const onabort = function (reason) {
58213
+ if (!aborted) {
58214
+ aborted = true;
58215
+ unsubscribe();
58216
+ const err = reason instanceof Error ? reason : this.reason;
58217
+ controller.abort(err instanceof core_AxiosError ? err : new cancel_CanceledError(err instanceof Error ? err.message : err));
58218
+ }
58219
+ }
58035
58220
 
58036
- const unsubscribe = () => {
58037
- if (signals) {
58038
- timer && clearTimeout(timer);
58221
+ let timer = timeout && setTimeout(() => {
58039
58222
  timer = null;
58040
- signals.forEach(signal => {
58041
- signal &&
58042
- (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
58043
- });
58044
- signals = null;
58223
+ onabort(new core_AxiosError(`timeout ${timeout} of ms exceeded`, core_AxiosError.ETIMEDOUT))
58224
+ }, timeout)
58225
+
58226
+ const unsubscribe = () => {
58227
+ if (signals) {
58228
+ timer && clearTimeout(timer);
58229
+ timer = null;
58230
+ signals.forEach(signal => {
58231
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
58232
+ });
58233
+ signals = null;
58234
+ }
58045
58235
  }
58046
- }
58047
58236
 
58048
- signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));
58237
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
58049
58238
 
58050
- const {signal} = controller;
58239
+ const {signal} = controller;
58051
58240
 
58052
- signal.unsubscribe = unsubscribe;
58241
+ signal.unsubscribe = () => utils.asap(unsubscribe);
58053
58242
 
58054
- return [signal, () => {
58055
- timer && clearTimeout(timer);
58056
- timer = null;
58057
- }];
58243
+ return signal;
58244
+ }
58058
58245
  }
58059
58246
 
58060
58247
  /* harmony default export */ const helpers_composeSignals = (composeSignals);
58061
58248
 
58062
58249
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/trackStream.js
58063
58250
 
58064
-
58065
58251
  const streamChunk = function* (chunk, chunkSize) {
58066
58252
  let len = chunk.byteLength;
58067
58253
 
@@ -58080,35 +58266,68 @@ const streamChunk = function* (chunk, chunkSize) {
58080
58266
  }
58081
58267
  }
58082
58268
 
58083
- const readBytes = async function* (iterable, chunkSize, encode) {
58084
- for await (const chunk of iterable) {
58085
- yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
58269
+ const readBytes = async function* (iterable, chunkSize) {
58270
+ for await (const chunk of readStream(iterable)) {
58271
+ yield* streamChunk(chunk, chunkSize);
58086
58272
  }
58087
58273
  }
58088
58274
 
58089
- const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
58090
- const iterator = readBytes(stream, chunkSize, encode);
58275
+ const readStream = async function* (stream) {
58276
+ if (stream[Symbol.asyncIterator]) {
58277
+ yield* stream;
58278
+ return;
58279
+ }
58280
+
58281
+ const reader = stream.getReader();
58282
+ try {
58283
+ for (;;) {
58284
+ const {done, value} = await reader.read();
58285
+ if (done) {
58286
+ break;
58287
+ }
58288
+ yield value;
58289
+ }
58290
+ } finally {
58291
+ await reader.cancel();
58292
+ }
58293
+ }
58294
+
58295
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
58296
+ const iterator = readBytes(stream, chunkSize);
58091
58297
 
58092
58298
  let bytes = 0;
58299
+ let done;
58300
+ let _onFinish = (e) => {
58301
+ if (!done) {
58302
+ done = true;
58303
+ onFinish && onFinish(e);
58304
+ }
58305
+ }
58093
58306
 
58094
58307
  return new ReadableStream({
58095
- type: 'bytes',
58096
-
58097
58308
  async pull(controller) {
58098
- const {done, value} = await iterator.next();
58309
+ try {
58310
+ const {done, value} = await iterator.next();
58099
58311
 
58100
- if (done) {
58101
- controller.close();
58102
- onFinish();
58103
- return;
58104
- }
58312
+ if (done) {
58313
+ _onFinish();
58314
+ controller.close();
58315
+ return;
58316
+ }
58105
58317
 
58106
- let len = value.byteLength;
58107
- onProgress && onProgress(bytes += len);
58108
- controller.enqueue(new Uint8Array(value));
58318
+ let len = value.byteLength;
58319
+ if (onProgress) {
58320
+ let loadedBytes = bytes += len;
58321
+ onProgress(loadedBytes);
58322
+ }
58323
+ controller.enqueue(new Uint8Array(value));
58324
+ } catch (err) {
58325
+ _onFinish(err);
58326
+ throw err;
58327
+ }
58109
58328
  },
58110
58329
  cancel(reason) {
58111
- onFinish(reason);
58330
+ _onFinish(reason);
58112
58331
  return iterator.return();
58113
58332
  }
58114
58333
  }, {
@@ -58127,15 +58346,6 @@ const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
58127
58346
 
58128
58347
 
58129
58348
 
58130
- const fetchProgressDecorator = (total, fn) => {
58131
- const lengthComputable = total != null;
58132
- return (loaded) => setTimeout(() => fn({
58133
- lengthComputable,
58134
- total,
58135
- loaded
58136
- }));
58137
- }
58138
-
58139
58349
  const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
58140
58350
  const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
58141
58351
 
@@ -58145,7 +58355,15 @@ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
58145
58355
  async (str) => new Uint8Array(await new Response(str).arrayBuffer())
58146
58356
  );
58147
58357
 
58148
- const supportsRequestStream = isReadableStreamSupported && (() => {
58358
+ const test = (fn, ...args) => {
58359
+ try {
58360
+ return !!fn(...args);
58361
+ } catch (e) {
58362
+ return false
58363
+ }
58364
+ }
58365
+
58366
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
58149
58367
  let duplexAccessed = false;
58150
58368
 
58151
58369
  const hasContentType = new Request(platform.origin, {
@@ -58158,17 +58376,13 @@ const supportsRequestStream = isReadableStreamSupported && (() => {
58158
58376
  }).headers.has('Content-Type');
58159
58377
 
58160
58378
  return duplexAccessed && !hasContentType;
58161
- })();
58379
+ });
58162
58380
 
58163
58381
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
58164
58382
 
58165
- const supportsResponseStream = isReadableStreamSupported && !!(()=> {
58166
- try {
58167
- return utils.isReadableStream(new Response('').body);
58168
- } catch(err) {
58169
- // return undefined
58170
- }
58171
- })();
58383
+ const supportsResponseStream = isReadableStreamSupported &&
58384
+ test(() => utils.isReadableStream(new Response('').body));
58385
+
58172
58386
 
58173
58387
  const resolvers = {
58174
58388
  stream: supportsResponseStream && ((res) => res.body)
@@ -58193,10 +58407,14 @@ const getBodyLength = async (body) => {
58193
58407
  }
58194
58408
 
58195
58409
  if(utils.isSpecCompliantForm(body)) {
58196
- return (await new Request(body).arrayBuffer()).byteLength;
58410
+ const _request = new Request(platform.origin, {
58411
+ method: 'POST',
58412
+ body,
58413
+ });
58414
+ return (await _request.arrayBuffer()).byteLength;
58197
58415
  }
58198
58416
 
58199
- if(utils.isArrayBufferView(body)) {
58417
+ if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {
58200
58418
  return body.byteLength;
58201
58419
  }
58202
58420
 
@@ -58233,18 +58451,13 @@ const resolveBodyLength = async (headers, body) => {
58233
58451
 
58234
58452
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
58235
58453
 
58236
- let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?
58237
- helpers_composeSignals([signal, cancelToken], timeout) : [];
58454
+ let composedSignal = helpers_composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
58238
58455
 
58239
- let finished, request;
58456
+ let request;
58240
58457
 
58241
- const onFinish = () => {
58242
- !finished && setTimeout(() => {
58243
- composedSignal && composedSignal.unsubscribe();
58244
- });
58245
-
58246
- finished = true;
58247
- }
58458
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
58459
+ composedSignal.unsubscribe();
58460
+ });
58248
58461
 
58249
58462
  let requestContentLength;
58250
58463
 
@@ -58266,17 +58479,22 @@ const resolveBodyLength = async (headers, body) => {
58266
58479
  }
58267
58480
 
58268
58481
  if (_request.body) {
58269
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(
58482
+ const [onProgress, flush] = progressEventDecorator(
58270
58483
  requestContentLength,
58271
- progressEventReducer(onUploadProgress)
58272
- ), null, encodeText);
58484
+ progressEventReducer(asyncDecorator(onUploadProgress))
58485
+ );
58486
+
58487
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
58273
58488
  }
58274
58489
  }
58275
58490
 
58276
58491
  if (!utils.isString(withCredentials)) {
58277
- withCredentials = withCredentials ? 'cors' : 'omit';
58492
+ withCredentials = withCredentials ? 'include' : 'omit';
58278
58493
  }
58279
58494
 
58495
+ // Cloudflare Workers throws when credentials are defined
58496
+ // see https://github.com/cloudflare/workerd/issues/902
58497
+ const isCredentialsSupported = "credentials" in Request.prototype;
58280
58498
  request = new Request(url, {
58281
58499
  ...fetchOptions,
58282
58500
  signal: composedSignal,
@@ -58284,14 +58502,14 @@ const resolveBodyLength = async (headers, body) => {
58284
58502
  headers: headers.normalize().toJSON(),
58285
58503
  body: data,
58286
58504
  duplex: "half",
58287
- withCredentials
58505
+ credentials: isCredentialsSupported ? withCredentials : undefined
58288
58506
  });
58289
58507
 
58290
58508
  let response = await fetch(request);
58291
58509
 
58292
58510
  const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
58293
58511
 
58294
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
58512
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
58295
58513
  const options = {};
58296
58514
 
58297
58515
  ['status', 'statusText', 'headers'].forEach(prop => {
@@ -58300,11 +58518,16 @@ const resolveBodyLength = async (headers, body) => {
58300
58518
 
58301
58519
  const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));
58302
58520
 
58521
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
58522
+ responseContentLength,
58523
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
58524
+ ) || [];
58525
+
58303
58526
  response = new Response(
58304
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(
58305
- responseContentLength,
58306
- progressEventReducer(onDownloadProgress, true)
58307
- ), isStreamResponse && onFinish, encodeText),
58527
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
58528
+ flush && flush();
58529
+ unsubscribe && unsubscribe();
58530
+ }),
58308
58531
  options
58309
58532
  );
58310
58533
  }
@@ -58313,9 +58536,7 @@ const resolveBodyLength = async (headers, body) => {
58313
58536
 
58314
58537
  let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);
58315
58538
 
58316
- !isStreamResponse && onFinish();
58317
-
58318
- stopTimeout && stopTimeout();
58539
+ !isStreamResponse && unsubscribe && unsubscribe();
58319
58540
 
58320
58541
  return await new Promise((resolve, reject) => {
58321
58542
  settle(resolve, reject, {
@@ -58328,7 +58549,7 @@ const resolveBodyLength = async (headers, body) => {
58328
58549
  })
58329
58550
  })
58330
58551
  } catch (err) {
58331
- onFinish();
58552
+ unsubscribe && unsubscribe();
58332
58553
 
58333
58554
  if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
58334
58555
  throw Object.assign(
@@ -58510,7 +58731,7 @@ function dispatchRequest(config) {
58510
58731
  }
58511
58732
 
58512
58733
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/env/data.js
58513
- const VERSION = "1.7.2";
58734
+ const VERSION = "1.7.7";
58514
58735
  ;// CONCATENATED MODULE: ./node_modules/axios/lib/helpers/validator.js
58515
58736
 
58516
58737
 
@@ -58939,6 +59160,20 @@ class CancelToken {
58939
59160
  }
58940
59161
  }
58941
59162
 
59163
+ toAbortSignal() {
59164
+ const controller = new AbortController();
59165
+
59166
+ const abort = (err) => {
59167
+ controller.abort(err);
59168
+ };
59169
+
59170
+ this.subscribe(abort);
59171
+
59172
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
59173
+
59174
+ return controller.signal;
59175
+ }
59176
+
58942
59177
  /**
58943
59178
  * Returns an object that contains a new `CancelToken` and a function that, when called,
58944
59179
  * cancels the `CancelToken`.
@@ -59174,7 +59409,7 @@ axios.default = axios;
59174
59409
  /***/ ((module) => {
59175
59410
 
59176
59411
  "use strict";
59177
- module.exports = {"rE":"12.1.0"};
59412
+ module.exports = {"rE":"12.3.0"};
59178
59413
 
59179
59414
  /***/ })
59180
59415