@stellar/stellar-sdk 12.1.0 → 12.2.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.
- package/CHANGELOG.md +52 -0
- package/dist/stellar-sdk.js +848 -815
- package/dist/stellar-sdk.min.js +1 -1
- package/lib/browser.d.ts +1 -1
- package/lib/browser.js +4 -4
- package/lib/config.js +5 -2
- package/lib/contract/assembled_transaction.d.ts +25 -27
- package/lib/contract/assembled_transaction.js +6 -6
- package/lib/contract/client.d.ts +0 -1
- package/lib/contract/client.js +2 -2
- package/lib/contract/index.d.ts +0 -1
- package/lib/contract/index.js +1 -18
- package/lib/contract/sent_transaction.d.ts +9 -10
- package/lib/contract/sent_transaction.js +2 -1
- package/lib/contract/spec.d.ts +1 -1
- package/lib/contract/spec.js +921 -956
- package/lib/contract/types.d.ts +5 -0
- package/lib/contract/types.js +4 -1
- package/lib/contract/utils.d.ts +0 -5
- package/lib/contract/utils.js +4 -18
- package/lib/errors.d.ts +4 -4
- package/lib/federation/server.d.ts +1 -1
- package/lib/horizon/account_call_builder.d.ts +2 -3
- package/lib/horizon/account_response.d.ts +1 -1
- package/lib/horizon/assets_call_builder.d.ts +2 -3
- package/lib/horizon/call_builder.d.ts +8 -8
- package/lib/horizon/call_builder.js +2 -6
- package/lib/horizon/claimable_balances_call_builder.d.ts +3 -4
- package/lib/horizon/effect_call_builder.d.ts +2 -3
- package/lib/horizon/friendbot_builder.d.ts +0 -1
- package/lib/horizon/horizon_api.d.ts +5 -1
- package/lib/horizon/horizon_axios_client.js +6 -6
- package/lib/horizon/ledger_call_builder.d.ts +2 -3
- package/lib/horizon/liquidity_pool_call_builder.d.ts +2 -4
- package/lib/horizon/offer_call_builder.d.ts +2 -3
- package/lib/horizon/operation_call_builder.d.ts +3 -4
- package/lib/horizon/orderbook_call_builder.d.ts +0 -1
- package/lib/horizon/path_call_builder.d.ts +1 -2
- package/lib/horizon/payment_call_builder.d.ts +2 -3
- package/lib/horizon/server.d.ts +29 -10
- package/lib/horizon/server.js +98 -55
- package/lib/horizon/strict_receive_path_call_builder.d.ts +1 -2
- package/lib/horizon/strict_send_path_call_builder.d.ts +1 -2
- package/lib/horizon/trade_aggregation_call_builder.d.ts +9 -10
- package/lib/horizon/trade_aggregation_call_builder.js +3 -7
- package/lib/horizon/trades_call_builder.d.ts +2 -3
- package/lib/horizon/transaction_call_builder.d.ts +3 -4
- package/lib/horizon/types/assets.d.ts +1 -1
- package/lib/horizon/types/effects.d.ts +1 -1
- package/lib/horizon/types/offer.d.ts +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/rpc/api.d.ts +29 -5
- package/lib/rpc/browser.d.ts +1 -1
- package/lib/rpc/browser.js +4 -4
- package/lib/rpc/index.d.ts +0 -1
- package/lib/rpc/jsonrpc.js +3 -3
- package/lib/rpc/parsers.d.ts +3 -3
- package/lib/rpc/parsers.js +23 -23
- package/lib/rpc/server.d.ts +13 -7
- package/lib/rpc/server.js +48 -56
- package/lib/rpc/transaction.d.ts +3 -4
- package/lib/rpc/transaction.js +23 -25
- package/lib/webauth/utils.js +3 -3
- package/package.json +17 -17
package/dist/stellar-sdk.js
CHANGED
|
@@ -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(
|
|
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';
|
|
@@ -1205,10 +1205,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1205
1205
|
value: true
|
|
1206
1206
|
}));
|
|
1207
1207
|
exports.humanizeEvents = humanizeEvents;
|
|
1208
|
-
var _xdr = _interopRequireDefault(__webpack_require__(1918));
|
|
1209
1208
|
var _strkey = __webpack_require__(7120);
|
|
1210
1209
|
var _scval = __webpack_require__(7177);
|
|
1211
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
1212
1210
|
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
1211
|
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
1212
|
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 +1229,16 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
1231
1229
|
*/
|
|
1232
1230
|
function humanizeEvents(events) {
|
|
1233
1231
|
return events.map(function (e) {
|
|
1234
|
-
|
|
1232
|
+
// A pseudo-instanceof check for xdr.DiagnosticEvent more reliable
|
|
1233
|
+
// in mixed SDK environments:
|
|
1234
|
+
if (e.inSuccessfulContractCall) {
|
|
1235
1235
|
return extractEvent(e.event());
|
|
1236
1236
|
}
|
|
1237
1237
|
return extractEvent(e);
|
|
1238
1238
|
});
|
|
1239
1239
|
}
|
|
1240
1240
|
function extractEvent(event) {
|
|
1241
|
-
return _objectSpread(_objectSpread({}, event.contractId() != null && {
|
|
1241
|
+
return _objectSpread(_objectSpread({}, typeof event.contractId === 'function' && event.contractId() != null && {
|
|
1242
1242
|
contractId: _strkey.StrKey.encodeContract(event.contractId())
|
|
1243
1243
|
}), {}, {
|
|
1244
1244
|
type: event.type().name,
|
|
@@ -15529,75 +15529,87 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
15529
15529
|
* scValToNative(scv) == gigaMap; // true
|
|
15530
15530
|
*/
|
|
15531
15531
|
function nativeToScVal(val) {
|
|
15532
|
-
var _val$constructor$name, _val$constructor;
|
|
15533
15532
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15534
15533
|
switch (_typeof(val)) {
|
|
15535
15534
|
case 'object':
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
|
|
15556
|
-
|
|
15557
|
-
|
|
15558
|
-
|
|
15559
|
-
|
|
15535
|
+
{
|
|
15536
|
+
var _val$constructor$name, _val$constructor;
|
|
15537
|
+
if (val === null) {
|
|
15538
|
+
return _xdr["default"].ScVal.scvVoid();
|
|
15539
|
+
}
|
|
15540
|
+
if (val instanceof _xdr["default"].ScVal) {
|
|
15541
|
+
return val; // should we copy?
|
|
15542
|
+
}
|
|
15543
|
+
if (val instanceof _address.Address) {
|
|
15544
|
+
return val.toScVal();
|
|
15545
|
+
}
|
|
15546
|
+
if (val instanceof _contract.Contract) {
|
|
15547
|
+
return val.address().toScVal();
|
|
15548
|
+
}
|
|
15549
|
+
if (val instanceof Uint8Array || Buffer.isBuffer(val)) {
|
|
15550
|
+
var _opts$type;
|
|
15551
|
+
var copy = Uint8Array.from(val);
|
|
15552
|
+
switch ((_opts$type = opts === null || opts === void 0 ? void 0 : opts.type) !== null && _opts$type !== void 0 ? _opts$type : 'bytes') {
|
|
15553
|
+
case 'bytes':
|
|
15554
|
+
return _xdr["default"].ScVal.scvBytes(copy);
|
|
15555
|
+
case 'symbol':
|
|
15556
|
+
return _xdr["default"].ScVal.scvSymbol(copy);
|
|
15557
|
+
case 'string':
|
|
15558
|
+
return _xdr["default"].ScVal.scvString(copy);
|
|
15559
|
+
default:
|
|
15560
|
+
throw new TypeError("invalid type (".concat(opts.type, ") specified for bytes-like value"));
|
|
15561
|
+
}
|
|
15560
15562
|
}
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
}
|
|
15563
|
+
if (Array.isArray(val)) {
|
|
15564
|
+
if (val.length > 0 && val.some(function (v) {
|
|
15565
|
+
return _typeof(v) !== _typeof(val[0]);
|
|
15566
|
+
})) {
|
|
15567
|
+
throw new TypeError("array values (".concat(val, ") must have the same type (types: ").concat(val.map(function (v) {
|
|
15568
|
+
return _typeof(v);
|
|
15569
|
+
}).join(','), ")"));
|
|
15570
|
+
}
|
|
15571
|
+
return _xdr["default"].ScVal.scvVec(val.map(function (v) {
|
|
15572
|
+
return nativeToScVal(v, opts);
|
|
15573
|
+
}));
|
|
15569
15574
|
}
|
|
15570
|
-
|
|
15571
|
-
|
|
15575
|
+
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') {
|
|
15576
|
+
var _val$constructor2;
|
|
15577
|
+
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), ")"));
|
|
15578
|
+
}
|
|
15579
|
+
return _xdr["default"].ScVal.scvMap(Object.entries(val)
|
|
15580
|
+
// The Soroban runtime expects maps to have their keys in sorted
|
|
15581
|
+
// order, so let's do that here as part of the conversion to prevent
|
|
15582
|
+
// confusing error messages on execution.
|
|
15583
|
+
.sort(function (_ref, _ref2) {
|
|
15584
|
+
var _ref3 = _slicedToArray(_ref, 1),
|
|
15585
|
+
key1 = _ref3[0];
|
|
15586
|
+
var _ref4 = _slicedToArray(_ref2, 1),
|
|
15587
|
+
key2 = _ref4[0];
|
|
15588
|
+
return key1.localeCompare(key2);
|
|
15589
|
+
}).map(function (_ref5) {
|
|
15590
|
+
var _k, _opts$type2;
|
|
15591
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
15592
|
+
k = _ref6[0],
|
|
15593
|
+
v = _ref6[1];
|
|
15594
|
+
// the type can be specified with an entry for the key and the value,
|
|
15595
|
+
// e.g. val = { 'hello': 1 } and opts.type = { hello: [ 'symbol',
|
|
15596
|
+
// 'u128' ]} or you can use `null` for the default interpretation
|
|
15597
|
+
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],
|
|
15598
|
+
_ref8 = _slicedToArray(_ref7, 2),
|
|
15599
|
+
keyType = _ref8[0],
|
|
15600
|
+
valType = _ref8[1];
|
|
15601
|
+
var keyOpts = keyType ? {
|
|
15602
|
+
type: keyType
|
|
15603
|
+
} : {};
|
|
15604
|
+
var valOpts = valType ? {
|
|
15605
|
+
type: valType
|
|
15606
|
+
} : {};
|
|
15607
|
+
return new _xdr["default"].ScMapEntry({
|
|
15608
|
+
key: nativeToScVal(k, keyOpts),
|
|
15609
|
+
val: nativeToScVal(v, valOpts)
|
|
15610
|
+
});
|
|
15572
15611
|
}));
|
|
15573
15612
|
}
|
|
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
15613
|
case 'number':
|
|
15602
15614
|
case 'bigint':
|
|
15603
15615
|
switch (opts === null || opts === void 0 ? void 0 : opts.type) {
|
|
@@ -15622,6 +15634,10 @@ function nativeToScVal(val) {
|
|
|
15622
15634
|
return _xdr["default"].ScVal.scvSymbol(val);
|
|
15623
15635
|
case 'address':
|
|
15624
15636
|
return new _address.Address(val).toScVal();
|
|
15637
|
+
case 'u32':
|
|
15638
|
+
return _xdr["default"].ScVal.scvU32(parseInt(val, 10));
|
|
15639
|
+
case 'i32':
|
|
15640
|
+
return _xdr["default"].ScVal.scvI32(parseInt(val, 10));
|
|
15625
15641
|
default:
|
|
15626
15642
|
if (_index.XdrLargeInt.isType(optType)) {
|
|
15627
15643
|
return new _index.XdrLargeInt(optType, val).toScVal();
|
|
@@ -17544,6 +17560,21 @@ var TransactionBuilder = exports.TransactionBuilder = /*#__PURE__*/function () {
|
|
|
17544
17560
|
return this;
|
|
17545
17561
|
}
|
|
17546
17562
|
|
|
17563
|
+
/**
|
|
17564
|
+
* Adds an operation to the transaction at a specific index.
|
|
17565
|
+
*
|
|
17566
|
+
* @param {xdr.Operation} operation - The xdr operation object to add, use {@link Operation} static methods.
|
|
17567
|
+
* @param {number} index - The index at which to insert the operation.
|
|
17568
|
+
*
|
|
17569
|
+
* @returns {TransactionBuilder} - The TransactionBuilder instance for method chaining.
|
|
17570
|
+
*/
|
|
17571
|
+
}, {
|
|
17572
|
+
key: "addOperationAt",
|
|
17573
|
+
value: function addOperationAt(operation, index) {
|
|
17574
|
+
this.operations.splice(index, 0, operation);
|
|
17575
|
+
return this;
|
|
17576
|
+
}
|
|
17577
|
+
|
|
17547
17578
|
/**
|
|
17548
17579
|
* Removes the operations from the builder (useful when cloning).
|
|
17549
17580
|
* @returns {TransactionBuilder} this builder instance
|
|
@@ -17555,6 +17586,20 @@ var TransactionBuilder = exports.TransactionBuilder = /*#__PURE__*/function () {
|
|
|
17555
17586
|
return this;
|
|
17556
17587
|
}
|
|
17557
17588
|
|
|
17589
|
+
/**
|
|
17590
|
+
* Removes the operation at the specified index from the transaction.
|
|
17591
|
+
*
|
|
17592
|
+
* @param {number} index - The index of the operation to remove.
|
|
17593
|
+
*
|
|
17594
|
+
* @returns {TransactionBuilder} The TransactionBuilder instance for method chaining.
|
|
17595
|
+
*/
|
|
17596
|
+
}, {
|
|
17597
|
+
key: "clearOperationAt",
|
|
17598
|
+
value: function clearOperationAt(index) {
|
|
17599
|
+
this.operations.splice(index, 1);
|
|
17600
|
+
return this;
|
|
17601
|
+
}
|
|
17602
|
+
|
|
17558
17603
|
/**
|
|
17559
17604
|
* Adds a memo to the transaction.
|
|
17560
17605
|
* @param {Memo} memo {@link Memo} object
|
|
@@ -20770,13 +20815,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
20770
20815
|
/* harmony export */ axios: () => (/* reexport safe */ axios__WEBPACK_IMPORTED_MODULE_2__.A),
|
|
20771
20816
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
20772
20817
|
/* harmony export */ });
|
|
20818
|
+
/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1083);
|
|
20773
20819
|
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4356);
|
|
20774
20820
|
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
20775
20821
|
/* 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
20822
|
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
20777
20823
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(356);
|
|
20778
20824
|
/* 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
20825
|
/* module decorator */ module = __webpack_require__.hmd(module);
|
|
20781
20826
|
|
|
20782
20827
|
|
|
@@ -20798,13 +20843,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
20798
20843
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
20799
20844
|
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
20845
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
20846
|
+
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; }
|
|
20847
|
+
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; }
|
|
20848
|
+
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
20849
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20802
20850
|
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
20851
|
var defaultConfig = {
|
|
20804
20852
|
allowHttp: false,
|
|
20805
20853
|
timeout: 0
|
|
20806
20854
|
};
|
|
20807
|
-
var config =
|
|
20855
|
+
var config = _objectSpread({}, defaultConfig);
|
|
20808
20856
|
var Config = function () {
|
|
20809
20857
|
function Config() {
|
|
20810
20858
|
_classCallCheck(this, Config);
|
|
@@ -20832,7 +20880,7 @@ var Config = function () {
|
|
|
20832
20880
|
}, {
|
|
20833
20881
|
key: "setDefault",
|
|
20834
20882
|
value: function setDefault() {
|
|
20835
|
-
config =
|
|
20883
|
+
config = _objectSpread({}, defaultConfig);
|
|
20836
20884
|
}
|
|
20837
20885
|
}]);
|
|
20838
20886
|
}();
|
|
@@ -20840,7 +20888,7 @@ var Config = function () {
|
|
|
20840
20888
|
|
|
20841
20889
|
/***/ }),
|
|
20842
20890
|
|
|
20843
|
-
/***/
|
|
20891
|
+
/***/ 6299:
|
|
20844
20892
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20845
20893
|
|
|
20846
20894
|
"use strict";
|
|
@@ -20929,6 +20977,9 @@ var Err = function () {
|
|
|
20929
20977
|
}
|
|
20930
20978
|
}]);
|
|
20931
20979
|
}();
|
|
20980
|
+
;// CONCATENATED MODULE: ./src/contract/types.ts
|
|
20981
|
+
var DEFAULT_TIMEOUT = 5 * 60;
|
|
20982
|
+
var NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
|
|
20932
20983
|
;// CONCATENATED MODULE: ./src/contract/utils.ts
|
|
20933
20984
|
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
20985
|
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 +20987,6 @@ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.
|
|
|
20936
20987
|
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
20988
|
|
|
20938
20989
|
|
|
20939
|
-
var DEFAULT_TIMEOUT = 5 * 60;
|
|
20940
20990
|
function withExponentialBackoff(_x, _x2, _x3) {
|
|
20941
20991
|
return _withExponentialBackoff.apply(this, arguments);
|
|
20942
20992
|
}
|
|
@@ -21035,21 +21085,8 @@ function _getAccount() {
|
|
|
21035
21085
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
21036
21086
|
while (1) switch (_context2.prev = _context2.next) {
|
|
21037
21087
|
case 0:
|
|
21038
|
-
|
|
21039
|
-
|
|
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:
|
|
21088
|
+
return _context2.abrupt("return", options.publicKey ? server.getAccount(options.publicKey) : new lib.Account(NULL_ACCOUNT, "0"));
|
|
21089
|
+
case 1:
|
|
21053
21090
|
case "end":
|
|
21054
21091
|
return _context2.stop();
|
|
21055
21092
|
}
|
|
@@ -21082,6 +21119,7 @@ function sent_transaction_toPrimitive(t, r) { if ("object" != sent_transaction_t
|
|
|
21082
21119
|
|
|
21083
21120
|
|
|
21084
21121
|
|
|
21122
|
+
|
|
21085
21123
|
var SentTransaction = function () {
|
|
21086
21124
|
function SentTransaction(_, assembled) {
|
|
21087
21125
|
var _this = this,
|
|
@@ -21244,7 +21282,7 @@ function assembled_transaction_toPrimitive(t, r) { if ("object" != assembled_tra
|
|
|
21244
21282
|
|
|
21245
21283
|
|
|
21246
21284
|
|
|
21247
|
-
|
|
21285
|
+
|
|
21248
21286
|
var AssembledTransaction = function () {
|
|
21249
21287
|
function AssembledTransaction(options) {
|
|
21250
21288
|
var _this = this,
|
|
@@ -21979,7 +22017,6 @@ var basicNodeSigner = function basicNodeSigner(keypair, networkPassphrase) {
|
|
|
21979
22017
|
/* provided dependency */ var spec_Buffer = __webpack_require__(8287)["Buffer"];
|
|
21980
22018
|
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
22019
|
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
22020
|
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
22021
|
function spec_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
21985
22022
|
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 +22032,36 @@ function spec_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined
|
|
|
21995
22032
|
function spec_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21996
22033
|
|
|
21997
22034
|
|
|
22035
|
+
function enumToJsonSchema(udt) {
|
|
22036
|
+
var description = udt.doc().toString();
|
|
22037
|
+
var cases = udt.cases();
|
|
22038
|
+
var oneOf = [];
|
|
22039
|
+
cases.forEach(function (aCase) {
|
|
22040
|
+
var title = aCase.name().toString();
|
|
22041
|
+
var desc = aCase.doc().toString();
|
|
22042
|
+
oneOf.push({
|
|
22043
|
+
description: desc,
|
|
22044
|
+
title: title,
|
|
22045
|
+
enum: [aCase.value()],
|
|
22046
|
+
type: "number"
|
|
22047
|
+
});
|
|
22048
|
+
});
|
|
22049
|
+
var res = {
|
|
22050
|
+
oneOf: oneOf
|
|
22051
|
+
};
|
|
22052
|
+
if (description.length > 0) {
|
|
22053
|
+
res.description = description;
|
|
22054
|
+
}
|
|
22055
|
+
return res;
|
|
22056
|
+
}
|
|
22057
|
+
function isNumeric(field) {
|
|
22058
|
+
return /^\d+$/.test(field.name().toString());
|
|
22059
|
+
}
|
|
21998
22060
|
function readObj(args, input) {
|
|
21999
22061
|
var inputName = input.name().toString();
|
|
22000
22062
|
var entry = Object.entries(args).find(function (_ref) {
|
|
22001
|
-
var _ref2 = spec_slicedToArray(_ref,
|
|
22002
|
-
name = _ref2[0]
|
|
22003
|
-
_ = _ref2[1];
|
|
22063
|
+
var _ref2 = spec_slicedToArray(_ref, 1),
|
|
22064
|
+
name = _ref2[0];
|
|
22004
22065
|
return name === inputName;
|
|
22005
22066
|
});
|
|
22006
22067
|
if (!entry) {
|
|
@@ -22008,11 +22069,416 @@ function readObj(args, input) {
|
|
|
22008
22069
|
}
|
|
22009
22070
|
return entry[1];
|
|
22010
22071
|
}
|
|
22072
|
+
function findCase(name) {
|
|
22073
|
+
return function matches(entry) {
|
|
22074
|
+
switch (entry.switch().value) {
|
|
22075
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
|
|
22076
|
+
{
|
|
22077
|
+
var tuple = entry.tupleCase();
|
|
22078
|
+
return tuple.name().toString() === name;
|
|
22079
|
+
}
|
|
22080
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
|
|
22081
|
+
{
|
|
22082
|
+
var voidCase = entry.voidCase();
|
|
22083
|
+
return voidCase.name().toString() === name;
|
|
22084
|
+
}
|
|
22085
|
+
default:
|
|
22086
|
+
return false;
|
|
22087
|
+
}
|
|
22088
|
+
};
|
|
22089
|
+
}
|
|
22090
|
+
function stringToScVal(str, ty) {
|
|
22091
|
+
switch (ty.value) {
|
|
22092
|
+
case lib.xdr.ScSpecType.scSpecTypeString().value:
|
|
22093
|
+
return lib.xdr.ScVal.scvString(str);
|
|
22094
|
+
case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
|
|
22095
|
+
return lib.xdr.ScVal.scvSymbol(str);
|
|
22096
|
+
case lib.xdr.ScSpecType.scSpecTypeAddress().value:
|
|
22097
|
+
{
|
|
22098
|
+
var addr = lib.Address.fromString(str);
|
|
22099
|
+
return lib.xdr.ScVal.scvAddress(addr.toScAddress());
|
|
22100
|
+
}
|
|
22101
|
+
case lib.xdr.ScSpecType.scSpecTypeU64().value:
|
|
22102
|
+
return new lib.XdrLargeInt("u64", str).toScVal();
|
|
22103
|
+
case lib.xdr.ScSpecType.scSpecTypeI64().value:
|
|
22104
|
+
return new lib.XdrLargeInt("i64", str).toScVal();
|
|
22105
|
+
case lib.xdr.ScSpecType.scSpecTypeU128().value:
|
|
22106
|
+
return new lib.XdrLargeInt("u128", str).toScVal();
|
|
22107
|
+
case lib.xdr.ScSpecType.scSpecTypeI128().value:
|
|
22108
|
+
return new lib.XdrLargeInt("i128", str).toScVal();
|
|
22109
|
+
case lib.xdr.ScSpecType.scSpecTypeU256().value:
|
|
22110
|
+
return new lib.XdrLargeInt("u256", str).toScVal();
|
|
22111
|
+
case lib.xdr.ScSpecType.scSpecTypeI256().value:
|
|
22112
|
+
return new lib.XdrLargeInt("i256", str).toScVal();
|
|
22113
|
+
case lib.xdr.ScSpecType.scSpecTypeBytes().value:
|
|
22114
|
+
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
22115
|
+
return lib.xdr.ScVal.scvBytes(spec_Buffer.from(str, "base64"));
|
|
22116
|
+
default:
|
|
22117
|
+
throw new TypeError("invalid type ".concat(ty.name, " specified for string value"));
|
|
22118
|
+
}
|
|
22119
|
+
}
|
|
22120
|
+
var PRIMITIVE_DEFINITONS = {
|
|
22121
|
+
U32: {
|
|
22122
|
+
type: "integer",
|
|
22123
|
+
minimum: 0,
|
|
22124
|
+
maximum: 4294967295
|
|
22125
|
+
},
|
|
22126
|
+
I32: {
|
|
22127
|
+
type: "integer",
|
|
22128
|
+
minimum: -2147483648,
|
|
22129
|
+
maximum: 2147483647
|
|
22130
|
+
},
|
|
22131
|
+
U64: {
|
|
22132
|
+
type: "string",
|
|
22133
|
+
pattern: "^([1-9][0-9]*|0)$",
|
|
22134
|
+
minLength: 1,
|
|
22135
|
+
maxLength: 20
|
|
22136
|
+
},
|
|
22137
|
+
I64: {
|
|
22138
|
+
type: "string",
|
|
22139
|
+
pattern: "^(-?[1-9][0-9]*|0)$",
|
|
22140
|
+
minLength: 1,
|
|
22141
|
+
maxLength: 21
|
|
22142
|
+
},
|
|
22143
|
+
U128: {
|
|
22144
|
+
type: "string",
|
|
22145
|
+
pattern: "^([1-9][0-9]*|0)$",
|
|
22146
|
+
minLength: 1,
|
|
22147
|
+
maxLength: 39
|
|
22148
|
+
},
|
|
22149
|
+
I128: {
|
|
22150
|
+
type: "string",
|
|
22151
|
+
pattern: "^(-?[1-9][0-9]*|0)$",
|
|
22152
|
+
minLength: 1,
|
|
22153
|
+
maxLength: 40
|
|
22154
|
+
},
|
|
22155
|
+
U256: {
|
|
22156
|
+
type: "string",
|
|
22157
|
+
pattern: "^([1-9][0-9]*|0)$",
|
|
22158
|
+
minLength: 1,
|
|
22159
|
+
maxLength: 78
|
|
22160
|
+
},
|
|
22161
|
+
I256: {
|
|
22162
|
+
type: "string",
|
|
22163
|
+
pattern: "^(-?[1-9][0-9]*|0)$",
|
|
22164
|
+
minLength: 1,
|
|
22165
|
+
maxLength: 79
|
|
22166
|
+
},
|
|
22167
|
+
Address: {
|
|
22168
|
+
type: "string",
|
|
22169
|
+
format: "address",
|
|
22170
|
+
description: "Address can be a public key or contract id"
|
|
22171
|
+
},
|
|
22172
|
+
ScString: {
|
|
22173
|
+
type: "string",
|
|
22174
|
+
description: "ScString is a string"
|
|
22175
|
+
},
|
|
22176
|
+
ScSymbol: {
|
|
22177
|
+
type: "string",
|
|
22178
|
+
description: "ScString is a string"
|
|
22179
|
+
},
|
|
22180
|
+
DataUrl: {
|
|
22181
|
+
type: "string",
|
|
22182
|
+
pattern: "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$"
|
|
22183
|
+
}
|
|
22184
|
+
};
|
|
22185
|
+
function typeRef(typeDef) {
|
|
22186
|
+
var t = typeDef.switch();
|
|
22187
|
+
var value = t.value;
|
|
22188
|
+
var ref;
|
|
22189
|
+
switch (value) {
|
|
22190
|
+
case lib.xdr.ScSpecType.scSpecTypeVal().value:
|
|
22191
|
+
{
|
|
22192
|
+
ref = "Val";
|
|
22193
|
+
break;
|
|
22194
|
+
}
|
|
22195
|
+
case lib.xdr.ScSpecType.scSpecTypeBool().value:
|
|
22196
|
+
{
|
|
22197
|
+
return {
|
|
22198
|
+
type: "boolean"
|
|
22199
|
+
};
|
|
22200
|
+
}
|
|
22201
|
+
case lib.xdr.ScSpecType.scSpecTypeVoid().value:
|
|
22202
|
+
{
|
|
22203
|
+
return {
|
|
22204
|
+
type: "null"
|
|
22205
|
+
};
|
|
22206
|
+
}
|
|
22207
|
+
case lib.xdr.ScSpecType.scSpecTypeError().value:
|
|
22208
|
+
{
|
|
22209
|
+
ref = "Error";
|
|
22210
|
+
break;
|
|
22211
|
+
}
|
|
22212
|
+
case lib.xdr.ScSpecType.scSpecTypeU32().value:
|
|
22213
|
+
{
|
|
22214
|
+
ref = "U32";
|
|
22215
|
+
break;
|
|
22216
|
+
}
|
|
22217
|
+
case lib.xdr.ScSpecType.scSpecTypeI32().value:
|
|
22218
|
+
{
|
|
22219
|
+
ref = "I32";
|
|
22220
|
+
break;
|
|
22221
|
+
}
|
|
22222
|
+
case lib.xdr.ScSpecType.scSpecTypeU64().value:
|
|
22223
|
+
{
|
|
22224
|
+
ref = "U64";
|
|
22225
|
+
break;
|
|
22226
|
+
}
|
|
22227
|
+
case lib.xdr.ScSpecType.scSpecTypeI64().value:
|
|
22228
|
+
{
|
|
22229
|
+
ref = "I64";
|
|
22230
|
+
break;
|
|
22231
|
+
}
|
|
22232
|
+
case lib.xdr.ScSpecType.scSpecTypeTimepoint().value:
|
|
22233
|
+
{
|
|
22234
|
+
throw new Error("Timepoint type not supported");
|
|
22235
|
+
ref = "Timepoint";
|
|
22236
|
+
break;
|
|
22237
|
+
}
|
|
22238
|
+
case lib.xdr.ScSpecType.scSpecTypeDuration().value:
|
|
22239
|
+
{
|
|
22240
|
+
throw new Error("Duration not supported");
|
|
22241
|
+
ref = "Duration";
|
|
22242
|
+
break;
|
|
22243
|
+
}
|
|
22244
|
+
case lib.xdr.ScSpecType.scSpecTypeU128().value:
|
|
22245
|
+
{
|
|
22246
|
+
ref = "U128";
|
|
22247
|
+
break;
|
|
22248
|
+
}
|
|
22249
|
+
case lib.xdr.ScSpecType.scSpecTypeI128().value:
|
|
22250
|
+
{
|
|
22251
|
+
ref = "I128";
|
|
22252
|
+
break;
|
|
22253
|
+
}
|
|
22254
|
+
case lib.xdr.ScSpecType.scSpecTypeU256().value:
|
|
22255
|
+
{
|
|
22256
|
+
ref = "U256";
|
|
22257
|
+
break;
|
|
22258
|
+
}
|
|
22259
|
+
case lib.xdr.ScSpecType.scSpecTypeI256().value:
|
|
22260
|
+
{
|
|
22261
|
+
ref = "I256";
|
|
22262
|
+
break;
|
|
22263
|
+
}
|
|
22264
|
+
case lib.xdr.ScSpecType.scSpecTypeBytes().value:
|
|
22265
|
+
{
|
|
22266
|
+
ref = "DataUrl";
|
|
22267
|
+
break;
|
|
22268
|
+
}
|
|
22269
|
+
case lib.xdr.ScSpecType.scSpecTypeString().value:
|
|
22270
|
+
{
|
|
22271
|
+
ref = "ScString";
|
|
22272
|
+
break;
|
|
22273
|
+
}
|
|
22274
|
+
case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
|
|
22275
|
+
{
|
|
22276
|
+
ref = "ScSymbol";
|
|
22277
|
+
break;
|
|
22278
|
+
}
|
|
22279
|
+
case lib.xdr.ScSpecType.scSpecTypeAddress().value:
|
|
22280
|
+
{
|
|
22281
|
+
ref = "Address";
|
|
22282
|
+
break;
|
|
22283
|
+
}
|
|
22284
|
+
case lib.xdr.ScSpecType.scSpecTypeOption().value:
|
|
22285
|
+
{
|
|
22286
|
+
var opt = typeDef.option();
|
|
22287
|
+
return typeRef(opt.valueType());
|
|
22288
|
+
}
|
|
22289
|
+
case lib.xdr.ScSpecType.scSpecTypeResult().value:
|
|
22290
|
+
{
|
|
22291
|
+
break;
|
|
22292
|
+
}
|
|
22293
|
+
case lib.xdr.ScSpecType.scSpecTypeVec().value:
|
|
22294
|
+
{
|
|
22295
|
+
var arr = typeDef.vec();
|
|
22296
|
+
var reference = typeRef(arr.elementType());
|
|
22297
|
+
return {
|
|
22298
|
+
type: "array",
|
|
22299
|
+
items: reference
|
|
22300
|
+
};
|
|
22301
|
+
}
|
|
22302
|
+
case lib.xdr.ScSpecType.scSpecTypeMap().value:
|
|
22303
|
+
{
|
|
22304
|
+
var map = typeDef.map();
|
|
22305
|
+
var items = [typeRef(map.keyType()), typeRef(map.valueType())];
|
|
22306
|
+
return {
|
|
22307
|
+
type: "array",
|
|
22308
|
+
items: {
|
|
22309
|
+
type: "array",
|
|
22310
|
+
items: items,
|
|
22311
|
+
minItems: 2,
|
|
22312
|
+
maxItems: 2
|
|
22313
|
+
}
|
|
22314
|
+
};
|
|
22315
|
+
}
|
|
22316
|
+
case lib.xdr.ScSpecType.scSpecTypeTuple().value:
|
|
22317
|
+
{
|
|
22318
|
+
var tuple = typeDef.tuple();
|
|
22319
|
+
var minItems = tuple.valueTypes().length;
|
|
22320
|
+
var maxItems = minItems;
|
|
22321
|
+
var _items = tuple.valueTypes().map(typeRef);
|
|
22322
|
+
return {
|
|
22323
|
+
type: "array",
|
|
22324
|
+
items: _items,
|
|
22325
|
+
minItems: minItems,
|
|
22326
|
+
maxItems: maxItems
|
|
22327
|
+
};
|
|
22328
|
+
}
|
|
22329
|
+
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
22330
|
+
{
|
|
22331
|
+
var _arr = typeDef.bytesN();
|
|
22332
|
+
return {
|
|
22333
|
+
$ref: "#/definitions/DataUrl",
|
|
22334
|
+
maxLength: _arr.n()
|
|
22335
|
+
};
|
|
22336
|
+
}
|
|
22337
|
+
case lib.xdr.ScSpecType.scSpecTypeUdt().value:
|
|
22338
|
+
{
|
|
22339
|
+
var udt = typeDef.udt();
|
|
22340
|
+
ref = udt.name().toString();
|
|
22341
|
+
break;
|
|
22342
|
+
}
|
|
22343
|
+
}
|
|
22344
|
+
return {
|
|
22345
|
+
$ref: "#/definitions/".concat(ref)
|
|
22346
|
+
};
|
|
22347
|
+
}
|
|
22348
|
+
function isRequired(typeDef) {
|
|
22349
|
+
return typeDef.switch().value !== lib.xdr.ScSpecType.scSpecTypeOption().value;
|
|
22350
|
+
}
|
|
22351
|
+
function argsAndRequired(input) {
|
|
22352
|
+
var properties = {};
|
|
22353
|
+
var required = [];
|
|
22354
|
+
input.forEach(function (arg) {
|
|
22355
|
+
var aType = arg.type();
|
|
22356
|
+
var name = arg.name().toString();
|
|
22357
|
+
properties[name] = typeRef(aType);
|
|
22358
|
+
if (isRequired(aType)) {
|
|
22359
|
+
required.push(name);
|
|
22360
|
+
}
|
|
22361
|
+
});
|
|
22362
|
+
var res = {
|
|
22363
|
+
properties: properties
|
|
22364
|
+
};
|
|
22365
|
+
if (required.length > 0) {
|
|
22366
|
+
res.required = required;
|
|
22367
|
+
}
|
|
22368
|
+
return res;
|
|
22369
|
+
}
|
|
22370
|
+
function structToJsonSchema(udt) {
|
|
22371
|
+
var fields = udt.fields();
|
|
22372
|
+
if (fields.some(isNumeric)) {
|
|
22373
|
+
if (!fields.every(isNumeric)) {
|
|
22374
|
+
throw new Error("mixed numeric and non-numeric field names are not allowed");
|
|
22375
|
+
}
|
|
22376
|
+
var items = fields.map(function (_, i) {
|
|
22377
|
+
return typeRef(fields[i].type());
|
|
22378
|
+
});
|
|
22379
|
+
return {
|
|
22380
|
+
type: "array",
|
|
22381
|
+
items: items,
|
|
22382
|
+
minItems: fields.length,
|
|
22383
|
+
maxItems: fields.length
|
|
22384
|
+
};
|
|
22385
|
+
}
|
|
22386
|
+
var description = udt.doc().toString();
|
|
22387
|
+
var _argsAndRequired = argsAndRequired(fields),
|
|
22388
|
+
properties = _argsAndRequired.properties,
|
|
22389
|
+
required = _argsAndRequired.required;
|
|
22390
|
+
properties.additionalProperties = false;
|
|
22391
|
+
return {
|
|
22392
|
+
description: description,
|
|
22393
|
+
properties: properties,
|
|
22394
|
+
required: required,
|
|
22395
|
+
type: "object"
|
|
22396
|
+
};
|
|
22397
|
+
}
|
|
22398
|
+
function functionToJsonSchema(func) {
|
|
22399
|
+
var _argsAndRequired2 = argsAndRequired(func.inputs()),
|
|
22400
|
+
properties = _argsAndRequired2.properties,
|
|
22401
|
+
required = _argsAndRequired2.required;
|
|
22402
|
+
var args = {
|
|
22403
|
+
additionalProperties: false,
|
|
22404
|
+
properties: properties,
|
|
22405
|
+
type: "object"
|
|
22406
|
+
};
|
|
22407
|
+
if ((required === null || required === void 0 ? void 0 : required.length) > 0) {
|
|
22408
|
+
args.required = required;
|
|
22409
|
+
}
|
|
22410
|
+
var input = {
|
|
22411
|
+
properties: {
|
|
22412
|
+
args: args
|
|
22413
|
+
}
|
|
22414
|
+
};
|
|
22415
|
+
var outputs = func.outputs();
|
|
22416
|
+
var output = outputs.length > 0 ? typeRef(outputs[0]) : typeRef(lib.xdr.ScSpecTypeDef.scSpecTypeVoid());
|
|
22417
|
+
var description = func.doc().toString();
|
|
22418
|
+
if (description.length > 0) {
|
|
22419
|
+
input.description = description;
|
|
22420
|
+
}
|
|
22421
|
+
input.additionalProperties = false;
|
|
22422
|
+
output.additionalProperties = false;
|
|
22423
|
+
return {
|
|
22424
|
+
input: input,
|
|
22425
|
+
output: output
|
|
22426
|
+
};
|
|
22427
|
+
}
|
|
22428
|
+
function unionToJsonSchema(udt) {
|
|
22429
|
+
var description = udt.doc().toString();
|
|
22430
|
+
var cases = udt.cases();
|
|
22431
|
+
var oneOf = [];
|
|
22432
|
+
cases.forEach(function (aCase) {
|
|
22433
|
+
switch (aCase.switch().value) {
|
|
22434
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
|
|
22435
|
+
{
|
|
22436
|
+
var c = aCase.voidCase();
|
|
22437
|
+
var title = c.name().toString();
|
|
22438
|
+
oneOf.push({
|
|
22439
|
+
type: "object",
|
|
22440
|
+
title: title,
|
|
22441
|
+
properties: {
|
|
22442
|
+
tag: title
|
|
22443
|
+
},
|
|
22444
|
+
additionalProperties: false,
|
|
22445
|
+
required: ["tag"]
|
|
22446
|
+
});
|
|
22447
|
+
break;
|
|
22448
|
+
}
|
|
22449
|
+
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
|
|
22450
|
+
{
|
|
22451
|
+
var _c = aCase.tupleCase();
|
|
22452
|
+
var _title = _c.name().toString();
|
|
22453
|
+
oneOf.push({
|
|
22454
|
+
type: "object",
|
|
22455
|
+
title: _title,
|
|
22456
|
+
properties: {
|
|
22457
|
+
tag: _title,
|
|
22458
|
+
values: {
|
|
22459
|
+
type: "array",
|
|
22460
|
+
items: _c.type().map(typeRef)
|
|
22461
|
+
}
|
|
22462
|
+
},
|
|
22463
|
+
required: ["tag", "values"],
|
|
22464
|
+
additionalProperties: false
|
|
22465
|
+
});
|
|
22466
|
+
}
|
|
22467
|
+
}
|
|
22468
|
+
});
|
|
22469
|
+
var res = {
|
|
22470
|
+
oneOf: oneOf
|
|
22471
|
+
};
|
|
22472
|
+
if (description.length > 0) {
|
|
22473
|
+
res.description = description;
|
|
22474
|
+
}
|
|
22475
|
+
return res;
|
|
22476
|
+
}
|
|
22011
22477
|
var Spec = function () {
|
|
22012
22478
|
function Spec(entries) {
|
|
22013
22479
|
spec_classCallCheck(this, Spec);
|
|
22014
22480
|
spec_defineProperty(this, "entries", []);
|
|
22015
|
-
if (entries.length
|
|
22481
|
+
if (entries.length === 0) {
|
|
22016
22482
|
throw new Error("Contract spec must have at least one entry");
|
|
22017
22483
|
}
|
|
22018
22484
|
var entry = entries[0];
|
|
@@ -22076,8 +22542,8 @@ var Spec = function () {
|
|
|
22076
22542
|
}, {
|
|
22077
22543
|
key: "findEntry",
|
|
22078
22544
|
value: function findEntry(name) {
|
|
22079
|
-
var entry = this.entries.find(function (
|
|
22080
|
-
return
|
|
22545
|
+
var entry = this.entries.find(function (e) {
|
|
22546
|
+
return e.value().name().toString() === name;
|
|
22081
22547
|
});
|
|
22082
22548
|
if (!entry) {
|
|
22083
22549
|
throw new Error("no such entry: ".concat(name));
|
|
@@ -22133,9 +22599,9 @@ var Spec = function () {
|
|
|
22133
22599
|
switch (value) {
|
|
22134
22600
|
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
22135
22601
|
{
|
|
22136
|
-
var
|
|
22137
|
-
if (copy.length !==
|
|
22138
|
-
throw new TypeError("expected ".concat(
|
|
22602
|
+
var bytesN = ty.bytesN();
|
|
22603
|
+
if (copy.length !== bytesN.n()) {
|
|
22604
|
+
throw new TypeError("expected ".concat(bytesN.n(), " bytes, but got ").concat(copy.length));
|
|
22139
22605
|
}
|
|
22140
22606
|
return lib.xdr.ScVal.scvBytes(copy);
|
|
22141
22607
|
}
|
|
@@ -22173,10 +22639,10 @@ var Spec = function () {
|
|
|
22173
22639
|
var valueType = map.valueType();
|
|
22174
22640
|
return lib.xdr.ScVal.scvMap(val.map(function (entry) {
|
|
22175
22641
|
var key = _this2.nativeToScVal(entry[0], keyType);
|
|
22176
|
-
var
|
|
22642
|
+
var mapVal = _this2.nativeToScVal(entry[1], valueType);
|
|
22177
22643
|
return new lib.xdr.ScMapEntry({
|
|
22178
22644
|
key: key,
|
|
22179
|
-
val:
|
|
22645
|
+
val: mapVal
|
|
22180
22646
|
});
|
|
22181
22647
|
}));
|
|
22182
22648
|
}
|
|
@@ -22198,10 +22664,10 @@ var Spec = function () {
|
|
|
22198
22664
|
k = _res$value[0],
|
|
22199
22665
|
v = _res$value[1];
|
|
22200
22666
|
var key = this.nativeToScVal(k, scMap.keyType());
|
|
22201
|
-
var
|
|
22667
|
+
var mapval = this.nativeToScVal(v, scMap.valueType());
|
|
22202
22668
|
entries.push(new lib.xdr.ScMapEntry({
|
|
22203
22669
|
key: key,
|
|
22204
|
-
val:
|
|
22670
|
+
val: mapval
|
|
22205
22671
|
}));
|
|
22206
22672
|
res = values.next();
|
|
22207
22673
|
}
|
|
@@ -22285,25 +22751,25 @@ var Spec = function () {
|
|
|
22285
22751
|
key: "nativeToUnion",
|
|
22286
22752
|
value: function nativeToUnion(val, union_) {
|
|
22287
22753
|
var _this3 = this;
|
|
22288
|
-
var
|
|
22289
|
-
var
|
|
22290
|
-
var
|
|
22291
|
-
return
|
|
22754
|
+
var entryName = val.tag;
|
|
22755
|
+
var caseFound = union_.cases().find(function (entry) {
|
|
22756
|
+
var caseN = entry.value().name().toString();
|
|
22757
|
+
return caseN === entryName;
|
|
22292
22758
|
});
|
|
22293
|
-
if (!
|
|
22294
|
-
throw new TypeError("no such enum entry: ".concat(
|
|
22759
|
+
if (!caseFound) {
|
|
22760
|
+
throw new TypeError("no such enum entry: ".concat(entryName, " in ").concat(union_));
|
|
22295
22761
|
}
|
|
22296
|
-
var key = lib.xdr.ScVal.scvSymbol(
|
|
22297
|
-
switch (
|
|
22762
|
+
var key = lib.xdr.ScVal.scvSymbol(entryName);
|
|
22763
|
+
switch (caseFound.switch()) {
|
|
22298
22764
|
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0():
|
|
22299
22765
|
{
|
|
22300
22766
|
return lib.xdr.ScVal.scvVec([key]);
|
|
22301
22767
|
}
|
|
22302
22768
|
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0():
|
|
22303
22769
|
{
|
|
22304
|
-
var types =
|
|
22770
|
+
var types = caseFound.tupleCase().type();
|
|
22305
22771
|
if (Array.isArray(val.values)) {
|
|
22306
|
-
if (val.values.length
|
|
22772
|
+
if (val.values.length !== types.length) {
|
|
22307
22773
|
throw new TypeError("union ".concat(union_, " expects ").concat(types.length, " values, but got ").concat(val.values.length));
|
|
22308
22774
|
}
|
|
22309
22775
|
var scvals = val.values.map(function (v, i) {
|
|
@@ -22312,7 +22778,7 @@ var Spec = function () {
|
|
|
22312
22778
|
scvals.unshift(key);
|
|
22313
22779
|
return lib.xdr.ScVal.scvVec(scvals);
|
|
22314
22780
|
}
|
|
22315
|
-
throw new Error("failed to parse union case ".concat(
|
|
22781
|
+
throw new Error("failed to parse union case ".concat(caseFound, " with ").concat(val));
|
|
22316
22782
|
}
|
|
22317
22783
|
default:
|
|
22318
22784
|
throw new Error("failed to parse union ".concat(union_, " with ").concat(val));
|
|
@@ -22365,7 +22831,7 @@ var Spec = function () {
|
|
|
22365
22831
|
}
|
|
22366
22832
|
switch (scv.switch().value) {
|
|
22367
22833
|
case lib.xdr.ScValType.scvVoid().value:
|
|
22368
|
-
return
|
|
22834
|
+
return undefined;
|
|
22369
22835
|
case lib.xdr.ScValType.scvU64().value:
|
|
22370
22836
|
case lib.xdr.ScValType.scvI64().value:
|
|
22371
22837
|
case lib.xdr.ScValType.scvU128().value:
|
|
@@ -22375,13 +22841,14 @@ var Spec = function () {
|
|
|
22375
22841
|
return (0,lib.scValToBigInt)(scv);
|
|
22376
22842
|
case lib.xdr.ScValType.scvVec().value:
|
|
22377
22843
|
{
|
|
22378
|
-
if (value
|
|
22844
|
+
if (value === lib.xdr.ScSpecType.scSpecTypeVec().value) {
|
|
22379
22845
|
var _scv$vec;
|
|
22380
22846
|
var vec = typeDef.vec();
|
|
22381
22847
|
return ((_scv$vec = scv.vec()) !== null && _scv$vec !== void 0 ? _scv$vec : []).map(function (elm) {
|
|
22382
22848
|
return _this5.scValToNative(elm, vec.elementType());
|
|
22383
22849
|
});
|
|
22384
|
-
}
|
|
22850
|
+
}
|
|
22851
|
+
if (value === lib.xdr.ScSpecType.scSpecTypeTuple().value) {
|
|
22385
22852
|
var _scv$vec2;
|
|
22386
22853
|
var tuple = typeDef.tuple();
|
|
22387
22854
|
var valTypes = tuple.valueTypes();
|
|
@@ -22397,10 +22864,10 @@ var Spec = function () {
|
|
|
22397
22864
|
{
|
|
22398
22865
|
var _scv$map;
|
|
22399
22866
|
var map = (_scv$map = scv.map()) !== null && _scv$map !== void 0 ? _scv$map : [];
|
|
22400
|
-
if (value
|
|
22401
|
-
var
|
|
22402
|
-
var keyType =
|
|
22403
|
-
var valueType =
|
|
22867
|
+
if (value === lib.xdr.ScSpecType.scSpecTypeMap().value) {
|
|
22868
|
+
var typed = typeDef.map();
|
|
22869
|
+
var keyType = typed.keyType();
|
|
22870
|
+
var valueType = typed.valueType();
|
|
22404
22871
|
var res = map.map(function (entry) {
|
|
22405
22872
|
return [_this5.scValToNative(entry.key(), keyType), _this5.scValToNative(entry.val(), valueType)];
|
|
22406
22873
|
});
|
|
@@ -22456,7 +22923,7 @@ var Spec = function () {
|
|
|
22456
22923
|
throw new Error("".concat(val, " has length 0, but the there are at least one case in the union"));
|
|
22457
22924
|
}
|
|
22458
22925
|
var name = vec[0].sym().toString();
|
|
22459
|
-
if (vec[0].switch().value
|
|
22926
|
+
if (vec[0].switch().value !== lib.xdr.ScValType.scvSymbol().value) {
|
|
22460
22927
|
throw new Error("{vec[0]} is not a symbol");
|
|
22461
22928
|
}
|
|
22462
22929
|
var entry = udt.cases().find(findCase(name));
|
|
@@ -22469,8 +22936,8 @@ var Spec = function () {
|
|
|
22469
22936
|
if (entry.switch().value === lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value) {
|
|
22470
22937
|
var tuple = entry.tupleCase();
|
|
22471
22938
|
var ty = tuple.type();
|
|
22472
|
-
var values = ty.map(function (
|
|
22473
|
-
return _this6.scValToNative(vec[i + 1],
|
|
22939
|
+
var values = ty.map(function (e, i) {
|
|
22940
|
+
return _this6.scValToNative(vec[i + 1], e);
|
|
22474
22941
|
});
|
|
22475
22942
|
res.values = values;
|
|
22476
22943
|
}
|
|
@@ -22518,514 +22985,50 @@ var Spec = function () {
|
|
|
22518
22985
|
key: "jsonSchema",
|
|
22519
22986
|
value: function jsonSchema(funcName) {
|
|
22520
22987
|
var definitions = {};
|
|
22521
|
-
|
|
22522
|
-
|
|
22523
|
-
|
|
22524
|
-
|
|
22525
|
-
|
|
22526
|
-
|
|
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);
|
|
22988
|
+
this.entries.forEach(function (entry) {
|
|
22989
|
+
switch (entry.switch().value) {
|
|
22990
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0().value:
|
|
22991
|
+
{
|
|
22992
|
+
var udt = entry.udtEnumV0();
|
|
22993
|
+
definitions[udt.name().toString()] = enumToJsonSchema(udt);
|
|
22542
22994
|
break;
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
|
|
22546
|
-
|
|
22547
|
-
|
|
22548
|
-
|
|
22549
|
-
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22995
|
+
}
|
|
22996
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtStructV0().value:
|
|
22997
|
+
{
|
|
22998
|
+
var _udt = entry.udtStructV0();
|
|
22999
|
+
definitions[_udt.name().toString()] = structToJsonSchema(_udt);
|
|
23000
|
+
break;
|
|
23001
|
+
}
|
|
23002
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0().value:
|
|
23003
|
+
{
|
|
23004
|
+
var _udt2 = entry.udtUnionV0();
|
|
23005
|
+
definitions[_udt2.name().toString()] = unionToJsonSchema(_udt2);
|
|
23006
|
+
break;
|
|
23007
|
+
}
|
|
23008
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value:
|
|
23009
|
+
{
|
|
23010
|
+
var fn = entry.functionV0();
|
|
23011
|
+
var fnName = fn.name().toString();
|
|
23012
|
+
var _functionToJsonSchema = functionToJsonSchema(fn),
|
|
23013
|
+
input = _functionToJsonSchema.input;
|
|
23014
|
+
definitions[fnName] = input;
|
|
23015
|
+
break;
|
|
23016
|
+
}
|
|
23017
|
+
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtErrorEnumV0().value:
|
|
23018
|
+
{}
|
|
22555
23019
|
}
|
|
22556
|
-
}
|
|
22557
|
-
_iterator.e(err);
|
|
22558
|
-
} finally {
|
|
22559
|
-
_iterator.f();
|
|
22560
|
-
}
|
|
23020
|
+
});
|
|
22561
23021
|
var res = {
|
|
22562
23022
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
22563
23023
|
definitions: spec_objectSpread(spec_objectSpread({}, PRIMITIVE_DEFINITONS), definitions)
|
|
22564
23024
|
};
|
|
22565
23025
|
if (funcName) {
|
|
22566
|
-
res
|
|
23026
|
+
res.$ref = "#/definitions/".concat(funcName);
|
|
22567
23027
|
}
|
|
22568
23028
|
return res;
|
|
22569
23029
|
}
|
|
22570
23030
|
}]);
|
|
22571
23031
|
}();
|
|
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
23032
|
// EXTERNAL MODULE: ./src/rpc/index.ts
|
|
23030
23033
|
var rpc = __webpack_require__(1660);
|
|
23031
23034
|
;// CONCATENATED MODULE: ./src/contract/client.ts
|
|
@@ -23037,8 +23040,8 @@ function client_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c),
|
|
|
23037
23040
|
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
23041
|
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
23042
|
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
|
|
23041
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.
|
|
23043
|
+
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; }
|
|
23044
|
+
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
23045
|
function client_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
23043
23046
|
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
23047
|
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 +23216,6 @@ var Client = function () {
|
|
|
23213
23216
|
|
|
23214
23217
|
|
|
23215
23218
|
|
|
23216
|
-
|
|
23217
23219
|
/***/ }),
|
|
23218
23220
|
|
|
23219
23221
|
/***/ 5885:
|
|
@@ -26724,14 +26726,14 @@ var AxiosClient = axios/* default */.A.create({
|
|
|
26724
26726
|
"X-Client-Version": version
|
|
26725
26727
|
}
|
|
26726
26728
|
});
|
|
26727
|
-
function
|
|
26729
|
+
function toSeconds(ms) {
|
|
26728
26730
|
return Math.floor(ms / 1000);
|
|
26729
26731
|
}
|
|
26730
|
-
AxiosClient.interceptors.response.use(function
|
|
26732
|
+
AxiosClient.interceptors.response.use(function (response) {
|
|
26731
26733
|
var hostname = URI_default()(response.config.url).hostname();
|
|
26732
|
-
var serverTime =
|
|
26733
|
-
var localTimeRecorded =
|
|
26734
|
-
if (!isNaN(serverTime)) {
|
|
26734
|
+
var serverTime = toSeconds(Date.parse(response.headers.date));
|
|
26735
|
+
var localTimeRecorded = toSeconds(new Date().getTime());
|
|
26736
|
+
if (!Number.isNaN(serverTime)) {
|
|
26735
26737
|
SERVER_TIME_MAP[hostname] = {
|
|
26736
26738
|
serverTime: serverTime,
|
|
26737
26739
|
localTimeRecorded: localTimeRecorded
|
|
@@ -26747,7 +26749,7 @@ function getCurrentServerTime(hostname) {
|
|
|
26747
26749
|
}
|
|
26748
26750
|
var serverTime = entry.serverTime,
|
|
26749
26751
|
localTimeRecorded = entry.localTimeRecorded;
|
|
26750
|
-
var currentTime =
|
|
26752
|
+
var currentTime = toSeconds(new Date().getTime());
|
|
26751
26753
|
if (currentTime - localTimeRecorded > 60 * 5) {
|
|
26752
26754
|
return null;
|
|
26753
26755
|
}
|
|
@@ -26948,8 +26950,7 @@ var CallBuilder = function () {
|
|
|
26948
26950
|
if (!json._links) {
|
|
26949
26951
|
return json;
|
|
26950
26952
|
}
|
|
26951
|
-
|
|
26952
|
-
var key = _Object$keys[_i];
|
|
26953
|
+
Object.keys(json._links).forEach(function (key) {
|
|
26953
26954
|
var n = json._links[key];
|
|
26954
26955
|
var included = false;
|
|
26955
26956
|
if (typeof json[key] !== "undefined") {
|
|
@@ -26972,10 +26973,7 @@ var CallBuilder = function () {
|
|
|
26972
26973
|
} else {
|
|
26973
26974
|
json[key] = _this4._requestFnForLink(n);
|
|
26974
26975
|
}
|
|
26975
|
-
};
|
|
26976
|
-
for (var _i = 0, _Object$keys = Object.keys(json._links); _i < _Object$keys.length; _i++) {
|
|
26977
|
-
_loop();
|
|
26978
|
-
}
|
|
26976
|
+
});
|
|
26979
26977
|
return json;
|
|
26980
26978
|
}
|
|
26981
26979
|
}, {
|
|
@@ -27786,13 +27784,9 @@ var TradeAggregationCallBuilder = function (_CallBuilder) {
|
|
|
27786
27784
|
return trade_aggregation_call_builder_createClass(TradeAggregationCallBuilder, [{
|
|
27787
27785
|
key: "isValidResolution",
|
|
27788
27786
|
value: function isValidResolution(resolution) {
|
|
27789
|
-
|
|
27790
|
-
|
|
27791
|
-
|
|
27792
|
-
return true;
|
|
27793
|
-
}
|
|
27794
|
-
}
|
|
27795
|
-
return false;
|
|
27787
|
+
return allowedResolutions.some(function (allowed) {
|
|
27788
|
+
return allowed === resolution;
|
|
27789
|
+
});
|
|
27796
27790
|
}
|
|
27797
27791
|
}, {
|
|
27798
27792
|
key: "isValidOffset",
|
|
@@ -27930,6 +27924,9 @@ var TransactionCallBuilder = function (_CallBuilder) {
|
|
|
27930
27924
|
}(CallBuilder);
|
|
27931
27925
|
;// CONCATENATED MODULE: ./src/horizon/server.ts
|
|
27932
27926
|
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); }
|
|
27927
|
+
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; }
|
|
27928
|
+
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; }
|
|
27929
|
+
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
27930
|
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
27931
|
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
27932
|
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 +27962,7 @@ function server_toPrimitive(t, r) { if ("object" != server_typeof(t) || !t) retu
|
|
|
27965
27962
|
var SUBMIT_TRANSACTION_TIMEOUT = 60 * 1000;
|
|
27966
27963
|
var STROOPS_IN_LUMEN = 10000000;
|
|
27967
27964
|
var ACCOUNT_REQUIRES_MEMO = "MQ==";
|
|
27968
|
-
function
|
|
27965
|
+
function getAmountInLumens(amt) {
|
|
27969
27966
|
return new bignumber(amt).div(STROOPS_IN_LUMEN).toString();
|
|
27970
27967
|
}
|
|
27971
27968
|
var Server = function () {
|
|
@@ -27984,6 +27981,9 @@ var Server = function () {
|
|
|
27984
27981
|
if (opts.authToken) {
|
|
27985
27982
|
customHeaders["X-Auth-Token"] = opts.authToken;
|
|
27986
27983
|
}
|
|
27984
|
+
if (opts.headers) {
|
|
27985
|
+
Object.assign(customHeaders, opts.headers);
|
|
27986
|
+
}
|
|
27987
27987
|
if (Object.keys(customHeaders).length > 0) {
|
|
27988
27988
|
horizon_axios_client.interceptors.request.use(function (config) {
|
|
27989
27989
|
config.headers = Object.assign(config.headers, customHeaders);
|
|
@@ -28027,11 +28027,8 @@ var Server = function () {
|
|
|
28027
28027
|
_context.next = 8;
|
|
28028
28028
|
return horizon_axios_client.get(URI_default()(this.serverURL).toString());
|
|
28029
28029
|
case 8:
|
|
28030
|
-
_context.
|
|
28031
|
-
|
|
28032
|
-
case 10:
|
|
28033
|
-
return _context.abrupt("return", _context.sent);
|
|
28034
|
-
case 11:
|
|
28030
|
+
return _context.abrupt("return", this.fetchTimebounds(seconds, true));
|
|
28031
|
+
case 9:
|
|
28035
28032
|
case "end":
|
|
28036
28033
|
return _context.stop();
|
|
28037
28034
|
}
|
|
@@ -28139,7 +28136,7 @@ var Server = function () {
|
|
|
28139
28136
|
sellerId = lib.StrKey.encodeEd25519PublicKey(offerClaimed.sellerId().ed25519());
|
|
28140
28137
|
break;
|
|
28141
28138
|
default:
|
|
28142
|
-
throw new Error("Invalid offer result type: "
|
|
28139
|
+
throw new Error("Invalid offer result type: ".concat(offerClaimedAtom.switch()));
|
|
28143
28140
|
}
|
|
28144
28141
|
var claimedOfferAmountBought = new bignumber(offerClaimed.amountBought().toString());
|
|
28145
28142
|
var claimedOfferAmountSold = new bignumber(offerClaimed.amountSold().toString());
|
|
@@ -28161,9 +28158,9 @@ var Server = function () {
|
|
|
28161
28158
|
sellerId: sellerId,
|
|
28162
28159
|
offerId: offerClaimed.offerId().toString(),
|
|
28163
28160
|
assetSold: assetSold,
|
|
28164
|
-
amountSold:
|
|
28161
|
+
amountSold: getAmountInLumens(claimedOfferAmountSold),
|
|
28165
28162
|
assetBought: assetBought,
|
|
28166
|
-
amountBought:
|
|
28163
|
+
amountBought: getAmountInLumens(claimedOfferAmountBought)
|
|
28167
28164
|
};
|
|
28168
28165
|
});
|
|
28169
28166
|
var effect = offerSuccess.offer().switch().name;
|
|
@@ -28174,7 +28171,7 @@ var Server = function () {
|
|
|
28174
28171
|
offerId: offerXDR.offerId().toString(),
|
|
28175
28172
|
selling: {},
|
|
28176
28173
|
buying: {},
|
|
28177
|
-
amount:
|
|
28174
|
+
amount: getAmountInLumens(offerXDR.amount().toString()),
|
|
28178
28175
|
price: {
|
|
28179
28176
|
n: offerXDR.price().n(),
|
|
28180
28177
|
d: offerXDR.price().d()
|
|
@@ -28198,8 +28195,8 @@ var Server = function () {
|
|
|
28198
28195
|
effect: effect,
|
|
28199
28196
|
operationIndex: i,
|
|
28200
28197
|
currentOffer: currentOffer,
|
|
28201
|
-
amountBought:
|
|
28202
|
-
amountSold:
|
|
28198
|
+
amountBought: getAmountInLumens(amountBought),
|
|
28199
|
+
amountSold: getAmountInLumens(amountSold),
|
|
28203
28200
|
isFullyOpen: !offersClaimed.length && effect !== "manageOfferDeleted",
|
|
28204
28201
|
wasPartiallyFilled: !!offersClaimed.length && effect !== "manageOfferDeleted",
|
|
28205
28202
|
wasImmediatelyFilled: !!offersClaimed.length && effect === "manageOfferDeleted",
|
|
@@ -28209,7 +28206,7 @@ var Server = function () {
|
|
|
28209
28206
|
return !!result;
|
|
28210
28207
|
});
|
|
28211
28208
|
}
|
|
28212
|
-
return
|
|
28209
|
+
return _objectSpread(_objectSpread({}, response.data), {}, {
|
|
28213
28210
|
offerResults: hasManageOffer ? offerResults : undefined
|
|
28214
28211
|
});
|
|
28215
28212
|
}).catch(function (response) {
|
|
@@ -28229,6 +28226,46 @@ var Server = function () {
|
|
|
28229
28226
|
}
|
|
28230
28227
|
return submitTransaction;
|
|
28231
28228
|
}())
|
|
28229
|
+
}, {
|
|
28230
|
+
key: "submitAsyncTransaction",
|
|
28231
|
+
value: (function () {
|
|
28232
|
+
var _submitAsyncTransaction = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee5(transaction) {
|
|
28233
|
+
var opts,
|
|
28234
|
+
tx,
|
|
28235
|
+
_args5 = arguments;
|
|
28236
|
+
return server_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
28237
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
28238
|
+
case 0:
|
|
28239
|
+
opts = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {
|
|
28240
|
+
skipMemoRequiredCheck: false
|
|
28241
|
+
};
|
|
28242
|
+
if (opts.skipMemoRequiredCheck) {
|
|
28243
|
+
_context5.next = 4;
|
|
28244
|
+
break;
|
|
28245
|
+
}
|
|
28246
|
+
_context5.next = 4;
|
|
28247
|
+
return this.checkMemoRequired(transaction);
|
|
28248
|
+
case 4:
|
|
28249
|
+
tx = encodeURIComponent(transaction.toEnvelope().toXDR().toString("base64"));
|
|
28250
|
+
return _context5.abrupt("return", horizon_axios_client.post(URI_default()(this.serverURL).segment("transactions_async").toString(), "tx=".concat(tx)).then(function (response) {
|
|
28251
|
+
return response.data;
|
|
28252
|
+
}).catch(function (response) {
|
|
28253
|
+
if (response instanceof Error) {
|
|
28254
|
+
return Promise.reject(response);
|
|
28255
|
+
}
|
|
28256
|
+
return Promise.reject(new errors/* BadResponseError */.nS("Transaction submission failed. Server responded: ".concat(response.status, " ").concat(response.statusText), response.data));
|
|
28257
|
+
}));
|
|
28258
|
+
case 6:
|
|
28259
|
+
case "end":
|
|
28260
|
+
return _context5.stop();
|
|
28261
|
+
}
|
|
28262
|
+
}, _callee5, this);
|
|
28263
|
+
}));
|
|
28264
|
+
function submitAsyncTransaction(_x3) {
|
|
28265
|
+
return _submitAsyncTransaction.apply(this, arguments);
|
|
28266
|
+
}
|
|
28267
|
+
return submitAsyncTransaction;
|
|
28268
|
+
}())
|
|
28232
28269
|
}, {
|
|
28233
28270
|
key: "accounts",
|
|
28234
28271
|
value: function accounts() {
|
|
@@ -28307,23 +28344,23 @@ var Server = function () {
|
|
|
28307
28344
|
}, {
|
|
28308
28345
|
key: "loadAccount",
|
|
28309
28346
|
value: (function () {
|
|
28310
|
-
var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
28347
|
+
var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6(accountId) {
|
|
28311
28348
|
var res;
|
|
28312
|
-
return server_regeneratorRuntime().wrap(function
|
|
28313
|
-
while (1) switch (
|
|
28349
|
+
return server_regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
28350
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
28314
28351
|
case 0:
|
|
28315
|
-
|
|
28352
|
+
_context6.next = 2;
|
|
28316
28353
|
return this.accounts().accountId(accountId).call();
|
|
28317
28354
|
case 2:
|
|
28318
|
-
res =
|
|
28319
|
-
return
|
|
28355
|
+
res = _context6.sent;
|
|
28356
|
+
return _context6.abrupt("return", new AccountResponse(res));
|
|
28320
28357
|
case 4:
|
|
28321
28358
|
case "end":
|
|
28322
|
-
return
|
|
28359
|
+
return _context6.stop();
|
|
28323
28360
|
}
|
|
28324
|
-
},
|
|
28361
|
+
}, _callee6, this);
|
|
28325
28362
|
}));
|
|
28326
|
-
function loadAccount(
|
|
28363
|
+
function loadAccount(_x4) {
|
|
28327
28364
|
return _loadAccount.apply(this, arguments);
|
|
28328
28365
|
}
|
|
28329
28366
|
return loadAccount;
|
|
@@ -28336,90 +28373,90 @@ var Server = function () {
|
|
|
28336
28373
|
}, {
|
|
28337
28374
|
key: "checkMemoRequired",
|
|
28338
28375
|
value: (function () {
|
|
28339
|
-
var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
28376
|
+
var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee7(transaction) {
|
|
28340
28377
|
var destinations, i, operation, destination, account;
|
|
28341
|
-
return server_regeneratorRuntime().wrap(function
|
|
28342
|
-
while (1) switch (
|
|
28378
|
+
return server_regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
28379
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
28343
28380
|
case 0:
|
|
28344
28381
|
if (transaction instanceof lib.FeeBumpTransaction) {
|
|
28345
28382
|
transaction = transaction.innerTransaction;
|
|
28346
28383
|
}
|
|
28347
28384
|
if (!(transaction.memo.type !== "none")) {
|
|
28348
|
-
|
|
28385
|
+
_context7.next = 3;
|
|
28349
28386
|
break;
|
|
28350
28387
|
}
|
|
28351
|
-
return
|
|
28388
|
+
return _context7.abrupt("return");
|
|
28352
28389
|
case 3:
|
|
28353
28390
|
destinations = new Set();
|
|
28354
28391
|
i = 0;
|
|
28355
28392
|
case 5:
|
|
28356
28393
|
if (!(i < transaction.operations.length)) {
|
|
28357
|
-
|
|
28394
|
+
_context7.next = 36;
|
|
28358
28395
|
break;
|
|
28359
28396
|
}
|
|
28360
28397
|
operation = transaction.operations[i];
|
|
28361
|
-
|
|
28362
|
-
|
|
28398
|
+
_context7.t0 = operation.type;
|
|
28399
|
+
_context7.next = _context7.t0 === "payment" ? 10 : _context7.t0 === "pathPaymentStrictReceive" ? 10 : _context7.t0 === "pathPaymentStrictSend" ? 10 : _context7.t0 === "accountMerge" ? 10 : 11;
|
|
28363
28400
|
break;
|
|
28364
28401
|
case 10:
|
|
28365
|
-
return
|
|
28402
|
+
return _context7.abrupt("break", 12);
|
|
28366
28403
|
case 11:
|
|
28367
|
-
return
|
|
28404
|
+
return _context7.abrupt("continue", 33);
|
|
28368
28405
|
case 12:
|
|
28369
28406
|
destination = operation.destination;
|
|
28370
28407
|
if (!destinations.has(destination)) {
|
|
28371
|
-
|
|
28408
|
+
_context7.next = 15;
|
|
28372
28409
|
break;
|
|
28373
28410
|
}
|
|
28374
|
-
return
|
|
28411
|
+
return _context7.abrupt("continue", 33);
|
|
28375
28412
|
case 15:
|
|
28376
28413
|
destinations.add(destination);
|
|
28377
28414
|
if (!destination.startsWith("M")) {
|
|
28378
|
-
|
|
28415
|
+
_context7.next = 18;
|
|
28379
28416
|
break;
|
|
28380
28417
|
}
|
|
28381
|
-
return
|
|
28418
|
+
return _context7.abrupt("continue", 33);
|
|
28382
28419
|
case 18:
|
|
28383
|
-
|
|
28384
|
-
|
|
28420
|
+
_context7.prev = 18;
|
|
28421
|
+
_context7.next = 21;
|
|
28385
28422
|
return this.loadAccount(destination);
|
|
28386
28423
|
case 21:
|
|
28387
|
-
account =
|
|
28424
|
+
account = _context7.sent;
|
|
28388
28425
|
if (!(account.data_attr["config.memo_required"] === ACCOUNT_REQUIRES_MEMO)) {
|
|
28389
|
-
|
|
28426
|
+
_context7.next = 24;
|
|
28390
28427
|
break;
|
|
28391
28428
|
}
|
|
28392
28429
|
throw new errors/* AccountRequiresMemoError */.Cu("account requires memo", destination, i);
|
|
28393
28430
|
case 24:
|
|
28394
|
-
|
|
28431
|
+
_context7.next = 33;
|
|
28395
28432
|
break;
|
|
28396
28433
|
case 26:
|
|
28397
|
-
|
|
28398
|
-
|
|
28399
|
-
if (!(
|
|
28400
|
-
|
|
28434
|
+
_context7.prev = 26;
|
|
28435
|
+
_context7.t1 = _context7["catch"](18);
|
|
28436
|
+
if (!(_context7.t1 instanceof errors/* AccountRequiresMemoError */.Cu)) {
|
|
28437
|
+
_context7.next = 30;
|
|
28401
28438
|
break;
|
|
28402
28439
|
}
|
|
28403
|
-
throw
|
|
28440
|
+
throw _context7.t1;
|
|
28404
28441
|
case 30:
|
|
28405
|
-
if (
|
|
28406
|
-
|
|
28442
|
+
if (_context7.t1 instanceof errors/* NotFoundError */.m_) {
|
|
28443
|
+
_context7.next = 32;
|
|
28407
28444
|
break;
|
|
28408
28445
|
}
|
|
28409
|
-
throw
|
|
28446
|
+
throw _context7.t1;
|
|
28410
28447
|
case 32:
|
|
28411
|
-
return
|
|
28448
|
+
return _context7.abrupt("continue", 33);
|
|
28412
28449
|
case 33:
|
|
28413
|
-
i
|
|
28414
|
-
|
|
28450
|
+
i += 1;
|
|
28451
|
+
_context7.next = 5;
|
|
28415
28452
|
break;
|
|
28416
28453
|
case 36:
|
|
28417
28454
|
case "end":
|
|
28418
|
-
return
|
|
28455
|
+
return _context7.stop();
|
|
28419
28456
|
}
|
|
28420
|
-
},
|
|
28457
|
+
}, _callee7, this, [[18, 26]]);
|
|
28421
28458
|
}));
|
|
28422
|
-
function checkMemoRequired(
|
|
28459
|
+
function checkMemoRequired(_x5) {
|
|
28423
28460
|
return _checkMemoRequired.apply(this, arguments);
|
|
28424
28461
|
}
|
|
28425
28462
|
return checkMemoRequired;
|
|
@@ -28469,7 +28506,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28469
28506
|
/* harmony import */ var _friendbot__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8242);
|
|
28470
28507
|
/* harmony import */ var _horizon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2731);
|
|
28471
28508
|
/* harmony import */ var _rpc__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1660);
|
|
28472
|
-
/* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(
|
|
28509
|
+
/* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(6299);
|
|
28473
28510
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(356);
|
|
28474
28511
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__);
|
|
28475
28512
|
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
@@ -28613,7 +28650,7 @@ function parseRawSendTransaction(r) {
|
|
|
28613
28650
|
diagnosticEventsXdr = r.diagnosticEventsXdr;
|
|
28614
28651
|
delete r.errorResultXdr;
|
|
28615
28652
|
delete r.diagnosticEventsXdr;
|
|
28616
|
-
if (
|
|
28653
|
+
if (errorResultXdr) {
|
|
28617
28654
|
return _objectSpread(_objectSpread(_objectSpread({}, r), diagnosticEventsXdr !== undefined && diagnosticEventsXdr.length > 0 && {
|
|
28618
28655
|
diagnosticEvents: diagnosticEventsXdr.map(function (evt) {
|
|
28619
28656
|
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
|
|
@@ -28660,27 +28697,6 @@ function parseRawLedgerEntries(raw) {
|
|
|
28660
28697
|
})
|
|
28661
28698
|
};
|
|
28662
28699
|
}
|
|
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
28700
|
function parseSuccessful(sim, partial) {
|
|
28685
28701
|
var _sim$results$length, _sim$results, _sim$stateChanges$len, _sim$stateChanges, _sim$stateChanges2;
|
|
28686
28702
|
var success = _objectSpread(_objectSpread(_objectSpread({}, partial), {}, {
|
|
@@ -28694,7 +28710,7 @@ function parseSuccessful(sim, partial) {
|
|
|
28694
28710
|
auth: ((_row$auth = row.auth) !== null && _row$auth !== void 0 ? _row$auth : []).map(function (entry) {
|
|
28695
28711
|
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64');
|
|
28696
28712
|
}),
|
|
28697
|
-
retval:
|
|
28713
|
+
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
28714
|
};
|
|
28699
28715
|
})[0]
|
|
28700
28716
|
}), ((_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 +28733,27 @@ function parseSuccessful(sim, partial) {
|
|
|
28717
28733
|
}
|
|
28718
28734
|
});
|
|
28719
28735
|
}
|
|
28736
|
+
function parseRawSimulation(sim) {
|
|
28737
|
+
var _sim$events$map, _sim$events;
|
|
28738
|
+
var looksRaw = _api__WEBPACK_IMPORTED_MODULE_1__/* .Api */ .j.isSimulationRaw(sim);
|
|
28739
|
+
if (!looksRaw) {
|
|
28740
|
+
return sim;
|
|
28741
|
+
}
|
|
28742
|
+
var base = {
|
|
28743
|
+
_parsed: true,
|
|
28744
|
+
id: sim.id,
|
|
28745
|
+
latestLedger: sim.latestLedger,
|
|
28746
|
+
events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
|
|
28747
|
+
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
|
|
28748
|
+
})) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
|
|
28749
|
+
};
|
|
28750
|
+
if (typeof sim.error === 'string') {
|
|
28751
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
28752
|
+
error: sim.error
|
|
28753
|
+
});
|
|
28754
|
+
}
|
|
28755
|
+
return parseSuccessful(sim, base);
|
|
28756
|
+
}
|
|
28720
28757
|
|
|
28721
28758
|
/***/ }),
|
|
28722
28759
|
|
|
@@ -28746,6 +28783,9 @@ function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _r
|
|
|
28746
28783
|
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
28784
|
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
28785
|
|
|
28786
|
+
function jsonrpc_hasOwnProperty(obj, prop) {
|
|
28787
|
+
return obj.hasOwnProperty(prop);
|
|
28788
|
+
}
|
|
28749
28789
|
function postObject(_x, _x2) {
|
|
28750
28790
|
return _postObject.apply(this, arguments);
|
|
28751
28791
|
}
|
|
@@ -28783,9 +28823,6 @@ function _postObject() {
|
|
|
28783
28823
|
}));
|
|
28784
28824
|
return _postObject.apply(this, arguments);
|
|
28785
28825
|
}
|
|
28786
|
-
function jsonrpc_hasOwnProperty(obj, prop) {
|
|
28787
|
-
return obj.hasOwnProperty(prop);
|
|
28788
|
-
}
|
|
28789
28826
|
// EXTERNAL MODULE: ./src/rpc/api.ts
|
|
28790
28827
|
var api = __webpack_require__(4076);
|
|
28791
28828
|
// EXTERNAL MODULE: ./src/rpc/transaction.ts
|
|
@@ -28795,9 +28832,6 @@ var parsers = __webpack_require__(784);
|
|
|
28795
28832
|
;// CONCATENATED MODULE: ./src/rpc/server.ts
|
|
28796
28833
|
/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"];
|
|
28797
28834
|
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
28835
|
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
28836
|
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
28837
|
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 +28856,37 @@ var Durability = function (Durability) {
|
|
|
28822
28856
|
Durability["Persistent"] = "persistent";
|
|
28823
28857
|
return Durability;
|
|
28824
28858
|
}({});
|
|
28859
|
+
function findCreatedAccountSequenceInTransactionMeta(meta) {
|
|
28860
|
+
var _operations$flatMap$f;
|
|
28861
|
+
var operations = [];
|
|
28862
|
+
switch (meta.switch()) {
|
|
28863
|
+
case 0:
|
|
28864
|
+
operations = meta.operations();
|
|
28865
|
+
break;
|
|
28866
|
+
case 1:
|
|
28867
|
+
case 2:
|
|
28868
|
+
case 3:
|
|
28869
|
+
operations = meta.value().operations();
|
|
28870
|
+
break;
|
|
28871
|
+
default:
|
|
28872
|
+
throw new Error('Unexpected transaction meta switch value');
|
|
28873
|
+
}
|
|
28874
|
+
var sequenceNumber = (_operations$flatMap$f = operations.flatMap(function (op) {
|
|
28875
|
+
return op.changes();
|
|
28876
|
+
}).find(function (c) {
|
|
28877
|
+
return c.switch() === lib.xdr.LedgerEntryChangeType.ledgerEntryCreated() && c.created().data().switch() === lib.xdr.LedgerEntryType.account();
|
|
28878
|
+
})) === 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();
|
|
28879
|
+
if (sequenceNumber) {
|
|
28880
|
+
return sequenceNumber;
|
|
28881
|
+
}
|
|
28882
|
+
throw new Error('No account created in transaction');
|
|
28883
|
+
}
|
|
28825
28884
|
var Server = function () {
|
|
28826
28885
|
function Server(serverURL) {
|
|
28827
28886
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28828
28887
|
_classCallCheck(this, Server);
|
|
28829
28888
|
this.serverURL = URI_default()(serverURL);
|
|
28830
|
-
if (opts.headers && Object.keys(opts.headers).length
|
|
28889
|
+
if (opts.headers && Object.keys(opts.headers).length !== 0) {
|
|
28831
28890
|
axios/* default */.Ay.interceptors.request.use(function (config) {
|
|
28832
28891
|
config.headers = Object.assign(config.headers, opts.headers);
|
|
28833
28892
|
return config;
|
|
@@ -29220,11 +29279,8 @@ var Server = function () {
|
|
|
29220
29279
|
return server_regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
29221
29280
|
while (1) switch (_context12.prev = _context12.next) {
|
|
29222
29281
|
case 0:
|
|
29223
|
-
_context12.
|
|
29224
|
-
|
|
29225
|
-
case 2:
|
|
29226
|
-
return _context12.abrupt("return", _context12.sent);
|
|
29227
|
-
case 3:
|
|
29282
|
+
return _context12.abrupt("return", postObject(this.serverURL.toString(), 'getNetwork'));
|
|
29283
|
+
case 1:
|
|
29228
29284
|
case "end":
|
|
29229
29285
|
return _context12.stop();
|
|
29230
29286
|
}
|
|
@@ -29314,7 +29370,7 @@ var Server = function () {
|
|
|
29314
29370
|
_context16.next = 5;
|
|
29315
29371
|
break;
|
|
29316
29372
|
}
|
|
29317
|
-
throw simResponse.error;
|
|
29373
|
+
throw new Error(simResponse.error);
|
|
29318
29374
|
case 5:
|
|
29319
29375
|
return _context16.abrupt("return", (0,transaction/* assembleTransaction */.X)(tx, simResponse).build());
|
|
29320
29376
|
case 6:
|
|
@@ -29427,54 +29483,27 @@ var Server = function () {
|
|
|
29427
29483
|
}
|
|
29428
29484
|
return requestAirdrop;
|
|
29429
29485
|
}())
|
|
29430
|
-
}
|
|
29431
|
-
|
|
29432
|
-
function
|
|
29433
|
-
|
|
29434
|
-
|
|
29435
|
-
|
|
29436
|
-
|
|
29437
|
-
|
|
29438
|
-
|
|
29439
|
-
|
|
29440
|
-
|
|
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;
|
|
29458
|
-
}
|
|
29459
|
-
var data = c.created().data();
|
|
29460
|
-
if (data.switch() !== lib.xdr.LedgerEntryType.account()) {
|
|
29461
|
-
continue;
|
|
29486
|
+
}, {
|
|
29487
|
+
key: "getFeeStats",
|
|
29488
|
+
value: (function () {
|
|
29489
|
+
var _getFeeStats = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee20() {
|
|
29490
|
+
return server_regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
29491
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
29492
|
+
case 0:
|
|
29493
|
+
return _context20.abrupt("return", postObject(this.serverURL.toString(), 'getFeeStats'));
|
|
29494
|
+
case 1:
|
|
29495
|
+
case "end":
|
|
29496
|
+
return _context20.stop();
|
|
29462
29497
|
}
|
|
29463
|
-
|
|
29464
|
-
|
|
29465
|
-
|
|
29466
|
-
|
|
29467
|
-
} finally {
|
|
29468
|
-
_iterator2.f();
|
|
29498
|
+
}, _callee20, this);
|
|
29499
|
+
}));
|
|
29500
|
+
function getFeeStats() {
|
|
29501
|
+
return _getFeeStats.apply(this, arguments);
|
|
29469
29502
|
}
|
|
29470
|
-
|
|
29471
|
-
|
|
29472
|
-
|
|
29473
|
-
|
|
29474
|
-
_iterator.f();
|
|
29475
|
-
}
|
|
29476
|
-
throw new Error('No account created in transaction');
|
|
29477
|
-
}
|
|
29503
|
+
return getFeeStats;
|
|
29504
|
+
}())
|
|
29505
|
+
}]);
|
|
29506
|
+
}();
|
|
29478
29507
|
|
|
29479
29508
|
/***/ }),
|
|
29480
29509
|
|
|
@@ -29492,8 +29521,20 @@ function findCreatedAccountSequenceInTransactionMeta(meta) {
|
|
|
29492
29521
|
|
|
29493
29522
|
|
|
29494
29523
|
|
|
29524
|
+
function isSorobanTransaction(tx) {
|
|
29525
|
+
if (tx.operations.length !== 1) {
|
|
29526
|
+
return false;
|
|
29527
|
+
}
|
|
29528
|
+
switch (tx.operations[0].type) {
|
|
29529
|
+
case 'invokeHostFunction':
|
|
29530
|
+
case 'extendFootprintTtl':
|
|
29531
|
+
case 'restoreFootprint':
|
|
29532
|
+
return true;
|
|
29533
|
+
default:
|
|
29534
|
+
return false;
|
|
29535
|
+
}
|
|
29536
|
+
}
|
|
29495
29537
|
function assembleTransaction(raw, simulation) {
|
|
29496
|
-
var _invokeOp$auth;
|
|
29497
29538
|
if ('innerTransaction' in raw) {
|
|
29498
29539
|
return assembleTransaction(raw.innerTransaction, simulation);
|
|
29499
29540
|
}
|
|
@@ -29511,33 +29552,19 @@ function assembleTransaction(raw, simulation) {
|
|
|
29511
29552
|
sorobanData: success.transactionData.build(),
|
|
29512
29553
|
networkPassphrase: raw.networkPassphrase
|
|
29513
29554
|
});
|
|
29514
|
-
|
|
29515
|
-
|
|
29516
|
-
|
|
29517
|
-
|
|
29518
|
-
|
|
29519
|
-
|
|
29520
|
-
|
|
29521
|
-
|
|
29522
|
-
|
|
29523
|
-
|
|
29524
|
-
break;
|
|
29555
|
+
if (raw.operations[0].type === 'invokeHostFunction') {
|
|
29556
|
+
var _invokeOp$auth;
|
|
29557
|
+
txnBuilder.clearOperations();
|
|
29558
|
+
var invokeOp = raw.operations[0];
|
|
29559
|
+
var existingAuth = (_invokeOp$auth = invokeOp.auth) !== null && _invokeOp$auth !== void 0 ? _invokeOp$auth : [];
|
|
29560
|
+
txnBuilder.addOperation(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.Operation.invokeHostFunction({
|
|
29561
|
+
source: invokeOp.source,
|
|
29562
|
+
func: invokeOp.func,
|
|
29563
|
+
auth: existingAuth.length > 0 ? existingAuth : success.result.auth
|
|
29564
|
+
}));
|
|
29525
29565
|
}
|
|
29526
29566
|
return txnBuilder;
|
|
29527
29567
|
}
|
|
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
29568
|
|
|
29542
29569
|
/***/ }),
|
|
29543
29570
|
|
|
@@ -29925,7 +29952,7 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
|
|
|
29925
29952
|
try {
|
|
29926
29953
|
serverKP = lib.Keypair.fromPublicKey(serverAccountID);
|
|
29927
29954
|
} catch (err) {
|
|
29928
|
-
throw new Error("Couldn't infer keypair from the provided 'serverAccountID': "
|
|
29955
|
+
throw new Error("Couldn't infer keypair from the provided 'serverAccountID': ".concat(err.message));
|
|
29929
29956
|
}
|
|
29930
29957
|
var clientSigners = new Set();
|
|
29931
29958
|
var _iterator2 = _createForOfIteratorHelper(signers),
|
|
@@ -29984,7 +30011,7 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
|
|
|
29984
30011
|
}
|
|
29985
30012
|
}
|
|
29986
30013
|
if (!serverSignatureFound) {
|
|
29987
|
-
throw new InvalidChallengeError("Transaction not signed by server: '"
|
|
30014
|
+
throw new InvalidChallengeError("Transaction not signed by server: '".concat(serverKP.publicKey(), "'"));
|
|
29988
30015
|
}
|
|
29989
30016
|
if (clientSigningKey && !clientSigningKeySignatureFound) {
|
|
29990
30017
|
throw new InvalidChallengeError("Transaction not signed by the source account of the 'client_domain' " + "ManageData operation");
|
|
@@ -30020,7 +30047,7 @@ function gatherTxSigners(transaction, signers) {
|
|
|
30020
30047
|
try {
|
|
30021
30048
|
keypair = lib.Keypair.fromPublicKey(signer);
|
|
30022
30049
|
} catch (err) {
|
|
30023
|
-
throw new InvalidChallengeError("Signer is not a valid address: "
|
|
30050
|
+
throw new InvalidChallengeError("Signer is not a valid address: ".concat(err.message));
|
|
30024
30051
|
}
|
|
30025
30052
|
for (var i = 0; i < txSignatures.length; i++) {
|
|
30026
30053
|
var decSig = txSignatures[i];
|
|
@@ -38223,7 +38250,10 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
38223
38250
|
if (typeof window !== 'undefined' && obj === window) {
|
|
38224
38251
|
return '{ [object Window] }';
|
|
38225
38252
|
}
|
|
38226
|
-
if (
|
|
38253
|
+
if (
|
|
38254
|
+
(typeof globalThis !== 'undefined' && obj === globalThis)
|
|
38255
|
+
|| (typeof __webpack_require__.g !== 'undefined' && obj === __webpack_require__.g)
|
|
38256
|
+
) {
|
|
38227
38257
|
return '{ [object globalThis] }';
|
|
38228
38258
|
}
|
|
38229
38259
|
if (!isDate(obj) && !isRegExp(obj)) {
|
|
@@ -38640,6 +38670,7 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
38640
38670
|
var obj = { __proto__: null };
|
|
38641
38671
|
|
|
38642
38672
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
38673
|
+
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
38643
38674
|
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
38644
38675
|
var parts = cleanStr.split(options.delimiter, limit);
|
|
38645
38676
|
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
|
@@ -38710,7 +38741,9 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
38710
38741
|
var root = chain[i];
|
|
38711
38742
|
|
|
38712
38743
|
if (root === '[]' && options.parseArrays) {
|
|
38713
|
-
obj = options.allowEmptyArrays && leaf === ''
|
|
38744
|
+
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
|
|
38745
|
+
? []
|
|
38746
|
+
: [].concat(leaf);
|
|
38714
38747
|
} else {
|
|
38715
38748
|
obj = options.plainObjects ? Object.create(null) : {};
|
|
38716
38749
|
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
@@ -59174,7 +59207,7 @@ axios.default = axios;
|
|
|
59174
59207
|
/***/ ((module) => {
|
|
59175
59208
|
|
|
59176
59209
|
"use strict";
|
|
59177
|
-
module.exports = {"rE":"12.
|
|
59210
|
+
module.exports = {"rE":"12.2.0"};
|
|
59178
59211
|
|
|
59179
59212
|
/***/ })
|
|
59180
59213
|
|