@stellar/stellar-sdk 12.0.1 → 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 +70 -0
- package/dist/stellar-sdk.js +1415 -1114
- 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 +102 -29
- package/lib/contract/assembled_transaction.js +361 -127
- package/lib/contract/client.d.ts +1 -1
- package/lib/contract/client.js +5 -2
- package/lib/contract/sent_transaction.d.ts +14 -18
- package/lib/contract/sent_transaction.js +17 -33
- package/lib/contract/spec.d.ts +1 -1
- package/lib/contract/spec.js +921 -956
- package/lib/contract/types.d.ts +10 -0
- package/lib/contract/types.js +4 -1
- package/lib/contract/utils.d.ts +4 -6
- package/lib/contract/utils.js +20 -2
- 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 +24 -33
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,
|
|
@@ -13720,21 +13720,30 @@ exports.extendFootprintTtl = extendFootprintTtl;
|
|
|
13720
13720
|
var _xdr = _interopRequireDefault(__webpack_require__(1918));
|
|
13721
13721
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13722
13722
|
/**
|
|
13723
|
-
* Builds an operation to bump the time-to-live of
|
|
13724
|
-
*
|
|
13725
|
-
*
|
|
13723
|
+
* Builds an operation to bump the time-to-live (TTL) of the ledger keys. The
|
|
13724
|
+
* keys for extension have to be provided in the read-only footprint of
|
|
13725
|
+
* the transaction.
|
|
13726
|
+
*
|
|
13727
|
+
* The only parameter of the operation itself is the new minimum TTL for
|
|
13728
|
+
* all the provided entries. If an entry already has a higher TTL, then it
|
|
13729
|
+
* will just be skipped.
|
|
13726
13730
|
*
|
|
13727
|
-
*
|
|
13731
|
+
* TTL is the number of ledgers from the current ledger (exclusive) until
|
|
13732
|
+
* the last ledger the entry is still considered alive (inclusive). Thus
|
|
13733
|
+
* the exact ledger until the entries will live will only be determined
|
|
13734
|
+
* when transaction has been applied.
|
|
13735
|
+
*
|
|
13736
|
+
* The footprint has to be specified in the transaction. See
|
|
13728
13737
|
* {@link TransactionBuilder}'s `opts.sorobanData` parameter, which is a
|
|
13729
13738
|
* {@link xdr.SorobanTransactionData} instance that contains fee data & resource
|
|
13730
|
-
* usage as part of {@link xdr.SorobanResources}
|
|
13739
|
+
* usage as part of {@link xdr.SorobanResources}.
|
|
13731
13740
|
*
|
|
13732
13741
|
* @function
|
|
13733
13742
|
* @alias Operation.extendFootprintTtl
|
|
13734
13743
|
*
|
|
13735
13744
|
* @param {object} opts - object holding operation parameters
|
|
13736
|
-
* @param {number} opts.extendTo - the
|
|
13737
|
-
*
|
|
13745
|
+
* @param {number} opts.extendTo - the minimum TTL that all the entries in
|
|
13746
|
+
* the read-only footprint will have
|
|
13738
13747
|
* @param {string} [opts.source] - an optional source account
|
|
13739
13748
|
*
|
|
13740
13749
|
* @returns {xdr.Operation} an Extend Footprint TTL operation
|
|
@@ -13743,7 +13752,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
|
|
|
13743
13752
|
function extendFootprintTtl(opts) {
|
|
13744
13753
|
var _opts$extendTo;
|
|
13745
13754
|
if (((_opts$extendTo = opts.extendTo) !== null && _opts$extendTo !== void 0 ? _opts$extendTo : -1) <= 0) {
|
|
13746
|
-
throw new RangeError(
|
|
13755
|
+
throw new RangeError('extendTo has to be positive');
|
|
13747
13756
|
}
|
|
13748
13757
|
var extendFootprintOp = new _xdr["default"].ExtendFootprintTtlOp({
|
|
13749
13758
|
ext: new _xdr["default"].ExtensionPoint(0),
|
|
@@ -14784,14 +14793,18 @@ exports.restoreFootprint = restoreFootprint;
|
|
|
14784
14793
|
var _xdr = _interopRequireDefault(__webpack_require__(1918));
|
|
14785
14794
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14786
14795
|
/**
|
|
14787
|
-
* Builds
|
|
14796
|
+
* Builds an operation to restore the archived ledger entries specified
|
|
14797
|
+
* by the ledger keys.
|
|
14798
|
+
*
|
|
14799
|
+
* The ledger keys to restore are specified separately from the operation
|
|
14800
|
+
* in read-write footprint of the transaction.
|
|
14788
14801
|
*
|
|
14789
14802
|
* It takes no parameters because the relevant footprint is derived from the
|
|
14790
|
-
* transaction itself
|
|
14803
|
+
* transaction itself. See {@link TransactionBuilder}'s `opts.sorobanData`
|
|
14791
14804
|
* parameter (or {@link TransactionBuilder.setSorobanData} /
|
|
14792
14805
|
* {@link TransactionBuilder.setLedgerKeys}), which is a
|
|
14793
14806
|
* {@link xdr.SorobanTransactionData} instance that contains fee data & resource
|
|
14794
|
-
* usage as part of {@link xdr.SorobanTransactionData}
|
|
14807
|
+
* usage as part of {@link xdr.SorobanTransactionData}.
|
|
14795
14808
|
*
|
|
14796
14809
|
* @function
|
|
14797
14810
|
* @alias Operation.restoreFootprint
|
|
@@ -15516,75 +15529,87 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
15516
15529
|
* scValToNative(scv) == gigaMap; // true
|
|
15517
15530
|
*/
|
|
15518
15531
|
function nativeToScVal(val) {
|
|
15519
|
-
var _val$constructor$name, _val$constructor;
|
|
15520
15532
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15521
15533
|
switch (_typeof(val)) {
|
|
15522
15534
|
case 'object':
|
|
15523
|
-
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15542
|
-
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
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
|
+
}
|
|
15547
15562
|
}
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15553
|
-
|
|
15554
|
-
|
|
15555
|
-
}
|
|
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
|
+
}));
|
|
15556
15574
|
}
|
|
15557
|
-
|
|
15558
|
-
|
|
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
|
+
});
|
|
15559
15611
|
}));
|
|
15560
15612
|
}
|
|
15561
|
-
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') {
|
|
15562
|
-
var _val$constructor2;
|
|
15563
|
-
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), ")"));
|
|
15564
|
-
}
|
|
15565
|
-
return _xdr["default"].ScVal.scvMap(Object.entries(val).map(function (_ref) {
|
|
15566
|
-
var _k, _opts$type2;
|
|
15567
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
15568
|
-
k = _ref2[0],
|
|
15569
|
-
v = _ref2[1];
|
|
15570
|
-
// the type can be specified with an entry for the key and the value,
|
|
15571
|
-
// e.g. val = { 'hello': 1 } and opts.type = { hello: [ 'symbol',
|
|
15572
|
-
// 'u128' ]} or you can use `null` for the default interpretation
|
|
15573
|
-
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],
|
|
15574
|
-
_ref4 = _slicedToArray(_ref3, 2),
|
|
15575
|
-
keyType = _ref4[0],
|
|
15576
|
-
valType = _ref4[1];
|
|
15577
|
-
var keyOpts = keyType ? {
|
|
15578
|
-
type: keyType
|
|
15579
|
-
} : {};
|
|
15580
|
-
var valOpts = valType ? {
|
|
15581
|
-
type: valType
|
|
15582
|
-
} : {};
|
|
15583
|
-
return new _xdr["default"].ScMapEntry({
|
|
15584
|
-
key: nativeToScVal(k, keyOpts),
|
|
15585
|
-
val: nativeToScVal(v, valOpts)
|
|
15586
|
-
});
|
|
15587
|
-
}));
|
|
15588
15613
|
case 'number':
|
|
15589
15614
|
case 'bigint':
|
|
15590
15615
|
switch (opts === null || opts === void 0 ? void 0 : opts.type) {
|
|
@@ -15609,6 +15634,10 @@ function nativeToScVal(val) {
|
|
|
15609
15634
|
return _xdr["default"].ScVal.scvSymbol(val);
|
|
15610
15635
|
case 'address':
|
|
15611
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));
|
|
15612
15641
|
default:
|
|
15613
15642
|
if (_index.XdrLargeInt.isType(optType)) {
|
|
15614
15643
|
return new _index.XdrLargeInt(optType, val).toScVal();
|
|
@@ -15716,21 +15745,23 @@ function scValToNative(scv) {
|
|
|
15716
15745
|
case _xdr["default"].ScValType.scvTimepoint().value:
|
|
15717
15746
|
case _xdr["default"].ScValType.scvDuration().value:
|
|
15718
15747
|
return new _xdr["default"].Uint64(scv.value()).toBigInt();
|
|
15719
|
-
case _xdr["default"].ScValType.
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
case _xdr["default"].
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
case _xdr["default"].ScStatusType.sstHostStorageError().value:
|
|
15728
|
-
case _xdr["default"].ScStatusType.sstHostContextError().value:
|
|
15729
|
-
case _xdr["default"].ScStatusType.sstVmError().value:
|
|
15730
|
-
case _xdr["default"].ScStatusType.sstContractError().value:
|
|
15731
|
-
case _xdr["default"].ScStatusType.sstHostAuthError().value:
|
|
15748
|
+
case _xdr["default"].ScValType.scvError().value:
|
|
15749
|
+
switch (scv.error()["switch"]().value) {
|
|
15750
|
+
// Distinguish errors from the user contract.
|
|
15751
|
+
case _xdr["default"].ScErrorType.sceContract().value:
|
|
15752
|
+
return {
|
|
15753
|
+
type: 'contract',
|
|
15754
|
+
code: scv.error().contractCode()
|
|
15755
|
+
};
|
|
15732
15756
|
default:
|
|
15733
|
-
|
|
15757
|
+
{
|
|
15758
|
+
var err = scv.error();
|
|
15759
|
+
return {
|
|
15760
|
+
type: 'system',
|
|
15761
|
+
code: err.code().value,
|
|
15762
|
+
value: err.code().name
|
|
15763
|
+
};
|
|
15764
|
+
}
|
|
15734
15765
|
}
|
|
15735
15766
|
|
|
15736
15767
|
// in the fallthrough case, just return the underlying value directly
|
|
@@ -17529,6 +17560,21 @@ var TransactionBuilder = exports.TransactionBuilder = /*#__PURE__*/function () {
|
|
|
17529
17560
|
return this;
|
|
17530
17561
|
}
|
|
17531
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
|
+
|
|
17532
17578
|
/**
|
|
17533
17579
|
* Removes the operations from the builder (useful when cloning).
|
|
17534
17580
|
* @returns {TransactionBuilder} this builder instance
|
|
@@ -17540,6 +17586,20 @@ var TransactionBuilder = exports.TransactionBuilder = /*#__PURE__*/function () {
|
|
|
17540
17586
|
return this;
|
|
17541
17587
|
}
|
|
17542
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
|
+
|
|
17543
17603
|
/**
|
|
17544
17604
|
* Adds a memo to the transaction.
|
|
17545
17605
|
* @param {Memo} memo {@link Memo} object
|
|
@@ -20755,13 +20815,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
20755
20815
|
/* harmony export */ axios: () => (/* reexport safe */ axios__WEBPACK_IMPORTED_MODULE_2__.A),
|
|
20756
20816
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
20757
20817
|
/* harmony export */ });
|
|
20818
|
+
/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1083);
|
|
20758
20819
|
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4356);
|
|
20759
20820
|
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
20760
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__]
|
|
20761
20822
|
/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
20762
20823
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(356);
|
|
20763
20824
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_1__);
|
|
20764
|
-
/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1083);
|
|
20765
20825
|
/* module decorator */ module = __webpack_require__.hmd(module);
|
|
20766
20826
|
|
|
20767
20827
|
|
|
@@ -20783,13 +20843,16 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
20783
20843
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
20784
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); } }
|
|
20785
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; }
|
|
20786
20849
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20787
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); }
|
|
20788
20851
|
var defaultConfig = {
|
|
20789
20852
|
allowHttp: false,
|
|
20790
20853
|
timeout: 0
|
|
20791
20854
|
};
|
|
20792
|
-
var config =
|
|
20855
|
+
var config = _objectSpread({}, defaultConfig);
|
|
20793
20856
|
var Config = function () {
|
|
20794
20857
|
function Config() {
|
|
20795
20858
|
_classCallCheck(this, Config);
|
|
@@ -20817,7 +20880,7 @@ var Config = function () {
|
|
|
20817
20880
|
}, {
|
|
20818
20881
|
key: "setDefault",
|
|
20819
20882
|
value: function setDefault() {
|
|
20820
|
-
config =
|
|
20883
|
+
config = _objectSpread({}, defaultConfig);
|
|
20821
20884
|
}
|
|
20822
20885
|
}]);
|
|
20823
20886
|
}();
|
|
@@ -20825,7 +20888,7 @@ var Config = function () {
|
|
|
20825
20888
|
|
|
20826
20889
|
/***/ }),
|
|
20827
20890
|
|
|
20828
|
-
/***/
|
|
20891
|
+
/***/ 6299:
|
|
20829
20892
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20830
20893
|
|
|
20831
20894
|
"use strict";
|
|
@@ -20836,6 +20899,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
20836
20899
|
__webpack_require__.d(__webpack_exports__, {
|
|
20837
20900
|
AssembledTransaction: () => (/* reexport */ AssembledTransaction),
|
|
20838
20901
|
Client: () => (/* reexport */ Client),
|
|
20902
|
+
DEFAULT_TIMEOUT: () => (/* reexport */ DEFAULT_TIMEOUT),
|
|
20839
20903
|
Err: () => (/* reexport */ Err),
|
|
20840
20904
|
NULL_ACCOUNT: () => (/* reexport */ NULL_ACCOUNT),
|
|
20841
20905
|
Ok: () => (/* reexport */ Ok),
|
|
@@ -20913,13 +20977,16 @@ var Err = function () {
|
|
|
20913
20977
|
}
|
|
20914
20978
|
}]);
|
|
20915
20979
|
}();
|
|
20980
|
+
;// CONCATENATED MODULE: ./src/contract/types.ts
|
|
20981
|
+
var DEFAULT_TIMEOUT = 5 * 60;
|
|
20982
|
+
var NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
|
|
20916
20983
|
;// CONCATENATED MODULE: ./src/contract/utils.ts
|
|
20917
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; }
|
|
20918
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); }
|
|
20919
20986
|
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); }
|
|
20920
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); }); }; }
|
|
20921
20988
|
|
|
20922
|
-
|
|
20989
|
+
|
|
20923
20990
|
function withExponentialBackoff(_x, _x2, _x3) {
|
|
20924
20991
|
return _withExponentialBackoff.apply(this, arguments);
|
|
20925
20992
|
}
|
|
@@ -21010,6 +21077,23 @@ function processSpecEntryStream(buffer) {
|
|
|
21010
21077
|
}
|
|
21011
21078
|
return res;
|
|
21012
21079
|
}
|
|
21080
|
+
function getAccount(_x4, _x5) {
|
|
21081
|
+
return _getAccount.apply(this, arguments);
|
|
21082
|
+
}
|
|
21083
|
+
function _getAccount() {
|
|
21084
|
+
_getAccount = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(options, server) {
|
|
21085
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
21086
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
21087
|
+
case 0:
|
|
21088
|
+
return _context2.abrupt("return", options.publicKey ? server.getAccount(options.publicKey) : new lib.Account(NULL_ACCOUNT, "0"));
|
|
21089
|
+
case 1:
|
|
21090
|
+
case "end":
|
|
21091
|
+
return _context2.stop();
|
|
21092
|
+
}
|
|
21093
|
+
}, _callee2);
|
|
21094
|
+
}));
|
|
21095
|
+
return _getAccount.apply(this, arguments);
|
|
21096
|
+
}
|
|
21013
21097
|
;// CONCATENATED MODULE: ./src/contract/sent_transaction.ts
|
|
21014
21098
|
var _SentTransaction;
|
|
21015
21099
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -21037,67 +21121,51 @@ function sent_transaction_toPrimitive(t, r) { if ("object" != sent_transaction_t
|
|
|
21037
21121
|
|
|
21038
21122
|
|
|
21039
21123
|
var SentTransaction = function () {
|
|
21040
|
-
function SentTransaction(
|
|
21124
|
+
function SentTransaction(_, assembled) {
|
|
21041
21125
|
var _this = this,
|
|
21042
21126
|
_this$assembled$optio2;
|
|
21043
21127
|
sent_transaction_classCallCheck(this, SentTransaction);
|
|
21044
21128
|
_defineProperty(this, "send", sent_transaction_asyncToGenerator(sent_transaction_regeneratorRuntime().mark(function _callee() {
|
|
21045
21129
|
var _this$assembled$optio;
|
|
21046
|
-
var
|
|
21130
|
+
var hash, timeoutInSeconds;
|
|
21047
21131
|
return sent_transaction_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21048
21132
|
while (1) switch (_context.prev = _context.next) {
|
|
21049
21133
|
case 0:
|
|
21050
|
-
|
|
21051
|
-
_this.
|
|
21052
|
-
|
|
21053
|
-
timebounds: undefined,
|
|
21054
|
-
sorobanData: new lib.SorobanDataBuilder(_this.assembled.simulationData.transactionData.toXDR()).build()
|
|
21055
|
-
}).setTimeout(timeoutInSeconds).build();
|
|
21056
|
-
_context.next = 4;
|
|
21057
|
-
return _this.signTransaction(_this.assembled.built.toXDR(), {
|
|
21058
|
-
networkPassphrase: _this.assembled.options.networkPassphrase
|
|
21059
|
-
});
|
|
21060
|
-
case 4:
|
|
21061
|
-
signature = _context.sent;
|
|
21062
|
-
_this.signed = lib.TransactionBuilder.fromXDR(signature, _this.assembled.options.networkPassphrase);
|
|
21063
|
-
_context.next = 8;
|
|
21064
|
-
return _this.server.sendTransaction(_this.signed);
|
|
21065
|
-
case 8:
|
|
21134
|
+
_context.next = 2;
|
|
21135
|
+
return _this.server.sendTransaction(_this.assembled.signed);
|
|
21136
|
+
case 2:
|
|
21066
21137
|
_this.sendTransactionResponse = _context.sent;
|
|
21067
21138
|
if (!(_this.sendTransactionResponse.status !== "PENDING")) {
|
|
21068
|
-
_context.next =
|
|
21139
|
+
_context.next = 5;
|
|
21069
21140
|
break;
|
|
21070
21141
|
}
|
|
21071
21142
|
throw new SentTransaction.Errors.SendFailed("Sending the transaction to the network failed!\n".concat(JSON.stringify(_this.sendTransactionResponse, null, 2)));
|
|
21072
|
-
case
|
|
21143
|
+
case 5:
|
|
21073
21144
|
hash = _this.sendTransactionResponse.hash;
|
|
21074
|
-
|
|
21145
|
+
timeoutInSeconds = (_this$assembled$optio = _this.assembled.options.timeoutInSeconds) !== null && _this$assembled$optio !== void 0 ? _this$assembled$optio : DEFAULT_TIMEOUT;
|
|
21146
|
+
_context.next = 9;
|
|
21075
21147
|
return withExponentialBackoff(function () {
|
|
21076
21148
|
return _this.server.getTransaction(hash);
|
|
21077
21149
|
}, function (resp) {
|
|
21078
21150
|
return resp.status === api/* Api */.j.GetTransactionStatus.NOT_FOUND;
|
|
21079
21151
|
}, timeoutInSeconds);
|
|
21080
|
-
case
|
|
21152
|
+
case 9:
|
|
21081
21153
|
_this.getTransactionResponseAll = _context.sent;
|
|
21082
21154
|
_this.getTransactionResponse = _this.getTransactionResponseAll[_this.getTransactionResponseAll.length - 1];
|
|
21083
21155
|
if (!(_this.getTransactionResponse.status === api/* Api */.j.GetTransactionStatus.NOT_FOUND)) {
|
|
21084
|
-
_context.next =
|
|
21156
|
+
_context.next = 13;
|
|
21085
21157
|
break;
|
|
21086
21158
|
}
|
|
21087
21159
|
throw new SentTransaction.Errors.TransactionStillPending("Waited ".concat(timeoutInSeconds, " seconds for transaction to complete, but it did not. ") + "Returning anyway. Check the transaction status manually. " + "Sent transaction: ".concat(JSON.stringify(_this.sendTransactionResponse, null, 2), "\n") + "All attempts to get the result: ".concat(JSON.stringify(_this.getTransactionResponseAll, null, 2)));
|
|
21088
|
-
case
|
|
21160
|
+
case 13:
|
|
21089
21161
|
return _context.abrupt("return", _this);
|
|
21090
|
-
case
|
|
21162
|
+
case 14:
|
|
21091
21163
|
case "end":
|
|
21092
21164
|
return _context.stop();
|
|
21093
21165
|
}
|
|
21094
21166
|
}, _callee);
|
|
21095
21167
|
})));
|
|
21096
|
-
this.signTransaction = signTransaction;
|
|
21097
21168
|
this.assembled = assembled;
|
|
21098
|
-
if (!signTransaction) {
|
|
21099
|
-
throw new Error("You must provide a `signTransaction` function to send a transaction");
|
|
21100
|
-
}
|
|
21101
21169
|
this.server = new server/* Server */.gq(this.assembled.options.rpcUrl, {
|
|
21102
21170
|
allowHttp: (_this$assembled$optio2 = this.assembled.options.allowHttp) !== null && _this$assembled$optio2 !== void 0 ? _this$assembled$optio2 : false
|
|
21103
21171
|
});
|
|
@@ -21119,7 +21187,7 @@ var SentTransaction = function () {
|
|
|
21119
21187
|
}
|
|
21120
21188
|
throw new SentTransaction.Errors.SendResultOnly("Transaction was sent to the network, but not yet awaited. No result to show. Await transaction completion with `getTransaction(sendTransactionResponse.hash)`");
|
|
21121
21189
|
}
|
|
21122
|
-
throw new Error("Sending transaction failed: ".concat(JSON.stringify(this.assembled)));
|
|
21190
|
+
throw new Error("Sending transaction failed: ".concat(JSON.stringify(this.assembled.signed)));
|
|
21123
21191
|
}
|
|
21124
21192
|
}]);
|
|
21125
21193
|
}();
|
|
@@ -21151,12 +21219,12 @@ _defineProperty(SentTransaction, "Errors", {
|
|
|
21151
21219
|
}(_wrapNativeSuper(Error))
|
|
21152
21220
|
});
|
|
21153
21221
|
_defineProperty(SentTransaction, "init", function () {
|
|
21154
|
-
var _ref2 = sent_transaction_asyncToGenerator(sent_transaction_regeneratorRuntime().mark(function _callee2(
|
|
21222
|
+
var _ref2 = sent_transaction_asyncToGenerator(sent_transaction_regeneratorRuntime().mark(function _callee2(_, assembled) {
|
|
21155
21223
|
var tx, sent;
|
|
21156
21224
|
return sent_transaction_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
21157
21225
|
while (1) switch (_context2.prev = _context2.next) {
|
|
21158
21226
|
case 0:
|
|
21159
|
-
tx = new _SentTransaction(
|
|
21227
|
+
tx = new _SentTransaction(undefined, assembled);
|
|
21160
21228
|
_context2.next = 3;
|
|
21161
21229
|
return tx.send();
|
|
21162
21230
|
case 3:
|
|
@@ -21185,18 +21253,20 @@ function assembled_transaction_isNativeFunction(t) { try { return -1 !== Functio
|
|
|
21185
21253
|
function assembled_transaction_setPrototypeOf(t, e) { return assembled_transaction_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, assembled_transaction_setPrototypeOf(t, e); }
|
|
21186
21254
|
function assembled_transaction_getPrototypeOf(t) { return assembled_transaction_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, assembled_transaction_getPrototypeOf(t); }
|
|
21187
21255
|
function assembled_transaction_typeof(o) { "@babel/helpers - typeof"; return assembled_transaction_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; }, assembled_transaction_typeof(o); }
|
|
21256
|
+
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; }
|
|
21257
|
+
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) { assembled_transaction_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; }
|
|
21188
21258
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
21189
21259
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21190
21260
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21191
21261
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21192
21262
|
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; } } }; }
|
|
21263
|
+
function assembled_transaction_regeneratorRuntime() { "use strict"; assembled_transaction_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" == assembled_transaction_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(assembled_transaction_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; }
|
|
21193
21264
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
21194
21265
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21195
21266
|
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; } }
|
|
21196
21267
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
21197
21268
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
21198
21269
|
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; }
|
|
21199
|
-
function assembled_transaction_regeneratorRuntime() { "use strict"; assembled_transaction_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" == assembled_transaction_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(assembled_transaction_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; }
|
|
21200
21270
|
function assembled_transaction_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); }
|
|
21201
21271
|
function assembled_transaction_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { assembled_transaction_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { assembled_transaction_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
21202
21272
|
function assembled_transaction_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -21212,7 +21282,7 @@ function assembled_transaction_toPrimitive(t, r) { if ("object" != assembled_tra
|
|
|
21212
21282
|
|
|
21213
21283
|
|
|
21214
21284
|
|
|
21215
|
-
|
|
21285
|
+
|
|
21216
21286
|
var AssembledTransaction = function () {
|
|
21217
21287
|
function AssembledTransaction(options) {
|
|
21218
21288
|
var _this = this,
|
|
@@ -21220,43 +21290,91 @@ var AssembledTransaction = function () {
|
|
|
21220
21290
|
_this$options$allowHt;
|
|
21221
21291
|
assembled_transaction_classCallCheck(this, AssembledTransaction);
|
|
21222
21292
|
assembled_transaction_defineProperty(this, "simulate", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee() {
|
|
21293
|
+
var _restore;
|
|
21294
|
+
var _ref2,
|
|
21295
|
+
restore,
|
|
21296
|
+
account,
|
|
21297
|
+
result,
|
|
21298
|
+
_this$options$fee,
|
|
21299
|
+
_this$options$args,
|
|
21300
|
+
_this$options$timeout,
|
|
21301
|
+
contract,
|
|
21302
|
+
_args = arguments;
|
|
21223
21303
|
return assembled_transaction_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21224
21304
|
while (1) switch (_context.prev = _context.next) {
|
|
21225
21305
|
case 0:
|
|
21306
|
+
_ref2 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, restore = _ref2.restore;
|
|
21307
|
+
if (_this.built) {
|
|
21308
|
+
_context.next = 5;
|
|
21309
|
+
break;
|
|
21310
|
+
}
|
|
21226
21311
|
if (_this.raw) {
|
|
21227
|
-
_context.next =
|
|
21312
|
+
_context.next = 4;
|
|
21228
21313
|
break;
|
|
21229
21314
|
}
|
|
21230
21315
|
throw new Error("Transaction has not yet been assembled; " + "call `AssembledTransaction.build` first.");
|
|
21231
|
-
case
|
|
21316
|
+
case 4:
|
|
21232
21317
|
_this.built = _this.raw.build();
|
|
21233
|
-
_context.next = 5;
|
|
21234
|
-
return _this.server.simulateTransaction(_this.built);
|
|
21235
21318
|
case 5:
|
|
21319
|
+
restore = (_restore = restore) !== null && _restore !== void 0 ? _restore : _this.options.restore;
|
|
21320
|
+
delete _this.simulationResult;
|
|
21321
|
+
delete _this.simulationTransactionData;
|
|
21322
|
+
_context.next = 10;
|
|
21323
|
+
return _this.server.simulateTransaction(_this.built);
|
|
21324
|
+
case 10:
|
|
21236
21325
|
_this.simulation = _context.sent;
|
|
21326
|
+
if (!(restore && api/* Api */.j.isSimulationRestore(_this.simulation))) {
|
|
21327
|
+
_context.next = 25;
|
|
21328
|
+
break;
|
|
21329
|
+
}
|
|
21330
|
+
_context.next = 14;
|
|
21331
|
+
return getAccount(_this.options, _this.server);
|
|
21332
|
+
case 14:
|
|
21333
|
+
account = _context.sent;
|
|
21334
|
+
_context.next = 17;
|
|
21335
|
+
return _this.restoreFootprint(_this.simulation.restorePreamble, account);
|
|
21336
|
+
case 17:
|
|
21337
|
+
result = _context.sent;
|
|
21338
|
+
if (!(result.status === api/* Api */.j.GetTransactionStatus.SUCCESS)) {
|
|
21339
|
+
_context.next = 24;
|
|
21340
|
+
break;
|
|
21341
|
+
}
|
|
21342
|
+
contract = new lib.Contract(_this.options.contractId);
|
|
21343
|
+
_this.raw = new lib.TransactionBuilder(account, {
|
|
21344
|
+
fee: (_this$options$fee = _this.options.fee) !== null && _this$options$fee !== void 0 ? _this$options$fee : lib.BASE_FEE,
|
|
21345
|
+
networkPassphrase: _this.options.networkPassphrase
|
|
21346
|
+
}).addOperation(contract.call.apply(contract, [_this.options.method].concat(_toConsumableArray((_this$options$args = _this.options.args) !== null && _this$options$args !== void 0 ? _this$options$args : [])))).setTimeout((_this$options$timeout = _this.options.timeoutInSeconds) !== null && _this$options$timeout !== void 0 ? _this$options$timeout : DEFAULT_TIMEOUT);
|
|
21347
|
+
_context.next = 23;
|
|
21348
|
+
return _this.simulate();
|
|
21349
|
+
case 23:
|
|
21350
|
+
return _context.abrupt("return", _this);
|
|
21351
|
+
case 24:
|
|
21352
|
+
throw new AssembledTransaction.Errors.RestorationFailure("Automatic restore failed! You set 'restore: true' but the attempted restore did not work. Result:\n".concat(JSON.stringify(result)));
|
|
21353
|
+
case 25:
|
|
21237
21354
|
if (api/* Api */.j.isSimulationSuccess(_this.simulation)) {
|
|
21238
21355
|
_this.built = (0,transaction/* assembleTransaction */.X)(_this.built, _this.simulation).build();
|
|
21239
21356
|
}
|
|
21240
21357
|
return _context.abrupt("return", _this);
|
|
21241
|
-
case
|
|
21358
|
+
case 27:
|
|
21242
21359
|
case "end":
|
|
21243
21360
|
return _context.stop();
|
|
21244
21361
|
}
|
|
21245
21362
|
}, _callee);
|
|
21246
21363
|
})));
|
|
21247
|
-
assembled_transaction_defineProperty(this, "
|
|
21248
|
-
var
|
|
21249
|
-
|
|
21364
|
+
assembled_transaction_defineProperty(this, "sign", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee2() {
|
|
21365
|
+
var _this$options$timeout2;
|
|
21366
|
+
var _ref4,
|
|
21367
|
+
_ref4$force,
|
|
21250
21368
|
force,
|
|
21251
|
-
|
|
21369
|
+
_ref4$signTransaction,
|
|
21252
21370
|
signTransaction,
|
|
21253
|
-
|
|
21254
|
-
|
|
21371
|
+
timeoutInSeconds,
|
|
21372
|
+
signature,
|
|
21255
21373
|
_args2 = arguments;
|
|
21256
21374
|
return assembled_transaction_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
21257
21375
|
while (1) switch (_context2.prev = _context2.next) {
|
|
21258
21376
|
case 0:
|
|
21259
|
-
|
|
21377
|
+
_ref4 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref4$force = _ref4.force, force = _ref4$force === void 0 ? false : _ref4$force, _ref4$signTransaction = _ref4.signTransaction, signTransaction = _ref4$signTransaction === void 0 ? _this.options.signTransaction : _ref4$signTransaction;
|
|
21260
21378
|
if (_this.built) {
|
|
21261
21379
|
_context2.next = 3;
|
|
21262
21380
|
break;
|
|
@@ -21281,45 +21399,80 @@ var AssembledTransaction = function () {
|
|
|
21281
21399
|
}
|
|
21282
21400
|
throw new AssembledTransaction.Errors.NeedsMoreSignatures("Transaction requires more signatures. " + "See `needsNonInvokerSigningBy` for details.");
|
|
21283
21401
|
case 9:
|
|
21284
|
-
|
|
21285
|
-
|
|
21286
|
-
|
|
21287
|
-
|
|
21288
|
-
|
|
21289
|
-
|
|
21290
|
-
|
|
21402
|
+
timeoutInSeconds = (_this$options$timeout2 = _this.options.timeoutInSeconds) !== null && _this$options$timeout2 !== void 0 ? _this$options$timeout2 : DEFAULT_TIMEOUT;
|
|
21403
|
+
_this.built = lib.TransactionBuilder.cloneFrom(_this.built, {
|
|
21404
|
+
fee: _this.built.fee,
|
|
21405
|
+
timebounds: undefined,
|
|
21406
|
+
sorobanData: _this.simulationData.transactionData
|
|
21407
|
+
}).setTimeout(timeoutInSeconds).build();
|
|
21408
|
+
_context2.next = 13;
|
|
21409
|
+
return signTransaction(_this.built.toXDR(), {
|
|
21410
|
+
networkPassphrase: _this.options.networkPassphrase
|
|
21411
|
+
});
|
|
21412
|
+
case 13:
|
|
21413
|
+
signature = _context2.sent;
|
|
21414
|
+
_this.signed = lib.TransactionBuilder.fromXDR(signature, _this.options.networkPassphrase);
|
|
21415
|
+
case 15:
|
|
21291
21416
|
case "end":
|
|
21292
21417
|
return _context2.stop();
|
|
21293
21418
|
}
|
|
21294
21419
|
}, _callee2);
|
|
21295
21420
|
})));
|
|
21296
|
-
assembled_transaction_defineProperty(this, "
|
|
21297
|
-
var
|
|
21421
|
+
assembled_transaction_defineProperty(this, "signAndSend", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee3() {
|
|
21422
|
+
var _ref6,
|
|
21423
|
+
_ref6$force,
|
|
21424
|
+
force,
|
|
21425
|
+
_ref6$signTransaction,
|
|
21426
|
+
signTransaction,
|
|
21427
|
+
_args3 = arguments;
|
|
21298
21428
|
return assembled_transaction_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
21299
21429
|
while (1) switch (_context3.prev = _context3.next) {
|
|
21300
21430
|
case 0:
|
|
21301
|
-
|
|
21431
|
+
_ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, _ref6$force = _ref6.force, force = _ref6$force === void 0 ? false : _ref6$force, _ref6$signTransaction = _ref6.signTransaction, signTransaction = _ref6$signTransaction === void 0 ? _this.options.signTransaction : _ref6$signTransaction;
|
|
21432
|
+
if (_this.signed) {
|
|
21433
|
+
_context3.next = 4;
|
|
21434
|
+
break;
|
|
21435
|
+
}
|
|
21436
|
+
_context3.next = 4;
|
|
21437
|
+
return _this.sign({
|
|
21438
|
+
force: force,
|
|
21439
|
+
signTransaction: signTransaction
|
|
21440
|
+
});
|
|
21441
|
+
case 4:
|
|
21442
|
+
return _context3.abrupt("return", _this.send());
|
|
21443
|
+
case 5:
|
|
21444
|
+
case "end":
|
|
21445
|
+
return _context3.stop();
|
|
21446
|
+
}
|
|
21447
|
+
}, _callee3);
|
|
21448
|
+
})));
|
|
21449
|
+
assembled_transaction_defineProperty(this, "getStorageExpiration", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee4() {
|
|
21450
|
+
var entryRes;
|
|
21451
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
21452
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
21453
|
+
case 0:
|
|
21454
|
+
_context4.next = 2;
|
|
21302
21455
|
return _this.server.getLedgerEntries(new lib.Contract(_this.options.contractId).getFootprint());
|
|
21303
21456
|
case 2:
|
|
21304
|
-
entryRes =
|
|
21457
|
+
entryRes = _context4.sent;
|
|
21305
21458
|
if (!(!entryRes.entries || !entryRes.entries.length || !entryRes.entries[0].liveUntilLedgerSeq)) {
|
|
21306
|
-
|
|
21459
|
+
_context4.next = 5;
|
|
21307
21460
|
break;
|
|
21308
21461
|
}
|
|
21309
21462
|
throw new Error("failed to get ledger entry");
|
|
21310
21463
|
case 5:
|
|
21311
|
-
return
|
|
21464
|
+
return _context4.abrupt("return", entryRes.entries[0].liveUntilLedgerSeq);
|
|
21312
21465
|
case 6:
|
|
21313
21466
|
case "end":
|
|
21314
|
-
return
|
|
21467
|
+
return _context4.stop();
|
|
21315
21468
|
}
|
|
21316
|
-
},
|
|
21469
|
+
}, _callee4);
|
|
21317
21470
|
})));
|
|
21318
21471
|
assembled_transaction_defineProperty(this, "needsNonInvokerSigningBy", function () {
|
|
21319
21472
|
var _rawInvokeHostFunctio;
|
|
21320
|
-
var
|
|
21321
|
-
|
|
21322
|
-
includeAlreadySigned =
|
|
21473
|
+
var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
21474
|
+
_ref8$includeAlreadyS = _ref8.includeAlreadySigned,
|
|
21475
|
+
includeAlreadySigned = _ref8$includeAlreadyS === void 0 ? false : _ref8$includeAlreadyS;
|
|
21323
21476
|
if (!_this.built) {
|
|
21324
21477
|
throw new Error("Transaction has not yet been simulated");
|
|
21325
21478
|
}
|
|
@@ -21333,14 +21486,14 @@ var AssembledTransaction = function () {
|
|
|
21333
21486
|
return lib.StrKey.encodeEd25519PublicKey(entry.credentials().address().address().accountId().ed25519());
|
|
21334
21487
|
})));
|
|
21335
21488
|
});
|
|
21336
|
-
assembled_transaction_defineProperty(this, "signAuthEntries", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function
|
|
21489
|
+
assembled_transaction_defineProperty(this, "signAuthEntries", assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee6() {
|
|
21337
21490
|
var _rawInvokeHostFunctio2;
|
|
21338
|
-
var
|
|
21339
|
-
|
|
21491
|
+
var _ref10,
|
|
21492
|
+
_ref10$expiration,
|
|
21340
21493
|
expiration,
|
|
21341
|
-
|
|
21494
|
+
_ref10$signAuthEntry,
|
|
21342
21495
|
signAuthEntry,
|
|
21343
|
-
|
|
21496
|
+
_ref10$publicKey,
|
|
21344
21497
|
publicKey,
|
|
21345
21498
|
needsNonInvokerSigningBy,
|
|
21346
21499
|
rawInvokeHostFunctionOp,
|
|
@@ -21351,32 +21504,32 @@ var AssembledTransaction = function () {
|
|
|
21351
21504
|
i,
|
|
21352
21505
|
entry,
|
|
21353
21506
|
pk,
|
|
21354
|
-
|
|
21355
|
-
return assembled_transaction_regeneratorRuntime().wrap(function
|
|
21356
|
-
while (1) switch (
|
|
21507
|
+
_args6 = arguments;
|
|
21508
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
21509
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
21357
21510
|
case 0:
|
|
21358
|
-
|
|
21511
|
+
_ref10 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref10$expiration = _ref10.expiration, expiration = _ref10$expiration === void 0 ? _this.getStorageExpiration() : _ref10$expiration, _ref10$signAuthEntry = _ref10.signAuthEntry, signAuthEntry = _ref10$signAuthEntry === void 0 ? _this.options.signAuthEntry : _ref10$signAuthEntry, _ref10$publicKey = _ref10.publicKey, publicKey = _ref10$publicKey === void 0 ? _this.options.publicKey : _ref10$publicKey;
|
|
21359
21512
|
if (_this.built) {
|
|
21360
|
-
|
|
21513
|
+
_context6.next = 3;
|
|
21361
21514
|
break;
|
|
21362
21515
|
}
|
|
21363
21516
|
throw new Error("Transaction has not yet been assembled or simulated");
|
|
21364
21517
|
case 3:
|
|
21365
21518
|
needsNonInvokerSigningBy = _this.needsNonInvokerSigningBy();
|
|
21366
21519
|
if (needsNonInvokerSigningBy) {
|
|
21367
|
-
|
|
21520
|
+
_context6.next = 6;
|
|
21368
21521
|
break;
|
|
21369
21522
|
}
|
|
21370
21523
|
throw new AssembledTransaction.Errors.NoUnsignedNonInvokerAuthEntries("No unsigned non-invoker auth entries; maybe you already signed?");
|
|
21371
21524
|
case 6:
|
|
21372
21525
|
if (!(needsNonInvokerSigningBy.indexOf(publicKey !== null && publicKey !== void 0 ? publicKey : "") === -1)) {
|
|
21373
|
-
|
|
21526
|
+
_context6.next = 8;
|
|
21374
21527
|
break;
|
|
21375
21528
|
}
|
|
21376
21529
|
throw new AssembledTransaction.Errors.NoSignatureNeeded("No auth entries for public key \"".concat(publicKey, "\""));
|
|
21377
21530
|
case 8:
|
|
21378
21531
|
if (signAuthEntry) {
|
|
21379
|
-
|
|
21532
|
+
_context6.next = 10;
|
|
21380
21533
|
break;
|
|
21381
21534
|
}
|
|
21382
21535
|
throw new AssembledTransaction.Errors.NoSigner("You must provide `signAuthEntry` when calling `signAuthEntries`, " + "or when constructing the `Client` or `AssembledTransaction`");
|
|
@@ -21384,78 +21537,78 @@ var AssembledTransaction = function () {
|
|
|
21384
21537
|
rawInvokeHostFunctionOp = _this.built.operations[0];
|
|
21385
21538
|
authEntries = (_rawInvokeHostFunctio2 = rawInvokeHostFunctionOp.auth) !== null && _rawInvokeHostFunctio2 !== void 0 ? _rawInvokeHostFunctio2 : [];
|
|
21386
21539
|
_iterator = _createForOfIteratorHelper(authEntries.entries());
|
|
21387
|
-
|
|
21540
|
+
_context6.prev = 13;
|
|
21388
21541
|
_iterator.s();
|
|
21389
21542
|
case 15:
|
|
21390
21543
|
if ((_step = _iterator.n()).done) {
|
|
21391
|
-
|
|
21544
|
+
_context6.next = 34;
|
|
21392
21545
|
break;
|
|
21393
21546
|
}
|
|
21394
21547
|
_step$value = _slicedToArray(_step.value, 2), i = _step$value[0], entry = _step$value[1];
|
|
21395
21548
|
if (!(entry.credentials().switch() !== lib.xdr.SorobanCredentialsType.sorobanCredentialsAddress())) {
|
|
21396
|
-
|
|
21549
|
+
_context6.next = 19;
|
|
21397
21550
|
break;
|
|
21398
21551
|
}
|
|
21399
|
-
return
|
|
21552
|
+
return _context6.abrupt("continue", 32);
|
|
21400
21553
|
case 19:
|
|
21401
21554
|
pk = lib.StrKey.encodeEd25519PublicKey(entry.credentials().address().address().accountId().ed25519());
|
|
21402
21555
|
if (!(pk !== publicKey)) {
|
|
21403
|
-
|
|
21556
|
+
_context6.next = 22;
|
|
21404
21557
|
break;
|
|
21405
21558
|
}
|
|
21406
|
-
return
|
|
21559
|
+
return _context6.abrupt("continue", 32);
|
|
21407
21560
|
case 22:
|
|
21408
|
-
|
|
21409
|
-
|
|
21410
|
-
|
|
21411
|
-
var
|
|
21412
|
-
return assembled_transaction_regeneratorRuntime().wrap(function
|
|
21413
|
-
while (1) switch (
|
|
21561
|
+
_context6.t0 = lib.authorizeEntry;
|
|
21562
|
+
_context6.t1 = entry;
|
|
21563
|
+
_context6.t2 = function () {
|
|
21564
|
+
var _ref11 = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee5(preimage) {
|
|
21565
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
21566
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
21414
21567
|
case 0:
|
|
21415
|
-
|
|
21416
|
-
|
|
21568
|
+
_context5.t0 = Buffer;
|
|
21569
|
+
_context5.next = 3;
|
|
21417
21570
|
return signAuthEntry(preimage.toXDR("base64"));
|
|
21418
21571
|
case 3:
|
|
21419
|
-
|
|
21420
|
-
return
|
|
21572
|
+
_context5.t1 = _context5.sent;
|
|
21573
|
+
return _context5.abrupt("return", _context5.t0.from.call(_context5.t0, _context5.t1, "base64"));
|
|
21421
21574
|
case 5:
|
|
21422
21575
|
case "end":
|
|
21423
|
-
return
|
|
21576
|
+
return _context5.stop();
|
|
21424
21577
|
}
|
|
21425
|
-
},
|
|
21578
|
+
}, _callee5);
|
|
21426
21579
|
}));
|
|
21427
21580
|
return function (_x) {
|
|
21428
|
-
return
|
|
21581
|
+
return _ref11.apply(this, arguments);
|
|
21429
21582
|
};
|
|
21430
21583
|
}();
|
|
21431
|
-
|
|
21584
|
+
_context6.next = 27;
|
|
21432
21585
|
return expiration;
|
|
21433
21586
|
case 27:
|
|
21434
|
-
|
|
21435
|
-
|
|
21436
|
-
|
|
21437
|
-
return (0,
|
|
21587
|
+
_context6.t3 = _context6.sent;
|
|
21588
|
+
_context6.t4 = _this.options.networkPassphrase;
|
|
21589
|
+
_context6.next = 31;
|
|
21590
|
+
return (0, _context6.t0)(_context6.t1, _context6.t2, _context6.t3, _context6.t4);
|
|
21438
21591
|
case 31:
|
|
21439
|
-
authEntries[i] =
|
|
21592
|
+
authEntries[i] = _context6.sent;
|
|
21440
21593
|
case 32:
|
|
21441
|
-
|
|
21594
|
+
_context6.next = 15;
|
|
21442
21595
|
break;
|
|
21443
21596
|
case 34:
|
|
21444
|
-
|
|
21597
|
+
_context6.next = 39;
|
|
21445
21598
|
break;
|
|
21446
21599
|
case 36:
|
|
21447
|
-
|
|
21448
|
-
|
|
21449
|
-
_iterator.e(
|
|
21600
|
+
_context6.prev = 36;
|
|
21601
|
+
_context6.t5 = _context6["catch"](13);
|
|
21602
|
+
_iterator.e(_context6.t5);
|
|
21450
21603
|
case 39:
|
|
21451
|
-
|
|
21604
|
+
_context6.prev = 39;
|
|
21452
21605
|
_iterator.f();
|
|
21453
|
-
return
|
|
21606
|
+
return _context6.finish(39);
|
|
21454
21607
|
case 42:
|
|
21455
21608
|
case "end":
|
|
21456
|
-
return
|
|
21609
|
+
return _context6.stop();
|
|
21457
21610
|
}
|
|
21458
|
-
},
|
|
21611
|
+
}, _callee6, null, [[13, 36, 39, 42]]);
|
|
21459
21612
|
})));
|
|
21460
21613
|
this.options = options;
|
|
21461
21614
|
this.options.simulate = (_this$options$simulat = this.options.simulate) !== null && _this$options$simulat !== void 0 ? _this$options$simulat : true;
|
|
@@ -21479,9 +21632,17 @@ var AssembledTransaction = function () {
|
|
|
21479
21632
|
simulationTransactionData: this.simulationData.transactionData.toXDR("base64")
|
|
21480
21633
|
});
|
|
21481
21634
|
}
|
|
21635
|
+
}, {
|
|
21636
|
+
key: "toXDR",
|
|
21637
|
+
value: function toXDR() {
|
|
21638
|
+
var _this$built2;
|
|
21639
|
+
if (!this.built) throw new Error("Transaction has not yet been simulated; " + "call `AssembledTransaction.simulate` first.");
|
|
21640
|
+
return (_this$built2 = this.built) === null || _this$built2 === void 0 ? void 0 : _this$built2.toEnvelope().toXDR('base64');
|
|
21641
|
+
}
|
|
21482
21642
|
}, {
|
|
21483
21643
|
key: "simulationData",
|
|
21484
21644
|
get: function get() {
|
|
21645
|
+
var _simulation$result;
|
|
21485
21646
|
if (this.simulationResult && this.simulationTransactionData) {
|
|
21486
21647
|
return {
|
|
21487
21648
|
result: this.simulationResult,
|
|
@@ -21496,12 +21657,12 @@ var AssembledTransaction = function () {
|
|
|
21496
21657
|
throw new Error("Transaction simulation failed: \"".concat(simulation.error, "\""));
|
|
21497
21658
|
}
|
|
21498
21659
|
if (api/* Api */.j.isSimulationRestore(simulation)) {
|
|
21499
|
-
throw new AssembledTransaction.Errors.ExpiredState("You need to restore some contract state before you can invoke this method
|
|
21660
|
+
throw new AssembledTransaction.Errors.ExpiredState("You need to restore some contract state before you can invoke this method.\n" + 'You can set `restore` to true in the method options in order to ' + 'automatically restore the contract state when needed.');
|
|
21500
21661
|
}
|
|
21501
|
-
|
|
21502
|
-
|
|
21503
|
-
|
|
21504
|
-
|
|
21662
|
+
this.simulationResult = (_simulation$result = simulation.result) !== null && _simulation$result !== void 0 ? _simulation$result : {
|
|
21663
|
+
auth: [],
|
|
21664
|
+
retval: lib.xdr.ScVal.scvVoid()
|
|
21665
|
+
};
|
|
21505
21666
|
this.simulationTransactionData = simulation.transactionData.build();
|
|
21506
21667
|
return {
|
|
21507
21668
|
result: this.simulationResult,
|
|
@@ -21512,6 +21673,9 @@ var AssembledTransaction = function () {
|
|
|
21512
21673
|
key: "result",
|
|
21513
21674
|
get: function get() {
|
|
21514
21675
|
try {
|
|
21676
|
+
if (!this.simulationData.result) {
|
|
21677
|
+
throw new Error("No simulation result!");
|
|
21678
|
+
}
|
|
21515
21679
|
return this.options.parseResultXdr(this.simulationData.result.retval);
|
|
21516
21680
|
} catch (e) {
|
|
21517
21681
|
if (!implementsToString(e)) throw e;
|
|
@@ -21531,6 +21695,36 @@ var AssembledTransaction = function () {
|
|
|
21531
21695
|
if (!err) return undefined;
|
|
21532
21696
|
return new Err(err);
|
|
21533
21697
|
}
|
|
21698
|
+
}, {
|
|
21699
|
+
key: "send",
|
|
21700
|
+
value: (function () {
|
|
21701
|
+
var _send = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee7() {
|
|
21702
|
+
var sent;
|
|
21703
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
21704
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
21705
|
+
case 0:
|
|
21706
|
+
if (this.signed) {
|
|
21707
|
+
_context7.next = 2;
|
|
21708
|
+
break;
|
|
21709
|
+
}
|
|
21710
|
+
throw new Error("The transaction has not yet been signed. Run `sign` first, or use `signAndSend` instead.");
|
|
21711
|
+
case 2:
|
|
21712
|
+
_context7.next = 4;
|
|
21713
|
+
return SentTransaction.init(undefined, this);
|
|
21714
|
+
case 4:
|
|
21715
|
+
sent = _context7.sent;
|
|
21716
|
+
return _context7.abrupt("return", sent);
|
|
21717
|
+
case 6:
|
|
21718
|
+
case "end":
|
|
21719
|
+
return _context7.stop();
|
|
21720
|
+
}
|
|
21721
|
+
}, _callee7, this);
|
|
21722
|
+
}));
|
|
21723
|
+
function send() {
|
|
21724
|
+
return _send.apply(this, arguments);
|
|
21725
|
+
}
|
|
21726
|
+
return send;
|
|
21727
|
+
}())
|
|
21534
21728
|
}, {
|
|
21535
21729
|
key: "isReadCall",
|
|
21536
21730
|
get: function get() {
|
|
@@ -21538,12 +21732,67 @@ var AssembledTransaction = function () {
|
|
|
21538
21732
|
var writeLength = this.simulationData.transactionData.resources().footprint().readWrite().length;
|
|
21539
21733
|
return authsCount === 0 && writeLength === 0;
|
|
21540
21734
|
}
|
|
21735
|
+
}, {
|
|
21736
|
+
key: "restoreFootprint",
|
|
21737
|
+
value: (function () {
|
|
21738
|
+
var _restoreFootprint = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee8(restorePreamble, account) {
|
|
21739
|
+
var _account;
|
|
21740
|
+
var restoreTx, sentTransaction;
|
|
21741
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
21742
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
21743
|
+
case 0:
|
|
21744
|
+
if (this.options.signTransaction) {
|
|
21745
|
+
_context8.next = 2;
|
|
21746
|
+
break;
|
|
21747
|
+
}
|
|
21748
|
+
throw new Error("For automatic restore to work you must provide a signTransaction function when initializing your Client");
|
|
21749
|
+
case 2:
|
|
21750
|
+
if (!((_account = account) !== null && _account !== void 0)) {
|
|
21751
|
+
_context8.next = 6;
|
|
21752
|
+
break;
|
|
21753
|
+
}
|
|
21754
|
+
_context8.t0 = _account;
|
|
21755
|
+
_context8.next = 9;
|
|
21756
|
+
break;
|
|
21757
|
+
case 6:
|
|
21758
|
+
_context8.next = 8;
|
|
21759
|
+
return getAccount(this.options, this.server);
|
|
21760
|
+
case 8:
|
|
21761
|
+
_context8.t0 = _context8.sent;
|
|
21762
|
+
case 9:
|
|
21763
|
+
account = _context8.t0;
|
|
21764
|
+
_context8.next = 12;
|
|
21765
|
+
return AssembledTransaction.buildFootprintRestoreTransaction(_objectSpread({}, this.options), restorePreamble.transactionData, account, restorePreamble.minResourceFee);
|
|
21766
|
+
case 12:
|
|
21767
|
+
restoreTx = _context8.sent;
|
|
21768
|
+
_context8.next = 15;
|
|
21769
|
+
return restoreTx.signAndSend();
|
|
21770
|
+
case 15:
|
|
21771
|
+
sentTransaction = _context8.sent;
|
|
21772
|
+
if (sentTransaction.getTransactionResponse) {
|
|
21773
|
+
_context8.next = 18;
|
|
21774
|
+
break;
|
|
21775
|
+
}
|
|
21776
|
+
throw new AssembledTransaction.Errors.RestorationFailure("The attempt at automatic restore failed. \n".concat(JSON.stringify(sentTransaction)));
|
|
21777
|
+
case 18:
|
|
21778
|
+
return _context8.abrupt("return", sentTransaction.getTransactionResponse);
|
|
21779
|
+
case 19:
|
|
21780
|
+
case "end":
|
|
21781
|
+
return _context8.stop();
|
|
21782
|
+
}
|
|
21783
|
+
}, _callee8, this);
|
|
21784
|
+
}));
|
|
21785
|
+
function restoreFootprint(_x2, _x3) {
|
|
21786
|
+
return _restoreFootprint.apply(this, arguments);
|
|
21787
|
+
}
|
|
21788
|
+
return restoreFootprint;
|
|
21789
|
+
}())
|
|
21541
21790
|
}], [{
|
|
21542
21791
|
key: "fromJSON",
|
|
21543
|
-
value: function fromJSON(options,
|
|
21544
|
-
var tx =
|
|
21545
|
-
simulationResult =
|
|
21546
|
-
simulationTransactionData =
|
|
21792
|
+
value: function fromJSON(options, _ref12) {
|
|
21793
|
+
var tx = _ref12.tx,
|
|
21794
|
+
simulationResult = _ref12.simulationResult,
|
|
21795
|
+
simulationTransactionData = _ref12.simulationTransactionData;
|
|
21547
21796
|
var txn = new AssembledTransaction(options);
|
|
21548
21797
|
txn.built = lib.TransactionBuilder.fromXDR(tx, options.networkPassphrase);
|
|
21549
21798
|
txn.simulationResult = {
|
|
@@ -21555,54 +21804,99 @@ var AssembledTransaction = function () {
|
|
|
21555
21804
|
txn.simulationTransactionData = lib.xdr.SorobanTransactionData.fromXDR(simulationTransactionData, "base64");
|
|
21556
21805
|
return txn;
|
|
21557
21806
|
}
|
|
21807
|
+
}, {
|
|
21808
|
+
key: "fromXDR",
|
|
21809
|
+
value: function fromXDR(options, encodedXDR, spec) {
|
|
21810
|
+
var _operation$func;
|
|
21811
|
+
var envelope = lib.xdr.TransactionEnvelope.fromXDR(encodedXDR, "base64");
|
|
21812
|
+
var built = lib.TransactionBuilder.fromXDR(envelope, options.networkPassphrase);
|
|
21813
|
+
var operation = built.operations[0];
|
|
21814
|
+
if (!(operation !== null && operation !== void 0 && (_operation$func = operation.func) !== null && _operation$func !== void 0 && _operation$func.value) || typeof operation.func.value !== 'function') {
|
|
21815
|
+
throw new Error("Could not extract the method from the transaction envelope.");
|
|
21816
|
+
}
|
|
21817
|
+
var invokeContractArgs = operation.func.value();
|
|
21818
|
+
if (!(invokeContractArgs !== null && invokeContractArgs !== void 0 && invokeContractArgs.functionName)) {
|
|
21819
|
+
throw new Error("Could not extract the method name from the transaction envelope.");
|
|
21820
|
+
}
|
|
21821
|
+
var method = invokeContractArgs.functionName().toString('utf-8');
|
|
21822
|
+
var txn = new AssembledTransaction(_objectSpread(_objectSpread({}, options), {}, {
|
|
21823
|
+
method: method,
|
|
21824
|
+
parseResultXdr: function parseResultXdr(result) {
|
|
21825
|
+
return spec.funcResToNative(method, result);
|
|
21826
|
+
}
|
|
21827
|
+
}));
|
|
21828
|
+
txn.built = built;
|
|
21829
|
+
return txn;
|
|
21830
|
+
}
|
|
21558
21831
|
}, {
|
|
21559
21832
|
key: "build",
|
|
21560
21833
|
value: (function () {
|
|
21561
|
-
var _build = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function
|
|
21834
|
+
var _build = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee9(options) {
|
|
21562
21835
|
var _options$fee, _options$args, _options$timeoutInSec;
|
|
21563
21836
|
var tx, contract, account;
|
|
21564
|
-
return assembled_transaction_regeneratorRuntime().wrap(function
|
|
21565
|
-
while (1) switch (
|
|
21837
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
21838
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
21566
21839
|
case 0:
|
|
21567
21840
|
tx = new AssembledTransaction(options);
|
|
21568
21841
|
contract = new lib.Contract(options.contractId);
|
|
21569
|
-
|
|
21570
|
-
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
_context6.next = 5;
|
|
21574
|
-
return tx.server.getAccount(options.publicKey);
|
|
21575
|
-
case 5:
|
|
21576
|
-
_context6.t0 = _context6.sent;
|
|
21577
|
-
_context6.next = 9;
|
|
21578
|
-
break;
|
|
21579
|
-
case 8:
|
|
21580
|
-
_context6.t0 = new lib.Account(NULL_ACCOUNT, "0");
|
|
21581
|
-
case 9:
|
|
21582
|
-
account = _context6.t0;
|
|
21842
|
+
_context9.next = 4;
|
|
21843
|
+
return getAccount(options, tx.server);
|
|
21844
|
+
case 4:
|
|
21845
|
+
account = _context9.sent;
|
|
21583
21846
|
tx.raw = new lib.TransactionBuilder(account, {
|
|
21584
21847
|
fee: (_options$fee = options.fee) !== null && _options$fee !== void 0 ? _options$fee : lib.BASE_FEE,
|
|
21585
21848
|
networkPassphrase: options.networkPassphrase
|
|
21586
21849
|
}).addOperation(contract.call.apply(contract, [options.method].concat(_toConsumableArray((_options$args = options.args) !== null && _options$args !== void 0 ? _options$args : [])))).setTimeout((_options$timeoutInSec = options.timeoutInSeconds) !== null && _options$timeoutInSec !== void 0 ? _options$timeoutInSec : DEFAULT_TIMEOUT);
|
|
21587
21850
|
if (!options.simulate) {
|
|
21588
|
-
|
|
21851
|
+
_context9.next = 9;
|
|
21589
21852
|
break;
|
|
21590
21853
|
}
|
|
21591
|
-
|
|
21854
|
+
_context9.next = 9;
|
|
21592
21855
|
return tx.simulate();
|
|
21593
|
-
case
|
|
21594
|
-
return
|
|
21595
|
-
case
|
|
21856
|
+
case 9:
|
|
21857
|
+
return _context9.abrupt("return", tx);
|
|
21858
|
+
case 10:
|
|
21596
21859
|
case "end":
|
|
21597
|
-
return
|
|
21860
|
+
return _context9.stop();
|
|
21598
21861
|
}
|
|
21599
|
-
},
|
|
21862
|
+
}, _callee9);
|
|
21600
21863
|
}));
|
|
21601
|
-
function build(
|
|
21864
|
+
function build(_x4) {
|
|
21602
21865
|
return _build.apply(this, arguments);
|
|
21603
21866
|
}
|
|
21604
21867
|
return build;
|
|
21605
21868
|
}())
|
|
21869
|
+
}, {
|
|
21870
|
+
key: "buildFootprintRestoreTransaction",
|
|
21871
|
+
value: function () {
|
|
21872
|
+
var _buildFootprintRestoreTransaction = assembled_transaction_asyncToGenerator(assembled_transaction_regeneratorRuntime().mark(function _callee10(options, sorobanData, account, fee) {
|
|
21873
|
+
var _options$timeoutInSec2;
|
|
21874
|
+
var tx;
|
|
21875
|
+
return assembled_transaction_regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
21876
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
21877
|
+
case 0:
|
|
21878
|
+
tx = new AssembledTransaction(options);
|
|
21879
|
+
tx.raw = new lib.TransactionBuilder(account, {
|
|
21880
|
+
fee: fee,
|
|
21881
|
+
networkPassphrase: options.networkPassphrase
|
|
21882
|
+
}).setSorobanData(sorobanData instanceof lib.SorobanDataBuilder ? sorobanData.build() : sorobanData).addOperation(lib.Operation.restoreFootprint({})).setTimeout((_options$timeoutInSec2 = options.timeoutInSeconds) !== null && _options$timeoutInSec2 !== void 0 ? _options$timeoutInSec2 : DEFAULT_TIMEOUT);
|
|
21883
|
+
_context10.next = 4;
|
|
21884
|
+
return tx.simulate({
|
|
21885
|
+
restore: false
|
|
21886
|
+
});
|
|
21887
|
+
case 4:
|
|
21888
|
+
return _context10.abrupt("return", tx);
|
|
21889
|
+
case 5:
|
|
21890
|
+
case "end":
|
|
21891
|
+
return _context10.stop();
|
|
21892
|
+
}
|
|
21893
|
+
}, _callee10);
|
|
21894
|
+
}));
|
|
21895
|
+
function buildFootprintRestoreTransaction(_x5, _x6, _x7, _x8) {
|
|
21896
|
+
return _buildFootprintRestoreTransaction.apply(this, arguments);
|
|
21897
|
+
}
|
|
21898
|
+
return buildFootprintRestoreTransaction;
|
|
21899
|
+
}()
|
|
21606
21900
|
}]);
|
|
21607
21901
|
}();
|
|
21608
21902
|
assembled_transaction_defineProperty(AssembledTransaction, "Errors", {
|
|
@@ -21614,52 +21908,60 @@ assembled_transaction_defineProperty(AssembledTransaction, "Errors", {
|
|
|
21614
21908
|
assembled_transaction_inherits(ExpiredStateError, _Error);
|
|
21615
21909
|
return assembled_transaction_createClass(ExpiredStateError);
|
|
21616
21910
|
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21617
|
-
|
|
21911
|
+
RestorationFailure: function (_Error2) {
|
|
21912
|
+
function RestoreFailureError() {
|
|
21913
|
+
assembled_transaction_classCallCheck(this, RestoreFailureError);
|
|
21914
|
+
return assembled_transaction_callSuper(this, RestoreFailureError, arguments);
|
|
21915
|
+
}
|
|
21916
|
+
assembled_transaction_inherits(RestoreFailureError, _Error2);
|
|
21917
|
+
return assembled_transaction_createClass(RestoreFailureError);
|
|
21918
|
+
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21919
|
+
NeedsMoreSignatures: function (_Error3) {
|
|
21618
21920
|
function NeedsMoreSignaturesError() {
|
|
21619
21921
|
assembled_transaction_classCallCheck(this, NeedsMoreSignaturesError);
|
|
21620
21922
|
return assembled_transaction_callSuper(this, NeedsMoreSignaturesError, arguments);
|
|
21621
21923
|
}
|
|
21622
|
-
assembled_transaction_inherits(NeedsMoreSignaturesError,
|
|
21924
|
+
assembled_transaction_inherits(NeedsMoreSignaturesError, _Error3);
|
|
21623
21925
|
return assembled_transaction_createClass(NeedsMoreSignaturesError);
|
|
21624
21926
|
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21625
|
-
NoSignatureNeeded: function (
|
|
21927
|
+
NoSignatureNeeded: function (_Error4) {
|
|
21626
21928
|
function NoSignatureNeededError() {
|
|
21627
21929
|
assembled_transaction_classCallCheck(this, NoSignatureNeededError);
|
|
21628
21930
|
return assembled_transaction_callSuper(this, NoSignatureNeededError, arguments);
|
|
21629
21931
|
}
|
|
21630
|
-
assembled_transaction_inherits(NoSignatureNeededError,
|
|
21932
|
+
assembled_transaction_inherits(NoSignatureNeededError, _Error4);
|
|
21631
21933
|
return assembled_transaction_createClass(NoSignatureNeededError);
|
|
21632
21934
|
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21633
|
-
NoUnsignedNonInvokerAuthEntries: function (
|
|
21935
|
+
NoUnsignedNonInvokerAuthEntries: function (_Error5) {
|
|
21634
21936
|
function NoUnsignedNonInvokerAuthEntriesError() {
|
|
21635
21937
|
assembled_transaction_classCallCheck(this, NoUnsignedNonInvokerAuthEntriesError);
|
|
21636
21938
|
return assembled_transaction_callSuper(this, NoUnsignedNonInvokerAuthEntriesError, arguments);
|
|
21637
21939
|
}
|
|
21638
|
-
assembled_transaction_inherits(NoUnsignedNonInvokerAuthEntriesError,
|
|
21940
|
+
assembled_transaction_inherits(NoUnsignedNonInvokerAuthEntriesError, _Error5);
|
|
21639
21941
|
return assembled_transaction_createClass(NoUnsignedNonInvokerAuthEntriesError);
|
|
21640
21942
|
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21641
|
-
NoSigner: function (
|
|
21943
|
+
NoSigner: function (_Error6) {
|
|
21642
21944
|
function NoSignerError() {
|
|
21643
21945
|
assembled_transaction_classCallCheck(this, NoSignerError);
|
|
21644
21946
|
return assembled_transaction_callSuper(this, NoSignerError, arguments);
|
|
21645
21947
|
}
|
|
21646
|
-
assembled_transaction_inherits(NoSignerError,
|
|
21948
|
+
assembled_transaction_inherits(NoSignerError, _Error6);
|
|
21647
21949
|
return assembled_transaction_createClass(NoSignerError);
|
|
21648
21950
|
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21649
|
-
NotYetSimulated: function (
|
|
21951
|
+
NotYetSimulated: function (_Error7) {
|
|
21650
21952
|
function NotYetSimulatedError() {
|
|
21651
21953
|
assembled_transaction_classCallCheck(this, NotYetSimulatedError);
|
|
21652
21954
|
return assembled_transaction_callSuper(this, NotYetSimulatedError, arguments);
|
|
21653
21955
|
}
|
|
21654
|
-
assembled_transaction_inherits(NotYetSimulatedError,
|
|
21956
|
+
assembled_transaction_inherits(NotYetSimulatedError, _Error7);
|
|
21655
21957
|
return assembled_transaction_createClass(NotYetSimulatedError);
|
|
21656
21958
|
}(assembled_transaction_wrapNativeSuper(Error)),
|
|
21657
|
-
FakeAccount: function (
|
|
21959
|
+
FakeAccount: function (_Error8) {
|
|
21658
21960
|
function FakeAccountError() {
|
|
21659
21961
|
assembled_transaction_classCallCheck(this, FakeAccountError);
|
|
21660
21962
|
return assembled_transaction_callSuper(this, FakeAccountError, arguments);
|
|
21661
21963
|
}
|
|
21662
|
-
assembled_transaction_inherits(FakeAccountError,
|
|
21964
|
+
assembled_transaction_inherits(FakeAccountError, _Error8);
|
|
21663
21965
|
return assembled_transaction_createClass(FakeAccountError);
|
|
21664
21966
|
}(assembled_transaction_wrapNativeSuper(Error))
|
|
21665
21967
|
});
|
|
@@ -21713,9 +22015,8 @@ var basicNodeSigner = function basicNodeSigner(keypair, networkPassphrase) {
|
|
|
21713
22015
|
};
|
|
21714
22016
|
;// CONCATENATED MODULE: ./src/contract/spec.ts
|
|
21715
22017
|
/* provided dependency */ var spec_Buffer = __webpack_require__(8287)["Buffer"];
|
|
21716
|
-
function
|
|
21717
|
-
function
|
|
21718
|
-
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; } } }; }
|
|
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; }
|
|
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; }
|
|
21719
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); }
|
|
21720
22021
|
function spec_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
21721
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); } }
|
|
@@ -21731,12 +22032,36 @@ function spec_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined
|
|
|
21731
22032
|
function spec_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
21732
22033
|
|
|
21733
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
|
+
}
|
|
21734
22060
|
function readObj(args, input) {
|
|
21735
22061
|
var inputName = input.name().toString();
|
|
21736
22062
|
var entry = Object.entries(args).find(function (_ref) {
|
|
21737
|
-
var _ref2 = spec_slicedToArray(_ref,
|
|
21738
|
-
name = _ref2[0]
|
|
21739
|
-
_ = _ref2[1];
|
|
22063
|
+
var _ref2 = spec_slicedToArray(_ref, 1),
|
|
22064
|
+
name = _ref2[0];
|
|
21740
22065
|
return name === inputName;
|
|
21741
22066
|
});
|
|
21742
22067
|
if (!entry) {
|
|
@@ -21744,152 +22069,557 @@ function readObj(args, input) {
|
|
|
21744
22069
|
}
|
|
21745
22070
|
return entry[1];
|
|
21746
22071
|
}
|
|
21747
|
-
|
|
21748
|
-
function
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
|
|
21752
|
-
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
21760
|
-
|
|
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;
|
|
21761
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"));
|
|
21762
22118
|
}
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
|
|
21774
|
-
|
|
21775
|
-
|
|
21776
|
-
|
|
21777
|
-
|
|
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;
|
|
21778
22194
|
}
|
|
21779
|
-
|
|
21780
|
-
|
|
21781
|
-
|
|
21782
|
-
|
|
21783
|
-
|
|
21784
|
-
var _this = this;
|
|
21785
|
-
var fn = this.getFunc(name);
|
|
21786
|
-
return fn.inputs().map(function (input) {
|
|
21787
|
-
return _this.nativeToScVal(readObj(args, input), input.type());
|
|
21788
|
-
});
|
|
21789
|
-
}
|
|
21790
|
-
}, {
|
|
21791
|
-
key: "funcResToNative",
|
|
21792
|
-
value: function funcResToNative(name, val_or_base64) {
|
|
21793
|
-
var val = typeof val_or_base64 === "string" ? lib.xdr.ScVal.fromXDR(val_or_base64, "base64") : val_or_base64;
|
|
21794
|
-
var func = this.getFunc(name);
|
|
21795
|
-
var outputs = func.outputs();
|
|
21796
|
-
if (outputs.length === 0) {
|
|
21797
|
-
var type = val.switch();
|
|
21798
|
-
if (type.value !== lib.xdr.ScValType.scvVoid().value) {
|
|
21799
|
-
throw new Error("Expected void, got ".concat(type.name));
|
|
21800
|
-
}
|
|
21801
|
-
return null;
|
|
22195
|
+
case lib.xdr.ScSpecType.scSpecTypeBool().value:
|
|
22196
|
+
{
|
|
22197
|
+
return {
|
|
22198
|
+
type: "boolean"
|
|
22199
|
+
};
|
|
21802
22200
|
}
|
|
21803
|
-
|
|
21804
|
-
|
|
22201
|
+
case lib.xdr.ScSpecType.scSpecTypeVoid().value:
|
|
22202
|
+
{
|
|
22203
|
+
return {
|
|
22204
|
+
type: "null"
|
|
22205
|
+
};
|
|
21805
22206
|
}
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
22207
|
+
case lib.xdr.ScSpecType.scSpecTypeError().value:
|
|
22208
|
+
{
|
|
22209
|
+
ref = "Error";
|
|
22210
|
+
break;
|
|
21809
22211
|
}
|
|
21810
|
-
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
value: function findEntry(name) {
|
|
21815
|
-
var entry = this.entries.find(function (entry) {
|
|
21816
|
-
return entry.value().name().toString() === name;
|
|
21817
|
-
});
|
|
21818
|
-
if (!entry) {
|
|
21819
|
-
throw new Error("no such entry: ".concat(name));
|
|
22212
|
+
case lib.xdr.ScSpecType.scSpecTypeU32().value:
|
|
22213
|
+
{
|
|
22214
|
+
ref = "U32";
|
|
22215
|
+
break;
|
|
21820
22216
|
}
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
|
|
21824
|
-
|
|
21825
|
-
value: function nativeToScVal(val, ty) {
|
|
21826
|
-
var _this2 = this;
|
|
21827
|
-
var t = ty.switch();
|
|
21828
|
-
var value = t.value;
|
|
21829
|
-
if (t.value === lib.xdr.ScSpecType.scSpecTypeUdt().value) {
|
|
21830
|
-
var udt = ty.udt();
|
|
21831
|
-
return this.nativeToUdt(val, udt.name().toString());
|
|
22217
|
+
case lib.xdr.ScSpecType.scSpecTypeI32().value:
|
|
22218
|
+
{
|
|
22219
|
+
ref = "I32";
|
|
22220
|
+
break;
|
|
21832
22221
|
}
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
}
|
|
21838
|
-
return this.nativeToScVal(val, opt.valueType());
|
|
22222
|
+
case lib.xdr.ScSpecType.scSpecTypeU64().value:
|
|
22223
|
+
{
|
|
22224
|
+
ref = "U64";
|
|
22225
|
+
break;
|
|
21839
22226
|
}
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
|
|
21860
|
-
|
|
21861
|
-
|
|
21862
|
-
|
|
21863
|
-
|
|
21864
|
-
|
|
21865
|
-
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
|
|
21872
|
-
|
|
21873
|
-
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
21877
|
-
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
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
|
+
}
|
|
22477
|
+
var Spec = function () {
|
|
22478
|
+
function Spec(entries) {
|
|
22479
|
+
spec_classCallCheck(this, Spec);
|
|
22480
|
+
spec_defineProperty(this, "entries", []);
|
|
22481
|
+
if (entries.length === 0) {
|
|
22482
|
+
throw new Error("Contract spec must have at least one entry");
|
|
22483
|
+
}
|
|
22484
|
+
var entry = entries[0];
|
|
22485
|
+
if (typeof entry === "string") {
|
|
22486
|
+
this.entries = entries.map(function (s) {
|
|
22487
|
+
return lib.xdr.ScSpecEntry.fromXDR(s, "base64");
|
|
22488
|
+
});
|
|
22489
|
+
} else {
|
|
22490
|
+
this.entries = entries;
|
|
22491
|
+
}
|
|
22492
|
+
}
|
|
22493
|
+
return spec_createClass(Spec, [{
|
|
22494
|
+
key: "funcs",
|
|
22495
|
+
value: function funcs() {
|
|
22496
|
+
return this.entries.filter(function (entry) {
|
|
22497
|
+
return entry.switch().value === lib.xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value;
|
|
22498
|
+
}).map(function (entry) {
|
|
22499
|
+
return entry.functionV0();
|
|
22500
|
+
});
|
|
22501
|
+
}
|
|
22502
|
+
}, {
|
|
22503
|
+
key: "getFunc",
|
|
22504
|
+
value: function getFunc(name) {
|
|
22505
|
+
var entry = this.findEntry(name);
|
|
22506
|
+
if (entry.switch().value !== lib.xdr.ScSpecEntryKind.scSpecEntryFunctionV0().value) {
|
|
22507
|
+
throw new Error("".concat(name, " is not a function"));
|
|
22508
|
+
}
|
|
22509
|
+
return entry.functionV0();
|
|
22510
|
+
}
|
|
22511
|
+
}, {
|
|
22512
|
+
key: "funcArgsToScVals",
|
|
22513
|
+
value: function funcArgsToScVals(name, args) {
|
|
22514
|
+
var _this = this;
|
|
22515
|
+
var fn = this.getFunc(name);
|
|
22516
|
+
return fn.inputs().map(function (input) {
|
|
22517
|
+
return _this.nativeToScVal(readObj(args, input), input.type());
|
|
22518
|
+
});
|
|
22519
|
+
}
|
|
22520
|
+
}, {
|
|
22521
|
+
key: "funcResToNative",
|
|
22522
|
+
value: function funcResToNative(name, val_or_base64) {
|
|
22523
|
+
var val = typeof val_or_base64 === "string" ? lib.xdr.ScVal.fromXDR(val_or_base64, "base64") : val_or_base64;
|
|
22524
|
+
var func = this.getFunc(name);
|
|
22525
|
+
var outputs = func.outputs();
|
|
22526
|
+
if (outputs.length === 0) {
|
|
22527
|
+
var type = val.switch();
|
|
22528
|
+
if (type.value !== lib.xdr.ScValType.scvVoid().value) {
|
|
22529
|
+
throw new Error("Expected void, got ".concat(type.name));
|
|
22530
|
+
}
|
|
22531
|
+
return null;
|
|
22532
|
+
}
|
|
22533
|
+
if (outputs.length > 1) {
|
|
22534
|
+
throw new Error("Multiple outputs not supported");
|
|
22535
|
+
}
|
|
22536
|
+
var output = outputs[0];
|
|
22537
|
+
if (output.switch().value === lib.xdr.ScSpecType.scSpecTypeResult().value) {
|
|
22538
|
+
return new Ok(this.scValToNative(val, output.result().okType()));
|
|
22539
|
+
}
|
|
22540
|
+
return this.scValToNative(val, output);
|
|
22541
|
+
}
|
|
22542
|
+
}, {
|
|
22543
|
+
key: "findEntry",
|
|
22544
|
+
value: function findEntry(name) {
|
|
22545
|
+
var entry = this.entries.find(function (e) {
|
|
22546
|
+
return e.value().name().toString() === name;
|
|
22547
|
+
});
|
|
22548
|
+
if (!entry) {
|
|
22549
|
+
throw new Error("no such entry: ".concat(name));
|
|
22550
|
+
}
|
|
22551
|
+
return entry;
|
|
22552
|
+
}
|
|
22553
|
+
}, {
|
|
22554
|
+
key: "nativeToScVal",
|
|
22555
|
+
value: function nativeToScVal(val, ty) {
|
|
22556
|
+
var _this2 = this;
|
|
22557
|
+
var t = ty.switch();
|
|
22558
|
+
var value = t.value;
|
|
22559
|
+
if (t.value === lib.xdr.ScSpecType.scSpecTypeUdt().value) {
|
|
22560
|
+
var udt = ty.udt();
|
|
22561
|
+
return this.nativeToUdt(val, udt.name().toString());
|
|
22562
|
+
}
|
|
22563
|
+
if (value === lib.xdr.ScSpecType.scSpecTypeOption().value) {
|
|
22564
|
+
var opt = ty.option();
|
|
22565
|
+
if (val === undefined) {
|
|
22566
|
+
return lib.xdr.ScVal.scvVoid();
|
|
22567
|
+
}
|
|
22568
|
+
return this.nativeToScVal(val, opt.valueType());
|
|
22569
|
+
}
|
|
22570
|
+
switch (spec_typeof(val)) {
|
|
22571
|
+
case "object":
|
|
22572
|
+
{
|
|
22573
|
+
var _val$constructor$name, _val$constructor;
|
|
22574
|
+
if (val === null) {
|
|
22575
|
+
switch (value) {
|
|
22576
|
+
case lib.xdr.ScSpecType.scSpecTypeVoid().value:
|
|
22577
|
+
return lib.xdr.ScVal.scvVoid();
|
|
22578
|
+
default:
|
|
22579
|
+
throw new TypeError("Type ".concat(ty, " was not void, but value was null"));
|
|
22580
|
+
}
|
|
22581
|
+
}
|
|
22582
|
+
if (val instanceof lib.xdr.ScVal) {
|
|
22583
|
+
return val;
|
|
22584
|
+
}
|
|
22585
|
+
if (val instanceof lib.Address) {
|
|
22586
|
+
if (ty.switch().value !== lib.xdr.ScSpecType.scSpecTypeAddress().value) {
|
|
22587
|
+
throw new TypeError("Type ".concat(ty, " was not address, but value was Address"));
|
|
22588
|
+
}
|
|
22589
|
+
return val.toScVal();
|
|
22590
|
+
}
|
|
22591
|
+
if (val instanceof lib.Contract) {
|
|
22592
|
+
if (ty.switch().value !== lib.xdr.ScSpecType.scSpecTypeAddress().value) {
|
|
22593
|
+
throw new TypeError("Type ".concat(ty, " was not address, but value was Address"));
|
|
22594
|
+
}
|
|
22595
|
+
return val.address().toScVal();
|
|
22596
|
+
}
|
|
22597
|
+
if (val instanceof Uint8Array || spec_Buffer.isBuffer(val)) {
|
|
22598
|
+
var copy = Uint8Array.from(val);
|
|
22599
|
+
switch (value) {
|
|
22600
|
+
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
22601
|
+
{
|
|
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));
|
|
22605
|
+
}
|
|
22606
|
+
return lib.xdr.ScVal.scvBytes(copy);
|
|
22607
|
+
}
|
|
22608
|
+
case lib.xdr.ScSpecType.scSpecTypeBytes().value:
|
|
22609
|
+
return lib.xdr.ScVal.scvBytes(copy);
|
|
22610
|
+
default:
|
|
22611
|
+
throw new TypeError("invalid type (".concat(ty, ") specified for Bytes and BytesN"));
|
|
22612
|
+
}
|
|
22613
|
+
}
|
|
22614
|
+
if (Array.isArray(val)) {
|
|
22615
|
+
switch (value) {
|
|
22616
|
+
case lib.xdr.ScSpecType.scSpecTypeVec().value:
|
|
22617
|
+
{
|
|
22618
|
+
var vec = ty.vec();
|
|
22619
|
+
var elementType = vec.elementType();
|
|
22620
|
+
return lib.xdr.ScVal.scvVec(val.map(function (v) {
|
|
22621
|
+
return _this2.nativeToScVal(v, elementType);
|
|
22622
|
+
}));
|
|
21893
22623
|
}
|
|
21894
22624
|
case lib.xdr.ScSpecType.scSpecTypeTuple().value:
|
|
21895
22625
|
{
|
|
@@ -21909,10 +22639,10 @@ var Spec = function () {
|
|
|
21909
22639
|
var valueType = map.valueType();
|
|
21910
22640
|
return lib.xdr.ScVal.scvMap(val.map(function (entry) {
|
|
21911
22641
|
var key = _this2.nativeToScVal(entry[0], keyType);
|
|
21912
|
-
var
|
|
22642
|
+
var mapVal = _this2.nativeToScVal(entry[1], valueType);
|
|
21913
22643
|
return new lib.xdr.ScMapEntry({
|
|
21914
22644
|
key: key,
|
|
21915
|
-
val:
|
|
22645
|
+
val: mapVal
|
|
21916
22646
|
});
|
|
21917
22647
|
}));
|
|
21918
22648
|
}
|
|
@@ -21934,10 +22664,10 @@ var Spec = function () {
|
|
|
21934
22664
|
k = _res$value[0],
|
|
21935
22665
|
v = _res$value[1];
|
|
21936
22666
|
var key = this.nativeToScVal(k, scMap.keyType());
|
|
21937
|
-
var
|
|
22667
|
+
var mapval = this.nativeToScVal(v, scMap.valueType());
|
|
21938
22668
|
entries.push(new lib.xdr.ScMapEntry({
|
|
21939
22669
|
key: key,
|
|
21940
|
-
val:
|
|
22670
|
+
val: mapval
|
|
21941
22671
|
}));
|
|
21942
22672
|
res = values.next();
|
|
21943
22673
|
}
|
|
@@ -22021,25 +22751,25 @@ var Spec = function () {
|
|
|
22021
22751
|
key: "nativeToUnion",
|
|
22022
22752
|
value: function nativeToUnion(val, union_) {
|
|
22023
22753
|
var _this3 = this;
|
|
22024
|
-
var
|
|
22025
|
-
var
|
|
22026
|
-
var
|
|
22027
|
-
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;
|
|
22028
22758
|
});
|
|
22029
|
-
if (!
|
|
22030
|
-
throw new TypeError("no such enum entry: ".concat(
|
|
22759
|
+
if (!caseFound) {
|
|
22760
|
+
throw new TypeError("no such enum entry: ".concat(entryName, " in ").concat(union_));
|
|
22031
22761
|
}
|
|
22032
|
-
var key = lib.xdr.ScVal.scvSymbol(
|
|
22033
|
-
switch (
|
|
22762
|
+
var key = lib.xdr.ScVal.scvSymbol(entryName);
|
|
22763
|
+
switch (caseFound.switch()) {
|
|
22034
22764
|
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0():
|
|
22035
22765
|
{
|
|
22036
22766
|
return lib.xdr.ScVal.scvVec([key]);
|
|
22037
22767
|
}
|
|
22038
22768
|
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0():
|
|
22039
22769
|
{
|
|
22040
|
-
var types =
|
|
22770
|
+
var types = caseFound.tupleCase().type();
|
|
22041
22771
|
if (Array.isArray(val.values)) {
|
|
22042
|
-
if (val.values.length
|
|
22772
|
+
if (val.values.length !== types.length) {
|
|
22043
22773
|
throw new TypeError("union ".concat(union_, " expects ").concat(types.length, " values, but got ").concat(val.values.length));
|
|
22044
22774
|
}
|
|
22045
22775
|
var scvals = val.values.map(function (v, i) {
|
|
@@ -22048,7 +22778,7 @@ var Spec = function () {
|
|
|
22048
22778
|
scvals.unshift(key);
|
|
22049
22779
|
return lib.xdr.ScVal.scvVec(scvals);
|
|
22050
22780
|
}
|
|
22051
|
-
throw new Error("failed to parse union case ".concat(
|
|
22781
|
+
throw new Error("failed to parse union case ".concat(caseFound, " with ").concat(val));
|
|
22052
22782
|
}
|
|
22053
22783
|
default:
|
|
22054
22784
|
throw new Error("failed to parse union ".concat(union_, " with ").concat(val));
|
|
@@ -22101,7 +22831,7 @@ var Spec = function () {
|
|
|
22101
22831
|
}
|
|
22102
22832
|
switch (scv.switch().value) {
|
|
22103
22833
|
case lib.xdr.ScValType.scvVoid().value:
|
|
22104
|
-
return
|
|
22834
|
+
return undefined;
|
|
22105
22835
|
case lib.xdr.ScValType.scvU64().value:
|
|
22106
22836
|
case lib.xdr.ScValType.scvI64().value:
|
|
22107
22837
|
case lib.xdr.ScValType.scvU128().value:
|
|
@@ -22111,13 +22841,14 @@ var Spec = function () {
|
|
|
22111
22841
|
return (0,lib.scValToBigInt)(scv);
|
|
22112
22842
|
case lib.xdr.ScValType.scvVec().value:
|
|
22113
22843
|
{
|
|
22114
|
-
if (value
|
|
22844
|
+
if (value === lib.xdr.ScSpecType.scSpecTypeVec().value) {
|
|
22115
22845
|
var _scv$vec;
|
|
22116
22846
|
var vec = typeDef.vec();
|
|
22117
22847
|
return ((_scv$vec = scv.vec()) !== null && _scv$vec !== void 0 ? _scv$vec : []).map(function (elm) {
|
|
22118
22848
|
return _this5.scValToNative(elm, vec.elementType());
|
|
22119
22849
|
});
|
|
22120
|
-
}
|
|
22850
|
+
}
|
|
22851
|
+
if (value === lib.xdr.ScSpecType.scSpecTypeTuple().value) {
|
|
22121
22852
|
var _scv$vec2;
|
|
22122
22853
|
var tuple = typeDef.tuple();
|
|
22123
22854
|
var valTypes = tuple.valueTypes();
|
|
@@ -22133,10 +22864,10 @@ var Spec = function () {
|
|
|
22133
22864
|
{
|
|
22134
22865
|
var _scv$map;
|
|
22135
22866
|
var map = (_scv$map = scv.map()) !== null && _scv$map !== void 0 ? _scv$map : [];
|
|
22136
|
-
if (value
|
|
22137
|
-
var
|
|
22138
|
-
var keyType =
|
|
22139
|
-
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();
|
|
22140
22871
|
var res = map.map(function (entry) {
|
|
22141
22872
|
return [_this5.scValToNative(entry.key(), keyType), _this5.scValToNative(entry.val(), valueType)];
|
|
22142
22873
|
});
|
|
@@ -22192,7 +22923,7 @@ var Spec = function () {
|
|
|
22192
22923
|
throw new Error("".concat(val, " has length 0, but the there are at least one case in the union"));
|
|
22193
22924
|
}
|
|
22194
22925
|
var name = vec[0].sym().toString();
|
|
22195
|
-
if (vec[0].switch().value
|
|
22926
|
+
if (vec[0].switch().value !== lib.xdr.ScValType.scvSymbol().value) {
|
|
22196
22927
|
throw new Error("{vec[0]} is not a symbol");
|
|
22197
22928
|
}
|
|
22198
22929
|
var entry = udt.cases().find(findCase(name));
|
|
@@ -22205,8 +22936,8 @@ var Spec = function () {
|
|
|
22205
22936
|
if (entry.switch().value === lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value) {
|
|
22206
22937
|
var tuple = entry.tupleCase();
|
|
22207
22938
|
var ty = tuple.type();
|
|
22208
|
-
var values = ty.map(function (
|
|
22209
|
-
return _this6.scValToNative(vec[i + 1],
|
|
22939
|
+
var values = ty.map(function (e, i) {
|
|
22940
|
+
return _this6.scValToNative(vec[i + 1], e);
|
|
22210
22941
|
});
|
|
22211
22942
|
res.values = values;
|
|
22212
22943
|
}
|
|
@@ -22254,514 +22985,50 @@ var Spec = function () {
|
|
|
22254
22985
|
key: "jsonSchema",
|
|
22255
22986
|
value: function jsonSchema(funcName) {
|
|
22256
22987
|
var definitions = {};
|
|
22257
|
-
|
|
22258
|
-
|
|
22259
|
-
|
|
22260
|
-
|
|
22261
|
-
|
|
22262
|
-
|
|
22263
|
-
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0().value:
|
|
22264
|
-
{
|
|
22265
|
-
var _udt = entry.udtEnumV0();
|
|
22266
|
-
definitions[_udt.name().toString()] = enumToJsonSchema(_udt);
|
|
22267
|
-
break;
|
|
22268
|
-
}
|
|
22269
|
-
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtStructV0().value:
|
|
22270
|
-
{
|
|
22271
|
-
var _udt2 = entry.udtStructV0();
|
|
22272
|
-
definitions[_udt2.name().toString()] = structToJsonSchema(_udt2);
|
|
22273
|
-
break;
|
|
22274
|
-
}
|
|
22275
|
-
case lib.xdr.ScSpecEntryKind.scSpecEntryUdtUnionV0().value:
|
|
22276
|
-
var udt = entry.udtUnionV0();
|
|
22277
|
-
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);
|
|
22278
22994
|
break;
|
|
22279
|
-
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
|
|
22287
|
-
|
|
22288
|
-
|
|
22289
|
-
|
|
22290
|
-
|
|
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
|
+
{}
|
|
22291
23019
|
}
|
|
22292
|
-
}
|
|
22293
|
-
_iterator.e(err);
|
|
22294
|
-
} finally {
|
|
22295
|
-
_iterator.f();
|
|
22296
|
-
}
|
|
23020
|
+
});
|
|
22297
23021
|
var res = {
|
|
22298
23022
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
22299
|
-
definitions:
|
|
23023
|
+
definitions: spec_objectSpread(spec_objectSpread({}, PRIMITIVE_DEFINITONS), definitions)
|
|
22300
23024
|
};
|
|
22301
23025
|
if (funcName) {
|
|
22302
|
-
res
|
|
23026
|
+
res.$ref = "#/definitions/".concat(funcName);
|
|
22303
23027
|
}
|
|
22304
23028
|
return res;
|
|
22305
23029
|
}
|
|
22306
23030
|
}]);
|
|
22307
23031
|
}();
|
|
22308
|
-
function stringToScVal(str, ty) {
|
|
22309
|
-
switch (ty.value) {
|
|
22310
|
-
case lib.xdr.ScSpecType.scSpecTypeString().value:
|
|
22311
|
-
return lib.xdr.ScVal.scvString(str);
|
|
22312
|
-
case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
|
|
22313
|
-
return lib.xdr.ScVal.scvSymbol(str);
|
|
22314
|
-
case lib.xdr.ScSpecType.scSpecTypeAddress().value:
|
|
22315
|
-
{
|
|
22316
|
-
var addr = lib.Address.fromString(str);
|
|
22317
|
-
return lib.xdr.ScVal.scvAddress(addr.toScAddress());
|
|
22318
|
-
}
|
|
22319
|
-
case lib.xdr.ScSpecType.scSpecTypeU64().value:
|
|
22320
|
-
return new lib.XdrLargeInt("u64", str).toScVal();
|
|
22321
|
-
case lib.xdr.ScSpecType.scSpecTypeI64().value:
|
|
22322
|
-
return new lib.XdrLargeInt("i64", str).toScVal();
|
|
22323
|
-
case lib.xdr.ScSpecType.scSpecTypeU128().value:
|
|
22324
|
-
return new lib.XdrLargeInt("u128", str).toScVal();
|
|
22325
|
-
case lib.xdr.ScSpecType.scSpecTypeI128().value:
|
|
22326
|
-
return new lib.XdrLargeInt("i128", str).toScVal();
|
|
22327
|
-
case lib.xdr.ScSpecType.scSpecTypeU256().value:
|
|
22328
|
-
return new lib.XdrLargeInt("u256", str).toScVal();
|
|
22329
|
-
case lib.xdr.ScSpecType.scSpecTypeI256().value:
|
|
22330
|
-
return new lib.XdrLargeInt("i256", str).toScVal();
|
|
22331
|
-
case lib.xdr.ScSpecType.scSpecTypeBytes().value:
|
|
22332
|
-
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
22333
|
-
return lib.xdr.ScVal.scvBytes(spec_Buffer.from(str, "base64"));
|
|
22334
|
-
default:
|
|
22335
|
-
throw new TypeError("invalid type ".concat(ty.name, " specified for string value"));
|
|
22336
|
-
}
|
|
22337
|
-
}
|
|
22338
|
-
function isNumeric(field) {
|
|
22339
|
-
return /^\d+$/.test(field.name().toString());
|
|
22340
|
-
}
|
|
22341
|
-
function findCase(name) {
|
|
22342
|
-
return function matches(entry) {
|
|
22343
|
-
switch (entry.switch().value) {
|
|
22344
|
-
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
|
|
22345
|
-
{
|
|
22346
|
-
var tuple = entry.tupleCase();
|
|
22347
|
-
return tuple.name().toString() === name;
|
|
22348
|
-
}
|
|
22349
|
-
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
|
|
22350
|
-
{
|
|
22351
|
-
var void_case = entry.voidCase();
|
|
22352
|
-
return void_case.name().toString() === name;
|
|
22353
|
-
}
|
|
22354
|
-
default:
|
|
22355
|
-
return false;
|
|
22356
|
-
}
|
|
22357
|
-
};
|
|
22358
|
-
}
|
|
22359
|
-
var PRIMITIVE_DEFINITONS = {
|
|
22360
|
-
U32: {
|
|
22361
|
-
type: "integer",
|
|
22362
|
-
minimum: 0,
|
|
22363
|
-
maximum: 4294967295
|
|
22364
|
-
},
|
|
22365
|
-
I32: {
|
|
22366
|
-
type: "integer",
|
|
22367
|
-
minimum: -2147483648,
|
|
22368
|
-
maximum: 2147483647
|
|
22369
|
-
},
|
|
22370
|
-
U64: {
|
|
22371
|
-
type: "string",
|
|
22372
|
-
pattern: "^([1-9][0-9]*|0)$",
|
|
22373
|
-
minLength: 1,
|
|
22374
|
-
maxLength: 20
|
|
22375
|
-
},
|
|
22376
|
-
I64: {
|
|
22377
|
-
type: "string",
|
|
22378
|
-
pattern: "^(-?[1-9][0-9]*|0)$",
|
|
22379
|
-
minLength: 1,
|
|
22380
|
-
maxLength: 21
|
|
22381
|
-
},
|
|
22382
|
-
U128: {
|
|
22383
|
-
type: "string",
|
|
22384
|
-
pattern: "^([1-9][0-9]*|0)$",
|
|
22385
|
-
minLength: 1,
|
|
22386
|
-
maxLength: 39
|
|
22387
|
-
},
|
|
22388
|
-
I128: {
|
|
22389
|
-
type: "string",
|
|
22390
|
-
pattern: "^(-?[1-9][0-9]*|0)$",
|
|
22391
|
-
minLength: 1,
|
|
22392
|
-
maxLength: 40
|
|
22393
|
-
},
|
|
22394
|
-
U256: {
|
|
22395
|
-
type: "string",
|
|
22396
|
-
pattern: "^([1-9][0-9]*|0)$",
|
|
22397
|
-
minLength: 1,
|
|
22398
|
-
maxLength: 78
|
|
22399
|
-
},
|
|
22400
|
-
I256: {
|
|
22401
|
-
type: "string",
|
|
22402
|
-
pattern: "^(-?[1-9][0-9]*|0)$",
|
|
22403
|
-
minLength: 1,
|
|
22404
|
-
maxLength: 79
|
|
22405
|
-
},
|
|
22406
|
-
Address: {
|
|
22407
|
-
type: "string",
|
|
22408
|
-
format: "address",
|
|
22409
|
-
description: "Address can be a public key or contract id"
|
|
22410
|
-
},
|
|
22411
|
-
ScString: {
|
|
22412
|
-
type: "string",
|
|
22413
|
-
description: "ScString is a string"
|
|
22414
|
-
},
|
|
22415
|
-
ScSymbol: {
|
|
22416
|
-
type: "string",
|
|
22417
|
-
description: "ScString is a string"
|
|
22418
|
-
},
|
|
22419
|
-
DataUrl: {
|
|
22420
|
-
type: "string",
|
|
22421
|
-
pattern: "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$"
|
|
22422
|
-
}
|
|
22423
|
-
};
|
|
22424
|
-
function typeRef(typeDef) {
|
|
22425
|
-
var t = typeDef.switch();
|
|
22426
|
-
var value = t.value;
|
|
22427
|
-
var ref;
|
|
22428
|
-
switch (value) {
|
|
22429
|
-
case lib.xdr.ScSpecType.scSpecTypeVal().value:
|
|
22430
|
-
{
|
|
22431
|
-
ref = "Val";
|
|
22432
|
-
break;
|
|
22433
|
-
}
|
|
22434
|
-
case lib.xdr.ScSpecType.scSpecTypeBool().value:
|
|
22435
|
-
{
|
|
22436
|
-
return {
|
|
22437
|
-
type: "boolean"
|
|
22438
|
-
};
|
|
22439
|
-
}
|
|
22440
|
-
case lib.xdr.ScSpecType.scSpecTypeVoid().value:
|
|
22441
|
-
{
|
|
22442
|
-
return {
|
|
22443
|
-
type: "null"
|
|
22444
|
-
};
|
|
22445
|
-
}
|
|
22446
|
-
case lib.xdr.ScSpecType.scSpecTypeError().value:
|
|
22447
|
-
{
|
|
22448
|
-
ref = "Error";
|
|
22449
|
-
break;
|
|
22450
|
-
}
|
|
22451
|
-
case lib.xdr.ScSpecType.scSpecTypeU32().value:
|
|
22452
|
-
{
|
|
22453
|
-
ref = "U32";
|
|
22454
|
-
break;
|
|
22455
|
-
}
|
|
22456
|
-
case lib.xdr.ScSpecType.scSpecTypeI32().value:
|
|
22457
|
-
{
|
|
22458
|
-
ref = "I32";
|
|
22459
|
-
break;
|
|
22460
|
-
}
|
|
22461
|
-
case lib.xdr.ScSpecType.scSpecTypeU64().value:
|
|
22462
|
-
{
|
|
22463
|
-
ref = "U64";
|
|
22464
|
-
break;
|
|
22465
|
-
}
|
|
22466
|
-
case lib.xdr.ScSpecType.scSpecTypeI64().value:
|
|
22467
|
-
{
|
|
22468
|
-
ref = "I64";
|
|
22469
|
-
break;
|
|
22470
|
-
}
|
|
22471
|
-
case lib.xdr.ScSpecType.scSpecTypeTimepoint().value:
|
|
22472
|
-
{
|
|
22473
|
-
throw new Error("Timepoint type not supported");
|
|
22474
|
-
ref = "Timepoint";
|
|
22475
|
-
break;
|
|
22476
|
-
}
|
|
22477
|
-
case lib.xdr.ScSpecType.scSpecTypeDuration().value:
|
|
22478
|
-
{
|
|
22479
|
-
throw new Error("Duration not supported");
|
|
22480
|
-
ref = "Duration";
|
|
22481
|
-
break;
|
|
22482
|
-
}
|
|
22483
|
-
case lib.xdr.ScSpecType.scSpecTypeU128().value:
|
|
22484
|
-
{
|
|
22485
|
-
ref = "U128";
|
|
22486
|
-
break;
|
|
22487
|
-
}
|
|
22488
|
-
case lib.xdr.ScSpecType.scSpecTypeI128().value:
|
|
22489
|
-
{
|
|
22490
|
-
ref = "I128";
|
|
22491
|
-
break;
|
|
22492
|
-
}
|
|
22493
|
-
case lib.xdr.ScSpecType.scSpecTypeU256().value:
|
|
22494
|
-
{
|
|
22495
|
-
ref = "U256";
|
|
22496
|
-
break;
|
|
22497
|
-
}
|
|
22498
|
-
case lib.xdr.ScSpecType.scSpecTypeI256().value:
|
|
22499
|
-
{
|
|
22500
|
-
ref = "I256";
|
|
22501
|
-
break;
|
|
22502
|
-
}
|
|
22503
|
-
case lib.xdr.ScSpecType.scSpecTypeBytes().value:
|
|
22504
|
-
{
|
|
22505
|
-
ref = "DataUrl";
|
|
22506
|
-
break;
|
|
22507
|
-
}
|
|
22508
|
-
case lib.xdr.ScSpecType.scSpecTypeString().value:
|
|
22509
|
-
{
|
|
22510
|
-
ref = "ScString";
|
|
22511
|
-
break;
|
|
22512
|
-
}
|
|
22513
|
-
case lib.xdr.ScSpecType.scSpecTypeSymbol().value:
|
|
22514
|
-
{
|
|
22515
|
-
ref = "ScSymbol";
|
|
22516
|
-
break;
|
|
22517
|
-
}
|
|
22518
|
-
case lib.xdr.ScSpecType.scSpecTypeAddress().value:
|
|
22519
|
-
{
|
|
22520
|
-
ref = "Address";
|
|
22521
|
-
break;
|
|
22522
|
-
}
|
|
22523
|
-
case lib.xdr.ScSpecType.scSpecTypeOption().value:
|
|
22524
|
-
{
|
|
22525
|
-
var opt = typeDef.option();
|
|
22526
|
-
return typeRef(opt.valueType());
|
|
22527
|
-
}
|
|
22528
|
-
case lib.xdr.ScSpecType.scSpecTypeResult().value:
|
|
22529
|
-
{
|
|
22530
|
-
break;
|
|
22531
|
-
}
|
|
22532
|
-
case lib.xdr.ScSpecType.scSpecTypeVec().value:
|
|
22533
|
-
{
|
|
22534
|
-
var arr = typeDef.vec();
|
|
22535
|
-
var _ref3 = typeRef(arr.elementType());
|
|
22536
|
-
return {
|
|
22537
|
-
type: "array",
|
|
22538
|
-
items: _ref3
|
|
22539
|
-
};
|
|
22540
|
-
}
|
|
22541
|
-
case lib.xdr.ScSpecType.scSpecTypeMap().value:
|
|
22542
|
-
{
|
|
22543
|
-
var map = typeDef.map();
|
|
22544
|
-
var items = [typeRef(map.keyType()), typeRef(map.valueType())];
|
|
22545
|
-
return {
|
|
22546
|
-
type: "array",
|
|
22547
|
-
items: {
|
|
22548
|
-
type: "array",
|
|
22549
|
-
items: items,
|
|
22550
|
-
minItems: 2,
|
|
22551
|
-
maxItems: 2
|
|
22552
|
-
}
|
|
22553
|
-
};
|
|
22554
|
-
}
|
|
22555
|
-
case lib.xdr.ScSpecType.scSpecTypeTuple().value:
|
|
22556
|
-
{
|
|
22557
|
-
var tuple = typeDef.tuple();
|
|
22558
|
-
var minItems = tuple.valueTypes().length;
|
|
22559
|
-
var maxItems = minItems;
|
|
22560
|
-
var _items = tuple.valueTypes().map(typeRef);
|
|
22561
|
-
return {
|
|
22562
|
-
type: "array",
|
|
22563
|
-
items: _items,
|
|
22564
|
-
minItems: minItems,
|
|
22565
|
-
maxItems: maxItems
|
|
22566
|
-
};
|
|
22567
|
-
}
|
|
22568
|
-
case lib.xdr.ScSpecType.scSpecTypeBytesN().value:
|
|
22569
|
-
{
|
|
22570
|
-
var _arr = typeDef.bytesN();
|
|
22571
|
-
return {
|
|
22572
|
-
$ref: "#/definitions/DataUrl",
|
|
22573
|
-
maxLength: _arr.n()
|
|
22574
|
-
};
|
|
22575
|
-
}
|
|
22576
|
-
case lib.xdr.ScSpecType.scSpecTypeUdt().value:
|
|
22577
|
-
{
|
|
22578
|
-
var udt = typeDef.udt();
|
|
22579
|
-
ref = udt.name().toString();
|
|
22580
|
-
break;
|
|
22581
|
-
}
|
|
22582
|
-
}
|
|
22583
|
-
return {
|
|
22584
|
-
$ref: "#/definitions/".concat(ref)
|
|
22585
|
-
};
|
|
22586
|
-
}
|
|
22587
|
-
function isRequired(typeDef) {
|
|
22588
|
-
return typeDef.switch().value != lib.xdr.ScSpecType.scSpecTypeOption().value;
|
|
22589
|
-
}
|
|
22590
|
-
function structToJsonSchema(udt) {
|
|
22591
|
-
var fields = udt.fields();
|
|
22592
|
-
if (fields.some(isNumeric)) {
|
|
22593
|
-
if (!fields.every(isNumeric)) {
|
|
22594
|
-
throw new Error("mixed numeric and non-numeric field names are not allowed");
|
|
22595
|
-
}
|
|
22596
|
-
var items = fields.map(function (_, i) {
|
|
22597
|
-
return typeRef(fields[i].type());
|
|
22598
|
-
});
|
|
22599
|
-
return {
|
|
22600
|
-
type: "array",
|
|
22601
|
-
items: items,
|
|
22602
|
-
minItems: fields.length,
|
|
22603
|
-
maxItems: fields.length
|
|
22604
|
-
};
|
|
22605
|
-
}
|
|
22606
|
-
var description = udt.doc().toString();
|
|
22607
|
-
var _args_and_required = args_and_required(fields),
|
|
22608
|
-
properties = _args_and_required.properties,
|
|
22609
|
-
required = _args_and_required.required;
|
|
22610
|
-
properties["additionalProperties"] = false;
|
|
22611
|
-
return {
|
|
22612
|
-
description: description,
|
|
22613
|
-
properties: properties,
|
|
22614
|
-
required: required,
|
|
22615
|
-
type: "object"
|
|
22616
|
-
};
|
|
22617
|
-
}
|
|
22618
|
-
function args_and_required(input) {
|
|
22619
|
-
var properties = {};
|
|
22620
|
-
var required = [];
|
|
22621
|
-
var _iterator2 = spec_createForOfIteratorHelper(input),
|
|
22622
|
-
_step2;
|
|
22623
|
-
try {
|
|
22624
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
22625
|
-
var arg = _step2.value;
|
|
22626
|
-
var type_ = arg.type();
|
|
22627
|
-
var name = arg.name().toString();
|
|
22628
|
-
properties[name] = typeRef(type_);
|
|
22629
|
-
if (isRequired(type_)) {
|
|
22630
|
-
required.push(name);
|
|
22631
|
-
}
|
|
22632
|
-
}
|
|
22633
|
-
} catch (err) {
|
|
22634
|
-
_iterator2.e(err);
|
|
22635
|
-
} finally {
|
|
22636
|
-
_iterator2.f();
|
|
22637
|
-
}
|
|
22638
|
-
var res = {
|
|
22639
|
-
properties: properties
|
|
22640
|
-
};
|
|
22641
|
-
if (required.length > 0) {
|
|
22642
|
-
res.required = required;
|
|
22643
|
-
}
|
|
22644
|
-
return res;
|
|
22645
|
-
}
|
|
22646
|
-
function functionToJsonSchema(func) {
|
|
22647
|
-
var _args_and_required2 = args_and_required(func.inputs()),
|
|
22648
|
-
properties = _args_and_required2.properties,
|
|
22649
|
-
required = _args_and_required2.required;
|
|
22650
|
-
var args = {
|
|
22651
|
-
additionalProperties: false,
|
|
22652
|
-
properties: properties,
|
|
22653
|
-
type: "object"
|
|
22654
|
-
};
|
|
22655
|
-
if ((required === null || required === void 0 ? void 0 : required.length) > 0) {
|
|
22656
|
-
args.required = required;
|
|
22657
|
-
}
|
|
22658
|
-
var input = {
|
|
22659
|
-
properties: {
|
|
22660
|
-
args: args
|
|
22661
|
-
}
|
|
22662
|
-
};
|
|
22663
|
-
var outputs = func.outputs();
|
|
22664
|
-
var output = outputs.length > 0 ? typeRef(outputs[0]) : typeRef(lib.xdr.ScSpecTypeDef.scSpecTypeVoid());
|
|
22665
|
-
var description = func.doc().toString();
|
|
22666
|
-
if (description.length > 0) {
|
|
22667
|
-
input.description = description;
|
|
22668
|
-
}
|
|
22669
|
-
input.additionalProperties = false;
|
|
22670
|
-
output.additionalProperties = false;
|
|
22671
|
-
return {
|
|
22672
|
-
input: input,
|
|
22673
|
-
output: output
|
|
22674
|
-
};
|
|
22675
|
-
}
|
|
22676
|
-
function unionToJsonSchema(udt) {
|
|
22677
|
-
var description = udt.doc().toString();
|
|
22678
|
-
var cases = udt.cases();
|
|
22679
|
-
var oneOf = [];
|
|
22680
|
-
var _iterator3 = spec_createForOfIteratorHelper(cases),
|
|
22681
|
-
_step3;
|
|
22682
|
-
try {
|
|
22683
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
22684
|
-
var case_ = _step3.value;
|
|
22685
|
-
switch (case_.switch().value) {
|
|
22686
|
-
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseVoidV0().value:
|
|
22687
|
-
{
|
|
22688
|
-
var c = case_.voidCase();
|
|
22689
|
-
var title = c.name().toString();
|
|
22690
|
-
oneOf.push({
|
|
22691
|
-
type: "object",
|
|
22692
|
-
title: title,
|
|
22693
|
-
properties: {
|
|
22694
|
-
tag: title
|
|
22695
|
-
},
|
|
22696
|
-
additionalProperties: false,
|
|
22697
|
-
required: ["tag"]
|
|
22698
|
-
});
|
|
22699
|
-
break;
|
|
22700
|
-
}
|
|
22701
|
-
case lib.xdr.ScSpecUdtUnionCaseV0Kind.scSpecUdtUnionCaseTupleV0().value:
|
|
22702
|
-
{
|
|
22703
|
-
var _c = case_.tupleCase();
|
|
22704
|
-
var _title = _c.name().toString();
|
|
22705
|
-
oneOf.push({
|
|
22706
|
-
type: "object",
|
|
22707
|
-
title: _title,
|
|
22708
|
-
properties: {
|
|
22709
|
-
tag: _title,
|
|
22710
|
-
values: {
|
|
22711
|
-
type: "array",
|
|
22712
|
-
items: _c.type().map(typeRef)
|
|
22713
|
-
}
|
|
22714
|
-
},
|
|
22715
|
-
required: ["tag", "values"],
|
|
22716
|
-
additionalProperties: false
|
|
22717
|
-
});
|
|
22718
|
-
}
|
|
22719
|
-
}
|
|
22720
|
-
}
|
|
22721
|
-
} catch (err) {
|
|
22722
|
-
_iterator3.e(err);
|
|
22723
|
-
} finally {
|
|
22724
|
-
_iterator3.f();
|
|
22725
|
-
}
|
|
22726
|
-
var res = {
|
|
22727
|
-
oneOf: oneOf
|
|
22728
|
-
};
|
|
22729
|
-
if (description.length > 0) {
|
|
22730
|
-
res.description = description;
|
|
22731
|
-
}
|
|
22732
|
-
return res;
|
|
22733
|
-
}
|
|
22734
|
-
function enumToJsonSchema(udt) {
|
|
22735
|
-
var description = udt.doc().toString();
|
|
22736
|
-
var cases = udt.cases();
|
|
22737
|
-
var oneOf = [];
|
|
22738
|
-
var _iterator4 = spec_createForOfIteratorHelper(cases),
|
|
22739
|
-
_step4;
|
|
22740
|
-
try {
|
|
22741
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
22742
|
-
var case_ = _step4.value;
|
|
22743
|
-
var title = case_.name().toString();
|
|
22744
|
-
var _description = case_.doc().toString();
|
|
22745
|
-
oneOf.push({
|
|
22746
|
-
description: _description,
|
|
22747
|
-
title: title,
|
|
22748
|
-
enum: [case_.value()],
|
|
22749
|
-
type: "number"
|
|
22750
|
-
});
|
|
22751
|
-
}
|
|
22752
|
-
} catch (err) {
|
|
22753
|
-
_iterator4.e(err);
|
|
22754
|
-
} finally {
|
|
22755
|
-
_iterator4.f();
|
|
22756
|
-
}
|
|
22757
|
-
var res = {
|
|
22758
|
-
oneOf: oneOf
|
|
22759
|
-
};
|
|
22760
|
-
if (description.length > 0) {
|
|
22761
|
-
res.description = description;
|
|
22762
|
-
}
|
|
22763
|
-
return res;
|
|
22764
|
-
}
|
|
22765
23032
|
// EXTERNAL MODULE: ./src/rpc/index.ts
|
|
22766
23033
|
var rpc = __webpack_require__(1660);
|
|
22767
23034
|
;// CONCATENATED MODULE: ./src/contract/client.ts
|
|
@@ -22773,8 +23040,8 @@ function client_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c),
|
|
|
22773
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); }); }; }
|
|
22774
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; }
|
|
22775
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; }
|
|
22776
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var
|
|
22777
|
-
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; }
|
|
22778
23045
|
function client_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
22779
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); } }
|
|
22780
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; }
|
|
@@ -22800,6 +23067,9 @@ var Client = function () {
|
|
|
22800
23067
|
}
|
|
22801
23068
|
}), tx);
|
|
22802
23069
|
});
|
|
23070
|
+
client_defineProperty(this, "txFromXDR", function (xdrBase64) {
|
|
23071
|
+
return AssembledTransaction.fromXDR(_this.options, xdrBase64, _this.spec);
|
|
23072
|
+
});
|
|
22803
23073
|
this.spec = spec;
|
|
22804
23074
|
this.options = options;
|
|
22805
23075
|
this.spec.funcs().forEach(function (xdrFn) {
|
|
@@ -26456,14 +26726,14 @@ var AxiosClient = axios/* default */.A.create({
|
|
|
26456
26726
|
"X-Client-Version": version
|
|
26457
26727
|
}
|
|
26458
26728
|
});
|
|
26459
|
-
function
|
|
26729
|
+
function toSeconds(ms) {
|
|
26460
26730
|
return Math.floor(ms / 1000);
|
|
26461
26731
|
}
|
|
26462
|
-
AxiosClient.interceptors.response.use(function
|
|
26732
|
+
AxiosClient.interceptors.response.use(function (response) {
|
|
26463
26733
|
var hostname = URI_default()(response.config.url).hostname();
|
|
26464
|
-
var serverTime =
|
|
26465
|
-
var localTimeRecorded =
|
|
26466
|
-
if (!isNaN(serverTime)) {
|
|
26734
|
+
var serverTime = toSeconds(Date.parse(response.headers.date));
|
|
26735
|
+
var localTimeRecorded = toSeconds(new Date().getTime());
|
|
26736
|
+
if (!Number.isNaN(serverTime)) {
|
|
26467
26737
|
SERVER_TIME_MAP[hostname] = {
|
|
26468
26738
|
serverTime: serverTime,
|
|
26469
26739
|
localTimeRecorded: localTimeRecorded
|
|
@@ -26479,7 +26749,7 @@ function getCurrentServerTime(hostname) {
|
|
|
26479
26749
|
}
|
|
26480
26750
|
var serverTime = entry.serverTime,
|
|
26481
26751
|
localTimeRecorded = entry.localTimeRecorded;
|
|
26482
|
-
var currentTime =
|
|
26752
|
+
var currentTime = toSeconds(new Date().getTime());
|
|
26483
26753
|
if (currentTime - localTimeRecorded > 60 * 5) {
|
|
26484
26754
|
return null;
|
|
26485
26755
|
}
|
|
@@ -26680,8 +26950,7 @@ var CallBuilder = function () {
|
|
|
26680
26950
|
if (!json._links) {
|
|
26681
26951
|
return json;
|
|
26682
26952
|
}
|
|
26683
|
-
|
|
26684
|
-
var key = _Object$keys[_i];
|
|
26953
|
+
Object.keys(json._links).forEach(function (key) {
|
|
26685
26954
|
var n = json._links[key];
|
|
26686
26955
|
var included = false;
|
|
26687
26956
|
if (typeof json[key] !== "undefined") {
|
|
@@ -26704,10 +26973,7 @@ var CallBuilder = function () {
|
|
|
26704
26973
|
} else {
|
|
26705
26974
|
json[key] = _this4._requestFnForLink(n);
|
|
26706
26975
|
}
|
|
26707
|
-
};
|
|
26708
|
-
for (var _i = 0, _Object$keys = Object.keys(json._links); _i < _Object$keys.length; _i++) {
|
|
26709
|
-
_loop();
|
|
26710
|
-
}
|
|
26976
|
+
});
|
|
26711
26977
|
return json;
|
|
26712
26978
|
}
|
|
26713
26979
|
}, {
|
|
@@ -27518,13 +27784,9 @@ var TradeAggregationCallBuilder = function (_CallBuilder) {
|
|
|
27518
27784
|
return trade_aggregation_call_builder_createClass(TradeAggregationCallBuilder, [{
|
|
27519
27785
|
key: "isValidResolution",
|
|
27520
27786
|
value: function isValidResolution(resolution) {
|
|
27521
|
-
|
|
27522
|
-
|
|
27523
|
-
|
|
27524
|
-
return true;
|
|
27525
|
-
}
|
|
27526
|
-
}
|
|
27527
|
-
return false;
|
|
27787
|
+
return allowedResolutions.some(function (allowed) {
|
|
27788
|
+
return allowed === resolution;
|
|
27789
|
+
});
|
|
27528
27790
|
}
|
|
27529
27791
|
}, {
|
|
27530
27792
|
key: "isValidOffset",
|
|
@@ -27662,6 +27924,9 @@ var TransactionCallBuilder = function (_CallBuilder) {
|
|
|
27662
27924
|
}(CallBuilder);
|
|
27663
27925
|
;// CONCATENATED MODULE: ./src/horizon/server.ts
|
|
27664
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; }
|
|
27665
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; }
|
|
27666
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); }
|
|
27667
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); }); }; }
|
|
@@ -27697,7 +27962,7 @@ function server_toPrimitive(t, r) { if ("object" != server_typeof(t) || !t) retu
|
|
|
27697
27962
|
var SUBMIT_TRANSACTION_TIMEOUT = 60 * 1000;
|
|
27698
27963
|
var STROOPS_IN_LUMEN = 10000000;
|
|
27699
27964
|
var ACCOUNT_REQUIRES_MEMO = "MQ==";
|
|
27700
|
-
function
|
|
27965
|
+
function getAmountInLumens(amt) {
|
|
27701
27966
|
return new bignumber(amt).div(STROOPS_IN_LUMEN).toString();
|
|
27702
27967
|
}
|
|
27703
27968
|
var Server = function () {
|
|
@@ -27716,6 +27981,9 @@ var Server = function () {
|
|
|
27716
27981
|
if (opts.authToken) {
|
|
27717
27982
|
customHeaders["X-Auth-Token"] = opts.authToken;
|
|
27718
27983
|
}
|
|
27984
|
+
if (opts.headers) {
|
|
27985
|
+
Object.assign(customHeaders, opts.headers);
|
|
27986
|
+
}
|
|
27719
27987
|
if (Object.keys(customHeaders).length > 0) {
|
|
27720
27988
|
horizon_axios_client.interceptors.request.use(function (config) {
|
|
27721
27989
|
config.headers = Object.assign(config.headers, customHeaders);
|
|
@@ -27759,11 +28027,8 @@ var Server = function () {
|
|
|
27759
28027
|
_context.next = 8;
|
|
27760
28028
|
return horizon_axios_client.get(URI_default()(this.serverURL).toString());
|
|
27761
28029
|
case 8:
|
|
27762
|
-
_context.
|
|
27763
|
-
|
|
27764
|
-
case 10:
|
|
27765
|
-
return _context.abrupt("return", _context.sent);
|
|
27766
|
-
case 11:
|
|
28030
|
+
return _context.abrupt("return", this.fetchTimebounds(seconds, true));
|
|
28031
|
+
case 9:
|
|
27767
28032
|
case "end":
|
|
27768
28033
|
return _context.stop();
|
|
27769
28034
|
}
|
|
@@ -27871,7 +28136,7 @@ var Server = function () {
|
|
|
27871
28136
|
sellerId = lib.StrKey.encodeEd25519PublicKey(offerClaimed.sellerId().ed25519());
|
|
27872
28137
|
break;
|
|
27873
28138
|
default:
|
|
27874
|
-
throw new Error("Invalid offer result type: "
|
|
28139
|
+
throw new Error("Invalid offer result type: ".concat(offerClaimedAtom.switch()));
|
|
27875
28140
|
}
|
|
27876
28141
|
var claimedOfferAmountBought = new bignumber(offerClaimed.amountBought().toString());
|
|
27877
28142
|
var claimedOfferAmountSold = new bignumber(offerClaimed.amountSold().toString());
|
|
@@ -27893,9 +28158,9 @@ var Server = function () {
|
|
|
27893
28158
|
sellerId: sellerId,
|
|
27894
28159
|
offerId: offerClaimed.offerId().toString(),
|
|
27895
28160
|
assetSold: assetSold,
|
|
27896
|
-
amountSold:
|
|
28161
|
+
amountSold: getAmountInLumens(claimedOfferAmountSold),
|
|
27897
28162
|
assetBought: assetBought,
|
|
27898
|
-
amountBought:
|
|
28163
|
+
amountBought: getAmountInLumens(claimedOfferAmountBought)
|
|
27899
28164
|
};
|
|
27900
28165
|
});
|
|
27901
28166
|
var effect = offerSuccess.offer().switch().name;
|
|
@@ -27906,7 +28171,7 @@ var Server = function () {
|
|
|
27906
28171
|
offerId: offerXDR.offerId().toString(),
|
|
27907
28172
|
selling: {},
|
|
27908
28173
|
buying: {},
|
|
27909
|
-
amount:
|
|
28174
|
+
amount: getAmountInLumens(offerXDR.amount().toString()),
|
|
27910
28175
|
price: {
|
|
27911
28176
|
n: offerXDR.price().n(),
|
|
27912
28177
|
d: offerXDR.price().d()
|
|
@@ -27930,8 +28195,8 @@ var Server = function () {
|
|
|
27930
28195
|
effect: effect,
|
|
27931
28196
|
operationIndex: i,
|
|
27932
28197
|
currentOffer: currentOffer,
|
|
27933
|
-
amountBought:
|
|
27934
|
-
amountSold:
|
|
28198
|
+
amountBought: getAmountInLumens(amountBought),
|
|
28199
|
+
amountSold: getAmountInLumens(amountSold),
|
|
27935
28200
|
isFullyOpen: !offersClaimed.length && effect !== "manageOfferDeleted",
|
|
27936
28201
|
wasPartiallyFilled: !!offersClaimed.length && effect !== "manageOfferDeleted",
|
|
27937
28202
|
wasImmediatelyFilled: !!offersClaimed.length && effect === "manageOfferDeleted",
|
|
@@ -27941,7 +28206,7 @@ var Server = function () {
|
|
|
27941
28206
|
return !!result;
|
|
27942
28207
|
});
|
|
27943
28208
|
}
|
|
27944
|
-
return
|
|
28209
|
+
return _objectSpread(_objectSpread({}, response.data), {}, {
|
|
27945
28210
|
offerResults: hasManageOffer ? offerResults : undefined
|
|
27946
28211
|
});
|
|
27947
28212
|
}).catch(function (response) {
|
|
@@ -27961,6 +28226,46 @@ var Server = function () {
|
|
|
27961
28226
|
}
|
|
27962
28227
|
return submitTransaction;
|
|
27963
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
|
+
}())
|
|
27964
28269
|
}, {
|
|
27965
28270
|
key: "accounts",
|
|
27966
28271
|
value: function accounts() {
|
|
@@ -28039,23 +28344,23 @@ var Server = function () {
|
|
|
28039
28344
|
}, {
|
|
28040
28345
|
key: "loadAccount",
|
|
28041
28346
|
value: (function () {
|
|
28042
|
-
var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
28347
|
+
var _loadAccount = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee6(accountId) {
|
|
28043
28348
|
var res;
|
|
28044
|
-
return server_regeneratorRuntime().wrap(function
|
|
28045
|
-
while (1) switch (
|
|
28349
|
+
return server_regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
28350
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
28046
28351
|
case 0:
|
|
28047
|
-
|
|
28352
|
+
_context6.next = 2;
|
|
28048
28353
|
return this.accounts().accountId(accountId).call();
|
|
28049
28354
|
case 2:
|
|
28050
|
-
res =
|
|
28051
|
-
return
|
|
28355
|
+
res = _context6.sent;
|
|
28356
|
+
return _context6.abrupt("return", new AccountResponse(res));
|
|
28052
28357
|
case 4:
|
|
28053
28358
|
case "end":
|
|
28054
|
-
return
|
|
28359
|
+
return _context6.stop();
|
|
28055
28360
|
}
|
|
28056
|
-
},
|
|
28361
|
+
}, _callee6, this);
|
|
28057
28362
|
}));
|
|
28058
|
-
function loadAccount(
|
|
28363
|
+
function loadAccount(_x4) {
|
|
28059
28364
|
return _loadAccount.apply(this, arguments);
|
|
28060
28365
|
}
|
|
28061
28366
|
return loadAccount;
|
|
@@ -28068,90 +28373,90 @@ var Server = function () {
|
|
|
28068
28373
|
}, {
|
|
28069
28374
|
key: "checkMemoRequired",
|
|
28070
28375
|
value: (function () {
|
|
28071
|
-
var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function
|
|
28376
|
+
var _checkMemoRequired = server_asyncToGenerator(server_regeneratorRuntime().mark(function _callee7(transaction) {
|
|
28072
28377
|
var destinations, i, operation, destination, account;
|
|
28073
|
-
return server_regeneratorRuntime().wrap(function
|
|
28074
|
-
while (1) switch (
|
|
28378
|
+
return server_regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
28379
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
28075
28380
|
case 0:
|
|
28076
28381
|
if (transaction instanceof lib.FeeBumpTransaction) {
|
|
28077
28382
|
transaction = transaction.innerTransaction;
|
|
28078
28383
|
}
|
|
28079
28384
|
if (!(transaction.memo.type !== "none")) {
|
|
28080
|
-
|
|
28385
|
+
_context7.next = 3;
|
|
28081
28386
|
break;
|
|
28082
28387
|
}
|
|
28083
|
-
return
|
|
28388
|
+
return _context7.abrupt("return");
|
|
28084
28389
|
case 3:
|
|
28085
28390
|
destinations = new Set();
|
|
28086
28391
|
i = 0;
|
|
28087
28392
|
case 5:
|
|
28088
28393
|
if (!(i < transaction.operations.length)) {
|
|
28089
|
-
|
|
28394
|
+
_context7.next = 36;
|
|
28090
28395
|
break;
|
|
28091
28396
|
}
|
|
28092
28397
|
operation = transaction.operations[i];
|
|
28093
|
-
|
|
28094
|
-
|
|
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;
|
|
28095
28400
|
break;
|
|
28096
28401
|
case 10:
|
|
28097
|
-
return
|
|
28402
|
+
return _context7.abrupt("break", 12);
|
|
28098
28403
|
case 11:
|
|
28099
|
-
return
|
|
28404
|
+
return _context7.abrupt("continue", 33);
|
|
28100
28405
|
case 12:
|
|
28101
28406
|
destination = operation.destination;
|
|
28102
28407
|
if (!destinations.has(destination)) {
|
|
28103
|
-
|
|
28408
|
+
_context7.next = 15;
|
|
28104
28409
|
break;
|
|
28105
28410
|
}
|
|
28106
|
-
return
|
|
28411
|
+
return _context7.abrupt("continue", 33);
|
|
28107
28412
|
case 15:
|
|
28108
28413
|
destinations.add(destination);
|
|
28109
28414
|
if (!destination.startsWith("M")) {
|
|
28110
|
-
|
|
28415
|
+
_context7.next = 18;
|
|
28111
28416
|
break;
|
|
28112
28417
|
}
|
|
28113
|
-
return
|
|
28418
|
+
return _context7.abrupt("continue", 33);
|
|
28114
28419
|
case 18:
|
|
28115
|
-
|
|
28116
|
-
|
|
28420
|
+
_context7.prev = 18;
|
|
28421
|
+
_context7.next = 21;
|
|
28117
28422
|
return this.loadAccount(destination);
|
|
28118
28423
|
case 21:
|
|
28119
|
-
account =
|
|
28424
|
+
account = _context7.sent;
|
|
28120
28425
|
if (!(account.data_attr["config.memo_required"] === ACCOUNT_REQUIRES_MEMO)) {
|
|
28121
|
-
|
|
28426
|
+
_context7.next = 24;
|
|
28122
28427
|
break;
|
|
28123
28428
|
}
|
|
28124
28429
|
throw new errors/* AccountRequiresMemoError */.Cu("account requires memo", destination, i);
|
|
28125
28430
|
case 24:
|
|
28126
|
-
|
|
28431
|
+
_context7.next = 33;
|
|
28127
28432
|
break;
|
|
28128
28433
|
case 26:
|
|
28129
|
-
|
|
28130
|
-
|
|
28131
|
-
if (!(
|
|
28132
|
-
|
|
28434
|
+
_context7.prev = 26;
|
|
28435
|
+
_context7.t1 = _context7["catch"](18);
|
|
28436
|
+
if (!(_context7.t1 instanceof errors/* AccountRequiresMemoError */.Cu)) {
|
|
28437
|
+
_context7.next = 30;
|
|
28133
28438
|
break;
|
|
28134
28439
|
}
|
|
28135
|
-
throw
|
|
28440
|
+
throw _context7.t1;
|
|
28136
28441
|
case 30:
|
|
28137
|
-
if (
|
|
28138
|
-
|
|
28442
|
+
if (_context7.t1 instanceof errors/* NotFoundError */.m_) {
|
|
28443
|
+
_context7.next = 32;
|
|
28139
28444
|
break;
|
|
28140
28445
|
}
|
|
28141
|
-
throw
|
|
28446
|
+
throw _context7.t1;
|
|
28142
28447
|
case 32:
|
|
28143
|
-
return
|
|
28448
|
+
return _context7.abrupt("continue", 33);
|
|
28144
28449
|
case 33:
|
|
28145
|
-
i
|
|
28146
|
-
|
|
28450
|
+
i += 1;
|
|
28451
|
+
_context7.next = 5;
|
|
28147
28452
|
break;
|
|
28148
28453
|
case 36:
|
|
28149
28454
|
case "end":
|
|
28150
|
-
return
|
|
28455
|
+
return _context7.stop();
|
|
28151
28456
|
}
|
|
28152
|
-
},
|
|
28457
|
+
}, _callee7, this, [[18, 26]]);
|
|
28153
28458
|
}));
|
|
28154
|
-
function checkMemoRequired(
|
|
28459
|
+
function checkMemoRequired(_x5) {
|
|
28155
28460
|
return _checkMemoRequired.apply(this, arguments);
|
|
28156
28461
|
}
|
|
28157
28462
|
return checkMemoRequired;
|
|
@@ -28201,7 +28506,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
28201
28506
|
/* harmony import */ var _friendbot__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(8242);
|
|
28202
28507
|
/* harmony import */ var _horizon__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(2731);
|
|
28203
28508
|
/* harmony import */ var _rpc__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(1660);
|
|
28204
|
-
/* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(
|
|
28509
|
+
/* harmony import */ var _contract__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(6299);
|
|
28205
28510
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(356);
|
|
28206
28511
|
/* harmony import */ var _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_stellar_stellar_base__WEBPACK_IMPORTED_MODULE_10__);
|
|
28207
28512
|
/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
@@ -28345,7 +28650,7 @@ function parseRawSendTransaction(r) {
|
|
|
28345
28650
|
diagnosticEventsXdr = r.diagnosticEventsXdr;
|
|
28346
28651
|
delete r.errorResultXdr;
|
|
28347
28652
|
delete r.diagnosticEventsXdr;
|
|
28348
|
-
if (
|
|
28653
|
+
if (errorResultXdr) {
|
|
28349
28654
|
return _objectSpread(_objectSpread(_objectSpread({}, r), diagnosticEventsXdr !== undefined && diagnosticEventsXdr.length > 0 && {
|
|
28350
28655
|
diagnosticEvents: diagnosticEventsXdr.map(function (evt) {
|
|
28351
28656
|
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
|
|
@@ -28392,27 +28697,6 @@ function parseRawLedgerEntries(raw) {
|
|
|
28392
28697
|
})
|
|
28393
28698
|
};
|
|
28394
28699
|
}
|
|
28395
|
-
function parseRawSimulation(sim) {
|
|
28396
|
-
var _sim$events$map, _sim$events;
|
|
28397
|
-
var looksRaw = _api__WEBPACK_IMPORTED_MODULE_1__/* .Api */ .j.isSimulationRaw(sim);
|
|
28398
|
-
if (!looksRaw) {
|
|
28399
|
-
return sim;
|
|
28400
|
-
}
|
|
28401
|
-
var base = {
|
|
28402
|
-
_parsed: true,
|
|
28403
|
-
id: sim.id,
|
|
28404
|
-
latestLedger: sim.latestLedger,
|
|
28405
|
-
events: (_sim$events$map = (_sim$events = sim.events) === null || _sim$events === void 0 ? void 0 : _sim$events.map(function (evt) {
|
|
28406
|
-
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.DiagnosticEvent.fromXDR(evt, 'base64');
|
|
28407
|
-
})) !== null && _sim$events$map !== void 0 ? _sim$events$map : []
|
|
28408
|
-
};
|
|
28409
|
-
if (typeof sim.error === 'string') {
|
|
28410
|
-
return _objectSpread(_objectSpread({}, base), {}, {
|
|
28411
|
-
error: sim.error
|
|
28412
|
-
});
|
|
28413
|
-
}
|
|
28414
|
-
return parseSuccessful(sim, base);
|
|
28415
|
-
}
|
|
28416
28700
|
function parseSuccessful(sim, partial) {
|
|
28417
28701
|
var _sim$results$length, _sim$results, _sim$stateChanges$len, _sim$stateChanges, _sim$stateChanges2;
|
|
28418
28702
|
var success = _objectSpread(_objectSpread(_objectSpread({}, partial), {}, {
|
|
@@ -28426,7 +28710,7 @@ function parseSuccessful(sim, partial) {
|
|
|
28426
28710
|
auth: ((_row$auth = row.auth) !== null && _row$auth !== void 0 ? _row$auth : []).map(function (entry) {
|
|
28427
28711
|
return _stellar_stellar_base__WEBPACK_IMPORTED_MODULE_0__.xdr.SorobanAuthorizationEntry.fromXDR(entry, 'base64');
|
|
28428
28712
|
}),
|
|
28429
|
-
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()
|
|
28430
28714
|
};
|
|
28431
28715
|
})[0]
|
|
28432
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) && {
|
|
@@ -28449,6 +28733,27 @@ function parseSuccessful(sim, partial) {
|
|
|
28449
28733
|
}
|
|
28450
28734
|
});
|
|
28451
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
|
+
}
|
|
28452
28757
|
|
|
28453
28758
|
/***/ }),
|
|
28454
28759
|
|
|
@@ -28478,6 +28783,9 @@ function _regeneratorRuntime() { "use strict"; _regeneratorRuntime = function _r
|
|
|
28478
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); }
|
|
28479
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); }); }; }
|
|
28480
28785
|
|
|
28786
|
+
function jsonrpc_hasOwnProperty(obj, prop) {
|
|
28787
|
+
return obj.hasOwnProperty(prop);
|
|
28788
|
+
}
|
|
28481
28789
|
function postObject(_x, _x2) {
|
|
28482
28790
|
return _postObject.apply(this, arguments);
|
|
28483
28791
|
}
|
|
@@ -28515,9 +28823,6 @@ function _postObject() {
|
|
|
28515
28823
|
}));
|
|
28516
28824
|
return _postObject.apply(this, arguments);
|
|
28517
28825
|
}
|
|
28518
|
-
function jsonrpc_hasOwnProperty(obj, prop) {
|
|
28519
|
-
return obj.hasOwnProperty(prop);
|
|
28520
|
-
}
|
|
28521
28826
|
// EXTERNAL MODULE: ./src/rpc/api.ts
|
|
28522
28827
|
var api = __webpack_require__(4076);
|
|
28523
28828
|
// EXTERNAL MODULE: ./src/rpc/transaction.ts
|
|
@@ -28527,9 +28832,6 @@ var parsers = __webpack_require__(784);
|
|
|
28527
28832
|
;// CONCATENATED MODULE: ./src/rpc/server.ts
|
|
28528
28833
|
/* provided dependency */ var Buffer = __webpack_require__(8287)["Buffer"];
|
|
28529
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); }
|
|
28530
|
-
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; } } }; }
|
|
28531
|
-
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; } }
|
|
28532
|
-
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; }
|
|
28533
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; }
|
|
28534
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; }
|
|
28535
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; }
|
|
@@ -28554,12 +28856,37 @@ var Durability = function (Durability) {
|
|
|
28554
28856
|
Durability["Persistent"] = "persistent";
|
|
28555
28857
|
return Durability;
|
|
28556
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
|
+
}
|
|
28557
28884
|
var Server = function () {
|
|
28558
28885
|
function Server(serverURL) {
|
|
28559
28886
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28560
28887
|
_classCallCheck(this, Server);
|
|
28561
28888
|
this.serverURL = URI_default()(serverURL);
|
|
28562
|
-
if (opts.headers && Object.keys(opts.headers).length
|
|
28889
|
+
if (opts.headers && Object.keys(opts.headers).length !== 0) {
|
|
28563
28890
|
axios/* default */.Ay.interceptors.request.use(function (config) {
|
|
28564
28891
|
config.headers = Object.assign(config.headers, opts.headers);
|
|
28565
28892
|
return config;
|
|
@@ -28952,11 +29279,8 @@ var Server = function () {
|
|
|
28952
29279
|
return server_regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
28953
29280
|
while (1) switch (_context12.prev = _context12.next) {
|
|
28954
29281
|
case 0:
|
|
28955
|
-
_context12.
|
|
28956
|
-
|
|
28957
|
-
case 2:
|
|
28958
|
-
return _context12.abrupt("return", _context12.sent);
|
|
28959
|
-
case 3:
|
|
29282
|
+
return _context12.abrupt("return", postObject(this.serverURL.toString(), 'getNetwork'));
|
|
29283
|
+
case 1:
|
|
28960
29284
|
case "end":
|
|
28961
29285
|
return _context12.stop();
|
|
28962
29286
|
}
|
|
@@ -29046,7 +29370,7 @@ var Server = function () {
|
|
|
29046
29370
|
_context16.next = 5;
|
|
29047
29371
|
break;
|
|
29048
29372
|
}
|
|
29049
|
-
throw simResponse.error;
|
|
29373
|
+
throw new Error(simResponse.error);
|
|
29050
29374
|
case 5:
|
|
29051
29375
|
return _context16.abrupt("return", (0,transaction/* assembleTransaction */.X)(tx, simResponse).build());
|
|
29052
29376
|
case 6:
|
|
@@ -29159,54 +29483,27 @@ var Server = function () {
|
|
|
29159
29483
|
}
|
|
29160
29484
|
return requestAirdrop;
|
|
29161
29485
|
}())
|
|
29162
|
-
}
|
|
29163
|
-
|
|
29164
|
-
function
|
|
29165
|
-
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
operations = meta.value().operations();
|
|
29174
|
-
break;
|
|
29175
|
-
default:
|
|
29176
|
-
throw new Error('Unexpected transaction meta switch value');
|
|
29177
|
-
}
|
|
29178
|
-
var _iterator = _createForOfIteratorHelper(operations),
|
|
29179
|
-
_step;
|
|
29180
|
-
try {
|
|
29181
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
29182
|
-
var op = _step.value;
|
|
29183
|
-
var _iterator2 = _createForOfIteratorHelper(op.changes()),
|
|
29184
|
-
_step2;
|
|
29185
|
-
try {
|
|
29186
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
29187
|
-
var c = _step2.value;
|
|
29188
|
-
if (c.switch() !== lib.xdr.LedgerEntryChangeType.ledgerEntryCreated()) {
|
|
29189
|
-
continue;
|
|
29190
|
-
}
|
|
29191
|
-
var data = c.created().data();
|
|
29192
|
-
if (data.switch() !== lib.xdr.LedgerEntryType.account()) {
|
|
29193
|
-
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();
|
|
29194
29497
|
}
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29198
|
-
|
|
29199
|
-
} finally {
|
|
29200
|
-
_iterator2.f();
|
|
29498
|
+
}, _callee20, this);
|
|
29499
|
+
}));
|
|
29500
|
+
function getFeeStats() {
|
|
29501
|
+
return _getFeeStats.apply(this, arguments);
|
|
29201
29502
|
}
|
|
29202
|
-
|
|
29203
|
-
|
|
29204
|
-
|
|
29205
|
-
|
|
29206
|
-
_iterator.f();
|
|
29207
|
-
}
|
|
29208
|
-
throw new Error('No account created in transaction');
|
|
29209
|
-
}
|
|
29503
|
+
return getFeeStats;
|
|
29504
|
+
}())
|
|
29505
|
+
}]);
|
|
29506
|
+
}();
|
|
29210
29507
|
|
|
29211
29508
|
/***/ }),
|
|
29212
29509
|
|
|
@@ -29224,8 +29521,20 @@ function findCreatedAccountSequenceInTransactionMeta(meta) {
|
|
|
29224
29521
|
|
|
29225
29522
|
|
|
29226
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
|
+
}
|
|
29227
29537
|
function assembleTransaction(raw, simulation) {
|
|
29228
|
-
var _invokeOp$auth;
|
|
29229
29538
|
if ('innerTransaction' in raw) {
|
|
29230
29539
|
return assembleTransaction(raw.innerTransaction, simulation);
|
|
29231
29540
|
}
|
|
@@ -29243,33 +29552,19 @@ function assembleTransaction(raw, simulation) {
|
|
|
29243
29552
|
sorobanData: success.transactionData.build(),
|
|
29244
29553
|
networkPassphrase: raw.networkPassphrase
|
|
29245
29554
|
});
|
|
29246
|
-
|
|
29247
|
-
|
|
29248
|
-
|
|
29249
|
-
|
|
29250
|
-
|
|
29251
|
-
|
|
29252
|
-
|
|
29253
|
-
|
|
29254
|
-
|
|
29255
|
-
|
|
29256
|
-
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
|
+
}));
|
|
29257
29565
|
}
|
|
29258
29566
|
return txnBuilder;
|
|
29259
29567
|
}
|
|
29260
|
-
function isSorobanTransaction(tx) {
|
|
29261
|
-
if (tx.operations.length !== 1) {
|
|
29262
|
-
return false;
|
|
29263
|
-
}
|
|
29264
|
-
switch (tx.operations[0].type) {
|
|
29265
|
-
case 'invokeHostFunction':
|
|
29266
|
-
case 'extendFootprintTtl':
|
|
29267
|
-
case 'restoreFootprint':
|
|
29268
|
-
return true;
|
|
29269
|
-
default:
|
|
29270
|
-
return false;
|
|
29271
|
-
}
|
|
29272
|
-
}
|
|
29273
29568
|
|
|
29274
29569
|
/***/ }),
|
|
29275
29570
|
|
|
@@ -29657,7 +29952,7 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
|
|
|
29657
29952
|
try {
|
|
29658
29953
|
serverKP = lib.Keypair.fromPublicKey(serverAccountID);
|
|
29659
29954
|
} catch (err) {
|
|
29660
|
-
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));
|
|
29661
29956
|
}
|
|
29662
29957
|
var clientSigners = new Set();
|
|
29663
29958
|
var _iterator2 = _createForOfIteratorHelper(signers),
|
|
@@ -29716,7 +30011,7 @@ function verifyChallengeTxSigners(challengeTx, serverAccountID, networkPassphras
|
|
|
29716
30011
|
}
|
|
29717
30012
|
}
|
|
29718
30013
|
if (!serverSignatureFound) {
|
|
29719
|
-
throw new InvalidChallengeError("Transaction not signed by server: '"
|
|
30014
|
+
throw new InvalidChallengeError("Transaction not signed by server: '".concat(serverKP.publicKey(), "'"));
|
|
29720
30015
|
}
|
|
29721
30016
|
if (clientSigningKey && !clientSigningKeySignatureFound) {
|
|
29722
30017
|
throw new InvalidChallengeError("Transaction not signed by the source account of the 'client_domain' " + "ManageData operation");
|
|
@@ -29752,7 +30047,7 @@ function gatherTxSigners(transaction, signers) {
|
|
|
29752
30047
|
try {
|
|
29753
30048
|
keypair = lib.Keypair.fromPublicKey(signer);
|
|
29754
30049
|
} catch (err) {
|
|
29755
|
-
throw new InvalidChallengeError("Signer is not a valid address: "
|
|
30050
|
+
throw new InvalidChallengeError("Signer is not a valid address: ".concat(err.message));
|
|
29756
30051
|
}
|
|
29757
30052
|
for (var i = 0; i < txSignatures.length; i++) {
|
|
29758
30053
|
var decSig = txSignatures[i];
|
|
@@ -37955,7 +38250,10 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
37955
38250
|
if (typeof window !== 'undefined' && obj === window) {
|
|
37956
38251
|
return '{ [object Window] }';
|
|
37957
38252
|
}
|
|
37958
|
-
if (
|
|
38253
|
+
if (
|
|
38254
|
+
(typeof globalThis !== 'undefined' && obj === globalThis)
|
|
38255
|
+
|| (typeof __webpack_require__.g !== 'undefined' && obj === __webpack_require__.g)
|
|
38256
|
+
) {
|
|
37959
38257
|
return '{ [object globalThis] }';
|
|
37960
38258
|
}
|
|
37961
38259
|
if (!isDate(obj) && !isRegExp(obj)) {
|
|
@@ -38372,6 +38670,7 @@ var parseValues = function parseQueryStringValues(str, options) {
|
|
|
38372
38670
|
var obj = { __proto__: null };
|
|
38373
38671
|
|
|
38374
38672
|
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
|
38673
|
+
cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
38375
38674
|
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
|
38376
38675
|
var parts = cleanStr.split(options.delimiter, limit);
|
|
38377
38676
|
var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
|
@@ -38442,7 +38741,9 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
38442
38741
|
var root = chain[i];
|
|
38443
38742
|
|
|
38444
38743
|
if (root === '[]' && options.parseArrays) {
|
|
38445
|
-
obj = options.allowEmptyArrays && leaf === ''
|
|
38744
|
+
obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
|
|
38745
|
+
? []
|
|
38746
|
+
: [].concat(leaf);
|
|
38446
38747
|
} else {
|
|
38447
38748
|
obj = options.plainObjects ? Object.create(null) : {};
|
|
38448
38749
|
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
|
@@ -58906,7 +59207,7 @@ axios.default = axios;
|
|
|
58906
59207
|
/***/ ((module) => {
|
|
58907
59208
|
|
|
58908
59209
|
"use strict";
|
|
58909
|
-
module.exports = {"rE":"12.0
|
|
59210
|
+
module.exports = {"rE":"12.2.0"};
|
|
58910
59211
|
|
|
58911
59212
|
/***/ })
|
|
58912
59213
|
|