@hiero-ledger/sdk 2.83.0-beta.1 → 2.83.0-beta.2
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/dist/umd.js +126 -46
- package/dist/umd.js.map +1 -1
- package/dist/umd.min.js +1 -1
- package/dist/umd.min.js.map +1 -1
- package/lib/EthereumTransactionDataEip1559.cjs +25 -8
- package/lib/EthereumTransactionDataEip1559.d.ts +20 -4
- package/lib/EthereumTransactionDataEip1559.js +1 -1
- package/lib/EthereumTransactionDataEip1559.js.map +1 -1
- package/lib/EthereumTransactionDataEip2930.cjs +25 -8
- package/lib/EthereumTransactionDataEip2930.d.ts +20 -4
- package/lib/EthereumTransactionDataEip2930.js +1 -1
- package/lib/EthereumTransactionDataEip2930.js.map +1 -1
- package/lib/EthereumTransactionDataEip7702.cjs +38 -26
- package/lib/EthereumTransactionDataEip7702.d.ts +29 -6
- package/lib/EthereumTransactionDataEip7702.js +1 -1
- package/lib/EthereumTransactionDataEip7702.js.map +1 -1
- package/lib/EthereumTransactionDataLegacy.cjs +2 -3
- package/lib/EthereumTransactionDataLegacy.js.map +1 -1
- package/lib/file/FileAppendTransaction.cjs +7 -0
- package/lib/file/FileAppendTransaction.d.ts +7 -0
- package/lib/file/FileAppendTransaction.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/EthereumTransactionDataEip1559.js +33 -8
- package/src/EthereumTransactionDataEip2930.js +33 -8
- package/src/EthereumTransactionDataEip7702.js +49 -27
- package/src/EthereumTransactionDataLegacy.js +3 -2
- package/src/file/FileAppendTransaction.js +7 -0
package/dist/umd.min.js
CHANGED
|
@@ -113,5 +113,5 @@ const _0n$4=BigInt(0),_1n$5=BigInt(1),_2n$3=BigInt(2);function isBytes(e){return
|
|
|
113
113
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
114
114
|
*
|
|
115
115
|
*/function assertBigInt(){if("undefined"==typeof BigInt)throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function concat$1(e){let t=0,n=0;for(let n=0;n<e.length;n++){t+=e[n].byteLength}const r=new Uint8Array(t);for(let t=0;t<e.length;t++){const o=e[t];r.set(new Uint8Array(o),n),n+=o.byteLength}return r.buffer}function checkBufferParams(e,t,n,r){return t instanceof Uint8Array?t.byteLength?n<0?(e.error="Wrong parameter: inputOffset less than zero",!1):r<0?(e.error="Wrong parameter: inputLength less than zero",!1):!(t.byteLength-n-r<0)||(e.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):(e.error="Wrong parameter: inputBuffer has zero length",!1):(e.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class ViewWriter{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return concat$1(this.items)}}const powers2=[new Uint8Array([1])],digitsString="0123456789",EMPTY_STRING="",EMPTY_BUFFER=new ArrayBuffer(0),EMPTY_VIEW=new Uint8Array(0),END_OF_CONTENT_NAME="EndOfContent",OCTET_STRING_NAME="OCTET STRING",BIT_STRING_NAME="BIT STRING";function HexBlock(e){var t;return(t=class extends e{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(e){this.valueHexView=new Uint8Array(e)}constructor(...e){var t;super(...e);const n=e[0]||{};this.isHexOnly=null!==(t=n.isHexOnly)&&void 0!==t&&t,this.valueHexView=n.valueHex?buildExports.BufferSourceConverter.toUint8Array(n.valueHex):EMPTY_VIEW}fromBER(e,t,n){const r=e instanceof ArrayBuffer?new Uint8Array(e):e;if(!checkBufferParams(this,r,t,n))return-1;const o=t+n;return this.valueHexView=r.subarray(t,o),this.valueHexView.length?(this.blockLength=n,o):(this.warnings.push("Zero buffer length"),t)}toBER(e=!1){return this.isHexOnly?e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",EMPTY_BUFFER)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:buildExports.Convert.ToHex(this.valueHexView)}}}).NAME="hexBlock",t}class LocalBaseBlock{static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}constructor({blockLength:e=0,error:t=EMPTY_STRING,warnings:n=[],valueBeforeDecode:r=EMPTY_VIEW}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=buildExports.BufferSourceConverter.toUint8Array(r)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:buildExports.Convert.ToHex(this.valueBeforeDecodeView)}}}LocalBaseBlock.NAME="baseBlock";class ValueBlock extends LocalBaseBlock{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}ValueBlock.NAME="valueBlock";class LocalIdentificationBlock extends(HexBlock(LocalBaseBlock)){constructor({idBlock:e={}}={}){var t,n,r,o;super(),e?(this.isHexOnly=null!==(t=e.isHexOnly)&&void 0!==t&&t,this.valueHexView=e.valueHex?buildExports.BufferSourceConverter.toUint8Array(e.valueHex):EMPTY_VIEW,this.tagClass=null!==(n=e.tagClass)&&void 0!==n?n:-1,this.tagNumber=null!==(r=e.tagNumber)&&void 0!==r?r:-1,this.isConstructed=null!==(o=e.isConstructed)&&void 0!==o&&o):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",EMPTY_BUFFER}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const n=new Uint8Array(1);if(!e){let e=this.tagNumber;e&=31,t|=e,n[0]=t}return n.buffer}if(!this.isHexOnly){const n=utilToBase(this.tagNumber,7),r=new Uint8Array(n),o=n.byteLength,a=new Uint8Array(o+1);if(a[0]=31|t,!e){for(let e=0;e<o-1;e++)a[e+1]=128|r[e];a[o]=r[o-1]}return a.buffer}const n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=31|t,!e){const e=this.valueHexView;for(let t=0;t<e.length-1;t++)n[t+1]=128|e[t];n[this.valueHexView.byteLength]=e[e.length-1]}return n.buffer}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);if(0===o.length)return this.error="Zero buffer length",-1;switch(192&o[0]){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=!(32&~o[0]),this.isHexOnly=!1;const a=31&o[0];if(31!==a)this.tagNumber=a,this.blockLength=1;else{let e=1,t=this.valueHexView=new Uint8Array(255),n=255;for(;128&o[e];){if(t[e-1]=127&o[e],e++,e>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(e===n){n+=255;const e=new Uint8Array(n);for(let n=0;n<t.length;n++)e[n]=t[n];t=this.valueHexView=new Uint8Array(n)}}this.blockLength=e+1,t[e-1]=127&o[e];const r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=t[n];t=this.valueHexView=new Uint8Array(e),t.set(r),this.blockLength<=9?this.tagNumber=utilFromBase(t,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(1===this.tagClass&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}}LocalIdentificationBlock.NAME="identificationBlock";class LocalLengthBlock extends LocalBaseBlock{constructor({lenBlock:e={}}={}){var t,n,r;super(),this.isIndefiniteForm=null!==(t=e.isIndefiniteForm)&&void 0!==t&&t,this.longFormUsed=null!==(n=e.longFormUsed)&&void 0!==n&&n,this.length=null!==(r=e.length)&&void 0!==r?r:0}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);if(0===o.length)return this.error="Zero buffer length",-1;if(255===o[0])return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=128===o[0],this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(128&o[0]),!1===this.longFormUsed)return this.length=o[0],this.blockLength=1,t+this.blockLength;const a=127&o[0];if(a>8)return this.error="Too big integer",-1;if(a+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const i=t+1,s=r.subarray(i,i+a);return 0===s[a-1]&&this.warnings.push("Needlessly long encoded length"),this.length=utilFromBase(s,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){const r=utilToBase(this.length,8);if(r.byteLength>127)return this.error="Too big length",EMPTY_BUFFER;if(t=new ArrayBuffer(r.byteLength+1),e)return t;const o=new Uint8Array(r);n=new Uint8Array(t),n[0]=128|r.byteLength;for(let e=0;e<r.byteLength;e++)n[e+1]=o[e];return t}return t=new ArrayBuffer(1),!1===e&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}}LocalLengthBlock.NAME="lengthBlock";const typeStore={};class BaseBlock extends LocalBaseBlock{constructor({name:e=EMPTY_STRING,optional:t=!1,primitiveSchema:n,...r}={},o){super(r),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new LocalIdentificationBlock(r),this.lenBlock=new LocalLengthBlock(r),this.valueBlock=o?new o(r):new ValueBlock(r)}fromBER(e,t,n){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}toBER(e,t){const n=t||new ViewWriter;t||prepareIndefiniteForm(this);const r=this.idBlock.toBER(e);if(n.write(r),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{const t=this.valueBlock.toBER(e);this.lenBlock.length=t.byteLength;const r=this.lenBlock.toBER(e);n.write(r),n.write(t)}return t?EMPTY_BUFFER:n.final()}toJSON(){const e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return"ascii"===e?this.onAsciiEncoding():buildExports.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${buildExports.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;return isEqualBuffer(this.toBER(),e.toBER())}}function prepareIndefiniteForm(e){var t;if(e instanceof typeStore.Constructed)for(const t of e.valueBlock.value)prepareIndefiniteForm(t)&&(e.lenBlock.isIndefiniteForm=!0);return!!(null===(t=e.lenBlock)||void 0===t?void 0:t.isIndefiniteForm)}BaseBlock.NAME="BaseBlock";class BaseStringBlock extends BaseBlock{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor({value:e=EMPTY_STRING,...t}={},n){super(t,n),e&&this.fromString(e)}fromBER(e,t,n){const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}BaseStringBlock.NAME="BaseStringBlock";class LocalPrimitiveValueBlock extends(HexBlock(ValueBlock)){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}}var _a$w,_a$v,_a$u,_a$t,_a$s;LocalPrimitiveValueBlock.NAME="PrimitiveValueBlock";class Primitive extends BaseBlock{constructor(e={}){super(e,LocalPrimitiveValueBlock),this.idBlock.isConstructed=!1}}function localChangeType(e,t){if(e instanceof t)return e;const n=new t;return n.idBlock=e.idBlock,n.lenBlock=e.lenBlock,n.warnings=e.warnings,n.valueBeforeDecodeView=e.valueBeforeDecodeView,n}function localFromBER(e,t=0,n=e.length){const r=t;let o=new BaseBlock({},ValueBlock);const a=new LocalBaseBlock;if(!checkBufferParams(a,e,t,n))return o.error=a.error,{offset:-1,result:o};if(!e.subarray(t,t+n).length)return o.error="Zero buffer length",{offset:-1,result:o};let i=o.idBlock.fromBER(e,t,n);if(o.idBlock.warnings.length&&o.warnings.concat(o.idBlock.warnings),-1===i)return o.error=o.idBlock.error,{offset:-1,result:o};if(t=i,n-=o.idBlock.blockLength,i=o.lenBlock.fromBER(e,t,n),o.lenBlock.warnings.length&&o.warnings.concat(o.lenBlock.warnings),-1===i)return o.error=o.lenBlock.error,{offset:-1,result:o};if(t=i,n-=o.lenBlock.blockLength,!o.idBlock.isConstructed&&o.lenBlock.isIndefiniteForm)return o.error="Indefinite length form used for primitive encoding form",{offset:-1,result:o};let s=BaseBlock;if(1===o.idBlock.tagClass){if(o.idBlock.tagNumber>=37&&!1===o.idBlock.isHexOnly)return o.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:o};switch(o.idBlock.tagNumber){case 0:if(o.idBlock.isConstructed&&o.lenBlock.length>0)return o.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:o};s=typeStore.EndOfContent;break;case 1:s=typeStore.Boolean;break;case 2:s=typeStore.Integer;break;case 3:s=typeStore.BitString;break;case 4:s=typeStore.OctetString;break;case 5:s=typeStore.Null;break;case 6:s=typeStore.ObjectIdentifier;break;case 10:s=typeStore.Enumerated;break;case 12:s=typeStore.Utf8String;break;case 13:s=typeStore.RelativeObjectIdentifier;break;case 14:s=typeStore.TIME;break;case 15:return o.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:o};case 16:s=typeStore.Sequence;break;case 17:s=typeStore.Set;break;case 18:s=typeStore.NumericString;break;case 19:s=typeStore.PrintableString;break;case 20:s=typeStore.TeletexString;break;case 21:s=typeStore.VideotexString;break;case 22:s=typeStore.IA5String;break;case 23:s=typeStore.UTCTime;break;case 24:s=typeStore.GeneralizedTime;break;case 25:s=typeStore.GraphicString;break;case 26:s=typeStore.VisibleString;break;case 27:s=typeStore.GeneralString;break;case 28:s=typeStore.UniversalString;break;case 29:s=typeStore.CharacterString;break;case 30:s=typeStore.BmpString;break;case 31:s=typeStore.DATE;break;case 32:s=typeStore.TimeOfDay;break;case 33:s=typeStore.DateTime;break;case 34:s=typeStore.Duration;break;default:{const e=o.idBlock.isConstructed?new typeStore.Constructed:new typeStore.Primitive;e.idBlock=o.idBlock,e.lenBlock=o.lenBlock,e.warnings=o.warnings,o=e}}}else s=o.idBlock.isConstructed?typeStore.Constructed:typeStore.Primitive;return o=localChangeType(o,s),i=o.fromBER(e,t,o.lenBlock.isIndefiniteForm?n:o.lenBlock.length),o.valueBeforeDecodeView=e.subarray(r,r+o.blockLength),{offset:i,result:o}}function fromBER(e){if(!e.byteLength){const e=new BaseBlock({},ValueBlock);return e.error="Input buffer has zero length",{offset:-1,result:e}}return localFromBER(buildExports.BufferSourceConverter.toUint8Array(e).slice(),0,e.byteLength)}function checkLen(e,t){return e?1:t}_a$w=Primitive,typeStore.Primitive=_a$w,Primitive.NAME="PRIMITIVE";class LocalConstructedValueBlock extends ValueBlock{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;if(this.valueBeforeDecodeView=r.subarray(t,t+n),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),t;let o=t;for(;checkLen(this.isIndefiniteForm,n)>0;){const e=localFromBER(r,o,n);if(-1===e.offset)return this.error=e.result.error,this.warnings.concat(e.result.warnings),-1;if(o=e.offset,this.blockLength+=e.result.blockLength,n-=e.result.blockLength,this.value.push(e.result),this.isIndefiniteForm&&e.result.constructor.NAME===END_OF_CONTENT_NAME)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===END_OF_CONTENT_NAME?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,t){const n=t||new ViewWriter;for(let t=0;t<this.value.length;t++)this.value[t].toBER(e,n);return t?EMPTY_BUFFER:n.final()}toJSON(){const e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(const t of this.value)e.value.push(t.toJSON());return e}}LocalConstructedValueBlock.NAME="ConstructedValueBlock";class Constructed extends BaseBlock{constructor(e={}){super(e,LocalConstructedValueBlock),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const r=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return-1===r?(this.error=this.valueBlock.error,r):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),r)}onAsciiEncoding(){const e=[];for(const t of this.valueBlock.value)e.push(t.toString("ascii").split("\n").map(e=>` ${e}`).join("\n"));const t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :\n${e.join("\n")}`:`${t} :`}}_a$v=Constructed,typeStore.Constructed=_a$v,Constructed.NAME="CONSTRUCTED";class LocalEndOfContentValueBlock extends ValueBlock{fromBER(e,t,n){return t}toBER(e){return EMPTY_BUFFER}}LocalEndOfContentValueBlock.override="EndOfContentValueBlock";class EndOfContent extends BaseBlock{constructor(e={}){super(e,LocalEndOfContentValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}_a$u=EndOfContent,typeStore.EndOfContent=_a$u,EndOfContent.NAME=END_OF_CONTENT_NAME;class Null extends BaseBlock{constructor(e={}){super(e,ValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){const n=new ArrayBuffer(2);if(!e){const e=new Uint8Array(n);e[0]=5,e[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}}_a$t=Null,typeStore.Null=_a$t,Null.NAME="NULL";class LocalBooleanValueBlock extends(HexBlock(ValueBlock)){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=buildExports.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,n){const r=buildExports.BufferSourceConverter.toUint8Array(e);return checkBufferParams(this,r,t,n)?(this.valueHexView=r.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,utilDecodeTC.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}LocalBooleanValueBlock.NAME="BooleanValueBlock";let Boolean$1=class extends BaseBlock{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,LocalBooleanValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};_a$s=Boolean$1,typeStore.Boolean=_a$s,Boolean$1.NAME="BOOLEAN";class LocalOctetStringValueBlock extends(HexBlock(LocalConstructedValueBlock)){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,n){let r=0;if(this.isConstructed){if(this.isHexOnly=!1,r=LocalConstructedValueBlock.prototype.fromBER.call(this,e,t,n),-1===r)return r;for(let e=0;e<this.value.length;e++){const t=this.value[e].constructor.NAME;if(t===END_OF_CONTENT_NAME){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(t!==OCTET_STRING_NAME)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,r=super.fromBER(e,t,n),this.blockLength=n;return r}toBER(e,t){return this.isConstructed?LocalConstructedValueBlock.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}var _a$r,_a$q,_a$p,_a$o,_a$n,_a$m,_a$l,_a$k,_a$j;LocalOctetStringValueBlock.NAME="OctetStringValueBlock";class OctetString extends BaseBlock{constructor({idBlock:e={},lenBlock:t={},...n}={}){var r,o;null!==(r=n.isConstructed)&&void 0!==r||(n.isConstructed=!!(null===(o=n.value)||void 0===o?void 0:o.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},LocalOctetStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,0===n)return 0===this.idBlock.error.length&&(this.blockLength+=this.idBlock.blockLength),0===this.lenBlock.error.length&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const r=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(r.byteLength){const e=localFromBER(r,0,r.byteLength);-1!==e.offset&&e.offset===n&&(this.valueBlock.value=[e.result])}}catch{}}return super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);return`${this.constructor.NAME} : ${buildExports.Convert.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof _a$r&&e.push(t.valueBlock.valueHexView);return buildExports.BufferSourceConverter.concat(e)}}_a$r=OctetString,typeStore.OctetString=_a$r,OctetString.NAME=OCTET_STRING_NAME;class LocalBitStringValueBlock extends(HexBlock(LocalConstructedValueBlock)){constructor({unusedBits:e=0,isConstructed:t=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let r=-1;if(this.isConstructed){if(r=LocalConstructedValueBlock.prototype.fromBER.call(this,e,t,n),-1===r)return r;for(const e of this.value){const t=e.constructor.NAME;if(t===END_OF_CONTENT_NAME){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(t!==BIT_STRING_NAME)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const n=e.valueBlock;if(this.unusedBits>0&&n.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=n.unusedBits}return r}const o=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,o,t,n))return-1;const a=o.subarray(t,t+n);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const e=a.subarray(1);try{if(e.byteLength){const t=localFromBER(e,0,e.byteLength);-1!==t.offset&&t.offset===n-1&&(this.value=[t.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+n}toBER(e,t){if(this.isConstructed)return LocalConstructedValueBlock.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return EMPTY_BUFFER;const n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}LocalBitStringValueBlock.NAME="BitStringValueBlock";class BitString extends BaseBlock{constructor({idBlock:e={},lenBlock:t={},...n}={}){var r,o;null!==(r=n.isConstructed)&&void 0!==r||(n.isConstructed=!!(null===(o=n.value)||void 0===o?void 0:o.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},LocalBitStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const n of t)e.push(n.toString(2).padStart(8,"0"));const n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}}function viewAdd(e,t){const n=new Uint8Array([0]),r=new Uint8Array(e),o=new Uint8Array(t);let a=r.slice(0);const i=a.length-1,s=o.slice(0),c=s.length-1;let u=0;let l=0;for(let e=c<i?i:c;e>=0;e--,l++){if(!0==l<s.length)u=a[i-l]+s[c-l]+n[0];else u=a[i-l]+n[0];if(n[0]=u/10,!0==l>=a.length)a=utilConcatView(new Uint8Array([u%10]),a);else a[i-l]=u%10}return n[0]>0&&(a=utilConcatView(n,a)),a}function power2(e){if(e>=powers2.length)for(let t=powers2.length;t<=e;t++){const e=new Uint8Array([0]);let n=powers2[t-1].slice(0);for(let t=n.length-1;t>=0;t--){const r=new Uint8Array([(n[t]<<1)+e[0]]);e[0]=r[0]/10,n[t]=r[0]%10}e[0]>0&&(n=utilConcatView(e,n)),powers2.push(n)}return powers2[e]}function viewSub(e,t){let n=0;const r=new Uint8Array(e),o=new Uint8Array(t),a=r.slice(0),i=a.length-1,s=o.slice(0),c=s.length-1;let u,l=0;for(let e=c;e>=0;e--,l++)if(u=a[i-l]-s[c-l]-n,!0==u<0)n=1,a[i-l]=u+10;else n=0,a[i-l]=u;if(n>0)for(let e=i-c+1;e>=0;e--,l++){if(u=a[i-l]-n,!(u<0)){n=0,a[i-l]=u;break}n=1,a[i-l]=u+10}return a.slice()}_a$q=BitString,typeStore.BitString=_a$q,BitString.NAME=BIT_STRING_NAME;class LocalIntegerValueBlock extends(HexBlock(ValueBlock)){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=utilDecodeTC.call(this)))}constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),void 0!==e&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(utilEncodeTC(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,r=0){const o=this.fromBER(e,t,n);if(-1===o)return o;const a=this.valueHexView;return 0===a[0]&&128&a[1]?this.valueHexView=a.subarray(1):0!==r&&a.length<r&&(r-a.length>1&&(r=a.length+1),this.valueHexView=a.subarray(r-a.length)),o}toDER(e=!1){const t=this.valueHexView;switch(!0){case!!(128&t[0]):{const e=new Uint8Array(this.valueHexView.length+1);e[0]=0,e.set(t,1),this.valueHexView=e}break;case 0===t[0]&&!(128&t[1]):this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(e)}fromBER(e,t,n){const r=super.fromBER(e,t,n);return-1===r||this.setValueHex(),r}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=8*this.valueHexView.length-1;let t,n=new Uint8Array(8*this.valueHexView.length/3),r=0;const o=this.valueHexView;let a="",i=!1;for(let i=o.byteLength-1;i>=0;i--){t=o[i];for(let o=0;o<8;o++){if(!(1&~t))if(r===e)n=viewSub(power2(r),n),a="-";else n=viewAdd(n,power2(r));r++,t>>=1}}for(let e=0;e<n.length;e++)n[e]&&(i=!0),i&&(a+=digitsString.charAt(n[e]));return!1===i&&(a+=digitsString.charAt(0)),a}}_a$p=LocalIntegerValueBlock,LocalIntegerValueBlock.NAME="IntegerValueBlock",Object.defineProperty(_a$p.prototype,"valueHex",{set:function(e){this.valueHexView=new Uint8Array(e),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});class Integer extends BaseBlock{constructor(e={}){super(e,LocalIntegerValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return assertBigInt(),BigInt(this.valueBlock.toString())}static fromBigInt(e){assertBigInt();const t=BigInt(e),n=new ViewWriter,r=t.toString(16).replace(/^-/,""),o=new Uint8Array(buildExports.Convert.FromHex(r));if(t<0){const e=new Uint8Array(o.length+(128&o[0]?1:0));e[0]|=128;const r=BigInt(`0x${buildExports.Convert.ToHex(e)}`)+t,a=buildExports.BufferSourceConverter.toUint8Array(buildExports.Convert.FromHex(r.toString(16)));a[0]|=128,n.write(a)}else 128&o[0]&&n.write(new Uint8Array([0])),n.write(o);return new _a$o({valueHex:n.final()})}convertToDER(){const e=new _a$o({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new _a$o({valueHex:0===this.valueBlock.valueHexView[0]?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}_a$o=Integer,typeStore.Integer=_a$o,Integer.NAME="INTEGER";class Enumerated extends Integer{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}_a$n=Enumerated,typeStore.Enumerated=_a$n,Enumerated.NAME="ENUMERATED";class LocalSidValueBlock extends(HexBlock(ValueBlock)){constructor({valueDec:e=-1,isFirstSid:t=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let e=0;e<n&&(this.valueHexView[e]=127&o[e],this.blockLength++,128&o[e]);e++);const a=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength;e++)a[e]=this.valueHexView[e];return this.valueHexView=a,128&o[this.blockLength-1]?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=utilFromBase(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){assertBigInt();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const n=new Uint8Array(t.length/7);for(let e=0;e<n.length;e++)n[e]=parseInt(t.slice(7*e,7*e+7),2)+(e+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const t=this.valueHexView,n=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength-1;e++)n[e]=128|t[e];return n[this.blockLength-1]=t[this.blockLength-1],n.buffer}const t=utilToBase(this.valueDec,7);if(0===t.byteLength)return this.error="Error during encoding SID value",EMPTY_BUFFER;const n=new Uint8Array(t.byteLength);if(!e){const e=new Uint8Array(t),r=t.byteLength-1;for(let t=0;t<r;t++)n[t]=128|e[t];n[r]=e[r]}return n}toString(){let e="";if(this.isHexOnly)e=buildExports.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}LocalSidValueBlock.NAME="sidBlock";class LocalObjectIdentifierValueBlock extends ValueBlock{constructor({value:e=EMPTY_STRING,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let r=t;for(;n>0;){const t=new LocalSidValueBlock;if(r=t.fromBER(e,r,n),-1===r)return this.blockLength=0,this.error=t.error,r;0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,n-=t.blockLength,this.value.push(t)}return r}toBER(e){const t=[];for(let n=0;n<this.value.length;n++){const r=this.value[n].toBER(e);if(0===r.byteLength)return this.error=this.value[n].error,EMPTY_BUFFER;t.push(r)}return concat$1(t)}fromString(e){this.value=[];let t=0,n=0,r="",o=!1;do{if(n=e.indexOf(".",t),r=-1===n?e.substring(t):e.substring(t,n),t=n+1,o){const e=this.value[0];let t=0;switch(e.valueDec){case 0:break;case 1:t=40;break;case 2:t=80;break;default:return void(this.value=[])}const n=parseInt(r,10);if(isNaN(n))return;e.valueDec=n+t,o=!1}else{const e=new LocalSidValueBlock;if(r>Number.MAX_SAFE_INTEGER){assertBigInt();const t=BigInt(r);e.valueBigInt=t}else if(e.valueDec=parseInt(r,10),isNaN(e.valueDec))return;this.value.length||(e.isFirstSid=!0,o=!0),this.value.push(e)}}while(-1!==n)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let r=this.value[n].toString();0!==n&&(e=`${e}.`),t?(r=`{${r}}`,this.value[n].isFirstSid?e=`2.{${r} - 80}`:e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}LocalObjectIdentifierValueBlock.NAME="ObjectIdentifierValueBlock";class ObjectIdentifier extends BaseBlock{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,LocalObjectIdentifierValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}_a$m=ObjectIdentifier,typeStore.ObjectIdentifier=_a$m,ObjectIdentifier.NAME="OBJECT IDENTIFIER";class LocalRelativeSidValueBlock extends(HexBlock(LocalBaseBlock)){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,n){if(0===n)return t;const r=buildExports.BufferSourceConverter.toUint8Array(e);if(!checkBufferParams(this,r,t,n))return-1;const o=r.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let e=0;e<n&&(this.valueHexView[e]=127&o[e],this.blockLength++,128&o[e]);e++);const a=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength;e++)a[e]=this.valueHexView[e];return this.valueHexView=a,128&o[this.blockLength-1]?(this.error="End of input reached before message was fully decoded",-1):(0===this.valueHexView[0]&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=utilFromBase(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const t=this.valueHexView,n=new Uint8Array(this.blockLength);for(let e=0;e<this.blockLength-1;e++)n[e]=128|t[e];return n[this.blockLength-1]=t[this.blockLength-1],n.buffer}const t=utilToBase(this.valueDec,7);if(0===t.byteLength)return this.error="Error during encoding SID value",EMPTY_BUFFER;const n=new Uint8Array(t.byteLength);if(!e){const e=new Uint8Array(t),r=t.byteLength-1;for(let t=0;t<r;t++)n[t]=128|e[t];n[r]=e[r]}return n.buffer}toString(){let e="";return e=this.isHexOnly?buildExports.Convert.ToHex(this.valueHexView):this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}LocalRelativeSidValueBlock.NAME="relativeSidBlock";class LocalRelativeObjectIdentifierValueBlock extends ValueBlock{constructor({value:e=EMPTY_STRING,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let r=t;for(;n>0;){const t=new LocalRelativeSidValueBlock;if(r=t.fromBER(e,r,n),-1===r)return this.blockLength=0,this.error=t.error,r;this.blockLength+=t.blockLength,n-=t.blockLength,this.value.push(t)}return r}toBER(e,t){const n=[];for(let t=0;t<this.value.length;t++){const r=this.value[t].toBER(e);if(0===r.byteLength)return this.error=this.value[t].error,EMPTY_BUFFER;n.push(r)}return concat$1(n)}fromString(e){this.value=[];let t=0,n=0,r="";do{n=e.indexOf(".",t),r=-1===n?e.substring(t):e.substring(t,n),t=n+1;const o=new LocalRelativeSidValueBlock;if(o.valueDec=parseInt(r,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(-1!==n);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let r=this.value[n].toString();0!==n&&(e=`${e}.`),t?(r=`{${r}}`,e+=r):e+=r}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}LocalRelativeObjectIdentifierValueBlock.NAME="RelativeObjectIdentifierValueBlock";class RelativeObjectIdentifier extends BaseBlock{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,LocalRelativeObjectIdentifierValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}_a$l=RelativeObjectIdentifier,typeStore.RelativeObjectIdentifier=_a$l,RelativeObjectIdentifier.NAME="RelativeObjectIdentifier";class Sequence extends Constructed{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}_a$k=Sequence,typeStore.Sequence=_a$k,Sequence.NAME="SEQUENCE";let Set$1=class extends Constructed{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};_a$j=Set$1,typeStore.Set=_a$j,Set$1.NAME="SET";class LocalStringValueBlock extends(HexBlock(ValueBlock)){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=EMPTY_STRING}toJSON(){return{...super.toJSON(),value:this.value}}}LocalStringValueBlock.NAME="StringValueBlock";class LocalSimpleStringValueBlock extends LocalStringValueBlock{}LocalSimpleStringValueBlock.NAME="SimpleStringValueBlock";class LocalSimpleStringBlock extends BaseStringBlock{constructor({...e}={}){super(e,LocalSimpleStringValueBlock)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,buildExports.BufferSourceConverter.toUint8Array(e))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);this.valueBlock.value=e}}LocalSimpleStringBlock.NAME="SIMPLE STRING";class LocalUtf8StringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){this.valueBlock.valueHexView=buildExports.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=buildExports.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=buildExports.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(buildExports.Convert.FromUtf8String(e)),this.valueBlock.value=e}}var _a$i,_a$h,_a$g,_a$f,_a$e,_a$d,_a$c,_a$b,_a$a,_a$9,_a$8,_a$7,_a$6,_a$5,_a$4,_a$3,_a$2,_a$1;LocalUtf8StringValueBlock.NAME="Utf8StringValueBlock";class Utf8String extends LocalUtf8StringValueBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}_a$i=Utf8String,typeStore.Utf8String=_a$i,Utf8String.NAME="UTF8String";class LocalBmpStringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){this.valueBlock.value=buildExports.Convert.ToUtf16String(e),this.valueBlock.valueHexView=buildExports.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(buildExports.Convert.FromUtf16String(e))}}LocalBmpStringValueBlock.NAME="BmpStringValueBlock";class BmpString extends LocalBmpStringValueBlock{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}_a$h=BmpString,typeStore.BmpString=_a$h,BmpString.NAME="BMPString";class LocalUniversalStringValueBlock extends LocalSimpleStringBlock{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let e=0;e<n.length;e+=4)n[e]=n[e+3],n[e+1]=n[e+2],n[e+2]=0,n[e+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(4*t);for(let r=0;r<t;r++){const t=utilToBase(e.charCodeAt(r),8),o=new Uint8Array(t);if(o.length>4)continue;const a=4-o.length;for(let e=o.length-1;e>=0;e--)n[4*r+e+a]=o[e]}this.valueBlock.value=e}}LocalUniversalStringValueBlock.NAME="UniversalStringValueBlock";class UniversalString extends LocalUniversalStringValueBlock{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}_a$g=UniversalString,typeStore.UniversalString=_a$g,UniversalString.NAME="UniversalString";class NumericString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}_a$f=NumericString,typeStore.NumericString=_a$f,NumericString.NAME="NumericString";class PrintableString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}_a$e=PrintableString,typeStore.PrintableString=_a$e,PrintableString.NAME="PrintableString";class TeletexString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}_a$d=TeletexString,typeStore.TeletexString=_a$d,TeletexString.NAME="TeletexString";class VideotexString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}_a$c=VideotexString,typeStore.VideotexString=_a$c,VideotexString.NAME="VideotexString";class IA5String extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}_a$b=IA5String,typeStore.IA5String=_a$b,IA5String.NAME="IA5String";class GraphicString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_a$a=GraphicString,typeStore.GraphicString=_a$a,GraphicString.NAME="GraphicString";class VisibleString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}_a$9=VisibleString,typeStore.VisibleString=_a$9,VisibleString.NAME="VisibleString";class GeneralString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}_a$8=GeneralString,typeStore.GeneralString=_a$8,GeneralString.NAME="GeneralString";class CharacterString extends LocalSimpleStringBlock{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}_a$7=CharacterString,typeStore.CharacterString=_a$7,CharacterString.NAME="CharacterString";class UTCTime extends VisibleString{constructor({value:e,valueDate:t,...n}={}){if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let t=0;t<e.length;t++)this.valueBlock.valueHexView[t]=e.charCodeAt(t)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,buildExports.BufferSourceConverter.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const t=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/gi.exec(e);if(null===t)return void(this.error="Wrong input string for conversion");const n=parseInt(t[1],10);this.year=n>=50?1900+n:2e3+n,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(e="iso"){if("iso"===e){const e=new Array(7);return e[0]=padNumber(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=padNumber(this.month,2),e[2]=padNumber(this.day,2),e[3]=padNumber(this.hour,2),e[4]=padNumber(this.minute,2),e[5]=padNumber(this.second,2),e[6]="Z",e.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}_a$6=UTCTime,typeStore.UTCTime=_a$6,UTCTime.NAME="UTCTime";class GeneralizedTime extends UTCTime{constructor(e={}){var t;super(e),null!==(t=this.millisecond)&&void 0!==t||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let t,n=!1,r="",o="",a=0,i=0,s=0;if("Z"===e[e.length-1])r=e.substring(0,e.length-1),n=!0;else{const t=new Number(e[e.length-1]);if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(n){if(-1!==r.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==r.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let e=1,t=r.indexOf("+"),n="";if(-1===t&&(t=r.indexOf("-"),e=-1),-1!==t){if(n=r.substring(t+1),r=r.substring(0,t),2!==n.length&&4!==n.length)throw new Error("Wrong input string for conversion");let o=parseInt(n.substring(0,2),10);if(isNaN(o.valueOf()))throw new Error("Wrong input string for conversion");if(i=e*o,4===n.length){if(o=parseInt(n.substring(2,4),10),isNaN(o.valueOf()))throw new Error("Wrong input string for conversion");s=e*o}}}let c=r.indexOf(".");if(-1===c&&(c=r.indexOf(",")),-1!==c){const e=new Number(`0${r.substring(c)}`);if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");a=e.valueOf(),o=r.substring(0,c)}else o=r;switch(!0){case 8===o.length:if(t=/(\d{4})(\d{2})(\d{2})/gi,-1!==c)throw new Error("Wrong input string for conversion");break;case 10===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*a;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*a;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===o.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){const e=1e3*a;this.millisecond=Math.floor(e)}break;default:throw new Error("Wrong input string for conversion")}const u=t.exec(o);if(null===u)throw new Error("Wrong input string for conversion");for(let e=1;e<u.length;e++)switch(e){case 1:this.year=parseInt(u[e],10);break;case 2:this.month=parseInt(u[e],10);break;case 3:this.day=parseInt(u[e],10);break;case 4:this.hour=parseInt(u[e],10)+i;break;case 5:this.minute=parseInt(u[e],10)+s;break;case 6:this.second=parseInt(u[e],10);break;default:throw new Error("Wrong input string for conversion")}if(!1===n){const e=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=e.getUTCFullYear(),this.month=e.getUTCMonth(),this.day=e.getUTCDay(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds(),this.millisecond=e.getUTCMilliseconds()}}toString(e="iso"){if("iso"===e){const e=[];return e.push(padNumber(this.year,4)),e.push(padNumber(this.month,2)),e.push(padNumber(this.day,2)),e.push(padNumber(this.hour,2)),e.push(padNumber(this.minute,2)),e.push(padNumber(this.second,2)),0!==this.millisecond&&(e.push("."),e.push(padNumber(this.millisecond,3))),e.push("Z"),e.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}_a$5=GeneralizedTime,typeStore.GeneralizedTime=_a$5,GeneralizedTime.NAME="GeneralizedTime";class DATE extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}_a$4=DATE,typeStore.DATE=_a$4,DATE.NAME="DATE";class TimeOfDay extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}_a$3=TimeOfDay,typeStore.TimeOfDay=_a$3,TimeOfDay.NAME="TimeOfDay";class DateTime extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}_a$2=DateTime,typeStore.DateTime=_a$2,DateTime.NAME="DateTime";let Duration$1=class extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};var _a;_a$1=Duration$1,typeStore.Duration=_a$1,Duration$1.NAME="Duration";class TIME extends Utf8String{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}_a=TIME,typeStore.TIME=_a,TIME.NAME="TIME";var pem={exports:{}},forge,hasRequiredForge;function requireForge(){return hasRequiredForge?forge:(hasRequiredForge=1,forge={options:{usePureJavaScript:!1}})}var util={exports:{}},baseN,hasRequiredBaseN,hasRequiredUtil,hasRequiredPem;function requireBaseN(){if(hasRequiredBaseN)return baseN;hasRequiredBaseN=1;var e={};baseN=e;var t={};return e.encode=function(e,t,n){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==n&&"number"!=typeof n)throw new TypeError('"maxline" must be a number.');var r="";if(e instanceof Uint8Array){var o=0,a=t.length,i=t.charAt(0),s=[0];for(o=0;o<e.length;++o){for(var c=0,u=e[o];c<s.length;++c)u+=s[c]<<8,s[c]=u%a,u=u/a|0;for(;u>0;)s.push(u%a),u=u/a|0}for(o=0;0===e[o]&&o<e.length-1;++o)r+=i;for(o=s.length-1;o>=0;--o)r+=t[s[o]]}else r=function(e,t){var n=0,r=t.length,o=t.charAt(0),a=[0];for(n=0;n<e.length();++n){for(var i=0,s=e.at(n);i<a.length;++i)s+=a[i]<<8,a[i]=s%r,s=s/r|0;for(;s>0;)a.push(s%r),s=s/r|0}var c="";for(n=0;0===e.at(n)&&n<e.length()-1;++n)c+=o;for(n=a.length-1;n>=0;--n)c+=t[a[n]];return c}(e,t);if(n){var l=new RegExp(".{1,"+n+"}","g");r=r.match(l).join("\r\n")}return r},e.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var r=t[n];if(!r){r=t[n]=[];for(var o=0;o<n.length;++o)r[n.charCodeAt(o)]=o}e=e.replace(/\s/g,"");var a=n.length,i=n.charAt(0),s=[0];for(o=0;o<e.length;o++){var c=r[e.charCodeAt(o)];if(void 0===c)return;for(var u=0,l=c;u<s.length;++u)l+=s[u]*a,s[u]=255&l,l>>=8;for(;l>0;)s.push(255&l),l>>=8}for(var d=0;e[d]===i&&d<e.length-1;++d)s.push(0);return"undefined"!=typeof Buffer?Buffer.from(s.reverse()):new Uint8Array(s.reverse())},baseN}function requireUtil(){if(hasRequiredUtil)return util.exports;hasRequiredUtil=1;var e=requireForge(),t=requireBaseN(),n=util.exports=e.util=e.util||{};function r(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(n.isArrayBuffer(e)||n.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof o||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return n.nextTick=process.nextTick,void("function"==typeof setImmediate?n.setImmediate=setImmediate:n.setImmediate=n.nextTick);if("function"==typeof setImmediate)return n.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(n.nextTick=function(e){return setImmediate(e)});if(n.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",t=[];function s(n){if(n.source===window&&n.data===e){n.stopPropagation();var r=t.slice();t.length=0,r.forEach(function(e){e()})}}n.setImmediate=function(n){t.push(n),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",s,!0)}if("undefined"!=typeof MutationObserver){var r=Date.now(),o=!0,a=document.createElement("div");t=[];new MutationObserver(function(){var e=t.slice();t.length=0,e.forEach(function(e){e()})}).observe(a,{attributes:!0});var i=n.setImmediate;n.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),i(e)):(t.push(e),1===t.length&&a.setAttribute("a",o=!o))}}n.nextTick=n.setImmediate}(),n.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,n.globalScope=n.isNodejs?commonjsGlobal:"undefined"==typeof self?window:self,n.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},n.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},n.isArrayBufferView=function(e){return e&&n.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},n.ByteBuffer=o,n.ByteStringBuffer=o;n.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},n.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},n.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},n.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},n.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var n=this.data;t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return this.data=n,this._optimizeConstructedString(t),this},n.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},n.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(n.encodeUtf8(e))},n.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},n.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},n.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},n.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},n.ByteStringBuffer.prototype.putInt=function(e,t){r(t);var n="";do{t-=8,n+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(n)},n.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},n.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},n.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},n.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},n.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},n.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},n.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},n.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},n.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},n.ByteStringBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},n.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<<e-2;return t>=n&&(t-=n<<1),t},n.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},n.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},n.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},n.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},n.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},n.ByteStringBuffer.prototype.copy=function(){var e=n.createBuffer(this.data);return e.read=this.read,e},n.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},n.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},n.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},n.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var n=this.data.charCodeAt(t);n<16&&(e+="0"),e+=n.toString(16)}return e},n.ByteStringBuffer.prototype.toString=function(){return n.decodeUtf8(this.bytes())},n.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=n.isArrayBuffer(e),o=n.isArrayBufferView(e);if(r||o)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},n.DataBuffer.prototype.length=function(){return this.write-this.read},n.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},n.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var n=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(n),this.data=new DataView(r.buffer),this},n.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},n.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var n=0;n<t;++n)this.data.setUint8(e);return this},n.DataBuffer.prototype.putBytes=function(e,t){if(n.isArrayBufferView(e)){var r=(o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-o.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(o),this.write+=r,this}if(n.isArrayBuffer(e)){var o=new Uint8Array(e);return this.accommodate(o.byteLength),new Uint8Array(this.data.buffer).set(o,this.write),this.write+=o.byteLength,this}if(e instanceof n.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&n.isArrayBufferView(e.data)){o=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(o.byteLength),new Uint8Array(e.data.byteLength,this.write).set(o),this.write+=o.byteLength,this}if(e instanceof n.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var a;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),a=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.hex.decode(e,a,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),a=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.base64.decode(e,a,this.write),this;if("utf8"===t&&(e=n.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),a=new Uint8Array(this.data.buffer,this.write),this.write+=n.binary.raw.decode(a),this;if("utf16"===t)return this.accommodate(2*e.length),a=new Uint16Array(this.data.buffer,this.write),this.write+=n.text.utf16.encode(a),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},n.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},n.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},n.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},n.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},n.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},n.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},n.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},n.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},n.DataBuffer.prototype.putInt=function(e,t){r(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},n.DataBuffer.prototype.putSignedInt=function(e,t){return r(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},n.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},n.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},n.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},n.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},n.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},n.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},n.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},n.DataBuffer.prototype.getInt=function(e){r(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},n.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),n=2<<e-2;return t>=n&&(t-=n<<1),t},n.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},n.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},n.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},n.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},n.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},n.DataBuffer.prototype.copy=function(){return new n.DataBuffer(this)},n.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},n.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},n.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},n.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var n=this.data.getUint8(t);n<16&&(e+="0"),e+=n.toString(16)}return e},n.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return n.binary.raw.encode(t);if("hex"===e)return n.binary.hex.encode(t);if("base64"===e)return n.binary.base64.encode(t);if("utf8"===e)return n.text.utf8.decode(t);if("utf16"===e)return n.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},n.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=n.encodeUtf8(e)),new n.ByteBuffer(e)},n.fillString=function(e,t){for(var n="";t>0;)1&t&&(n+=e),(t>>>=1)>0&&(e+=e);return n},n.xorBytes=function(e,t,n){for(var r="",o="",a="",i=0,s=0;n>0;--n,++i)o=e.charCodeAt(i)^t.charCodeAt(i),s>=10&&(r+=a,a="",s=0),a+=String.fromCharCode(o),++s;return r+=a},n.hexToBytes=function(e){var t="",n=0;for(!0&e.length&&(n=1,t+=String.fromCharCode(parseInt(e[0],16)));n<e.length;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t},n.bytesToHex=function(e){return n.createBuffer(e).toHex()},n.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],s="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";n.encode64=function(e,t){for(var n,r,o,i="",s="",c=0;c<e.length;)n=e.charCodeAt(c++),r=e.charCodeAt(c++),o=e.charCodeAt(c++),i+=a.charAt(n>>2),i+=a.charAt((3&n)<<4|r>>4),isNaN(r)?i+="==":(i+=a.charAt((15&r)<<2|o>>6),i+=isNaN(o)?"=":a.charAt(63&o)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},n.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,n,r,o,a="",s=0;s<e.length;)t=i[e.charCodeAt(s++)-43],n=i[e.charCodeAt(s++)-43],r=i[e.charCodeAt(s++)-43],o=i[e.charCodeAt(s++)-43],a+=String.fromCharCode(t<<2|n>>4),64!==r&&(a+=String.fromCharCode((15&n)<<4|r>>2),64!==o&&(a+=String.fromCharCode((3&r)<<6|o)));return a},n.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},n.decodeUtf8=function(e){return decodeURIComponent(escape(e))},n.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:t.encode,decode:t.decode}},n.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},n.binary.raw.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(e.length));for(var o=n=n||0,a=0;a<e.length;++a)r[o++]=e.charCodeAt(a);return t?o-n:r},n.binary.hex.encode=n.bytesToHex,n.binary.hex.decode=function(e,t,n){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2)));var o=0,a=n=n||0;for(1&e.length&&(o=1,r[a++]=parseInt(e[0],16));o<e.length;o+=2)r[a++]=parseInt(e.substr(o,2),16);return t?a-n:r},n.binary.base64.encode=function(e,t){for(var n,r,o,i="",s="",c=0;c<e.byteLength;)n=e[c++],r=e[c++],o=e[c++],i+=a.charAt(n>>2),i+=a.charAt((3&n)<<4|r>>4),isNaN(r)?i+="==":(i+=a.charAt((15&r)<<2|o>>6),i+=isNaN(o)?"=":a.charAt(63&o)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},n.binary.base64.decode=function(e,t,n){var r,o,a,s,c=t;c||(c=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,l=n=n||0;u<e.length;)r=i[e.charCodeAt(u++)-43],o=i[e.charCodeAt(u++)-43],a=i[e.charCodeAt(u++)-43],s=i[e.charCodeAt(u++)-43],c[l++]=r<<2|o>>4,64!==a&&(c[l++]=(15&o)<<4|a>>2,64!==s&&(c[l++]=(3&a)<<6|s));return t?l-n:c.subarray(0,l)},n.binary.base58.encode=function(e,t){return n.binary.baseN.encode(e,s,t)},n.binary.base58.decode=function(e,t){return n.binary.baseN.decode(e,s,t)},n.text={utf8:{},utf16:{}},n.text.utf8.encode=function(e,t,r){e=n.encodeUtf8(e);var o=t;o||(o=new Uint8Array(e.length));for(var a=r=r||0,i=0;i<e.length;++i)o[a++]=e.charCodeAt(i);return t?a-r:o},n.text.utf8.decode=function(e){return n.decodeUtf8(String.fromCharCode.apply(null,e))},n.text.utf16.encode=function(e,t,n){var r=t;r||(r=new Uint8Array(2*e.length));for(var o=new Uint16Array(r.buffer),a=n=n||0,i=n,s=0;s<e.length;++s)o[i++]=e.charCodeAt(s),a+=2;return t?a-n:r},n.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},n.deflate=function(e,t,r){if(t=n.decode64(e.deflate(n.encode64(t)).rval),r){var o=2;32&t.charCodeAt(1)&&(o=6),t=t.substring(o,t.length-4)}return t},n.inflate=function(e,t,r){var o=e.inflate(n.encode64(t)).rval;return null===o?null:n.decode64(o)};var c=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var o;if(null===r?o=e.removeItem(t):(r=n.encode64(JSON.stringify(r)),o=e.setItem(t,r)),void 0!==o&&!0!==o.rval){var a=new Error(o.error.message);throw a.id=o.error.id,a.name=o.error.name,a}},u=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var o=new Error(r.error.message);throw o.id=r.error.id,o.name=r.error.name,o}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(n.decode64(r))),r},l=function(e,t,n,r){var o=u(e,t);null===o&&(o={}),o[n]=r,c(e,t,o)},d=function(e,t,n){var r=u(e,t);return null!==r&&(r=n in r?r[n]:null),r},p=function(e,t,n){var r=u(e,t);if(null!==r&&n in r){delete r[n];var o=!0;for(var a in r){o=!1;break}o&&(r=null),c(e,t,r)}},h=function(e,t){c(e,t,null)},f=function(e,t,n){var r,o=null;void 0===n&&(n=["web","flash"]);var a=!1,i=null;for(var s in n){r=n[s];try{if("flash"===r||"both"===r){if(null===t[0])throw new Error("Flash local storage not available.");o=e.apply(this,t),a="flash"===r}"web"!==r&&"both"!==r||(t[0]=localStorage,o=e.apply(this,t),a=!0)}catch(e){i=e}if(a)break}if(!a)throw i;return o};return n.setItem=function(e,t,n,r,o){f(l,arguments,o)},n.getItem=function(e,t,n,r){return f(d,arguments,r)},n.removeItem=function(e,t,n,r){f(p,arguments,r)},n.clearItems=function(e,t,n){f(h,arguments,n)},n.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},n.format=function(e){for(var t,n,r=/%./g,o=0,a=[],i=0;t=r.exec(e);){(n=e.substring(i,r.lastIndex-2)).length>0&&a.push(n),i=r.lastIndex;var s=t[0][1];switch(s){case"s":case"o":o<arguments.length?a.push(arguments[1+o++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(e.substring(i)),a.join("")},n.formatNumber=function(e,t,n,r){var o=e,a=isNaN(t=Math.abs(t))?2:t,i=void 0===n?",":n,s=void 0===r?".":r,c=o<0?"-":"",u=parseInt(o=Math.abs(+o||0).toFixed(a),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+s:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?i+Math.abs(o-u).toFixed(a).slice(2):"")},n.formatSize=function(e){return e=e>=1073741824?n.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?n.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?n.formatNumber(e/1024,0)+" KiB":n.formatNumber(e,0)+" bytes"},n.bytesFromIP=function(e){return-1!==e.indexOf(".")?n.bytesFromIPv4(e):-1!==e.indexOf(":")?n.bytesFromIPv6(e):null},n.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=n.createBuffer(),r=0;r<e.length;++r){var o=parseInt(e[r],10);if(isNaN(o))return null;t.putByte(o)}return t.getBytes()},n.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter(function(e){return 0===e.length&&++t,!0})).length+t),o=n.createBuffer(),a=0;a<8;++a)if(e[a]&&0!==e[a].length){var i=n.hexToBytes(e[a]);i.length<2&&o.putByte(0),o.putBytes(i)}else o.fillWithByte(0,r),r=0;return o.getBytes()},n.bytesToIP=function(e){return 4===e.length?n.bytesToIPv4(e):16===e.length?n.bytesToIPv6(e):null},n.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t.join(".")},n.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],o=0,a=0;a<e.length;a+=2){for(var i=n.bytesToHex(e[a]+e[a+1]);"0"===i[0]&&"0"!==i;)i=i.substr(1);if("0"===i){var s=r[r.length-1],c=t.length;s&&c===s.end+1?(s.end=c,s.end-s.start>r[o].end-r[o].start&&(o=r.length-1)):r.push({start:c,end:c})}t.push(i)}if(r.length>0){var u=r[o];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},n.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in n&&!e.update)return t(null,n.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return n.cores=navigator.hardwareConcurrency,t(null,n.cores);if("undefined"==typeof Worker)return n.cores=1,t(null,n.cores);if("undefined"==typeof Blob)return n.cores=2,t(null,n.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(e){var t=Date.now(),n=t+4;self.postMessage({st:t,et:n})})}.toString(),")()"],{type:"application/javascript"}));!function e(o,a,i){if(0===a){var s=Math.floor(o.reduce(function(e,t){return e+t},0)/o.length);return n.cores=Math.max(1,s),URL.revokeObjectURL(r),t(null,n.cores)}!function(e,t){for(var n=[],o=[],a=0;a<e;++a){var i=new Worker(r);i.addEventListener("message",function(r){if(o.push(r.data),o.length===e){for(var a=0;a<e;++a)n[a].terminate();t(null,o)}}),n.push(i)}for(a=0;a<e;++a)n[a].postMessage(a)}(i,function(t,n){o.push(function(e,t){for(var n=[],r=0;r<e;++r)for(var o=t[r],a=n[r]=[],i=0;i<e;++i)if(r!==i){var s=t[i];(o.st>s.st&&o.st<s.et||s.st>o.st&&s.st<o.et)&&a.push(i)}return n.reduce(function(e,t){return Math.max(e,t.length)},0)}(i,n)),e(o,a-1,i)})}([],5,16)},util.exports}function requirePem(){if(hasRequiredPem)return pem.exports;hasRequiredPem=1;var e=requireForge();requireUtil();var t=pem.exports=e.pem=e.pem||{};function n(e){for(var t=e.name+": ",n=[],r=function(e,t){return" "+t},o=0;o<e.values.length;++o)n.push(e.values[o].replace(/^(\S+\r\n)/,r));t+=n.join(",")+"\r\n";var a=0,i=-1;for(o=0;o<t.length;++o,++a)if(a>65&&-1!==i){var s=t[i];","===s?(++i,t=t.substr(0,i)+"\r\n "+t.substr(i)):t=t.substr(0,i)+"\r\n"+s+t.substr(i+1),a=o-i-1,i=-1,++o}else" "!==t[o]&&"\t"!==t[o]&&","!==t[o]||(i=o);return t}function r(e){return e.replace(/^\s+/,"")}return t.encode=function(t,r){r=r||{};var o,a="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(a+=n(o={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(a+=n(o={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(o={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&o.values.push(t.dekInfo.parameters),a+=n(o)),t.headers)for(var i=0;i<t.headers.length;++i)a+=n(t.headers[i]);return t.procType&&(a+="\r\n"),a+=e.util.encode64(t.body,r.maxline||64)+"\r\n",a+="-----END "+t.type+"-----\r\n"},t.decode=function(t){for(var n,o=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,i=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,s=/\r?\n/;n=a.exec(t);){var c=n[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var u={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(n[3])};if(o.push(u),n[2]){for(var l=n[2].split(s),d=0;n&&d<l.length;){for(var p=l[d].replace(/\s+$/,""),h=d+1;h<l.length;++h){var f=l[h];if(!/\s/.test(f[0]))break;p+=f,d=h}if(n=p.match(i)){for(var y={name:n[1],values:[]},m=n[2].split(","),g=0;g<m.length;++g)y.values.push(r(m[g]));if(u.procType)if(u.contentDomain||"Content-Domain"!==y.name)if(u.dekInfo||"DEK-Info"!==y.name)u.headers.push(y);else{if(0===y.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:m[0],parameters:m[1]||null}}else u.contentDomain=m[0]||"";else{if("Proc-Type"!==y.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:m[0],type:m[1]}}}++d}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===o.length)throw new Error("Invalid PEM formatted message.");return o},pem.exports}var pemExports=requirePem(),pemForge=getDefaultExportFromCjs(pemExports);const ID_ED25519="1.3.101.112";async function readPemED25519(e,t){const n=decode$2(e.replace(/-----BEGIN (.*)-----|-----END (.*)-----|\n|\r/g,""));if(t){let e;try{e=EncryptedPrivateKeyInfo.parse(n)}catch(e){const t=null!=e&&null!=e.message?e.message:"";throw new BadKeyError(`failed to parse encrypted private key: ${t}`)}const r=await e.decrypt(t);let o=null;if(r.algId.algIdent!==ID_ED25519)throw new BadKeyError(`unknown private key algorithm ${r.algId.toString()}`);o=Ed25519PrivateKey;const a=decode$3(r.privateKey);if(!("bytes"in a))throw new BadKeyError(`expected ASN bytes, got ${JSON.stringify(a)}`);return o.fromBytes(a.bytes)}return n.subarray(16)}async function readPemECDSA(e,t){const n=decode$2(e.replace(/-----BEGIN (.*)-----|-----END (.*)-----|\n|\r/g,""));if(t){const n=pemForge.decode(e)[0].dekInfo.parameters,r=decode$5(n),o=e.split("\n"),a=await messageDigest(t,n),i=bufferExports.Buffer.from(o.slice(4,o.length-1).join(""),"base64"),s=await createDecipheriv(CipherAlgorithm.Aes128Cbc,a,r,i);return EcdsaPrivateKey.fromBytesDer(s)}return fromBER(n).result.valueBlock.value[1].valueBlock.valueHexView}async function read(e,t){return!!e.includes("BEGIN EC PRIVATE KEY")?readPemECDSA(e,t):readPemED25519(e,t)}function legacy(e,t){const n=new Uint8Array(e.length+8);n.set(e,0);const r=new DataView(n.buffer,n.byteOffset,n.byteLength);0xffffffffff===t?(r.setInt32(e.length+0,255),r.setInt32(e.length+4,-1)):(r.setInt32(e.length+0,t<0?-1:0),r.setInt32(e.length+4,t));const o=Uint8Array.from([255]);return deriveKey(HashAlgorithm.Sha512,n,o,2048,32)}const CACHE$1={privateKeyConstructor:null,privateKeyFromBytes:null,mnemonicFromString:null};let PrivateKey$1=class e extends Key$1{constructor(e){super(),this._key=e}get _type(){return this._key._type}get _chainCode(){return this._key._chainCode}static generateED25519(){return new e(Ed25519PrivateKey.generate())}static generateECDSA(){return new e(EcdsaPrivateKey.generate())}static generate(){return e.generateED25519()}static async generateAsync(){return e.generateED25519Async()}static async generateED25519Async(){return new e(await Ed25519PrivateKey.generateAsync())}static async generateECDSAAsync(){return new e(await EcdsaPrivateKey.generateAsync())}static fromBytes(t){let n;32==t.length&&console.warn("WARNING: Consider using fromStringECDSA() or fromStringED25519() on a HEX-encoded string and fromStringDer() on a HEX-encoded string with DER prefix instead.");try{return new e(Ed25519PrivateKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}try{return new e(EcdsaPrivateKey.fromBytes(t))}catch(e){n=null!=e&&null!=e.message?e.message:""}throw new BadKeyError(`private key cannot be decoded from bytes: ${n}`)}static fromBytesECDSA(t){return new e(EcdsaPrivateKey.fromBytes(t))}static fromBytesED25519(t){return new e(Ed25519PrivateKey.fromBytes(t))}static fromString(t){return e.fromBytes(decode$5(t))}static fromStringECDSA(t){return e.fromBytesECDSA(decode$5(t))}static fromStringED25519(t){return e.fromBytesED25519(decode$5(t))}static async fromSeedED25519(t){const n=await Ed25519PrivateKey.fromSeed(t);return new e(n)}static async fromSeedECDSAsecp256k1(t){const n=await EcdsaPrivateKey.fromSeed(t);return new e(n)}static async fromMnemonic(e,t=""){if(null==CACHE$1.mnemonicFromString)throw new Error("Mnemonic not found in cache");return("string"==typeof e?CACHE$1.mnemonicFromString(e):e).toEd25519PrivateKey(t)}static async fromKeystore(t,n=""){return e.fromBytes(await loadKeystore(t,n))}static async fromPem(t,n=""){const r=await read(t,n);if(r instanceof Ed25519PrivateKey||r instanceof EcdsaPrivateKey)return new e(r);const o=!!t.includes("BEGIN EC PRIVATE KEY");return new e(o?EcdsaPrivateKey.fromBytes(r):Ed25519PrivateKey.fromBytes(r))}async derive(t){if(null==this._key._chainCode)throw new Error("this private key does not support key derivation");if(this._key instanceof Ed25519PrivateKey){const{keyData:n,chainCode:r}=await derive(this.toBytesRaw(),this._key._chainCode,t);return new e(new Ed25519PrivateKey(n,r))}{const{keyData:n,chainCode:r}=await derive$1(this.toBytesRaw(),this._key._chainCode,t);return new e(new EcdsaPrivateKey(fromBytes(n),r))}}async legacyDerive(t){const n=await legacy(this.toBytesRaw().subarray(0,32),t),r=this._key.constructor;return new e(new r(n))}get publicKey(){return new PublicKey$1(this._key.publicKey)}sign(e){return this._key.sign(e)}signTransaction(e){if(e.isFrozen()||e.freeze(),1!=e._signedTransactions.length)throw new Error("`PrivateKey.signTransaction()` requires `Transaction` to have a single node `AccountId` set");const t=e._signedTransactions[0],n=encode$2(this.publicKey.toBytesRaw());null==t.sigMap&&(t.sigMap={}),null==t.sigMap.sigPair&&(t.sigMap.sigPair=[]);for(const e of t.sigMap.sigPair)if(null!=e.pubKeyPrefix&&encode$2(e.pubKeyPrefix)===n)switch(this._type){case"ED25519":return e.ed25519;case"secp256k1":return e.ECDSASecp256k1}const r=this.sign(null!=t.bodyBytes?t.bodyBytes:new Uint8Array),o={pubKeyPrefix:this.publicKey.toBytesRaw()};switch(this._type){case"ED25519":o.ed25519=r;break;case"secp256k1":o.ECDSASecp256k1=r}return t.sigMap.sigPair.push(o),e._signerPublicKeys.add(n),r}isDerivable(){return null!=this._key._chainCode}toBytes(){return this._key instanceof Ed25519PrivateKey?this.toBytesRaw():this.toBytesDer()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this.toStringDer()}toStringDer(){return encode$2(this.toBytesDer())}toStringRaw(){return encode$2(this.toBytesRaw())}toKeystore(e=""){return createKeystore(this.toBytesRaw(),e)}getRecoveryId(e,t,n){if(!(this._key instanceof EcdsaPrivateKey))throw new Error("Invalid key type, must be ECDSA secp256k1.");if(32!==e.length||32!==t.length)throw new Error("Invalid signature components.");const r=new Uint8Array(64);return r.set(e,0),r.set(t,32),this._key.getRecoveryId(r,n)}};CACHE$1.privateKeyConstructor=e=>new PrivateKey$1(e),CACHE$1.privateKeyFromBytes=e=>PrivateKey$1.fromBytes(e);const BadMnemonicReason=Object.freeze({BadLength:"BadLength",UnknownWords:"UnknownWords",ChecksumMismatch:"ChecksumMismatch"});class BadMnemonicError extends Error{constructor(e,t,n){let r;switch(t){case BadMnemonicReason.BadLength:r="mnemonic is of an unexpected number of words";break;case BadMnemonicReason.ChecksumMismatch:r="checksum byte in mnemonic did not match the rest of the mnemonic";break;case BadMnemonicReason.UnknownWords:r="mnemonic contained words that are not in the standard word list";break;default:throw new Error(`unexpected value ${t.toString()} for 'reason'`)}super(`invalid mnemonic: ${r}`),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,BadMnemonicError),this.name="BadMnemonicError",this.reason=t,this.mnemonic=e,this.unknownWordIndices=n}}var legacyWords=["aback","abbey","abbot","abide","ablaze","able","aboard","abode","abort","abound","about","above","abroad","abrupt","absent","absorb","absurd","abuse","accent","accept","access","accord","accuse","ace","ache","aching","acid","acidic","acorn","acre","across","act","action","active","actor","actual","acute","adam","adapt","add","added","addict","adept","adhere","adjust","admire","admit","adobe","adopt","adrift","adult","adverb","advice","aerial","afar","affair","affect","afford","afghan","afield","afloat","afraid","afresh","after","again","age","agency","agenda","agent","aghast","agile","ago","agony","agree","agreed","ahead","aid","aide","aim","air","airman","airy","akin","alarm","alaska","albeit","album","ale","alert","alibi","alice","alien","alight","align","alike","alive","alkali","all","alley","allied","allow","alloy","ally","almond","almost","aloft","alone","along","aloof","aloud","alpha","alpine","also","altar","alter","always","amaze","amazon","amber","ambush","amen","amend","amid","amidst","amiss","among","amount","ample","amuse","anchor","and","andrew","anew","angel","anger","angle","angry","animal","ankle","annoy","annual","answer","anthem","any","anyhow","anyway","apart","apathy","apex","apiece","appeal","appear","apple","apply","april","apron","arab","arcade","arcane","arch","arctic","ardent","are","area","argue","arid","arise","ark","arm","armful","army","aroma","around","arouse","array","arrest","arrive","arrow","arson","art","artery","artful","artist","ascent","ash","ashen","ashore","aside","ask","asleep","aspect","assay","assent","assert","assess","asset","assign","assist","assume","assure","asthma","astute","asylum","ate","athens","atlas","atom","atomic","attach","attack","attain","attend","attic","auburn","audio","audit","august","aunt","auntie","aura","austin","author","auto","autumn","avail","avenge","avenue","avert","avid","avoid","await","awake","awaken","award","aware","awash","away","awful","awhile","axe","axes","axiom","axis","axle","aye","babe","baby","bach","back","backup","bacon","bad","badge","badly","bag","baggy","bail","bait","bake","baker","bakery","bald","ball","ballad","ballet","ballot","baltic","bamboo","ban","banal","banana","band","bang","bank","bar","barber","bare","barely","barge","bark","barley","barn","baron","barrel","barren","basalt","base","basic","basil","basin","basis","basket","bass","bat","batch","bath","baton","battle","bay","beach","beacon","beak","beam","bean","bear","beard","beast","beat","beauty","become","bed","beech","beef","beefy","beep","beer","beet","beetle","before","beg","beggar","begin","behalf","behave","behind","beige","being","belief","bell","belly","belong","below","belt","bench","bend","benign","bent","berlin","berry","berth","beset","beside","best","bestow","bet","beta","betray","better","beware","beyond","bias","biceps","bicker","bid","big","bigger","bike","bile","bill","bin","binary","bind","biopsy","birch","bird","birdie","birth","bishop","bit","bitch","bite","bitter","black","blade","blame","bland","blast","blaze","bleak","blend","bless","blew","blind","blink","blip","bliss","blitz","block","blond","blood","bloody","bloom","blot","blouse","blow","blue","bluff","blunt","blur","blush","boar","board","boast","boat","bob","bodily","body","bogus","boil","bold","bolt","bomb","bombay","bond","bone","bonn","bonnet","bonus","bony","book","boom","boost","boot","booth","booze","border","bore","borrow","bosom","boss","boston","both","bother","bottle","bottom","bought","bounce","bound","bounty","bout","bovine","bow","bowel","bowl","box","boy","boyish","brace","brain","brainy","brake","bran","branch","brand","brandy","brass","brave","bravo","brazil","breach","bread","break","breast","breath","bred","breed","breeze","brew","bribe","brick","bride","bridge","brief","bright","brim","brine","bring","brink","brisk","broad","broke","broken","bronze","brook","broom","brown","bruise","brush","brutal","brute","bubble","buck","bucket","buckle","budget","buffet","buggy","build","bulb","bulge","bulk","bulky","bull","bullet","bully","bump","bumpy","bunch","bundle","bunk","bunny","burden","bureau","burial","buried","burly","burn","burnt","burrow","burst","bury","bus","bush","bust","bustle","busy","but","butler","butt","butter","button","buy","buyer","buzz","bye","byte","cab","cabin","cable","cache","cactus","caesar","cage","cairo","cajun","cajole","cake","calf","call","caller","calm","calmly","came","camel","camera","camp","campus","can","canada","canal","canary","cancel","cancer","candid","candle","candy","cane","canine","canoe","canopy","canvas","canyon","cap","cape","car","carbon","card","care","career","caress","cargo","carl","carnal","carol","carp","carpet","carrot","carry","cart","cartel","case","cash","cask","cast","castle","casual","cat","catch","cater","cattle","caught","causal","cause","cave","cease","celery","cell","cellar","celtic","cement","censor","census","cent","cereal","chain","chair","chalk","chalky","champ","chance","change","chant","chaos","chap","chapel","charge","charm","chart","chase","chat","cheap","cheat","check","cheek","cheeky","cheer","cheery","cheese","chef","cheque","cherry","chess","chest","chew","chic","chick","chief","child","chile","chill","chilly","chin","china","chip","choice","choir","choose","chop","choppy","chord","chorus","chose","chosen","chris","chrome","chunk","chunky","church","cider","cigar","cinema","circa","circle","circus","cite","city","civic","civil","clad","claim","clammy","clan","clap","clash","clasp","class","clause","claw","clay","clean","clear","clergy","clerk","clever","click","client","cliff","climax","climb","clinch","cling","clinic","clip","cloak","clock","clone","close","closer","closet","cloth","cloud","cloudy","clout","clown","club","clue","clumsy","clung","clutch","coach","coal","coarse","coast","coat","coax","cobalt","cobra","coca","cock","cocoa","code","coffee","coffin","cohort","coil","coin","coke","cold","collar","colon","colony","colt","column","comb","combat","come","comedy","comic","commit","common","compel","comply","concur","cone","confer","congo","consul","convex","convey","convoy","cook","cool","cope","copper","copy","coral","cord","core","cork","corn","corner","corps","corpse","corpus","cortex","cosmic","cosmos","cost","costly","cotton","couch","cough","could","count","county","coup","couple","coupon","course","court","cousin","cove","cover","covert","cow","coward","cowboy","cozy","crab","crack","cradle","craft","crafty","crag","crane","crash","crate","crater","crawl","crazy","creak","cream","creamy","create","credit","creed","creek","creep","creepy","crept","crest","crew","cried","crime","crisis","crisp","critic","crook","crop","cross","crow","crowd","crown","crude","cruel","cruise","crunch","crush","crust","crux","cry","crypt","cuba","cube","cubic","cuckoo","cuff","cult","cup","curb","cure","curfew","curl","curry","curse","cursor","curve","cuss","custom","cut","cute","cycle","cyclic","cynic","czech","dad","daddy","dagger","daily","dairy","daisy","dale","dam","damage","damp","dampen","dance","danger","danish","dare","dark","darken","darn","dart","dash","data","date","david","dawn","day","dead","deadly","deaf","deal","dealer","dean","dear","death","debate","debit","debris","debt","debtor","decade","decay","decent","decide","deck","decor","decree","deduce","deed","deep","deeply","deer","defeat","defect","defend","defer","define","defy","degree","deity","delay","delete","delhi","delta","demand","demise","demo","demure","denial","denote","dense","dental","deny","depart","depend","depict","deploy","depot","depth","deputy","derive","desert","design","desire","desist","desk","detail","detect","deter","detest","detour","device","devise","devoid","devote","devour","dial","diana","diary","dice","dictum","did","die","diesel","diet","differ","dig","digest","digit","dine","dinghy","dinner","diode","dip","dire","direct","dirt","dirty","disc","disco","dish","disk","dismal","dispel","ditch","dive","divert","divide","divine","dizzy","docile","dock","doctor","dog","dogma","dole","doll","dollar","dolly","domain","dome","domino","donate","done","donkey","donor","doom","door","dorsal","dose","dot","double","doubt","dough","dour","dove","down","dozen","draft","drag","dragon","drain","drama","drank","draw","drawer","dread","dream","dreary","dress","drew","dried","drift","drill","drink","drip","drive","driver","drop","drove","drown","drug","drum","drunk","dry","dual","duck","duct","due","duel","duet","duke","dull","duly","dumb","dummy","dump","dune","dung","duress","during","dusk","dust","dusty","dutch","duty","dwarf","dwell","dyer","dying","dynamo","each","eager","eagle","ear","earl","early","earn","earth","ease","easel","easily","east","easter","easy","eat","eaten","eater","echo","eddy","eden","edge","edible","edict","edit","editor","eel","eerie","eerily","effect","effort","egg","ego","eight","eighth","eighty","either","elbow","elder","eldest","elect","eleven","elicit","elite","else","elude","elves","embark","emblem","embryo","emerge","emit","empire","employ","empty","enable","enamel","end","endure","enemy","energy","engage","engine","enjoy","enlist","enough","ensure","entail","enter","entire","entry","envoy","envy","enzyme","epic","epoch","equal","equate","equip","equity","era","erect","eric","erode","erotic","errant","error","escape","escort","essay","essex","estate","esteem","ethic","ethnic","europe","evade","eve","even","event","ever","every","evict","evil","evoke","evolve","exact","exam","exceed","excel","except","excess","excise","excite","excuse","exempt","exert","exile","exist","exit","exodus","exotic","expand","expect","expert","expire","export","expose","extend","extra","eye","eyed","fabric","face","facial","fact","factor","fade","fail","faint","fair","fairly","fairy","faith","fake","falcon","fall","false","falter","fame","family","famine","famous","fan","fancy","far","farce","fare","farm","farmer","fast","fasten","faster","fat","fatal","fate","father","fatty","fault","faulty","fauna","fear","feast","feat","fed","fee","feeble","feed","feel","feet","fell","fellow","felt","female","fence","fend","ferry","fetal","fetch","feudal","fever","few","fewer","fiasco","fiddle","field","fiend","fierce","fiery","fifth","fifty","fig","fight","figure","file","fill","filled","filler","film","filter","filth","filthy","final","finale","find","fine","finery","finger","finish","finite","fire","firm","firmly","first","fiscal","fish","fisher","fist","fit","fitful","five","fix","flag","flair","flak","flame","flank","flap","flare","flash","flask","flat","flavor","flaw","fled","flee","fleece","fleet","flesh","fleshy","flew","flick","flight","flimsy","flint","flirt","float","flock","flood","floor","floppy","flora","floral","flour","flow","flower","fluent","fluffy","fluid","flung","flurry","flush","flute","flux","fly","flyer","foal","foam","focal","focus","fog","foil","fold","folk","follow","folly","fond","fondly","font","food","fool","foot","for","forbid","force","ford","forest","forge","forget","fork","form","formal","format","former","fort","forth","forty","forum","fossil","foster","foul","found","four","fourth","fox","foyer","frail","frame","franc","france","frank","fraud","fred","free","freed","freely","freeze","french","frenzy","fresh","friar","friday","fridge","fried","friend","fright","fringe","frock","frog","from","front","frost","frosty","frown","frozen","frugal","fruit","fry","fudge","fuel","full","fully","fumes","fun","fund","funny","fur","furry","fury","fuse","fusion","fuss","fussy","futile","future","fuzzy","gadget","gain","gala","galaxy","gale","gall","galley","gallon","gallop","gamble","game","gamma","gandhi","gang","gap","garage","garden","garlic","gas","gasp","gate","gather","gauge","gaunt","gave","gaze","gear","geese","gem","gemini","gender","gene","geneva","genial","genius","genre","gentle","gently","gentry","genus","george","germ","get","ghetto","ghost","giant","gift","giggle","gill","gilt","ginger","girl","give","given","glad","glade","glance","gland","glare","glass","glassy","gleam","glee","glide","global","globe","gloom","gloomy","gloria","glory","gloss","glossy","glove","glow","glue","gnat","gnu","goal","goat","gold","golden","golf","gone","gong","goo","good","goose","gore","gorge","gory","gosh","gospel","gossip","got","gothic","govern","gown","grab","grace","grade","grail","grain","grand","grant","grape","graph","grasp","grass","grassy","grate","grave","gravel","gravy","grease","greasy","great","greece","greed","greedy","greek","green","greet","grew","grey","grid","grief","grill","grim","grin","grind","grip","grit","gritty","groan","groin","groom","groove","gross","ground","group","grove","grow","grown","growth","grudge","grunt","guard","guess","guest","guide","guild","guilt","guilty","guise","guitar","gulf","gully","gun","gunman","guru","gut","guy","gypsy","habit","hack","had","hail","hair","hairy","haiti","hale","half","hall","halt","hamlet","hammer","hand","handle","handy","hang","hangar","hanoi","happen","happy","harass","harbor","hard","harder","hardly","hare","harem","harm","harp","harry","harsh","has","hash","hassle","haste","hasten","hasty","hat","hatch","hate","haul","haunt","havana","have","haven","havoc","hawaii","hawk","hay","hazard","haze","hazel","hazy","head","heal","health","heap","hear","heard","heart","hearth","hearty","heat","heater","heaven","heavy","hebrew","heck","hectic","hedge","heel","hefty","height","heir","held","helium","helix","hell","hello","helm","helmet","help","hemp","hence","henry","her","herald","herb","herd","here","hereby","hermes","hernia","hero","heroic","heroin","hey","heyday","hick","hidden","hide","high","higher","highly","hill","him","hind","hinder","hint","hippie","hire","his","hiss","hit","hive","hoard","hoarse","hobby","hockey","hold","holder","hole","hollow","holly","holy","home","honest","honey","hood","hook","hope","horn","horrid","horror","horse","hose","host","hot","hotel","hound","hour","house","hover","how","huge","hull","human","humane","humble","humid","hung","hunger","hungry","hunt","hurdle","hurl","hurry","hurt","hush","hut","hybrid","hymn","hyphen","ice","icing","icon","idaho","idea","ideal","idiom","idiot","idle","idly","idol","ignite","ignore","ill","image","immune","impact","imply","import","impose","inca","incest","inch","income","incur","indeed","index","india","indian","indoor","induce","inept","inert","infant","infect","infer","influx","inform","inject","injure","injury","ink","inlaid","inland","inlet","inmate","inn","innate","inner","input","insane","insect","insert","inset","inside","insist","insult","insure","intact","intake","intend","inter","into","invade","invent","invest","invite","invoke","inward","iowa","iran","iraq","irish","iron","ironic","irony","isaac","isabel","island","isle","israel","issue","italy","itch","item","itself","ivan","ivory","jack","jacket","jacob","jade","jaguar","jail","james","jane","japan","jargon","java","jaw","jazz","jeep","jelly","jerky","jest","jet","jewel","jewish","jim","job","jock","jockey","joe","john","join","joint","joke","jolly","jolt","jordan","joseph","joy","joyful","joyous","judge","judy","juice","juicy","july","jumble","jumbo","jump","june","jungle","junior","junk","junta","jury","just","kansas","karate","karl","keel","keen","keep","keeper","kenya","kept","kernel","kettle","key","khaki","kick","kid","kidnap","kidney","kill","killer","kin","kind","kindly","king","kiss","kite","kitten","knack","knee","kneel","knew","knife","knight","knit","knob","knock","knot","know","known","koran","korea","kuwait","label","lace","lack","lad","ladder","laden","lady","lagoon","laity","lake","lamb","lame","lamp","lance","land","lane","lap","lapse","large","larval","laser","last","latch","late","lately","latent","later","latest","latin","latter","laugh","launch","lava","lavish","law","lawful","lawn","lawyer","lay","layer","layman","lazy","lead","leader","leaf","leafy","league","leak","leaky","lean","leap","learn","lease","leash","least","leave","led","ledge","left","leg","legacy","legal","legend","legion","lemon","lend","length","lens","lent","leo","leper","lesion","less","lessen","lesser","lesson","lest","let","lethal","letter","level","lever","levy","lewis","liable","liar","libel","libya","lice","lick","lid","lie","lied","lier","life","lift","light","like","likely","limb","lime","limit","limp","line","linear","linen","linger","link","lint","lion","lip","liquid","liquor","list","listen","lit","live","lively","liver","liz","lizard","load","loaf","loan","lobby","lobe","local","locate","lock","locus","lodge","loft","lofty","log","logic","logo","london","lone","lonely","long","longer","look","loop","loose","loosen","loot","lord","lorry","lose","loss","lost","lot","lotion","lotus","loud","loudly","lounge","lousy","love","lovely","lover","low","lower","lowest","loyal","lucid","luck","lucky","lucy","lull","lump","lumpy","lunacy","lunar","lunch","lung","lure","lurid","lush","lust","lute","luther","luxury","lying","lymph","lynch","lyric","macho","macro","mad","madam","made","mafia","magic","magma","magnet","magnum","magpie","maid","maiden","mail","main","mainly","major","make","maker","male","malice","mall","malt","mammal","manage","mane","mania","manic","manner","manor","mantle","manual","manure","many","map","maple","marble","march","mare","margin","maria","marina","mark","market","marry","mars","marsh","martin","martyr","mary","mask","mason","mass","mast","master","mat","match","mate","matrix","matter","mature","maxim","may","maybe","mayor","maze","mead","meadow","meal","mean","meant","meat","medal","media","median","medic","medium","meet","mellow","melody","melon","melt","member","memo","memory","menace","mend","mental","mentor","menu","mercy","mere","merely","merge","merger","merit","merry","mesh","mess","messy","met","metal","meter","method","methyl","metric","metro","mexico","miami","mickey","mid","midday","middle","midst","midway","might","mighty","mild","mildew","mile","milk","milky","mill","mimic","mince","mind","mine","mini","mink","minor","mint","minus","minute","mire","mirror","mirth","misery","miss","mist","misty","mite","mix","moan","moat","mob","mobile","mock","mode","model","modem","modern","modest","modify","module","moist","molar","mold","mole","molten","moment","monday","money","monk","monkey","month","mood","moody","moon","moor","moral","morale","morbid","more","morgue","mortal","mortar","mosaic","moscow","moses","mosque","moss","most","mostly","moth","mother","motion","motive","motor","mount","mourn","mouse","mouth","move","movie","mrs","much","muck","mucus","mud","muddle","muddy","mule","mummy","munich","murder","murky","murmur","muscle","museum","music","mussel","must","mutant","mute","mutiny","mutter","mutton","mutual","muzzle","myopic","myriad","myself","mystic","myth","nadir","nail","naked","name","namely","nape","napkin","naples","narrow","nasal","nasty","nathan","nation","native","nature","nausea","naval","nave","navy","near","nearer","nearly","neat","neatly","neck","need","needle","needy","negate","neon","nepal","nephew","nerve","nest","net","neural","never","newly","next","nice","nicely","niche","nickel","niece","night","nile","nimble","nine","ninety","ninth","nobel","noble","nobody","node","noise","noisy","none","noon","nor","norm","normal","north","norway","nose","nosy","not","note","notice","notify","notion","noun","novel","novice","now","nozzle","null","numb","number","nurse","nut","nylon","nymph","oak","oar","oasis","oath","obese","obey","object","oblige","oboe","obtain","obtuse","occult","occupy","occur","ocean","octave","odd","off","offend","offer","office","offset","often","ohio","oil","oily","okay","old","older","oldest","olive","omega","omen","omit","once","one","onion","only","onset","onto","onus","onward","opaque","open","openly","opera","opium","oppose","optic","option","oracle","oral","orange","orbit","orchid","ordeal","order","organ","orgasm","orient","origin","ornate","orphan","oscar","other","otter","ought","ounce","our","out","outer","output","outset","oval","oven","over","overt","owe","owing","owl","own","owner","oxford","oxide","oxygen","oyster","ozone","pace","pack","packet","pact","pad","paddle","paddy","pagan","page","paid","pain","paint","pair","palace","pale","palm","pan","panama","panel","panic","papa","papal","paper","parade","parcel","pardon","parent","paris","parish","park","parody","parrot","part","partly","party","pascal","pass","past","paste","pastel","pastor","pastry","pat","patch","patent","path","patio","patrol","patron","paul","pause","pave","paw","pawn","pay","peace","peach","peak","pear","pearl","pedal","peel","peer","peking","pelvic","pelvis","pen","penal","pence","pencil","penny","people","pepper","per","perch","peril","period","perish","permit","person","peru","pest","pet","peter","petite","petrol","petty","phase","philip","phone","photo","phrase","piano","pick","picket","picnic","pie","piece","pier","pierce","piety","pig","pigeon","piggy","pike","pile","pill","pillar","pillow","pilot","pin","pinch","pine","pink","pint","pious","pipe","pirate","piss","pistol","piston","pit","pitch","pity","pivot","pixel","pizza","place","placid","plague","plain","plan","plane","planet","plank","plant","plasma","plate","play","player","plea","plead","please","pledge","plenty","plight","plot","plough","ploy","plug","plum","plump","plunge","plural","plus","plush","pocket","poem","poet","poetic","poetry","point","poison","poland","polar","pole","police","policy","polish","polite","poll","pollen","polo","pond","ponder","pony","pool","poor","poorly","pop","poppy","pore","pork","port","portal","pose","posh","post","postal","pot","potato","potent","pouch","pound","pour","powder","power","praise","pray","prayer","preach","prefer","prefix","press","pretty","price","pride","priest","primal","prime","prince","print","prior","prism","prison","privy","prize","probe","profit","prompt","prone","proof","propel","proper","prose","proton","proud","prove","proven","proxy","prune","pry","psalm","pseudo","psyche","pub","public","puff","pull","pulp","pulpit","pulsar","pulse","pump","punch","punish","punk","pupil","puppet","puppy","pure","purely","purge","purify","purple","purse","pursue","push","pushy","put","putt","puzzle","quaint","quake","quarry","quart","quartz","quebec","queen","queer","query","quest","queue","quick","quid","quiet","quilt","quirk","quit","quite","quiver","quiz","quota","quote","rabbit","race","racial","racism","rack","racket","radar","radio","radish","radius","raffle","raft","rage","raid","rail","rain","rainy","raise","rake","rally","ramp","random","range","rank","ransom","rape","rapid","rare","rarely","rarity","rash","rat","rate","rather","ratify","ratio","rattle","rave","raven","raw","ray","razor","reach","react","read","reader","ready","real","really","realm","reap","rear","reason","rebel","recall","recent","recess","recipe","reckon","record","recoup","rector","red","redeem","redo","reduce","reed","reef","reek","refer","reform","refuge","refuse","regal","regard","regent","regime","region","regret","reign","reject","relate","relax","relay","relic","relief","relish","rely","remain","remark","remedy","remind","remit","remote","remove","renal","render","rent","rental","repair","repeal","repeat","repent","reply","report","rescue","resent","reside","resign","resin","resist","resort","rest","result","resume","retail","retain","retina","retire","return","reveal","review","revise","revive","revolt","reward","rex","rhine","rhino","rhyme","rhythm","ribbon","rice","rich","rick","rid","ride","rider","ridge","rife","rifle","rift","right","rigid","rile","rim","ring","rinse","riot","ripe","ripen","ripple","rise","risk","risky","rite","ritual","ritz","rival","river","road","roar","roast","rob","robe","robert","robin","robot","robust","rock","rocket","rocky","rod","rode","rodent","rogue","role","roll","roman","rome","roof","room","root","rope","rose","rosy","rot","rotate","rotor","rotten","rouge","rough","round","route","rover","row","royal","rub","rubber","rubble","ruby","rudder","rude","rug","rugby","ruin","rule","ruler","rumble","rump","run","rune","rung","runway","rural","rush","russia","rust","rustic","rusty","sack","sacred","sad","saddle","sadism","sadly","safari","safe","safely","safer","safety","saga","sage","sahara","said","sail","sailor","saint","sake","salad","salary","sale","saline","saliva","salmon","saloon","salt","salty","salute","sam","same","sample","sand","sandy","sane","sash","satin","satire","saturn","sauce","saucer","saudi","sauna","savage","save","saw","say","scale","scalp","scan","scant","scar","scarce","scare","scarf","scary","scene","scenic","scent","school","scold","scope","score","scorn","scotch","scott","scout","scrap","scrape","scream","screen","screw","script","scroll","scrub","scum","sea","seal","seam","seaman","search","season","seat","second","secret","sect","sector","secure","see","seed","seeing","seek","seem","seize","seldom","select","self","sell","seller","semi","senate","send","senile","senior","sense","sensor","sent","sentry","seoul","sequel","serene","serial","series","sermon","serum","serve","server","set","settle","seven","severe","sew","sewage","shabby","shade","shadow","shady","shaft","shaggy","shah","shake","shaky","shall","sham","shame","shape","share","shark","sharp","shawl","she","shear","sheen","sheep","sheer","sheet","shelf","shell","sherry","shield","shift","shine","shiny","ship","shire","shirk","shirt","shiver","shock","shoe","shook","shoot","shop","shore","short","shot","should","shout","show","shower","shrank","shrewd","shrill","shrimp","shrine","shrink","shrub","shrug","shut","shy","shyly","sick","side","siege","sigh","sight","sigma","sign","signal","silent","silk","silken","silky","sill","silly","silo","silver","simple","simply","since","sinful","sing","singer","single","sink","sir","sire","siren","sister","sit","site","sitter","six","sixth","sixty","size","sketch","skill","skin","skinny","skip","skirt","skull","sky","slab","slack","slain","slam","slang","slap","slat","slate","slave","sleek","sleep","sleepy","sleeve","slice","slick","slid","slide","slight","slim","slimy","sling","slip","slit","slogan","slope","sloppy","slot","slow","slowly","slug","slum","slump","smack","small","smart","smash","smear","smell","smelly","smelt","smile","smite","smoke","smoky","smooth","smug","snack","snail","snake","snap","snatch","sneak","snow","snowy","snug","soak","soap","sober","soccer","social","sock","socket","socks","soda","sodden","sodium","sofa","soft","soften","softly","soggy","soil","solar","sold","sole","solely","solemn","solid","solo","solve","some","son","sonar","sonata","song","sonic","sony","soon","sooner","soot","soothe","sordid","sore","sorrow","sorry","sort","soul","sound","soup","sour","source","soviet","sow","space","spade","spain","span","spare","spark","sparse","spasm","spat","spate","speak","spear","speech","speed","speedy","spell","spend","sphere","spice","spicy","spider","spiky","spill","spin","spinal","spine","spiral","spirit","spit","spite","splash","split","spoil","spoke","sponge","spoon","sport","spot","spouse","spray","spread","spree","spring","sprint","spur","squad","square","squash","squat","squid","stab","stable","stack","staff","stage","stain","stair","stairs","stake","stale","stall","stamp","stance","stand","staple","star","starch","stare","stark","start","starve","state","static","statue","status","stay","stead","steady","steak","steal","steam","steel","steep","steer","stem","stench","step","stereo","stern","stew","stick","sticky","stiff","stifle","stigma","still","sting","stint","stir","stitch","stock","stocky","stone","stony","stool","stop","store","storm","stormy","story","stout","stove","stow","strain","strait","strand","strap","strata","straw","stray","streak","stream","street","stress","strict","stride","strife","strike","string","strip","stripe","strive","stroke","stroll","strong","stud","studio","study","stuff","stuffy","stunt","stupid","sturdy","style","submit","subtle","subtly","suburb","such","sudden","sue","suez","suffer","sugar","suit","suite","suitor","sullen","sultan","sum","summer","summit","summon","sun","sunday","sunny","sunset","super","superb","supper","supple","supply","sure","surely","surf","surge","survey","suture","swamp","swan","swap","swarm","sway","swear","sweat","sweaty","sweden","sweep","sweet","swell","swift","swim","swine","swing","swirl","swiss","switch","sword","swore","sydney","symbol","synod","syntax","syria","syrup","system","table","tablet","taboo","tacit","tackle","tact","tactic","tail","tailor","taiwan","take","tale","talent","talk","tall","tally","tame","tampa","tan","tandem","tangle","tank","tap","tape","target","tariff","tarp","tart","tarzan","task","taste","tasty","tattoo","taurus","taut","tavern","tax","taxi","tea","teach","teak","team","tear","tease","tech","teeth","tell","temper","temple","tempo","tempt","ten","tenant","tend","tender","tendon","tennis","tenor","tense","tent","tenth","tenure","teresa","term","terror","terse","test","texas","text","thank","thaw","them","theme","thence","theory","there","these","thesis","they","thick","thief","thigh","thin","thing","think","third","thirst","thirty","this","thomas","thorn","those","though","thread","threat","three","thrill","thrive","throat","throne","throng","throw","thrust","thud","thug","thumb","thus","thyme","tibet","tick","ticket","tidal","tide","tidy","tie","tier","tiger","tight","tile","till","tilt","timber","time","timid","tin","tiny","tip","tire","tissue","title","toad","toast","today","toe","toilet","token","tokyo","told","toll","tom","tomato","tomb","tonal","tone","tongue","tonic","too","took","tool","tooth","top","topaz","topic","torch","torque","torso","tort","toss","total","touch","tough","tour","toward","towel","tower","town","toxic","toxin","toy","trace","track","tract","trade","tragic","trail","train","trait","tram","trance","trap","trauma","travel","tray","tread","treat","treaty","treble","tree","trek","tremor","trench","trend","trendy","trial","tribal","tribe","trick","tricky","tried","trifle","trim","trio","trip","triple","troop","trophy","trot","trough","trout","truce","truck","true","truly","trunk","trust","truth","try","tube","tumble","tuna","tundra","tune","tunic","tunnel","turban","turf","turk","turkey","turn","turtle","tutor","tweed","twelve","twenty","twice","twin","twist","two","tycoon","tying","type","tyrant","ugly","ulcer","ultra","umpire","unable","uncle","under","uneasy","unfair","unify","union","unique","unit","unite","unity","unlike","unrest","unruly","until","update","upheld","uphill","uphold","upon","upper","uproar","upset","upshot","uptake","upturn","upward","urban","urge","urgent","urging","urine","usable","usage","use","useful","user","usual","utmost","utter","vacant","vacuum","vague","vain","valet","valid","valley","value","valve","van","vanish","vanity","vary","vase","vast","vat","vault","vector","veil","vein","velvet","vendor","veneer","venice","venom","vent","venue","venus","verb","verbal","verge","verify","verity","verse","versus","very","vessel","vest","vet","veto","via","viable","vicar","vice","victim","victor","video","vienna","view","vigil","viking","vile","villa","vine","vinyl","viola","violet","violin","viral","virgo","virtue","virus","visa","vision","visit","visual","vital","vivid","vocal","vodka","vogue","voice","void","volley","volume","vote","vowel","voyage","vulgar","wade","wage","waist","wait","waiter","wake","walk","walker","wall","wallet","walnut","wander","want","war","warden","warm","warmth","warn","warp","warsaw","wary","was","wash","wasp","waste","watch","water","watery","wave","wax","way","weak","weaken","wealth","weapon","wear","weary","weave","wedge","wee","weed","week","weekly","weep","weigh","weight","weird","well","were","west","wet","whale","wharf","what","wheat","wheel","when","whence","where","which","whiff","while","whim","whip","whisky","white","who","whole","wholly","whom","whose","why","wicked","wide","widely","widen","wider","widow","width","wife","wig","wild","wildly","will","willow","wily","win","wind","window","windy","wine","wing","wink","winner","winter","wipe","wire","wisdom","wise","wish","wit","witch","with","within","witty","wizard","woke","wolf","wolves","woman","womb","won","wonder","wood","wooden","woods","woody","wool","word","work","worker","world","worm","worry","worse","worst","worth","worthy","would","wound","wrap","wrath","wreath","wreck","wring","wrist","writ","write","writer","wrong","xerox","yacht","yale","yard","yarn","yeah","year","yeard","yeast","yellow","yet","yield","yogurt","yolk","you","young","your","youth","zaire","zeal","zebra","zenith","zero","zeus","zigzag","zinc","zombie","zone"],bip39Words=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"];async function digest$1(e){return new Uint8Array(await crypto.subtle.digest("SHA-256",e))}async function toSeed(e,t){const n=e.join(" "),r=`mnemonic${t}`.normalize("NFKD");return deriveKey(HashAlgorithm.Sha512,n,r,2048,64)}function legacy1(e,t){const n=convertRadix(e.map(e=>t.indexOf(e.toLowerCase())),t.length,256,33),r=n[n.length-1],o=new Uint8Array(n.length-1);for(let e=0;e<n.length-1;e+=1)o[e]=n[e]^r;return[o,r]}async function legacy2(e,t){const n=11*e.length,r=[];r.fill(!1,0,n);for(const[n,o]of e.entries()){const e=t.indexOf(o.toLowerCase());if(e<0)throw new Error(`Word not found in wordlist: ${o}`);for(let t=0;t<11;t+=1)r[11*n+t]=!!(e&1<<10-t)}const o=n/33,a=n-o,i=new Uint8Array(a/8);for(let e=0;e<i.length;e+=1)for(let t=0;t<8;t+=1)r[8*e+t]&&(i[e]|=1<<7-t);const s=bytesToBits(await digest$1(i));for(let e=0;e<o;e+=1)if(r[a+e]!==s[e])throw new Error("Checksum mismatch");return i}function crc8(e){let t=255;for(let n=0;n<e.length-1;n+=1){t^=e[n];for(let e=0;e<8;e+=1)t=t>>>1^(1&t?178:0)}return 255^t}function convertRadix(e,t,n,r){let o=new BigNumber(0);for(const n of e)o=o.times(t),o=o.plus(n);const a=new Uint8Array(r);for(let e=r-1;e>=0;e-=1){const t=o.dividedToIntegerBy(n),r=o.modulo(n);o=t,a[e]=r.toNumber()}return a}function bytesToBits(e){const t=[];t.fill(!1,0,8*e.length);for(let n=0;n<e.length;n+=1)for(let r=0;r<8;r+=1)t[8*n+r]=!!(e[n]&1<<7-r);return t}const ED25519_SEED_TEXT="ed25519 seed",ECDSA_SEED_TEXT="Bitcoin seed",HARDENED=2147483648,HEDERA_PATH=[44,3030,0,0],SLIP44_ECDSA_HEDERA_PATH=[44|HARDENED,3030|HARDENED,0|HARDENED,0],SLIP44_ECDSA_ETH_PATH=[44|HARDENED,60|HARDENED,0|HARDENED,0,0];let Mnemonic$1=class e{constructor({words:e}){this.words=e}static generate(){return e._generate(24)}static generate12(){return e._generate(12)}static async _generate(t){let n;if(12===t)n=16;else{if(24!==t)throw new Error(`unsupported phrase length ${t}, only 12 or 24 are supported`);n=32}const r=await bytesAsync(n),o=(bytesToBinary(Array.from(r))+await deriveChecksumBits(r)).match(/(.{1,11})/g),a=(null!=o?o:[]).map(e=>bip39Words[binaryToByte(e)]);return new e({words:a})}static fromWords(t){return new e({words:t})._validate()}toPrivateKey(e=""){return this.toEd25519PrivateKey(e)}async toEd25519PrivateKey(e="",t=HEDERA_PATH){let{keyData:n,chainCode:r}=await this._toKeyData(e,ED25519_SEED_TEXT);for(const e of t)({keyData:n,chainCode:r}=await derive(n,r,e));const o=nacl.sign.keyPair.fromSeed(n);if(null==CACHE$1.privateKeyConstructor)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyConstructor(new Ed25519PrivateKey(o,r))}async toStandardEd25519PrivateKey(t="",n){const r=await e.toSeed(this.words,t);let o=await PrivateKey$1.fromSeedED25519(r);n=null==n?0:n;for(const e of[44,3030,0,0,n])o=await o.derive(e);return o}async toEcdsaPrivateKey(e="",t=HEDERA_PATH){let{keyData:n,chainCode:r}=await this._toKeyData(e,ECDSA_SEED_TEXT);for(const e of t)({keyData:n,chainCode:r}=await derive$1(n,r,e));if(null==CACHE$1.privateKeyConstructor)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyConstructor(new EcdsaPrivateKey(fromBytes(n),r))}async toStandardECDSAsecp256k1PrivateKey(t="",n){const r=await e.toSeed(this.words,t);let o=await PrivateKey$1.fromSeedECDSAsecp256k1(r);n=null==n?0:n;for(const e of[toHardenedIndex(44),toHardenedIndex(3030),toHardenedIndex(0),0,n])o=await o.derive(e);return o}static async toSeed(e,t){return await toSeed(e,t)}async _toKeyData(e,t){const n=await toSeed(this.words,e),r=await hash(HashAlgorithm.Sha512,t,n);return{keyData:r.subarray(0,32),chainCode:r.subarray(32)}}static async fromString(t){return e.fromWords(t.split(/\s|,/))}async _validate(){if(22===this.words.length){const e=this.words.reduce((e,t,n)=>legacyWords.includes(t.toLowerCase())?e:[...e,n],[]);if(e.length>0)throw new BadMnemonicError(this,BadMnemonicReason.UnknownWords,e);const[t,n]=legacy1(this.words,legacyWords);if(n!==crc8(t))throw new BadMnemonicError(this,BadMnemonicReason.ChecksumMismatch,[])}else{if(12!==this.words.length&&24!==this.words.length)throw new BadMnemonicError(this,BadMnemonicReason.BadLength,[]);const e=this.words.reduce((e,t,n)=>bip39Words.includes(t)?e:[...e,n],[]);if(e.length>0)throw new BadMnemonicError(this,BadMnemonicReason.UnknownWords,e);const t=this.words.map(e=>bip39Words.indexOf(e).toString(2).padStart(11,"0")).join(""),n=32*Math.floor(t.length/33),r=t.slice(0,n),o=t.slice(n),a=r.match(/(.{1,8})/g).map(binaryToByte);if(await deriveChecksumBits(Uint8Array.from(a))!==o)throw new BadMnemonicError(this,BadMnemonicReason.ChecksumMismatch,[])}return this}async toLegacyPrivateKey(){let e;if(22===this.words.length?[e]=legacy1(this.words,legacyWords):e=await legacy2(this.words,bip39Words),null==CACHE$1.privateKeyFromBytes)throw new Error("PrivateKey not found in cache");return CACHE$1.privateKeyFromBytes(e)}toString(){return this.words.join(" ")}};function binaryToByte(e){return parseInt(e,2)}function bytesToBinary(e){return e.map(e=>e.toString(2).padStart(8,"0")).join("")}async function deriveChecksumBits(e){const t=8*e.length/32,n=await digest$1(e);return bytesToBinary(Array.from(n)).slice(0,t)}function arrayEqual(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=new DataView(t.buffer,t.byteOffset,t.byteLength);let o=e.byteLength;for(;o--;)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}class Cache{constructor(){this._timeDrift=0,this._contractId=null,this._keyList=null,this._thresholdKey=null,this._publicKeyED25519=null,this._publicKeyECDSA=null,this._privateKeyConstructor=null,this._mnemonicFromString=null,this._accountIdConstructor=null,this._delegateContractId=null,this._evmAddress=null,this._ethereumTransactionDataLegacyFromBytes=null,this._ethereumTransactionDataEip1559FromBytes=null,this._ethereumTransactionDataEip2930FromBytes=null,this._ethereumTransactionDataEip7702FromBytes=null,this._transactionReceiptQueryConstructor=null,this._transactionRecordQueryConstructor=null}setTimeDrift(e){this._timeDrift=e}get timeDrift(){if(null==this._timeDrift)throw new Error("Cache.timeDrift was used before it was set");return this._timeDrift}setContractId(e){this._contractId=e}get contractId(){if(null==this._contractId)throw new Error("Cache.contractId was used before it was set");return this._contractId}setKeyList(e){this._keyList=e}get keyList(){if(null==this._keyList)throw new Error("Cache.keyList was used before it was set");return this._keyList}setThresholdKey(e){this._thresholdKey=e}get thresholdKey(){if(null==this._thresholdKey)throw new Error("Cache.thresholdKey was used before it was set");return this._thresholdKey}setPublicKeyED25519(e){this._publicKeyED25519=e}get publicKeyED25519(){if(null==this._publicKeyED25519)throw new Error("Cache.publicKeyED25519 was used before it was set");return this._publicKeyED25519}setPublicKeyECDSA(e){this._publicKeyECDSA=e}get publicKeyECDSA(){if(null==this._publicKeyECDSA)throw new Error("Cache.publicKeyECDSA was used before it was set");return this._publicKeyECDSA}setPrivateKeyConstructor(e){this._privateKeyConstructor=e}get privateKeyConstructor(){if(null==this._privateKeyConstructor)throw new Error("Cache.privateKeyConstructor was used before it was set");return this._privateKeyConstructor}setMnemonicFromString(e){this._mnemonicFromString=e}get mnemonicFromString(){if(null==this._mnemonicFromString)throw new Error("Cache.mnemonicFromString was used before it was set");return this.mnemonicFromString}setAccountIdConstructor(e){this._accountIdConstructor=e}get accountIdConstructor(){if(null==this._accountIdConstructor)throw new Error("Cache.accountIdConstructor was used before it was set");return this._accountIdConstructor}setDelegateContractId(e){this._delegateContractId=e}get delegateContractId(){if(null==this._delegateContractId)throw new Error("Cache.delegateContractId was used before it was set");return this._delegateContractId}setEvmAddress(e){this._evmAddress=e}get evmAddress(){if(null==this._evmAddress)throw new Error("Cache.evmAddress was used before it was set");return this._evmAddress}setEthereumTransactionDataLegacyFromBytes(e){this._ethereumTransactionDataLegacyFromBytes=e}get ethereumTransactionDataLegacyFromBytes(){if(null==this._ethereumTransactionDataLegacyFromBytes)throw new Error("Cache.ethereumTransactionDataLegacyFromBytes was used before it was set");return this._ethereumTransactionDataLegacyFromBytes}setEthereumTransactionDataEip1559FromBytes(e){this._ethereumTransactionDataEip1559FromBytes=e}get ethereumTransactionDataEip1559FromBytes(){if(null==this._ethereumTransactionDataEip1559FromBytes)throw new Error("Cache.ethereumTransactionDataEip1559FromBytes was used before it was set");return this._ethereumTransactionDataEip1559FromBytes}setEthereumTransactionDataEip2930FromBytes(e){this._ethereumTransactionDataEip2930FromBytes=e}get ethereumTransactionDataEip2930FromBytes(){if(null==this._ethereumTransactionDataEip2930FromBytes)throw new Error("Cache.ethereumTransactionDataEip2930FromBytes was used before it was set");return this._ethereumTransactionDataEip2930FromBytes}setEthereumTransactionDataEip7702FromBytes(e){this._ethereumTransactionDataEip7702FromBytes=e}get ethereumTransactionDataEip7702FromBytes(){if(null==this._ethereumTransactionDataEip7702FromBytes)throw new Error("Cache.ethereumTransactionDataEip7702FromBytes was used before it was set");return this._ethereumTransactionDataEip7702FromBytes}setTransactionReceiptQueryConstructor(e){this._transactionReceiptQueryConstructor=e}get transactionReceiptQueryConstructor(){if(null==this._transactionReceiptQueryConstructor)throw new Error("Cache.transactionReceiptQueryConstructor was used before it was set");return this._transactionReceiptQueryConstructor}setTransactionRecordQueryConstructor(e){this._transactionRecordQueryConstructor=e}get transactionRecordQueryConstructor(){if(null==this._transactionRecordQueryConstructor)throw new Error("Cache.transactionRecordQueryConstructor was used before it was set");return this._transactionRecordQueryConstructor}}const CACHE=new Cache;class Key{_toProtobufKey(){throw new Error("not implemented")}static _fromProtobufKey(e){return null!=e.contractID?CACHE.contractId(e.contractID):null!=e.delegatableContractId?CACHE.delegateContractId(e.delegatableContractId):null!=e.ed25519&&e.ed25519.byteLength>0?CACHE.publicKeyED25519(e.ed25519):null!=e.ECDSASecp256k1&&e.ECDSASecp256k1.byteLength>0?CACHE.publicKeyECDSA(e.ECDSASecp256k1):null!=e.thresholdKey&&null!=e.thresholdKey.threshold?CACHE.thresholdKey(e.thresholdKey):null!=e.keyList?CACHE.keyList(e.keyList):null}}class PublicKey extends Key{constructor(e){super(),this._key=e}static fromBytes(e){return new PublicKey(PublicKey$1.fromBytes(e))}static fromBytesED25519(e){return new PublicKey(PublicKey$1.fromBytesED25519(e))}static fromBytesECDSA(e){return new PublicKey(PublicKey$1.fromBytesECDSA(e))}static fromString(e){return new PublicKey(PublicKey$1.fromString(e))}static fromStringECDSA(e){return new PublicKey(PublicKey$1.fromStringECDSA(e))}static fromStringED25519(e){return new PublicKey(PublicKey$1.fromStringED25519(e))}verify(e,t){return this._key.verify(e,t)}verifyTransaction(e){e._requireFrozen(),e.isFrozen()||e.freeze();for(const t of e._signedTransactions.list)if(!this._verifySignedTransaction(t))return!1;return!0}_verifySignedTransaction(e){const t=e.sigMap;if(null==t||null==t.sigPair)return!1;const n=e.bodyBytes,r=this.toBytesRaw();for(const e of t.sigPair){if(!arrayEqual(e.pubKeyPrefix,r))continue;const t=this._extractSignature(e);return null!=t&&this.verify(n,t)}return!1}_extractSignature(e){return null!=e.ed25519?e.ed25519:null!=e.ECDSASecp256k1?e.ECDSASecp256k1:null}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toEthereumAddress(){return this._key.toEthereumAddress()}toEvmAddress(){return this._key.toEthereumAddress()}toString(){return this._key.toString()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}equals(e){return this._key.equals(e._key)}_toProtobufKey(){switch(this._key._type){case"ED25519":return{ed25519:this._key.toBytesRaw()};case"secp256k1":return{ECDSASecp256k1:this._key.toBytesRaw()};default:throw new Error(`unrecognized key type ${this._key._type}`)}}_toProtobufSignature(e){switch(this._key._type){case"ED25519":return{pubKeyPrefix:this._key.toBytesRaw(),ed25519:e};case"secp256k1":return{pubKeyPrefix:this._key.toBytesRaw(),ECDSASecp256k1:e};default:throw new Error(`unrecognized key type ${this._key._type}`)}}get type(){return this._key._type}toAccountId(e,t){return CACHE.accountIdConstructor(e,t,this)}static unusableKey(){return PublicKey.fromStringED25519("0000000000000000000000000000000000000000000000000000000000000000")}}CACHE.setPublicKeyED25519(e=>PublicKey.fromBytesED25519(e)),CACHE.setPublicKeyECDSA(e=>PublicKey.fromBytesECDSA(e));const version="6.16.0";function checkType(e,t,n){const r=t.split("|").map(e=>e.trim());for(let n=0;n<r.length;n++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof e===t)return}const o=new Error(`invalid value for type ${t}`);throw o.code="INVALID_ARGUMENT",o.argument=`value.${n}`,o.value=e,o}function defineProperties(e,t,n){for(let r in t){let o=t[r];const a=n?n[r]:null;a&&checkType(o,a,r),Object.defineProperty(e,r,{enumerable:!0,value:o,writable:!1})}}function stringify(e,t){if(null==e)return"null";if(null==t&&(t=new Set),"object"==typeof e){if(t.has(e))return"[Circular]";t.add(e)}if(Array.isArray(e))return"[ "+e.map(e=>stringify(e,t)).join(", ")+" ]";if(e instanceof Uint8Array){const t="0123456789abcdef";let n="0x";for(let r=0;r<e.length;r++)n+=t[e[r]>>4],n+=t[15&e[r]];return n}if("object"==typeof e&&"function"==typeof e.toJSON)return stringify(e.toJSON(),t);switch(typeof e){case"boolean":case"number":case"symbol":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const n=Object.keys(e);return n.sort(),"{ "+n.map(n=>`${stringify(n,t)}: ${stringify(e[n],t)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function isError(e,t){return e&&e.code===t}function makeError(e,t,n){let r,o=e;{const r=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${stringify(n)}`);for(const e in n){if("shortMessage"===e)continue;const t=n[e];r.push(e+"="+stringify(t))}}r.push(`code=${t}`),r.push(`version=${version}`),r.length&&(e+=" ("+r.join(", ")+")")}switch(t){case"INVALID_ARGUMENT":r=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(e);break;default:r=new Error(e)}return defineProperties(r,{code:t}),n&&Object.assign(r,n),null==r.shortMessage&&defineProperties(r,{shortMessage:o}),r}function assert(e,t,n,r){if(!e)throw makeError(t,n,r)}function assertArgument(e,t,n,r){assert(e,t,"INVALID_ARGUMENT",{argument:n,value:r})}function assertArgumentCount(e,t,n){null==n&&(n=""),n&&(n=": "+n),assert(e>=t,"missing argument"+n,"MISSING_ARGUMENT",{count:e,expectedCount:t}),assert(e<=t,"too many arguments"+n,"UNEXPECTED_ARGUMENT",{count:e,expectedCount:t})}function assertPrivate(e,t,n){if(null==n&&(n=""),e!==t){let e=n,t="new";n&&(e+=".",t+=" "+n),assert(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}function _getBytes(e,t,n){if(e instanceof Uint8Array)return n?new Uint8Array(e):e;if("string"==typeof e&&e.length%2==0&&e.match(/^0x[0-9a-f]*$/i)){const t=new Uint8Array((e.length-2)/2);let n=2;for(let r=0;r<t.length;r++)t[r]=parseInt(e.substring(n,n+2),16),n+=2;return t}assertArgument(!1,"invalid BytesLike value",t||"value",e)}function getBytes(e,t){return _getBytes(e,t,!1)}function getBytesCopy(e,t){return _getBytes(e,t,!0)}["NFD","NFC","NFKD","NFKC"].reduce((e,t)=>{try{if("test"!=="test".normalize(t))throw new Error("bad");if("NFD"===t){const e=String.fromCharCode(233).normalize("NFD");if(e!==String.fromCharCode(101,769))throw new Error("broken")}e.push(t)}catch(e){}return e},[]);const HexCharacters="0123456789abcdef";function hexlify(e){const t=getBytes(e);let n="0x";for(let e=0;e<t.length;e++){const r=t[e];n+=HexCharacters[(240&r)>>4]+HexCharacters[15&r]}return n}function concat(e){return"0x"+e.map(e=>hexlify(e).substring(2)).join("")}const BN_0$2=BigInt(0),BN_1$1=BigInt(1),maxValue=9007199254740991;function fromTwos(e,t){const n=getUint(e,"value"),r=BigInt(getNumber(t,"width"));if(assert(n>>r===BN_0$2,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),n>>r-BN_1$1){return-((~n&(BN_1$1<<r)-BN_1$1)+BN_1$1)}return n}function toTwos(e,t){let n=getBigInt(e,"value");const r=BigInt(getNumber(t,"width")),o=BN_1$1<<r-BN_1$1;if(n<BN_0$2){n=-n,assert(n<=o,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e});return(~n&(BN_1$1<<r)-BN_1$1)+BN_1$1}return assert(n<o,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),n}function mask(e,t){const n=getUint(e,"value"),r=BigInt(getNumber(t,"bits"));return n&(BN_1$1<<r)-BN_1$1}function getBigInt(e,t){switch(typeof e){case"bigint":return e;case"number":return assertArgument(Number.isInteger(e),"underflow",t||"value",e),assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(n){assertArgument(!1,`invalid BigNumberish string: ${n.message}`,t||"value",e)}}assertArgument(!1,"invalid BigNumberish value",t||"value",e)}function getUint(e,t){const n=getBigInt(e,t);return assert(n>=BN_0$2,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),n}const Nibbles="0123456789abcdef";function toBigInt(e){if(e instanceof Uint8Array){let t="0x0";for(const n of e)t+=Nibbles[n>>4],t+=Nibbles[15&n];return BigInt(t)}return getBigInt(e)}function getNumber(e,t){switch(typeof e){case"bigint":return assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),Number(e);case"number":return assertArgument(Number.isInteger(e),"underflow",t||"value",e),assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return getNumber(BigInt(e),t)}catch(n){assertArgument(!1,`invalid numeric string: ${n.message}`,t||"value",e)}}assertArgument(!1,"invalid numeric value",t||"value",e)}function toNumber(e){return getNumber(toBigInt(e))}function toBeHex(e,t){const n=getUint(e,"value");let r=n.toString(16);{const o=getNumber(t,"width");if(0===o&&n===BN_0$2)return"0x";for(assert(2*o>=r.length,`value exceeds width (${o} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});r.length<2*o;)r="0"+r}return"0x"+r}function toBeArray(e,t){const n=getUint(e,"value");if(n===BN_0$2){return new Uint8Array(0)}let r=n.toString(16);r.length%2&&(r="0"+r);const o=new Uint8Array(r.length/2);for(let e=0;e<o.length;e++){const t=2*e;o[e]=parseInt(r.substring(t,t+2),16)}return o}function errorFunc(e,t,n,r,o){assertArgument(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",n)}function ignoreFunc(e,t,n,r,o){if("BAD_PREFIX"===e||"UNEXPECTED_CONTINUE"===e){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return"OVERRUN"===e?n.length-t-1:0}function replaceFunc(e,t,n,r,o){return"OVERLONG"===e?(assertArgument("number"==typeof o,"invalid bad code point for replacement","badCodepoint",o),r.push(o),0):(r.push(65533),ignoreFunc(e,t,n))}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(e,t){null==t&&(t=Utf8ErrorFuncs.error);const n=getBytes(e,"bytes"),r=[];let o=0;for(;o<n.length;){const e=n[o++];if(!(e>>7)){r.push(e);continue}let a=null,i=null;if(192==(224&e))a=1,i=127;else if(224==(240&e))a=2,i=2047;else{if(240!=(248&e)){o+=t(128==(192&e)?"UNEXPECTED_CONTINUE":"BAD_PREFIX",o-1,n,r);continue}a=3,i=65535}if(o-1+a>=n.length){o+=t("OVERRUN",o-1,n,r);continue}let s=e&(1<<8-a-1)-1;for(let e=0;e<a;e++){let e=n[o];if(128!=(192&e)){o+=t("MISSING_CONTINUE",o,n,r),s=null;break}s=s<<6|63&e,o++}null!==s&&(s>1114111?o+=t("OUT_OF_RANGE",o-1-a,n,r,s):s>=55296&&s<=57343?o+=t("UTF16_SURROGATE",o-1-a,n,r,s):s<=i?o+=t("OVERLONG",o-1-a,n,r,s):r.push(s))}return r}function toUtf8Bytes(e,t){assertArgument("string"==typeof e,"invalid string value","str",e);let n=[];for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){t++;const o=e.charCodeAt(t);assertArgument(t<e.length&&56320==(64512&o),"invalid surrogate pair","str",e);const a=65536+((1023&r)<<10)+(1023&o);n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(63&a|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return new Uint8Array(n)}function _toUtf8String(e){return e.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))).join("")}function toUtf8String(e,t){return _toUtf8String(getUtf8CodePoints(e,t))}function hexlifyByte(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function unarrayifyInteger(e,t,n){let r=0;for(let o=0;o<n;o++)r=256*r+e[t+o];return r}function _decodeChildren(e,t,n,r){const o=[];for(;n<t+1+r;){const a=_decode(e,n);o.push(a.result),assert((n+=a.consumed)<=t+1+r,"child data too short","BUFFER_OVERRUN",{buffer:e,length:r,offset:t})}return{consumed:1+r,result:o}}function _decode(e,t){assert(0!==e.length,"data too short","BUFFER_OVERRUN",{buffer:e,length:0,offset:1});const n=t=>{assert(t<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:t})};if(e[t]>=248){const r=e[t]-247;n(t+1+r);const o=unarrayifyInteger(e,t+1,r);return n(t+1+r+o),_decodeChildren(e,t,t+1+r,r+o)}if(e[t]>=192){const r=e[t]-192;return n(t+1+r),_decodeChildren(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;n(t+1+r);const o=unarrayifyInteger(e,t+1,r);n(t+1+r+o);return{consumed:1+r+o,result:hexlify(e.slice(t+1+r,t+1+r+o))}}if(e[t]>=128){const r=e[t]-128;n(t+1+r);return{consumed:1+r,result:hexlify(e.slice(t+1,t+1+r))}}return{consumed:1,result:hexlifyByte(e[t])}}function decodeRlp(e){const t=getBytes(e,"data"),n=_decode(t,0);return assertArgument(n.consumed===t.length,"unexpected junk after rlp payload","data",e),n.result}function arrayifyInteger(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function _encode(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(_encode(e))}),t.length<=55)return t.unshift(192+t.length),t;const n=arrayifyInteger(t.length);return n.unshift(247+n.length),n.concat(t)}const t=Array.prototype.slice.call(getBytes(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=arrayifyInteger(t.length);return n.unshift(183+n.length),n.concat(t)}const nibbles="0123456789abcdef";function encodeRlp(e){let t="0x";for(const n of _encode(e))t+=nibbles[n>>4],t+=nibbles[15&n];return t}const WordSize=32,Padding=new Uint8Array(WordSize),passProperties=["then"],_guard$1={},resultNames=new WeakMap;function getNames(e){return resultNames.get(e)}function setNames(e,t){resultNames.set(e,t)}function throwError(e,t){const n=new Error(`deferred error during ABI decoding triggered accessing ${e}`);throw n.error=t,n}function toObject(e,t,n){return e.indexOf(null)>=0?t.map((e,t)=>e instanceof Result?toObject(getNames(e),e,n):e):e.reduce((e,r,o)=>{let a=t.getValue(r);return r in e||(n&&a instanceof Result&&(a=toObject(getNames(a),a,n)),e[r]=a),e},{})}class Result extends Array{#e;constructor(...e){const t=e[0];let n=e[1],r=(e[2]||[]).slice(),o=!0;t!==_guard$1&&(n=e,r=[],o=!1),super(n.length),n.forEach((e,t)=>{this[t]=e});const a=r.reduce((e,t)=>("string"==typeof t&&e.set(t,(e.get(t)||0)+1),e),new Map);if(setNames(this,Object.freeze(n.map((e,t)=>{const n=r[t];return null!=n&&1===a.get(n)?n:null}))),this.#e=[],null==this.#e&&this.#e,!o)return;Object.freeze(this);const i=new Proxy(this,{get:(e,t,n)=>{if("string"==typeof t){if(t.match(/^[0-9]+$/)){const n=getNumber(t,"%index");if(n<0||n>=this.length)throw new RangeError("out of result range");const r=e[n];return r instanceof Error&&throwError(`index ${n}`,r),r}if(passProperties.indexOf(t)>=0)return Reflect.get(e,t,n);const r=e[t];if(r instanceof Function)return function(...t){return r.apply(this===n?e:this,t)};if(!(t in e))return e.getValue.apply(this===n?e:this,[t])}return Reflect.get(e,t,n)}});return setNames(i,getNames(this)),i}toArray(e){const t=[];return this.forEach((n,r)=>{n instanceof Error&&throwError(`index ${r}`,n),e&&n instanceof Result&&(n=n.toArray(e)),t.push(n)}),t}toObject(e){const t=getNames(this);return t.reduce((n,r,o)=>(assert(null!=r,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),toObject(t,this,e)),{})}slice(e,t){null==e&&(e=0),e<0&&(e+=this.length)<0&&(e=0),null==t&&(t=this.length),t<0&&(t+=this.length)<0&&(t=0),t>this.length&&(t=this.length);const n=getNames(this),r=[],o=[];for(let a=e;a<t;a++)r.push(this[a]),o.push(n[a]);return new Result(_guard$1,r,o)}filter(e,t){const n=getNames(this),r=[],o=[];for(let a=0;a<this.length;a++){const i=this[a];i instanceof Error&&throwError(`index ${a}`,i),e.call(t,i,a,this)&&(r.push(i),o.push(n[a]))}return new Result(_guard$1,r,o)}map(e,t){const n=[];for(let r=0;r<this.length;r++){const o=this[r];o instanceof Error&&throwError(`index ${r}`,o),n.push(e.call(t,o,r,this))}return n}getValue(e){const t=getNames(this).indexOf(e);if(-1===t)return;const n=this[t];return n instanceof Error&&throwError(`property ${JSON.stringify(e)}`,n.error),n}static fromItems(e,t){return new Result(_guard$1,e,t)}}function getValue(e){let t=toBeArray(e);return assert(t.length<=WordSize,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:WordSize,offset:t.length}),t.length!==WordSize&&(t=getBytesCopy(concat([Padding.slice(t.length%WordSize),t]))),t}class Coder{name;type;localName;dynamic;constructor(e,t,n,r){defineProperties(this,{name:e,type:t,localName:n,dynamic:r},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){assertArgument(!1,e,this.localName,t)}}class Writer{#t;#n;constructor(){this.#t=[],this.#n=0}get data(){return concat(this.#t)}get length(){return this.#n}#r(e){return this.#t.push(e),this.#n+=e.length,e.length}appendWriter(e){return this.#r(getBytesCopy(e.data))}writeBytes(e){let t=getBytesCopy(e);const n=t.length%WordSize;return n&&(t=getBytesCopy(concat([t,Padding.slice(n)]))),this.#r(t)}writeValue(e){return this.#r(getValue(e))}writeUpdatableValue(){const e=this.#t.length;return this.#t.push(Padding),this.#n+=WordSize,t=>{this.#t[e]=getValue(t)}}}class Reader{allowLoose;#t;#o;#a;#i;#s;constructor(e,t,n){defineProperties(this,{allowLoose:!!t}),this.#t=getBytesCopy(e),this.#a=0,this.#i=null,this.#s=null!=n?n:1024,this.#o=0}get data(){return hexlify(this.#t)}get dataLength(){return this.#t.length}get consumed(){return this.#o}get bytes(){return new Uint8Array(this.#t)}#c(e){if(this.#i)return this.#i.#c(e);this.#a+=e,assert(this.#s<1||this.#a<=this.#s*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#s} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:getBytesCopy(this.#t),offset:this.#o,length:e,info:{bytesRead:this.#a,dataLength:this.dataLength}})}#u(e,t,n){let r=Math.ceil(t/WordSize)*WordSize;return this.#o+r>this.#t.length&&(this.allowLoose&&n&&this.#o+t<=this.#t.length?r=t:assert(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:getBytesCopy(this.#t),length:this.#t.length,offset:this.#o+r})),this.#t.slice(this.#o,this.#o+r)}subReader(e){const t=new Reader(this.#t.slice(this.#o+e),this.allowLoose,this.#s);return t.#i=this,t}readBytes(e,t){let n=this.#u(0,e,!!t);return this.#c(e),this.#o+=n.length,n.slice(0,e)}readValue(){return toBigInt(this.readBytes(WordSize))}readIndex(){return toNumber(this.readBytes(WordSize))}}function number(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bytes(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function exists(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output(e,t){bytes(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}
|
|
116
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u8a=e=>e instanceof Uint8Array,u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function toBytes(e){if("string"==typeof e&&(e=utf8ToBytes(e)),!u8a(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class Hash{clone(){return this._cloneInto()}}function wrapConstructor(e){const t=t=>e().update(toBytes(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(e,t=!1){return t?{h:Number(e&U32_MASK64),l:Number(e>>_32n&U32_MASK64)}:{h:0|Number(e>>_32n&U32_MASK64),l:0|Number(e&U32_MASK64)}}function split(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:a,l:i}=fromBig(e[o],t);[n[o],r[o]]=[a,i]}return[n,r]}const rotlSH=(e,t,n)=>e<<n|t>>>32-n,rotlSL=(e,t,n)=>t<<n|e>>>32-n,rotlBH=(e,t,n)=>t<<n-32|e>>>64-n,rotlBL=(e,t,n)=>e<<n-32|t>>>64-n,[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]],_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let e=0,t=_1n,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],SHA3_PI.push(2*(5*r+n)),SHA3_ROTL.push((e+1)*(e+2)/2%64);let o=_0n;for(let e=0;e<7;e++)t=(t<<_1n^(t>>_7n)*_0x71n)%_256n,t&_2n&&(o^=_1n<<(_1n<<BigInt(e))-_1n);_SHA3_IOTA.push(o)}const[SHA3_IOTA_H,SHA3_IOTA_L]=split(_SHA3_IOTA,!0),rotlH=(e,t,n)=>n>32?rotlBH(e,t,n):rotlSH(e,t,n),rotlL=(e,t,n)=>n>32?rotlBL(e,t,n):rotlSL(e,t,n);function keccakP(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,o=(t+2)%10,a=n[o],i=n[o+1],s=rotlH(a,i,1)^n[r],c=rotlL(a,i,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],o=e[3];for(let n=0;n<24;n++){const r=SHA3_ROTL[n],a=rotlH(t,o,r),i=rotlL(t,o,r),s=SHA3_PI[n];t=e[s],o=e[s+1],e[s]=a,e[s+1]=i}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=SHA3_IOTA_H[r],e[1]^=SHA3_IOTA_L[r]}n.fill(0)}let Keccak$1=class e extends Hash{constructor(e,t,n,r=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){exists(this);const{blockLen:t,state:n}=this,r=(e=toBytes(e)).length;for(let o=0;o<r;){const a=Math.min(t-this.pos,r-o);for(let t=0;t<a;t++)n[this.pos++]^=e[o++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,128&t&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){exists(this,!1),bytes(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,o=e.length;r<o;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,o-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:a,enableXOF:i}=this;return t||(t=new e(n,r,o,i,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}};const gen=(e,t,n)=>wrapConstructor(()=>new Keccak$1(t,e,n)),keccak_256=gen(1,136,32);let locked=!1;const _keccak256=function(e){return keccak_256(e)};let __keccak256=_keccak256;function keccak256$1(e){const t=getBytes(e,"data");return hexlify(__keccak256(t))}keccak256$1._=_keccak256,keccak256$1.lock=function(){locked=!0},keccak256$1.register=function(e){if(locked)throw new TypeError("keccak256 is locked");__keccak256=e},Object.freeze(keccak256$1);const BN_0$1=BigInt(0),BN_36=BigInt(36);function getChecksumAddress(e){const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=getBytes(keccak256$1(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const ibanLookup={};for(let e=0;e<10;e++)ibanLookup[String(e)]=String(e);for(let e=0;e<26;e++)ibanLookup[String.fromCharCode(65+e)]=String(10+e);const safeDigits=15;function ibanChecksum(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>ibanLookup[e]).join("");for(;t.length>=safeDigits;){let e=t.substring(0,safeDigits);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}const Base36=function(){const e={};for(let t=0;t<36;t++){e["0123456789abcdefghijklmnopqrstuvwxyz"[t]]=BigInt(t)}return e}();function fromBase36(e){e=e.toLowerCase();let t=BN_0$1;for(let n=0;n<e.length;n++)t=t*BN_36+Base36[e[n]];return t}function getAddress(e){if(assertArgument("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const t=getChecksumAddress(e);return assertArgument(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===e,"bad address checksum","address",e),t}if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){assertArgument(e.substring(2,4)===ibanChecksum(e),"bad icap checksum","address",e);let t=fromBase36(e.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return getChecksumAddress("0x"+t)}assertArgument(!1,"invalid address","address",e)}const _gaurd={};function n(e,t){let n=!1;return t<0&&(n=!0,t*=-1),new Typed(_gaurd,`${n?"":"u"}int${t}`,e,{signed:n,width:t})}function b(e,t){return new Typed(_gaurd,`bytes${t||""}`,e,{size:t})}const _typedSymbol=Symbol.for("_ethers_typed");class Typed{type;value;#l;_typedSymbol;constructor(e,t,n,r){null==r&&(r=null),assertPrivate(_gaurd,e,"Typed"),defineProperties(this,{_typedSymbol:_typedSymbol,type:t,value:n}),this.#l=r,this.format()}format(){if("array"===this.type)throw new Error("");if("dynamicArray"===this.type)throw new Error("");return"tuple"===this.type?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return"string"===this.type}get tupleName(){if("tuple"!==this.type)throw TypeError("not a tuple");return this.#l}get arrayLength(){if("array"!==this.type)throw TypeError("not an array");return!0===this.#l?-1:!1===this.#l?this.value.length:null}static from(e,t){return new Typed(_gaurd,e,t)}static uint8(e){return n(e,8)}static uint16(e){return n(e,16)}static uint24(e){return n(e,24)}static uint32(e){return n(e,32)}static uint40(e){return n(e,40)}static uint48(e){return n(e,48)}static uint56(e){return n(e,56)}static uint64(e){return n(e,64)}static uint72(e){return n(e,72)}static uint80(e){return n(e,80)}static uint88(e){return n(e,88)}static uint96(e){return n(e,96)}static uint104(e){return n(e,104)}static uint112(e){return n(e,112)}static uint120(e){return n(e,120)}static uint128(e){return n(e,128)}static uint136(e){return n(e,136)}static uint144(e){return n(e,144)}static uint152(e){return n(e,152)}static uint160(e){return n(e,160)}static uint168(e){return n(e,168)}static uint176(e){return n(e,176)}static uint184(e){return n(e,184)}static uint192(e){return n(e,192)}static uint200(e){return n(e,200)}static uint208(e){return n(e,208)}static uint216(e){return n(e,216)}static uint224(e){return n(e,224)}static uint232(e){return n(e,232)}static uint240(e){return n(e,240)}static uint248(e){return n(e,248)}static uint256(e){return n(e,256)}static uint(e){return n(e,256)}static int8(e){return n(e,-8)}static int16(e){return n(e,-16)}static int24(e){return n(e,-24)}static int32(e){return n(e,-32)}static int40(e){return n(e,-40)}static int48(e){return n(e,-48)}static int56(e){return n(e,-56)}static int64(e){return n(e,-64)}static int72(e){return n(e,-72)}static int80(e){return n(e,-80)}static int88(e){return n(e,-88)}static int96(e){return n(e,-96)}static int104(e){return n(e,-104)}static int112(e){return n(e,-112)}static int120(e){return n(e,-120)}static int128(e){return n(e,-128)}static int136(e){return n(e,-136)}static int144(e){return n(e,-144)}static int152(e){return n(e,-152)}static int160(e){return n(e,-160)}static int168(e){return n(e,-168)}static int176(e){return n(e,-176)}static int184(e){return n(e,-184)}static int192(e){return n(e,-192)}static int200(e){return n(e,-200)}static int208(e){return n(e,-208)}static int216(e){return n(e,-216)}static int224(e){return n(e,-224)}static int232(e){return n(e,-232)}static int240(e){return n(e,-240)}static int248(e){return n(e,-248)}static int256(e){return n(e,-256)}static int(e){return n(e,-256)}static bytes1(e){return b(e,1)}static bytes2(e){return b(e,2)}static bytes3(e){return b(e,3)}static bytes4(e){return b(e,4)}static bytes5(e){return b(e,5)}static bytes6(e){return b(e,6)}static bytes7(e){return b(e,7)}static bytes8(e){return b(e,8)}static bytes9(e){return b(e,9)}static bytes10(e){return b(e,10)}static bytes11(e){return b(e,11)}static bytes12(e){return b(e,12)}static bytes13(e){return b(e,13)}static bytes14(e){return b(e,14)}static bytes15(e){return b(e,15)}static bytes16(e){return b(e,16)}static bytes17(e){return b(e,17)}static bytes18(e){return b(e,18)}static bytes19(e){return b(e,19)}static bytes20(e){return b(e,20)}static bytes21(e){return b(e,21)}static bytes22(e){return b(e,22)}static bytes23(e){return b(e,23)}static bytes24(e){return b(e,24)}static bytes25(e){return b(e,25)}static bytes26(e){return b(e,26)}static bytes27(e){return b(e,27)}static bytes28(e){return b(e,28)}static bytes29(e){return b(e,29)}static bytes30(e){return b(e,30)}static bytes31(e){return b(e,31)}static bytes32(e){return b(e,32)}static address(e){return new Typed(_gaurd,"address",e)}static bool(e){return new Typed(_gaurd,"bool",!!e)}static bytes(e){return new Typed(_gaurd,"bytes",e)}static string(e){return new Typed(_gaurd,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new Typed(_gaurd,"overrides",Object.assign({},e))}static isTyped(e){return e&&"object"==typeof e&&"_typedSymbol"in e&&e._typedSymbol===_typedSymbol}static dereference(e,t){if(Typed.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}}class AddressCoder extends Coder{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let n=Typed.dereference(t,"string");try{n=getAddress(n)}catch(e){return this._throwError(e.message,t)}return e.writeValue(n)}decode(e){return getAddress(toBeHex(e.readValue(),20))}}class AnonymousCoder extends Coder{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}function pack(e,t,n){let r=[];if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map(t=>{const r=t.localName;return assert(r,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:t},value:n}),assert(!e[r],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:t},value:n}),e[r]=!0,n[r]})}else assertArgument(!1,"invalid tuple value","tuple",n);assertArgument(t.length===r.length,"types/value length mismatch","tuple",n);let o=new Writer,a=new Writer,i=[];t.forEach((e,t)=>{let n=r[t];if(e.dynamic){let t=a.length;e.encode(a,n);let r=o.writeUpdatableValue();i.push(e=>{r(e+t)})}else e.encode(o,n)}),i.forEach(e=>{e(o.length)});let s=e.appendWriter(o);return s+=e.appendWriter(a),s}function unpack(e,t){let n=[],r=[],o=e.subReader(0);return t.forEach(t=>{let a=null;if(t.dynamic){let n=e.readIndex(),r=o.subReader(n);try{a=t.decode(r)}catch(e){if(isError(e,"BUFFER_OVERRUN"))throw e;a=e,a.baseType=t.name,a.name=t.localName,a.type=t.type}}else try{a=t.decode(e)}catch(e){if(isError(e,"BUFFER_OVERRUN"))throw e;a=e,a.baseType=t.name,a.name=t.localName,a.type=t.type}if(null==a)throw new Error("investigate");n.push(a),r.push(t.localName||null)}),Result.fromItems(n,r)}class ArrayCoder extends Coder{coder;length;constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),defineProperties(this,{coder:e,length:t})}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){const n=Typed.dereference(t,"array");Array.isArray(n)||this._throwError("expected array value",n);let r=this.length;-1===r&&(r=n.length,e.writeValue(n.length)),assertArgumentCount(n.length,r,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let e=0;e<n.length;e++)o.push(this.coder);return pack(e,o,n)}decode(e){let t=this.length;-1===t&&(t=e.readIndex(),assert(t*WordSize<=e.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:e.bytes,offset:t*WordSize,length:e.dataLength}));let n=[];for(let e=0;e<t;e++)n.push(new AnonymousCoder(this.coder));return unpack(e,n)}}class BooleanCoder extends Coder{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const n=Typed.dereference(t,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class DynamicBytesCoder extends Coder{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=getBytesCopy(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class BytesCoder extends DynamicBytesCoder{constructor(e){super("bytes",e)}decode(e){return hexlify(super.decode(e))}}class FixedBytesCoder extends Coder{size;constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),defineProperties(this,{size:e},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=getBytesCopy(Typed.dereference(t,this.type));return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return hexlify(e.readBytes(this.size))}}const Empty=new Uint8Array([]);class NullCoder extends Coder{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes(Empty)}decode(e){return e.readBytes(0),null}}const BN_0=BigInt(0),BN_1=BigInt(1),BN_MAX_UINT256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class NumberCoder extends Coder{size;signed;constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),defineProperties(this,{size:e,signed:t},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(e,t){let n=getBigInt(Typed.dereference(t,this.type)),r=mask(BN_MAX_UINT256,8*WordSize);if(this.signed){let e=mask(r,8*this.size-1);(n>e||n<-(e+BN_1))&&this._throwError("value out-of-bounds",t),n=toTwos(n,8*WordSize)}else(n<BN_0||n>mask(r,8*this.size))&&this._throwError("value out-of-bounds",t);return e.writeValue(n)}decode(e){let t=mask(e.readValue(),8*this.size);return this.signed&&(t=fromTwos(t,8*this.size)),t}}class StringCoder extends DynamicBytesCoder{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,toUtf8Bytes(Typed.dereference(t,"string")))}decode(e){return toUtf8String(super.decode(e))}}class TupleCoder extends Coder{coders;constructor(e,t){let n=!1;const r=[];e.forEach(e=>{e.dynamic&&(n=!0),r.push(e.type)});super("tuple","tuple("+r.join(",")+")",t,n),defineProperties(this,{coders:Object.freeze(e.slice())})}defaultValue(){const e=[];this.coders.forEach(t=>{e.push(t.defaultValue())});const t=this.coders.reduce((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});return this.coders.forEach((n,r)=>{let o=n.localName;o&&1===t[o]&&("length"===o&&(o="_length"),null==e[o]&&(e[o]=e[r]))}),Object.freeze(e)}encode(e,t){const n=Typed.dereference(t,"tuple");return pack(e,this.coders,n)}decode(e){return unpack(e,this.coders)}}function setify(e){const t=new Set;return e.forEach(e=>t.add(e)),Object.freeze(t)}const _kwVisibDeploy="external public payable override";setify(_kwVisibDeploy.split(" "));const _kwVisib="constant external internal payable private public pure view override";setify(_kwVisib.split(" "));const _kwTypes="constructor error event fallback function receive struct";setify(_kwTypes.split(" "));const _kwModifiers="calldata memory storage payable indexed",KwModifiers=setify(_kwModifiers.split(" ")),_kwOther="tuple returns",_keywords=[_kwTypes,_kwModifiers,_kwOther,_kwVisib].join(" "),Keywords=setify(_keywords.split(" ")),SimpleTokens={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},regexWhitespacePrefix=new RegExp("^(\\s*)"),regexNumberPrefix=new RegExp("^([0-9]+)"),regexIdPrefix=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),regexId=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),regexType=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class TokenString{#o;#d;get offset(){return this.#o}get length(){return this.#d.length-this.#o}constructor(e){this.#o=0,this.#d=e.slice()}clone(){return new TokenString(this.#d)}reset(){this.#o=0}#p(e=0,t=0){return new TokenString(this.#d.slice(e,t).map(t=>Object.freeze(Object.assign({},t,{match:t.match-e,linkBack:t.linkBack-e,linkNext:t.linkNext-e}))))}popKeyword(e){const t=this.peek();if("KEYWORD"!==t.type||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if("OPEN_PAREN"!==e.type)throw new Error("bad start");const t=this.#p(this.#o+1,e.match+1);return this.#o=e.match+1,t}popParams(){const e=this.peek();if("OPEN_PAREN"!==e.type)throw new Error("bad start");const t=[];for(;this.#o<e.match-1;){const e=this.peek().linkNext;t.push(this.#p(this.#o+1,e)),this.#o=e}return this.#o=e.match+1,t}peek(){if(this.#o>=this.#d.length)throw new Error("out-of-bounds");return this.#d[this.#o]}peekKeyword(e){const t=this.peekType("KEYWORD");return null!=t&&e.has(t)?t:null}peekType(e){if(0===this.length)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return this.#o++,e}toString(){const e=[];for(let t=this.#o;t<this.#d.length;t++){const n=this.#d[t];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(" ")}>`}}function lex(e){const t=[],n=t=>{const n=a<e.length?JSON.stringify(e[a]):"$EOI";throw new Error(`invalid token ${n} at ${a}: ${t}`)};let r=[],o=[],a=0;for(;a<e.length;){let i=e.substring(a),s=i.match(regexWhitespacePrefix);s&&(a+=s[1].length,i=e.substring(a));const c={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:a,value:-1};t.push(c);let u=SimpleTokens[i[0]]||"";if(u){if(c.type=u,c.text=i[0],a++,"OPEN_PAREN"===u)r.push(t.length-1),o.push(t.length-1);else if("CLOSE_PAREN"==u)0===r.length&&n("no matching open bracket"),c.match=r.pop(),t[c.match].match=t.length-1,c.depth--,c.linkBack=o.pop(),t[c.linkBack].linkNext=t.length-1;else if("COMMA"===u)c.linkBack=o.pop(),t[c.linkBack].linkNext=t.length-1,o.push(t.length-1);else if("OPEN_BRACKET"===u)c.type="BRACKET";else if("CLOSE_BRACKET"===u){let e=t.pop().text;if(t.length>0&&"NUMBER"===t[t.length-1].type){const n=t.pop().text;e=n+e,t[t.length-1].value=getNumber(n)}if(0===t.length||"BRACKET"!==t[t.length-1].type)throw new Error("missing opening bracket");t[t.length-1].text+=e}}else if(s=i.match(regexIdPrefix),s){if(c.text=s[1],a+=c.text.length,Keywords.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(regexType)){c.type="TYPE";continue}c.type="ID"}else{if(s=i.match(regexNumberPrefix),!s)throw new Error(`unexpected token ${JSON.stringify(i[0])} at position ${a}`);c.text=s[1],c.type="NUMBER",a+=c.text.length}}return new TokenString(t.map(e=>Object.freeze(e)))}function consumeKeywords(e,t){const n=new Set;for(;;){const r=e.peekType("KEYWORD");if(null==r||t&&!t.has(r))break;if(e.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}const regexArrayType=new RegExp(/^(.*)\[([0-9]*)\]$/);function verifyBasicType(e){const t=e.match(regexType);if(assertArgument(t,"invalid type","type",e),"uint"===e)return"uint256";if("int"===e)return"int256";if(t[2]){const n=parseInt(t[2]);assertArgument(0!==n&&n<=32,"invalid bytes length","type",e)}else if(t[3]){const n=parseInt(t[3]);assertArgument(0!==n&&n<=256&&n%8==0,"invalid numeric width","type",e)}return e}const _guard={},internal=Symbol.for("_ethers_internal"),ParamTypeInternal="_ParamTypeInternal";class ParamType{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,t,n,r,o,a,i,s){if(assertPrivate(e,_guard,"ParamType"),Object.defineProperty(this,internal,{value:ParamTypeInternal}),a&&(a=Object.freeze(a.slice())),"array"===r){if(null==i||null==s)throw new Error("")}else if(null!=i||null!=s)throw new Error("");if("tuple"===r){if(null==a)throw new Error("")}else if(null!=a)throw new Error("");defineProperties(this,{name:t,type:n,baseType:r,indexed:o,components:a,arrayLength:i,arrayChildren:s})}format(e){if(null==e&&(e="sighash"),"json"===e){const t=this.name||"";if(this.isArray()){const e=JSON.parse(this.arrayChildren.format("json"));return e.name=t,e.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(e)}const n={type:"tuple"===this.baseType?"tuple":this.type,name:t};return"boolean"==typeof this.indexed&&(n.indexed=this.indexed),this.isTuple()&&(n.components=this.components.map(t=>JSON.parse(t.format(e)))),JSON.stringify(n)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(t=>t.format(e)).join("full"===e?", ":",")+")":t+=this.type,"sighash"!==e&&(!0===this.indexed&&(t+=" indexed"),"full"===e&&this.name&&(t+=" "+this.name)),t}isArray(){return"array"===this.baseType}isTuple(){return"tuple"===this.baseType}isIndexable(){return null!=this.indexed}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(-1!==this.arrayLength&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(e=>n.arrayChildren.walk(e,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((e,r)=>n.components[r].walk(e,t))}return t(this.type,e)}#h(e,t,n,r){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(-1!==this.arrayLength&&t.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=t.slice();return a.forEach((t,r)=>{o.#h(e,t,n,e=>{a[r]=e})}),void r(a)}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(t))a=t.slice();else{if(null==t||"object"!=typeof t)throw new Error("invalid tuple value");a=o.map(e=>{if(!e.name)throw new Error("cannot use object value with unnamed components");if(!(e.name in t))throw new Error(`missing value for component ${e.name}`);return t[e.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");return a.forEach((t,r)=>{o[r].#h(e,t,n,e=>{a[r]=e})}),void r(a)}const o=n(this.type,t);o.then?e.push(async function(){r(await o)}()):r(o)}async walkAsync(e,t){const n=[],r=[e];return this.#h(n,e,t,e=>{r[0]=e}),n.length&&await Promise.all(n),r[0]}static from(e,t){if(ParamType.isParamType(e))return e;if("string"==typeof e)try{return ParamType.from(lex(e),t)}catch(t){assertArgument(!1,"invalid param type","obj",e)}else if(e instanceof TokenString){let n="",r="",o=null;consumeKeywords(e,setify(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(r="tuple",o=e.popParams().map(e=>ParamType.from(e)),n=`tuple(${o.map(e=>e.format()).join(",")})`):(n=verifyBasicType(e.popType("TYPE")),r=n);let a=null,i=null;for(;e.length&&e.peekType("BRACKET");){const t=e.pop();a=new ParamType(_guard,"",n,r,null,o,i,a),i=t.value,n+=t.text,r="array",o=null}let s=null;if(consumeKeywords(e,KwModifiers).has("indexed")){if(!t)throw new Error("");s=!0}const c=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new ParamType(_guard,c,n,r,s,o,i,a)}const n=e.name;assertArgument(!n||"string"==typeof n&&n.match(regexId),"invalid name","obj.name",n);let r=e.indexed;null!=r&&(assertArgument(t,"parameter cannot be indexed","obj.indexed",e.indexed),r=!!r);let o=e.type,a=o.match(regexArrayType);if(a){const t=parseInt(a[2]||"-1"),i=ParamType.from({type:a[1],components:e.components});return new ParamType(_guard,n||"",o,"array",r,null,t,i)}if("tuple"===o||o.startsWith("tuple(")||o.startsWith("(")){const t=null!=e.components?e.components.map(e=>ParamType.from(e)):null;return new ParamType(_guard,n||"",o,"tuple",r,t,null,null)}return o=verifyBasicType(e.type),new ParamType(_guard,n||"",o,o,r,null,null,null)}static isParamType(e){return e&&e[internal]===ParamTypeInternal}}const PanicReasons=new Map;PanicReasons.set(0,"GENERIC_PANIC"),PanicReasons.set(1,"ASSERT_FALSE"),PanicReasons.set(17,"OVERFLOW"),PanicReasons.set(18,"DIVIDE_BY_ZERO"),PanicReasons.set(33,"ENUM_RANGE_ERROR"),PanicReasons.set(34,"BAD_STORAGE_DATA"),PanicReasons.set(49,"STACK_UNDERFLOW"),PanicReasons.set(50,"ARRAY_RANGE_ERROR"),PanicReasons.set(65,"OUT_OF_MEMORY"),PanicReasons.set(81,"UNINITIALIZED_FUNCTION_CALL");const paramTypeBytes=new RegExp(/^bytes([0-9]*)$/),paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);let defaultCoder=null,defaultMaxInflation=1024;function getBuiltinCallException(e,t,n,r){let o="missing revert data",a=null;let i=null;if(n){o="execution reverted";const e=getBytes(n);if(n=hexlify(n),0===e.length)o+=" (no data present; likely require(false) occurred",a="require(false)";else if(e.length%32!=4)o+=" (could not decode reason; invalid data length)";else if("0x08c379a0"===hexlify(e.slice(0,4)))try{a=r.decode(["string"],e.slice(4))[0],i={signature:"Error(string)",name:"Error",args:[a]},o+=`: ${JSON.stringify(a)}`}catch(e){o+=" (could not decode reason; invalid string data)"}else if("0x4e487b71"===hexlify(e.slice(0,4)))try{const t=Number(r.decode(["uint256"],e.slice(4))[0]);i={signature:"Panic(uint256)",name:"Panic",args:[t]},a=`Panic due to ${PanicReasons.get(t)||"UNKNOWN"}(${t})`,o+=`: ${a}`}catch(e){o+=" (could not decode panic code)"}else o+=" (unknown custom error)"}const s={to:t.to?getAddress(t.to):null,data:t.data||"0x"};return t.from&&(s.from=getAddress(t.from)),makeError(o,"CALL_EXCEPTION",{action:e,data:n,reason:a,transaction:s,invocation:null,revert:i})}class AbiCoder{#f(e){if(e.isArray())return new ArrayCoder(this.#f(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new TupleCoder(e.components.map(e=>this.#f(e)),e.name);switch(e.baseType){case"address":return new AddressCoder(e.name);case"bool":return new BooleanCoder(e.name);case"string":return new StringCoder(e.name);case"bytes":return new BytesCoder(e.name);case"":return new NullCoder(e.name)}let t=e.type.match(paramTypeNumber);if(t){let n=parseInt(t[2]||"256");return assertArgument(0!==n&&n<=256&&n%8==0,"invalid "+t[1]+" bit length","param",e),new NumberCoder(n/8,"int"===t[1],e.name)}if(t=e.type.match(paramTypeBytes),t){let n=parseInt(t[1]);return assertArgument(0!==n&&n<=32,"invalid bytes length","param",e),new FixedBytesCoder(n,e.name)}assertArgument(!1,"invalid type","type",e.type)}getDefaultValue(e){const t=e.map(e=>this.#f(ParamType.from(e)));return new TupleCoder(t,"_").defaultValue()}encode(e,t){assertArgumentCount(t.length,e.length,"types/values length mismatch");const n=e.map(e=>this.#f(ParamType.from(e))),r=new TupleCoder(n,"_"),o=new Writer;return r.encode(o,t),o.data}decode(e,t,n){const r=e.map(e=>this.#f(ParamType.from(e)));return new TupleCoder(r,"_").decode(new Reader(t,n,defaultMaxInflation))}static _setDefaultMaxInflation(e){assertArgument("number"==typeof e&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),defaultMaxInflation=e}static defaultAbiCoder(){return null==defaultCoder&&(defaultCoder=new AbiCoder),defaultCoder}static getBuiltinCallException(e,t,n){return getBuiltinCallException(e,t,n,AbiCoder.defaultAbiCoder())}}class EvmAddress extends Key{constructor(e){super(),this._bytes=e}static fromString(e){if(40!==(e=e.startsWith("0x")?e.slice(2):e).length)throw new Error("Input EVM address string is not the correct size");return new EvmAddress(decode$7(e))}static fromBytes(e){return new EvmAddress(e)}toBytes(){return this._bytes}toString(){return encode$4(this._bytes)}equals(e){return arrayEqual$2(this._bytes,e._bytes)}}const regex=/"^(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))(?:-([a-z]{5}))?$/,ENTITY_ID_REGEX=/^(\d+)(?:\.(\d+)\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/,EVM_ADDRESS_LENGTH=20,LONG_ZERO_PREFIX_LENGTH=12,ENTITY_NUM_OFFSET=16;function constructor(e,t,n){if(null==t&&null!=n||null!=t&&null==n)throw new Error("invalid entity ID");const[r,o,a]="number"==typeof e||Long.isLong(e)?[null!=n?Long.fromValue(e):Long.ZERO,null!=t?Long.fromValue(t):Long.ZERO,null!=n?Long.fromValue(n):Long.fromValue(e)]:[null!=e.shard?Long.fromValue(e.shard):Long.ZERO,null!=e.realm?Long.fromValue(e.realm):Long.ZERO,Long.fromValue(e.num)];if(r.isNegative()||o.isNegative()||a.isNegative())throw new Error("negative numbers are not allowed in IDs");return{shard:r,realm:o,num:a}}function compare(e,t){let n=e[0].compare(t[0]);return 0!=n?n:(n=e[1].compare(t[1]),0!=n?n:e[2].compare(t[2]))}function fromStringSplitter(e){const t=ENTITY_ID_REGEX.exec(e);if(null==t)throw new Error(`failed to parse entity id: ${e}`);return null==t[2]&&null==t[3]?{shard:"0",realm:"0",numOrHex:t[1],checksum:t[4]}:{shard:t[1],realm:t[2],numOrHex:t[3],checksum:t[4]}}function fromString(e){const t=fromStringSplitter(e);if(Number.isNaN(t.shard)||Number.isNaN(t.realm)||Number.isNaN(t.numOrHex))throw new Error("invalid format for entity ID");return{shard:null!=t.shard?Long.fromString(t.shard):Long.ZERO,realm:null!=t.realm?Long.fromString(t.realm):Long.ZERO,num:Long.fromString(t.numOrHex),checksum:t.checksum}}function fromSolidityAddress(e){const t=e.startsWith("0x")?decode$7(e.slice(2)):decode$7(e);if(t.length!==EVM_ADDRESS_LENGTH)throw new Error(`Invalid hex encoded solidity address length:\n expected length 40, got length ${e.length}`);return[Long.fromBytesBE([0,0,0,0,...t.slice(0,4)]),Long.fromBytesBE(Array.from(t.slice(4,12))),Long.fromBytesBE(Array.from(t.slice(12,20)))]}function fromEvmAddress(e,t,n){if(!isHexString(n))throw new Error(`Invalid EVM address hex string: ${n}`);const r=n.startsWith("0x")?decode$7(n.slice(2)):decode$7(n);if(r.length!==EVM_ADDRESS_LENGTH)throw new Error(`Invalid hex encoded evm address length:\n expected length ${EVM_ADDRESS_LENGTH}, got length ${n.length}`);let o=Long.ZERO;return isLongZeroAddress(r)&&(o=Long.fromBytesBE(Array.from(r.slice(LONG_ZERO_PREFIX_LENGTH,EVM_ADDRESS_LENGTH)))),[e instanceof Long?e:Long.fromNumber(e),t instanceof Long?t:Long.fromNumber(t),o,o.isZero()?EvmAddress.fromBytes(r):null]}function toSolidityAddress(e){const t=new Uint8Array(20),n=safeView(t),[r,o,a]=e;return n.setUint32(0,convertToNumber(r)),n.setUint32(8,convertToNumber(o)),n.setUint32(16,convertToNumber(a)),encode$4(t)}function toEvmAddress(e){if(e instanceof Uint8Array)return encode$4(e);const t=e,n=new Uint8Array(EVM_ADDRESS_LENGTH);return safeView(n).setUint32(ENTITY_NUM_OFFSET,convertToNumber(t)),encode$4(n)}function _parseAddress(e,t){let n=regex.exec(t);if(null===n){return{status:0}}let r=[Long.fromString(n[1]),Long.fromString(n[2]),Long.fromString(n[3])],o=`${r[0].toString()}.${r[1].toString()}.${r[2].toString()}`,a=_checksum(e,o);return{status:void 0===n[4]?2:a==n[4]?3:1,num1:r[0],num2:r[1],num3:r[2],givenChecksum:n[4],correctChecksum:a,noChecksumFormat:o,withChecksumFormat:`${o}-${a}`}}function _checksum(e,t){let n="",r=[],o=0,a=0,i=0,s=0,c=0;const u=11881376,l="a".charCodeAt(0);let d=new Uint8Array(e.length+6);d.set(e,0),d.set([0,0,0,0,0,0],e.length);for(let e=0;e<t.length;e++)r.push("."===t[e]?10:parseInt(t[e],10));for(let e=0;e<r.length;e++)i=(31*i+r[e])%17576,e%2==0?o=(o+r[e])%11:a=(a+r[e])%11;for(let e=0;e<d.length;e++)s=(31*s+d[e])%u;c=(17576*(11*(t.length%5*11+o)+a)+i+s)%u,c=1000003*c%u;for(let e=0;e<5;e++)n=String.fromCharCode(l+c%26)+n,c/=26;return n}function validateChecksum(e,t,n,r,o){if(null==o._network._ledgerId||null==r)return;const a=_checksum(o._network._ledgerId._ledgerId,`${e.toString()}.${t.toString()}.${n.toString()}`);if(r!=a)throw new BadEntityIdError(e,t,n,r,a)}function toStringWithChecksum(e,t){if(null==t)throw new Error("client cannot be null");if(null==t._network._ledgerId)throw new Error("cannot calculate checksum with a client that does not contain a recognzied ledger ID");return`${e}-${_checksum(t._network._ledgerId._ledgerId,e)}`}function appendBuffer(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n}function toHexString(e){var t="0x";return e.forEach(function(e){t+=("0"+(255&e).toString(16)).slice(-2)}),t}function aliasToPublicKey(e){const t=base32.decode(e);if(!t)return null;let n;try{n=libExports.proto.Key.decode(t)}catch(e){throw new Error("The alias is created with hollow account. Please use aliasToEvmAddress!")}return null!=n.ed25519&&n.ed25519.byteLength>0?PublicKey.fromBytes(n.ed25519):null!=n.ECDSASecp256k1&&n.ECDSASecp256k1.byteLength>0?PublicKey.fromBytes(n.ECDSASecp256k1):null}function aliasToEvmAddress(e){const t=base32.decode(e);if(!t)return null;try{throw libExports.proto.Key.decode(t),new Error("The alias is created with ed25519 or ECDSASecp256k1 account. Please use aliasToPublicKey!")}catch(e){return toHexString(t)}}function publicKeyToAlias(e){if("string"==typeof e&&(e.startsWith("0x")&&42==e.length||40==e.length)){e.startsWith("0x")||(e=`0x${e}`);const t=getBytes(e);return t?base32.encode(t):null}const t="string"==typeof e?PublicKey.fromString(e):e;let n=t.toStringRaw(),r="";"secp256k1"===t._key._type&&(r="0x3A21"),"ED25519"===t._key._type&&(r="0x1220"),n.startsWith("0x")||(n=`0x${n}`);const o=appendBuffer(getBytes(r),getBytes(n));return base32.encode(o)}var EntityIdHelper=Object.freeze({__proto__:null,_checksum:_checksum,_parseAddress:_parseAddress,aliasToEvmAddress:aliasToEvmAddress,aliasToPublicKey:aliasToPublicKey,compare:compare,constructor:constructor,fromEvmAddress:fromEvmAddress,fromSolidityAddress:fromSolidityAddress,fromString:fromString,fromStringSplitter:fromStringSplitter,publicKeyToAlias:publicKeyToAlias,toEvmAddress:toEvmAddress,toSolidityAddress:toSolidityAddress,toStringWithChecksum:toStringWithChecksum,validateChecksum:validateChecksum});const HARDENED_BIT=2147483648;class Mnemonic{constructor(e){this._mnemonic=e}static async generate(){return new Mnemonic(await Mnemonic$1._generate(24))}static async generate12(){return new Mnemonic(await Mnemonic$1._generate(12))}static async fromWords(e){return new Mnemonic(await Mnemonic$1.fromWords(e))}async toPrivateKey(e=""){return CACHE.privateKeyConstructor(await this._mnemonic.toPrivateKey(e))}async toEd25519PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toEd25519PrivateKey(e,t))}async toStandardEd25519PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toStandardEd25519PrivateKey(e,t))}async toEcdsaPrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toEcdsaPrivateKey(e,t))}calculateDerivationPathValues(e){const t=/m\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)/.exec(e),n=new Array(5);if(t)for(let e=1;e<=5;e++){let r=t[e];r.endsWith("'")?(r=r.substring(0,r.length-1),n[e-1]=parseInt(r,10)|HARDENED_BIT):n[e-1]=parseInt(r,10)}return n}async toStandardECDSAsecp256k1PrivateKeyImpl(e,t){return await this.toEcdsaPrivateKey(e,t)}async toStandardECDSAsecp256k1PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toStandardECDSAsecp256k1PrivateKey(e,t))}async toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath(e="",t){const n=this.calculateDerivationPathValues(t);return await this.toStandardECDSAsecp256k1PrivateKeyImpl(e,n)}static async fromString(e){return new Mnemonic(await Mnemonic$1.fromString(e))}async toLegacyPrivateKey(){return CACHE.privateKeyConstructor(await this._mnemonic.toLegacyPrivateKey())}async toSeed(e){return await Mnemonic$1.toSeed(this._mnemonic.words,e)}toString(){return this._mnemonic.toString()}}class ObjectMap{constructor(e){this._map=new Map,this.__map=new Map,this._fromString=e}get(e){const t="string"==typeof e?e:e.toString(),n=this._map.get(t);return null!=n?n:null}_set(e,t){const n="string"==typeof e?e:e.toString();this._map.set(n,t),this.__map.set(e,t)}values(){return this._map.values()}get size(){return this._map.size}keys(){return this.__map.keys()}[Symbol.iterator](){return this.__map[Symbol.iterator]()}toString(){const e={};for(const[t,n]of this._map)e[t]=n;return JSON.stringify(e)}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t}),e}}function decode$1(e){const t=e.startsWith("0x")?e.substring(2):e;if(t.length%2!=0)throw new Error("Invalid hex string: Must have an even number of characters.");if(/[^0-9a-fA-F]/.test(t))throw new Error("Invalid hex string: Contains non-hexadecimal characters.");const n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const r=parseInt(t.substring(e,e+2),16);n[e/2]=r}return Buffer.from(t,"hex")}class AccountId{constructor(e,t,n,r,o){const a=constructor(e,t,n);this.shard=a.shard,this.realm=a.realm,this.num=a.num,this.aliasKey=null!=r?r:null,this.evmAddress=null!=o?o:null,this._checksum=null}static fromString(e){let t,n,r=Long.ZERO,o=Long.ZERO,a=Long.ZERO;if(e.startsWith("0x")&&42==e.length||40==e.length)n=EvmAddress.fromString(e);else{const i=fromStringSplitter(e);if(Number.isNaN(i.shard)||Number.isNaN(i.realm))throw new Error("invalid format for entity ID");null!=i.shard&&(r=Long.fromString(i.shard)),null!=i.realm&&(o=Long.fromString(i.realm)),i.numOrHex.length<20?a=Long.fromString(i.numOrHex):40==i.numOrHex.length?n=EvmAddress.fromString(i.numOrHex):t=PublicKey.fromString(i.numOrHex)}return new AccountId(r,o,a,t,n)}static fromEvmAddress(e,t,n){const r="string"==typeof n?EvmAddress.fromString(n):n,[o,a,i,s]=fromEvmAddress(e,t,r.toString());return new AccountId(o,a,i,void 0,s||void 0)}static fromEvmPublicAddress(e){return new AccountId(0,0,0,void 0,e)}static _fromProtobuf(e){let t,n;return null!=e.alias&&(20===e.alias.length?n=EvmAddress.fromBytes(e.alias):t=Key._fromProtobufKey(libExports.proto.Key.decode(e.alias))),t instanceof PublicKey||(t=void 0),new AccountId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.accountNum?e.accountNum:0,t,n)}get checksum(){return this._checksum}getEvmAddress(){return this.evmAddress}async populateAccountNum(e){if(null===this.evmAddress)throw new Error("field `evmAddress` should not be null");const t=`${e.mirrorRestApiBaseUrl}/accounts/${this.evmAddress.toString()}`;await new Promise(e=>{setTimeout(e,3e3)});const n=await fetch(t),r=(await n.json()).account;return this.num=Long.fromString(r.slice(r.lastIndexOf(".")+1)),this}async populateAccountEvmAddress(e){if(null===this.num)throw new Error("field `num` should not be null");const t=`${e.mirrorRestApiBaseUrl}/accounts/${this.num.toString()}`;await new Promise(e=>{setTimeout(e,3e3)});const n=await fetch(t),r=(await n.json()).evm_address;return this.evmAddress=EvmAddress.fromString(r),this}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return AccountId._fromProtobuf(libExports.proto.AccountID.decode(e))}static fromSolidityAddress(e){return isLongZeroAddress(decode$1(e))?new AccountId(...fromSolidityAddress(e)):this.fromEvmAddress(0,0,e)}toSolidityAddress(){return null!=this.evmAddress?this.evmAddress.toString():null!=this.aliasKey&&"secp256k1"==this.aliasKey._key._type?this.aliasKey.toEvmAddress():toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?toEvmAddress(this.evmAddress.toBytes()):toEvmAddress(this.num)}_toProtobuf(){let e=null;null!=this.aliasKey?e=libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null!=this.evmAddress&&(e=this.evmAddress._bytes);const t=this.num.eq(Long.fromBigInt(0n))&&e;return e?{alias:t?e:null,accountNum:t?null:this.num,shardNum:this.shard,realmNum:this.realm}:{alias:null,accountNum:this.num,shardNum:this.shard,realmNum:this.realm}}toBytes(){return libExports.proto.AccountID.encode(this._toProtobuf()).finish()}toString(){let e=this.num.toString();return null!=this.aliasKey?e=this.aliasKey.toString():null!=this.evmAddress&&(e=this.evmAddress.toString()),`${this.shard.toString()}.${this.realm.toString()}.${e}`}toStringWithChecksum(e){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");return toStringWithChecksum(this.toString(),e)}equals(e){let t=!1;return null!=this.aliasKey&&null!=e.aliasKey?t=this.aliasKey.equals(e.aliasKey):null!=this.evmAddress&&null!=e.evmAddress?t=this.evmAddress.equals(e.evmAddress):null==this.aliasKey&&null==e.aliasKey&&null==this.evmAddress&&null==e.evmAddress&&(t=this.num.eq(e.num)),this.shard.eq(e.shard)&&this.realm.eq(e.realm)&&t}clone(){const e=new AccountId(this);return e._checksum=this._checksum,e.aliasKey=this.aliasKey,e.evmAddress=this.evmAddress,e}compare(e){let t=this.shard.compare(e.shard);if(0!=t)return t;if(t=this.realm.compare(e.realm),0!=t)return t;if(null!=this.aliasKey&&null!=e.aliasKey){const t=this.aliasKey.toString(),n=e.aliasKey.toString();return t>n?1:t<n?-1:0}if(null!=this.evmAddress&&null!=e.evmAddress){const t=this.evmAddress.toString(),n=e.evmAddress.toString();return t>n?1:t<n?-1:0}return null==this.aliasKey&&null==e.aliasKey&&null==this.evmAddress&&null==e.evmAddress?this.num.compare(e.num):1}}CACHE.setAccountIdConstructor((e,t,n)=>new AccountId(e,t,Long.ZERO,n));const MAX_NS=Long.fromNumber(1e9),generatedIds=new Set;class Timestamp{constructor(e,t){this.seconds=e instanceof Long?e:Long.fromNumber(e),this.nanos=t instanceof Long?t:Long.fromNumber(t),Object.freeze(this)}static generate(e=!0){let t;t=e?Math.floor(5e3*Math.random())+3e3:0;const n=Date.now()-t,r=Math.floor(n/1e3)+CACHE.timeDrift,o=1e6*Math.floor(n%1e3)+Math.floor(1e6*Math.random()),a=new Timestamp(r,o);return generatedIds.has(a.toString())?this.generate():(generatedIds.add(a.toString()),a)}static fromDate(e){let t;if("number"==typeof e)t=Long.fromNumber(e);else if("string"==typeof e)t=Long.fromNumber(Date.parse(e)).mul(1e6);else{if(!(e instanceof Date))throw new TypeError(`invalid type '${typeof e}' for 'data', expected 'Date'`);t=Long.fromNumber(e.getTime()).mul(1e6)}return new Timestamp(0,0).plusNanos(t)}toDate(){return new Date(1e3*this.seconds.toNumber()+Math.floor(this.nanos.toInt()/1e6))}plusNanos(e){const t=this.nanos.add(e);return new Timestamp(this.seconds.add(t.div(MAX_NS)),t.mod(MAX_NS))}_toProtobuf(){return{seconds:this.seconds,nanos:this.nanos.toInt()}}static _fromProtobuf(e){return new Timestamp(e.seconds instanceof Long||null!=e.seconds?e.seconds:0,null!=e.nanos?e.nanos:0)}toString(){const e=String(this.nanos).padStart(9,"0");return`${this.seconds.toString()}.${e}`}compare(e){const t=this.seconds.compare(e.seconds);return 0!=t?t:this.nanos.compare(e.nanos)}}class TransactionId{constructor(e,t,n=!1,r=null){this.accountId=e,this.validStart=t,this.scheduled=n,this.nonce=null,null!=r&&0!=r&&this.setNonce(r),Object.seal(this)}setNonce(e){return this.nonce="number"==typeof e?Long.fromNumber(e):e,this}static withValidStart(e,t){return new TransactionId(e,t)}static generate(e){return new TransactionId("string"==typeof e?AccountId.fromString(e):new AccountId(e),Timestamp.generate())}static fromString(e){let t,n,r,o,a,i;return[t,i]=e.split("@"),[n,i]=i.split("."),i.includes("?")?([r,i]=i.split("?scheduled"),o=!0,a=i.includes("/")?i.replace("/",""):null):i.includes("/")?([r,a]=i.split("/"),o=!1):r=i,new TransactionId(AccountId.fromString(t),new Timestamp(Long.fromValue(n),Long.fromValue(r)),o,null!=a?Long.fromString(a):null)}setScheduled(e){return this.scheduled=e,this}toString(){if(null!=this.accountId&&null!=this.validStart){const e=String(this.validStart.nanos).padStart(9,"0"),t=null!=this.nonce?"/".concat(this.nonce.toString()):"",n=this.scheduled?"?scheduled":"";return`${this.accountId.toString()}@${this.validStart.seconds.toString()}.${e}${n}${t}`}throw new Error("neither `accountId` nor `validStart` are set")}static _fromProtobuf(e){if(null!=e.accountID&&null!=e.transactionValidStart)return new TransactionId(AccountId._fromProtobuf(e.accountID),Timestamp._fromProtobuf(e.transactionValidStart),null!=e.scheduled?e.scheduled:void 0,null!=e.nonce?e.nonce:void 0);throw new Error("Neither `nonce` or `accountID` and `transactionValidStart` are set")}_toProtobuf(){return{accountID:null!=this.accountId?this.accountId._toProtobuf():null,transactionValidStart:null!=this.validStart?this.validStart._toProtobuf():null,scheduled:this.scheduled,nonce:null!=this.nonce?this.nonce.toInt():null}}static fromBytes(e){return TransactionId._fromProtobuf(libExports.proto.TransactionID.decode(e))}toBytes(){return libExports.proto.TransactionID.encode(this._toProtobuf()).finish()}clone(){return new TransactionId(this.accountId,this.validStart,this.scheduled,this.nonce)}compare(e){const t=this.accountId.compare(e.accountId);return 0!=t?t:this.validStart.compare(e.validStart)}getReceipt(e){return CACHE.transactionReceiptQueryConstructor().setTransactionId(this).execute(e)}async getRecord(e){return await this.getReceipt(e),CACHE.transactionRecordQueryConstructor().setTransactionId(this).execute(e)}}class SignaturePairMap extends ObjectMap{constructor(){super(e=>PublicKey.fromString(e))}static _fromTransactionSigMap(e){const t=new SignaturePairMap,n=null!=e.sigPair?e.sigPair:[];for(const e of n)null!=e.pubKeyPrefix&&(null!=e.ed25519?t._set(PublicKey.fromBytesED25519(e.pubKeyPrefix),e.ed25519):null!=e.ECDSASecp256k1&&t._set(PublicKey.fromBytesECDSA(e.pubKeyPrefix),e.ECDSASecp256k1));return t}addSignature(e,t){return this._set(e,t),this}}let NodeAccountIdSignatureMap$1=class e extends ObjectMap{constructor(){super(e=>TransactionId.fromString(e))}static _fromSignedTransactions(t){const n=new e;for(const{bodyBytes:e,sigMap:r}of t.list)if(null!=e&&null!=r){const t=libExports.proto.TransactionBody.decode(e);if(null!=t.transactionID){const e=TransactionId._fromProtobuf(t.transactionID);n._set(e,SignaturePairMap._fromTransactionSigMap(r))}}return n}addSignature(e,t,n){const r=this.get(e);r?r.addSignature(t,n):this._set(e,(new SignaturePairMap).addSignature(t,n))}};class List{constructor(){this.list=[],this.locked=!1,this.index=0}setList(e){if(this.locked)throw new Error("list is locked");return this.list=e,this.index=0,this}push(...e){if(this.locked)throw new Error("list is locked");return this.list.push(...e),this}setLocked(){return this.locked=!0,this}clear(){this.list=[],this.index=0,this.locked=!1}get(e){return this.list[e]}set(e,t){return e===this.length?this.list.push(t):this.list[e]=t,this}setIfAbsent(e,t){return e!=this.length&&null!=this.list[e]||this.set(e,t()),this}get next(){return this.get(this.advance())}get current(){return this.get(this.index)}advance(){const e=this.index;return this.index=(this.index+1)%this.list.length,e}get isEmpty(){return 0===this.length}get length(){return this.list.length}clone(){const e=new List;return e.list=this.list,e.locked=this.locked,e}}let SignatureMap$1=class e extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromTransaction(t){const n=new e,r=t._nodeAccountIds.length,o=t._signedTransactions.length/r;for(let e=0;e<r;e++){const a=new List;for(let n=0;n<o;n++)a.push(t._signedTransactions.get(n*r+e));n._set(t._nodeAccountIds.list[e],NodeAccountIdSignatureMap$1._fromSignedTransactions(a))}return n}addSignature(e,t,n,r){let o=this.get(e);return o||(o=new NodeAccountIdSignatureMap$1,this._set(e,o)),o.addSignature(t,n,r),this._set(e,o),this}getFlatSignatureList(){const e=[];for(const t of this.values())for(const n of t.values())e.push(n);return e}};class ASN1Decoder{constructor(e){this.data=new Uint8Array(e),this.pos=0,this.oids=[],this.oidMap={"1.3.132.0.10":"ecdsa","1.3.101.112":"ed25519","1.2.840.10045.2.1":"pubkey"},this.isPublicKey=!1}readLength(){let e=this.data[this.pos++];if(128&e){let t=127&e;e=0;for(let n=0;n<t;n++)e=e<<8|this.data[this.pos++]}return e}readType(){return this.data[this.pos++]}readInteger(){const e=this.readLength();let t=0;for(let n=0;n<e;n++)t=t<<8|this.data[this.pos++];return{integer:t}}readOctetString(){const e=this.readLength(),t=this.data.slice(this.pos,this.pos+e);return this.pos+=e,{pkey:t}}readBitString(){const e=this.readLength(),t=this.data[this.pos++],n=this.data.slice(this.pos,this.pos+e-1);return this.pos+=e-1,{unusedBits:t,pubkey:n}}readObjectIdentifier(){const e=this.readLength(),t=this.pos+e,n=[];let r=0;const o=this.data[this.pos++];for(n.push(Math.floor(o/40)),n.push(o%40);this.pos<t;){const e=this.data[this.pos++];r=r<<7|127&e,128&e||(n.push(r),r=0)}const a=n.join(".");return this.oids.push(a),{oid:a}}getOids(){return this.oids}getOidKeyTypes(){return this.oids.map(e=>this.oidMap[e]||"unknown")}readSequence(){const e=this.readLength(),t=this.pos+e,n=[];for(;this.pos<t;)n.push(this.read());return n}read(){const e=this.readType();switch(e){case 2:return this.readInteger();case 3:return this.readBitString();case 4:return this.readOctetString();case 6:return this.readObjectIdentifier();case 48:case 160:case 161:return this.readSequence();default:throw new Error(`Unsupported type: ${e}`)}}isPublicKeyType(){return this.isPublicKey}}class PrivateKey extends Key{constructor(e){super(),this._key=e}static generateED25519(){return new PrivateKey(PrivateKey$1.generateED25519())}static generateECDSA(){return new PrivateKey(PrivateKey$1.generateECDSA())}static generate(){return PrivateKey.generateED25519()}static async generateAsync(){return new PrivateKey(await PrivateKey$1.generateAsync())}static async generateED25519Async(){return new PrivateKey(await PrivateKey$1.generateED25519Async())}static async generateECDSAAsync(){return new PrivateKey(await PrivateKey$1.generateECDSAAsync())}static fromBytes(e){const t=hexlify(e);return PrivateKey.isDerKey(t)?"ecdsa"===PrivateKey.getAlgorithm(t)?new PrivateKey(PrivateKey$1.fromBytesECDSA(e)):new PrivateKey(PrivateKey$1.fromBytesED25519(e)):new PrivateKey(PrivateKey$1.fromBytes(e))}static fromBytesECDSA(e){return new PrivateKey(PrivateKey$1.fromBytesECDSA(e))}static fromBytesED25519(e){return new PrivateKey(PrivateKey$1.fromBytesED25519(e))}static fromString(e){return PrivateKey.isDerKey(e)?this.fromStringDer(e):new PrivateKey(PrivateKey$1.fromString(e))}static fromStringDer(e){return PrivateKey.isDerKey(e)?"ecdsa"===PrivateKey.getAlgorithm(e)?this.fromStringECDSA(e):this.fromStringED25519(e):PrivateKey.fromString(e)}static fromStringECDSA(e){return new PrivateKey(PrivateKey$1.fromStringECDSA(e))}static fromStringED25519(e){return new PrivateKey(PrivateKey$1.fromStringED25519(e))}static async fromSeedED25519(e){return new PrivateKey(await PrivateKey$1.fromSeedED25519(e))}static async fromSeedECDSAsecp256k1(e){return new PrivateKey(await PrivateKey$1.fromSeedECDSAsecp256k1(e))}static async fromMnemonic(e,t=""){return new PrivateKey(e instanceof Mnemonic?await PrivateKey$1.fromMnemonic(e._mnemonic,t):await PrivateKey$1.fromMnemonic(e,t))}static async fromKeystore(e,t=""){return new PrivateKey(await PrivateKey$1.fromKeystore(e,t))}static async fromPem(e,t=""){return new PrivateKey(await PrivateKey$1.fromPem(e,t))}async derive(e){return new PrivateKey(await this._key.derive(e))}async legacyDerive(e){return new PrivateKey(await this._key.legacyDerive(e))}get publicKey(){return new PublicKey(this._key.publicKey)}get chainCode(){return this._key._chainCode}sign(e){return this._key.sign(e)}signTransaction(e,t=!1){if(t)return this._signTransactionLegacy(e);const n=new SignatureMap$1;for(const t of e._signedTransactions.list){const e=t.bodyBytes;if(!e)throw new Error("Body bytes are missing");const r=libExports.proto.TransactionBody.decode(e);if(!r.transactionID||!r.nodeAccountID)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const o=AccountId._fromProtobuf(r.nodeAccountID),a=TransactionId._fromProtobuf(r.transactionID),i=this._key.sign(e);n.addSignature(o,a,this.publicKey,i)}return e.addSignature(this.publicKey,n),n}_signTransactionLegacy(e){const t=e._signedTransactions.list.map(e=>{const t=e.bodyBytes;return t?this._key.sign(t):new Uint8Array});return e.addSignature(this.publicKey,t),1===t.length?t[0]:t}isDerivable(){return this._key.isDerivable()}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this._key.toStringDer()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}toKeystore(e=""){return this._key.toKeystore(e)}_toProtobufKey(){return this.publicKey._toProtobufKey()}toAccountId(e,t){return this.publicKey.toAccountId(e,t)}get type(){return this._key._type}getRecoveryId(e,t,n){return this._key.getRecoveryId(e,t,n)}static getAlgorithm(e){if(!PrivateKey.isDerKey(e))throw new Error("Only der keys are supported");const t=new ASN1Decoder(Uint8Array.from(decode$7(e)));t.read();return t.getOidKeyTypes()[0]}static isDerKey(e){try{const t=Uint8Array.from(decode$7(e));return new ASN1Decoder(t).read(),!0}catch(e){return!1}}}CACHE.setPrivateKeyConstructor(e=>new PrivateKey(e));class KeyList extends Key{constructor(e,t){super(),this._keys=null==e?[]:e instanceof Key?[e]:e,this._threshold=null==t?null:t}static of(...e){return new KeyList(e,null)}static from(e,t,n){return new KeyList(null==t?Array.from(e):Array.from(e,t,n))}get threshold(){return this._threshold}setThreshold(e){return this._threshold=e,this}push(...e){return this._keys.push(...e)}splice(e,t,...n){return new KeyList(this._keys.splice(e,t,...n),this.threshold)}slice(e,t){return new KeyList(this._keys.slice(e,t),this.threshold)}[Symbol.iterator](){return this._keys[Symbol.iterator]()}toArray(){return this._keys.slice()}toString(){return JSON.stringify({threshold:this._threshold,keys:this._keys.toString()})}_toProtobufKey(){const e=this._keys.map(e=>e._toProtobufKey());return null==this.threshold?{keyList:{keys:e}}:{thresholdKey:{threshold:this.threshold,keys:{keys:e}}}}static __fromProtobufKeyList(e){const t=(null!=e.keys?e.keys:[]).map(e=>Key._fromProtobufKey(e));return new KeyList(t)}static __fromProtobufThresoldKey(e){const t=KeyList.__fromProtobufKeyList(null!=e.keys?e.keys:{});return t.setThreshold(null!=e.threshold?e.threshold:0),t}}function valueToLong(e){return BigNumber.isBigNumber(e)?e:new BigNumber(e.toString())}CACHE.setKeyList(e=>KeyList.__fromProtobufKeyList(e)),CACHE.setThresholdKey(e=>KeyList.__fromProtobufThresoldKey(e));class HbarUnit{constructor(e,t,n){this._name=e,this._symbol=t,this._tinybar=n,Object.freeze(this)}static fromString(e){switch(e){case HbarUnit.Hbar._symbol:return HbarUnit.Hbar;case HbarUnit.Tinybar._symbol:return HbarUnit.Tinybar;case HbarUnit.Microbar._symbol:return HbarUnit.Microbar;case HbarUnit.Millibar._symbol:return HbarUnit.Millibar;case HbarUnit.Kilobar._symbol:return HbarUnit.Kilobar;case HbarUnit.Megabar._symbol:return HbarUnit.Megabar;case HbarUnit.Gigabar._symbol:return HbarUnit.Gigabar;default:throw new Error("Unknown unit.")}}}HbarUnit.Tinybar=new HbarUnit("tinybar","tℏ",new BigNumber(1)),HbarUnit.Microbar=new HbarUnit("microbar","μℏ",new BigNumber(100)),HbarUnit.Millibar=new HbarUnit("millibar","mℏ",new BigNumber(1e5)),HbarUnit.Hbar=new HbarUnit("hbar","ℏ",new BigNumber("100000000")),HbarUnit.Kilobar=new HbarUnit("kilobar","kℏ",new BigNumber(1e3).multipliedBy(new BigNumber("100000000"))),HbarUnit.Megabar=new HbarUnit("megabar","Mℏ",new BigNumber(1e6).multipliedBy(new BigNumber("100000000"))),HbarUnit.Gigabar=new HbarUnit("gigabar","Gℏ",new BigNumber("1000000000").multipliedBy(new BigNumber("100000000")));class Hbar{constructor(e,t=HbarUnit.Hbar){if(t===HbarUnit.Tinybar)this._valueInTinybar=valueToLong(e);else{let n;n=Long.isLong(e)?new BigNumber(e.toString(10)):BigNumber.isBigNumber(e)||"string"==typeof e||"number"==typeof e?new BigNumber(e):new BigNumber(0),this._valueInTinybar=n.multipliedBy(t._tinybar)}if(!this._valueInTinybar.isInteger())throw new Error("Hbar in tinybars contains decimals")}static from(e,t){return new Hbar(e,t)}static fromTinybars(e){return"string"==typeof e?this.fromString(e,HbarUnit.Tinybar):new Hbar(e,HbarUnit.Tinybar)}static fromString(e,t=HbarUnit.Hbar){if(/^((?:\+|-)?\d+(?:\.\d+)?)(?: (tℏ|μℏ|mℏ|ℏ|kℏ|Mℏ|Gℏ))?$/.test(e)){let[n,r]=e.split(" ");return null!=r&&(t=HbarUnit.fromString(r)),new Hbar(new BigNumber(n),t)}throw new Error("invalid argument provided")}to(e){return this._valueInTinybar.dividedBy(e._tinybar)}toBigNumber(){return this.to(HbarUnit.Hbar)}toTinybars(){return Long.fromValue(this._valueInTinybar.toFixed())}negated(){return Hbar.fromTinybars(this._valueInTinybar.negated())}isNegative(){return this._valueInTinybar.isNegative()}toString(e){return null!=e?`${this._valueInTinybar.dividedBy(e._tinybar).toString()} ${e._symbol}`:this._valueInTinybar.isLessThan(1e4)&&this._valueInTinybar.isGreaterThan(-1e4)?`${this._valueInTinybar.toFixed()} ${HbarUnit.Tinybar._symbol}`:`${this.to(HbarUnit.Hbar).toString()} ${HbarUnit.Hbar._symbol}`}}class StatusError extends Error{constructor(e,t){super(t),this.name="StatusError",this.status=e.status,this.transactionId=e.transactionId,this.message=t,void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,StatusError)}toJSON(){return{name:this.name,status:this.status.toString(),transactionId:this.transactionId.toString(),message:this.message}}toString(){return JSON.stringify(this.toJSON())}valueOf(){return this.toJSON()}}class ReceiptStatusError extends StatusError{constructor(e){super(e,`receipt for transaction ${e.transactionId.toString()} contained error status ${e.status.toString()}`),this.transactionReceipt=e.transactionReceipt}}class Status{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case Status.Ok:return"OK";case Status.InvalidTransaction:return"INVALID_TRANSACTION";case Status.PayerAccountNotFound:return"PAYER_ACCOUNT_NOT_FOUND";case Status.InvalidNodeAccount:return"INVALID_NODE_ACCOUNT";case Status.TransactionExpired:return"TRANSACTION_EXPIRED";case Status.InvalidTransactionStart:return"INVALID_TRANSACTION_START";case Status.InvalidTransactionDuration:return"INVALID_TRANSACTION_DURATION";case Status.InvalidSignature:return"INVALID_SIGNATURE";case Status.MemoTooLong:return"MEMO_TOO_LONG";case Status.InsufficientTxFee:return"INSUFFICIENT_TX_FEE";case Status.InsufficientPayerBalance:return"INSUFFICIENT_PAYER_BALANCE";case Status.DuplicateTransaction:return"DUPLICATE_TRANSACTION";case Status.Busy:return"BUSY";case Status.NotSupported:return"NOT_SUPPORTED";case Status.InvalidFileId:return"INVALID_FILE_ID";case Status.InvalidAccountId:return"INVALID_ACCOUNT_ID";case Status.InvalidContractId:return"INVALID_CONTRACT_ID";case Status.InvalidTransactionId:return"INVALID_TRANSACTION_ID";case Status.ReceiptNotFound:return"RECEIPT_NOT_FOUND";case Status.RecordNotFound:return"RECORD_NOT_FOUND";case Status.InvalidSolidityId:return"INVALID_SOLIDITY_ID";case Status.Unknown:return"UNKNOWN";case Status.Success:return"SUCCESS";case Status.FailInvalid:return"FAIL_INVALID";case Status.FailFee:return"FAIL_FEE";case Status.FailBalance:return"FAIL_BALANCE";case Status.KeyRequired:return"KEY_REQUIRED";case Status.BadEncoding:return"BAD_ENCODING";case Status.InsufficientAccountBalance:return"INSUFFICIENT_ACCOUNT_BALANCE";case Status.InvalidSolidityAddress:return"INVALID_SOLIDITY_ADDRESS";case Status.InsufficientGas:return"INSUFFICIENT_GAS";case Status.ContractSizeLimitExceeded:return"CONTRACT_SIZE_LIMIT_EXCEEDED";case Status.LocalCallModificationException:return"LOCAL_CALL_MODIFICATION_EXCEPTION";case Status.ContractRevertExecuted:return"CONTRACT_REVERT_EXECUTED";case Status.ContractExecutionException:return"CONTRACT_EXECUTION_EXCEPTION";case Status.InvalidReceivingNodeAccount:return"INVALID_RECEIVING_NODE_ACCOUNT";case Status.MissingQueryHeader:return"MISSING_QUERY_HEADER";case Status.AccountUpdateFailed:return"ACCOUNT_UPDATE_FAILED";case Status.InvalidKeyEncoding:return"INVALID_KEY_ENCODING";case Status.NullSolidityAddress:return"NULL_SOLIDITY_ADDRESS";case Status.ContractUpdateFailed:return"CONTRACT_UPDATE_FAILED";case Status.InvalidQueryHeader:return"INVALID_QUERY_HEADER";case Status.InvalidFeeSubmitted:return"INVALID_FEE_SUBMITTED";case Status.InvalidPayerSignature:return"INVALID_PAYER_SIGNATURE";case Status.KeyNotProvided:return"KEY_NOT_PROVIDED";case Status.InvalidExpirationTime:return"INVALID_EXPIRATION_TIME";case Status.NoWaclKey:return"NO_WACL_KEY";case Status.FileContentEmpty:return"FILE_CONTENT_EMPTY";case Status.InvalidAccountAmounts:return"INVALID_ACCOUNT_AMOUNTS";case Status.EmptyTransactionBody:return"EMPTY_TRANSACTION_BODY";case Status.InvalidTransactionBody:return"INVALID_TRANSACTION_BODY";case Status.InvalidSignatureTypeMismatchingKey:return"INVALID_SIGNATURE_TYPE_MISMATCHING_KEY";case Status.InvalidSignatureCountMismatchingKey:return"INVALID_SIGNATURE_COUNT_MISMATCHING_KEY";case Status.EmptyLiveHashBody:return"EMPTY_LIVE_HASH_BODY";case Status.EmptyLiveHash:return"EMPTY_LIVE_HASH";case Status.EmptyLiveHashKeys:return"EMPTY_LIVE_HASH_KEYS";case Status.InvalidLiveHashSize:return"INVALID_LIVE_HASH_SIZE";case Status.EmptyQueryBody:return"EMPTY_QUERY_BODY";case Status.EmptyLiveHashQuery:return"EMPTY_LIVE_HASH_QUERY";case Status.LiveHashNotFound:return"LIVE_HASH_NOT_FOUND";case Status.AccountIdDoesNotExist:return"ACCOUNT_ID_DOES_NOT_EXIST";case Status.LiveHashAlreadyExists:return"LIVE_HASH_ALREADY_EXISTS";case Status.InvalidFileWacl:return"INVALID_FILE_WACL";case Status.SerializationFailed:return"SERIALIZATION_FAILED";case Status.TransactionOversize:return"TRANSACTION_OVERSIZE";case Status.TransactionTooManyLayers:return"TRANSACTION_TOO_MANY_LAYERS";case Status.ContractDeleted:return"CONTRACT_DELETED";case Status.PlatformNotActive:return"PLATFORM_NOT_ACTIVE";case Status.KeyPrefixMismatch:return"KEY_PREFIX_MISMATCH";case Status.PlatformTransactionNotCreated:return"PLATFORM_TRANSACTION_NOT_CREATED";case Status.InvalidRenewalPeriod:return"INVALID_RENEWAL_PERIOD";case Status.InvalidPayerAccountId:return"INVALID_PAYER_ACCOUNT_ID";case Status.AccountDeleted:return"ACCOUNT_DELETED";case Status.FileDeleted:return"FILE_DELETED";case Status.AccountRepeatedInAccountAmounts:return"ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS";case Status.SettingNegativeAccountBalance:return"SETTING_NEGATIVE_ACCOUNT_BALANCE";case Status.ObtainerRequired:return"OBTAINER_REQUIRED";case Status.ObtainerSameContractId:return"OBTAINER_SAME_CONTRACT_ID";case Status.ObtainerDoesNotExist:return"OBTAINER_DOES_NOT_EXIST";case Status.ModifyingImmutableContract:return"MODIFYING_IMMUTABLE_CONTRACT";case Status.FileSystemException:return"FILE_SYSTEM_EXCEPTION";case Status.AutorenewDurationNotInRange:return"AUTORENEW_DURATION_NOT_IN_RANGE";case Status.ErrorDecodingBytestring:return"ERROR_DECODING_BYTESTRING";case Status.ContractFileEmpty:return"CONTRACT_FILE_EMPTY";case Status.ContractBytecodeEmpty:return"CONTRACT_BYTECODE_EMPTY";case Status.InvalidInitialBalance:return"INVALID_INITIAL_BALANCE";case Status.InvalidReceiveRecordThreshold:return"INVALID_RECEIVE_RECORD_THRESHOLD";case Status.InvalidSendRecordThreshold:return"INVALID_SEND_RECORD_THRESHOLD";case Status.AccountIsNotGenesisAccount:return"ACCOUNT_IS_NOT_GENESIS_ACCOUNT";case Status.PayerAccountUnauthorized:return"PAYER_ACCOUNT_UNAUTHORIZED";case Status.InvalidFreezeTransactionBody:return"INVALID_FREEZE_TRANSACTION_BODY";case Status.FreezeTransactionBodyNotFound:return"FREEZE_TRANSACTION_BODY_NOT_FOUND";case Status.TransferListSizeLimitExceeded:return"TRANSFER_LIST_SIZE_LIMIT_EXCEEDED";case Status.ResultSizeLimitExceeded:return"RESULT_SIZE_LIMIT_EXCEEDED";case Status.NotSpecialAccount:return"NOT_SPECIAL_ACCOUNT";case Status.ContractNegativeGas:return"CONTRACT_NEGATIVE_GAS";case Status.ContractNegativeValue:return"CONTRACT_NEGATIVE_VALUE";case Status.InvalidFeeFile:return"INVALID_FEE_FILE";case Status.InvalidExchangeRateFile:return"INVALID_EXCHANGE_RATE_FILE";case Status.InsufficientLocalCallGas:return"INSUFFICIENT_LOCAL_CALL_GAS";case Status.EntityNotAllowedToDelete:return"ENTITY_NOT_ALLOWED_TO_DELETE";case Status.AuthorizationFailed:return"AUTHORIZATION_FAILED";case Status.FileUploadedProtoInvalid:return"FILE_UPLOADED_PROTO_INVALID";case Status.FileUploadedProtoNotSavedToDisk:return"FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK";case Status.FeeScheduleFilePartUploaded:return"FEE_SCHEDULE_FILE_PART_UPLOADED";case Status.ExchangeRateChangeLimitExceeded:return"EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED";case Status.MaxContractStorageExceeded:return"MAX_CONTRACT_STORAGE_EXCEEDED";case Status.TransferAccountSameAsDeleteAccount:return"TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT";case Status.TotalLedgerBalanceInvalid:return"TOTAL_LEDGER_BALANCE_INVALID";case Status.ExpirationReductionNotAllowed:return"EXPIRATION_REDUCTION_NOT_ALLOWED";case Status.MaxGasLimitExceeded:return"MAX_GAS_LIMIT_EXCEEDED";case Status.MaxFileSizeExceeded:return"MAX_FILE_SIZE_EXCEEDED";case Status.ReceiverSigRequired:return"RECEIVER_SIG_REQUIRED";case Status.InvalidTopicId:return"INVALID_TOPIC_ID";case Status.InvalidAdminKey:return"INVALID_ADMIN_KEY";case Status.InvalidSubmitKey:return"INVALID_SUBMIT_KEY";case Status.Unauthorized:return"UNAUTHORIZED";case Status.InvalidTopicMessage:return"INVALID_TOPIC_MESSAGE";case Status.InvalidAutorenewAccount:return"INVALID_AUTORENEW_ACCOUNT";case Status.AutorenewAccountNotAllowed:return"AUTORENEW_ACCOUNT_NOT_ALLOWED";case Status.TopicExpired:return"TOPIC_EXPIRED";case Status.InvalidChunkNumber:return"INVALID_CHUNK_NUMBER";case Status.InvalidChunkTransactionId:return"INVALID_CHUNK_TRANSACTION_ID";case Status.AccountFrozenForToken:return"ACCOUNT_FROZEN_FOR_TOKEN";case Status.TokensPerAccountLimitExceeded:return"TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED";case Status.InvalidTokenId:return"INVALID_TOKEN_ID";case Status.InvalidTokenDecimals:return"INVALID_TOKEN_DECIMALS";case Status.InvalidTokenInitialSupply:return"INVALID_TOKEN_INITIAL_SUPPLY";case Status.InvalidTreasuryAccountForToken:return"INVALID_TREASURY_ACCOUNT_FOR_TOKEN";case Status.InvalidTokenSymbol:return"INVALID_TOKEN_SYMBOL";case Status.TokenHasNoFreezeKey:return"TOKEN_HAS_NO_FREEZE_KEY";case Status.TransfersNotZeroSumForToken:return"TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN";case Status.MissingTokenSymbol:return"MISSING_TOKEN_SYMBOL";case Status.TokenSymbolTooLong:return"TOKEN_SYMBOL_TOO_LONG";case Status.AccountKycNotGrantedForToken:return"ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN";case Status.TokenHasNoKycKey:return"TOKEN_HAS_NO_KYC_KEY";case Status.InsufficientTokenBalance:return"INSUFFICIENT_TOKEN_BALANCE";case Status.TokenWasDeleted:return"TOKEN_WAS_DELETED";case Status.TokenHasNoSupplyKey:return"TOKEN_HAS_NO_SUPPLY_KEY";case Status.TokenHasNoWipeKey:return"TOKEN_HAS_NO_WIPE_KEY";case Status.InvalidTokenMintAmount:return"INVALID_TOKEN_MINT_AMOUNT";case Status.InvalidTokenBurnAmount:return"INVALID_TOKEN_BURN_AMOUNT";case Status.TokenNotAssociatedToAccount:return"TOKEN_NOT_ASSOCIATED_TO_ACCOUNT";case Status.CannotWipeTokenTreasuryAccount:return"CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT";case Status.InvalidKycKey:return"INVALID_KYC_KEY";case Status.InvalidWipeKey:return"INVALID_WIPE_KEY";case Status.InvalidFreezeKey:return"INVALID_FREEZE_KEY";case Status.InvalidSupplyKey:return"INVALID_SUPPLY_KEY";case Status.MissingTokenName:return"MISSING_TOKEN_NAME";case Status.TokenNameTooLong:return"TOKEN_NAME_TOO_LONG";case Status.InvalidWipingAmount:return"INVALID_WIPING_AMOUNT";case Status.TokenIsImmutable:return"TOKEN_IS_IMMUTABLE";case Status.TokenAlreadyAssociatedToAccount:return"TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT";case Status.TransactionRequiresZeroTokenBalances:return"TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES";case Status.AccountIsTreasury:return"ACCOUNT_IS_TREASURY";case Status.TokenIdRepeatedInTokenList:return"TOKEN_ID_REPEATED_IN_TOKEN_LIST";case Status.TokenTransferListSizeLimitExceeded:return"TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED";case Status.EmptyTokenTransferBody:return"EMPTY_TOKEN_TRANSFER_BODY";case Status.EmptyTokenTransferAccountAmounts:return"EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS";case Status.InvalidScheduleId:return"INVALID_SCHEDULE_ID";case Status.ScheduleIsImmutable:return"SCHEDULE_IS_IMMUTABLE";case Status.InvalidSchedulePayerId:return"INVALID_SCHEDULE_PAYER_ID";case Status.InvalidScheduleAccountId:return"INVALID_SCHEDULE_ACCOUNT_ID";case Status.NoNewValidSignatures:return"NO_NEW_VALID_SIGNATURES";case Status.UnresolvableRequiredSigners:return"UNRESOLVABLE_REQUIRED_SIGNERS";case Status.ScheduledTransactionNotInWhitelist:return"SCHEDULED_TRANSACTION_NOT_IN_WHITELIST";case Status.SomeSignaturesWereInvalid:return"SOME_SIGNATURES_WERE_INVALID";case Status.TransactionIdFieldNotAllowed:return"TRANSACTION_ID_FIELD_NOT_ALLOWED";case Status.IdenticalScheduleAlreadyCreated:return"IDENTICAL_SCHEDULE_ALREADY_CREATED";case Status.InvalidZeroByteInString:return"INVALID_ZERO_BYTE_IN_STRING";case Status.ScheduleAlreadyDeleted:return"SCHEDULE_ALREADY_DELETED";case Status.ScheduleAlreadyExecuted:return"SCHEDULE_ALREADY_EXECUTED";case Status.MessageSizeTooLarge:return"MESSAGE_SIZE_TOO_LARGE";case Status.OperationRepeatedInBucketGroups:return"OPERATION_REPEATED_IN_BUCKET_GROUPS";case Status.BucketCapacityOverflow:return"BUCKET_CAPACITY_OVERFLOW";case Status.NodeCapacityNotSufficientForOperation:return"NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION";case Status.BucketHasNoThrottleGroups:return"BUCKET_HAS_NO_THROTTLE_GROUPS";case Status.ThrottleGroupHasZeroOpsPerSec:return"THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC";case Status.SuccessButMissingExpectedOperation:return"SUCCESS_BUT_MISSING_EXPECTED_OPERATION";case Status.UnparseableThrottleDefinitions:return"UNPARSEABLE_THROTTLE_DEFINITIONS";case Status.InvalidThrottleDefinitions:return"INVALID_THROTTLE_DEFINITIONS";case Status.AccountExpiredAndPendingRemoval:return"ACCOUNT_EXPIRED_AND_PENDING_REMOVAL";case Status.InvalidTokenMaxSupply:return"INVALID_TOKEN_MAX_SUPPLY";case Status.InvalidTokenNftSerialNumber:return"INVALID_TOKEN_NFT_SERIAL_NUMBER";case Status.InvalidNftId:return"INVALID_NFT_ID";case Status.MetadataTooLong:return"METADATA_TOO_LONG";case Status.BatchSizeLimitExceeded:return"BATCH_SIZE_LIMIT_EXCEEDED";case Status.InvalidQueryRange:return"INVALID_QUERY_RANGE";case Status.FractionDividesByZero:return"FRACTION_DIVIDES_BY_ZERO";case Status.InsufficientPayerBalanceForCustomFee:return"INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE";case Status.CustomFeesListTooLong:return"CUSTOM_FEES_LIST_TOO_LONG";case Status.InvalidCustomFeeCollector:return"INVALID_CUSTOM_FEE_COLLECTOR";case Status.InvalidTokenIdInCustomFees:return"INVALID_TOKEN_ID_IN_CUSTOM_FEES";case Status.TokenNotAssociatedToFeeCollector:return"TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR";case Status.TokenMaxSupplyReached:return"TOKEN_MAX_SUPPLY_REACHED";case Status.SenderDoesNotOwnNftSerialNo:return"SENDER_DOES_NOT_OWN_NFT_SERIAL_NO";case Status.CustomFeeNotFullySpecified:return"CUSTOM_FEE_NOT_FULLY_SPECIFIED";case Status.CustomFeeMustBePositive:return"CUSTOM_FEE_MUST_BE_POSITIVE";case Status.TokenHasNoFeeScheduleKey:return"TOKEN_HAS_NO_FEE_SCHEDULE_KEY";case Status.CustomFeeOutsideNumericRange:return"CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE";case Status.RoyaltyFractionCannotExceedOne:return"ROYALTY_FRACTION_CANNOT_EXCEED_ONE";case Status.FractionalFeeMaxAmountLessThanMinAmount:return"FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT";case Status.CustomScheduleAlreadyHasNoFees:return"CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES";case Status.CustomFeeDenominationMustBeFungibleCommon:return"CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON";case Status.CustomFractionalFeeOnlyAllowedForFungibleCommon:return"CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON";case Status.InvalidCustomFeeScheduleKey:return"INVALID_CUSTOM_FEE_SCHEDULE_KEY";case Status.InvalidTokenMintMetadata:return"INVALID_TOKEN_MINT_METADATA";case Status.InvalidTokenBurnMetadata:return"INVALID_TOKEN_BURN_METADATA";case Status.CurrentTreasuryStillOwnsNfts:return"CURRENT_TREASURY_STILL_OWNS_NFTS";case Status.AccountStillOwnsNfts:return"ACCOUNT_STILL_OWNS_NFTS";case Status.TreasuryMustOwnBurnedNft:return"TREASURY_MUST_OWN_BURNED_NFT";case Status.AccountDoesNotOwnWipedNft:return"ACCOUNT_DOES_NOT_OWN_WIPED_NFT";case Status.AccountAmountTransfersOnlyAllowedForFungibleCommon:return"ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON";case Status.MaxNftsInPriceRegimeHaveBeenMinted:return"MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED";case Status.PayerAccountDeleted:return"PAYER_ACCOUNT_DELETED";case Status.CustomFeeChargingExceededMaxRecursionDepth:return"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH";case Status.CustomFeeChargingExceededMaxAccountAmounts:return"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS";case Status.InsufficientSenderAccountBalanceForCustomFee:return"INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE";case Status.SerialNumberLimitReached:return"SERIAL_NUMBER_LIMIT_REACHED";case Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique:return"CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE";case Status.NoRemainingAutomaticAssociations:return"NO_REMAINING_AUTOMATIC_ASSOCIATIONS";case Status.ExistingAutomaticAssociationsExceedGivenLimit:return"EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT";case Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit:return"REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT";case Status.TokenIsPaused:return"TOKEN_IS_PAUSED";case Status.TokenHasNoPauseKey:return"TOKEN_HAS_NO_PAUSE_KEY";case Status.InvalidPauseKey:return"INVALID_PAUSE_KEY";case Status.FreezeUpdateFileDoesNotExist:return"FREEZE_UPDATE_FILE_DOES_NOT_EXIST";case Status.FreezeUpdateFileHashDoesNotMatch:return"FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH";case Status.NoUpgradeHasBeenPrepared:return"NO_UPGRADE_HAS_BEEN_PREPARED";case Status.NoFreezeIsScheduled:return"NO_FREEZE_IS_SCHEDULED";case Status.UpdateFileHashChangedSincePrepareUpgrade:return"UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE";case Status.FreezeStartTimeMustBeFuture:return"FREEZE_START_TIME_MUST_BE_FUTURE";case Status.PreparedUpdateFileIsImmutable:return"PREPARED_UPDATE_FILE_IS_IMMUTABLE";case Status.FreezeAlreadyScheduled:return"FREEZE_ALREADY_SCHEDULED";case Status.FreezeUpgradeInProgress:return"FREEZE_UPGRADE_IN_PROGRESS";case Status.UpdateFileIdDoesNotMatchPrepared:return"UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED";case Status.UpdateFileHashDoesNotMatchPrepared:return"UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED";case Status.ConsensusGasExhausted:return"CONSENSUS_GAS_EXHAUSTED";case Status.RevertedSuccess:return"REVERTED_SUCCESS";case Status.MaxStorageInPriceRegimeHasBeenUsed:return"MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED";case Status.InvalidAliasKey:return"INVALID_ALIAS_KEY";case Status.UnexpectedTokenDecimals:return"UNEXPECTED_TOKEN_DECIMALS";case Status.InvalidProxyAccountId:return"INVALID_PROXY_ACCOUNT_ID";case Status.InvalidTransferAccountId:return"INVALID_TRANSFER_ACCOUNT_ID";case Status.InvalidFeeCollectorAccountId:return"INVALID_FEE_COLLECTOR_ACCOUNT_ID";case Status.AliasIsImmutable:return"ALIAS_IS_IMMUTABLE";case Status.SpenderAccountSameAsOwner:return"SPENDER_ACCOUNT_SAME_AS_OWNER";case Status.AmountExceedsTokenMaxSupply:return"AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY";case Status.NegativeAllowanceAmount:return"NEGATIVE_ALLOWANCE_AMOUNT";case Status.CannotApproveForAllFungibleCommon:return"CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON";case Status.SpenderDoesNotHaveAllowance:return"SPENDER_DOES_NOT_HAVE_ALLOWANCE";case Status.AmountExceedsAllowance:return"AMOUNT_EXCEEDS_ALLOWANCE";case Status.MaxAllowancesExceeded:return"MAX_ALLOWANCES_EXCEEDED";case Status.EmptyAllowances:return"EMPTY_ALLOWANCES";case Status.SpenderAccountRepeatedInAllowances:return"SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES";case Status.RepeatedSerialNumsInNftAllowances:return"REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES";case Status.FungibleTokenInNftAllowances:return"FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES";case Status.NftInFungibleTokenAllowances:return"NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES";case Status.InvalidAllowanceOwnerId:return"INVALID_ALLOWANCE_OWNER_ID";case Status.InvalidAllowanceSpenderId:return"INVALID_ALLOWANCE_SPENDER_ID";case Status.RepeatedAllowancesToDelete:return"REPEATED_ALLOWANCES_TO_DELETE";case Status.InvalidDelegatingSpender:return"INVALID_DELEGATING_SPENDER";case Status.DelegatingSpenderCannotGrantApproveForAll:return"DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL";case Status.DelegatingSpenderDoesNotHaveApproveForAll:return"DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL";case Status.ScheduleExpirationTimeTooFarInFuture:return"SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE";case Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime:return"SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME";case Status.ScheduleFutureThrottleExceeded:return"SCHEDULE_FUTURE_THROTTLE_EXCEEDED";case Status.ScheduleFutureGasLimitExceeded:return"SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED";case Status.InvalidEthereumTransaction:return"INVALID_ETHEREUM_TRANSACTION";case Status.WrongChainId:return"WRONG_CHAIN_ID";case Status.WrongNonce:return"WRONG_NONCE";case Status.AccessListUnsupported:return"ACCESS_LIST_UNSUPPORTED";case Status.SchedulePendingExpiration:return"SCHEDULE_PENDING_EXPIRATION";case Status.ContractIsTokenTreasury:return"CONTRACT_IS_TOKEN_TREASURY";case Status.ContractHasNonZeroTokenBalances:return"CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES";case Status.ContractExpiredAndPendingRemoval:return"CONTRACT_EXPIRED_AND_PENDING_REMOVAL";case Status.ContractHasNoAutoRenewAccount:return"CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT";case Status.PermanentRemovalRequiresSystemInitiation:return"PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION";case Status.ProxyAccountIdFieldIsDeprecated:return"PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED";case Status.SelfStakingIsNotAllowed:return"SELF_STAKING_IS_NOT_ALLOWED";case Status.InvalidStakingId:return"INVALID_STAKING_ID";case Status.StakingNotEnabled:return"STAKING_NOT_ENABLED";case Status.InvalidPrngRange:return"INVALID_PRNG_RANGE";case Status.MaxEntitiesInPriceRegimeHaveBeenCreated:return"MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED";case Status.InvalidFullPrefixSignatureForPrecompile:return"INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE";case Status.InsufficientBalancesForStorageRent:return"INSUFFICIENT_BALANCES_FOR_STORAGE_RENT";case Status.MaxChildRecordsExceeded:return"MAX_CHILD_RECORDS_EXCEEDED";case Status.InsufficientBalancesForRenewalFees:return"INSUFFICIENT_BALANCES_FOR_RENEWAL_FEES";case Status.TransactionHasUnknownFields:return"TRANSACTION_HAS_UNKNOWN_FIELDS";case Status.AccountIsImmutable:return"ACCOUNT_IS_IMMUTABLE";case Status.AliasAlreadyAssigned:return"ALIAS_ALREADY_ASSIGNED";case Status.InvalidMetadataKey:return"INVALID_METADATA_KEY";case Status.TokenHasNoMetadataKey:return"TOKEN_HAS_NO_METADATA_KEY";case Status.MissingTokenMetadata:return"MISSING_TOKEN_METADATA";case Status.MissingSerialNumbers:return"MISSING_SERIAL_NUMBERS";case Status.TokenHasNoAdminKey:return"TOKEN_HAS_NO_ADMIN_KEY";case Status.NodeDeleted:return"NODE_DELETED";case Status.InvalidNodeId:return"INVALID_NODE_ID";case Status.InvalidGossipEndpoint:return"INVALID_GOSSIP_ENDPOINT";case Status.InvalidNodeAccountId:return"INVALID_NODE_ACCOUNT_ID";case Status.InvalidNodeDescription:return"INVALID_NODE_DESCRIPTION";case Status.InvalidServiceEndpoint:return"INVALID_SERVICE_ENDPOINT";case Status.InvalidGossipCaCertificate:return"INVALID_GOSSIP_CA_CERTIFICATE";case Status.InvalidGrpcCertificate:return"INVALID_GRPC_CERTIFICATE";case Status.InvalidMaxAutoAssociations:return"INVALID_MAX_AUTO_ASSOCIATIONS";case Status.MaxNodesCreated:return"MAX_NODES_CREATED";case Status.IpFqdnCannotBeSetForSameEndpoint:return"IP_FQDN_CANNOT_BE_SET_FOR_SAME_ENDPOINT";case Status.GossipEndpointCannotHaveFqdn:return"GOSSIP_ENDPOINT_CANNOT_HAVE_FQDN";case Status.FqdnSizeTooLarge:return"FQDN_SIZE_TOO_LARGE";case Status.InvalidEndpoint:return"INVALID_ENDPOINT";case Status.GossipEndpointsExceededLimit:return"GOSSIP_ENDPOINTS_EXCEEDED_LIMIT";case Status.TokenReferenceRepeated:return"TOKEN_REFERENCE_REPEATED";case Status.InvalidOwnerId:return"INVALID_OWNER_ID";case Status.TokenReferenceListSizeLimitExceeded:return"TOKEN_REFERENCE_LIST_SIZE_LIMIT_EXCEEDED";case Status.ServiceEndpointsExceededLimit:return"SERVICE_ENDPOINTS_EXCEEDED_LIMIT";case Status.InvalidIpv4Address:return"INVALID_IPV4_ADDRESS";case Status.EmptyTokenReferenceList:return"EMPTY_TOKEN_REFERENCE_LIST";case Status.UpdateNodeAccountNotAllowed:return"UPDATE_NODE_ACCOUNT_NOT_ALLOWED";case Status.TokenHasNoMetadataOrSupplyKey:return"TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY";case Status.EmptyPendingAirdropIdList:return"EMPTY_PENDING_AIRDROP_ID_LIST";case Status.PendingAirdropIdRepeated:return"PENDING_AIRDROP_ID_REPEATED";case Status.PendingAirdropIdListTooLong:return"PENDING_AIRDROP_ID_LIST_TOO_LONG";case Status.PendingNftAirdropAlreadyExists:return"PENDING_NFT_AIRDROP_ALREADY_EXISTS";case Status.AccountHasPendingAirdrops:return"ACCOUNT_HAS_PENDING_AIRDROPS";case Status.ThrottledAtConsensus:return"THROTTLED_AT_CONSENSUS";case Status.InvalidPendingAirdropId:return"INVALID_PENDING_AIRDROP_ID";case Status.TokenAirdropWithFallbackRoyalty:return"TOKEN_AIRDROP_WITH_FALLBACK_ROYALTY";case Status.InvalidTokenInPendingAirdrop:return"INVALID_TOKEN_IN_PENDING_AIRDROP";case Status.ScheduleExpiryIsBusy:return"SCHEDULE_EXPIRY_IS_BUSY";case Status.InvalidGrpcCertificateHash:return"INVALID_GRPC_CERTIFICATE_HASH";case Status.MissingExpiryTime:return"MISSING_EXPIRY_TIME";case Status.NoSchedulingAllowedAfterScheduledRecursion:return"NO_SCHEDULING_ALLOWED_AFTER_SCHEDULED_RECURSION";case Status.RecursiveSchedulingLimitReached:return"RECURSIVE_SCHEDULING_LIMIT_REACHED";case Status.WaitingForLedgerId:return"WAITING_FOR_LEDGER_ID";case Status.MaxEntriesForFeeExemptKeyListExceeded:return"MAX_ENTRIES_FOR_FEE_EXEMPT_KEY_LIST_EXCEEDED";case Status.FeeExemptKeyListContainsDuplicatedKeys:return"FEE_EXEMPT_KEY_LIST_CONTAINS_DUPLICATED_KEYS";case Status.InvalidKeyInFeeExemptKeyList:return"INVALID_KEY_IN_FEE_EXEMPT_KEY_LIST";case Status.InvalidFeeScheduleKey:return"INVALID_FEE_SCHEDULE_KEY";case Status.FeeScheduleKeyCannotBeUpdated:return"FEE_SCHEDULE_KEY_CANNOT_BE_UPDATED";case Status.FeeScheduleKeyNotSet:return"FEE_SCHEDULE_KEY_NOT_SET";case Status.MaxCustomFeeLimitExceeded:return"MAX_CUSTOM_FEE_LIMIT_EXCEEDED";case Status.NoValidMaxCustomFee:return"NO_VALID_MAX_CUSTOM_FEE";case Status.InvalidMaxCustomFees:return"INVALID_MAX_CUSTOM_FEES";case Status.DuplicateDenominationInMaxCustomFeeList:return"DUPLICATE_DENOMINATION_IN_MAX_CUSTOM_FEE_LIST";case Status.DuplicateAccountIdInMaxCustomFeeList:return"DUPLICATE_ACCOUNT_ID_IN_MAX_CUSTOM_FEE_LIST";case Status.MaxCustomFeesIsNotSupported:return"MAX_CUSTOM_FEES_IS_NOT_SUPPORTED";case Status.BatchListEmpty:return"BATCH_LIST_EMPTY";case Status.BatchListContainsDuplicates:return"BATCH_LIST_CONTAINS_DUPLICATES";case Status.BatchTransactionInBlacklist:return"BATCH_TRANSACTION_IN_BLACKLIST";case Status.InnerTransactionFailed:return"INNER_TRANSACTION_FAILED";case Status.MissingBatchKey:return"MISSING_BATCH_KEY";case Status.BatchKeySetOnNonInnerTransaction:return"BATCH_KEY_SET_ON_NON_INNER_TRANSACTION";case Status.InvalidBatchKey:return"INVALID_BATCH_KEY";case Status.ScheduleExpiryNotConfigurable:return"SCHEDULE_EXPIRY_NOT_CONFIGURABLE";case Status.CreatingSystemEntities:return"CREATING_SYSTEM_ENTITIES";case Status.ThrottleGroupLcmOverflow:return"THROTTLE_GROUP_LCM_OVERFLOW";case Status.AirdropContainsMultipleSendersForAToken:return"AIRDROP_CONTAINS_MULTIPLE_SENDERS_FOR_A_TOKEN";case Status.GrpcWebProxyNotSupported:return"GRPC_WEB_PROXY_NOT_SUPPORTED";case Status.NftTransfersOnlyAllowedForNonFungibleUnique:return"NFT_TRANSFERS_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE";case Status.InvalidSerializedTxMessageHashAlgorithm:return"INVALID_SERIALIZED_TX_MESSAGE_HASH_ALGORITHM";case Status.WrongHookEntityType:return"WRONG_HOOK_ENTITY_TYPE";case Status.EvmHookGasThrottled:return"EVM_HOOK_GAS_THROTTLED";case Status.HookIdInUse:return"HOOK_ID_IN_USE";case Status.BadHookRequest:return"BAD_HOOK_REQUEST";case Status.RejectedByAccountAllowanceHook:return"REJECTED_BY_ACCOUNT_ALLOWANCE_HOOK";case Status.HookNotFound:return"HOOK_NOT_FOUND";case Status.EvmHookStorageUpdateBytesTooLong:return"EVM_HOOK_STORAGE_UPDATE_BYTES_TOO_LONG";case Status.EvmHookStorageUpdateBytesMustUseMinimalRepresentation:return"EVM_HOOK_STORAGE_UPDATE_BYTES_MUST_USE_MINIMAL_REPRESENTATION";case Status.InvalidHookId:return"INVALID_HOOK_ID";case Status.EmptyEvmHookStorageUpdate:return"EMPTY_EVM_HOOK_STORAGE_UPDATE";case Status.HookIdRepeatedInCreationDetails:return"HOOK_ID_REPEATED_IN_CREATION_DETAILS";case Status.HooksNotEnabled:return"HOOKS_NOT_ENABLED";case Status.HookIsNotAnEvmHook:return"HOOK_IS_NOT_AN_EVM_HOOK";case Status.HookDeleted:return"HOOK_DELETED";case Status.TooManyEvmHookStorageUpdates:return"TOO_MANY_EVM_HOOK_STORAGE_UPDATES";case Status.HookCreationBytesMustUseMinimalRepresentation:return"HOOK_CREATION_BYTES_MUST_USE_MINIMAL_REPRESENTATION";case Status.HookCreationBytesTooLong:return"HOOK_CREATION_BYTES_TOO_LONG";case Status.InvalidHookCreationSpec:return"INVALID_HOOK_CREATION_SPEC";case Status.HookExtensionEmpty:return"HOOK_EXTENSION_EMPTY";case Status.InvalidHookAdminKey:return"INVALID_HOOK_ADMIN_KEY";case Status.HookDeletionRequiresZeroStorageSlots:return"HOOK_DELETION_REQUIRES_ZERO_STORAGE_SLOTS";case Status.CannotSetHooksAndApproval:return"CANNOT_SET_HOOKS_AND_APPROVAL";case Status.TransactionRequiresZeroHooks:return"TRANSACTION_REQUIRES_ZERO_HOOKS";case Status.InvalidHookCall:return"INVALID_HOOK_CALL";case Status.HooksAreNotSupportedInAirdrops:return"HOOKS_ARE_NOT_SUPPORTED_IN_AIRDROPS";case Status.AccountIsLinkedToANode:return"ACCOUNT_IS_LINKED_TO_A_NODE";case Status.HooksExecutionsRequireTopLevelCryptoTransfer:return"HOOKS_EXECUTIONS_REQUIRE_TOP_LEVEL_CRYPTO_TRANSFER";case Status.NodeAccountHasZeroBalance:return"NODE_ACCOUNT_HAS_ZERO_BALANCE";case Status.TransferToFeeCollectionAccountNotAllowed:return"TRANSFER_TO_FEE_COLLECTION_ACCOUNT_NOT_ALLOWED";case Status.TooManyHookInvocations:return"TOO_MANY_HOOK_INVOCATIONS";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return Status.Ok;case 1:return Status.InvalidTransaction;case 2:return Status.PayerAccountNotFound;case 3:return Status.InvalidNodeAccount;case 4:return Status.TransactionExpired;case 5:return Status.InvalidTransactionStart;case 6:return Status.InvalidTransactionDuration;case 7:return Status.InvalidSignature;case 8:return Status.MemoTooLong;case 9:return Status.InsufficientTxFee;case 10:return Status.InsufficientPayerBalance;case 11:return Status.DuplicateTransaction;case 12:return Status.Busy;case 13:return Status.NotSupported;case 14:return Status.InvalidFileId;case 15:return Status.InvalidAccountId;case 16:return Status.InvalidContractId;case 17:return Status.InvalidTransactionId;case 18:return Status.ReceiptNotFound;case 19:return Status.RecordNotFound;case 20:return Status.InvalidSolidityId;case 21:return Status.Unknown;case 22:return Status.Success;case 23:return Status.FailInvalid;case 24:return Status.FailFee;case 25:return Status.FailBalance;case 26:return Status.KeyRequired;case 27:return Status.BadEncoding;case 28:return Status.InsufficientAccountBalance;case 29:return Status.InvalidSolidityAddress;case 30:return Status.InsufficientGas;case 31:return Status.ContractSizeLimitExceeded;case 32:return Status.LocalCallModificationException;case 33:return Status.ContractRevertExecuted;case 34:return Status.ContractExecutionException;case 35:return Status.InvalidReceivingNodeAccount;case 36:return Status.MissingQueryHeader;case 37:return Status.AccountUpdateFailed;case 38:return Status.InvalidKeyEncoding;case 39:return Status.NullSolidityAddress;case 40:return Status.ContractUpdateFailed;case 41:return Status.InvalidQueryHeader;case 42:return Status.InvalidFeeSubmitted;case 43:return Status.InvalidPayerSignature;case 44:return Status.KeyNotProvided;case 45:return Status.InvalidExpirationTime;case 46:return Status.NoWaclKey;case 47:return Status.FileContentEmpty;case 48:return Status.InvalidAccountAmounts;case 49:return Status.EmptyTransactionBody;case 50:return Status.InvalidTransactionBody;case 51:return Status.InvalidSignatureTypeMismatchingKey;case 52:return Status.InvalidSignatureCountMismatchingKey;case 53:return Status.EmptyLiveHashBody;case 54:return Status.EmptyLiveHash;case 55:return Status.EmptyLiveHashKeys;case 56:return Status.InvalidLiveHashSize;case 57:return Status.EmptyQueryBody;case 58:return Status.EmptyLiveHashQuery;case 59:return Status.LiveHashNotFound;case 60:return Status.AccountIdDoesNotExist;case 61:return Status.LiveHashAlreadyExists;case 62:return Status.InvalidFileWacl;case 63:return Status.SerializationFailed;case 64:return Status.TransactionOversize;case 65:return Status.TransactionTooManyLayers;case 66:return Status.ContractDeleted;case 67:return Status.PlatformNotActive;case 68:return Status.KeyPrefixMismatch;case 69:return Status.PlatformTransactionNotCreated;case 70:return Status.InvalidRenewalPeriod;case 71:return Status.InvalidPayerAccountId;case 72:return Status.AccountDeleted;case 73:return Status.FileDeleted;case 74:return Status.AccountRepeatedInAccountAmounts;case 75:return Status.SettingNegativeAccountBalance;case 76:return Status.ObtainerRequired;case 77:return Status.ObtainerSameContractId;case 78:return Status.ObtainerDoesNotExist;case 79:return Status.ModifyingImmutableContract;case 80:return Status.FileSystemException;case 81:return Status.AutorenewDurationNotInRange;case 82:return Status.ErrorDecodingBytestring;case 83:return Status.ContractFileEmpty;case 84:return Status.ContractBytecodeEmpty;case 85:return Status.InvalidInitialBalance;case 86:return Status.InvalidReceiveRecordThreshold;case 87:return Status.InvalidSendRecordThreshold;case 88:return Status.AccountIsNotGenesisAccount;case 89:return Status.PayerAccountUnauthorized;case 90:return Status.InvalidFreezeTransactionBody;case 91:return Status.FreezeTransactionBodyNotFound;case 92:return Status.TransferListSizeLimitExceeded;case 93:return Status.ResultSizeLimitExceeded;case 94:return Status.NotSpecialAccount;case 95:return Status.ContractNegativeGas;case 96:return Status.ContractNegativeValue;case 97:return Status.InvalidFeeFile;case 98:return Status.InvalidExchangeRateFile;case 99:return Status.InsufficientLocalCallGas;case 100:return Status.EntityNotAllowedToDelete;case 101:return Status.AuthorizationFailed;case 102:return Status.FileUploadedProtoInvalid;case 103:return Status.FileUploadedProtoNotSavedToDisk;case 104:return Status.FeeScheduleFilePartUploaded;case 105:return Status.ExchangeRateChangeLimitExceeded;case 106:return Status.MaxContractStorageExceeded;case 107:return Status.TransferAccountSameAsDeleteAccount;case 108:return Status.TotalLedgerBalanceInvalid;case 110:return Status.ExpirationReductionNotAllowed;case 111:return Status.MaxGasLimitExceeded;case 112:return Status.MaxFileSizeExceeded;case 113:return Status.ReceiverSigRequired;case 150:return Status.InvalidTopicId;case 155:return Status.InvalidAdminKey;case 156:return Status.InvalidSubmitKey;case 157:return Status.Unauthorized;case 158:return Status.InvalidTopicMessage;case 159:return Status.InvalidAutorenewAccount;case 160:return Status.AutorenewAccountNotAllowed;case 162:return Status.TopicExpired;case 163:return Status.InvalidChunkNumber;case 164:return Status.InvalidChunkTransactionId;case 165:return Status.AccountFrozenForToken;case 166:return Status.TokensPerAccountLimitExceeded;case 167:return Status.InvalidTokenId;case 168:return Status.InvalidTokenDecimals;case 169:return Status.InvalidTokenInitialSupply;case 170:return Status.InvalidTreasuryAccountForToken;case 171:return Status.InvalidTokenSymbol;case 172:return Status.TokenHasNoFreezeKey;case 173:return Status.TransfersNotZeroSumForToken;case 174:return Status.MissingTokenSymbol;case 175:return Status.TokenSymbolTooLong;case 176:return Status.AccountKycNotGrantedForToken;case 177:return Status.TokenHasNoKycKey;case 178:return Status.InsufficientTokenBalance;case 179:return Status.TokenWasDeleted;case 180:return Status.TokenHasNoSupplyKey;case 181:return Status.TokenHasNoWipeKey;case 182:return Status.InvalidTokenMintAmount;case 183:return Status.InvalidTokenBurnAmount;case 184:return Status.TokenNotAssociatedToAccount;case 185:return Status.CannotWipeTokenTreasuryAccount;case 186:return Status.InvalidKycKey;case 187:return Status.InvalidWipeKey;case 188:return Status.InvalidFreezeKey;case 189:return Status.InvalidSupplyKey;case 190:return Status.MissingTokenName;case 191:return Status.TokenNameTooLong;case 192:return Status.InvalidWipingAmount;case 193:return Status.TokenIsImmutable;case 194:return Status.TokenAlreadyAssociatedToAccount;case 195:return Status.TransactionRequiresZeroTokenBalances;case 196:return Status.AccountIsTreasury;case 197:return Status.TokenIdRepeatedInTokenList;case 198:return Status.TokenTransferListSizeLimitExceeded;case 199:return Status.EmptyTokenTransferBody;case 200:return Status.EmptyTokenTransferAccountAmounts;case 201:return Status.InvalidScheduleId;case 202:return Status.ScheduleIsImmutable;case 203:return Status.InvalidSchedulePayerId;case 204:return Status.InvalidScheduleAccountId;case 205:return Status.NoNewValidSignatures;case 206:return Status.UnresolvableRequiredSigners;case 207:return Status.ScheduledTransactionNotInWhitelist;case 208:return Status.SomeSignaturesWereInvalid;case 209:return Status.TransactionIdFieldNotAllowed;case 210:return Status.IdenticalScheduleAlreadyCreated;case 211:return Status.InvalidZeroByteInString;case 212:return Status.ScheduleAlreadyDeleted;case 213:return Status.ScheduleAlreadyExecuted;case 214:return Status.MessageSizeTooLarge;case 215:return Status.OperationRepeatedInBucketGroups;case 216:return Status.BucketCapacityOverflow;case 217:return Status.NodeCapacityNotSufficientForOperation;case 218:return Status.BucketHasNoThrottleGroups;case 219:return Status.ThrottleGroupHasZeroOpsPerSec;case 220:return Status.SuccessButMissingExpectedOperation;case 221:return Status.UnparseableThrottleDefinitions;case 222:return Status.InvalidThrottleDefinitions;case 223:return Status.AccountExpiredAndPendingRemoval;case 224:return Status.InvalidTokenMaxSupply;case 225:return Status.InvalidTokenNftSerialNumber;case 226:return Status.InvalidNftId;case 227:return Status.MetadataTooLong;case 228:return Status.BatchSizeLimitExceeded;case 229:return Status.InvalidQueryRange;case 230:return Status.FractionDividesByZero;case 231:return Status.InsufficientPayerBalanceForCustomFee;case 232:return Status.CustomFeesListTooLong;case 233:return Status.InvalidCustomFeeCollector;case 234:return Status.InvalidTokenIdInCustomFees;case 235:return Status.TokenNotAssociatedToFeeCollector;case 236:return Status.TokenMaxSupplyReached;case 237:return Status.SenderDoesNotOwnNftSerialNo;case 238:return Status.CustomFeeNotFullySpecified;case 239:return Status.CustomFeeMustBePositive;case 240:return Status.TokenHasNoFeeScheduleKey;case 241:return Status.CustomFeeOutsideNumericRange;case 242:return Status.RoyaltyFractionCannotExceedOne;case 243:return Status.FractionalFeeMaxAmountLessThanMinAmount;case 244:return Status.CustomScheduleAlreadyHasNoFees;case 245:return Status.CustomFeeDenominationMustBeFungibleCommon;case 246:return Status.CustomFractionalFeeOnlyAllowedForFungibleCommon;case 247:return Status.InvalidCustomFeeScheduleKey;case 248:return Status.InvalidTokenMintMetadata;case 249:return Status.InvalidTokenBurnMetadata;case 250:return Status.CurrentTreasuryStillOwnsNfts;case 251:return Status.AccountStillOwnsNfts;case 252:return Status.TreasuryMustOwnBurnedNft;case 253:return Status.AccountDoesNotOwnWipedNft;case 254:return Status.AccountAmountTransfersOnlyAllowedForFungibleCommon;case 255:return Status.MaxNftsInPriceRegimeHaveBeenMinted;case 256:return Status.PayerAccountDeleted;case 257:return Status.CustomFeeChargingExceededMaxRecursionDepth;case 258:return Status.CustomFeeChargingExceededMaxAccountAmounts;case 259:return Status.InsufficientSenderAccountBalanceForCustomFee;case 260:return Status.SerialNumberLimitReached;case 261:return Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique;case 262:return Status.NoRemainingAutomaticAssociations;case 263:return Status.ExistingAutomaticAssociationsExceedGivenLimit;case 264:return Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit;case 265:return Status.TokenIsPaused;case 266:return Status.TokenHasNoPauseKey;case 267:return Status.InvalidPauseKey;case 268:return Status.FreezeUpdateFileDoesNotExist;case 269:return Status.FreezeUpdateFileHashDoesNotMatch;case 270:return Status.NoUpgradeHasBeenPrepared;case 271:return Status.NoFreezeIsScheduled;case 272:return Status.UpdateFileHashChangedSincePrepareUpgrade;case 273:return Status.FreezeStartTimeMustBeFuture;case 274:return Status.PreparedUpdateFileIsImmutable;case 275:return Status.FreezeAlreadyScheduled;case 276:return Status.FreezeUpgradeInProgress;case 277:return Status.UpdateFileIdDoesNotMatchPrepared;case 278:return Status.UpdateFileHashDoesNotMatchPrepared;case 279:return Status.ConsensusGasExhausted;case 280:return Status.RevertedSuccess;case 281:return Status.MaxStorageInPriceRegimeHasBeenUsed;case 282:return Status.InvalidAliasKey;case 283:return Status.UnexpectedTokenDecimals;case 284:return Status.InvalidProxyAccountId;case 285:return Status.InvalidTransferAccountId;case 286:return Status.InvalidFeeCollectorAccountId;case 287:return Status.AliasIsImmutable;case 288:return Status.SpenderAccountSameAsOwner;case 289:return Status.AmountExceedsTokenMaxSupply;case 290:return Status.NegativeAllowanceAmount;case 291:return Status.CannotApproveForAllFungibleCommon;case 292:return Status.SpenderDoesNotHaveAllowance;case 293:return Status.AmountExceedsAllowance;case 294:return Status.MaxAllowancesExceeded;case 295:return Status.EmptyAllowances;case 296:return Status.SpenderAccountRepeatedInAllowances;case 297:return Status.RepeatedSerialNumsInNftAllowances;case 298:return Status.FungibleTokenInNftAllowances;case 299:return Status.NftInFungibleTokenAllowances;case 300:return Status.InvalidAllowanceOwnerId;case 301:return Status.InvalidAllowanceSpenderId;case 302:return Status.RepeatedAllowancesToDelete;case 303:return Status.InvalidDelegatingSpender;case 304:return Status.DelegatingSpenderCannotGrantApproveForAll;case 305:return Status.DelegatingSpenderDoesNotHaveApproveForAll;case 306:return Status.ScheduleExpirationTimeTooFarInFuture;case 307:return Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime;case 308:return Status.ScheduleFutureThrottleExceeded;case 309:return Status.ScheduleFutureGasLimitExceeded;case 310:return Status.InvalidEthereumTransaction;case 311:return Status.WrongChainId;case 312:return Status.WrongNonce;case 313:return Status.AccessListUnsupported;case 314:return Status.SchedulePendingExpiration;case 315:return Status.ContractIsTokenTreasury;case 316:return Status.ContractHasNonZeroTokenBalances;case 317:return Status.ContractExpiredAndPendingRemoval;case 318:return Status.ContractHasNoAutoRenewAccount;case 319:return Status.PermanentRemovalRequiresSystemInitiation;case 320:return Status.ProxyAccountIdFieldIsDeprecated;case 321:return Status.SelfStakingIsNotAllowed;case 322:return Status.InvalidStakingId;case 323:return Status.StakingNotEnabled;case 324:return Status.InvalidPrngRange;case 325:return Status.MaxEntitiesInPriceRegimeHaveBeenCreated;case 326:return Status.InvalidFullPrefixSignatureForPrecompile;case 327:return Status.InsufficientBalancesForStorageRent;case 328:return Status.MaxChildRecordsExceeded;case 329:return Status.InsufficientBalancesForRenewalFees;case 330:return Status.TransactionHasUnknownFields;case 331:return Status.AccountIsImmutable;case 332:return Status.AliasAlreadyAssigned;case 333:return Status.InvalidMetadataKey;case 334:return Status.TokenHasNoMetadataKey;case 335:return Status.MissingTokenMetadata;case 336:return Status.MissingSerialNumbers;case 337:return Status.TokenHasNoAdminKey;case 338:return Status.NodeDeleted;case 339:return Status.InvalidNodeId;case 340:return Status.InvalidGossipEndpoint;case 341:return Status.InvalidNodeAccountId;case 342:return Status.InvalidNodeDescription;case 343:return Status.InvalidServiceEndpoint;case 344:return Status.InvalidGossipCaCertificate;case 345:return Status.InvalidGrpcCertificate;case 346:return Status.InvalidMaxAutoAssociations;case 347:return Status.MaxNodesCreated;case 348:return Status.IpFqdnCannotBeSetForSameEndpoint;case 349:return Status.GossipEndpointCannotHaveFqdn;case 350:return Status.FqdnSizeTooLarge;case 351:return Status.InvalidEndpoint;case 352:return Status.GossipEndpointsExceededLimit;case 353:return Status.TokenReferenceRepeated;case 354:return Status.InvalidOwnerId;case 355:return Status.TokenReferenceListSizeLimitExceeded;case 356:return Status.ServiceEndpointsExceededLimit;case 357:return Status.InvalidIpv4Address;case 358:return Status.EmptyTokenReferenceList;case 359:return Status.UpdateNodeAccountNotAllowed;case 360:return Status.TokenHasNoMetadataOrSupplyKey;case 361:return Status.EmptyPendingAirdropIdList;case 362:return Status.PendingAirdropIdRepeated;case 363:return Status.PendingAirdropIdListTooLong;case 364:return Status.PendingNftAirdropAlreadyExists;case 365:return Status.AccountHasPendingAirdrops;case 366:return Status.ThrottledAtConsensus;case 367:return Status.InvalidPendingAirdropId;case 368:return Status.TokenAirdropWithFallbackRoyalty;case 369:return Status.InvalidTokenInPendingAirdrop;case 370:return Status.ScheduleExpiryIsBusy;case 371:return Status.InvalidGrpcCertificateHash;case 372:return Status.MissingExpiryTime;case 373:return Status.NoSchedulingAllowedAfterScheduledRecursion;case 374:return Status.RecursiveSchedulingLimitReached;case 375:return Status.WaitingForLedgerId;case 376:return Status.MaxEntriesForFeeExemptKeyListExceeded;case 377:return Status.FeeExemptKeyListContainsDuplicatedKeys;case 378:return Status.InvalidKeyInFeeExemptKeyList;case 379:return Status.InvalidFeeScheduleKey;case 380:return Status.FeeScheduleKeyCannotBeUpdated;case 381:return Status.FeeScheduleKeyNotSet;case 382:return Status.MaxCustomFeeLimitExceeded;case 383:return Status.NoValidMaxCustomFee;case 384:return Status.InvalidMaxCustomFees;case 385:return Status.DuplicateDenominationInMaxCustomFeeList;case 386:return Status.DuplicateAccountIdInMaxCustomFeeList;case 387:return Status.MaxCustomFeesIsNotSupported;case 388:return Status.BatchListEmpty;case 389:return Status.BatchListContainsDuplicates;case 390:return Status.BatchTransactionInBlacklist;case 391:return Status.InnerTransactionFailed;case 392:return Status.MissingBatchKey;case 393:return Status.BatchKeySetOnNonInnerTransaction;case 394:return Status.InvalidBatchKey;case 395:return Status.ScheduleExpiryNotConfigurable;case 396:return Status.CreatingSystemEntities;case 397:return Status.ThrottleGroupLcmOverflow;case 398:return Status.AirdropContainsMultipleSendersForAToken;case 399:return Status.GrpcWebProxyNotSupported;case 400:return Status.NftTransfersOnlyAllowedForNonFungibleUnique;case 401:return Status.InvalidSerializedTxMessageHashAlgorithm;case 499:return Status.WrongHookEntityType;case 500:return Status.EvmHookGasThrottled;case 501:return Status.HookIdInUse;case 502:return Status.BadHookRequest;case 503:return Status.RejectedByAccountAllowanceHook;case 504:return Status.HookNotFound;case 505:return Status.EvmHookStorageUpdateBytesTooLong;case 506:return Status.EvmHookStorageUpdateBytesMustUseMinimalRepresentation;case 507:return Status.InvalidHookId;case 508:return Status.EmptyEvmHookStorageUpdate;case 509:return Status.HookIdRepeatedInCreationDetails;case 510:return Status.HooksNotEnabled;case 511:return Status.HookIsNotAnEvmHook;case 512:return Status.HookDeleted;case 513:return Status.TooManyEvmHookStorageUpdates;case 514:return Status.HookCreationBytesMustUseMinimalRepresentation;case 515:return Status.HookCreationBytesTooLong;case 516:return Status.InvalidHookCreationSpec;case 517:return Status.HookExtensionEmpty;case 518:return Status.InvalidHookAdminKey;case 519:return Status.HookDeletionRequiresZeroStorageSlots;case 520:return Status.CannotSetHooksAndApproval;case 521:return Status.TransactionRequiresZeroHooks;case 522:return Status.InvalidHookCall;case 523:return Status.HooksAreNotSupportedInAirdrops;case 524:return Status.AccountIsLinkedToANode;case 525:return Status.HooksExecutionsRequireTopLevelCryptoTransfer;case 526:return Status.NodeAccountHasZeroBalance;case 527:return Status.TransferToFeeCollectionAccountNotAllowed;case 528:return Status.TooManyHookInvocations;default:throw new Error(`(BUG) Status.fromCode() does not handle code: ${e}`)}}valueOf(){return this._code}}Status.Ok=new Status(0),Status.InvalidTransaction=new Status(1),Status.PayerAccountNotFound=new Status(2),Status.InvalidNodeAccount=new Status(3),Status.TransactionExpired=new Status(4),Status.InvalidTransactionStart=new Status(5),Status.InvalidTransactionDuration=new Status(6),Status.InvalidSignature=new Status(7),Status.MemoTooLong=new Status(8),Status.InsufficientTxFee=new Status(9),Status.InsufficientPayerBalance=new Status(10),Status.DuplicateTransaction=new Status(11),Status.Busy=new Status(12),Status.NotSupported=new Status(13),Status.InvalidFileId=new Status(14),Status.InvalidAccountId=new Status(15),Status.InvalidContractId=new Status(16),Status.InvalidTransactionId=new Status(17),Status.ReceiptNotFound=new Status(18),Status.RecordNotFound=new Status(19),Status.InvalidSolidityId=new Status(20),Status.Unknown=new Status(21),Status.Success=new Status(22),Status.FailInvalid=new Status(23),Status.FailFee=new Status(24),Status.FailBalance=new Status(25),Status.KeyRequired=new Status(26),Status.BadEncoding=new Status(27),Status.InsufficientAccountBalance=new Status(28),Status.InvalidSolidityAddress=new Status(29),Status.InsufficientGas=new Status(30),Status.ContractSizeLimitExceeded=new Status(31),Status.LocalCallModificationException=new Status(32),Status.ContractRevertExecuted=new Status(33),Status.ContractExecutionException=new Status(34),Status.InvalidReceivingNodeAccount=new Status(35),Status.MissingQueryHeader=new Status(36),Status.AccountUpdateFailed=new Status(37),Status.InvalidKeyEncoding=new Status(38),Status.NullSolidityAddress=new Status(39),Status.ContractUpdateFailed=new Status(40),Status.InvalidQueryHeader=new Status(41),Status.InvalidFeeSubmitted=new Status(42),Status.InvalidPayerSignature=new Status(43),Status.KeyNotProvided=new Status(44),Status.InvalidExpirationTime=new Status(45),Status.NoWaclKey=new Status(46),Status.FileContentEmpty=new Status(47),Status.InvalidAccountAmounts=new Status(48),Status.EmptyTransactionBody=new Status(49),Status.InvalidTransactionBody=new Status(50),Status.InvalidSignatureTypeMismatchingKey=new Status(51),Status.InvalidSignatureCountMismatchingKey=new Status(52),Status.EmptyLiveHashBody=new Status(53),Status.EmptyLiveHash=new Status(54),Status.EmptyLiveHashKeys=new Status(55),Status.InvalidLiveHashSize=new Status(56),Status.EmptyQueryBody=new Status(57),Status.EmptyLiveHashQuery=new Status(58),Status.LiveHashNotFound=new Status(59),Status.AccountIdDoesNotExist=new Status(60),Status.LiveHashAlreadyExists=new Status(61),Status.InvalidFileWacl=new Status(62),Status.SerializationFailed=new Status(63),Status.TransactionOversize=new Status(64),Status.TransactionTooManyLayers=new Status(65),Status.ContractDeleted=new Status(66),Status.PlatformNotActive=new Status(67),Status.KeyPrefixMismatch=new Status(68),Status.PlatformTransactionNotCreated=new Status(69),Status.InvalidRenewalPeriod=new Status(70),Status.InvalidPayerAccountId=new Status(71),Status.AccountDeleted=new Status(72),Status.FileDeleted=new Status(73),Status.AccountRepeatedInAccountAmounts=new Status(74),Status.SettingNegativeAccountBalance=new Status(75),Status.ObtainerRequired=new Status(76),Status.ObtainerSameContractId=new Status(77),Status.ObtainerDoesNotExist=new Status(78),Status.ModifyingImmutableContract=new Status(79),Status.FileSystemException=new Status(80),Status.AutorenewDurationNotInRange=new Status(81),Status.ErrorDecodingBytestring=new Status(82),Status.ContractFileEmpty=new Status(83),Status.ContractBytecodeEmpty=new Status(84),Status.InvalidInitialBalance=new Status(85),Status.InvalidReceiveRecordThreshold=new Status(86),Status.InvalidSendRecordThreshold=new Status(87),Status.AccountIsNotGenesisAccount=new Status(88),Status.PayerAccountUnauthorized=new Status(89),Status.InvalidFreezeTransactionBody=new Status(90),Status.FreezeTransactionBodyNotFound=new Status(91),Status.TransferListSizeLimitExceeded=new Status(92),Status.ResultSizeLimitExceeded=new Status(93),Status.NotSpecialAccount=new Status(94),Status.ContractNegativeGas=new Status(95),Status.ContractNegativeValue=new Status(96),Status.InvalidFeeFile=new Status(97),Status.InvalidExchangeRateFile=new Status(98),Status.InsufficientLocalCallGas=new Status(99),Status.EntityNotAllowedToDelete=new Status(100),Status.AuthorizationFailed=new Status(101),Status.FileUploadedProtoInvalid=new Status(102),Status.FileUploadedProtoNotSavedToDisk=new Status(103),Status.FeeScheduleFilePartUploaded=new Status(104),Status.ExchangeRateChangeLimitExceeded=new Status(105),Status.MaxContractStorageExceeded=new Status(106),Status.TransferAccountSameAsDeleteAccount=new Status(107),Status.TotalLedgerBalanceInvalid=new Status(108),Status.ExpirationReductionNotAllowed=new Status(110),Status.MaxGasLimitExceeded=new Status(111),Status.MaxFileSizeExceeded=new Status(112),Status.ReceiverSigRequired=new Status(113),Status.InvalidTopicId=new Status(150),Status.InvalidAdminKey=new Status(155),Status.InvalidSubmitKey=new Status(156),Status.Unauthorized=new Status(157),Status.InvalidTopicMessage=new Status(158),Status.InvalidAutorenewAccount=new Status(159),Status.AutorenewAccountNotAllowed=new Status(160),Status.TopicExpired=new Status(162),Status.InvalidChunkNumber=new Status(163),Status.InvalidChunkTransactionId=new Status(164),Status.AccountFrozenForToken=new Status(165),Status.TokensPerAccountLimitExceeded=new Status(166),Status.InvalidTokenId=new Status(167),Status.InvalidTokenDecimals=new Status(168),Status.InvalidTokenInitialSupply=new Status(169),Status.InvalidTreasuryAccountForToken=new Status(170),Status.InvalidTokenSymbol=new Status(171),Status.TokenHasNoFreezeKey=new Status(172),Status.TransfersNotZeroSumForToken=new Status(173),Status.MissingTokenSymbol=new Status(174),Status.TokenSymbolTooLong=new Status(175),Status.AccountKycNotGrantedForToken=new Status(176),Status.TokenHasNoKycKey=new Status(177),Status.InsufficientTokenBalance=new Status(178),Status.TokenWasDeleted=new Status(179),Status.TokenHasNoSupplyKey=new Status(180),Status.TokenHasNoWipeKey=new Status(181),Status.InvalidTokenMintAmount=new Status(182),Status.InvalidTokenBurnAmount=new Status(183),Status.TokenNotAssociatedToAccount=new Status(184),Status.CannotWipeTokenTreasuryAccount=new Status(185),Status.InvalidKycKey=new Status(186),Status.InvalidWipeKey=new Status(187),Status.InvalidFreezeKey=new Status(188),Status.InvalidSupplyKey=new Status(189),Status.MissingTokenName=new Status(190),Status.TokenNameTooLong=new Status(191),Status.InvalidWipingAmount=new Status(192),Status.TokenIsImmutable=new Status(193),Status.TokenAlreadyAssociatedToAccount=new Status(194),Status.TransactionRequiresZeroTokenBalances=new Status(195),Status.AccountIsTreasury=new Status(196),Status.TokenIdRepeatedInTokenList=new Status(197),Status.TokenTransferListSizeLimitExceeded=new Status(198),Status.EmptyTokenTransferBody=new Status(199),Status.EmptyTokenTransferAccountAmounts=new Status(200),Status.InvalidScheduleId=new Status(201),Status.ScheduleIsImmutable=new Status(202),Status.InvalidSchedulePayerId=new Status(203),Status.InvalidScheduleAccountId=new Status(204),Status.NoNewValidSignatures=new Status(205),Status.UnresolvableRequiredSigners=new Status(206),Status.ScheduledTransactionNotInWhitelist=new Status(207),Status.SomeSignaturesWereInvalid=new Status(208),Status.TransactionIdFieldNotAllowed=new Status(209),Status.IdenticalScheduleAlreadyCreated=new Status(210),Status.InvalidZeroByteInString=new Status(211),Status.ScheduleAlreadyDeleted=new Status(212),Status.ScheduleAlreadyExecuted=new Status(213),Status.MessageSizeTooLarge=new Status(214),Status.OperationRepeatedInBucketGroups=new Status(215),Status.BucketCapacityOverflow=new Status(216),Status.NodeCapacityNotSufficientForOperation=new Status(217),Status.BucketHasNoThrottleGroups=new Status(218),Status.ThrottleGroupHasZeroOpsPerSec=new Status(219),Status.SuccessButMissingExpectedOperation=new Status(220),Status.UnparseableThrottleDefinitions=new Status(221),Status.InvalidThrottleDefinitions=new Status(222),Status.AccountExpiredAndPendingRemoval=new Status(223),Status.InvalidTokenMaxSupply=new Status(224),Status.InvalidTokenNftSerialNumber=new Status(225),Status.InvalidNftId=new Status(226),Status.MetadataTooLong=new Status(227),Status.BatchSizeLimitExceeded=new Status(228),Status.InvalidQueryRange=new Status(229),Status.FractionDividesByZero=new Status(230),Status.InsufficientPayerBalanceForCustomFee=new Status(231),Status.CustomFeesListTooLong=new Status(232),Status.InvalidCustomFeeCollector=new Status(233),Status.InvalidTokenIdInCustomFees=new Status(234),Status.TokenNotAssociatedToFeeCollector=new Status(235),Status.TokenMaxSupplyReached=new Status(236),Status.SenderDoesNotOwnNftSerialNo=new Status(237),Status.CustomFeeNotFullySpecified=new Status(238),Status.CustomFeeMustBePositive=new Status(239),Status.TokenHasNoFeeScheduleKey=new Status(240),Status.CustomFeeOutsideNumericRange=new Status(241),Status.RoyaltyFractionCannotExceedOne=new Status(242),Status.FractionalFeeMaxAmountLessThanMinAmount=new Status(243),Status.CustomScheduleAlreadyHasNoFees=new Status(244),Status.CustomFeeDenominationMustBeFungibleCommon=new Status(245),Status.CustomFractionalFeeOnlyAllowedForFungibleCommon=new Status(246),Status.InvalidCustomFeeScheduleKey=new Status(247),Status.InvalidTokenMintMetadata=new Status(248),Status.InvalidTokenBurnMetadata=new Status(249),Status.CurrentTreasuryStillOwnsNfts=new Status(250),Status.AccountStillOwnsNfts=new Status(251),Status.TreasuryMustOwnBurnedNft=new Status(252),Status.AccountDoesNotOwnWipedNft=new Status(253),Status.AccountAmountTransfersOnlyAllowedForFungibleCommon=new Status(254),Status.MaxNftsInPriceRegimeHaveBeenMinted=new Status(255),Status.PayerAccountDeleted=new Status(256),Status.CustomFeeChargingExceededMaxRecursionDepth=new Status(257),Status.CustomFeeChargingExceededMaxAccountAmounts=new Status(258),Status.InsufficientSenderAccountBalanceForCustomFee=new Status(259),Status.SerialNumberLimitReached=new Status(260),Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique=new Status(261),Status.NoRemainingAutomaticAssociations=new Status(262),Status.ExistingAutomaticAssociationsExceedGivenLimit=new Status(263),Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit=new Status(264),Status.TokenIsPaused=new Status(265),Status.TokenHasNoPauseKey=new Status(266),Status.InvalidPauseKey=new Status(267),Status.FreezeUpdateFileDoesNotExist=new Status(268),Status.FreezeUpdateFileHashDoesNotMatch=new Status(269),Status.NoUpgradeHasBeenPrepared=new Status(270),Status.NoFreezeIsScheduled=new Status(271),Status.UpdateFileHashChangedSincePrepareUpgrade=new Status(272),Status.FreezeStartTimeMustBeFuture=new Status(273),Status.PreparedUpdateFileIsImmutable=new Status(274),Status.FreezeAlreadyScheduled=new Status(275),Status.FreezeUpgradeInProgress=new Status(276),Status.UpdateFileIdDoesNotMatchPrepared=new Status(277),Status.UpdateFileHashDoesNotMatchPrepared=new Status(278),Status.ConsensusGasExhausted=new Status(279),Status.RevertedSuccess=new Status(280),Status.MaxStorageInPriceRegimeHasBeenUsed=new Status(281),Status.InvalidAliasKey=new Status(282),Status.UnexpectedTokenDecimals=new Status(283),Status.InvalidProxyAccountId=new Status(284),Status.InvalidTransferAccountId=new Status(285),Status.InvalidFeeCollectorAccountId=new Status(286),Status.AliasIsImmutable=new Status(287),Status.SpenderAccountSameAsOwner=new Status(288),Status.AmountExceedsTokenMaxSupply=new Status(289),Status.NegativeAllowanceAmount=new Status(290),Status.CannotApproveForAllFungibleCommon=new Status(291),Status.SpenderDoesNotHaveAllowance=new Status(292),Status.AmountExceedsAllowance=new Status(293),Status.MaxAllowancesExceeded=new Status(294),Status.EmptyAllowances=new Status(295),Status.SpenderAccountRepeatedInAllowances=new Status(296),Status.RepeatedSerialNumsInNftAllowances=new Status(297),Status.FungibleTokenInNftAllowances=new Status(298),Status.NftInFungibleTokenAllowances=new Status(299),Status.InvalidAllowanceOwnerId=new Status(300),Status.InvalidAllowanceSpenderId=new Status(301),Status.RepeatedAllowancesToDelete=new Status(302),Status.InvalidDelegatingSpender=new Status(303),Status.DelegatingSpenderCannotGrantApproveForAll=new Status(304),Status.DelegatingSpenderDoesNotHaveApproveForAll=new Status(305),Status.ScheduleExpirationTimeTooFarInFuture=new Status(306),Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime=new Status(307),Status.ScheduleFutureThrottleExceeded=new Status(308),Status.ScheduleFutureGasLimitExceeded=new Status(309),Status.InvalidEthereumTransaction=new Status(310),Status.WrongChainId=new Status(311),Status.WrongNonce=new Status(312),Status.AccessListUnsupported=new Status(313),Status.SchedulePendingExpiration=new Status(314),Status.ContractIsTokenTreasury=new Status(315),Status.ContractHasNonZeroTokenBalances=new Status(316),Status.ContractExpiredAndPendingRemoval=new Status(317),Status.ContractHasNoAutoRenewAccount=new Status(318),Status.PermanentRemovalRequiresSystemInitiation=new Status(319),Status.ProxyAccountIdFieldIsDeprecated=new Status(320),Status.SelfStakingIsNotAllowed=new Status(321),Status.InvalidStakingId=new Status(322),Status.StakingNotEnabled=new Status(323),Status.InvalidPrngRange=new Status(324),Status.MaxEntitiesInPriceRegimeHaveBeenCreated=new Status(325),Status.InvalidFullPrefixSignatureForPrecompile=new Status(326),Status.InsufficientBalancesForStorageRent=new Status(327),Status.MaxChildRecordsExceeded=new Status(328),Status.InsufficientBalancesForRenewalFees=new Status(329),Status.TransactionHasUnknownFields=new Status(330),Status.AccountIsImmutable=new Status(331),Status.AliasAlreadyAssigned=new Status(332),Status.InvalidMetadataKey=new Status(333),Status.TokenHasNoMetadataKey=new Status(334),Status.MissingTokenMetadata=new Status(335),Status.MissingSerialNumbers=new Status(336),Status.TokenHasNoAdminKey=new Status(337),Status.NodeDeleted=new Status(338),Status.InvalidNodeId=new Status(339),Status.InvalidGossipEndpoint=new Status(340),Status.InvalidNodeAccountId=new Status(341),Status.InvalidNodeDescription=new Status(342),Status.InvalidServiceEndpoint=new Status(343),Status.InvalidGossipCaCertificate=new Status(344),Status.InvalidGrpcCertificate=new Status(345),Status.InvalidMaxAutoAssociations=new Status(346),Status.MaxNodesCreated=new Status(347),Status.IpFqdnCannotBeSetForSameEndpoint=new Status(348),Status.GossipEndpointCannotHaveFqdn=new Status(349),Status.FqdnSizeTooLarge=new Status(350),Status.InvalidEndpoint=new Status(351),Status.GossipEndpointsExceededLimit=new Status(352),Status.TokenReferenceRepeated=new Status(353),Status.InvalidOwnerId=new Status(354),Status.TokenReferenceListSizeLimitExceeded=new Status(355),Status.ServiceEndpointsExceededLimit=new Status(356),Status.InvalidIpv4Address=new Status(357),Status.EmptyTokenReferenceList=new Status(358),Status.UpdateNodeAccountNotAllowed=new Status(359),Status.TokenHasNoMetadataOrSupplyKey=new Status(360),Status.EmptyPendingAirdropIdList=new Status(361),Status.PendingAirdropIdRepeated=new Status(362),Status.PendingAirdropIdListTooLong=new Status(363),Status.PendingNftAirdropAlreadyExists=new Status(364),Status.AccountHasPendingAirdrops=new Status(365),Status.ThrottledAtConsensus=new Status(366),Status.InvalidPendingAirdropId=new Status(367),Status.TokenAirdropWithFallbackRoyalty=new Status(368),Status.InvalidTokenInPendingAirdrop=new Status(369),Status.ScheduleExpiryIsBusy=new Status(370),Status.InvalidGrpcCertificateHash=new Status(371),Status.MissingExpiryTime=new Status(372),Status.NoSchedulingAllowedAfterScheduledRecursion=new Status(373),Status.RecursiveSchedulingLimitReached=new Status(374),Status.WaitingForLedgerId=new Status(375),Status.MaxEntriesForFeeExemptKeyListExceeded=new Status(376),Status.FeeExemptKeyListContainsDuplicatedKeys=new Status(377),Status.InvalidKeyInFeeExemptKeyList=new Status(378),Status.InvalidFeeScheduleKey=new Status(379),Status.FeeScheduleKeyCannotBeUpdated=new Status(380),Status.FeeScheduleKeyNotSet=new Status(381),Status.MaxCustomFeeLimitExceeded=new Status(382),Status.NoValidMaxCustomFee=new Status(383),Status.InvalidMaxCustomFees=new Status(384),Status.DuplicateDenominationInMaxCustomFeeList=new Status(385),Status.DuplicateAccountIdInMaxCustomFeeList=new Status(386),Status.MaxCustomFeesIsNotSupported=new Status(387),Status.BatchListEmpty=new Status(388),Status.BatchListContainsDuplicates=new Status(389),Status.BatchTransactionInBlacklist=new Status(390),Status.InnerTransactionFailed=new Status(391),Status.MissingBatchKey=new Status(392),Status.BatchKeySetOnNonInnerTransaction=new Status(393),Status.InvalidBatchKey=new Status(394),Status.ScheduleExpiryNotConfigurable=new Status(395),Status.CreatingSystemEntities=new Status(396),Status.ThrottleGroupLcmOverflow=new Status(397),Status.AirdropContainsMultipleSendersForAToken=new Status(398),Status.GrpcWebProxyNotSupported=new Status(399),Status.NftTransfersOnlyAllowedForNonFungibleUnique=new Status(400),Status.InvalidSerializedTxMessageHashAlgorithm=new Status(401),Status.WrongHookEntityType=new Status(499),Status.EvmHookGasThrottled=new Status(500),Status.HookIdInUse=new Status(501),Status.BadHookRequest=new Status(502),Status.RejectedByAccountAllowanceHook=new Status(503),Status.HookNotFound=new Status(504),Status.EvmHookStorageUpdateBytesTooLong=new Status(505),Status.EvmHookStorageUpdateBytesMustUseMinimalRepresentation=new Status(506),Status.InvalidHookId=new Status(507),Status.EmptyEvmHookStorageUpdate=new Status(508),Status.HookIdRepeatedInCreationDetails=new Status(509),Status.HooksNotEnabled=new Status(510),Status.HookIsNotAnEvmHook=new Status(511),Status.HookDeleted=new Status(512),Status.TooManyEvmHookStorageUpdates=new Status(513),Status.HookCreationBytesMustUseMinimalRepresentation=new Status(514),Status.HookCreationBytesTooLong=new Status(515),Status.InvalidHookCreationSpec=new Status(516),Status.HookExtensionEmpty=new Status(517),Status.InvalidHookAdminKey=new Status(518),Status.HookDeletionRequiresZeroStorageSlots=new Status(519),Status.CannotSetHooksAndApproval=new Status(520),Status.TransactionRequiresZeroHooks=new Status(521),Status.InvalidHookCall=new Status(522),Status.HooksAreNotSupportedInAirdrops=new Status(523),Status.AccountIsLinkedToANode=new Status(524),Status.HooksExecutionsRequireTopLevelCryptoTransfer=new Status(525),Status.NodeAccountHasZeroBalance=new Status(526),Status.TransferToFeeCollectionAccountNotAllowed=new Status(527),Status.TooManyHookInvocations=new Status(528);class GrpcStatus{constructor(e){this._code=e,Object.freeze(this)}static _fromValue(e){switch(e){case 0:return GrpcStatus.Ok;case 1:return GrpcStatus.Cancelled;case 2:return GrpcStatus.Unknown;case 3:return GrpcStatus.InvalidArgument;case 4:return GrpcStatus.DeadlineExceeded;case 5:return GrpcStatus.NotFound;case 6:return GrpcStatus.AlreadyExists;case 7:return GrpcStatus.PermissionDenied;case 8:return GrpcStatus.ResourceExhausted;case 9:return GrpcStatus.FailedPrecondition;case 10:return GrpcStatus.Aborted;case 11:return GrpcStatus.OutOfRange;case 12:return GrpcStatus.Unimplemented;case 13:return GrpcStatus.Internal;case 14:return GrpcStatus.Unavailable;case 15:return GrpcStatus.DataLoss;case 16:return GrpcStatus.Unauthenticated;case 17:return GrpcStatus.Timeout;case 18:return GrpcStatus.GrpcWeb;default:throw new Error("(BUG) non-exhaustive GrpcStatus switch statement")}}toString(){switch(this){case GrpcStatus.Ok:return"OK";case GrpcStatus.Cancelled:return"CANCELLED";case GrpcStatus.Unknown:return"UNKNOWN";case GrpcStatus.InvalidArgument:return"INVALID_ARGUMENT";case GrpcStatus.DeadlineExceeded:return"DEADLINE_EXCEEDED";case GrpcStatus.NotFound:return"NOT_FOUND";case GrpcStatus.AlreadyExists:return"ALREADY_EXISTS";case GrpcStatus.PermissionDenied:return"PERMISSION_DENIED";case GrpcStatus.Unauthenticated:return"UNAUTHENTICATED";case GrpcStatus.ResourceExhausted:return"RESOURCE_EXHAUSTED";case GrpcStatus.FailedPrecondition:return"FAILED_PRECONDITION";case GrpcStatus.Aborted:return"ABORTED";case GrpcStatus.OutOfRange:return"OUT_OF_RANGE";case GrpcStatus.Unimplemented:return"UNIMPLEMENTED";case GrpcStatus.Internal:return"INTERNAL";case GrpcStatus.Unavailable:return"UNAVAILABLE";case GrpcStatus.DataLoss:return"DATA_LOSS";case GrpcStatus.Timeout:return"TIMEOUT";case GrpcStatus.GrpcWeb:return"GRPC_WEB";default:return`UNKNOWN (${this._code})`}}valueOf(){return this._code}}GrpcStatus.Ok=new GrpcStatus(0),GrpcStatus.Cancelled=new GrpcStatus(1),GrpcStatus.Unknown=new GrpcStatus(2),GrpcStatus.InvalidArgument=new GrpcStatus(3),GrpcStatus.DeadlineExceeded=new GrpcStatus(4),GrpcStatus.NotFound=new GrpcStatus(5),GrpcStatus.AlreadyExists=new GrpcStatus(6),GrpcStatus.PermissionDenied=new GrpcStatus(7),GrpcStatus.ResourceExhausted=new GrpcStatus(8),GrpcStatus.FailedPrecondition=new GrpcStatus(9),GrpcStatus.Aborted=new GrpcStatus(10),GrpcStatus.OutOfRange=new GrpcStatus(11),GrpcStatus.Unimplemented=new GrpcStatus(12),GrpcStatus.Internal=new GrpcStatus(13),GrpcStatus.Unavailable=new GrpcStatus(14),GrpcStatus.DataLoss=new GrpcStatus(15),GrpcStatus.Unauthenticated=new GrpcStatus(16),GrpcStatus.Timeout=new GrpcStatus(17),GrpcStatus.GrpcWeb=new GrpcStatus(18);class GrpcServiceError extends Error{constructor(e,t){super(`gRPC service failed with: Status: ${e.toString()}, Code: ${e.valueOf()}`),this.status=e,this.nodeAccountId=t,this.name="GrpcServiceError",void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,GrpcServiceError)}static _fromResponse(e){if(null!=e.code&&null!=e.details){const t=GrpcStatus._fromValue(e.code),n=new GrpcServiceError(t);return n.stack+=`\nCaused by: ${e.stack?e.stack.toString():""}`,n.message+=`: ${e.details}`,n}return e}toString(){return`${this.name}: ${this.message}`}}class HttpStatus{constructor(e){this._code=e,Object.freeze(this)}static _fromValue(e){return new HttpStatus(e)}toString(){return this._code.toString()}valueOf(){return this._code}}class HttpError extends Error{constructor(e){super(`failed with error code: ${e.toString()}`),this.status=e,this.name="HttpError",void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,HttpError)}}class MaxAttemptsOrTimeoutError extends Error{constructor(e,t){super(e),this.nodeAccountId=t}toJSON(){return{message:this.message,nodeAccountId:this.nodeAccountId}}toString(){return JSON.stringify(this.toJSON())}valueOf(){return this.toJSON()}}const ExecutionState={Finished:"Finished",Retry:"Retry",Error:"Error"},RST_STREAM=/\brst[^0-9a-zA-Z]stream\b/i;class Executable{constructor(){this._maxAttempts=null,this._nodeAccountIds=new List,this.transactionNodeIds=[],this._signOnDemand=!1,this._minBackoff=null,this._maxBackoff=8e3,this._operator=null,this._requestTimeout=null,this._grpcDeadline=null,this._logger=null}get nodeAccountIds(){return this._nodeAccountIds.isEmpty?null:(this._nodeAccountIds.setLocked(),this._nodeAccountIds.list)}setNodeAccountIds(e){return this._nodeAccountIds.setList(e).setLocked(),this}get maxRetries(){return console.warn("Deprecated: use maxAttempts instead"),this.maxAttempts}setMaxRetries(e){return console.warn("Deprecated: use setMaxAttempts() instead"),this.setMaxAttempts(e)}get maxAttempts(){return this._maxAttempts}setMaxAttempts(e){return this._maxAttempts=e,this}get grpcDeadline(){return this._grpcDeadline}setGrpcDeadline(e){return this._grpcDeadline=e,this}setMinBackoff(e){if(null==e)throw new Error("minBackoff cannot be null.");if(null!=this._maxBackoff&&e>this._maxBackoff)throw new Error("minBackoff cannot be larger than maxBackoff.");return this._minBackoff=e,this}get minBackoff(){return this._minBackoff}setMaxBackoff(e){if(null==e)throw new Error("maxBackoff cannot be null.");if(null!=this._minBackoff&&e<this._minBackoff)throw new Error("maxBackoff cannot be smaller than minBackoff.");return this._maxBackoff=e,this}get maxBackoff(){return this._maxBackoff}_beforeExecute(e){throw new Error("not implemented")}_makeRequestAsync(){throw new Error("not implemented")}_mapStatusError(e,t,n){throw new Error("not implemented")}_mapResponse(e,t,n){throw new Error("not implemented")}_execute(e,t){throw new Error("not implemented")}_getTransactionId(){throw new Error("not implemented")}_getLogId(){throw new Error("not implemented")}_requestToBytes(e){throw new Error("not implemented")}_responseToBytes(e){throw new Error("not implemented")}_getStatusAndExecutionState(e,t){throw new Error("not implemented")}_shouldRetryExceptionally(e){return!(e instanceof GrpcServiceError)||(e.status._code===GrpcStatus.Timeout._code||e.status._code===GrpcStatus.DeadlineExceeded._code||e.status._code===GrpcStatus.Unavailable._code||e.status._code===GrpcStatus.ResourceExhausted._code||e.status._code===GrpcStatus.GrpcWeb._code||e.status._code===GrpcStatus.Internal._code&&RST_STREAM.test(e.message))}_shouldRetryRequestError(e,t){return(e instanceof GrpcServiceError||e instanceof HttpError)&&this._shouldRetryExceptionally(e)&&t<=this._maxAttempts}_setOperatorWith(e,t,n){return this._operator={transactionSigner:n,accountId:e,publicKey:t},this}async executeWithSigner(e){return e.call(this)}isBatchedAndNotBatchTransaction(){return!1}_validateTransactionNodeIds(){if(!this.transactionNodeIds.length)return;const e=this._nodeAccountIds.list.map(e=>e.toString());if(this.transactionNodeIds.some(t=>e.includes(t)))return;const t=e.length>2?`${e.slice(0,2).join(", ")} ...`:e.join(", "),n=1===e.length;throw new Error(`Attempting to execute a transaction against node${n?"":"s"} ${t}, which ${n?"is":"are"} not included in the Client's node list. Please review your Client configuration.`)}async _setupExecution(e,t){if(this.isBatchedAndNotBatchTransaction())throw new Error("Cannot execute batchified transaction outside of BatchTransaction");this._logger=this._logger??e._logger,null==this._requestTimeout&&(this._requestTimeout=t||e.requestTimeout),null==this._grpcDeadline&&(this._grpcDeadline=e.grpcDeadline),null==this._maxBackoff&&(this._maxBackoff=e.maxBackoff),null==this._minBackoff&&(this._minBackoff=e.minBackoff),null==this._maxAttempts&&(this._maxAttempts=e.maxAttempts),await this._beforeExecute(e)}_getExecutionNode(e){let t;if(this._nodeAccountIds.isEmpty?(t=e._network.getNode(),this._nodeAccountIds.setList([t.accountId])):t=e._network.getNode(this._nodeAccountIds.current),null==t)throw new Error(`NodeAccountId not recognized: ${this._nodeAccountIds.current.toString()}`);return t}_shouldSkipAttemptForNodeAccountId(e){if(!this.transactionNodeIds.length)return!1;return!this.transactionNodeIds.includes(e.toString())}async _handleUnhealthyNode(e,t,n,r){if(isTransactionReceiptOrRecordRequest(t)&&this._nodeAccountIds.length<=1||r)return void await delayForAttempt(r,n,this._minBackoff,this._maxBackoff);if(this._nodeAccountIds.index===this._nodeAccountIds.list.length-1)throw new Error(`Network connectivity issue: All nodes are unhealthy. Original node list: ${this._nodeAccountIds.list.join(", ")}`);this._logger?.debug(`[${this._getLogId()}] Node is not healthy, trying the next node.`),this._nodeAccountIds.advance()}async _handleInvalidNodeAccountId(e,t,n){this._logger?.debug(`[${this._getLogId()}] node with accountId: ${n.toString()} and proxy IP: ${t.address.toString()} has invalid node account ID, marking as unhealthy and updating network`),e._network.increaseBackoff(t);try{e.mirrorNetwork.length>0?await e.updateNetwork():this._logger?.warn(`[${this._getLogId()}] Cannot update address book: no mirror network configured. Retrying with existing network configuration.`)}catch(e){const t=e instanceof Error?e.message:String(e);this._logger?.trace(`[${this._getLogId()}] failed to update client address book after INVALID_NODE_ACCOUNT_ID: ${t}`)}}async _executeRequestWithGrpcDeadline(e,t){const n=[];let r=null;null!=this._grpcDeadline&&n.push(new Promise((e,t)=>{r=setTimeout(()=>t(new GrpcServiceError(GrpcStatus.DeadlineExceeded)),this._grpcDeadline)})),this._logger?.trace(`[${this._getLogId()}] sending protobuf ${encode$4(this._requestToBytes(t))}`),n.push(this._execute(e,t));try{return await Promise.race(n)}finally{null!=r&&clearTimeout(r)}}async execute(e,t){await this._setupExecution(e,t);const n=e.isLocalNetwork;this._validateTransactionNodeIds();const r=Date.now();let o=null;for(let t=1;t<=this._maxAttempts;t+=1){if(null!=this._requestTimeout&&r+this._requestTimeout<=Date.now())throw new MaxAttemptsOrTimeoutError("timeout exceeded",this._nodeAccountIds.isEmpty?"No node account ID set":this._nodeAccountIds.current.toString());if(this._shouldSkipAttemptForNodeAccountId(this._nodeAccountIds.current)){console.error(`Attempting to execute a transaction against node ${this._nodeAccountIds.current.toString()}, which is not included in the Client's node list. Please review your Client configuration.`),this._nodeAccountIds.advance();continue}const a=this._getExecutionNode(e);this._logger?.debug(`[${this._getLogId()}] Node AccountID: ${a.accountId.toString()}, IP: ${a.address.toString()}`);const i=a.getChannel();null!=this._grpcDeadline&&i.setGrpcDeadline(this._grpcDeadline);const s=await this._makeRequestAsync();if(!a.isHealthy()){await this._handleUnhealthyNode(a,s,t,n);continue}let c;this._nodeAccountIds.advance();try{c=await this._executeRequestWithGrpcDeadline(i,s)}catch(n){const r=GrpcServiceError._fromResponse(n);if(o=r,this._logger?.debug(`[${this._getLogId()}] received error ${JSON.stringify(r)}`),this._shouldRetryRequestError(r,t)){this._logger?.debug(`[${this._getLogId()}] node with accountId: ${a.accountId.toString()} and proxy IP: ${a.address.toString()} is unhealthy`),a.isHealthy()&&e._network.increaseBackoff(a);continue}throw n}this._logger?.trace(`[${this._getLogId()}] sending protobuf ${encode$4(this._responseToBytes(c))}`),e._network.decreaseBackoff(a);const[u,l]=this._getStatusAndExecutionState(s,c);switch(u.toString()!==Status.Ok.toString()&&u.toString()!==Status.Success.toString()&&(o=u),l){case ExecutionState.Retry:u===Status.InvalidNodeAccount&&await this._handleInvalidNodeAccountId(e,a,a.accountId),await delayForAttempt(n,t,this._minBackoff,this._maxBackoff);continue;case ExecutionState.Finished:return this._mapResponse(c,a.accountId,s);case ExecutionState.Error:throw this._mapStatusError(s,c,a.accountId);default:throw new Error("(BUG) non-exhaustive switch statement for `ExecutionState`")}}throw new MaxAttemptsOrTimeoutError(`max attempts of ${this._maxAttempts.toString()} was reached for request with last error being: ${null!=o?o.toString():""}`,this._nodeAccountIds.current.toString())}toBytes(){throw new Error("not implemented")}setLogger(e){return this._logger=e,this}get logger(){return this._logger}}function isTransactionReceiptOrRecordRequest(e){return"object"==typeof e&&null!==e&&("transactionGetReceipt"in e||"transactionGetRecord"in e)}function delayForAttempt(e,t,n,r){if(e)return new Promise(e=>setTimeout(e,n));const o=Math.min(Math.floor(n*Math.pow(2,t)),r);return new Promise(e=>setTimeout(e,o))}class PrecheckStatusError extends StatusError{constructor(e){super(e,`transaction ${e.transactionId.toString()} failed precheck with status ${e.status.toString()} against node account id ${e.nodeId.toString()}`),this.contractFunctionResult=e.contractFunctionResult,this.nodeId=e.nodeId}toJSON(){return{name:this.name,status:this.status.toString(),transactionId:this.transactionId.toString(),nodeId:this.nodeId.toString(),message:this.message,contractFunctionResult:this.contractFunctionResult}}}class MaxQueryPaymentExceeded extends Error{constructor(e,t){super(),this.message=`query cost of ${e.toString()} HBAR exceeds max set on client: ${t.toString()} HBAR`,this.name="MaxQueryPaymentExceededError",this.queryCost=e,this.maxQueryPayment=t}}class QueryBase extends Executable{constructor(){super()}async _makePaymentTransaction(e,t,n,r){const o=[];null!=n?(o.push({accountID:n.accountId._toProtobuf(),amount:r.negated().toTinybars()}),o.push({accountID:t._toProtobuf(),amount:r.toTinybars()})):(o.push({accountID:new AccountId(0)._toProtobuf(),amount:r.negated().toTinybars()}),o.push({accountID:t._toProtobuf(),amount:r.toTinybars()}));const a={transactionID:e._toProtobuf(),nodeAccountID:t._toProtobuf(),transactionFee:new Hbar(1).toTinybars(),transactionValidDuration:{seconds:Long.fromNumber(120)},cryptoTransfer:{transfers:{accountAmounts:o}}},i={bodyBytes:libExports.proto.TransactionBody.encode(a).finish()};if(null!=n){const e=await n.transactionSigner(i.bodyBytes);i.sigMap={sigPair:[n.publicKey._toProtobufSignature(e)]}}return{signedTransactionBytes:libExports.proto.SignedTransaction.encode(i).finish()}}}class CostQuery extends QueryBase{constructor(e){super(),this._query=e,this._grpcDeadline=e._grpcDeadline,this._requestTimeout=e._requestTimeout,this._nodeAccountIds=e._nodeAccountIds.clone(),this._operator=e._operator,this._header=null}_getTransactionId(){return this._query._getTransactionId()}_getLogId(){return`CostQuery:${this._query._getLogId()}`}async _beforeExecute(e){if(null==e)throw new Error("Cannot do CostQuery without Client");const t=null!=this._operator?this._operator:e._operator;if(null==t)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._query._nodeAccountIds.isEmpty&&this._query._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute());const n=TransactionId.generate(t.accountId);null==this._query.paymentTransactionId&&this._query.setPaymentTransactionId(n);const r=this._getLogId(),o=new AccountId(0),a=TransactionId.generate(new AccountId(0)),i=new Hbar(0);this._logger&&this._logger.debug(`[${r}] making a payment transaction for node ${o.toString()} and transaction ID ${a.toString()} with amount ${i.toString()}`),this._header={payment:await this._makePaymentTransaction(a,new AccountId(0),t,i),responseType:libExports.proto.ResponseType.COST_ANSWER}}_makeRequestAsync(){return Promise.resolve(this._query._onMakeRequest(this._header))}_getStatusAndExecutionState(e,t){return this._query._getStatusAndExecutionState(e,t)}_mapStatusError(e,t,n){return this._query._mapStatusError(e,t,n)}_mapResponse(e,t,n){const r=this._query._mapResponseHeader(e).cost;return Promise.resolve(Hbar.fromTinybars(r))}_execute(e,t){return this._query._execute(e,t)}_requestToBytes(e){return this._query._requestToBytes(e)}_responseToBytes(e){return this._query._responseToBytes(e)}}const QUERY_REGISTRY=new Map;class Query extends QueryBase{constructor(){super(),this._paymentTransactionId=null,this._paymentTransactions=[],this._queryPayment=null,this._maxQueryPayment=null,this._timestamp=Date.now()}static fromBytes(e){const t=libExports.proto.Query.decode(e);if(null==t.query)throw new Error("(BUG) query.query was not set in the protobuf");const n=QUERY_REGISTRY.get(t.query);if(null==n)throw new Error(`(BUG) Query.fromBytes() not implemented for type ${t.query}`);return n(t)}toBytes(){return libExports.proto.Query.encode(this._makeRequest()).finish()}setQueryPayment(e){return this._queryPayment=e,this}setMaxQueryPayment(e){return this._maxQueryPayment=e,this}async getCost(e){this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute()),this._timestamp=Date.now();const t=await new CostQuery(this).execute(e);return Hbar.fromTinybars(t._valueInTinybar.multipliedBy(1.1).toFixed(0))}setPaymentTransactionId(e){return this._paymentTransactionId=e,this}get paymentTransactionId(){return this._paymentTransactionId}_getTransactionId(){if(null==this._paymentTransactionId)throw new Error("Query.PaymentTransactionId was not set duration execution");return this._paymentTransactionId}_isPaymentRequired(){return!0}_validateChecksums(e){}async _beforeExecute(e){if(this._paymentTransactions.length>0)return;if(e.isAutoValidateChecksumsEnabled()&&this._validateChecksums(e),this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute()),this._operator=null!=this._operator?this._operator:e._operator,this._isPaymentRequired()){if(this.transactionNodeIds=Object.values(e.network).map(e=>e.toString()),null==this._operator)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._paymentTransactionId=TransactionId.generate(this._operator.accountId)}else this._paymentTransactionId=TransactionId.generate(new AccountId(0));let t=new Hbar(0);const n=null!=this._maxQueryPayment?this._maxQueryPayment:e.defaultMaxQueryPayment;if(null!=this._queryPayment)t=this._queryPayment;else if(0===this._paymentTransactions.length&&this._isPaymentRequired()){const r=await this.getCost(e);if(n.toTinybars().toInt()<r.toTinybars().toInt())throw new MaxQueryPaymentExceeded(r,n);t=r,this._logger&&this._logger.debug(`[${this._getLogId()}] received cost for query ${t.toString()}`)}this._queryPayment=t,this._timestamp=Date.now(),this._nodeAccountIds.setLocked();for(const e of this._nodeAccountIds.list){const t=this._getLogId(),n=this._paymentTransactionId,r=this._queryPayment;this._logger&&this._logger.debug(`[${t}] making a payment transaction for node ${e.toString()} and transaction ID ${n.toString()} with amount ${r.toString()}`),this._paymentTransactions.push(await this._makePaymentTransaction(n,e,this._isPaymentRequired()?this._operator:null,r))}}_mapResponseHeader(e){throw new Error("not implemented")}_makeRequestHeader(){let e={};return this._isPaymentRequired()&&this._paymentTransactions.length>0&&(e={responseType:libExports.proto.ResponseType.ANSWER_ONLY,payment:this._paymentTransactions[this._nodeAccountIds.index]}),e}_onMakeRequest(e){throw new Error("not implemented")}_makeRequest(){let e={};return this._isPaymentRequired()&&null!=this._paymentTransactions&&(e={payment:this._paymentTransactions[this._nodeAccountIds.index],responseType:libExports.proto.ResponseType.ANSWER_ONLY}),this._onMakeRequest(e)}async _makeRequestAsync(){let e={responseType:libExports.proto.ResponseType.ANSWER_ONLY};const t=this._getLogId(),n=this._nodeAccountIds.current,r=TransactionId.generate(this._operator?this._operator.accountId:new AccountId(0)),o=this._queryPayment;return this._logger&&this._logger.debug(`[${t}] making a payment transaction for node ${n.toString()} and transaction ID ${r.toString()} with amount ${o.toString()}`),e.payment=await this._makePaymentTransaction(r,n,this._isPaymentRequired()?this._operator:null,o),this._onMakeRequest(e)}_getStatusAndExecutionState(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t),r=Status._fromCode(null!=n?n:libExports.proto.ResponseCodeEnum.OK);switch(this._logger?.debug(`[${this._getLogId()}] received status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.PlatformTransactionNotCreated:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:return[r,ExecutionState.Finished];default:return[r,ExecutionState.Error]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t),o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}_requestToBytes(e){return libExports.proto.Query.encode(e).finish()}_responseToBytes(e){return libExports.proto.Response.encode(e).finish()}}class ContractId extends Key{constructor(e,t,n,r){super();const o=constructor(e,t,n);this.shard=o.shard,this.realm=o.realm,this.num=o.num,this.evmAddress=null!=r?r:null,this._checksum=null}static fromEvmAddress(e,t,n){const r=EvmAddress.fromString(n),[o,a,i,s]=fromEvmAddress(e,t,r.toString());return new ContractId(o,a,i,s?.toBytes())}static fromString(e){const t=fromStringSplitter(e);if(Number.isNaN(t.shard)||Number.isNaN(t.realm))throw new Error("invalid format for entity ID");const n=null!=t.shard?Long.fromString(t.shard):Long.ZERO,r=null!=t.realm?Long.fromString(t.realm):Long.ZERO,[o,a]=t.numOrHex.length<40?[Long.fromString(t.numOrHex),void 0]:[Long.ZERO,decode$7(t.numOrHex)];return new ContractId(n,r,o,a)}static _fromProtobuf(e){return new ContractId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.contractNum?e.contractNum:0)}get checksum(){return this._checksum}async populateAccountNum(e){const t=`${e.mirrorRestApiBaseUrl}/contracts/${this.toEvmAddress()}`,n=await fetch(t),r=(await n.json()).contract_id;return this.num=Long.fromString(r.slice(r.lastIndexOf(".")+1)),this}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return ContractId._fromProtobuf(libExports.proto.ContractID.decode(e))}static fromSolidityAddress(e){return isLongZeroAddress(decode$7(e))?new ContractId(...fromSolidityAddress(e)):this.fromEvmAddress(0,0,e)}toSolidityAddress(){return null!=this.evmAddress?encode$4(this.evmAddress):toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?toEvmAddress(this.evmAddress):toEvmAddress(this.num)}_toProtobuf(){return{contractNum:this.num,shardNum:this.shard,realmNum:this.realm,evmAddress:this.evmAddress}}toString(){return null!=this.evmAddress?`${this.shard.toString()}.${this.realm.toString()}.${encode$4(this.evmAddress)}`:`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.ContractID.encode(this._toProtobuf()).finish()}clone(){const e=new ContractId(this);return e._checksum=this._checksum,e.evmAddress=this.evmAddress,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}equals(e){let t=!1;return null!=this.evmAddress&&null!=e.evmAddress&&(t=arrayEqual(this.evmAddress,e.evmAddress)),this.shard.eq(e.shard)&&this.realm.eq(e.realm)&&this.num.eq(e.num)&&t}_toProtobufKey(){return{contractID:this._toProtobuf()}}static __fromProtobufKey(e){return ContractId._fromProtobuf(e)}}CACHE.setContractId(e=>ContractId.__fromProtobufKey(e));class FileId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static getAddressBookFileIdFor(e=0,t=0){return new FileId({num:102,shard:e,realm:t})}static getFeeScheduleFileIdFor(e=0,t=0){return new FileId({num:111,shard:e,realm:t})}static getExchangeRatesFileIdFor(e=0,t=0){return new FileId({num:112,shard:e,realm:t})}static fromString(e){const t=fromString(e),n=new FileId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new FileId(null!=e.shardNum?Long.fromString(e.shardNum.toString()):0,null!=e.realmNum?Long.fromString(e.realmNum.toString()):0,null!=e.fileNum?Long.fromString(e.fileNum.toString()):0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return FileId._fromProtobuf(libExports.proto.FileID.decode(e))}static fromSolidityAddress(e){const[t,n,r]=fromSolidityAddress(e);return new FileId(t,n,r)}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("FileId.fromEvmAddress does not support non-long-zero addresses");const[r,o,a]=fromEvmAddress(e,t,n);return new FileId(r,o,a)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{fileNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.FileID.encode(this._toProtobuf()).finish()}clone(){const e=new FileId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}FileId.ADDRESS_BOOK=new FileId(102),FileId.FEE_SCHEDULE=new FileId(111),FileId.EXCHANGE_RATES=new FileId(112);class TopicId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new TopicId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new TopicId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.topicNum?e.topicNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return TopicId._fromProtobuf(libExports.proto.TopicID.decode(e))}static fromSolidityAddress(e){const[t,n,r]=fromSolidityAddress(e);return new TopicId(t,n,r)}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("TopicId.fromEvmAddress does not support non-long-zero addresses");const[r,o,a]=fromEvmAddress(e,t,n);return new TopicId(r,o,a)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{topicNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.TopicID.encode(this._toProtobuf()).finish()}clone(){const e=new TopicId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class TokenId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new TokenId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new TokenId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.tokenNum?e.tokenNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return TokenId._fromProtobuf(libExports.proto.TokenID.decode(e))}static fromSolidityAddress(e){return new TokenId(...fromSolidityAddress(e))}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("TokenId.fromEvmAddress does not support non-long-zero addresses");const[r,o,a]=fromEvmAddress(e,t,n);return new TokenId(r,o,a)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{tokenNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.TokenID.encode(this._toProtobuf()).finish()}clone(){const e=new TokenId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class ScheduleId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new ScheduleId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new ScheduleId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.scheduleNum?e.scheduleNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return ScheduleId._fromProtobuf(libExports.proto.ScheduleID.decode(e))}static fromSolidityAddress(e){return new ScheduleId(...fromSolidityAddress(e))}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}_toProtobuf(){return{scheduleNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.ScheduleID.encode(this._toProtobuf()).finish()}clone(){const e=new ScheduleId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class ExchangeRate{constructor(e){this.hbars=e.hbars,this.cents=e.cents,this.expirationTime=e.expirationTime,this.exchangeRateInCents=e.cents/e.hbars,Object.freeze(this)}static _fromProtobuf(e){return new ExchangeRate({hbars:e.hbarEquiv,cents:e.centEquiv,expirationTime:new Date(null!=e.expirationTime&&null!=e.expirationTime.seconds?Long.isLong(e.expirationTime.seconds)?1e3*e.expirationTime.seconds.toNumber():1e3*e.expirationTime.seconds:0)})}_toProtobuf(){return{hbarEquiv:this.hbars,centEquiv:this.cents,expirationTime:{seconds:Long.fromNumber(Math.trunc(this.expirationTime.getTime()/1e3))}}}toJSON(){return{hbars:this.hbars,cents:this.cents,expirationTime:this.expirationTime,exchangeRateInCents:this.exchangeRateInCents}}toString(){return JSON.stringify(this.toJSON())}}class TransactionReceipt{constructor(e){this.status=e.status,this.accountId=e.accountId,this.fileId=e.fileId,this.contractId=e.contractId,this.topicId=e.topicId,this.tokenId=e.tokenId,this.scheduleId=e.scheduleId,this.exchangeRate=e.exchangeRate,this.nextExchangeRate=e.nextExchangeRate,this.topicSequenceNumber=e.topicSequenceNumber,this.topicRunningHash=e.topicRunningHash,this.totalSupply=e.totalSupply,this.scheduledTransactionId=e.scheduledTransactionId,this.serials=e.serials??[],this.duplicates=e.duplicates??[],this.children=e.children??[],this.nodeId=e.nodeId,Object.freeze(this)}_toProtobuf(){return{duplicateTransactionReceipts:this.duplicates.map(e=>e._toProtobuf().receipt),childTransactionReceipts:this.children.map(e=>e._toProtobuf().receipt),receipt:{status:this.status.valueOf(),accountID:null!=this.accountId?this.accountId._toProtobuf():null,fileID:null!=this.fileId?this.fileId._toProtobuf():null,contractID:null!=this.contractId?this.contractId._toProtobuf():null,topicID:null!=this.topicId?this.topicId._toProtobuf():null,tokenID:null!=this.tokenId?this.tokenId._toProtobuf():null,scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,topicRunningHash:null==this.topicRunningHash?null:this.topicRunningHash,topicSequenceNumber:this.topicSequenceNumber,exchangeRate:{nextRate:null!=this.nextExchangeRate?this.nextExchangeRate._toProtobuf():null,currentRate:null!=this.exchangeRate?this.exchangeRate._toProtobuf():null},scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,serialNumbers:this.serials,newTotalSupply:this.totalSupply,nodeId:this.nodeId}}}static _fromProtobuf(e){const t=e.receipt,n=null!=e.childTransactionReceipts?e.childTransactionReceipts.map(e=>TransactionReceipt._fromProtobuf({receipt:e})):[],r=null!=e.duplicateTransactionReceipts?e.duplicateTransactionReceipts.map(e=>TransactionReceipt._fromProtobuf({receipt:e})):[];return new TransactionReceipt({status:Status._fromCode(null!=t.status?t.status:0),accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):null,fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):null,contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):null,topicId:null!=t.topicID?TopicId._fromProtobuf(t.topicID):null,tokenId:null!=t.tokenID?TokenId._fromProtobuf(t.tokenID):null,scheduleId:null!=t.scheduleID?ScheduleId._fromProtobuf(t.scheduleID):null,exchangeRate:null!=t.exchangeRate?ExchangeRate._fromProtobuf(t.exchangeRate.currentRate):null,nextExchangeRate:null!=t.exchangeRate?ExchangeRate._fromProtobuf(t.exchangeRate.nextRate):null,topicSequenceNumber:null==t.topicSequenceNumber?null:Long.fromString(t.topicSequenceNumber.toString()),topicRunningHash:null!=t.topicRunningHash?new Uint8Array(t.topicRunningHash):null,totalSupply:null!=t.newTotalSupply?Long.fromString(t.newTotalSupply.toString()):null,scheduledTransactionId:null!=t.scheduledTransactionID?TransactionId._fromProtobuf(t.scheduledTransactionID):null,serials:null!=t.serialNumbers?t.serialNumbers.map(e=>Long.fromValue(e)):[],children:n,duplicates:r,nodeId:null!=t.nodeId?t.nodeId:null})}static fromBytes(e){return TransactionReceipt._fromProtobuf(libExports.proto.TransactionGetReceiptResponse.decode(e))}toBytes(){return libExports.proto.TransactionGetReceiptResponse.encode(this._toProtobuf()).finish()}toJSON(){return{status:this.status.toString(),accountId:this.accountId?.toString()||null,filedId:this.fileId?.toString()||null,contractId:this.contractId?.toString()||null,topicId:this.topicId?.toString()||null,tokenId:this.tokenId?.toString()||null,scheduleId:this.scheduleId?.toString()||null,exchangeRate:this.exchangeRate?.toJSON()||null,nextExchangeRate:this.nextExchangeRate?.toJSON()||null,topicSequenceNumber:this.topicSequenceNumber?.toString()||null,topicRunningHash:null!=this.topicRunningHash?encode$4(this.topicRunningHash):null,totalSupply:this.totalSupply?.toString()||null,scheduledTransactionId:this.scheduledTransactionId?.toString()||null,serials:this.serials.map(e=>e.toString()),duplicates:this.duplicates.map(e=>e.toJSON()),children:this.children.map(e=>e.toJSON()),nodeId:this.nodeId?.toString()||null}}toString(){return JSON.stringify(this.toJSON())}}const{proto:proto$7}=HieroProto;class TransactionReceiptQuery extends Query{constructor(e={}){super(),this._transactionId=null,this._includeChildren=null,this._includeDuplicates=null,this._validateStatus=!0,null!=e.transactionId&&this.setTransactionId(e.transactionId),null!=e.includeChildren&&this.setIncludeChildren(e.includeChildren),null!=e.includeDuplicates&&this.setIncludeDuplicates(e.includeDuplicates),null!=e.validateStatus&&this.setValidateStatus(e.validateStatus)}static _fromProtobuf(e){const t=e.transactionGetReceipt;return new TransactionReceiptQuery({transactionId:t.transactionID?TransactionId._fromProtobuf(t.transactionID):void 0,includeDuplicates:null!=t.includeDuplicates?t.includeDuplicates:void 0,includeChildren:null!=t.includeChildReceipts?t.includeChildReceipts:void 0})}get transactionId(){return this._transactionId}setTransactionId(e){return this._transactionId="string"==typeof e?TransactionId.fromString(e):e.clone(),this}setIncludeDuplicates(e){return this._includeDuplicates=e,this}get includeDuplicates(){return null!=this._includeDuplicates&&this._includeDuplicates}setIncludeChildren(e){return this._includeChildren=e,this}get includeChildren(){return null!=this._includeChildren&&this._includeChildren}setValidateStatus(e){return this._validateStatus=e,this}get validateStatus(){return this._validateStatus}_isPaymentRequired(){return!1}_getStatusAndExecutionState(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t);let r=Status._fromCode(null!=n?n:proto$7.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received node precheck status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:break;default:return[r,ExecutionState.Error]}const o=t.transactionGetReceipt.receipt.status;switch(r=Status._fromCode(o),this._logger&&this._logger.debug(`[${this._getLogId()}] received receipt status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:return[r,ExecutionState.Retry];case Status.Success:case Status.FeeScheduleFilePartUploaded:return[r,ExecutionState.Finished];default:return[r,this._validateStatus?ExecutionState.Error:ExecutionState.Finished]}}_getTransactionId(){return null!=this._transactionId?this._transactionId:super._getTransactionId()}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t);let o=Status._fromCode(null!=r?r:proto$7.ResponseCodeEnum.OK);if(o!==Status.Ok)return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null});const a=t.transactionGetReceipt,i=a.receipt.status;if(o=Status._fromCode(i),null==this._transactionId)throw new Error("Failed to construct `ReceiptStatusError` because `transactionId` is `null`");return new ReceiptStatusError({status:o,transactionId:this._transactionId,transactionReceipt:TransactionReceipt._fromProtobuf(a)})}_validateChecksums(e){null!=this._transactionId&&null!=this._transactionId.accountId&&this._transactionId.accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getTransactionReceipts(t)}_mapResponseHeader(e){return e.transactionGetReceipt.header}_mapResponse(e,t,n){const r=e.transactionGetReceipt;return Promise.resolve(TransactionReceipt._fromProtobuf(r))}_onMakeRequest(e){return{transactionGetReceipt:{header:e,transactionID:null!=this._transactionId?this._transactionId._toProtobuf():null,includeDuplicates:this._includeDuplicates,includeChildReceipts:this._includeChildren}}}_getLogId(){return`TransactionReceiptQuery:${this._timestamp.toString()}`}}QUERY_REGISTRY.set("transactionGetReceipt",TransactionReceiptQuery._fromProtobuf);class EvmHookCall{constructor(e={}){this._data=null,this._gasLimit=null,null!=e.data&&this.setData(e.data),null!=e.gasLimit&&this.setGasLimit(e.gasLimit)}setData(e){return this._data=e,this}setGasLimit(e){return this._gasLimit=e,this}get data(){return this._data}get gasLimit(){return this._gasLimit}static _fromProtobuf(e){return new EvmHookCall({data:e.data?e.data:void 0,gasLimit:e.gasLimit?e.gasLimit:void 0})}_toProtobuf(){return{data:this._data,gasLimit:this._gasLimit?this._gasLimit:null}}}class HookCall{constructor(e={}){void 0!==e.hookId&&this.setHookId(e.hookId),void 0!==e.evmHookCall&&this.setCall(e.evmHookCall)}setHookId(e){return this._hookId=e,this}setCall(e){return this._evmHookCall=e,this}get hookId(){return this._hookId}get evmHookCall(){return this._evmHookCall}static _fromProtobuf(e){return new HookCall({hookId:e.hookId??void 0,evmHookCall:e.evmHookCall?EvmHookCall._fromProtobuf(e.evmHookCall):void 0})}_toProtobuf(){return{hookId:this._hookId,evmHookCall:this._evmHookCall?._toProtobuf()}}}const FungibleHookType=Object.freeze({PRE_TX_ALLOWANCE_HOOK:0,PRE_POST_TX_ALLOWANCE_HOOK:1});class FungibleHookCall extends HookCall{constructor(e){if(super(e),null==e.type)throw new Error("type cannot be null");this._type=e.type}get type(){return this._type}static _fromProtobufWithType(e,t){return new FungibleHookCall({hookId:null!=e.hookId?e.hookId:void 0,evmHookCall:e.evmHookCall?EvmHookCall._fromProtobuf(e.evmHookCall):void 0,type:t})}}class Transfer{constructor(e){this.accountId=e.accountId instanceof AccountId?e.accountId:AccountId.fromString(e.accountId),this.amount=e.amount instanceof Hbar?e.amount:new Hbar(e.amount),this.isApproved=e.isApproved,this.hookCall=e.hookCall}static _fromProtobuf(e){const t=[];for(const n of e){let e;null!=n.preTxAllowanceHook?e=FungibleHookCall._fromProtobufWithType(n.preTxAllowanceHook,FungibleHookType.PRE_TX_ALLOWANCE_HOOK):null!=n.prePostTxAllowanceHook&&(e=FungibleHookCall._fromProtobufWithType(n.prePostTxAllowanceHook,FungibleHookType.PRE_POST_TX_ALLOWANCE_HOOK)),t.push(new Transfer({accountId:AccountId._fromProtobuf(n.accountID),amount:Hbar.fromTinybars(null!=n.amount?n.amount:0),isApproved:n.isApproval,hookCall:e}))}return t}_toProtobuf(){const e={accountID:this.accountId._toProtobuf(),amount:this.amount.toTinybars(),isApproval:this.isApproved};if(null!=this.hookCall)switch(this.hookCall.type){case FungibleHookType.PRE_TX_ALLOWANCE_HOOK:e.preTxAllowanceHook=this.hookCall._toProtobuf();break;case FungibleHookType.PRE_POST_TX_ALLOWANCE_HOOK:e.prePostTxAllowanceHook=this.hookCall._toProtobuf()}return e}toJSON(){return{accountId:this.accountId.toString(),amount:this.amount.toTinybars().toString(),isApproved:this.isApproved}}toString(){return JSON.stringify(this.toJSON())}}class ContractLogInfo{constructor(e){this.contractId=e.contractId,this.bloom=e.bloom,this.topics=e.topics,this.data=e.data,Object.freeze(this)}static _fromProtobuf(e){return new ContractLogInfo({contractId:ContractId._fromProtobuf(e.contractID),bloom:null!=e.bloom?e.bloom:new Uint8Array,topics:null!=e.topic?e.topic:[],data:null!=e.data?e.data:new Uint8Array})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),bloom:this.bloom,topic:this.topics,data:this.data}}}function decode(e){return(new TextDecoder).decode(e)}function encode(e){return(new TextEncoder).encode(e)}const{proto:proto$6}=HieroProto;class ContractNonceInfo{constructor(e){this.contractId=e.contractId,this.nonce=e.nonce,Object.freeze(this)}static _fromProtobuf(e){return new ContractNonceInfo({contractId:ContractId._fromProtobuf(e.contractId),nonce:null!=e.nonce?e.nonce:Long.ZERO})}_toProtobuf(){return{contractId:this.contractId._toProtobuf(),nonce:this.nonce}}static fromBytes(e){return ContractNonceInfo._fromProtobuf(proto$6.ContractNonceInfo.decode(e))}toBytes(){return proto$6.ContractNonceInfo.encode(this._toProtobuf()).finish()}toJSON(){return{contractId:this.contractId.toString(),nonce:this.nonce.toNumber()}}toString(){return JSON.stringify(this.toJSON())}equals(e){return this.contractId.equals(e.contractId)&&this.nonce.eq(e.nonce)}}const defaultAbiCoder$1=AbiCoder.defaultAbiCoder();class ContractFunctionResult{constructor(e){this._createResult=e._createResult,this.contractId=e.contractId,this.bytes=e.bytes,this.errorMessage=e.errorMessage,this.bloom=e.bloom,this.gasUsed=e.gasUsed,this.logs=e.logs,this.createdContractIds=e.createdContractIds,this.evmAddress=e.evmAddress,this.stateChanges=e.stateChanges,this.gas=e.gas,this.amount=e.amount,this.functionParameters=e.functionParameters,this.senderAccountId=e.senderAccountId,this.contractNonces=e.contractNonces,this.signerNonce=e.signerNonce}static _fromProtobuf(e,t){const n=e.contractID,r=e.gasUsed,o=e.gas?e.gas:-1,a=e.amount?e.amount:-1;return new ContractFunctionResult({_createResult:t,bytes:e.contractCallResult,contractId:null!=n?ContractId._fromProtobuf(n):null,errorMessage:null!=e.errorMessage?e.errorMessage:null,bloom:e.bloom,gasUsed:r instanceof Long?r:Long.fromValue(r),logs:(null!=e.logInfo?e.logInfo:[]).map(e=>ContractLogInfo._fromProtobuf(e)),createdContractIds:(null!=e.createdContractIDs?e.createdContractIDs:[]).map(e=>ContractId._fromProtobuf(e)),evmAddress:null!=e.evmAddress&&Object.hasOwn(e.evmAddress,"value")&&null!=e.evmAddress.value?e.evmAddress.value:null,stateChanges:[],gas:o instanceof Long?o:Long.fromValue(o),amount:a instanceof Long?a:Long.fromValue(a),functionParameters:e.functionParameters,senderAccountId:null!=e.senderId?AccountId._fromProtobuf(e.senderId):null,contractNonces:(null!=e.contractNonces?e.contractNonces:[]).map(e=>ContractNonceInfo._fromProtobuf(e)),signerNonce:null!=e.signerNonce&&Object.hasOwn(e.signerNonce,"value")&&e.signerNonce.value||null})}asBytes(){return this.bytes}getString(e){return decode(this.getBytes(e))}getBytes(e){const t=this.getInt32(e),n=safeView(this.bytes).getInt32(t+28);return this.bytes.subarray(t+32,t+32+n)}getBytes32(e){return this.bytes.subarray(32*(null!=e?e:0),32*(null!=e?e:0)+32)}getBool(e){return 0!==this.bytes[32*(null!=e?e:0)+31]}getInt8(e){const t=32*(null!=e?e:0)+31;return safeView(this.bytes).getInt8(t)}getUint8(e){return this.bytes[32*(null!=e?e:0)+31]}getInt16(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint16(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt24(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint24(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt32(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint32(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt40(e){const t=defaultAbiCoder$1.decode(["int40"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint40(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(27,32)),16)}getInt48(e){const t=defaultAbiCoder$1.decode(["int48"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint48(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(26,32)),16)}getInt56(e){const t=defaultAbiCoder$1.decode(["int56"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint56(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(25,32)),16)}getInt64(e){const t=defaultAbiCoder$1.decode(["int64"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint64(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(24,32)),16)}getInt72(e){const t=defaultAbiCoder$1.decode(["int72"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint72(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(23,32)),16)}getInt80(e){const t=defaultAbiCoder$1.decode(["int80"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint80(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(22,32)),16)}getInt88(e){const t=defaultAbiCoder$1.decode(["int88"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint88(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(21,32)),16)}getInt96(e){const t=defaultAbiCoder$1.decode(["int96"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint96(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(20,32)),16)}getInt104(e){const t=defaultAbiCoder$1.decode(["int104"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint104(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(19,32)),16)}getInt112(e){const t=defaultAbiCoder$1.decode(["int112"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint112(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(18,32)),16)}getInt120(e){const t=defaultAbiCoder$1.decode(["int120"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint120(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(17,32)),16)}getInt128(e){const t=defaultAbiCoder$1.decode(["int128"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint128(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(16,32)),16)}getInt136(e){const t=defaultAbiCoder$1.decode(["int136"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint136(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(15,32)),16)}getInt144(e){const t=defaultAbiCoder$1.decode(["int144"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint144(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(14,32)),16)}getInt152(e){const t=defaultAbiCoder$1.decode(["int152"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint152(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(13,32)),16)}getInt160(e){const t=defaultAbiCoder$1.decode(["int160"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint160(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(12,32)),16)}getInt168(e){const t=defaultAbiCoder$1.decode(["int168"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint168(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(11,32)),16)}getInt176(e){const t=defaultAbiCoder$1.decode(["int176"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint176(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(10,32)),16)}getInt184(e){const t=defaultAbiCoder$1.decode(["int184"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint184(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(9,32)),16)}getInt192(e){const t=defaultAbiCoder$1.decode(["int192"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint192(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(8,32)),16)}getInt200(e){const t=defaultAbiCoder$1.decode(["int200"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint200(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(7,32)),16)}getInt208(e){const t=defaultAbiCoder$1.decode(["int208"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint208(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(6,32)),16)}getInt216(e){const t=defaultAbiCoder$1.decode(["int216"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint216(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(5,32)),16)}getInt224(e){const t=defaultAbiCoder$1.decode(["int224"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint224(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(4,32)),16)}getInt232(e){const t=defaultAbiCoder$1.decode(["int232"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint232(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(3,32)),16)}getInt240(e){const t=defaultAbiCoder$1.decode(["int240"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint240(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(2,32)),16)}getInt248(e){const t=defaultAbiCoder$1.decode(["int248"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint248(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(1,32)),16)}getInt256(e){const t=defaultAbiCoder$1.decode(["int256"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint256(e){return new BigNumber(encode$4(this._getBytes32(e)),16)}getAddress(e){return encode$4(this.bytes.subarray(32*(null!=e?e:0)+12,32*(null!=e?e:0)+32))}getResult(e){const t=defaultAbiCoder$1.decode(e,this.bytes),n=[];for(let r=0;r<t.length;r++)n.push(this._convertEthersValue(t[r],e[r]));return n}_convertEthersValue(e,t){const n="string"==typeof t?t:t.type||String(t);if(Array.isArray(e)){const t=n.replace(/\[]$/,"");return e.map(e=>this._convertEthersValue(e,t))}if("bigint"!=typeof e)return e;const r=n.match(/^u?int(\d+)?$/);if(r){if((r[1]?parseInt(r[1],10):256)<=32)return Number(e)}return new BigNumber(e.toString())}_getBytes32(e){return this.bytes.subarray(32*(null!=e?e:0),32*(null!=e?e:0)+32)}_toProtobuf(){return{contractID:null!=this.contractId?this.contractId._toProtobuf():null,contractCallResult:this.bytes,errorMessage:this.errorMessage,bloom:this.bloom,gasUsed:this.gasUsed,logInfo:this.logs.map(e=>e._toProtobuf()),createdContractIDs:this.createdContractIds.map(e=>e._toProtobuf()),evmAddress:null!=this.evmAddress?{value:this.evmAddress}:null,gas:this.gas,amount:this.amount,functionParameters:this.functionParameters,senderId:null!=this.senderAccountId?this.senderAccountId._toProtobuf():null,contractNonces:this.contractNonces.map(e=>e._toProtobuf()),signerNonce:null!=this.signerNonce?{value:this.signerNonce}:null}}}class TokenTransferAccountMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t.toString()}),e}}class TokenTransferMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}__set(e,t,n){const r=e.toString();let o=this._map.get(r);null==o&&(o=new TokenTransferAccountMap,this._map.set(r,o),this.__map.set(e,o)),o._set(t,convertAmountToLong(n))}static _fromProtobuf(e){const t=new TokenTransferMap;for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.transfers?n.transfers:[]){const n=AccountId._fromProtobuf(r.accountID);t.__set(e,n,r.amount)}}return t}_toProtobuf(){const e=[];for(const[t,n]of this){const r=[];for(const[e,t]of n)r.push({accountID:e._toProtobuf(),amount:t});e.push({token:t._toProtobuf(),transfers:r})}return e}}class TokenNftTransferMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}__set(e,t){const n=e.toString();let r=this._map.get(n);null==r&&(r=[],this._map.set(n,r),this.__map.set(e,r)),r.push(t)}static _fromProtobuf(e){const t=new TokenNftTransferMap;for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.nftTransfers?n.nftTransfers:[]){const n=AccountId._fromProtobuf(r.senderAccountID),o=AccountId._fromProtobuf(r.receiverAccountID);t.__set(e,{sender:n,recipient:o,serial:Long.fromValue(r.serialNumber),isApproved:!1})}}return t}_toProtobuf(){const e=[];for(const[t,n]of this){const r=[];for(const e of n)r.push({senderAccountID:e.sender._toProtobuf(),receiverAccountID:e.recipient._toProtobuf(),serialNumber:e.serial});e.push({token:t._toProtobuf(),nftTransfers:r})}return e}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t.map(e=>({sender:e.sender.toString(),recipient:e.recipient.toString(),serial:e.serial,isApproved:e.isApproved}))}),e}}class AssessedCustomFee{constructor(e={}){this._feeCollectorAccountId=null,null!=e.feeCollectorAccountId&&this.setFeeCollectorAccountId(e.feeCollectorAccountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._amount=null,null!=e.amount&&this.setAmount(e.amount),this._payerAccountIds=null,null!=e.payerAccountIds&&this.setPayerAccountIds(e.payerAccountIds)}get feeCollectorAccountId(){return this._feeCollectorAccountId}setFeeCollectorAccountId(e){return this._feeCollectorAccountId="string"==typeof e?AccountId.fromString(e):e,this}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}get amount(){return this._amount}setAmount(e){return this._amount=convertAmountToLong(e),this}get payerAccountIds(){return this._payerAccountIds}setPayerAccountIds(e){return this._payerAccountIds=e,this}static _fromProtobuf(e){return new AssessedCustomFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,tokenId:null!=e.tokenId?TokenId._fromProtobuf(e.tokenId):void 0,amount:null!=e.amount?e.amount:void 0,payerAccountIds:null!=e.effectivePayerAccountId?e.effectivePayerAccountId.map(e=>AccountId._fromProtobuf(e)):void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,tokenId:null!=this._tokenId?this._tokenId._toProtobuf():null,amount:this._amount,effectivePayerAccountId:null!=this._payerAccountIds?this._payerAccountIds.map(e=>e._toProtobuf()):null}}toJSON(){return{feeCollectorAccountId:this.feeCollectorAccountId?.toString()||null,tokenId:this._tokenId?.toString()||null,amount:this._amount?.toString()||null,payerAccountIds:this._payerAccountIds?.map(e=>e.toString())||[]}}}class TokenAssociation{constructor(e={}){this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._defaultMaxTransactionFee=new Hbar(5)}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e,this}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}static _fromProtobuf(e){return new TokenAssociation({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):void 0,tokenId:null!=e.tokenId?TokenId._fromProtobuf(e.tokenId):void 0})}_toProtobuf(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():void 0,tokenId:null!=this._tokenId?this._tokenId._toProtobuf():void 0}}toJSON(){return{accountId:this._accountId?.toString()||null,tokenId:this._tokenId?.toString()||null}}}class TokenTransfer{constructor(e){this.tokenId=e.tokenId instanceof TokenId?e.tokenId:TokenId.fromString(e.tokenId),this.accountId=e.accountId instanceof AccountId?e.accountId:AccountId.fromString(e.accountId),this.expectedDecimals=e.expectedDecimals,this.amount=convertAmountToLong(e.amount),this.isApproved=e.isApproved,this.hookCall=e.hookCall||null}static _fromProtobuf(e){const t=[];for(const n of e){const e=TokenId._fromProtobuf(n.token),r=null!=n.expectedDecimals&&Object.hasOwn(n.expectedDecimals,"value")?n.expectedDecimals.value:null;for(const o of null!=n.transfers?n.transfers:[]){let n=null;null!=o.preTxAllowanceHook?n=FungibleHookCall._fromProtobufWithType(o.preTxAllowanceHook,FungibleHookType.PRE_TX_ALLOWANCE_HOOK):null!=o.prePostTxAllowanceHook&&(n=FungibleHookCall._fromProtobufWithType(o.prePostTxAllowanceHook,FungibleHookType.PRE_POST_TX_ALLOWANCE_HOOK)),t.push(new TokenTransfer({tokenId:e,accountId:AccountId._fromProtobuf(o.accountID),expectedDecimals:r||null,amount:null!=o.amount?o.amount:Long.ZERO,isApproved:1==o.isApproval,hookCall:n??void 0}))}}return t}_toProtobuf(){const e={accountID:this.accountId._toProtobuf(),amount:this.amount,isApproval:this.isApproved};if(null!=this.hookCall)switch(this.hookCall.type){case FungibleHookType.PRE_TX_ALLOWANCE_HOOK:e.preTxAllowanceHook=this.hookCall._toProtobuf();break;case FungibleHookType.PRE_POST_TX_ALLOWANCE_HOOK:e.prePostTxAllowanceHook=this.hookCall._toProtobuf()}return e}toJSON(){return{tokenId:this.tokenId.toString(),accountId:this.accountId.toString(),expectedDecimals:this.expectedDecimals,amount:this.amount.toString(),isApproved:this.isApproved}}toString(){return JSON.stringify(this.toJSON())}}class NftId{constructor(e,t){this.tokenId=e,this.serial="number"==typeof t?Long.fromNumber(t):t,Object.freeze(this)}static fromString(e){const t=e.split("/").length>1?e.split("/"):e.split("@");for(const e of t)if(""===e)throw new Error("invalid format for NftId: use [token]/[serial] or [token]@[serial]");const n=TokenId.fromString(t[0]),r=Long.fromString(t[1]);return new NftId(n,r)}static _fromProtobuf(e){return new NftId(TokenId._fromProtobuf(e.token_ID),null!=e.serialNumber?e.serialNumber:Long.ZERO)}static fromBytes(e){return NftId._fromProtobuf(libExports.proto.NftID.decode(e))}_toProtobuf(){return{token_ID:this.tokenId._toProtobuf(),serialNumber:Long.fromValue(void 0!==this.serial?this.serial:0)}}toString(){return`${this.tokenId.toString()}/${this.serial.toString()}`}toBytes(){return libExports.proto.NftID.encode(this._toProtobuf()).finish()}}class PendingAirdropId{constructor(e={}){this._senderId=null,this._receiverId=null,this._tokenId=null,this._nftId=null,null!=e.receiverId&&this.setReceiverId(e.receiverId),null!=e.senderId&&this.setSenderid(e.senderId),null!=e.tokenId?this.setTokenId(e.tokenId):null!=e.nftId&&this.setNftId(e.nftId)}static fromBytes(e){if(null==e.senderId)throw new Error("senderId is required");if(null==e.receiverId)throw new Error("receiverId is required");if(null==e.fungibleTokenType&&null==e.nonFungibleToken)throw new Error("Either fungibleTokenType or nonFungibleToken is required");return new PendingAirdropId({senderId:AccountId._fromProtobuf(e.senderId),receiverId:AccountId._fromProtobuf(e.receiverId),nftId:null!=e.nonFungibleToken?NftId._fromProtobuf(e.nonFungibleToken):null,tokenId:null!=e.fungibleTokenType?TokenId._fromProtobuf(e.fungibleTokenType):null})}setSenderid(e){return this._senderId="string"==typeof e?AccountId.fromString(e):e,this}setReceiverId(e){return this._receiverId="string"==typeof e?AccountId.fromString(e):e,this}setTokenId(e){return this._nftId=null,this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}setNftId(e){return this._tokenId=null,this._nftId="string"==typeof e?NftId.fromString(e):e,this}get senderId(){return this._senderId}get receiverId(){return this._receiverId}get tokenId(){return this._tokenId}get nftId(){return this._nftId}toBytes(){return{senderId:this._senderId?._toProtobuf(),receiverId:this._receiverId?._toProtobuf(),fungibleTokenType:this._tokenId?._toProtobuf(),nonFungibleToken:this._nftId?._toProtobuf()}}}class PendingAirdropRecord{constructor(e){this.airdropId=e.airdropId,this.amount=convertAmountToLong(e.amount)}toBytes(){return{pendingAirdropId:this.airdropId.toBytes(),pendingAirdropValue:{amount:this.amount}}}static fromBytes(e){if(null==e.pendingAirdropId)throw new Error("pendingAirdropId is required");const t=PendingAirdropId.fromBytes(e.pendingAirdropId),n=e.pendingAirdropValue?.amount;return new PendingAirdropRecord({airdropId:t,amount:n||Long.ZERO})}}class TransactionRecord{constructor(e){this.receipt=e.receipt,this.transactionHash=e.transactionHash,this.consensusTimestamp=e.consensusTimestamp,this.transactionId=e.transactionId,this.transactionMemo=e.transactionMemo,this.transactionFee=e.transactionFee,this.transfers=e.transfers,this.contractFunctionResult=null!=e.contractFunctionResult?e.contractFunctionResult:null,this.tokenTransfers=e.tokenTransfers,this.tokenTransfersList=e.tokenTransfersList,this.scheduleRef=e.scheduleRef,this.assessedCustomFees=e.assessedCustomFees,this.nftTransfers=e.nftTransfers,this.automaticTokenAssociations=e.automaticTokenAssociations,this.parentConsensusTimestamp=e.parentConsensusTimestamp,this.aliasKey=e.aliasKey,this.duplicates=e.duplicates,this.children=e.children,this.hbarAllowanceAdjustments=e.hbarAllowanceAdjustments,this.tokenAllowanceAdjustments=e.tokenAllowanceAdjustments,this.nftAllowanceAdjustments=e.nftAllowanceAdjustments,this.ethereumHash=e.ethereumHash,this.paidStakingRewards=e.paidStakingRewards,this.prngBytes=e.prngBytes,this.prngNumber=e.prngNumber,this.evmAddress=e.evmAddress,this.newPendingAirdrops=e.newPendingAirdrops,Object.freeze(this)}_toProtobuf(){const e=this.tokenTransfers._toProtobuf(),t=this.nftTransfers._toProtobuf(),n=[];for(const r of e)for(const e of t)null!=r.token&&null!=e.token&&r.token.shardNum===e.token.shardNum&&r.token.realmNum===e.token.realmNum&&r.token.tokenNum===e.token.tokenNum?n.push({token:r.token,transfers:r.transfers,nftTransfers:r.nftTransfers}):(n.push(r),n.push(e));return{duplicateTransactionRecords:this.duplicates.map(e=>e._toProtobuf().transactionRecord),childTransactionRecords:this.children.map(e=>e._toProtobuf().transactionRecord),transactionRecord:{receipt:this.receipt._toProtobuf().receipt,transactionHash:null!=this.transactionHash?this.transactionHash:null,consensusTimestamp:null!=this.consensusTimestamp?this.consensusTimestamp._toProtobuf():null,transactionID:null!=this.transactionId?this.transactionId._toProtobuf():null,memo:null!=this.transactionMemo?this.transactionMemo:null,transactionFee:null!=this.transactionFee?this.transactionFee.toTinybars():null,contractCallResult:null==this.contractFunctionResult||this.contractFunctionResult._createResult?null:this.contractFunctionResult._toProtobuf(),contractCreateResult:null!=this.contractFunctionResult&&this.contractFunctionResult._createResult?this.contractFunctionResult._toProtobuf():null,transferList:null!=this.transfers?{accountAmounts:this.transfers.map(e=>e._toProtobuf())}:null,tokenTransferLists:n,scheduleRef:null!=this.scheduleRef?this.scheduleRef._toProtobuf():null,assessedCustomFees:this.assessedCustomFees.map(e=>e._toProtobuf()),automaticTokenAssociations:this.automaticTokenAssociations.map(e=>e._toProtobuf()),parentConsensusTimestamp:null!=this.parentConsensusTimestamp?this.parentConsensusTimestamp._toProtobuf():null,alias:null!=this.aliasKey?libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ethereumHash:this.ethereumHash,paidStakingRewards:this.paidStakingRewards.map(e=>e._toProtobuf()),prngBytes:this.prngBytes,prngNumber:null!=this.prngNumber?this.prngNumber:null,evmAddress:null!=this.evmAddress?this.evmAddress.toBytes():null,newPendingAirdrops:this.newPendingAirdrops.map(e=>e.toBytes())}}}static _fromProtobuf(e){const t=e.transactionRecord;let n=null!=t.alias&&t.alias.length>0?Key._fromProtobufKey(libExports.proto.Key.decode(t.alias)):null;n instanceof PublicKey||(n=null);const r=null!=e.childTransactionRecords?e.childTransactionRecords.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})):[],o=null!=e.duplicateTransactionRecords?e.duplicateTransactionRecords.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})):[],a=null!=t.contractCallResult?ContractFunctionResult._fromProtobuf(t.contractCallResult,!1):null!=t.contractCreateResult?ContractFunctionResult._fromProtobuf(t.contractCreateResult,!0):void 0,i=null!=t.newPendingAirdrops?t.newPendingAirdrops.map(e=>PendingAirdropRecord.fromBytes(e)):[];return new TransactionRecord({receipt:TransactionReceipt._fromProtobuf({receipt:t.receipt}),transactionHash:null!=t.transactionHash?t.transactionHash:new Uint8Array,consensusTimestamp:Timestamp._fromProtobuf(t.consensusTimestamp),transactionId:TransactionId._fromProtobuf(t.transactionID),transactionMemo:null!=t.memo?t.memo:"",transactionFee:Hbar.fromTinybars(null!=t.transactionFee?t.transactionFee:0),transfers:Transfer._fromProtobuf(null!=t.transferList&&null!=t.transferList.accountAmounts?t.transferList.accountAmounts:[]),contractFunctionResult:a,tokenTransfers:TokenTransferMap._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),tokenTransfersList:TokenTransfer._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),scheduleRef:null!=t.scheduleRef?ScheduleId._fromProtobuf(t.scheduleRef):null,assessedCustomFees:null!=t.assessedCustomFees?t.assessedCustomFees.map(e=>AssessedCustomFee._fromProtobuf(e)):[],nftTransfers:TokenNftTransferMap._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),automaticTokenAssociations:null!=t.automaticTokenAssociations?t.automaticTokenAssociations.map(e=>TokenAssociation._fromProtobuf(e)):[],parentConsensusTimestamp:null!=t.parentConsensusTimestamp?Timestamp._fromProtobuf(t.parentConsensusTimestamp):null,aliasKey:n,duplicates:o,children:r,hbarAllowanceAdjustments:[],tokenAllowanceAdjustments:[],nftAllowanceAdjustments:[],ethereumHash:null!=t.ethereumHash?t.ethereumHash:null,paidStakingRewards:null!=t.paidStakingRewards?Transfer._fromProtobuf(t.paidStakingRewards):[],prngBytes:null!=t.prngBytes?t.prngBytes:null,prngNumber:null!=t.prngNumber?t.prngNumber:null,evmAddress:null!=t.evmAddress?EvmAddress.fromBytes(t.evmAddress):null,newPendingAirdrops:i})}static fromBytes(e){return TransactionRecord._fromProtobuf(libExports.proto.TransactionGetRecordResponse.decode(e))}toBytes(){return libExports.proto.TransactionGetRecordResponse.encode(this._toProtobuf()).finish()}toJSON(){return{receipt:this.receipt.toJSON(),transactionHash:encode$4(this.transactionHash),consensusTimestamp:this.consensusTimestamp.toDate(),transactionId:this.transactionId.toString(),transactionMemo:this.transactionMemo,transactionFee:this.transactionFee.toTinybars().toString(),transfers:this.transfers.map(e=>e.toJSON()),tokenTransfers:this.tokenTransfers,tokenTransfersList:this.tokenTransfersList.map(e=>e.toJSON()),scheduleRef:this.scheduleRef?.toString()||null,assessedCustomFees:this.assessedCustomFees,nftTransfers:this.nftTransfers,automaticTokenAssociations:this.automaticTokenAssociations,parentConsensusTimestamp:this.parentConsensusTimestamp?.toDate()||null,aliasKey:this.aliasKey?.toString()||null,duplicates:this.duplicates,children:this.children,ethereumHash:null!=this.ethereumHash?encode$4(this.ethereumHash):null,paidStakingRewards:this.paidStakingRewards,prngBytes:null!=this.prngBytes?encode$4(this.prngBytes):null,prngNumber:this.prngNumber,evmAddress:this.evmAddress?.toString()||null}}toString(){return JSON.stringify(this.toJSON())}}class RecordStatusError extends StatusError{constructor(e){super(e,`Record for transaction ${e.transactionId.toString()} contained error status ${e.status.toString()}`),this.transactionRecord=e.transactionRecord}}const{proto:proto$5}=HieroProto;class TransactionRecordQuery extends Query{constructor(e={}){super(),this._transactionId=null,this._includeChildren=null,this._includeDuplicates=null,this._validateReceiptStatus=!0,null!=e.transactionId&&this.setTransactionId(e.transactionId),null!=e.includeChildren&&this.setIncludeChildren(e.includeChildren),null!=e.includeDuplicates&&this.setIncludeDuplicates(e.includeDuplicates),null!=e.validateReceiptStatus&&this.setValidateReceiptStatus(e.validateReceiptStatus)}get transactionId(){return this._transactionId}static _fromProtobuf(e){const t=e.transactionGetRecord;return new TransactionRecordQuery({transactionId:t.transactionID?TransactionId._fromProtobuf(t.transactionID):void 0,includeChildren:null!=t.includeChildRecords?t.includeChildRecords:void 0,includeDuplicates:null!=t.includeDuplicates?t.includeDuplicates:void 0})}setTransactionId(e){return this._transactionId="string"==typeof e?TransactionId.fromString(e):e.clone(),this}setIncludeChildren(e){return this._includeChildren=e,this}get includeChildren(){return null!=this._includeChildren&&this._includeChildren}setIncludeDuplicates(e){return this._duplicates=e,this}get includeDuplicates(){return null!=this._duplicates&&this._duplicates}setValidateReceiptStatus(e){return this._validateReceiptStatus=e,this}get validateReceiptStatus(){return this._validateReceiptStatus}_getStatusAndExecutionState(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t);let r=Status._fromCode(null!=n?n:proto$5.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received node precheck status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.RecordNotFound:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:break;default:return[r,ExecutionState.Error]}const o=t.transactionGetRecord;if(o.header.responseType===libExports.proto.ResponseType.COST_ANSWER)return[r,ExecutionState.Finished];const a=o.transactionRecord.receipt.status;switch(r=Status._fromCode(a),this._logger&&this._logger.debug(`[${this._getLogId()}] received record's receipt ${r.toString()}`),r){case Status.Ok:case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.RecordNotFound:return[r,ExecutionState.Retry];case Status.Success:return[r,ExecutionState.Finished];default:return[r,this._validateReceiptStatus?ExecutionState.Error:ExecutionState.Finished]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t);let o=Status._fromCode(null!=r?r:proto$5.ResponseCodeEnum.OK);switch(o){case Status.Ok:break;case Status.ContractRevertExecuted:return new RecordStatusError({status:o,transactionId:this._getTransactionId(),transactionRecord:TransactionRecord._fromProtobuf({transactionRecord:t.transactionGetRecord.transactionRecord})});default:return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}const a=t.transactionGetRecord.transactionRecord.receipt,i=a.status;return o=Status._fromCode(i),o===Status.ContractRevertExecuted?new RecordStatusError({status:o,transactionId:this._getTransactionId(),transactionRecord:TransactionRecord._fromProtobuf({transactionRecord:t.transactionGetRecord.transactionRecord})}):new ReceiptStatusError({status:o,transactionId:this._getTransactionId(),transactionReceipt:TransactionReceipt._fromProtobuf({receipt:a})})}_validateChecksums(e){null!=this._transactionId&&null!=this._transactionId.accountId&&this._transactionId.accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getTxRecordByTxID(t)}_mapResponseHeader(e){return e.transactionGetRecord.header}_mapResponse(e,t,n){const r=e.transactionGetRecord;return Promise.resolve(TransactionRecord._fromProtobuf(r))}_onMakeRequest(e){return{transactionGetRecord:{header:e,transactionID:null!=this._transactionId?this._transactionId._toProtobuf():null,includeChildRecords:this._includeChildren,includeDuplicates:this._includeDuplicates}}}_getLogId(){return`TransactionRecordQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("transactionGetRecord",TransactionRecordQuery._fromProtobuf);class TransactionResponse{constructor(e){this.nodeId=e.nodeId,this.transactionHash=e.transactionHash,this.transactionId=e.transactionId,this.transaction=e.transaction,this.logger=e.logger,this.transactionNodeAccountIds=e.transactionNodeAccountIds}static fromJSON(e){return new TransactionResponse({nodeId:AccountId.fromString(e.nodeId),transactionHash:decode$7(e.transactionHash),transactionId:TransactionId.fromString(e.transactionId)})}async getReceipt(e){let t;try{t=await this.getReceiptQuery(e).execute(e)}catch(t){if(t instanceof ReceiptStatusError&&t.status===Status.ThrottledAtConsensus)return this.logger?.info("Transaction throttled at consensus"),this._retryTransaction(e);throw t}if(t.status!==Status.Success&&t.status!==Status.FeeScheduleFilePartUploaded)throw new ReceiptStatusError({transactionReceipt:t,status:t.status,transactionId:this.transactionId});return t}async getRecord(e){return await this.getReceipt(e),this.getRecordQuery(e).execute(e)}async getVerboseRecord(e){try{return await this.getReceiptQuery(e).execute(e),this.getRecordQuery(e).execute(e)}catch(t){return this.getRecordQuery(e).execute(e)}}async getReceiptWithSigner(e){const t=await this.getReceiptQuery().executeWithSigner(e);if(t.status!==Status.Success)throw new ReceiptStatusError({transactionReceipt:t,status:t.status,transactionId:this.transactionId});return t}async getRecordWithSigner(e){return await this.getReceiptWithSigner(e),this.getRecordQuery().executeWithSigner(e)}getReceiptQuery(e){const t=(new TransactionReceiptQuery).setTransactionId(this.transactionId);if(null!=e&&e.allowReceiptNodeFailover){const n=null!=this.transactionNodeAccountIds&&this.transactionNodeAccountIds.length>0?this.transactionNodeAccountIds:e._network.getNodeAccountIdsForExecute(),r=[this.nodeId];for(const e of n)e.equals(this.nodeId)||r.push(e);t.setNodeAccountIds(r)}else t.setNodeAccountIds([this.nodeId]);return t}getRecordQuery(e){const t=(new TransactionRecordQuery).setTransactionId(this.transactionId);if(null!=e&&e.allowReceiptNodeFailover){const n=null!=this.transactionNodeAccountIds&&this.transactionNodeAccountIds.length>0?this.transactionNodeAccountIds:e._network.getNodeAccountIdsForExecute(),r=[this.nodeId];for(const e of n)e.equals(this.nodeId)||r.push(e);t.setNodeAccountIds(r)}else t.setNodeAccountIds([this.nodeId]);return t}toJSON(){return{nodeId:this.nodeId.toString(),transactionHash:encode$4(this.transactionHash),transactionId:this.transactionId.toString()}}async _retryTransaction(e){if(!this.transaction)throw new Error("If you retry transaction you should have the transaction set");if(e.operatorAccountId?.toString()!==this.transaction.transactionId?.accountId?.toString())throw new Error("Retry mechanism is not supported when tx id is not generated by the operator account");if(null===e.operatorAccountId)throw new Error("Operator account is not set");let t=250;for(let n=0;n<5;n++){if(this.logger?.trace(`Transaction throttled, retry attempt ${n}`),this.transaction?._resetTransaction(e),null==this.transaction||null==this.transaction.transactionId)throw new Error("Transaction or Transaction ID is null after reset");this.transactionId=this.transaction.transactionId,n>0&&(await wait(Math.min(t,16e3)),t*=2);try{this.transaction._resetTransaction(e);const t=await this.transaction.execute(e),r=await(new TransactionReceiptQuery).setTransactionId(t.transactionId).setNodeAccountIds([t.nodeId]).execute(e);if(r.status!==Status.ThrottledAtConsensus)return this.logger?.info(`Transaction throttle retry succeeded after attempt ${n}`),r}catch(e){if(e instanceof ReceiptStatusError&&e.status===Status.ThrottledAtConsensus){this.logger?.info("Transaction throttled at consensus");continue}throw this.logger?.error(`An error occurred after throttle retry: ${e instanceof Error?e.message:String(e)}`),e}}throw this.logger?.error("Transaction throttle retry failed after maximum attempts"),new Error("Transaction retry failed after maximum attempts")}toString(){return JSON.stringify(this.toJSON())}}async function digest(e){const t=e.buffer instanceof ArrayBuffer?e:new Uint8Array(e);return new Uint8Array(await window.crypto.subtle.digest("SHA-384",t))}class TransactionHashMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static async _fromTransaction(e){const t=new TransactionHashMap;for(let n=0;n<e._nodeAccountIds.length;n++){const r=e._nodeAccountIds.list[n],o=e._transactions.get(n),a=await digest(o.signedTransactionBytes);t._set(r,a)}return t}}class NodeAccountIdSignatureMap extends ObjectMap{constructor(){super(e=>PublicKey.fromString(e))}static _fromTransactionSigMap(e){const t=new NodeAccountIdSignatureMap,n=null!=e.sigPair?e.sigPair:[];for(const e of n)null!=e.pubKeyPrefix&&(null!=e.ed25519?t._set(PublicKey.fromBytesED25519(e.pubKeyPrefix),e.ed25519):null!=e.ECDSASecp256k1&&t._set(PublicKey.fromBytesECDSA(e.pubKeyPrefix),e.ECDSASecp256k1));return t}}class SignatureMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromTransaction(e){const t=new SignatureMap;for(let n=0;n<e._nodeAccountIds.length;n++){const r=e._signedTransactions.get(n).sigMap;null!=r&&t._set(e._nodeAccountIds.list[n],NodeAccountIdSignatureMap._fromTransactionSigMap(r))}return t}}class CustomFee{constructor(e={}){this._feeCollectorAccountId=null,this._allCollectorsAreExempt=!1,null!=e.feeCollectorAccountId&&this.setFeeCollectorAccountId(e.feeCollectorAccountId),null!=e.allCollectorsAreExempt&&this.setAllCollectorsAreExempt(e.allCollectorsAreExempt)}get feeCollectorAccountId(){return this._feeCollectorAccountId}setFeeCollectorAccountId(e){return this._feeCollectorAccountId="string"==typeof e?AccountId.fromString(e):e,this}get allCollectorsAreExempt(){return this._allCollectorsAreExempt}setAllCollectorsAreExempt(e){return this._allCollectorsAreExempt=e,this}static _fromProtobuf(e){throw new Error("not implemented")}_toProtobuf(){throw new Error("not implemented")}}class CustomFixedFee extends CustomFee{constructor(e={}){super(e),this._denominatingTokenId=null,null!=e.denominatingTokenId&&this.setDenominatingTokenId(e.denominatingTokenId),this._amount=null,null!=e.amount&&this.setAmount(e.amount)}setHbarAmount(e){return this._amount=e.toTinybars(),this._denominatingTokenId=null,this}get hbarAmount(){return null!=this._denominatingTokenId?null:Hbar.fromTinybars(null!=this._amount?this._amount:0)}setDenominatingTokenToSameToken(){return this._denominatingTokenId=new TokenId(0,0,0),this}get denominatingTokenId(){return this._denominatingTokenId}setDenominatingTokenId(e){return this._denominatingTokenId="string"==typeof e?TokenId.fromString(e):e,this}get amount(){return this._amount}setAmount(e){return this._amount=convertAmountToLong(e),this}static _fromProtobuf(e){const t=e.fixedFee;return new CustomFixedFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,denominatingTokenId:null!=t.denominatingTokenId?TokenId._fromProtobuf(t.denominatingTokenId):void 0,amount:null!=t.amount?t.amount:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}_toTopicFeeProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}}class CustomFeeLimit{constructor(e={}){this._accountId=null,e.accountId&&this.setAccountId(e.accountId),this._fees=null,e.fees&&this.setFees(e.fees)}static _fromProtobuf(e){return new CustomFeeLimit({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):null,fees:null!=e.fees?e.fees.map(e=>CustomFixedFee._fromProtobuf({fixedFee:e})):null})}getAccountId(){return this._accountId}setAccountId(e){return this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}getFees(){return this._fees}setFees(e){return this._fees=e,this}_toProtobuf(){const e=[];return null!=this._fees&&this._fees.forEach(t=>{const n=t._toProtobuf();null!=n.fixedFee&&e.push(n.fixedFee)}),{accountId:null!=this._accountId?this._accountId._toProtobuf():null,fees:e}}}class SignableNodeTransactionBodyBytes{constructor(e,t,n){this.nodeAccountId=e,this.transactionId=t,this.signableTransactionBodyBytes=n}}const DEFAULT_AUTO_RENEW_PERIOD=Long.fromValue(7776e3),DEFAULT_RECORD_THRESHOLD=Hbar.fromTinybars(Long.fromString("9223372036854775807")),NODE_ACCOUNT_BATCH_ID=new AccountId(0,0,0),DEFAULT_TRANSACTION_VALID_DURATION=120,CHUNK_SIZE=1024;function isMultiTransactionIdType(e){return"fileAppend"===e||"consensusSubmitMessage"===e}const TRANSACTION_REGISTRY=new Map;class Transaction extends Executable{constructor(){super(),this._transactions=new List,this._signedTransactions=new List,this._signerPublicKeys=new Set,this._transactionValidDuration=DEFAULT_TRANSACTION_VALID_DURATION,this._defaultMaxTransactionFee=new Hbar(2),this._customFeeLimits=[],this._maxTransactionFee=null,this._transactionMemo="",this._transactionIds=new List,this._publicKeys=[],this._transactionSigners=[],this._regenerateTransactionId=null,this._batchKey=null,this._isThrottled=!1}static fromBytes(e){const t=[],n=[],r=[],o=[],a=[],i=[],s=libExports.proto.TransactionList.decode(e).transactionList;if(0===s.length){const t=libExports.proto.Transaction.decode(e);0!==t.signedTransactionBytes.length?s.push(t):s.push({signedTransactionBytes:libExports.proto.SignedTransaction.encode({sigMap:t.sigMap,bodyBytes:t.bodyBytes}).finish()})}for(const e of s){if(null==e.bodyBytes&&null==e.signedTransactionBytes)throw new Error("bodyBytes and signedTransactionBytes are null");if(e.bodyBytes&&0!=e.bodyBytes.length){const t=libExports.proto.TransactionBody.decode(e.bodyBytes);if(null!=t.transactionID){const e=TransactionId._fromProtobuf(t.transactionID);o.includes(e.toString())||(n.push(e),o.push(e.toString()))}if(null!=t.nodeAccountID){const e=AccountId._fromProtobuf(t.nodeAccountID);a.includes(e.toString())||(r.push(e),a.push(e.toString()))}if(null==t.data)throw new Error("(BUG) body.data was not set in the protobuf");i.push(t)}if(e.signedTransactionBytes&&0!=e.signedTransactionBytes.length){const s=libExports.proto.SignedTransaction.decode(e.signedTransactionBytes);t.push(s);const c=libExports.proto.TransactionBody.decode(s.bodyBytes);if(null!=c.transactionID){const e=TransactionId._fromProtobuf(c.transactionID);o.includes(e.toString())||(n.push(e),o.push(e.toString()))}if(null!=c.nodeAccountID){const e=AccountId._fromProtobuf(c.nodeAccountID);a.includes(e.toString())||(r.push(e),a.push(e.toString()))}if(null==c.data)throw new Error("(BUG) body.data was not set in the protobuf");i.push(c)}}const c=i[0];if(null==c||null==c.data)throw new Error("No transaction found in bytes or failed to decode TransactionBody");const u=TRANSACTION_REGISTRY.get(c.data);if(null==u)throw new Error(`(BUG) Transaction.fromBytes() not implemented for type ${c.data}`);return u(s,t,n,r,i)}schedule(){if(this._requireNotFrozen(),1!=SCHEDULE_CREATE_TRANSACTION.length)throw new Error("ScheduleCreateTransaction has not been loaded yet");return SCHEDULE_CREATE_TRANSACTION[0]()._setScheduledTransaction(this)}async batchify(e,t){return this._requireNotFrozen(),this.setBatchKey(t),await this.signWithOperator(e)}static _validateTransactionBodies(e,t,n,r){const o=0===t.length,a=0===r.length;if(o||a)return;const i=t.length,s=n.length,c=0===s?1:s,u=isMultiTransactionIdType(e),l=!u&&1!==i;if(0===s){if(r.length!==i||l)throw new Error("failed to validate transaction bodies");return}const d=i*c;if(r.length!==d||l)throw new Error("failed to validate transaction bodies");const p=new Set;p.add("nodeAccountID");for(let e=0;e<i;e++){const t=e*s,n=r[t];for(let e=1;e<s;e++)if(!compare$1(n,r[t+e],p))throw new Error("failed to validate transaction bodies")}u&&Transaction._validateChunkedTransactionBodies(e,r,c)}static _validateChunkedTransactionBodies(e,t,n){const r=Transaction._getChunkedTransactionIgnoredFields(e),o=t[0];for(let e=n;e<t.length;e+=n)if(!compare$1(o,t[e],r))throw new Error("failed to validate transaction bodies")}static _getChunkedTransactionIgnoredFields(e){const t=new Set;return t.add("nodeAccountID"),t.add("transactionID"),"fileAppend"===e?t.add("contents"):"consensusSubmitMessage"===e&&(t.add("message"),t.add("chunkInfo")),t}static _fromProtobufTransactions(e,t,n,r,o,a){const i=a[0];Transaction._validateTransactionBodies(e._getTransactionDataCase(),r,o,a);const s=new AccountId(0);for(let e=0;e<o.length;e++)o[e].equals(s)&&o.splice(e--,1);e._transactions.setList(t),e._signedTransactions.setList(n),e._transactionIds.setList(r),e._nodeAccountIds.setList(o),e._transactionValidDuration=null!=i.transactionValidDuration&&null!=i.transactionValidDuration.seconds?Long.fromValue(i.transactionValidDuration.seconds).toInt():DEFAULT_TRANSACTION_VALID_DURATION,e._maxTransactionFee=null!=i.transactionFee&&i.transactionFee>new Long(0,0,!0)?Hbar.fromTinybars(i.transactionFee):null,e._customFeeLimits=null!=i.maxCustomFees?i.maxCustomFees?.map(e=>CustomFeeLimit._fromProtobuf(e)):[],e._batchKey=null!=i.batchKey?Key._fromProtobufKey(i?.batchKey):null,e._transactionMemo=null!=i.memo?i.memo:"";for(let r=0;r<o.length;r++){const o=n[r]||t[r];if(null!=o.sigMap&&null!=o.sigMap.sigPair)for(const t of o.sigMap.sigPair)e._signerPublicKeys.add(encode$4(t.pubKeyPrefix)),e._publicKeys.push(PublicKey.fromBytes(t.pubKeyPrefix)),e._transactionSigners.push(null)}return e}setNodeAccountIds(e){return this._requireNotFrozen(),super.setNodeAccountIds(e),this}get transactionValidDuration(){return this._transactionValidDuration}get size(){return this._requireFrozen(),this._makeRequestAsync().then(e=>libExports.proto.Transaction.encode(e).finish().length)}get bodySize(){const e=this._makeTransactionBody(AccountId.fromString("0.0.0"));return libExports.proto.TransactionBody.encode(e).finish().length}setTransactionValidDuration(e){return this._requireNotFrozen(),this._transactionValidDuration=e,this}get maxTransactionFee(){return this._maxTransactionFee}setMaxTransactionFee(e){return this._requireNotFrozen(),this._maxTransactionFee=e instanceof Hbar?e:new Hbar(e),this}get regenerateTransactionId(){return this._regenerateTransactionId}setRegenerateTransactionId(e){return this._requireNotFrozen(),this._regenerateTransactionId=e,this}get transactionMemo(){return this._transactionMemo}setTransactionMemo(e){return this._requireNotFrozen(),this._transactionMemo=e,this}get transactionId(){return this._transactionIds.isEmpty?null:(this._transactionIds.setLocked(),this._transactionIds.current)}setTransactionId(e){return this._requireNotFrozen(),this._transactionIds.setList([e]).setLocked(),this}getRequiredChunks(){return 1}get bodySizeAllChunks(){const e=[];for(let t=0;t<this.getRequiredChunks();t++)this._transactionIds.index=t,e.push(this.bodySize);return this._transactionIds.index=0,e}sign(e){return this.signWith(e.publicKey,t=>Promise.resolve(e.sign(t)))}_validateSignedTransactionBodies(){if(0===this._transactionIds.length||0===this._signedTransactions.length)return;const e=[];for(const t of this._signedTransactions.list){if(null==t.bodyBytes)throw new Error("failed to validate transaction bodies");e.push(libExports.proto.TransactionBody.decode(t.bodyBytes))}Transaction._validateTransactionBodies(this._getTransactionDataCase(),this._transactionIds.list,this._nodeAccountIds.list,e)}async signWith(e,t){this._signOnDemand||this._requireFrozen();const n=encode$4(e.toBytesRaw());if(this._signerPublicKeys.has(n))return this;if(this._validateSignedTransactionBodies(),this._transactions.clear(),this._signerPublicKeys.add(n),this._publicKeys.push(e),this._transactionSigners.push(t),this._signOnDemand)return this;this._transactionIds.setLocked(),this._nodeAccountIds.setLocked();for(const n of this._signedTransactions.list){const r=n.bodyBytes,o=await t(r);null==n.sigMap&&(n.sigMap={}),null==n.sigMap.sigPair&&(n.sigMap.sigPair=[]),n.sigMap.sigPair.push(e._toProtobufSignature(o))}return this}signWithOperator(e){const t=e._operator;if(null==t)throw new Error("`client` must have an operator to sign with the operator");return this._isFrozen()||this.freezeWith(e),this.signWith(t.publicKey,t.transactionSigner)}_resetTransaction(e){if(!e.operatorAccountId)throw new Error("Client must have an operator account ID");this.logger?.info("Resetting transaction id and resigning");const t=TransactionId.generate(e.operatorAccountId);this._transactionIds.clear(),this._signedTransactions.clear(),this._transactionIds.setList([t]),this._isThrottled=!0}addSignature(e,t){if(!(t instanceof SignatureMap$1))return this._addSignatureLegacy(e,t);this.isFrozen()||this.freeze();const n=encode$4(e.toBytesRaw());if(this._signerPublicKeys.has(n))return this;this._transactions.clear(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._signedTransactions.setLocked();for(let n=0;n<this._signedTransactions.length;n++){const r=this._signedTransactions.get(n);if(null==r.sigMap&&(r.sigMap={}),null==r.sigMap.sigPair&&(r.sigMap.sigPair=[]),r.bodyBytes){const{transactionID:n,nodeAccountID:o}=libExports.proto.TransactionBody.decode(r.bodyBytes);if(!n||!o)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const a=TransactionId._fromProtobuf(n),i=AccountId._fromProtobuf(o),s=t.get(i),c=s?.get(a),u=c?.get(e);if(!u)throw new Error("Signature not found for the transaction and public key");const l=e._toProtobufSignature(u);r.sigMap?.sigPair?.push(l)}}return this._signerPublicKeys.add(n),this._publicKeys.push(e),this._transactionSigners.push(null),this}_addSignatureLegacy(e,t){const n=t instanceof Uint8Array,r=Array.isArray(t);if(this.getRequiredChunks()>1)throw new Error("Add signature is not supported for chunked transactions");if(n&&1!==this._signedTransactions.length)throw new Error("Signature array must match the number of transactions");if(r&&t.length!==this._signedTransactions.length)throw new Error("Signature array must match the number of transactions");this.isFrozen()||this.freeze();const o=encode$4(e.toBytesRaw());if(this._signerPublicKeys.has(o))return this;this._transactions.clear(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._signedTransactions.setLocked();const a=n?[t]:t;for(let t=0;t<this._signedTransactions.length;t++){const n=this._signedTransactions.get(t);null==n.sigMap&&(n.sigMap={}),null==n.sigMap.sigPair&&(n.sigMap.sigPair=[]),n.sigMap.sigPair.push(e._toProtobufSignature(a[t]))}return this._signerPublicKeys.add(o),this._publicKeys.push(e),this._transactionSigners.push(null),this}getSignaturesLegacy(){return this._requireFrozen(),this._requireNotSignOnDemand(),this._buildAllTransactions(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),SignatureMap._fromTransaction(this)}removeSignature(e){this.isFrozen()||this.freeze();const t=encode$4(e.toBytesRaw());if(!this._signerPublicKeys.has(t))throw new Error("The public key has not signed this transaction");const n=[];for(const e of this._signedTransactions.list){const r=this._removeSignaturesFromTransaction(e,t);n.push(...r)}return this._signerPublicKeys.delete(t),this._publicKeys=this._publicKeys.filter(t=>!t.equals(e)),this._transactionSigners.pop(),n}removeAllSignatures(){this.isFrozen()||this.freeze();const e=this._collectSignaturesByPublicKey();for(const e of this._signedTransactions.list)e.sigMap&&e.sigMap.sigPair&&(e.sigMap.sigPair=[]);return this._signerPublicKeys.clear(),this._publicKeys=[],this._transactionSigners=[],e}getSignatures(e){return e?this.getSignaturesLegacy():(this._requireFrozen(),this._requireNotSignOnDemand(),this._buildAllTransactions(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),SignatureMap$1._fromTransaction(this))}async getSignaturesAsync(){return this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),SignatureMap$1._fromTransaction(this)}_setTransactionId(){if(null==this._operatorAccountId&&this._transactionIds.isEmpty)throw new Error("`transactionId` must be set or `client` must be provided with `freezeWith`")}_setNodeAccountIds(e){if(this._nodeAccountIds.isEmpty){if(null==e)throw new Error("`nodeAccountId` must be set or `client` must be provided with `freezeWith`");this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute())}}_applyMaxNodesPerTransactionLimit(e){const t=e.maxNodesPerTransaction;if(t<=0||this._nodeAccountIds.length<=t)return;this._logger&&this._logger.debug(`Trimming frozen transaction from ${this._nodeAccountIds.length} nodes to ${t} nodes based on maxNodesPerTransaction setting`);const n=this._nodeAccountIds.list.slice(0,t),r=this._nodeAccountIds.length,o=this._transactionIds.length,a=[];for(let e=0;e<o;e++){const n=e*r;for(let e=0;e<t;e++){const t=n+e;t<this._signedTransactions.length&&a.push(this._signedTransactions.get(t))}}this._transactions.clear(),this._nodeAccountIds.locked=!1,this._nodeAccountIds.setList(n),this._nodeAccountIds.locked=!0,this._signedTransactions.setList(a)}setBatchKey(e){return this._requireNotFrozen(),this._batchKey=e,this}get batchKey(){return this._batchKey}get signableNodeBodyBytesList(){return this._requireFrozen(),this._signedTransactions.list.map(e=>{if(!e.bodyBytes)throw new Error("Missing bodyBytes in signed transaction.");const t=libExports.proto.TransactionBody.decode(e.bodyBytes);if(!t.nodeAccountID)throw new Error("Missing nodeAccountID in transaction body.");const n=AccountId._fromProtobuf(t.nodeAccountID);if(!t.transactionID)throw new Error("Missing transactionID in transaction body.");const r=TransactionId._fromProtobuf(t.transactionID);return new SignableNodeTransactionBodyBytes(n,r,e.bodyBytes)})}_buildSignedTransactions(){this._signedTransactions.locked||this._signedTransactions.setList(this._nodeAccountIds.list.map(e=>this._makeSignedTransaction(e)))}_buildIncompleteTransactions(){0==this._nodeAccountIds.length?this._transactions.setList([this._makeSignedTransaction(null)]):this._transactions.setList(this._nodeAccountIds.list.map(e=>this._makeSignedTransaction(e)))}freeze(){return this.freezeWith(null)}_freezeWithAccountId(e){null==this._operatorAccountId&&(this._operatorAccountId=e)}freezeWith(e){if(this._signOnDemand=null!=e&&e.signOnDemand,this._operator=null!=e?e._operator:null,this._freezeWithAccountId(null!=e?e.operatorAccountId:null),this._maxTransactionFee=null==this._maxTransactionFee?null!=e&&null!=e.defaultMaxTransactionFee?e.defaultMaxTransactionFee:this._defaultMaxTransactionFee:this._maxTransactionFee,this._regenerateTransactionId=null!=e&&null==this._regenerateTransactionId?e.defaultRegenerateTransactionId:this._regenerateTransactionId,this.batchKey?this._nodeAccountIds.setList([NODE_ACCOUNT_BATCH_ID]):this._setNodeAccountIds(e),this._setTransactionId(),null!=e)for(const t of this._transactionIds.list)null!=t.accountId&&t.accountId.validateChecksum(e);return this._buildNewTransactionIdList(),this._signOnDemand||this._buildSignedTransactions(),this}async signWithSigner(e){return await e.signTransaction(this),this}async freezeWithSigner(e){return await e.populateTransaction(this),this.freeze(),this}toBytes(){return this._requireNotSignOnDemand(),this._isFrozen()?(this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._buildAllTransactions()):this._buildIncompleteTransactions(),libExports.proto.TransactionList.encode({transactionList:this._transactions.list}).finish()}async toBytesAsync(){return this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),libExports.proto.TransactionList.encode({transactionList:this._transactions.list}).finish()}async getTransactionHash(){return this._requireFrozen(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),digest(this._transactions.get(0).signedTransactionBytes)}async getTransactionHashPerNode(){return this._requireFrozen(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),await TransactionHashMap._fromTransaction(this)}isFrozen(){return this._signedTransactions.length>0}_getTransactionId(){const e=this.transactionId;if(null==e)throw new Error("transaction must have been frozen before getting the transaction ID, try calling `freeze`");return e}_validateChecksums(e){}async _beforeExecute(e){this.transactionNodeIds=Object.values(e.network).map(e=>e.toString()),this._logger&&this._logger.info(`Network used: ${e._network.networkName}`),this._isFrozen()||this.freezeWith(e),this._applyMaxNodesPerTransactionLimit(e),e.isAutoValidateChecksumsEnabled()&&this._validateChecksums(e),null!=this._operator&&null!=this._operator||(this._operator=null!=e?e._operator:null),null!=this._operatorAccountId&&null!=this._operatorAccountId||(this._operatorAccountId=null!=e&&null!=e._operator?e._operator.accountId:null),null!=this._operator&&await this.signWith(this._operator.publicKey,this._operator.transactionSigner)}async _makeRequestAsync(){const e=this._transactionIds.index*this._nodeAccountIds.length+this._nodeAccountIds.index;return this._signOnDemand||this._isThrottled?await this._buildTransactionAsync():(this._buildTransaction(e),this._transactions.get(e))}async _signTransaction(){const e=this._makeSignedTransaction(this._nodeAccountIds.next),t=e.bodyBytes;for(let n=0;n<this._publicKeys.length;n++){const r=this._publicKeys[n],o=this._transactionSigners[n];if(null==o)continue;const a=await o(t);null==e.sigMap&&(e.sigMap={}),null==e.sigMap.sigPair&&(e.sigMap.sigPair=[]),e.sigMap.sigPair.push(r._toProtobufSignature(a))}return e}_buildNewTransactionIdList(){if(this._transactionIds.locked||null==this._operatorAccountId)return;const e=TransactionId.withValidStart(this._operatorAccountId,Timestamp.generate());this._transactionIds.set(this._transactionIds.index,e)}_buildAllTransactions(){for(let e=0;e<this._signedTransactions.length;e++)this._buildTransaction(e)}async _buildAllTransactionsAsync(){if(this._signOnDemand){if(this._buildSignedTransactions(),!this._transactions.locked)for(let e=0;e<this._signedTransactions.length;e++)this._transactions.push(await this._buildTransactionAsync())}else this._buildAllTransactions()}_buildTransaction(e){if(this._transactions.length<e)for(let t=this._transactions.length;t<e;t++)this._transactions.push(null);null!=this._transactions.list[e]&&this._transactions.set(e,{signedTransactionBytes:libExports.proto.SignedTransaction.encode(this._signedTransactions.get(e)).finish()}),this._transactions.setIfAbsent(e,()=>({signedTransactionBytes:libExports.proto.SignedTransaction.encode(this._signedTransactions.get(e)).finish()}))}async _buildTransactionAsync(){return{signedTransactionBytes:libExports.proto.SignedTransaction.encode(await this._signTransaction()).finish()}}_getStatusAndExecutionState(e,t){const{nodeTransactionPrecheckCode:n}=t,r=Status._fromCode(null!=n?n:libExports.proto.ResponseCodeEnum.OK);switch(this._logger&&(this._logger.debug(`[${this._getLogId()}] received status ${r.toString()}`),this._logger.info(`SDK Transaction Status Response: ${r.toString()}`)),r){case Status.Busy:case Status.Unknown:case Status.PlatformTransactionNotCreated:case Status.PlatformNotActive:case Status.InvalidNodeAccount:return[r,ExecutionState.Retry];case Status.Ok:return[r,ExecutionState.Finished];case Status.TransactionExpired:return this._transactionIds.locked||null!=this._regenerateTransactionId&&!this._regenerateTransactionId?[r,ExecutionState.Error]:(this._buildNewTransactionIdList(),[r,ExecutionState.Retry]);default:return[r,ExecutionState.Error]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=t,o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);return this._logger&&this._logger.info(`Transaction Error Info: ${o.toString()}, ${this.transactionId.toString()}`),new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}async _mapResponse(e,t,n){const r=await digest(n.signedTransactionBytes),o=this._getTransactionId();return this._transactionIds.advance(),this._logger&&this._logger.info(`Transaction Info: ${JSON.stringify(new TransactionResponse({nodeId:t,transactionHash:r,transactionId:o,logger:this._logger}).toJSON())}`),new TransactionResponse({nodeId:t,transactionHash:r,transactionId:o,transaction:this,logger:this._logger,transactionNodeAccountIds:this._nodeAccountIds.isEmpty?void 0:this._nodeAccountIds.list})}_makeSignedTransaction(e){const t=this._makeTransactionBody(e);this._logger&&this._logger.info(`Transaction Body: ${JSON.stringify(t)}`);return{sigMap:{sigPair:[]},bodyBytes:libExports.proto.TransactionBody.encode(t).finish()}}isBatchedAndNotBatchTransaction(){return null!=this.batchKey&&"atomicBatch"!=this._getTransactionDataCase()}_makeTransactionBody(e){return{[this._getTransactionDataCase()]:this._makeTransactionData(),transactionFee:null!=this._maxTransactionFee?this._maxTransactionFee.toTinybars():null,memo:this._transactionMemo,transactionID:null!=this._transactionIds.current?this._transactionIds.current._toProtobuf():null,nodeAccountID:null!=e?e._toProtobuf():null,transactionValidDuration:{seconds:Long.fromNumber(this._transactionValidDuration)},maxCustomFees:null!=this._customFeeLimits?this._customFeeLimits.map(e=>e._toProtobuf()):null,batchKey:this.batchKey?._toProtobufKey()}}_getTransactionDataCase(){throw new Error("not implemented")}_getScheduledTransactionBody(){return{memo:this.transactionMemo,transactionFee:null==this._maxTransactionFee?this._defaultMaxTransactionFee.toTinybars():this._maxTransactionFee.toTinybars(),maxCustomFees:null!=this._customFeeLimits?this._customFeeLimits.map(e=>e._toProtobuf()):null,[this._getTransactionDataCase()]:this._makeTransactionData()}}_makeTransactionData(){throw new Error("not implemented")}_isFrozen(){return this._signOnDemand||this._signedTransactions.length>0}_requireNotFrozen(){if(this._isFrozen())throw new Error("transaction is immutable; it has at least one signature or has been explicitly frozen")}_requireNotSignOnDemand(){if(this._signOnDemand)throw new Error("Please use `toBytesAsync()` if `signOnDemand` is enabled")}_requireFrozen(){if(!this._isFrozen())throw new Error("transaction must have been frozen before calculating the hash will be stable, try calling `freeze`")}_requireOneNodeAccountId(){if(1!=this._nodeAccountIds.length)throw"transaction did not have exactly one node ID set"}_requestToBytes(e){return libExports.proto.Transaction.encode(e).finish()}_responseToBytes(e){return libExports.proto.TransactionResponse.encode(e).finish()}_removeSignaturesFromTransaction(e,t){const n=[];return e.sigMap&&e.sigMap.sigPair?(e.sigMap.sigPair=e.sigMap.sigPair.filter(e=>{const r=this._shouldRemoveSignature(e,t),o=e.ed25519??e.ECDSASecp256k1;return r&&o&&n.push(o),!r}),n):[]}_shouldRemoveSignature=(e,t)=>encode$4(e?.pubKeyPrefix||new Uint8Array)===t;_collectSignaturesByPublicKey(){const e=new Map,t={};for(const n of this._signedTransactions.list){if(!n.sigMap||!n.sigMap.sigPair)return new Map;for(const r of n.sigMap.sigPair){const n=r.ed25519??r.ECDSASecp256k1;if(!n||!r.pubKeyPrefix)return new Map;const o=encode$4(r.pubKeyPrefix);let a=t[o];a||(a=PublicKey.fromString(o),t[o]=a),e.has(a)||e.set(a,[]);const i=e.get(a);i&&i.push(n)}}return e}}const SCHEDULE_CREATE_TRANSACTION=[],NftHookType=Object.freeze({PRE_HOOK_SENDER:0,PRE_POST_HOOK_SENDER:1,PRE_HOOK_RECEIVER:2,PRE_POST_HOOK_RECEIVER:3});class NftHookCall extends HookCall{constructor(e){if(super(e),null==e.type)throw new Error("type cannot be null");this._type=e.type}get type(){return this._type}static _fromProtobufWithType(e,t){return new NftHookCall({hookId:null!=e.hookId?e.hookId:void 0,evmHookCall:e.evmHookCall?EvmHookCall._fromProtobuf(e.evmHookCall):void 0,type:t})}}class TokenNftTransfer{constructor(e){this.tokenId=e.tokenId instanceof TokenId?e.tokenId:TokenId.fromString(e.tokenId),this.senderAccountId=e.senderAccountId instanceof AccountId?e.senderAccountId:AccountId.fromString(e.senderAccountId),this.receiverAccountId=e.receiverAccountId instanceof AccountId?e.receiverAccountId:AccountId.fromString(e.receiverAccountId),this.serialNumber=Long.fromValue(e.serialNumber),this.senderHookCall=e.senderHookCall,this.receiverHookCall=e.receiverHookCall,this.isApproved=e.isApproved}static _fromProtobuf(e){const t=[];for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.nftTransfers?n.nftTransfers:[]){let n,o;null!=r.preTxSenderAllowanceHook?n=NftHookCall._fromProtobufWithType(r.preTxSenderAllowanceHook,NftHookType.PRE_HOOK_SENDER):null!=r.prePostTxSenderAllowanceHook&&(n=NftHookCall._fromProtobufWithType(r.prePostTxSenderAllowanceHook,NftHookType.PRE_POST_HOOK_SENDER)),null!=r.preTxReceiverAllowanceHook?o=NftHookCall._fromProtobufWithType(r.preTxReceiverAllowanceHook,NftHookType.PRE_HOOK_RECEIVER):null!=r.prePostTxReceiverAllowanceHook&&(o=NftHookCall._fromProtobufWithType(r.prePostTxReceiverAllowanceHook,NftHookType.PRE_POST_HOOK_RECEIVER)),t.push(new TokenNftTransfer({tokenId:e,senderAccountId:AccountId._fromProtobuf(r.senderAccountID),receiverAccountId:AccountId._fromProtobuf(r.receiverAccountID),serialNumber:null!=r.serialNumber?r.serialNumber:Long.ZERO,isApproved:1==r.isApproval,senderHookCall:n,receiverHookCall:o}))}}return t}_toProtobuf(){const e={senderAccountID:this.senderAccountId._toProtobuf(),receiverAccountID:this.receiverAccountId._toProtobuf(),serialNumber:this.serialNumber,isApproval:this.isApproved};if(null!=this.senderHookCall)switch(this.senderHookCall.type){case NftHookType.PRE_HOOK_SENDER:e.preTxSenderAllowanceHook=this.senderHookCall._toProtobuf();break;case NftHookType.PRE_POST_HOOK_SENDER:e.prePostTxSenderAllowanceHook=this.senderHookCall._toProtobuf()}if(null!=this.receiverHookCall)switch(this.receiverHookCall.type){case NftHookType.PRE_HOOK_RECEIVER:e.preTxReceiverAllowanceHook=this.receiverHookCall._toProtobuf();break;case NftHookType.PRE_POST_HOOK_RECEIVER:e.prePostTxReceiverAllowanceHook=this.receiverHookCall._toProtobuf()}return e}}class NullableTokenDecimalMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class AbstractTokenTransferTransaction extends Transaction{constructor(e={}){super(),this._tokenTransfers=[],this._nftTransfers=[];for(const t of null!=e.tokenTransfers?e.tokenTransfers:[])this.addTokenTransfer(t.tokenId,t.accountId,t.amount);for(const t of null!=e.nftTransfers?e.nftTransfers:[])this.addNftTransfer(t.tokenId,t.serial,t.sender,t.recipient)}addNftTransfer(e,t,n,r){return this._addNftTransfer(!1,e,t,n,r)}_addTokenTransfer(e,t,n,r,o,a){this._requireNotFrozen();const i=e instanceof TokenId?e:TokenId.fromString(e),s=t instanceof AccountId?t:AccountId.fromString(t),c=convertAmountToLong(n);for(const e of this._tokenTransfers)if(0===e.tokenId.compare(i)&&0===e.accountId.compare(s))return e.amount=e.amount.add(c),e.expectedDecimals=o,this;return this._tokenTransfers.push(new TokenTransfer({tokenId:e,accountId:t,expectedDecimals:o,amount:n,isApproved:r,hookCall:a})),this}addTokenTransfer(e,t,n){return this._addTokenTransfer(e,t,n,!1,null)}_addNftTransfer(e,t,n,r,o,a,i){let s,c,u;if(this._requireNotFrozen(),t instanceof NftId)s=t,c="string"==typeof n?AccountId.fromString(n):n,u="string"==typeof r?AccountId.fromString(r):r;else if(t instanceof TokenId)s=new NftId(t,n),c="string"==typeof r?AccountId.fromString(r):r,u="string"==typeof o?AccountId.fromString(o):o;else try{s=NftId.fromString(t),c="string"==typeof n?AccountId.fromString(n):n,u="string"==typeof r?AccountId.fromString(r):r}catch(e){const a=TokenId.fromString(t);s=new NftId(a,n),c="string"==typeof r?AccountId.fromString(r):r,u="string"==typeof o?AccountId.fromString(o):o}for(const e of this._nftTransfers)if(0===e.tokenId.compare(s.tokenId)&&0===e.serialNumber.compare(s.serial))return e.senderAccountId=c,e.receiverAccountId=u,this;return this._nftTransfers.push(new TokenNftTransfer({tokenId:s.tokenId,serialNumber:s.serial,senderAccountId:c,receiverAccountId:u,isApproved:e,senderHookCall:a,receiverHookCall:i})),this}addApprovedNftTransfer(e,t,n,r){return this._addNftTransfer(!0,e,t,n,r)}addApprovedTokenTransfer(e,t,n){return this._addTokenTransfer(e,t,n,!0,null)}addTokenTransferWithDecimals(e,t,n,r){this._requireNotFrozen();const o=e instanceof TokenId?e:TokenId.fromString(e),a=t instanceof AccountId?t:AccountId.fromString(t),i=convertAmountToLong(n);let s=!1;for(const e of this._tokenTransfers)if(0===e.tokenId.compare(o)){if(null!=e.expectedDecimals&&e.expectedDecimals!==r)throw new Error("expected decimals mis-match");e.expectedDecimals=r,0===e.accountId.compare(a)&&(e.amount=e.amount.add(i),e.expectedDecimals=r,s=!0)}return s||this._tokenTransfers.push(new TokenTransfer({tokenId:e,accountId:t,expectedDecimals:r,amount:n,isApproved:!1})),this}get tokenIdDecimals(){const e=new NullableTokenDecimalMap;for(const t of this._tokenTransfers)e._set(t.tokenId,t.expectedDecimals);return e}get nftTransfers(){const e=new TokenNftTransferMap;for(const t of this._nftTransfers){const n=e.get(t.tokenId),r={sender:t.senderAccountId,recipient:t.receiverAccountId,serial:t.serialNumber,isApproved:t.isApproved};null!=n?n.push(r):e._set(t.tokenId,[r])}return e}get tokenTransfers(){const e=new TokenTransferMap;for(const t of this._tokenTransfers){let n=e.get(t.tokenId);null!=n?n._set(t.accountId,t.amount):(n=new TokenTransferAccountMap,n._set(t.accountId,t.amount),e._set(t.tokenId,n))}return e}_makeTransactionData(){const e=[];this._tokenTransfers.sort((e,t)=>{const n=e.tokenId.compare(t.tokenId);return 0!==n?n:e.accountId.compare(t.accountId)}),this._nftTransfers.sort((e,t)=>{const n=e.senderAccountId.compare(t.senderAccountId);if(0!=n)return n;const r=e.receiverAccountId.compare(t.receiverAccountId);return 0!=r?r:e.serialNumber.compare(t.serialNumber)});let t=0,n=0;for(;t<this._tokenTransfers.length||n<this._nftTransfers.length;)if(t<this._tokenTransfers.length&&n<this._nftTransfers.length){const r=this._tokenTransfers[t].tokenId,o=this._nftTransfers[n].tokenId,a=e.length>0?e[e.length-1]:null,i=null!=a?a.tokenId:null;if(null!=a&&null!=i&&0===i.compare(r)){a.transfers.push(this._tokenTransfers[t++]);continue}if(null!=a&&null!=i&&0===i.compare(o)){a.nftTransfers.push(this._nftTransfers[n++]);continue}const s=r.compare(o);0===s?e.push({tokenId:r,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[this._nftTransfers[n++]]}):s<0?e.push({tokenId:r,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[]}):e.push({tokenId:o,expectedDecimals:null,transfers:[],nftTransfers:[this._nftTransfers[n++]]})}else if(t<this._tokenTransfers.length){const n=this._tokenTransfers[t].tokenId;let r;for(const t of e)0===t.tokenId.compare(n)&&(r=t);const o=null!=r?r.tokenId:null;if(null!=r&&null!=o&&0===o.compare(n)){r.transfers.push(this._tokenTransfers[t++]);continue}e.push({tokenId:n,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[]})}else if(n<this._nftTransfers.length){const t=this._nftTransfers[n].tokenId;let r;for(const n of e)0===n.tokenId.compare(t)&&(r=n);const o=null!=r?r.tokenId:null;if(null!=r&&null!=o&&0===o.compare(t)){r.nftTransfers.push(this._nftTransfers[n++]);continue}e.push({tokenId:t,expectedDecimals:null,transfers:[],nftTransfers:[this._nftTransfers[n++]]})}return{tokenTransfers:e.map(e=>({token:e.tokenId._toProtobuf(),expectedDecimals:null!=e.expectedDecimals?{value:e.expectedDecimals}:null,transfers:e.transfers.map(e=>e._toProtobuf()),nftTransfers:e.nftTransfers.map(e=>e._toProtobuf())}))}}}class TokenAirdropTransaction extends AbstractTokenTransferTransaction{constructor(e={}){if(super(),null!=e.tokenTransfers)for(const t of e.tokenTransfers)this._addTokenTransfer(t.tokenId,t.accountId,t.amount,t.isApproved,t.expectedDecimals);if(this._nftTransfers=[],null!=e.nftTransfers)for(const t of e.nftTransfers)this._addNftTransfer(t.isApproved,t.tokenId,t.serialNumber,t.senderAccountId,t.receiverAccountId)}addApprovedTokenTransferWithDecimals(e,t,n,r){return this._requireNotFrozen(),this._addTokenTransfer(e,t,n,!0,r,void 0),this}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenAirdrop,i=TokenTransfer._fromProtobuf(a.tokenTransfers??[]),s=TokenNftTransfer._fromProtobuf(a.tokenTransfers??[]);return Transaction._fromProtobufTransactions(new TokenAirdropTransaction({nftTransfers:s,tokenTransfers:i}),e,t,n,r,o)}_execute(e,t){return e.token.airdropTokens(t)}_getTransactionDataCase(){return"tokenAirdrop"}_getLogId(){return`TokenAirdropTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenAirdrop",TokenAirdropTransaction._fromProtobuf);class AirdropPendingTransaction extends Transaction{constructor(e){super(),this._pendingAirdropIds=[],null!=e?.pendingAirdropIds&&(this._pendingAirdropIds=e.pendingAirdropIds)}get pendingAirdropIds(){return this._pendingAirdropIds}addPendingAirdropId(e){return this._requireNotFrozen(),this._pendingAirdropIds.push(e),this}setPendingAirdropIds(e){return this._requireNotFrozen(),this._pendingAirdropIds=e,this}}class TokenClaimAirdropTransaction extends AirdropPendingTransaction{constructor(e={}){super(e)}_execute(e,t){return e.token.claimAirdrop(t)}_makeTransactionData(){return{pendingAirdrops:this.pendingAirdropIds.map(e=>e.toBytes())}}static _fromProtobuf(e,t,n,r,o){const a=o[0],{pendingAirdrops:i}=a.tokenClaimAirdrop;return Transaction._fromProtobufTransactions(new TokenClaimAirdropTransaction({pendingAirdropIds:i?.map(e=>PendingAirdropId.fromBytes(e))}),e,t,n,r,o)}_getTransactionDataCase(){return"tokenClaimAirdrop"}_getLogId(){return`TokenClaimAirdropTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenClaimAirdrop",TokenClaimAirdropTransaction._fromProtobuf);class TokenCancelAirdropTransaction extends AirdropPendingTransaction{constructor(e={}){super(e)}_makeTransactionData(){return{pendingAirdrops:this.pendingAirdropIds.map(e=>e.toBytes())}}_execute(e,t){return e.token.cancelAirdrop(t)}_getTransactionDataCase(){return"tokenCancelAirdrop"}static _fromProtobuf(e,t,n,r,o){const a=o[0],{pendingAirdrops:i}=a.tokenCancelAirdrop;return Transaction._fromProtobufTransactions(new TokenCancelAirdropTransaction({pendingAirdropIds:i?.map(e=>PendingAirdropId.fromBytes(e))}),e,t,n,r,o)}_getLogId(){return`TokenCancelAirdrop:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenCancelAirdrop",TokenCancelAirdropTransaction._fromProtobuf);class HbarAllowance{constructor(e){this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.amount=e.amount,Object.freeze(this)}static _fromProtobuf(e){return new HbarAllowance({spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}static _fromGrantedProtobuf(e,t){return new HbarAllowance({spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}_toProtobuf(){return{owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,amount:null!=this.amount?this.amount.toTinybars():null}}_validateChecksums(e){null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}toJSON(){return{ownerAccountId:null!=this.ownerAccountId?this.ownerAccountId.toString():null,spenderAccountId:null!=this.spenderAccountId?this.spenderAccountId.toString():null,amount:null!=this.amount?this.amount.toString():null}}}class TokenAllowance{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.amount=null!=e.amount?convertAmountToLong(e.amount):null,Object.freeze(this)}static _fromProtobuf(e){return new TokenAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,amount:null!=e.amount?Long.fromValue(e.amount):null})}static _fromGrantedProtobuf(e,t){return new TokenAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,amount:null!=e.amount?Long.fromValue(e.amount):null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,amount:this.amount}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}class TokenNftAllowance{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.serialNumbers=e.serialNumbers,this.allSerials=e.allSerials,this.delegatingSpender=e.delegatingSpender,Object.freeze(this)}static _fromProtobuf(e){const t=null!=e.approvedForAll&&1==e.approvedForAll.value;return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:null!=e.spender?AccountId._fromProtobuf(e.spender):null,ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,serialNumbers:t?null:null!=e.serialNumbers?e.serialNumbers.map(e=>Long.fromValue(e)):[],allSerials:t,delegatingSpender:null!=e.delegatingSpender?AccountId._fromProtobuf(e.delegatingSpender):null})}static _fromGrantedProtobuf(e,t){return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,serialNumbers:[],allSerials:null,delegatingSpender:null})}static _fromRemoveProtobuf(e){return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:null,ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,serialNumbers:null!=e.serialNumbers?e.serialNumbers.map(e=>Long.fromValue(e)):[],allSerials:null,delegatingSpender:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,approvedForAll:null==this.serialNumbers?{value:this.allSerials}:null,serialNumbers:this.serialNumbers,delegatingSpender:null!=this.delegatingSpender?this.delegatingSpender._toProtobuf():null}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}class AccountAllowanceAdjustTransaction extends Transaction{constructor(e={}){super(),this._hbarAllowances=null!=e.hbarAllowances?e.hbarAllowances:[],this._tokenAllowances=null!=e.tokenAllowances?e.tokenAllowances:[],this._nftAllowances=null!=e.nftAllowances?e.nftAllowances:[]}get hbarAllowances(){return this._hbarAllowances}addHbarAllowance(e,t){const n=t instanceof Hbar?t:new Hbar(t);return this._adjustHbarAllowance(null,e,requireNotNegative(n))}_adjustHbarAllowance(e,t,n){return this._requireNotFrozen(),this._hbarAllowances.push(new HbarAllowance({spenderAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,ownerAccountId:"string"==typeof e?AccountId.fromString(e):e instanceof ContractId?AccountId.fromEvmAddress(e.shard,e.realm,e.toEvmAddress()):e,amount:n})),this}grantHbarAllowance(e,t,n){const r=n instanceof Hbar?n:new Hbar(n);return this._adjustHbarAllowance(e,t,requireNotNegative(r))}revokeHbarAllowance(e,t,n){const r=n instanceof Hbar?n:new Hbar(n);return this._adjustHbarAllowance(e,t,requireNotNegative(r).negated())}get tokenAllowances(){return this._tokenAllowances}addTokenAllowance(e,t,n){return this._adjustTokenAllowance(e,null,t,requireNotNegative(Long.fromValue(n)))}_adjustTokenAllowance(e,t,n,r){return this._requireNotFrozen(),this._tokenAllowances.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,amount:"number"==typeof r?Long.fromNumber(r):r})),this}grantTokenAllowance(e,t,n,r){return this._adjustTokenAllowance(e,t,n,requireNotNegative(Long.fromValue(r)))}revokeTokenAllowance(e,t,n,r){return this._adjustTokenAllowance(e,t,n,requireNotNegative(Long.fromValue(r)))}addTokenNftAllowance(e,t){const n="string"==typeof e?NftId.fromString(e):e;return this._adjustTokenNftAllowance(n,null,t)}_adjustTokenNftAllowance(e,t,n){this._requireNotFrozen();const r="string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,o="string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t;let a=!1;for(const t of this._nftAllowances)if(0===t.tokenId.compare(e.tokenId)&&null!=t.spenderAccountId&&0===t.spenderAccountId.compare(r)){null!=t.serialNumbers&&t.serialNumbers.push(e.serial),a=!0;break}return a||this._nftAllowances.push(new TokenNftAllowance({tokenId:e.tokenId,spenderAccountId:r,serialNumbers:[e.serial],ownerAccountId:o,allSerials:!1,delegatingSpender:null})),this}grantTokenNftAllowance(e,t,n){const r="string"==typeof e?NftId.fromString(e):e;return requireNotNegative(r.serial),this._adjustTokenNftAllowance(r,t,n)}revokeTokenNftAllowance(e,t,n){const r="string"==typeof e?NftId.fromString(e):e;return requireNotNegative(r.serial),this._adjustTokenNftAllowance(new NftId(r.tokenId,r.serial.negate()),t,n)}addAllTokenNftAllowance(e,t){return this._adjustTokenNftAllowanceAllSerials(e,null,t,!0)}grantTokenNftAllowanceAllSerials(e,t,n){return this._adjustTokenNftAllowanceAllSerials(e,t,n,!0)}revokeTokenNftAllowanceAllSerials(e,t,n){return this._adjustTokenNftAllowanceAllSerials(e,t,n,!1)}_adjustTokenNftAllowanceAllSerials(e,t,n,r){return this._requireNotFrozen(),this._nftAllowances.push(new TokenNftAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,ownerAccountId:null!=t?"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t:null,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,serialNumbers:null,allSerials:r,delegatingSpender:null})),this}_validateChecksums(e){this._hbarAllowances.map(t=>t._validateChecksums(e)),this._tokenAllowances.map(t=>t._validateChecksums(e)),this._nftAllowances.map(t=>t._validateChecksums(e))}_execute(e,t){return Promise.reject(new Error("This feature has been deprecated for this class."))}_getTransactionDataCase(){throw new Error("This feature has been deprecated for this class.")}_makeTransactionData(){throw new Error("This feature has been deprecated.")}_getLogId(){return`AccountAllowanceAdjustTransaction:${this._transactionIds.current.validStart.toString()}`}}class AccountAllowanceApproveTransaction extends Transaction{constructor(e={}){super(),this._hbarApprovals=null!=e.hbarApprovals?e.hbarApprovals:[],this._tokenApprovals=null!=e.tokenApprovals?e.tokenApprovals:[],this._nftApprovals=null!=e.nftApprovals?e.nftApprovals:[]}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoApproveAllowance;return Transaction._fromProtobufTransactions(new AccountAllowanceApproveTransaction({hbarApprovals:(null!=a.cryptoAllowances?a.cryptoAllowances:[]).map(e=>HbarAllowance._fromProtobuf(e)),tokenApprovals:(null!=a.tokenAllowances?a.tokenAllowances:[]).map(e=>TokenAllowance._fromProtobuf(e)),nftApprovals:(null!=a.nftAllowances?a.nftAllowances:[]).map(e=>TokenNftAllowance._fromProtobuf(e))}),e,t,n,r,o)}get hbarApprovals(){return this._hbarApprovals}approveHbarAllowance(e,t,n){return this._requireNotFrozen(),this._hbarApprovals.push(new HbarAllowance({spenderAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,ownerAccountId:"string"==typeof e?AccountId.fromString(e):e instanceof ContractId?AccountId.fromEvmAddress(e.shard,e.realm,e.toEvmAddress()):e,amount:n instanceof Hbar?n:new Hbar(n)})),this}addHbarAllowance(e,t){return this._requireNotFrozen(),this._hbarApprovals.push(new HbarAllowance({spenderAccountId:"string"==typeof e?AccountId.fromString(e):e,amount:t instanceof Hbar?t:new Hbar(t),ownerAccountId:null})),this}get tokenApprovals(){return this._tokenApprovals}approveTokenAllowance(e,t,n,r){this._requireNotFrozen();const o=convertAmountToLong(r);return this._tokenApprovals.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,amount:o})),this}addTokenAllowance(e,t,n){this._requireNotFrozen();const r=convertAmountToLong(n);return this._tokenApprovals.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof t?AccountId.fromString(t):t,amount:r,ownerAccountId:null})),this}addTokenNftAllowance(e,t){return this._approveTokenNftAllowance(e,null,t,null)}get tokenNftApprovals(){return this._nftApprovals}_approveTokenNftAllowance(e,t,n,r){this._requireNotFrozen();const o="string"==typeof e?NftId.fromString(e):e,a="string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n;let i=!1;for(const e of this._nftApprovals)if(0===e.tokenId.compare(o.tokenId)&&null!=e.spenderAccountId&&0===e.spenderAccountId.compare(a)){null!=e.serialNumbers&&e.serialNumbers.push(o.serial),i=!0;break}return i||this._nftApprovals.push(new TokenNftAllowance({tokenId:o.tokenId,spenderAccountId:a,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,serialNumbers:[o.serial],allSerials:!1,delegatingSpender:"string"==typeof r?AccountId.fromString(r):r})),this}approveTokenNftAllowance(e,t,n){return this._approveTokenNftAllowance(e,t,n,null)}approveTokenNftAllowanceWithDelegatingSpender(e,t,n,r){return this._approveTokenNftAllowance(e,t,n,r)}_approveAllTokenNftAllowance(e,t,n,r){return this._requireNotFrozen(),this._nftApprovals.push(new TokenNftAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,serialNumbers:null,allSerials:r,delegatingSpender:null})),this}addAllTokenNftAllowance(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!0)}approveTokenNftAllowanceAllSerials(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!0)}deleteTokenNftAllowanceAllSerials(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!1)}_validateChecksums(e){this._hbarApprovals.map(t=>t._validateChecksums(e)),this._tokenApprovals.map(t=>t._validateChecksums(e)),this._nftApprovals.map(t=>t._validateChecksums(e))}_execute(e,t){return e.crypto.approveAllowances(t)}_getTransactionDataCase(){return"cryptoApproveAllowance"}_makeTransactionData(){return{cryptoAllowances:this._hbarApprovals.map(e=>e._toProtobuf()),tokenAllowances:this._tokenApprovals.map(e=>e._toProtobuf()),nftAllowances:this._nftApprovals.map(e=>e._toProtobuf())}}_getLogId(){return`AccountAllowanceApproveTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoApproveAllowance",AccountAllowanceApproveTransaction._fromProtobuf);class AccountAllowanceDeleteTransaction extends Transaction{constructor(e={}){super(),this._nftAllowances=null!=e.nftAllowances?e.nftAllowances:[]}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoDeleteAllowance;return Transaction._fromProtobufTransactions(new AccountAllowanceDeleteTransaction({nftAllowances:(null!=a.nftAllowances?a.nftAllowances:[]).map(e=>TokenNftAllowance._fromProtobuf(e))}),e,t,n,r,o)}get tokenNftAllowanceDeletions(){return this._nftAllowances}deleteAllTokenNftAllowances(e,t){this._requireNotFrozen();const n="string"==typeof e?NftId.fromString(e):e,r="string"==typeof t?AccountId.fromString(t):t;let o=!1;for(const e of this._nftAllowances)if(0===e.tokenId.compare(n.tokenId)){null!=e.serialNumbers&&e.serialNumbers.push(n.serial),o=!0;break}return o||this._nftAllowances.push(new TokenNftAllowance({tokenId:n.tokenId,spenderAccountId:null,serialNumbers:[n.serial],ownerAccountId:r,allSerials:!1,delegatingSpender:null})),this}_validateChecksums(e){this._nftAllowances.map(t=>t._validateChecksums(e))}_execute(e,t){return e.crypto.deleteAllowances(t)}_getTransactionDataCase(){return"cryptoDeleteAllowance"}_makeTransactionData(){return{nftAllowances:this._nftAllowances.map(e=>e._toProtobuf())}}_getLogId(){return`AccountAllowanceDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDeleteAllowance",AccountAllowanceDeleteTransaction._fromProtobuf);class TokenBalanceMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class TokenDecimalMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class AccountBalance{constructor(e){this.hbars=e.hbars,this.tokens=e.tokens||new TokenBalanceMap,this.tokenDecimals=e.tokenDecimals||new TokenDecimalMap,Object.freeze(this)}static fromBytes(e){return AccountBalance._fromProtobuf(libExports.proto.CryptoGetAccountBalanceResponse.decode(e))}static _fromProtobuf(e){const t=new TokenBalanceMap,n=new TokenDecimalMap;if(null!=e.tokenBalances)for(const r of e.tokenBalances){const e=TokenId._fromProtobuf(r.tokenId);n._set(e,null!=r.decimals?r.decimals:0),t._set(e,Long.fromValue(r.balance))}return new AccountBalance({hbars:Hbar.fromTinybars(e.balance),tokens:t,tokenDecimals:n})}_toProtobuf(){const e=[];for(const[t,n]of this.tokens)e.push({tokenId:t._toProtobuf(),balance:n,decimals:this.tokenDecimals.get(t)});return{balance:this.hbars.toTinybars(),tokenBalances:e}}toBytes(){return libExports.proto.CryptoGetAccountBalanceResponse.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){const e=[];for(const[t,n]of this.tokens){const r=this.tokenDecimals.get(t);e.push({tokenId:t.toString(),balance:n.toString(),decimals:null!=r?r:0})}return{hbars:this.hbars.toString(),tokens:e}}}class AccountBalanceQuery extends Query{constructor(e={}){super(),this._accountId=null,this._contractId=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.cryptogetAccountBalance;return new AccountBalanceQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_isPaymentRequired(){return!1}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.crypto.cryptoGetBalance(t)}_mapResponseHeader(e){return e.cryptogetAccountBalance.header}_mapResponse(e){const t=e.cryptogetAccountBalance;return Promise.resolve(AccountBalance._fromProtobuf(t))}_onMakeRequest(e){return{cryptogetAccountBalance:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`AccountBalanceQuery:${this._timestamp.toString()}`}}QUERY_REGISTRY.set("cryptogetAccountBalance",AccountBalanceQuery._fromProtobuf.bind(null));class Duration{constructor(e){this.seconds=e instanceof Long?e:Long.fromNumber(e),Object.freeze(this)}_toProtobuf(){return{seconds:this.seconds}}static _fromProtobuf(e){return new Duration(e.seconds)}}class AccountCreateTransaction extends Transaction{constructor(e={}){super(),this._key=null,this._initialBalance=null,this._sendRecordThreshold=DEFAULT_RECORD_THRESHOLD,this._receiveRecordThreshold=DEFAULT_RECORD_THRESHOLD,this._receiverSignatureRequired=!1,this._proxyAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._accountMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=!1,this._alias=null,this._hooks=[],null!=e.hooks&&e.hooks.forEach(e=>{this.addHook(e)}),null!=e.key&&this.setKeyWithoutAlias(e.key),null!=e.receiverSignatureRequired&&this.setReceiverSignatureRequired(e.receiverSignatureRequired),null!=e.initialBalance&&this.setInitialBalance(e.initialBalance),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.accountMemo&&this.setAccountMemo(e.accountMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.alias&&this.setAlias(e.alias)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoCreateAccount;let i;return null!=a.alias&&a.alias.length>0&&20===a.alias.length&&(i=EvmAddress.fromBytes(a.alias)),Transaction._fromProtobufTransactions(new AccountCreateTransaction({key:null!=a.key?Key._fromProtobufKey(a.key):void 0,initialBalance:null!=a.initialBalance?Hbar.fromTinybars(a.initialBalance):void 0,receiverSignatureRequired:null!=a.receiverSigRequired?a.receiverSigRequired:void 0,proxyAccountId:null!=a.proxyAccountID?AccountId._fromProtobuf(a.proxyAccountID):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,accountMemo:null!=a.memo?a.memo:void 0,maxAutomaticTokenAssociations:null!=a.maxAutomaticTokenAssociations?a.maxAutomaticTokenAssociations:void 0,stakedAccountId:null!=a.stakedAccountId?AccountId._fromProtobuf(a.stakedAccountId):void 0,stakedNodeId:null!=a.stakedNodeId?a.stakedNodeId:void 0,declineStakingReward:1==a.declineReward,alias:i}),e,t,n,r,o)}get key(){return this._key}setKey(e){return this._requireNotFrozen(),this._key=e,this}setECDSAKeyWithAlias(e){this.setKeyWithoutAlias(e);const t=this._deriveECDSAKeyAlias(e);return this.setAlias(t),this}setKeyWithAlias(e,t){this.setKeyWithoutAlias(e);const n=this._deriveECDSAKeyAlias(t);return this.setAlias(n),this}setKeyWithoutAlias(e){return this._requireNotFrozen(),this._key=e,this}get initialBalance(){return this._initialBalance}setInitialBalance(e){return this._requireNotFrozen(),this._initialBalance=e instanceof Hbar?e:new Hbar(e),this}get receiverSignatureRequired(){return this._receiverSignatureRequired}setReceiverSignatureRequired(e){return this._requireNotFrozen(),this._receiverSignatureRequired=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get accountMemo(){return this._accountMemo}setAccountMemo(e){return this._requireNotFrozen(),this._accountMemo=e,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations="number"==typeof e?Long.fromNumber(e):e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get alias(){return this._alias}setAlias(e){if("string"==typeof e){if(!(e.startsWith("0x")&&42==e.length||40==e.length))throw new Error('evmAddress must be a valid EVM address with or without "0x" prefix');this._alias=EvmAddress.fromString(e)}else this._alias=e;return this}_validateChecksums(e){null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_deriveECDSAKeyAlias(e){const t=e instanceof PrivateKey&&"secp256k1"===e.type,n=e instanceof PublicKey&&"secp256k1"===e.type;if(t)return e.publicKey.toEvmAddress();if(n)return e.toEvmAddress();throw new Error("Invalid key for alias derivation provided: expected an ECDSA (secp256k1) PrivateKey or PublicKey.")}_execute(e,t){return e.crypto.createAccount(t)}_getTransactionDataCase(){return"cryptoCreateAccount"}_makeTransactionData(){let e=null;return null!=this._alias&&(e=this._alias.toBytes()),{key:null!=this._key?this._key._toProtobufKey():null,initialBalance:null!=this._initialBalance?this._initialBalance.toTinybars():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,receiveRecordThreshold:this._receiveRecordThreshold.toTinybars(),sendRecordThreshold:this._sendRecordThreshold.toTinybars(),receiverSigRequired:this._receiverSignatureRequired,memo:this._accountMemo,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?this._maxAutomaticTokenAssociations.toInt():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:this.declineStakingRewards,hookCreationDetails:this._hooks.map(e=>e._toProtobuf()),alias:e}}addHook(e){return this._hooks.push(e),this}setHooks(e){return this._hooks=e,this}get hooks(){return this._hooks}_getLogId(){return`AccountCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoCreateAccount",AccountCreateTransaction._fromProtobuf);class AccountDeleteTransaction extends Transaction{constructor(e={}){super(),this._accountId=null,this._transferAccountId=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.transferAccountId&&this.setTransferAccountId(e.transferAccountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoDelete;return Transaction._fromProtobufTransactions(new AccountDeleteTransaction({accountId:null!=a.deleteAccountID?AccountId._fromProtobuf(a.deleteAccountID):void 0,transferAccountId:null!=a.transferAccountID?AccountId._fromProtobuf(a.transferAccountID):void 0}),e,t,n,r,o)}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(e){return this._requireNotFrozen(),this._transferAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(e)}_execute(e,t){return e.crypto.cryptoDelete(t)}_getTransactionDataCase(){return"cryptoDelete"}_makeTransactionData(){return{deleteAccountID:null!=this._accountId?this._accountId._toProtobuf():null,transferAccountID:null!=this._transferAccountId?this._transferAccountId._toProtobuf():null}}_getLogId(){return`AccountDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDelete",AccountDeleteTransaction._fromProtobuf);class StakingInfo{constructor(e){this.declineStakingReward=e.declineStakingReward,this.stakePeriodStart=e.stakePeriodStart,this.pendingReward=e.pendingReward,this.stakedToMe=e.stakedToMe,this.stakedAccountId=e.stakedAccountId,this.stakedNodeId=e.stakedNodeId,Object.freeze(this)}static _fromProtobuf(e){return new StakingInfo({declineStakingReward:1==e.declineReward,stakePeriodStart:null!=e.stakePeriodStart?Timestamp._fromProtobuf(e.stakePeriodStart):null,pendingReward:null!=e.pendingReward?Hbar.fromTinybars(e.pendingReward):null,stakedToMe:null!=e.stakedToMe?Hbar.fromTinybars(e.stakedToMe):null,stakedAccountId:null!=e.stakedAccountId?AccountId._fromProtobuf(e.stakedAccountId):null,stakedNodeId:null!=e.stakedNodeId?e.stakedNodeId:null})}_toProtobuf(){return{declineReward:this.declineStakingReward,stakePeriodStart:null!=this.stakePeriodStart?this.stakePeriodStart._toProtobuf():null,pendingReward:null!=this.pendingReward?this.pendingReward.toTinybars():null,stakedToMe:null!=this.stakedToMe?this.stakedToMe.toTinybars():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId}}static fromBytes(e){return StakingInfo._fromProtobuf(libExports.proto.StakingInfo.decode(e))}toBytes(){return libExports.proto.StakingInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{declineStakingReward:this.declineStakingReward,stakePeriodStart:null!=this.stakePeriodStart?this.stakePeriodStart.toString():null,pendingReward:null!=this.pendingReward?this.pendingReward.toString():null,stakedToMe:null!=this.stakedToMe?this.stakedToMe.toString():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId.toString():null,stakedNodeId:null!=this.stakedNodeId?this.stakedNodeId.toString():null}}}class LiveHash{constructor(e){this.accountId=e.accountId,this.hash=e.hash,this.keys=e.keys,this.duration=e.duration,Object.freeze(this)}static _fromProtobuf(e){const t=e;return new LiveHash({accountId:AccountId._fromProtobuf(t.accountId),hash:null!=t.hash?t.hash:new Uint8Array,keys:null!=t.keys?KeyList.__fromProtobufKeyList(t.keys):new KeyList,duration:Duration._fromProtobuf(t.duration)})}_toProtobuf(){return{accountId:this.accountId._toProtobuf(),hash:this.hash,keys:this.keys._toProtobufKey().keyList,duration:this.duration._toProtobuf()}}}class TokenRelationship{constructor(e){this.tokenId=e.tokenId,this.symbol=e.symbol,this.balance=e.balance,this.isKycGranted=e.isKycGranted,this.isFrozen=e.isFrozen,this.automaticAssociation=e.automaticAssociation,Object.freeze(this)}static _fromProtobuf(e){const t=TokenId._fromProtobuf(e.tokenId),n=null==e.kycStatus||0===e.kycStatus?null:1===e.kycStatus,r=null==e.freezeStatus||0===e.freezeStatus?null:1===e.freezeStatus;return new TokenRelationship({tokenId:t,symbol:e.symbol,balance:null!=e.balance?e.balance instanceof Long?e.balance:Long.fromValue(e.balance):Long.ZERO,isKycGranted:n,isFrozen:r,automaticAssociation:null!=e.automaticAssociation?e.automaticAssociation:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),symbol:this.symbol,balance:this.balance,kycStatus:null==this.isKycGranted?0:this.isKycGranted?1:2,freezeStatus:null==this.isFrozen?0:this.isFrozen?1:2,automaticAssociation:this.automaticAssociation}}}class TokenRelationshipMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}static _fromProtobuf(e){const t=new TokenRelationshipMap;for(const n of e){const e=TokenId._fromProtobuf(n.tokenId);t._set(e,TokenRelationship._fromProtobuf(n))}return t}_toProtobuf(){const e=[];for(const[t,n]of this)e.push(n._toProtobuf());return e}}class LedgerId{constructor(e){this._ledgerId=e,Object.freeze(this)}static fromString(e){switch(e){case NETNAMES[0]:case"0":return LedgerId.MAINNET;case NETNAMES[1]:case"1":return LedgerId.TESTNET;case NETNAMES[2]:case"2":return LedgerId.PREVIEWNET;case NETNAMES[3]:case"3":return LedgerId.LOCAL_NODE;default:try{let t=decode$7(e);return new LedgerId(t)}catch(e){throw new Error("Default reached for fromString")}}}toString(){if(1!=this._ledgerId.length)return encode$4(this._ledgerId);switch(this._ledgerId[0]){case 0:return NETNAMES[0];case 1:return NETNAMES[1];case 2:return NETNAMES[2];case 3:return NETNAMES[3];default:return encode$4(this._ledgerId)}}static fromBytes(e){return new LedgerId(e)}toBytes(){return this._ledgerId}isMainnet(){return this.toString()==NETNAMES[0]}isTestnet(){return this.toString()==NETNAMES[1]}isPreviewnet(){return this.toString()==NETNAMES[2]}isLocalNode(){return this.toString()==NETNAMES[3]}}const NETNAMES=["mainnet","testnet","previewnet","local-node"];LedgerId.MAINNET=new LedgerId(new Uint8Array([0])),LedgerId.TESTNET=new LedgerId(new Uint8Array([1])),LedgerId.PREVIEWNET=new LedgerId(new Uint8Array([2])),LedgerId.LOCAL_NODE=new LedgerId(new Uint8Array([3]));class AccountInfo{constructor(e){this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.isDeleted=e.isDeleted,this.proxyAccountId=e.proxyAccountId,this.proxyReceived=e.proxyReceived,this.key=e.key,this.balance=e.balance,this.sendRecordThreshold=e.sendRecordThreshold,this.receiveRecordThreshold=e.receiveRecordThreshold,this.isReceiverSignatureRequired=e.isReceiverSignatureRequired,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.liveHashes=e.liveHashes,this.tokenRelationships=e.tokenRelationships,this.accountMemo=e.accountMemo,this.ownedNfts=e.ownedNfts,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.aliasKey=e.aliasKey,this.ledgerId=e.ledgerId,this.hbarAllowances=e.hbarAllowances,this.tokenAllowances=e.tokenAllowances,this.nftAllowances=e.nftAllowances,this.ethereumNonce=e.ethereumNonce,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(e){let t=null!=e.alias&&e.alias.length>0?Key._fromProtobufKey(libExports.proto.Key.decode(e.alias)):null;t instanceof PublicKey||(t=null);const n=AccountId._fromProtobuf(e.accountID);return new AccountInfo({accountId:n,contractAccountId:null!=e.contractAccountID?e.contractAccountID:null,isDeleted:null!=e.deleted&&e.deleted,key:Key._fromProtobufKey(e.key),balance:Hbar.fromTinybars(null!=e.balance?e.balance:0),sendRecordThreshold:Hbar.fromTinybars(null!=e.generateSendRecordThreshold?e.generateSendRecordThreshold:0),receiveRecordThreshold:Hbar.fromTinybars(null!=e.generateReceiveRecordThreshold?e.generateReceiveRecordThreshold:0),isReceiverSignatureRequired:null!=e.receiverSigRequired&&e.receiverSigRequired,expirationTime:Timestamp._fromProtobuf(e.expirationTime),autoRenewPeriod:null!=e.autoRenewPeriod?new Duration(e.autoRenewPeriod.seconds):new Duration(0),proxyAccountId:null!=e.proxyAccountID&&0!==Long.fromValue(e.proxyAccountID.shardNum).toInt()&&0!==Long.fromValue(e.proxyAccountID.realmNum).toInt()&&0!==Long.fromValue(e.proxyAccountID.accountNum).toInt()?AccountId._fromProtobuf(e.proxyAccountID):null,proxyReceived:Hbar.fromTinybars(null!=e.proxyReceived?e.proxyReceived:0),liveHashes:(null!=e.liveHashes?e.liveHashes:[]).map(e=>LiveHash._fromProtobuf(e)),tokenRelationships:TokenRelationshipMap._fromProtobuf(null!=e.tokenRelationships?e.tokenRelationships:[]),accountMemo:null!=e.memo?e.memo:"",ownedNfts:e.ownedNfts?e.ownedNfts:Long.ZERO,maxAutomaticTokenAssociations:e.maxAutomaticTokenAssociations?Long.fromNumber(e.maxAutomaticTokenAssociations):Long.ZERO,aliasKey:t,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,hbarAllowances:[],tokenAllowances:[],nftAllowances:[],ethereumNonce:null!=e.ethereumNonce?e.ethereumNonce:null,stakingInfo:null!=e.stakingInfo?StakingInfo._fromProtobuf(e.stakingInfo):null})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,deleted:this.isDeleted,proxyAccountID:null!=this.proxyAccountId?this.proxyAccountId._toProtobuf():null,proxyReceived:this.proxyReceived.toTinybars(),key:this.key._toProtobufKey(),balance:this.balance.toTinybars(),generateSendRecordThreshold:this.sendRecordThreshold.toTinybars(),generateReceiveRecordThreshold:this.receiveRecordThreshold.toTinybars(),receiverSigRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:this.autoRenewPeriod._toProtobuf(),liveHashes:this.liveHashes.map(e=>e._toProtobuf()),tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,memo:this.accountMemo,ownedNfts:this.ownedNfts,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toInt(),alias:null!=this.aliasKey?libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,ethereumNonce:this.ethereumNonce,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null}}static fromBytes(e){return AccountInfo._fromProtobuf(libExports.proto.CryptoGetInfoResponse.AccountInfo.decode(e))}toBytes(){return libExports.proto.CryptoGetInfoResponse.AccountInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{balance:this.balance.toString(),accountId:this.accountId.toString(),contractAccountId:this.contractAccountId,isDeleted:this.isDeleted,proxyAccountId:null!=this.proxyAccountId?this.proxyAccountId.toString():null,proxyReceived:this.proxyReceived.toString(),key:null!=this.key?this.key.toString():null,sendRecordThreshold:this.sendRecordThreshold.toString(),receiveRecordThreshold:this.receiveRecordThreshold.toString(),isReceiverSignatureRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime.toString(),autoRenewPeriod:this.autoRenewPeriod.toString(),accountMemo:this.accountMemo,ownedNfts:this.ownedNfts.toString(),maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toString(),aliasKey:null!=this.aliasKey?this.aliasKey.toString():null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,ethereumNonce:null!=this.ethereumNonce?this.ethereumNonce.toString():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo.toJSON():null}}}class AccountInfoQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e){const t=e.cryptoGetInfo;return new AccountInfoQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getAccountInfo(t)}async getCost(e){return super.getCost(e)}_mapResponseHeader(e){return e.cryptoGetInfo.header}_mapResponse(e,t,n){const r=e.cryptoGetInfo;return Promise.resolve(AccountInfo._fromProtobuf(r.accountInfo))}_onMakeRequest(e){return{cryptoGetInfo:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetInfo",AccountInfoQuery._fromProtobuf);class AccountInfoFlow{static async verifySignature(e,t,n,r){const o=await(new AccountInfoQuery).setAccountId(t).execute(e);return!(o.key instanceof KeyList)&&o.key.verify(n,r)}static async verifyTransaction(e,t,n){const r=await(new AccountInfoQuery).setAccountId(t).execute(e);return!(r.key instanceof KeyList)&&r.key.verifyTransaction(n)}static async verifySignatureWithSigner(e,t,n,r){const o=await(new AccountInfoQuery).setAccountId(t).executeWithSigner(e);return!(o.key instanceof KeyList)&&o.key.verify(n,r)}static async verifyTransactionWithSigner(e,t,n){const r=await(new AccountInfoQuery).setAccountId(t).executeWithSigner(e);return!(r.key instanceof KeyList)&&r.key.verifyTransaction(n)}}class AccountRecordsQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e){const t=e.cryptoGetAccountRecords;return new AccountRecordsQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getAccountRecords(t)}_mapResponseHeader(e){return e.cryptoGetAccountRecords.header}_mapResponse(e,t,n){const r=e.cryptoGetAccountRecords.records;return Promise.resolve(r.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})))}_onMakeRequest(e){return{cryptoGetAccountRecords:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountRecordsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetAccountRecords",AccountRecordsQuery._fromProtobuf);class AccountUpdateTransaction extends Transaction{constructor(e={}){super(),this._accountId=null,this._key=null,this._receiverSignatureRequired=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._expirationTime=null,this._accountMemo=null,this._maxAutomaticTokenAssociations=null,this._aliasKey=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,this._hooksToBeCreated=[],this._hooksToBeDeleted=[],null!=e.accountId&&this.setAccountId(e.accountId),null!=e.key&&this.setKey(e.key),null!=e.receiverSignatureRequired&&this.setReceiverSignatureRequired(e.receiverSignatureRequired),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.accountMemo&&this.setAccountMemo(e.accountMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.hooksToBeCreated&&this.setHooksToCreate(e.hooksToBeCreated),null!=e.hooksToBeDeleted&&this.setHooksToDelete(e.hooksToBeDeleted)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoUpdateAccount;return Transaction._fromProtobufTransactions(new AccountUpdateTransaction({accountId:null!=a.accountIDToUpdate?AccountId._fromProtobuf(a.accountIDToUpdate):void 0,key:null!=a.key?Key._fromProtobufKey(a.key):void 0,receiverSignatureRequired:null!=a.receiverSigRequiredWrapper&&Object.hasOwn(a.receiverSigRequiredWrapper,"value")?a.receiverSigRequiredWrapper.value:void 0,proxyAccountId:null!=a.proxyAccountID?AccountId._fromProtobuf(a.proxyAccountID):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0,accountMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0,maxAutomaticTokenAssociations:null!=a.maxAutomaticTokenAssociations&&null!=a.maxAutomaticTokenAssociations.value&&Object.hasOwn(a.maxAutomaticTokenAssociations,"value")?Long.fromNumber(a.maxAutomaticTokenAssociations.value):void 0,stakedAccountId:null!=a.stakedAccountId?AccountId._fromProtobuf(a.stakedAccountId):void 0,stakedNodeId:null!=a.stakedNodeId?a.stakedNodeId:void 0,declineStakingReward:null!=a.declineReward&&Object.hasOwn(a.declineReward,"value")?a.declineReward.value:void 0}),e,t,n,r,o)}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get key(){return this._key}setKey(e){return this._requireNotFrozen(),this._key=e,this}get receiverSignatureRequired(){return this._receiverSignatureRequired}setReceiverSignatureRequired(e){return this._requireNotFrozen(),this._receiverSignatureRequired=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?Timestamp.fromDate(e):e,this}get accountMemo(){return this._accountMemo}setAccountMemo(e){return this._requireNotFrozen(),this._accountMemo=e,this}clearAccountMemo(){return this._requireNotFrozen(),this._accountMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations="number"==typeof e?Long.fromNumber(e):e,this}get aliasKey(){return null}setAliasKey(e){return this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}clearStakedAccountId(){return this._requireNotFrozen(),this._stakedAccountId=new AccountId(0,0,0),this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}clearStakedNodeId(){return this._requireNotFrozen(),this._stakedNodeId=Long.fromNumber(-1),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}addHookToCreate(e){return this._hooksToBeCreated.push(e),this}setHooksToCreate(e){return this._hooksToBeCreated=e,this}get hooksToCreate(){return this._hooksToBeCreated}addHookToDelete(e){return this._hooksToBeDeleted.push(e),this}setHooksToDelete(e){return this._hooksToBeDeleted=e,this}get hooksToDelete(){return this._hooksToBeDeleted}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_execute(e,t){return e.crypto.updateAccount(t)}_getTransactionDataCase(){return"cryptoUpdateAccount"}_makeTransactionData(){return{accountIDToUpdate:null!=this._accountId?this._accountId._toProtobuf():null,key:null!=this._key?this._key._toProtobufKey():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,receiverSigRequiredWrapper:null==this._receiverSignatureRequired?null:{value:this._receiverSignatureRequired},memo:null!=this._accountMemo?{value:this._accountMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations.toInt()}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null,hookIdsToDelete:this._hooksToBeDeleted,hookCreationDetails:this._hooksToBeCreated.map(e=>e._toProtobuf())}}_getLogId(){return`AccountUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoUpdateAccount",AccountUpdateTransaction._fromProtobuf);class FreezeType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case FreezeType.UnknownFreezeType:return"UNKNOWN_FREEZE_TYPE";case FreezeType.FreezeOnly:return"FREEZE_ONLY";case FreezeType.PrepareUpgrade:return"PREPARE_UPGRADE";case FreezeType.FreezeUpgrade:return"FREEZE_UPGRADE";case FreezeType.FreezeAbort:return"FREEZE_ABORT";case FreezeType.TelemetryUpgrade:return"TELEMETRY_UPGRADE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return FreezeType.UnknownFreezeType;case 1:return FreezeType.FreezeOnly;case 2:return FreezeType.PrepareUpgrade;case 3:return FreezeType.FreezeUpgrade;case 4:return FreezeType.FreezeAbort;case 5:return FreezeType.TelemetryUpgrade;default:throw new Error(`(BUG) Status.fromCode() does not handle code: ${e}`)}}valueOf(){return this._code}}FreezeType.UnknownFreezeType=new FreezeType(0),FreezeType.FreezeOnly=new FreezeType(1),FreezeType.PrepareUpgrade=new FreezeType(2),FreezeType.FreezeUpgrade=new FreezeType(3),FreezeType.FreezeAbort=new FreezeType(4),FreezeType.TelemetryUpgrade=new FreezeType(5);class FreezeTransaction extends Transaction{constructor(e={}){super(),this._startTime=null,this._startTimestamp=null,this._endTime=null,this._fileId=null,this._fileHash=null,this._freezeType=null,null!=e.startTime&&this.setStartTime(e.startTime.hour,e.startTime.minute),null!=e.endTime&&this.setEndTime(e.endTime.hour,e.endTime.minute),null!=e.startTimestamp&&this.setStartTimestamp(e.startTimestamp),null!=e.updateFileId&&this.setUpdateFileId(e.updateFileId),null!=e.fileId&&this.setFileId(e.fileId),null!=e.fileHash&&this.setFileHash(e.fileHash),null!=e.freezeType&&this.setFreezeType(e.freezeType)}static _fromProtobuf(e,t,n,r,o){const a=o[0].freeze;return Transaction._fromProtobufTransactions(new FreezeTransaction({startTime:null!=a.startHour&&null!=a.startMin?{hour:a.startHour,minute:a.startMin}:void 0,endTime:null!=a.endHour&&null!=a.endMin?{hour:a.endHour,minute:a.endMin}:void 0,startTimestamp:null!=a.startTime?Timestamp._fromProtobuf(a.startTime):void 0,updateFileId:null!=a.updateFile?FileId._fromProtobuf(a.updateFile):void 0,fileHash:null!=a.fileHash?a.fileHash:void 0,freezeType:null!=a.freezeType?FreezeType._fromCode(a.freezeType):void 0}),e,t,n,r,o)}get startTime(){return null}setStartTime(e,t){if(this._requireNotFrozen(),"string"==typeof e){const t=e.split(":");this._startTime={hour:Number(t[0]),minute:Number(t[1])}}else this._startTime={hour:e,minute:t};return this}get startTimestamp(){return this._startTimestamp}setStartTimestamp(e){return this._requireNotFrozen(),this._startTimestamp=e,this}get endTime(){return console.warn("`FreezeTransaction.endTime` is deprecated"),this._endTime}setEndTime(e,t){if(console.warn("`FreezeTransaction.endTime` is deprecated"),this._requireNotFrozen(),"string"==typeof e){const t=e.split(":");this._endTime={hour:Number(t[0]),minute:Number(t[1])}}else this._endTime={hour:e,minute:t};return this}get updateFileId(){return this.fileId}setUpdateFileId(e){return this.setFileId(e)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e,this}get fileHash(){return this._fileHash}setFileHash(e){return this._requireNotFrozen(),this._fileHash="string"==typeof e?decode$7(e):e,this}get freezeType(){return this._freezeType}setFreezeType(e){return this._requireNotFrozen(),this._freezeType=e,this}_getTransactionDataCase(){return"freeze"}_makeTransactionData(){return{startTime:null!=this._startTimestamp?this._startTimestamp._toProtobuf():null,updateFile:null!=this._fileId?this._fileId._toProtobuf():null,fileHash:this._fileHash,freezeType:null!=this._freezeType?this._freezeType.valueOf():null}}_getLogId(){return`FreezeTransaction:${this._transactionIds.current.validStart.toString()}`}_execute(e,t){return e.freeze.freeze(t)}}TRANSACTION_REGISTRY.set("freeze",FreezeTransaction._fromProtobuf);class BatchTransaction extends Transaction{constructor(e){super(),this._batchTransactions=e?.transactions||[]}setInnerTransactions(e){return e.forEach(e=>this._validateTransaction(e)),this._batchTransactions=e,this}addInnerTransaction(e){return this._validateTransaction(e),this._requireNotFrozen(),this._batchTransactions.push(e),this}get innerTransactions(){return this._batchTransactions}get innerTransactionIds(){return Array.isArray(this._batchTransactions)?this._batchTransactions.map(e=>e.transactionId):[]}_makeTransactionData(){if(!Array.isArray(this._batchTransactions))return{transactions:[]};return{transactions:this._batchTransactions.map(e=>libExports.proto.SignedTransaction.encode(e._signedTransactions.get(0)).finish())}}static _fromProtobuf(e,t,n,r,o){const a=o[0],i=a.atomicBatch?.transactions,s=i?.map(e=>libExports.proto.SignedTransaction.decode(e)),c=s?.map(e=>{const t=libExports.proto.TransactionBody.decode(e.bodyBytes),n=t.data;if(!n)throw new Error("Transaction type not found");const r=TRANSACTION_REGISTRY.get(n);if(!r)throw new Error("fromProtobuf not found");return r([],[e],[],[],[t])});return Transaction._fromProtobufTransactions(new BatchTransaction({transactions:c}),e,t,n,r,o)}_getTransactionDataCase(){return"atomicBatch"}_getLogId(){return`AtomicBatch:${this._transactionIds.current.validStart.toString()}`}_execute(e,t){return e.util.atomicBatch(t)}_validateTransaction(e){if(e instanceof BatchTransaction||e instanceof FreezeTransaction)throw new Error("Transaction is not allowed to be added to a batch");if(!e.isFrozen())throw new Error("Transaction must be frozen before being added to a batch");if(!e.batchKey)throw new Error("Transaction must have a batch key")}}TRANSACTION_REGISTRY.set("atomicBatch",BatchTransaction._fromProtobuf);class ContractByteCodeQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.contractGetBytecode;return new ContractByteCodeQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.contractGetBytecode(t)}_mapResponseHeader(e){return e.contractGetBytecodeResponse.header}_mapResponse(e){const t=e.contractGetBytecodeResponse;return Promise.resolve(null!=t.bytecode?t.bytecode:new Uint8Array)}_onMakeRequest(e){return{contractGetBytecode:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`ContractByteCodeQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractGetBytecode",ContractByteCodeQuery._fromProtobuf);const HEX_CHARS="0123456789abcdef".split(""),KECCAK_PADDING=[1,256,65536,16777216],SHIFT=[0,8,16,24],RC=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Keccak=e=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:(t=[0,0,0,0,0,0,0,0,0,0],[].concat(t,t,t,t,t))};var t},update=(e,t)=>{for(var n,r,o=t.length,a=e.blocks,i=e.blockCount<<2,s=e.blockCount,c=e.outputBlocks,u=e.s,l=0;l<o;){if(e.reset)for(e.reset=!1,a[0]=e.block,n=1;n<s+1;++n)a[n]=0;if("string"!=typeof t)for(n=e.start;l<o&&n<i;++l)a[n>>2]|=t[l]<<SHIFT[3&n++];else for(n=e.start;l<o&&n<i;++l)(r=t.charCodeAt(l))<128?a[n>>2]|=r<<SHIFT[3&n++]:r<2048?(a[n>>2]|=(192|r>>6)<<SHIFT[3&n++],a[n>>2]|=(128|63&r)<<SHIFT[3&n++]):r<55296||r>=57344?(a[n>>2]|=(224|r>>12)<<SHIFT[3&n++],a[n>>2]|=(128|r>>6&63)<<SHIFT[3&n++],a[n>>2]|=(128|63&r)<<SHIFT[3&n++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++l)),a[n>>2]|=(240|r>>18)<<SHIFT[3&n++],a[n>>2]|=(128|r>>12&63)<<SHIFT[3&n++],a[n>>2]|=(128|r>>6&63)<<SHIFT[3&n++],a[n>>2]|=(128|63&r)<<SHIFT[3&n++]);if(e.lastByteIndex=n,n>=i){for(e.start=n-i,e.block=a[s],n=0;n<s;++n)u[n]^=a[n];f(u),e.reset=!0}else e.start=n}if(a[(n=e.lastByteIndex)>>2]|=KECCAK_PADDING[3&n],e.lastByteIndex===i)for(a[0]=a[s],n=1;n<s+1;++n)a[n]=0;for(a[s-1]|=2147483648,n=0;n<s;++n)u[n]^=a[n];f(u);var d,p="",h=0;for(n=0;h<c;){for(n=0;n<s&&h<c;++n,++h)d=u[n],p+=HEX_CHARS[d>>4&15]+HEX_CHARS[15&d]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15];h%s===0&&(f(u),n=0)}return"0x"+p},f=e=>{var t,n,r,o,a,i,s,c,u,l,d,p,h,f,y,m,g,_,b,I,k,T,S,w,A,v,E,O,N,P,R,C,D,B,L,x,F,U,H,K,j,M,G,q,V,$,z,W,Y,Q,X,Z,J,ee,te,ne,re,oe,ae,ie,se,ce,ue;for(r=0;r<48;r+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(i<<1|s>>>31),n=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|i>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=o^(c<<1|u>>>31),n=a^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=i^(l<<1|d>>>31),n=s^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(p<<1|h>>>31),n=u^(h<<1|p>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(o<<1|a>>>31),n=d^(a<<1|o>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,f=e[0],y=e[1],$=e[11]<<4|e[10]>>>28,z=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ie=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,M=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,x=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,_=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,D=e[44]<<29|e[45]>>>3,w=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,re=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,H=e[27]<<25|e[26]>>>7,I=e[36]<<21|e[37]>>>11,k=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,J=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,v=e[18]<<20|e[19]>>>12,E=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,K=e[38]<<8|e[39]>>>24,j=e[39]<<8|e[38]>>>24,T=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=f^~m&_,e[1]=y^~g&b,e[10]=w^~v&O,e[11]=A^~E&N,e[20]=B^~x&U,e[21]=L^~F&H,e[30]=q^~$&W,e[31]=V^~z&Y,e[40]=ee^~ne&oe,e[41]=te^~re&ae,e[2]=m^~_&I,e[3]=g^~b&k,e[12]=v^~O&P,e[13]=E^~N&R,e[22]=x^~U&K,e[23]=F^~H&j,e[32]=$^~W&Q,e[33]=z^~Y&X,e[42]=ne^~oe&ie,e[43]=re^~ae&se,e[4]=_^~I&T,e[5]=b^~k&S,e[14]=O^~P&C,e[15]=N^~R&D,e[24]=U^~K&M,e[25]=H^~j&G,e[34]=W^~Q&Z,e[35]=Y^~X&J,e[44]=oe^~ie&ce,e[45]=ae^~se&ue,e[6]=I^~T&f,e[7]=k^~S&y,e[16]=P^~C&w,e[17]=R^~D&A,e[26]=K^~M&B,e[27]=j^~G&L,e[36]=Q^~Z&q,e[37]=X^~J&V,e[46]=ie^~ce&ee,e[47]=se^~ue&te,e[8]=T^~f&m,e[9]=S^~y&g,e[18]=C^~w&v,e[19]=D^~A&E,e[28]=M^~B&x,e[29]=G^~L&F,e[38]=Z^~q&$,e[39]=J^~V&z,e[48]=ce^~ee&ne,e[49]=ue^~te&re,e[0]^=RC[r],e[1]^=RC[r+1]},keccak=e=>t=>{var n;if("0x"===t.slice(0,2)){n=[];for(var r=2,o=t.length;r<o;r+=2)n.push(parseInt(t.slice(r,r+2),16))}else n=t;return update(Keccak(e),n)},keccak256=keccak(256),ArgumentType={uint8:0,int8:1,uint16:2,int16:3,uint24:4,int24:5,uint32:6,int32:7,uint40:8,int40:9,uint48:10,int48:11,uint56:12,int56:13,uint64:14,int64:15,uint72:16,int72:17,uint80:18,int80:19,uint88:20,int88:21,uint96:22,int96:23,uint104:24,int104:25,uint112:26,int112:27,uint120:28,int120:29,uint128:30,int128:31,uint136:32,int136:33,uint144:34,int144:35,uint152:36,int152:37,uint160:38,int160:39,uint168:40,int168:41,uint176:42,int176:43,uint184:44,int184:45,uint192:46,int192:47,uint200:48,int200:49,uint208:50,int208:51,uint216:52,int216:53,uint224:54,int224:55,uint232:56,int232:57,uint240:58,int240:59,uint248:60,int248:61,uint256:62,int256:63,string:64,bool:65,bytes:66,bytes32:67,address:68,func:69};class ContractFunctionSelector{constructor(e){this.name=null,this._params="",this._paramTypes=[],null!=e&&(this._name=e)}addString(){return this._addParam({ty:ArgumentType.string,array:!1})}addStringArray(){return this._addParam({ty:ArgumentType.string,array:!0})}addBytes(){return this._addParam({ty:ArgumentType.bytes,array:!1})}addBytes32(){return this._addParam({ty:ArgumentType.bytes32,array:!1})}addBytesArray(){return this._addParam({ty:ArgumentType.bytes,array:!0})}addBytes32Array(){return this._addParam({ty:ArgumentType.bytes32,array:!0})}addInt8(){return this._addParam({ty:ArgumentType.int8,array:!1})}addUint8(){return this._addParam({ty:ArgumentType.uint8,array:!1})}addInt16(){return this._addParam({ty:ArgumentType.int16,array:!1})}addUint16(){return this._addParam({ty:ArgumentType.uint16,array:!1})}addInt24(){return this._addParam({ty:ArgumentType.int24,array:!1})}addUint24(){return this._addParam({ty:ArgumentType.uint24,array:!1})}addInt32(){return this._addParam({ty:ArgumentType.int32,array:!1})}addUint32(){return this._addParam({ty:ArgumentType.uint32,array:!1})}addInt40(){return this._addParam({ty:ArgumentType.int40,array:!1})}addUint40(){return this._addParam({ty:ArgumentType.uint40,array:!1})}addInt48(){return this._addParam({ty:ArgumentType.int48,array:!1})}addUint48(){return this._addParam({ty:ArgumentType.uint48,array:!1})}addInt56(){return this._addParam({ty:ArgumentType.int56,array:!1})}addUint56(){return this._addParam({ty:ArgumentType.uint56,array:!1})}addInt64(){return this._addParam({ty:ArgumentType.int64,array:!1})}addUint64(){return this._addParam({ty:ArgumentType.uint64,array:!1})}addInt72(){return this._addParam({ty:ArgumentType.int72,array:!1})}addUint72(){return this._addParam({ty:ArgumentType.uint72,array:!1})}addInt80(){return this._addParam({ty:ArgumentType.int80,array:!1})}addUint80(){return this._addParam({ty:ArgumentType.uint80,array:!1})}addInt88(){return this._addParam({ty:ArgumentType.int88,array:!1})}addUint88(){return this._addParam({ty:ArgumentType.uint88,array:!1})}addInt96(){return this._addParam({ty:ArgumentType.int96,array:!1})}addUint96(){return this._addParam({ty:ArgumentType.uint96,array:!1})}addInt104(){return this._addParam({ty:ArgumentType.int104,array:!1})}addUint104(){return this._addParam({ty:ArgumentType.uint104,array:!1})}addInt112(){return this._addParam({ty:ArgumentType.int112,array:!1})}addUint112(){return this._addParam({ty:ArgumentType.uint112,array:!1})}addInt120(){return this._addParam({ty:ArgumentType.int120,array:!1})}addUint120(){return this._addParam({ty:ArgumentType.uint120,array:!1})}addInt128(){return this._addParam({ty:ArgumentType.int128,array:!1})}addUint128(){return this._addParam({ty:ArgumentType.uint128,array:!1})}addInt136(){return this._addParam({ty:ArgumentType.int136,array:!1})}addUint136(){return this._addParam({ty:ArgumentType.uint136,array:!1})}addInt144(){return this._addParam({ty:ArgumentType.int144,array:!1})}addUint144(){return this._addParam({ty:ArgumentType.uint144,array:!1})}addInt152(){return this._addParam({ty:ArgumentType.int152,array:!1})}addUint152(){return this._addParam({ty:ArgumentType.uint152,array:!1})}addInt160(){return this._addParam({ty:ArgumentType.int160,array:!1})}addUint160(){return this._addParam({ty:ArgumentType.uint160,array:!1})}addInt168(){return this._addParam({ty:ArgumentType.int168,array:!1})}addUint168(){return this._addParam({ty:ArgumentType.uint168,array:!1})}addInt176(){return this._addParam({ty:ArgumentType.int176,array:!1})}addUint176(){return this._addParam({ty:ArgumentType.uint176,array:!1})}addInt184(){return this._addParam({ty:ArgumentType.int184,array:!1})}addUint184(){return this._addParam({ty:ArgumentType.uint184,array:!1})}addInt192(){return this._addParam({ty:ArgumentType.int192,array:!1})}addUint192(){return this._addParam({ty:ArgumentType.uint192,array:!1})}addInt200(){return this._addParam({ty:ArgumentType.int200,array:!1})}addUint200(){return this._addParam({ty:ArgumentType.uint200,array:!1})}addInt208(){return this._addParam({ty:ArgumentType.int208,array:!1})}addUint208(){return this._addParam({ty:ArgumentType.uint208,array:!1})}addInt216(){return this._addParam({ty:ArgumentType.int216,array:!1})}addUint216(){return this._addParam({ty:ArgumentType.uint216,array:!1})}addInt224(){return this._addParam({ty:ArgumentType.int224,array:!1})}addUint224(){return this._addParam({ty:ArgumentType.uint224,array:!1})}addInt232(){return this._addParam({ty:ArgumentType.int232,array:!1})}addUint232(){return this._addParam({ty:ArgumentType.uint232,array:!1})}addInt240(){return this._addParam({ty:ArgumentType.int240,array:!1})}addUint240(){return this._addParam({ty:ArgumentType.uint240,array:!1})}addInt248(){return this._addParam({ty:ArgumentType.int248,array:!1})}addUint248(){return this._addParam({ty:ArgumentType.uint248,array:!1})}addInt256(){return this._addParam({ty:ArgumentType.int256,array:!1})}addUint256(){return this._addParam({ty:ArgumentType.uint256,array:!1})}addInt8Array(){return this._addParam({ty:ArgumentType.int8,array:!0})}addUint8Array(){return this._addParam({ty:ArgumentType.uint8,array:!0})}addInt16Array(){return this._addParam({ty:ArgumentType.int16,array:!0})}addUint16Array(){return this._addParam({ty:ArgumentType.uint16,array:!0})}addInt24Array(){return this._addParam({ty:ArgumentType.int24,array:!0})}addUint24Array(){return this._addParam({ty:ArgumentType.uint24,array:!0})}addInt32Array(){return this._addParam({ty:ArgumentType.int32,array:!0})}addUint32Array(){return this._addParam({ty:ArgumentType.uint32,array:!0})}addInt40Array(){return this._addParam({ty:ArgumentType.int40,array:!0})}addUint40Array(){return this._addParam({ty:ArgumentType.uint40,array:!0})}addInt48Array(){return this._addParam({ty:ArgumentType.int48,array:!0})}addUint48Array(){return this._addParam({ty:ArgumentType.uint48,array:!0})}addInt56Array(){return this._addParam({ty:ArgumentType.int56,array:!0})}addUint56Array(){return this._addParam({ty:ArgumentType.uint56,array:!0})}addInt64Array(){return this._addParam({ty:ArgumentType.int64,array:!0})}addUint64Array(){return this._addParam({ty:ArgumentType.uint64,array:!0})}addInt72Array(){return this._addParam({ty:ArgumentType.int72,array:!0})}addUint72Array(){return this._addParam({ty:ArgumentType.uint72,array:!0})}addInt80Array(){return this._addParam({ty:ArgumentType.int80,array:!0})}addUint80Array(){return this._addParam({ty:ArgumentType.uint80,array:!0})}addInt88Array(){return this._addParam({ty:ArgumentType.int88,array:!0})}addUint88Array(){return this._addParam({ty:ArgumentType.uint88,array:!0})}addInt96Array(){return this._addParam({ty:ArgumentType.int96,array:!0})}addUint96Array(){return this._addParam({ty:ArgumentType.uint96,array:!0})}addInt104Array(){return this._addParam({ty:ArgumentType.int104,array:!0})}addUint104Array(){return this._addParam({ty:ArgumentType.uint104,array:!0})}addInt112Array(){return this._addParam({ty:ArgumentType.int112,array:!0})}addUint112Array(){return this._addParam({ty:ArgumentType.uint112,array:!0})}addInt120Array(){return this._addParam({ty:ArgumentType.int120,array:!0})}addUint120Array(){return this._addParam({ty:ArgumentType.uint120,array:!0})}addInt128Array(){return this._addParam({ty:ArgumentType.int128,array:!0})}addUint128Array(){return this._addParam({ty:ArgumentType.uint128,array:!0})}addInt136Array(){return this._addParam({ty:ArgumentType.int136,array:!0})}addUint136Array(){return this._addParam({ty:ArgumentType.uint136,array:!0})}addInt144Array(){return this._addParam({ty:ArgumentType.int144,array:!0})}addUint144Array(){return this._addParam({ty:ArgumentType.uint144,array:!0})}addInt152Array(){return this._addParam({ty:ArgumentType.int152,array:!0})}addUint152Array(){return this._addParam({ty:ArgumentType.uint152,array:!0})}addInt160Array(){return this._addParam({ty:ArgumentType.int160,array:!0})}addUint160Array(){return this._addParam({ty:ArgumentType.uint160,array:!0})}addInt168Array(){return this._addParam({ty:ArgumentType.int168,array:!0})}addUint168Array(){return this._addParam({ty:ArgumentType.uint168,array:!0})}addInt176Array(){return this._addParam({ty:ArgumentType.int176,array:!0})}addUint176Array(){return this._addParam({ty:ArgumentType.uint176,array:!0})}addInt184Array(){return this._addParam({ty:ArgumentType.int184,array:!0})}addUint184Array(){return this._addParam({ty:ArgumentType.uint184,array:!0})}addInt192Array(){return this._addParam({ty:ArgumentType.int192,array:!0})}addUint192Array(){return this._addParam({ty:ArgumentType.uint192,array:!0})}addInt200Array(){return this._addParam({ty:ArgumentType.int200,array:!0})}addUint200Array(){return this._addParam({ty:ArgumentType.uint200,array:!0})}addInt208Array(){return this._addParam({ty:ArgumentType.int208,array:!0})}addUint208Array(){return this._addParam({ty:ArgumentType.uint208,array:!0})}addInt216Array(){return this._addParam({ty:ArgumentType.int216,array:!0})}addUint216Array(){return this._addParam({ty:ArgumentType.uint216,array:!0})}addInt224Array(){return this._addParam({ty:ArgumentType.int224,array:!0})}addUint224Array(){return this._addParam({ty:ArgumentType.uint224,array:!0})}addInt232Array(){return this._addParam({ty:ArgumentType.int232,array:!0})}addUint232Array(){return this._addParam({ty:ArgumentType.uint232,array:!0})}addInt240Array(){return this._addParam({ty:ArgumentType.int240,array:!0})}addUint240Array(){return this._addParam({ty:ArgumentType.uint240,array:!0})}addInt248Array(){return this._addParam({ty:ArgumentType.int248,array:!0})}addUint248Array(){return this._addParam({ty:ArgumentType.uint248,array:!0})}addInt256Array(){return this._addParam({ty:ArgumentType.int256,array:!0})}addUint256Array(){return this._addParam({ty:ArgumentType.uint256,array:!0})}addBool(){return this._addParam({ty:ArgumentType.bool,array:!1})}addAddress(){return this._addParam({ty:ArgumentType.address,array:!1})}addAddressArray(){return this._addParam({ty:ArgumentType.address,array:!0})}addFunction(){return this._addParam({ty:ArgumentType.func,array:!1})}_addParam(e){return this._paramTypes.length>0&&(this._params+=","),this._params+=solidityTypeToString(e),this._paramTypes.push(e),this}_build(e){if(null!=e)this._name=e;else if(null==this._name)throw new Error("`name` required for ContractFunctionSelector");const t=encode$4(encode(this.toString()));return decode$7(keccak256(`0x${t}`)).slice(0,4)}toString(){return`${null!=this._name?this._name.toString():""}(${this._params})`}}function solidityTypeToString(e){let t="";switch(e.ty){case ArgumentType.uint8:t="uint8";break;case ArgumentType.int8:t="int8";break;case ArgumentType.uint16:t="uint16";break;case ArgumentType.int16:t="int16";break;case ArgumentType.uint24:t="uint24";break;case ArgumentType.int24:t="int24";break;case ArgumentType.uint32:t="uint32";break;case ArgumentType.int32:t="int32";break;case ArgumentType.uint40:t="uint40";break;case ArgumentType.int40:t="int40";break;case ArgumentType.uint48:t="uint48";break;case ArgumentType.int48:t="int48";break;case ArgumentType.uint56:t="uint56";break;case ArgumentType.int56:t="int56";break;case ArgumentType.uint64:t="uint64";break;case ArgumentType.int64:t="int64";break;case ArgumentType.uint72:t="uint72";break;case ArgumentType.int72:t="int72";break;case ArgumentType.uint80:t="uint80";break;case ArgumentType.int80:t="int80";break;case ArgumentType.uint88:t="uint88";break;case ArgumentType.int88:t="int88";break;case ArgumentType.uint96:t="uint96";break;case ArgumentType.int96:t="int96";break;case ArgumentType.uint104:t="uint104";break;case ArgumentType.int104:t="int104";break;case ArgumentType.uint112:t="uint112";break;case ArgumentType.int112:t="int112";break;case ArgumentType.uint120:t="uint120";break;case ArgumentType.int120:t="int120";break;case ArgumentType.uint128:t="uint128";break;case ArgumentType.int128:t="int128";break;case ArgumentType.uint136:t="uint136";break;case ArgumentType.int136:t="int136";break;case ArgumentType.uint144:t="uint144";break;case ArgumentType.int144:t="int144";break;case ArgumentType.uint152:t="uint152";break;case ArgumentType.int152:t="int152";break;case ArgumentType.uint160:t="uint160";break;case ArgumentType.int160:t="int160";break;case ArgumentType.uint168:t="uint168";break;case ArgumentType.int168:t="int168";break;case ArgumentType.uint176:t="uint176";break;case ArgumentType.int176:t="int176";break;case ArgumentType.uint184:t="uint184";break;case ArgumentType.int184:t="int184";break;case ArgumentType.uint192:t="uint192";break;case ArgumentType.int192:t="int192";break;case ArgumentType.uint200:t="uint200";break;case ArgumentType.int200:t="int200";break;case ArgumentType.uint208:t="uint208";break;case ArgumentType.int208:t="int208";break;case ArgumentType.uint216:t="uint216";break;case ArgumentType.int216:t="int216";break;case ArgumentType.uint224:t="uint224";break;case ArgumentType.int224:t="int224";break;case ArgumentType.uint232:t="uint232";break;case ArgumentType.int232:t="int232";break;case ArgumentType.uint240:t="uint240";break;case ArgumentType.int240:t="int240";break;case ArgumentType.uint248:t="uint248";break;case ArgumentType.int248:t="int248";break;case ArgumentType.uint256:t="uint256";break;case ArgumentType.int256:t="int256";break;case ArgumentType.string:t="string";break;case ArgumentType.bool:t="bool";break;case ArgumentType.bytes:t="bytes";break;case ArgumentType.bytes32:t="bytes32";break;case ArgumentType.address:t="address";break;case ArgumentType.func:t="function";break;default:t=""}return e.array&&(t+="[]"),t}const defaultAbiCoder=AbiCoder.defaultAbiCoder();class ContractFunctionParameters{constructor(){this._selector=new ContractFunctionSelector,this._arguments=[]}addString(e){return this._selector.addString(),this._addParam(e,!0)}addStringArray(e){return this._selector.addStringArray(),this._addParam(e,!0)}addBytes(e){return this._selector.addBytes(),this._addParam(e,!0)}addBytes32(e){if(32!==e.length)throw new Error(`addBytes32 expected array to be of length 32, but received ${e.length}`);return this._selector.addBytes32(),this._addParam(e,!1)}addBytesArray(e){return this._selector.addBytesArray(),this._addParam(e,!0)}addBytes32Array(e){for(const[t,n]of e.entries())if(32!==n.length)throw new Error(`addBytes32 expected array to be of length 32, but received ${n.length}`);return this._selector.addBytes32Array(),this._addParam(e,!0)}addBool(e){return this._selector.addBool(),this._addParam(e,!1)}addInt8(e){return this._selector.addInt8(),this._addParam(convertToBigNumber(e),!1)}addUint8(e){return this._selector.addUint8(),this._addParam(convertToBigNumber(e),!1)}addInt16(e){return this._selector.addInt16(),this._addParam(convertToBigNumber(e),!1)}addUint16(e){return this._selector.addUint16(),this._addParam(convertToBigNumber(e),!1)}addInt24(e){return this._selector.addInt24(),this._addParam(convertToBigNumber(e),!1)}addUint24(e){return this._selector.addUint24(),this._addParam(convertToBigNumber(e),!1)}addInt32(e){return this._selector.addInt32(),this._addParam(convertToBigNumber(e),!1)}addUint32(e){return this._selector.addUint32(),this._addParam(convertToBigNumber(e),!1)}addInt40(e){return this._selector.addInt40(),this._addParam(convertToBigNumber(e),!1)}addUint40(e){return this._selector.addUint40(),this._addParam(convertToBigNumber(e),!1)}addInt48(e){return this._selector.addInt48(),this._addParam(convertToBigNumber(e),!1)}addUint48(e){return this._selector.addUint48(),this._addParam(convertToBigNumber(e),!1)}addInt56(e){return this._selector.addInt56(),this._addParam(convertToBigNumber(e),!1)}addUint56(e){return this._selector.addUint56(),this._addParam(convertToBigNumber(e),!1)}addInt64(e){return this._selector.addInt64(),this._addParam(convertToBigNumber(e),!1)}addUint64(e){return this._selector.addUint64(),this._addParam(convertToBigNumber(e),!1)}addInt72(e){return this._selector.addInt72(),this._addParam(convertToBigNumber(e),!1)}addUint72(e){return this._selector.addUint72(),this._addParam(convertToBigNumber(e),!1)}addInt80(e){return this._selector.addInt80(),this._addParam(convertToBigNumber(e),!1)}addUint80(e){return this._selector.addUint80(),this._addParam(convertToBigNumber(e),!1)}addInt88(e){return this._selector.addInt88(),this._addParam(convertToBigNumber(e),!1)}addUint88(e){return this._selector.addUint88(),this._addParam(convertToBigNumber(e),!1)}addInt96(e){return this._selector.addInt96(),this._addParam(convertToBigNumber(e),!1)}addUint96(e){return this._selector.addUint96(),this._addParam(convertToBigNumber(e),!1)}addInt104(e){return this._selector.addInt104(),this._addParam(convertToBigNumber(e),!1)}addUint104(e){return this._selector.addUint104(),this._addParam(convertToBigNumber(e),!1)}addInt112(e){return this._selector.addInt112(),this._addParam(convertToBigNumber(e),!1)}addUint112(e){return this._selector.addUint112(),this._addParam(convertToBigNumber(e),!1)}addInt120(e){return this._selector.addInt120(),this._addParam(convertToBigNumber(e),!1)}addUint120(e){return this._selector.addUint120(),this._addParam(convertToBigNumber(e),!1)}addInt128(e){return this._selector.addInt128(),this._addParam(convertToBigNumber(e),!1)}addUint128(e){return this._selector.addUint128(),this._addParam(convertToBigNumber(e),!1)}addInt136(e){return this._selector.addInt136(),this._addParam(convertToBigNumber(e),!1)}addUint136(e){return this._selector.addUint136(),this._addParam(convertToBigNumber(e),!1)}addInt144(e){return this._selector.addInt144(),this._addParam(convertToBigNumber(e),!1)}addUint144(e){return this._selector.addUint144(),this._addParam(convertToBigNumber(e),!1)}addInt152(e){return this._selector.addInt152(),this._addParam(convertToBigNumber(e),!1)}addUint152(e){return this._selector.addUint152(),this._addParam(convertToBigNumber(e),!1)}addInt160(e){return this._selector.addInt160(),this._addParam(convertToBigNumber(e),!1)}addUint160(e){return this._selector.addUint160(),this._addParam(convertToBigNumber(e),!1)}addInt168(e){return this._selector.addInt168(),this._addParam(convertToBigNumber(e),!1)}addUint168(e){return this._selector.addUint168(),this._addParam(convertToBigNumber(e),!1)}addInt176(e){return this._selector.addInt176(),this._addParam(convertToBigNumber(e),!1)}addUint176(e){return this._selector.addUint176(),this._addParam(convertToBigNumber(e),!1)}addInt184(e){return this._selector.addInt184(),this._addParam(convertToBigNumber(e),!1)}addUint184(e){return this._selector.addUint184(),this._addParam(convertToBigNumber(e),!1)}addInt192(e){return this._selector.addInt192(),this._addParam(convertToBigNumber(e),!1)}addUint192(e){return this._selector.addUint192(),this._addParam(convertToBigNumber(e),!1)}addInt200(e){return this._selector.addInt200(),this._addParam(convertToBigNumber(e),!1)}addUint200(e){return this._selector.addUint200(),this._addParam(convertToBigNumber(e),!1)}addInt208(e){return this._selector.addInt208(),this._addParam(convertToBigNumber(e),!1)}addUint208(e){return this._selector.addUint208(),this._addParam(convertToBigNumber(e),!1)}addInt216(e){return this._selector.addInt216(),this._addParam(convertToBigNumber(e),!1)}addUint216(e){return this._selector.addUint216(),this._addParam(convertToBigNumber(e),!1)}addInt224(e){return this._selector.addInt224(),this._addParam(convertToBigNumber(e),!1)}addUint224(e){return this._selector.addUint224(),this._addParam(convertToBigNumber(e),!1)}addInt232(e){return this._selector.addInt232(),this._addParam(convertToBigNumber(e),!1)}addUint232(e){return this._selector.addUint232(),this._addParam(convertToBigNumber(e),!1)}addInt240(e){return this._selector.addInt240(),this._addParam(convertToBigNumber(e),!1)}addUint240(e){return this._selector.addUint240(),this._addParam(convertToBigNumber(e),!1)}addInt248(e){return this._selector.addInt248(),this._addParam(convertToBigNumber(e),!1)}addUint248(e){return this._selector.addUint248(),this._addParam(convertToBigNumber(e),!1)}addInt256(e){return this._selector.addInt256(),this._addParam(convertToBigNumber(e),!1)}addUint256(e){return this._selector.addUint256(),this._addParam(convertToBigNumber(e),!1)}addInt8Array(e){return this._selector.addInt8Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint8Array(e){return this._selector.addUint8Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt16Array(e){return this._selector.addInt16Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint16Array(e){return this._selector.addUint16Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt24Array(e){return this._selector.addInt24Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint24Array(e){return this._selector.addUint24Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt32Array(e){return this._selector.addInt32Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint32Array(e){return this._selector.addUint32Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt40Array(e){return this._selector.addInt40Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint40Array(e){return this._selector.addUint40Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt48Array(e){return this._selector.addInt48Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint48Array(e){return this._selector.addUint48Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt56Array(e){return this._selector.addInt56Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint56Array(e){return this._selector.addUint56Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt64Array(e){return this._selector.addInt64Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint64Array(e){return this._selector.addUint64Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt72Array(e){return this._selector.addInt72Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint72Array(e){return this._selector.addUint72Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt80Array(e){return this._selector.addInt80Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint80Array(e){return this._selector.addUint80Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt88Array(e){return this._selector.addInt88Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint88Array(e){return this._selector.addUint88Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt96Array(e){return this._selector.addInt96Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint96Array(e){return this._selector.addUint96Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt104Array(e){return this._selector.addInt104Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint104Array(e){return this._selector.addUint104Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt112Array(e){return this._selector.addInt112Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint112Array(e){return this._selector.addUint112Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt120Array(e){return this._selector.addInt120Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint120Array(e){return this._selector.addUint120Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt128Array(e){return this._selector.addInt128Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint128Array(e){return this._selector.addUint128Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt136Array(e){return this._selector.addInt136Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint136Array(e){return this._selector.addUint136Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt144Array(e){return this._selector.addInt144Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint144Array(e){return this._selector.addUint144Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt152Array(e){return this._selector.addInt152Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint152Array(e){return this._selector.addUint152Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt160Array(e){return this._selector.addInt160Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint160Array(e){return this._selector.addUint160Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt168Array(e){return this._selector.addInt168Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint168Array(e){return this._selector.addUint168Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt176Array(e){return this._selector.addInt176Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint176Array(e){return this._selector.addUint176Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt184Array(e){return this._selector.addInt184Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint184Array(e){return this._selector.addUint184Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt192Array(e){return this._selector.addInt192Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint192Array(e){return this._selector.addUint192Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt200Array(e){return this._selector.addInt200Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint200Array(e){return this._selector.addUint200Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt208Array(e){return this._selector.addInt208Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint208Array(e){return this._selector.addUint208Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt216Array(e){return this._selector.addInt216Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint216Array(e){return this._selector.addUint216Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt224Array(e){return this._selector.addInt224Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint224Array(e){return this._selector.addUint224Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt232Array(e){return this._selector.addInt232Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint232Array(e){return this._selector.addUint232Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt240Array(e){return this._selector.addInt240Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint240Array(e){return this._selector.addUint240Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt248Array(e){return this._selector.addInt248Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint248Array(e){return this._selector.addUint248Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt256Array(e){return this._selector.addInt256Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint256Array(e){return this._selector.addUint256Array(),this._addParam(convertToBigNumberArray(e),!0)}addAddress(e){let t;if("string"==typeof e){if(40!==e.length&&42!==e.length)throw new Error("`address` type requires parameter to be 40 or 42 characters");t=e}else t=e.toString();const n=40===t.length?decode$7(t):decode$7(t.substring(2));return this._selector.addAddress(),this._addParam(n,!1)}addAddressArray(e){const t=[];for(const[n,r]of e.entries()){let e;if("string"==typeof r){if(40!==r.length&&42!==r.length)throw new Error("`address` type requires parameter to be 40 or 42 characters");e=r}else e=r.toString();const n=40===e.length?decode$7(e):decode$7(e.substring(2));t.push(n)}return this._selector.addAddressArray(),this._addParam(t,!0)}addFunction(e,t){const n=decode$7(e),r=t._build();if(20!==n.length)throw new Error("`function` type requires parameter `address` to be exactly 20 bytes");this._selector.addFunction();const o=new Uint8Array(24);return o.set(n,0),o.set(r,20),this._addParam(o,!1)}_addParam(e,t){const n=this._selector._paramTypes.length-1,r=argumentToBytes(e,this._selector._paramTypes[n]);return this._arguments.push({dynamic:t,value:r}),this}_build(e){const t=null!=e,n=t?4:0,r=0===this._arguments.length?n:32*this._arguments.length+this._arguments.map(e=>e.dynamic?e.value.length:0).reduce((e,t)=>e+t)+n,o=new Uint8Array(r);t&&o.set(this._selector._build(e),0);let a=32*this._arguments.length;for(const[e,{dynamic:t,value:r}]of this._arguments.entries())if(t){const t=safeView(o,n+32*e+28);t.setUint32(0,a),o.set(r,t.getUint32(0)+n),a+=r.length}else o.set(r,n+32*e);return o}}function argumentToBytes(e,t){let n,r=new Uint8Array(32),o=safeView(r);if(t.array){if(!Array.isArray(e))throw new TypeError("SolidityType indicates type is array, but parameter is not an array");const n=[];for(const[r,o]of e.entries()){const e=argumentToBytes(o,{ty:t.ty,array:!1});n.push(e)}const a=n.map(e=>e.length).reduce((e,t)=>e+t,0);switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.uint256:case ArgumentType.int256:case ArgumentType.bool:case ArgumentType.bytes32:case ArgumentType.address:case ArgumentType.func:r=new Uint8Array(a+32);break;case ArgumentType.bytes:case ArgumentType.string:r=new Uint8Array(32*n.length+a+32);break;default:throw new TypeError(`Expected param type to be ArgumentType, but received ${t.ty}`)}o=safeView(r,28),o.setUint32(0,n.length);let i=32*n.length;for(const[e,o]of n.entries())switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.uint256:case ArgumentType.int256:case ArgumentType.bool:case ArgumentType.bytes32:case ArgumentType.address:case ArgumentType.func:r.set(o,32*e+32);break;case ArgumentType.bytes:case ArgumentType.string:const n=safeView(r,32*(e+1)+28);n.setUint32(0,i),r.set(o,n.getUint32(0)+32),i+=o.length;break;default:throw new TypeError(`Expected param type to be ArgumentType, but received ${t.ty}`)}return r}switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.int256:case ArgumentType.uint256:{let n=e.toString(16);n=e>0||0==e?"0x"+n:n.slice(0,1)+"0x"+n.slice(1);return getBytes(defaultAbiCoder.encode([solidityTypeToString(t)],[n]))}case ArgumentType.address:return r.set(e,12),r;case ArgumentType.bool:return r[31]=e?1:0,r;case ArgumentType.func:return r.set(e,8),r;case ArgumentType.bytes32:return r.set(e,0),r;case ArgumentType.bytes:case ArgumentType.string:return n=e instanceof Uint8Array?e:encode(e),r=Math.floor(n.length/32)>=0?0!==Math.floor(n.length%32)?new Uint8Array(32*(Math.floor(n.length/32)+1)+32):new Uint8Array(32*Math.floor(n.length/32)+32):new Uint8Array(64),r.set(n,32),o=safeView(r,28),o.setUint32(0,n.length),r;default:throw new Error(`Unsupported argument type: ${t.toString()}`)}}class ContractCallQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId),this._gas=null,null!=e.gas&&this.setGas(e.gas),this._functionParameters=null,null!=e.functionParameters&&(e.functionParameters instanceof Uint8Array?this.setFunctionParameters(e.functionParameters):this.setFunction(e.functionParameters.name,e.functionParameters.parameters)),this._maxResultSize=null,null!=e.maxResultSize&&this.setMaxResultSize(e.maxResultSize),this._senderAccountId=null,null!=e.senderAccountId&&this.setSenderAccountId(e.senderAccountId)}static _fromProtobuf(e){const t=e.contractCallLocal;return new ContractCallQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0,gas:null!=t.gas?t.gas:void 0,functionParameters:null!=t.functionParameters?t.functionParameters:void 0,maxResultSize:null!=t.maxResultSize?t.maxResultSize:void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get gas(){return this._gas}setGas(e){return this._gas=e instanceof Long?e:Long.fromValue(e),this}get senderAccountId(){return this._senderAccountId}setSenderAccountId(e){return this._senderAccountId="string"==typeof e?AccountId.fromString(e):e,this}get functionParameters(){return this._functionParameters}setFunctionParameters(e){return this._functionParameters=e,this}setFunction(e,t){return this._functionParameters=(null!=t?t:new ContractFunctionParameters)._build(e),this}setMaxResultSize(e){return this._maxResultSize=e instanceof Long?e:Long.fromValue(e),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t),o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);if(!t.contractCallLocal.functionResult)return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null});const a=this._mapResponseSync(t);return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:a})}_execute(e,t){return e.smartContract.contractCallLocalMethod(t)}_mapResponseHeader(e){return e.contractCallLocal.header}_mapResponse(e){const t=e.contractCallLocal;return Promise.resolve(ContractFunctionResult._fromProtobuf(t.functionResult,!1))}_mapResponseSync(e){const t=e.contractCallLocal;return ContractFunctionResult._fromProtobuf(t.functionResult,!1)}_onMakeRequest(e){return{contractCallLocal:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null,gas:this._gas,maxResultSize:this._maxResultSize,functionParameters:this._functionParameters,senderId:null!=this._senderAccountId?this._senderAccountId._toProtobuf():null}}}_getLogId(){return`ContractCallQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractCallLocal",ContractCallQuery._fromProtobuf);class FileCreateTransaction extends Transaction{constructor(e={}){super(),this._keys=null,this._expirationTime=new Timestamp(0,0).plusNanos(Long.fromNumber(Date.now()).mul(1e6).add(DEFAULT_AUTO_RENEW_PERIOD.mul(1e9))),this._contents=null,this._fileMemo=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.keys&&this.setKeys(e.keys),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.contents&&this.setContents(e.contents),e.fileMemo&&null!=e.fileMemo&&this.setFileMemo(e.fileMemo)}static _fromProtobuf(e,t,n,r,o){const a=o[0].fileCreate;return Transaction._fromProtobufTransactions(new FileCreateTransaction({keys:null!=a.keys&&null!=a.keys.keys?a.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0,contents:null!=a.contents?a.contents:void 0,fileMemo:null!=a.memo?a.memo:void 0}),e,t,n,r,o)}get keys(){return this._keys}setKeys(e){if(this._requireNotFrozen(),e instanceof KeyList&&null!=e.threshold)throw new Error("Cannot set threshold key as file key");return this._keys=e instanceof KeyList?e.toArray():e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode(e),this}get fileMemo(){return this._fileMemo}setFileMemo(e){return this._requireNotFrozen(),this._fileMemo=e,this}_execute(e,t){return e.file.createFile(t)}_getTransactionDataCase(){return"fileCreate"}_makeTransactionData(){return{keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:null,expirationTime:this._expirationTime._toProtobuf(),contents:this._contents,memo:this._fileMemo}}_getLogId(){return`FileCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileCreate",FileCreateTransaction._fromProtobuf);class FileAppendTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contents=null,this._maxChunks=20,this._chunkSize=4096,this._chunkInterval=10,this._defaultMaxTransactionFee=new Hbar(5),null!=e.fileId&&this.setFileId(e.fileId),null!=e.contents&&this.setContents(e.contents),null!=e.maxChunks&&this.setMaxChunks(e.maxChunks),null!=e.chunkSize&&this.setChunkSize(e.chunkSize),null!=e.chunkInterval&&this.setChunkInterval(e.chunkInterval),this._transactionIds=new List}static _fromProtobuf(e,t,n,r,o){const a=o[0].fileAppend;let i;const s=r.length>0?r.length:1;for(let e=0;e<o.length;e+=s){const t=o[e].fileAppend;if(null==t.contents)break;if(null==i){i=new Uint8Array(t.contents);continue}const n=new Uint8Array(i.length+t.contents.length);n.set(i,0),n.set(t.contents,i.length),i=n}const c=a.contents?.length||void 0,u=o.length?o.length/s:void 0;let l;if(n.length>1){const e=n[0].validStart,t=n[1].validStart;e&&t&&(l=t.nanos.sub(e.nanos).toNumber())}return Transaction._fromProtobufTransactions(new FileAppendTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,contents:i,chunkSize:c,maxChunks:u,chunkInterval:l}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}getRequiredChunks(){if(null==this._contents)return 1;return Math.ceil(this._contents.length/this._chunkSize)}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode(e),this}get maxChunks(){return this._maxChunks}setMaxChunks(e){if(e<=0)throw new Error("Max chunks must be greater than 0");return this._requireNotFrozen(),this._maxChunks=e,this}get chunkSize(){return this._chunkSize}setChunkSize(e){if(e<=0)throw new Error("Chunk size must be greater than 0");return this._chunkSize=e,this}get chunkInterval(){return this._chunkInterval}setChunkInterval(e){return this._chunkInterval=e,this}freezeWith(e){if(super.freezeWith(e),null==this._contents)return this;let t=this._getTransactionId();this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<this.getRequiredChunks();e++){this._transactionIds.push(t),this._transactionIds.advance();for(const e of this._nodeAccountIds.list)this._signedTransactions.push(this._makeSignedTransaction(e));t=new TransactionId(t.accountId,new Timestamp(t.validStart.seconds,t.validStart.nanos.add(this._chunkInterval)))}return this._transactionIds.advance(),this._transactionIds.setLocked(),this}schedule(){if(this._requireNotFrozen(),null!=this._contents&&this._contents.length>this._chunkSize)throw new Error(`cannot schedule \`FileAppendTransaction\` with message over ${this._chunkSize} bytes`);return super.schedule()}async execute(e,t){return(await this.executeAll(e,t))[0]}async executeAll(e,t){if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot execute \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);super._isFrozen()||this.freezeWith(e);const n=this._getTransactionId(),r=e.operatorAccountId;null!=r&&r.equals(n.accountId)&&await super.signWithOperator(e);const o=[];let a=t;for(let t=0;t<this._transactionIds.length;t++){const t=Date.now(),n=await super.execute(e,a);null!=a&&(a=Date.now()-t),await n.getReceipt(e),o.push(n)}return o}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.appendContent(t)}_getTransactionDataCase(){return"fileAppend"}_buildIncompleteTransactions(){const e=AccountId.fromString("0.0.0"),t=this.transactionId?.accountId||e,n=this.transactionId?.validStart||Timestamp.fromDate(new Date);if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<this.getRequiredChunks();e++){let r=TransactionId.withValidStart(t,n.plusNanos(this._chunkInterval*e));if(this._transactionIds.push(r),this._transactionIds.advance(),0===this._nodeAccountIds.list.length)this._transactions.push(this._makeSignedTransaction(null));else for(const e of this._nodeAccountIds.list)this._transactions.push(this._makeSignedTransaction(e))}this._transactionIds.advance(),this._transactionIds.setLocked()}_buildAllTransactions(){if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);for(let e=0;e<this._signedTransactions.length;e++)this._buildTransaction(e)}_getLogId(){return`FileAppendTransaction:${this._transactionIds.current.validStart.toString()}`}_makeTransactionData(){const e=null!=this._contents?this._contents.length:0,t=this._transactionIds.index*this._chunkSize,n=Math.min(t+this._chunkSize,e);return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contents:null!=this._contents?this._contents.slice(t,n):null}}}TRANSACTION_REGISTRY.set("fileAppend",FileAppendTransaction._fromProtobuf);class FileDeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].fileDelete;return Transaction._fromProtobufTransactions(new FileDeleteTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.deleteFile(t)}_getTransactionDataCase(){return"fileDelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null}}_getLogId(){return`FileDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileDelete",FileDeleteTransaction._fromProtobuf);class ContractCreateTransaction extends Transaction{constructor(e={}){super(),this._bytecodeFileId=null,this._bytecode=null,this._adminKey=null,this._gas=null,this._initialBalance=null,this._proxyAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._constructorParameters=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._defaultMaxTransactionFee=new Hbar(20),this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=!1,this._autoRenewAccountId=null,this._hooks=[],null!=e.hooks&&(this._hooks=e.hooks),null!=e.bytecodeFileId&&this.setBytecodeFileId(e.bytecodeFileId),null!=e.bytecode&&this.setBytecode(e.bytecode),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.gas&&this.setGas(e.gas),null!=e.initialBalance&&this.setInitialBalance(e.initialBalance),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.constructorParameters&&this.setConstructorParameters(e.constructorParameters),null!=e.contractMemo&&this.setContractMemo(e.contractMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].contractCreateInstance;return Transaction._fromProtobufTransactions(new ContractCreateTransaction({bytecodeFileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,gas:null!=a.gas?a.gas:void 0,initialBalance:null!=a.initialBalance?Hbar.fromTinybars(a.initialBalance):void 0,proxyAccountId:null!=a.proxyAccountID?AccountId._fromProtobuf(a.proxyAccountID):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,constructorParameters:null!=a.constructorParameters?a.constructorParameters:void 0,contractMemo:null!=a.memo?a.memo:void 0,maxAutomaticTokenAssociations:null!=a.maxAutomaticTokenAssociations?a.maxAutomaticTokenAssociations:void 0,stakedAccountId:null!=a.stakedAccountId?AccountId._fromProtobuf(a.stakedAccountId):void 0,stakedNodeId:null!=a.stakedNodeId?a.stakedNodeId:void 0,declineStakingReward:1==a.declineReward,autoRenewAccountId:null!=a.autoRenewAccountId?AccountId._fromProtobuf(a.autoRenewAccountId):void 0}),e,t,n,r,o)}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(e){return this._requireNotFrozen(),this._bytecodeFileId="string"==typeof e?FileId.fromString(e):e.clone(),this._bytecode=null,this}get bytecode(){return this._bytecode}setBytecode(e){return this._requireNotFrozen(),this._bytecode=e,this._bytecodeFileId=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get gas(){return this._gas}setGas(e){if(this._requireNotFrozen(),this._gas=e instanceof Long?e:Long.fromValue(e),this._gas.lessThan(0))throw new Error("Gas cannot be negative number");return this}get initialBalance(){return this._initialBalance}setInitialBalance(e){return this._requireNotFrozen(),this._initialBalance=e instanceof Hbar?e:new Hbar(e),this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get constructorParameters(){return this._constructorParameters}setConstructorParameters(e){return this._requireNotFrozen(),this._constructorParameters=e instanceof ContractFunctionParameters?e._build():e,this}get contractMemo(){return this._contractMemo}setContractMemo(e){return this._requireNotFrozen(),this._contractMemo=e,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._maxAutomaticTokenAssociations=e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this._stakedNodeId=null,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this._stakedAccountId=null,this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?AccountId.fromString(e):e,this}_validateChecksums(e){null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}addHook(e){return this._hooks.push(e),this}setHooks(e){return this._hooks=e,this}get hooks(){return this._hooks}_execute(e,t){return e.smartContract.createContract(t)}_getTransactionDataCase(){return"contractCreateInstance"}_makeTransactionData(){return{fileID:null!=this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,initcode:this._bytecode,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,gas:this._gas,initialBalance:null!=this._initialBalance?this._initialBalance.toTinybars():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),constructorParameters:this._constructorParameters,memo:this._contractMemo,maxAutomaticTokenAssociations:this._maxAutomaticTokenAssociations,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:this.declineStakingRewards,autoRenewAccountId:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,hookCreationDetails:this.hooks.map(e=>e._toProtobuf())}}_getLogId(){return`ContractCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractCreateInstance",ContractCreateTransaction._fromProtobuf);class ContractCreateFlow{constructor(){this._bytecode=null,this._contractCreate=new ContractCreateTransaction,this._signerPublicKeys=new Set,this._publicKeys=[],this._transactionSigners=[],this._maxChunks=null}get maxChunks(){return this._maxChunks}setMaxChunks(e){return this._maxChunks=e,this}get bytecode(){return this._bytecode}setBytecode(e){return this._bytecode=e instanceof Uint8Array?e:encode(e),this}get adminKey(){return this._contractCreate.adminKey}setAdminKey(e){return this._contractCreate.setAdminKey(e),this}get gas(){return this._contractCreate.gas}setGas(e){return this._contractCreate.setGas(e),this}get initialBalance(){return this._contractCreate.initialBalance}setInitialBalance(e){return this._contractCreate.setInitialBalance(e),this}get proxyAccountId(){return this._contractCreate.proxyAccountId}setProxyAccountId(e){return this._contractCreate.setProxyAccountId(e),this}get autoRenewPeriod(){return this._contractCreate.autoRenewPeriod}setAutoRenewPeriod(e){return this._contractCreate.setAutoRenewPeriod(e),this}get constructorParameters(){return this._contractCreate.constructorParameters}setConstructorParameters(e){return this._contractCreate.setConstructorParameters(e),this}get contractMemo(){return this._contractCreate.contractMemo}setContractMemo(e){return this._contractCreate.setContractMemo(e),this}get maxAutomaticTokenAssociation(){return this._contractCreate.maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._contractCreate.setMaxAutomaticTokenAssociations(e),this}get stakedAccountId(){return this._contractCreate.stakedAccountId}setStakedAccountId(e){return this._contractCreate.setStakedAccountId(e),this}get stakedNodeId(){return this._contractCreate.stakedNodeId}setStakedNodeId(e){return this._contractCreate.setStakedNodeId(e),this}get declineStakingRewards(){return this._contractCreate.declineStakingRewards}setDeclineStakingReward(e){return this._contractCreate.setDeclineStakingReward(e),this}get autoRenewAccountId(){return this._contractCreate.autoRenewAccountId}setAutoRenewAccountId(e){return this._contractCreate.setAutoRenewAccountId(e),this}sign(e){return this.signWith(e.publicKey,t=>Promise.resolve(e.sign(t)))}signWith(e,t){const n=encode$4(e.toBytesRaw());return this._signerPublicKeys.has(n)||(this._publicKeys.push(e),this._transactionSigners.push(t)),this}async execute(e,t){if(null==this._bytecode)throw new Error("cannot create contract with no bytecode");const n=e.operatorPublicKey,r=(new FileCreateTransaction).setKeys(null!=n?[n]:[]).setContents(this._bytecode.subarray(0,Math.min(this._bytecode.length,2048))).freezeWith(e);await addSignersToTransaction(r,this._publicKeys,this._transactionSigners);let o=await r.execute(e,t);const a=(await o.getReceipt(e)).fileId;if(this._bytecode.length>2048){const n=(new FileAppendTransaction).setFileId(a).setContents(this._bytecode.subarray(2048)).freezeWith(e);await addSignersToTransaction(n,this._publicKeys,this._transactionSigners),await n.execute(e,t)}if(this._contractCreate.setBytecodeFileId(a).freezeWith(e),await addSignersToTransaction(this._contractCreate,this._publicKeys,this._transactionSigners),o=await this._contractCreate.execute(e,t),await o.getReceipt(e),null!=n){const n=(new FileDeleteTransaction).setFileId(a).freezeWith(e);await addSignersToTransaction(n,this._publicKeys,this._transactionSigners),await(await n.execute(e,t)).getReceipt(e)}return o}async executeWithSigner(e){if(null==this._bytecode)throw new Error("cannot create contract with no bytecode");if(null==e.getAccountKey)throw new Error("`Signer.getAccountKey()` is not implemented, but is required for `ContractCreateFlow`");const t=await e.getAccountKey();let n;if(t instanceof PublicKey)n=t;else{const e=Object.values(t._key._key._keyData),r=new Uint8Array(e);n=PublicKey.fromBytes(r)}const r=await(new FileCreateTransaction).setKeys(null!=n?[n]:[]).setContents(this._bytecode.subarray(0,Math.min(this._bytecode.length,2048))).freezeWithSigner(e);await r.signWithSigner(e),await addSignersToTransaction(r,this._publicKeys,this._transactionSigners);let o=await r.executeWithSigner(e);const a=(await o.getReceiptWithSigner(e)).fileId;if(this._bytecode.length>2048){let t=(new FileAppendTransaction).setFileId(a).setContents(this._bytecode.subarray(2048));null!=this._maxChunks&&t.setMaxChunks(this._maxChunks),t=await t.freezeWithSigner(e),await t.signWithSigner(e),await addSignersToTransaction(t,this._publicKeys,this._transactionSigners),await t.executeWithSigner(e)}if(this._contractCreate=await this._contractCreate.setBytecodeFileId(a).freezeWithSigner(e),this._contractCreate=await this._contractCreate.signWithSigner(e),await addSignersToTransaction(this._contractCreate,this._publicKeys,this._transactionSigners),o=await this._contractCreate.executeWithSigner(e),await o.getReceiptWithSigner(e),null!=t){const t=await(new FileDeleteTransaction).setFileId(a).freezeWithSigner(e);await t.signWithSigner(e),await addSignersToTransaction(t,this._publicKeys,this._transactionSigners),await(await t.executeWithSigner(e)).getReceiptWithSigner(e)}return o}}async function addSignersToTransaction(e,t,n){for(let r=0;r<t.length;r++)await e.signWith(t[r],n[r])}class ContractDeleteTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._transferAccountId=null,this._transferContractId=null,this._permanentRemoval=!1,null!=e.contractId&&this.setContractId(e.contractId),null!=e.transferAccountId&&this.setTransferAccountId(e.transferAccountId),null!=e.transferContractId&&this.setTransferContractId(e.transferContractId),null!=e.permanentRemoval&&this.setPermanentRemoval(e.permanentRemoval)}static _fromProtobuf(e,t,n,r,o){const a=o[0].contractDeleteInstance;return Transaction._fromProtobufTransactions(new ContractDeleteTransaction({contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0,transferAccountId:null!=a.transferAccountID?AccountId._fromProtobuf(a.transferAccountID):void 0,transferContractId:null!=a.transferContractID?ContractId._fromProtobuf(a.transferContractID):void 0,permanentRemoval:a.permanentRemoval??!1}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get transferContractId(){return this._transferContractId}setTransferContractId(e){return this._requireNotFrozen(),this._transferContractId=e instanceof ContractId?e:ContractId.fromString(e),this._transferAccountId=null,this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(e){return this._requireNotFrozen(),this._transferAccountId=e instanceof AccountId?e:AccountId.fromString(e),this._transferContractId=null,this}get permanentRemoval(){return this._permanentRemoval}setPermanentRemoval(e){return this._requireNotFrozen(),this._permanentRemoval=e,this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(e),null!=this._transferContractId&&this._transferContractId.validateChecksum(e)}_execute(e,t){return e.smartContract.deleteContract(t)}_getTransactionDataCase(){return"contractDeleteInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,transferAccountID:this._transferAccountId?this._transferAccountId._toProtobuf():null,transferContractID:null!=this._transferContractId?this._transferContractId._toProtobuf():null,permanentRemoval:this._permanentRemoval}}_getLogId(){return`ContractDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractDeleteInstance",ContractDeleteTransaction._fromProtobuf);class ContractExecuteTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._gas=null,this._amount=null,this._functionParameters=null,null!=e.contractId&&this.setContractId(e.contractId),null!=e.gas&&this.setGas(e.gas),null!=e.amount&&this.setPayableAmount(e.amount),null!=e.functionParameters?this.setFunctionParameters(e.functionParameters):null!=e.function&&this.setFunction(e.function.name,e.function.parameters)}static _fromProtobuf(e,t,n,r,o){const a=o[0].contractCall;return Transaction._fromProtobufTransactions(new ContractExecuteTransaction({contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0,gas:null!=a.gas?a.gas:void 0,amount:null!=a.amount?Hbar.fromTinybars(a.amount):void 0,functionParameters:null!=a.functionParameters?a.functionParameters:void 0}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get gas(){return this._gas}setGas(e){this._requireNotFrozen();const t=e instanceof Long?e:Long.fromValue(e);if(t.lt(0))throw new Error("Gas must be greater than 0");return this._gas=t,this}get payableAmount(){return this._amount}setPayableAmount(e,t=HbarUnit.Hbar){return this._requireNotFrozen(),this._amount=e instanceof Hbar?e:Hbar.from(e,t),this}get functionParameters(){return this._functionParameters}setFunctionParameters(e){return this._requireNotFrozen(),this._functionParameters=e,this}setFunction(e,t){return this._requireNotFrozen(),this._functionParameters=null!=t?t._build(e):(new ContractFunctionParameters)._build(e),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.contractCallMethod(t)}_getTransactionDataCase(){return"contractCall"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,gas:this._gas,amount:null!=this._amount?this._amount.toTinybars():null,functionParameters:this._functionParameters}}_getLogId(){return`ContractExecuteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractCall",ContractExecuteTransaction._fromProtobuf);const{proto:proto$4}=HieroProto;class ContractInfo{constructor(e){this.contractId=e.contractId,this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.storage=e.storage,this.contractMemo=e.contractMemo,this.balance=e.balance,this.isDeleted=e.isDeleted,this.tokenRelationships=e.tokenRelationships,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.ledgerId=e.ledgerId,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(e){const t=e.autoRenewPeriod.seconds;return new ContractInfo({contractId:ContractId._fromProtobuf(e.contractID),accountId:AccountId._fromProtobuf(e.accountID),contractAccountId:null!=e.contractAccountID?e.contractAccountID:"",adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,expirationTime:Timestamp._fromProtobuf(e.expirationTime),autoRenewPeriod:new Duration(t),autoRenewAccountId:null!=e.autoRenewAccountId?AccountId._fromProtobuf(e.autoRenewAccountId):null,storage:null!=e.storage?e.storage instanceof Long?e.storage:Long.fromValue(e.storage):Long.ZERO,contractMemo:null!=e.memo?e.memo:"",balance:Hbar.fromTinybars(null!=e.balance?e.balance:0),isDeleted:e.deleted,tokenRelationships:TokenRelationshipMap._fromProtobuf(null!=e.tokenRelationships?e.tokenRelationships:[]),ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,stakingInfo:null!=e.stakingInfo?StakingInfo._fromProtobuf(e.stakingInfo):null,maxAutomaticTokenAssociations:null!=e.maxAutomaticTokenAssociations?Long.isLong(e.maxAutomaticTokenAssociations)?e.maxAutomaticTokenAssociations:Long.fromValue(e.maxAutomaticTokenAssociations):Long.ZERO})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccountId:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,storage:this.storage,memo:this.contractMemo,balance:this.balance.toTinybars(),deleted:this.isDeleted,tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toNumber()}}static fromBytes(e){return ContractInfo._fromProtobuf(proto$4.ContractGetInfoResponse.ContractInfo.decode(e))}toBytes(){return proto$4.ContractGetInfoResponse.ContractInfo.encode(this._toProtobuf()).finish()}}class ContractInfoQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.contractGetInfo;return new ContractInfoQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.getContractInfo(t)}async getCost(e){return super.getCost(e)}_mapResponseHeader(e){return e.contractGetInfo.header}_mapResponse(e,t,n){const r=e.contractGetInfo;return Promise.resolve(ContractInfo._fromProtobuf(r.contractInfo))}_onMakeRequest(e){return{contractGetInfo:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`ContractInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractGetInfo",ContractInfoQuery._fromProtobuf);class ContractUpdateTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._expirationTime=null,this._adminKey=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._bytecodeFileId=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,this._autoRenewAccountId=null,this._hooksToBeCreated=[],this._hooksToBeDeleted=[],null!=e.contractId&&this.setContractId(e.contractId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.bytecodeFileId&&this.setBytecodeFileId(e.bytecodeFileId),null!=e.contractMemo&&this.setContractMemo(e.contractMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.hooksToBeCreated&&this.setHooksToCreate(e.hooksToBeCreated),null!=e.hooksToBeDeleted&&this.setHooksToDelete(e.hooksToBeDeleted)}static _fromProtobuf(e,t,n,r,o){const a=o[0].contractUpdateInstance;let i,s,c;return null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds&&(i=a.autoRenewPeriod.seconds),null!=a.memoWrapper&&Object.hasOwn(a.memoWrapper,"value")&&null!=a.memoWrapper.value&&(s=a.memoWrapper.value),null!=a.maxAutomaticTokenAssociations&&null!=a.maxAutomaticTokenAssociations.value&&(c=a.maxAutomaticTokenAssociations.value),Transaction._fromProtobufTransactions(new ContractUpdateTransaction({contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0,bytecodeFileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,proxyAccountId:null!=a.proxyAccountID?AccountId._fromProtobuf(a.proxyAccountID):void 0,autoRenewPeriod:i,contractMemo:s,maxAutomaticTokenAssociations:c,stakedAccountId:null!=a.stakedAccountId?AccountId._fromProtobuf(a.stakedAccountId):void 0,stakedNodeId:null!=a.stakedNodeId?a.stakedNodeId:void 0,declineStakingReward:null!=a.declineReward&&1==Boolean(a.declineReward),autoRenewAccountId:null!=a.autoRenewAccountId?AccountId._fromProtobuf(a.autoRenewAccountId):void 0}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(e){return console.warn("Deprecated: there is no replacement"),this._requireNotFrozen(),this._bytecodeFileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get contractMemo(){return this._contractMemo}setContractMemo(e){return this._requireNotFrozen(),this._contractMemo=e,this}clearContractMemo(){return this._requireNotFrozen(),this._contractMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations=e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?AccountId.fromString(e):e,this}clearAutoRenewAccountId(){return this._autoRenewAccountId=new AccountId(0),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e),null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}addHookToCreate(e){return this._hooksToBeCreated.push(e),this}setHooksToCreate(e){return this._hooksToBeCreated=e,this}get hooksToCreate(){return this._hooksToBeCreated}addHookToDelete(e){return this._hooksToBeDeleted.push(e),this}setHooksToDelete(e){return this._hooksToBeDeleted=e,this}get hooksToDelete(){return this._hooksToBeDeleted}_execute(e,t){return e.smartContract.updateContract(t)}_getTransactionDataCase(){return"contractUpdateInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,fileID:this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,memoWrapper:null!=this._contractMemo?{value:this._contractMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null,autoRenewAccountId:null!=this._autoRenewAccountId?"0.0.0"==this._autoRenewAccountId.toString()?libExports.proto.AccountID.create():this._autoRenewAccountId._toProtobuf():null,hookIdsToDelete:null!=this._hooksToBeDeleted?this._hooksToBeDeleted:null,hookCreationDetails:null!=this._hooksToBeCreated?this._hooksToBeCreated.map(e=>e._toProtobuf()):null}}_getLogId(){return`ContractUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractUpdateInstance",ContractUpdateTransaction._fromProtobuf);class FeeAssessmentMethod{constructor(e){this._value=e,Object.freeze(this)}toString(){switch(this){case FeeAssessmentMethod.Inclusive:return"INCLUSIVE";case FeeAssessmentMethod.Exclusive:return"EXCLUSIVE";default:return`UNKNOWN (${this._value.toString()})`}}static _fromValue(e){switch(e){case!1:return FeeAssessmentMethod.Inclusive;case!0:return FeeAssessmentMethod.Exclusive}}valueOf(){return this._value}}FeeAssessmentMethod.Inclusive=new FeeAssessmentMethod(!1),FeeAssessmentMethod.Exclusive=new FeeAssessmentMethod(!0);class CustomFractionalFee extends CustomFee{constructor(e={}){super(e),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator),this._min=null,null!=e.min&&this.setMin(e.min),this._max,null!=e.max&&this.setMax(e.max),this._assessmentMethod,null!=e.assessmentMethod&&this.setAssessmentMethod(e.assessmentMethod)}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?Long.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?Long.fromNumber(e):e,this}get min(){return this._min}setMin(e){return this._min="number"==typeof e?Long.fromNumber(e):e,this}get max(){return this._max}setMax(e){return this._max="number"==typeof e?Long.fromNumber(e):e,this}get assessmentMethod(){return this._assessmentMethod}setAssessmentMethod(e){return this._assessmentMethod=e,this}static _fromProtobuf(e){const t=e.fractionalFee,n=t.fractionalAmount;return new CustomFractionalFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0,min:null!=t.minimumAmount?t.minimumAmount:void 0,max:null!=t.maximumAmount?t.maximumAmount:void 0,assessmentMethod:null!=t.netOfTransfers?new FeeAssessmentMethod(t.netOfTransfers):void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fractionalFee:{fractionalAmount:{numerator:this._numerator,denominator:this._denominator},minimumAmount:this._min,maximumAmount:this._max,netOfTransfers:null!=this._assessmentMethod&&this._assessmentMethod.valueOf()}}}}class CustomRoyalyFee extends CustomFee{constructor(e={}){super(e),this._fallbackFee=null,null!=e.fallbackFee&&this.setFallbackFee(e.fallbackFee),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator)}get fallbackFee(){return this._fallbackFee}setFallbackFee(e){return this._fallbackFee=e,this}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?Long.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?Long.fromNumber(e):e,this}static _fromProtobuf(e){const t=e.royaltyFee,n=t.exchangeValueFraction;return new CustomRoyalyFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,fallbackFee:null!=t.fallbackFee?CustomFixedFee._fromProtobuf({fixedFee:t.fallbackFee}):void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,royaltyFee:{exchangeValueFraction:{numerator:this._numerator,denominator:this._denominator},fallbackFee:null!=this._fallbackFee?this._fallbackFee._toProtobuf().fixedFee:null}}}}class DelegateContractId extends ContractId{constructor(e,t,n,r){super(e,t,n,r)}static fromString(e){return new DelegateContractId(ContractId.fromString(e))}static _fromProtobuf(e){return new DelegateContractId(ContractId._fromProtobuf(e))}static fromBytes(e){return new DelegateContractId(ContractId.fromBytes(e))}static fromSolidityAddress(e){return new DelegateContractId(ContractId.fromSolidityAddress(e))}clone(){const e=new DelegateContractId(this);return e._checksum=this._checksum,e}_toProtobufKey(){return{delegatableContractId:this._toProtobuf()}}static __fromProtobufKey(e){return DelegateContractId._fromProtobuf(e)}}CACHE.setDelegateContractId(e=>DelegateContractId.__fromProtobufKey(e));class EthereumTransaction extends Transaction{constructor(e={}){super(),this._ethereumData=null,this._callDataFileId=null,this._maxGasAllowance=null,null!=e.ethereumData&&this.setEthereumData(e.ethereumData),null!=e.callData&&this.setCallDataFileId(e.callData),null!=e.callDataFileId&&this.setCallDataFileId(e.callDataFileId),null!=e.maxGasAllowance&&this.setMaxGasAllowanceHbar(e.maxGasAllowance)}static _fromProtobuf(e,t,n,r,o){const a=o[0].ethereumTransaction;return Transaction._fromProtobufTransactions(new EthereumTransaction({ethereumData:null!=a.ethereumData?a.ethereumData:void 0,callData:null!=a.callData?FileId._fromProtobuf(a.callData):void 0,maxGasAllowance:null!=a.maxGasAllowance?Hbar.fromTinybars(a.maxGasAllowance):void 0}),e,t,n,r,o)}get ethereumData(){return this._ethereumData}setEthereumData(e){return this._requireNotFrozen(),this._ethereumData=e,this}get callData(){return this.callDataFileId}setCallData(e){return this.setCallDataFileId(e)}get callDataFileId(){return this._callDataFileId}setCallDataFileId(e){return this._requireNotFrozen(),this._callDataFileId=e,this}get maxGasAllowance(){return this._maxGasAllowance}setMaxGasAllowance(e){return this.setMaxGasAllowanceHbar(e)}setMaxGasAllowanceHbar(e){return this._requireNotFrozen(),this._maxGasAllowance=e instanceof Hbar?e:new Hbar(e),this}_validateChecksums(e){null!=this._ethereumData&&this._ethereumData instanceof FileId&&this._ethereumData.validateChecksum(e)}_execute(e,t){return e.smartContract.callEthereum(t)}_getTransactionDataCase(){return"ethereumTransaction"}_makeTransactionData(){return{ethereumData:this._ethereumData,callData:null!=this._callDataFileId?this._callDataFileId._toProtobuf():null,maxGasAllowance:null!=this._maxGasAllowance?this._maxGasAllowance.toTinybars():null}}_getLogId(){return`EthereumTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("ethereumTransaction",EthereumTransaction._fromProtobuf);class EthereumTransactionData{constructor(e){this.callData=e.callData}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");switch(e[0]){case 1:return CACHE.ethereumTransactionDataEip2930FromBytes(e);case 2:return CACHE.ethereumTransactionDataEip1559FromBytes(e);case 4:return CACHE.ethereumTransactionDataEip7702FromBytes(e);default:return CACHE.ethereumTransactionDataLegacyFromBytes(e)}}toBytes(){throw new Error("not implemented")}toString(){throw new Error("not implemented")}toJSON(){throw new Error("not implemented")}}class EthereumTransactionDataLegacy extends EthereumTransactionData{constructor(e){super(e),this.nonce=e.nonce,this.gasPrice=e.gasPrice,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.v=e.v,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decodeRlp(e);if(9!=t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataLegacy({nonce:decode$7(t[0]),gasPrice:decode$7(t[1]),gasLimit:decode$7(t[2]),to:decode$7(t[3]),value:decode$7(t[4]),callData:decode$7(t[5]),v:decode$7(t[6]),r:decode$7(t[7]),s:decode$7(t[8])})}toBytes(){return decode$7(encodeRlp([this.nonce,this.gasPrice,this.gasLimit,this.to,this.value,this.callData,this.v,this.r,this.s]))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{nonce:encode$4(this.nonce),gasPrice:encode$4(this.gasPrice),gasLimit:encode$4(this.gasLimit),to:encode$4(this.to),value:encode$4(this.value),callData:encode$4(this.callData),v:encode$4(this.v),r:encode$4(this.r),s:encode$4(this.s)}}}CACHE.setEthereumTransactionDataLegacyFromBytes(e=>EthereumTransactionDataLegacy.fromBytes(e));class EthereumTransactionDataEip1559 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.maxPriorityGas=e.maxPriorityGas,this.maxGas=e.maxGas,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decodeRlp(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(12!=t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataEip1559({chainId:decode$7(t[0]),nonce:decode$7(t[1]),maxPriorityGas:decode$7(t[2]),maxGas:decode$7(t[3]),gasLimit:decode$7(t[4]),to:decode$7(t[5]),value:decode$7(t[6]),callData:decode$7(t[7]),accessList:t[8].map(e=>decode$7(e)),recId:decode$7(t[9]),r:decode$7(t[10]),s:decode$7(t[11])})}toBytes(){return decode$7("02"+encodeRlp([this.chainId,this.nonce,this.maxPriorityGas,this.maxGas,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$4(this.chainId),nonce:encode$4(this.nonce),maxPriorityGas:encode$4(this.maxPriorityGas),maxGas:encode$4(this.maxGas),gasLimit:encode$4(this.gasLimit),to:encode$4(this.to),value:encode$4(this.value),callData:encode$4(this.callData),accessList:this.accessList.map(e=>encode$4(e)),recId:encode$4(this.recId),r:encode$4(this.r),s:encode$4(this.s)}}}CACHE.setEthereumTransactionDataEip1559FromBytes(e=>EthereumTransactionDataEip1559.fromBytes(e));class EthereumTransactionDataEip2930 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.gasPrice=e.gasPrice,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decodeRlp(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(11!==t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataEip2930({chainId:decode$7(t[0]),nonce:decode$7(t[1]),gasPrice:decode$7(t[2]),gasLimit:decode$7(t[3]),to:decode$7(t[4]),value:decode$7(t[5]),callData:decode$7(t[6]),accessList:t[7].map(e=>decode$7(e)),recId:decode$7(t[8]),r:decode$7(t[9]),s:decode$7(t[10])})}toBytes(){return decode$7("01"+encodeRlp([this.chainId,this.nonce,this.gasPrice,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$4(this.chainId),nonce:encode$4(this.nonce),gasPrice:encode$4(this.gasPrice),gasLimit:encode$4(this.gasLimit),to:encode$4(this.to),value:encode$4(this.value),callData:encode$4(this.callData),accessList:this.accessList.map(e=>encode$4(e)),recId:encode$4(this.recId),r:encode$4(this.r),s:encode$4(this.s)}}}CACHE.setEthereumTransactionDataEip2930FromBytes(e=>EthereumTransactionDataEip2930.fromBytes(e));class EthereumTransactionDataEip7702 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.maxPriorityGas=e.maxPriorityGas,this.maxGas=e.maxGas,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.callData=e.callData,this.authorizationList=e.authorizationList,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decodeRlp(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(13!==t.length)throw new Error("invalid ethereum transaction data");if(!Array.isArray(t[9]))throw new Error("authorization list must be an array");const n=t[9].map(e=>{if(!Array.isArray(e)||6!==e.length)throw new Error("invalid authorization list entry: must be [chainId, contractAddress, nonce, yParity, r, s]");return[decode$7(e[0]),decode$7(e[1]),decode$7(e[2]),decode$7(e[3]),decode$7(e[4]),decode$7(e[5])]});return new EthereumTransactionDataEip7702({chainId:decode$7(t[0]),nonce:decode$7(t[1]),maxPriorityGas:decode$7(t[2]),maxGas:decode$7(t[3]),gasLimit:decode$7(t[4]),to:decode$7(t[5]),value:decode$7(t[6]),callData:decode$7(t[7]),accessList:t[8].map(e=>decode$7(e)),authorizationList:n,recId:decode$7(t[10]),r:decode$7(t[11]),s:decode$7(t[12])})}toBytes(){return decode$7("04"+encodeRlp([this.chainId,this.nonce,this.maxPriorityGas,this.maxGas,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.authorizationList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$4(this.chainId),nonce:encode$4(this.nonce),maxPriorityGas:encode$4(this.maxPriorityGas),maxGas:encode$4(this.maxGas),gasLimit:encode$4(this.gasLimit),to:encode$4(this.to),value:encode$4(this.value),callData:encode$4(this.callData),authorizationList:this.authorizationList.map(([e,t,n,r,o,a])=>[encode$4(e),encode$4(t),encode$4(n),encode$4(r),encode$4(o),encode$4(a)]),accessList:this.accessList.map(e=>encode$4(e)),recId:encode$4(this.recId),r:encode$4(this.r),s:encode$4(this.s)}}}CACHE.setEthereumTransactionDataEip7702FromBytes(e=>EthereumTransactionDataEip7702.fromBytes(e));class EthereumFlow{constructor(e={}){this._ethereumData=null,this._callDataFileId=null,this._maxGasAllowance=null,null!=e.ethereumData&&this.setEthereumData(e.ethereumData),null!=e.maxGasAllowance&&this.setMaxGasAllowanceHbar(e.maxGasAllowance),this._maxChunks=null}get maxChunks(){return this._maxChunks}setMaxChunks(e){return this._maxChunks=e,this}get ethereumData(){return this._ethereumData}setEthereumData(e){return this._ethereumData=e instanceof Uint8Array?EthereumTransactionData.fromBytes(e):e,this}get maxGasAllowance(){return this._maxGasAllowance}setMaxGasAllowance(e){return this.setMaxGasAllowanceHbar(e)}setMaxGasAllowanceHbar(e){return this._maxGasAllowance=e instanceof Hbar?e:new Hbar(e),this}async execute(e){if(null==this._ethereumData)throw new Error("cannot submit ethereum transaction with no ethereum data");const t=new EthereumTransaction,n=this._ethereumData.toBytes();if(null!=this._maxGasAllowance&&t.setMaxGasAllowanceHbar(this._maxGasAllowance),null!=this._callDataFileId){if(0===this._ethereumData.callData.length)throw new Error("call data file ID provided, but ethereum data already contains call data");t.setEthereumData(n).setCallDataFileId(this._callDataFileId)}else if(n.length<=128e3)t.setEthereumData(n);else{const n=await createFile(this._ethereumData.callData,e,this._maxChunks);this._ethereumData.callData=new Uint8Array,t.setEthereumData(this._ethereumData.toBytes()).setCallDataFileId(n)}return t.execute(e)}}async function createFile(e,t,n){const r=encode$4(e),o=(await(await(new FileCreateTransaction).setContents(r.substring(0,4096)).setKeys(t.operatorPublicKey?[t.operatorPublicKey]:[]).execute(t)).getReceipt(t)).fileId;if(e.length>4096){let e=(new FileAppendTransaction).setFileId(o).setContents(r.substring(4096,r.length));null!=n&&e.setMaxChunks(n),await(await e.execute(t)).getReceipt(t)}return o}const{proto:proto$3}=HieroProto;class ExchangeRates{constructor(e){this.currentRate=e.currentRate,this.nextRate=e.nextRate,Object.freeze(this)}static _fromProtobuf(e){return new ExchangeRates({currentRate:ExchangeRate._fromProtobuf(e.currentRate),nextRate:ExchangeRate._fromProtobuf(e.nextRate)})}_toProtobuf(){return{currentRate:this.currentRate._toProtobuf(),nextRate:this.nextRate._toProtobuf()}}static fromBytes(e){return ExchangeRates._fromProtobuf(proto$3.ExchangeRateSet.decode(e))}}class FeeComponents{constructor(e={}){this.min=e.min,this.max=e.max,this.constant=e.constant,this.transactionBandwidthByte=e.transactionBandwidthByte,this.transactionVerification=e.transactionVerification,this.transactionRamByteHour=e.transactionRamByteHour,this.transactionStorageByteHour=e.transactionStorageByteHour,this.contractTransactionGas=e.contractTransactionGas,this.transferVolumeHbar=e.transferVolumeHbar,this.responseMemoryByte=e.responseMemoryByte,this.responseDiskByte=e.responseDiskByte}static fromBytes(e){return FeeComponents._fromProtobuf(libExports.proto.FeeComponents.decode(e))}static _fromProtobuf(e){return new FeeComponents({min:null!=e.min?e.min:void 0,max:null!=e.max?e.max:void 0,constant:null!=e.constant?e.constant:void 0,transactionBandwidthByte:null!=e.bpt?e.bpt:void 0,transactionVerification:null!=e.vpt?e.vpt:void 0,transactionRamByteHour:null!=e.rbh?e.rbh:void 0,transactionStorageByteHour:null!=e.sbh?e.sbh:void 0,contractTransactionGas:null!=e.gas?e.gas:void 0,transferVolumeHbar:null!=e.tv?e.tv:void 0,responseMemoryByte:null!=e.bpr?e.bpr:void 0,responseDiskByte:null!=e.sbpr?e.sbpr:void 0})}_toProtobuf(){return{min:null!=this.min?this.min:void 0,max:null!=this.max?this.max:void 0,constant:null!=this.constant?this.constant:void 0,bpt:null!=this.transactionBandwidthByte?this.transactionBandwidthByte:void 0,vpt:null!=this.transactionVerification?this.transactionVerification:void 0,rbh:null!=this.transactionRamByteHour?this.transactionRamByteHour:void 0,sbh:null!=this.transactionStorageByteHour?this.transactionStorageByteHour:void 0,gas:null!=this.contractTransactionGas?this.contractTransactionGas:void 0,tv:null!=this.transferVolumeHbar?this.transferVolumeHbar:void 0,bpr:null!=this.responseMemoryByte?this.responseMemoryByte:void 0,sbpr:null!=this.responseDiskByte?this.responseDiskByte:void 0}}toBytes(){return libExports.proto.FeeComponents.encode(this._toProtobuf()).finish()}}class FeeDataType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case FeeDataType.Default:return"DEFAULT";case FeeDataType.TokenFungibleCommon:return"TOKEN_FUNGIBLE_COMMON";case FeeDataType.TokenNonFungibleUnique:return"TOKEN_NON_FUNGIBLE_UNIQUE";case FeeDataType.TokenFungibleCommonWithCustomFees:return"TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES";case FeeDataType.TokenNonFungibleUniqueWithCustomFees:return"TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES";case FeeDataType.ScheduleCreateContractCall:return"SCHEDULE_CREATE_CONTRACT_CALL";case FeeDataType.TopicCreateWithCustomFees:return"TOPIC_CREATE_WITH_CUSTOM_FEES";case FeeDataType.SubmitMessageWithCustomFees:return"SUBMIT_MESSAGE_WITH_CUSTOM_FEES";case FeeDataType.CryptoTransferWithHooks:return"CRYPTO_TRANSFER_WITH_HOOKS";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return FeeDataType.Default;case 1:return FeeDataType.TokenFungibleCommon;case 2:return FeeDataType.TokenNonFungibleUnique;case 3:return FeeDataType.TokenFungibleCommonWithCustomFees;case 4:return FeeDataType.TokenNonFungibleUniqueWithCustomFees;case 5:return FeeDataType.ScheduleCreateContractCall;case 6:return FeeDataType.TopicCreateWithCustomFees;case 7:return FeeDataType.SubmitMessageWithCustomFees;case 8:return FeeDataType.CryptoTransferWithHooks}throw new Error(`(BUG) SubType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}FeeDataType.Default=new FeeDataType(0),FeeDataType.TokenFungibleCommon=new FeeDataType(1),FeeDataType.TokenNonFungibleUnique=new FeeDataType(2),FeeDataType.TokenFungibleCommonWithCustomFees=new FeeDataType(3),FeeDataType.TokenNonFungibleUniqueWithCustomFees=new FeeDataType(4),FeeDataType.ScheduleCreateContractCall=new FeeDataType(5),FeeDataType.TopicCreateWithCustomFees=new FeeDataType(6),FeeDataType.SubmitMessageWithCustomFees=new FeeDataType(7),FeeDataType.CryptoTransferWithHooks=new FeeDataType(8);class FeeData{constructor(e={}){this.nodedata=e.nodedata,this.networkdata=e.networkdata,this.servicedata=e.servicedata,this.feeDataType=e.feeDataType}static fromBytes(e){return FeeData._fromProtobuf(libExports.proto.FeeData.decode(e))}static _fromProtobuf(e){return new FeeData({nodedata:null!=e.nodedata?FeeComponents._fromProtobuf(e.nodedata):void 0,networkdata:null!=e.networkdata?FeeComponents._fromProtobuf(e.networkdata):void 0,servicedata:null!=e.servicedata?FeeComponents._fromProtobuf(e.servicedata):void 0,feeDataType:null!=e.subType?FeeDataType._fromCode(e.subType):void 0})}_toProtobuf(){return{nodedata:null!=this.nodedata?this.nodedata._toProtobuf():void 0,networkdata:null!=this.networkdata?this.networkdata._toProtobuf():void 0,servicedata:null!=this.servicedata?this.servicedata._toProtobuf():void 0,subType:null!=this.feeDataType?this.feeDataType.valueOf():void 0}}toBytes(){return libExports.proto.FeeData.encode(this._toProtobuf()).finish()}}class RequestType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case RequestType.None:return"NONE";case RequestType.CryptoTransfer:return"CryptoTransfer";case RequestType.CryptoUpdate:return"CryptoUpdate";case RequestType.CryptoDelete:return"CryptoDelete";case RequestType.CryptoAddLiveHash:return"CryptoAddLiveHash";case RequestType.CryptoDeleteLiveHash:return"CryptoDeleteLiveHash";case RequestType.ContractCall:return"ContractCall";case RequestType.ContractCreate:return"ContractCreate";case RequestType.ContractUpdate:return"ContractUpdate";case RequestType.FileCreate:return"FileCreate";case RequestType.FileAppend:return"FileAppend";case RequestType.FileUpdate:return"FileUpdate";case RequestType.FileDelete:return"FileDelete";case RequestType.CryptoGetAccountBalance:return"CryptoGetAccountBalance";case RequestType.CryptoGetAccountRecords:return"CryptoGetAccountRecords";case RequestType.CryptoGetInfo:return"CryptoGetInfo";case RequestType.ContractCallLocal:return"ContractCallLocal";case RequestType.ContractGetInfo:return"ContractGetInfo";case RequestType.ContractGetBytecode:return"ContractGetBytecode";case RequestType.GetBySolidityID:return"GetBySolidityID";case RequestType.GetByKey:return"GetByKey";case RequestType.CryptoGetLiveHash:return"CryptoGetLiveHash";case RequestType.CryptoGetStakers:return"CryptoGetStakers";case RequestType.FileGetContents:return"FileGetContents";case RequestType.FileGetInfo:return"FileGetInfo";case RequestType.TransactionGetRecord:return"TransactionGetRecord";case RequestType.ContractGetRecords:return"ContractGetRecords";case RequestType.CryptoCreate:return"CryptoCreate";case RequestType.SystemDelete:return"SystemDelete";case RequestType.SystemUndelete:return"SystemUndelete";case RequestType.ContractDelete:return"ContractDelete";case RequestType.Freeze:return"Freeze";case RequestType.CreateTransactionRecord:return"CreateTransactionRecord";case RequestType.CryptoAccountAutoRenew:return"CryptoAccountAutoRenew";case RequestType.ContractAutoRenew:return"ContractAutoRenew";case RequestType.GetVersionInfo:return"GetVersionInfo";case RequestType.TransactionGetReceipt:return"TransactionGetReceipt";case RequestType.ConsensusCreateTopic:return"ConsensusCreateTopic";case RequestType.ConsensusUpdateTopic:return"ConsensusUpdateTopic";case RequestType.ConsensusDeleteTopic:return"ConsensusDeleteTopic";case RequestType.ConsensusGetTopicInfo:return"ConsensusGetTopicInfo";case RequestType.ConsensusSubmitMessage:return"ConsensusSubmitMessage";case RequestType.UncheckedSubmit:return"UncheckedSubmit";case RequestType.TokenCreate:return"TokenCreate";case RequestType.TokenGetInfo:return"TokenGetInfo";case RequestType.TokenFreezeAccount:return"TokenFreezeAccount";case RequestType.TokenUnfreezeAccount:return"TokenUnfreezeAccount";case RequestType.TokenGrantKycToAccount:return"TokenGrantKycToAccount";case RequestType.TokenRevokeKycFromAccount:return"TokenRevokeKycFromAccount";case RequestType.TokenDelete:return"TokenDelete";case RequestType.TokenUpdate:return"TokenUpdate";case RequestType.TokenMint:return"TokenMint";case RequestType.TokenBurn:return"TokenBurn";case RequestType.TokenAccountWipe:return"TokenAccountWipe";case RequestType.TokenAssociateToAccount:return"TokenAssociateToAccount";case RequestType.TokenDissociateFromAccount:return"TokenDissociateFromAccount";case RequestType.ScheduleCreate:return"ScheduleCreate";case RequestType.ScheduleDelete:return"ScheduleDelete";case RequestType.ScheduleSign:return"ScheduleSign";case RequestType.ScheduleGetInfo:return"ScheduleGetInfo";case RequestType.TokenGetAccountNftInfos:return"TokenGetAccountNftInfos";case RequestType.TokenGetNftInfo:return"TokenGetNftInfo";case RequestType.TokenGetNftInfos:return"TokenGetNftInfos";case RequestType.TokenFeeScheduleUpdate:return"TokenFeeScheduleUpdate";case RequestType.NetworkGetExecutionTime:return"NetworkGetExecutionTime";case RequestType.TokenPause:return"TokenPause";case RequestType.TokenUnpause:return"TokenUnpause";case RequestType.CryptoApproveAllowance:return"CryptoApproveAllowance";case RequestType.CryptoDeleteAllowance:return"CryptoDeleteAllowance";case RequestType.GetAccountDetails:return"GetAccountDetails";case RequestType.EthereumTransaction:return"EthereumTransaction";case RequestType.NodeStakeUpdate:return"NodeStakeUpdate";case RequestType.Prng:return"UtilPrng";case RequestType.TransactionGetFastRecord:return"TransactionGetFastRecord";case RequestType.TokenUpdateNfts:return"TokenUpdateNfts";case RequestType.NodeCreate:return"NodeCreate";case RequestType.NodeUpdate:return"NodeUpdate";case RequestType.NodeDelete:return"NodeDelete";case RequestType.TokenReject:return"TokenReject";case RequestType.TokenAirdrop:return"TokenAirdrop";case RequestType.TokenCancelAirdrop:return"TokenCancelAirdrop";case RequestType.TokenClaimAirdrop:return"TokenClaimAirdrop";case RequestType.TssMessage:return"TssMessage";case RequestType.TssVote:return"TssVote";case RequestType.TssShareSignature:return"TssShareSignature";case RequestType.TssEncryptionKey:return"TssEncryptionKey";case RequestType.StateSignatureTransaction:return"StateSignatureTransaction";case RequestType.HistoryAssemblySignature:return"HistoryAssemblySignature";case RequestType.HistoryProofKeyPublication:return"HistoryProofKeyPublication";case RequestType.HistoryProofVote:return"HistoryProofVote";case RequestType.HintsKeyPublication:return"HintsKeyPublication";case RequestType.HintsPreprocessingVote:return"HintsPreprocessingVote";case RequestType.HintsPartialSignature:return"HintsPartialSignature";case RequestType.CrsPublication:return"CrsPublication";case RequestType.AtomicBatch:return"AtomicBatch";case RequestType.LambdaSStore:return"LambdaSStore";case RequestType.HookDispatch:return"HookDispatch";case RequestType.HookStore:return"HookStore";case RequestType.LedgerIdPublication:return"LedgerIdPublication";case RequestType.RegisteredNodeCreate:return"RegisteredNodeCreate";case RequestType.RegisteredNodeUpdate:return"RegisteredNodeUpdate";case RequestType.RegisteredNodeDelete:return"RegisteredNodeDelete";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return RequestType.None;case 1:return RequestType.CryptoTransfer;case 2:return RequestType.CryptoUpdate;case 3:return RequestType.CryptoDelete;case 4:return RequestType.CryptoAddLiveHash;case 5:return RequestType.CryptoDeleteLiveHash;case 6:return RequestType.ContractCall;case 7:return RequestType.ContractCreate;case 8:return RequestType.ContractUpdate;case 9:return RequestType.FileCreate;case 10:return RequestType.FileAppend;case 11:return RequestType.FileUpdate;case 12:return RequestType.FileDelete;case 13:return RequestType.CryptoGetAccountBalance;case 14:return RequestType.CryptoGetAccountRecords;case 15:return RequestType.CryptoGetInfo;case 16:return RequestType.ContractCallLocal;case 17:return RequestType.ContractGetInfo;case 18:return RequestType.ContractGetBytecode;case 19:return RequestType.GetBySolidityID;case 20:return RequestType.GetByKey;case 21:return RequestType.CryptoGetLiveHash;case 22:return RequestType.CryptoGetStakers;case 23:return RequestType.FileGetContents;case 24:return RequestType.FileGetInfo;case 25:return RequestType.TransactionGetRecord;case 26:return RequestType.ContractGetRecords;case 27:return RequestType.CryptoCreate;case 28:return RequestType.SystemDelete;case 29:return RequestType.SystemUndelete;case 30:return RequestType.ContractDelete;case 31:return RequestType.Freeze;case 32:return RequestType.CreateTransactionRecord;case 33:return RequestType.CryptoAccountAutoRenew;case 34:return RequestType.ContractAutoRenew;case 35:return RequestType.GetVersionInfo;case 36:return RequestType.TransactionGetReceipt;case 50:return RequestType.ConsensusCreateTopic;case 51:return RequestType.ConsensusUpdateTopic;case 52:return RequestType.ConsensusDeleteTopic;case 53:return RequestType.ConsensusGetTopicInfo;case 54:return RequestType.ConsensusSubmitMessage;case 55:return RequestType.UncheckedSubmit;case 56:return RequestType.TokenCreate;case 58:return RequestType.TokenGetInfo;case 59:return RequestType.TokenFreezeAccount;case 60:return RequestType.TokenUnfreezeAccount;case 61:return RequestType.TokenGrantKycToAccount;case 62:return RequestType.TokenRevokeKycFromAccount;case 63:return RequestType.TokenDelete;case 64:return RequestType.TokenUpdate;case 65:return RequestType.TokenMint;case 66:return RequestType.TokenBurn;case 67:return RequestType.TokenAccountWipe;case 68:return RequestType.TokenAssociateToAccount;case 69:return RequestType.TokenDissociateFromAccount;case 70:return RequestType.ScheduleCreate;case 71:return RequestType.ScheduleDelete;case 72:return RequestType.ScheduleSign;case 73:return RequestType.ScheduleGetInfo;case 74:return RequestType.TokenGetAccountNftInfos;case 75:return RequestType.TokenGetNftInfo;case 76:return RequestType.TokenGetNftInfos;case 77:return RequestType.TokenFeeScheduleUpdate;case 78:return RequestType.NetworkGetExecutionTime;case 79:return RequestType.TokenPause;case 80:return RequestType.TokenUnpause;case 81:return RequestType.CryptoApproveAllowance;case 82:return RequestType.CryptoDeleteAllowance;case 83:return RequestType.GetAccountDetails;case 84:return RequestType.EthereumTransaction;case 85:return RequestType.NodeStakeUpdate;case 86:return RequestType.Prng;case 87:return RequestType.TransactionGetFastRecord;case 88:return RequestType.TokenUpdateNfts;case 89:return RequestType.NodeCreate;case 90:return RequestType.NodeUpdate;case 91:return RequestType.NodeDelete;case 92:return RequestType.TokenReject;case 93:return RequestType.TokenAirdrop;case 94:return RequestType.TokenCancelAirdrop;case 95:return RequestType.TokenClaimAirdrop;case 96:return RequestType.TssMessage;case 97:return RequestType.TssVote;case 98:return RequestType.TssShareSignature;case 99:return RequestType.TssEncryptionKey;case 100:return RequestType.StateSignatureTransaction;case 101:return RequestType.HintsKeyPublication;case 102:return RequestType.HintsPreprocessingVote;case 103:return RequestType.HintsPartialSignature;case 104:return RequestType.HistoryAssemblySignature;case 105:return RequestType.HistoryProofKeyPublication;case 106:return RequestType.HistoryProofVote;case 107:return RequestType.CrsPublication;case 108:return RequestType.AtomicBatch;case 109:return RequestType.LambdaSStore;case 110:return RequestType.HookDispatch;case 111:return RequestType.HookStore;case 112:return RequestType.LedgerIdPublication;case 113:return RequestType.RegisteredNodeCreate;case 114:return RequestType.RegisteredNodeUpdate;case 115:return RequestType.RegisteredNodeDelete}throw new Error(`(BUG) RequestType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}RequestType.None=new RequestType(0),RequestType.CryptoTransfer=new RequestType(1),RequestType.CryptoUpdate=new RequestType(2),RequestType.CryptoDelete=new RequestType(3),RequestType.CryptoAddLiveHash=new RequestType(4),RequestType.CryptoDeleteLiveHash=new RequestType(5),RequestType.ContractCall=new RequestType(6),RequestType.ContractCreate=new RequestType(7),RequestType.ContractUpdate=new RequestType(8),RequestType.FileCreate=new RequestType(9),RequestType.FileAppend=new RequestType(10),RequestType.FileUpdate=new RequestType(11),RequestType.FileDelete=new RequestType(12),RequestType.CryptoGetAccountBalance=new RequestType(13),RequestType.CryptoGetAccountRecords=new RequestType(14),RequestType.CryptoGetInfo=new RequestType(15),RequestType.ContractCallLocal=new RequestType(16),RequestType.ContractGetInfo=new RequestType(17),RequestType.ContractGetBytecode=new RequestType(18),RequestType.GetBySolidityID=new RequestType(19),RequestType.GetByKey=new RequestType(20),RequestType.CryptoGetLiveHash=new RequestType(21),RequestType.CryptoGetStakers=new RequestType(22),RequestType.FileGetContents=new RequestType(23),RequestType.FileGetInfo=new RequestType(24),RequestType.TransactionGetRecord=new RequestType(25),RequestType.ContractGetRecords=new RequestType(26),RequestType.CryptoCreate=new RequestType(27),RequestType.SystemDelete=new RequestType(28),RequestType.SystemUndelete=new RequestType(29),RequestType.ContractDelete=new RequestType(30),RequestType.Freeze=new RequestType(31),RequestType.CreateTransactionRecord=new RequestType(32),RequestType.CryptoAccountAutoRenew=new RequestType(33),RequestType.ContractAutoRenew=new RequestType(34),RequestType.GetVersionInfo=new RequestType(35),RequestType.TransactionGetReceipt=new RequestType(36),RequestType.ConsensusCreateTopic=new RequestType(50),RequestType.ConsensusUpdateTopic=new RequestType(51),RequestType.ConsensusDeleteTopic=new RequestType(52),RequestType.ConsensusGetTopicInfo=new RequestType(53),RequestType.ConsensusSubmitMessage=new RequestType(54),RequestType.UncheckedSubmit=new RequestType(55),RequestType.TokenCreate=new RequestType(56),RequestType.TokenGetInfo=new RequestType(58),RequestType.TokenFreezeAccount=new RequestType(59),RequestType.TokenUnfreezeAccount=new RequestType(60),RequestType.TokenGrantKycToAccount=new RequestType(61),RequestType.TokenRevokeKycFromAccount=new RequestType(62),RequestType.TokenDelete=new RequestType(63),RequestType.TokenUpdate=new RequestType(64),RequestType.TokenMint=new RequestType(65),RequestType.TokenBurn=new RequestType(66),RequestType.TokenAccountWipe=new RequestType(67),RequestType.TokenAssociateToAccount=new RequestType(68),RequestType.TokenDissociateFromAccount=new RequestType(69),RequestType.ScheduleCreate=new RequestType(70),RequestType.ScheduleDelete=new RequestType(71),RequestType.ScheduleSign=new RequestType(72),RequestType.ScheduleGetInfo=new RequestType(73),RequestType.TokenGetAccountNftInfos=new RequestType(74),RequestType.TokenGetNftInfo=new RequestType(75),RequestType.TokenGetNftInfos=new RequestType(76),RequestType.TokenFeeScheduleUpdate=new RequestType(77),RequestType.NetworkGetExecutionTime=new RequestType(78),RequestType.TokenPause=new RequestType(79),RequestType.TokenUnpause=new RequestType(80),RequestType.CryptoApproveAllowance=new RequestType(81),RequestType.CryptoDeleteAllowance=new RequestType(82),RequestType.GetAccountDetails=new RequestType(83),RequestType.EthereumTransaction=new RequestType(84),RequestType.NodeStakeUpdate=new RequestType(85),RequestType.Prng=new RequestType(86),RequestType.TransactionGetFastRecord=new RequestType(87),RequestType.TokenUpdateNfts=new RequestType(88),RequestType.NodeCreate=new RequestType(89),RequestType.NodeUpdate=new RequestType(90),RequestType.NodeDelete=new RequestType(91),RequestType.TokenReject=new RequestType(92),RequestType.TokenAirdrop=new RequestType(93),RequestType.TokenCancelAirdrop=new RequestType(94),RequestType.TokenClaimAirdrop=new RequestType(95),RequestType.TssMessage=new RequestType(96),RequestType.TssVote=new RequestType(97),RequestType.TssShareSignature=new RequestType(98),RequestType.TssEncryptionKey=new RequestType(99),RequestType.StateSignatureTransaction=new RequestType(100),RequestType.HintsKeyPublication=new RequestType(101),RequestType.HintsPreprocessingVote=new RequestType(102),RequestType.HintsPartialSignature=new RequestType(103),RequestType.HistoryAssemblySignature=new RequestType(104),RequestType.HistoryProofKeyPublication=new RequestType(105),RequestType.HistoryProofVote=new RequestType(106),RequestType.CrsPublication=new RequestType(107),RequestType.HistoryAssemblySignature=new RequestType(104),RequestType.HistoryProofKeyPublication=new RequestType(105),RequestType.HistoryProofVote=new RequestType(106),RequestType.AtomicBatch=new RequestType(108),RequestType.LambdaSStore=new RequestType(109),RequestType.HookDispatch=new RequestType(110),RequestType.HookStore=new RequestType(111),RequestType.LedgerIdPublication=new RequestType(112),RequestType.RegisteredNodeCreate=new RequestType(113),RequestType.RegisteredNodeUpdate=new RequestType(114),RequestType.RegisteredNodeDelete=new RequestType(115);class TransactionFeeSchedule{constructor(e={}){this.hederaFunctionality=e.hederaFunctionality,this.feeData=e.feeData,this.fees=e.fees}static fromBytes(e){return TransactionFeeSchedule._fromProtobuf(libExports.proto.TransactionFeeSchedule.decode(e))}static _fromProtobuf(e){return new TransactionFeeSchedule({hederaFunctionality:null!=e.hederaFunctionality?RequestType._fromCode(e.hederaFunctionality):void 0,feeData:null!=e.feeData?FeeData._fromProtobuf(e.feeData):void 0,fees:null!=e.fees?e.fees.map(e=>FeeData._fromProtobuf(e)):void 0})}_toProtobuf(){return{hederaFunctionality:null!=this.hederaFunctionality?this.hederaFunctionality.valueOf():void 0,feeData:null!=this.feeData?this.feeData._toProtobuf():void 0,fees:null!=this.fees?this.fees.map(e=>e._toProtobuf()):void 0}}toBytes(){return libExports.proto.TransactionFeeSchedule.encode(this._toProtobuf()).finish()}}class FeeSchedule{constructor(e={}){this.transactionFeeSchedule=e.transactionFeeSchedule,this.expirationTime=e.expirationTime}static fromBytes(e){return FeeSchedule._fromProtobuf(libExports.proto.FeeSchedule.decode(e))}static _fromProtobuf(e){return new FeeSchedule({transactionFeeSchedule:null!=e.transactionFeeSchedule?e.transactionFeeSchedule.map(e=>TransactionFeeSchedule._fromProtobuf(e)):void 0,expirationTime:null!=e.expiryTime?Timestamp._fromProtobuf(e.expiryTime):void 0})}_toProtobuf(){return{transactionFeeSchedule:null!=this.transactionFeeSchedule?this.transactionFeeSchedule.map(e=>e._toProtobuf()):void 0,expiryTime:null!=this.expirationTime?this.expirationTime._toProtobuf():void 0}}toBytes(){return libExports.proto.FeeSchedule.encode(this._toProtobuf()).finish()}}class FeeSchedules{constructor(e={}){this.current=e.currentFeeSchedule,this.next=e.nextFeeSchedule}static fromBytes(e){return FeeSchedules._fromProtobuf(libExports.proto.CurrentAndNextFeeSchedule.decode(e))}static _fromProtobuf(e){return new FeeSchedules({currentFeeSchedule:null!=e.currentFeeSchedule?FeeSchedule._fromProtobuf(e.currentFeeSchedule):void 0,nextFeeSchedule:null!=e.nextFeeSchedule?FeeSchedule._fromProtobuf(e.nextFeeSchedule):void 0})}_toProtobuf(){return{currentFeeSchedule:null!=this.current?this.current._toProtobuf():void 0,nextFeeSchedule:null!=this.next?this.next._toProtobuf():void 0}}toBytes(){return libExports.proto.CurrentAndNextFeeSchedule.encode(this._toProtobuf()).finish()}}class HookExtensionPoint{constructor(){}static get ACCOUNT_ALLOWANCE_HOOK(){return 0}}class HookCreationDetails{constructor(e={}){this._extensionPoint=null,this._hookId=null,this._evmHook=null,this._adminKey=null,null!=e.extensionPoint&&this.setExtensionPoint(e.extensionPoint),null!=e.hookId&&this.setHookId(e.hookId),null!=e.evmHook&&this.setEvmHook(e.evmHook),null!=e.adminKey&&this.setAdminKey(e.adminKey)}setExtensionPoint(e){return this._extensionPoint=e,this}setHookId(e){return this._hookId=e instanceof Long?e:Long.fromNumber(e),this}setEvmHook(e){return this._evmHook=e,this}setAdminKey(e){return this._adminKey=e,this}get extensionPoint(){return this._extensionPoint}get hookId(){return this._hookId}get evmHook(){return this._evmHook}get adminKey(){return this._adminKey}_toProtobuf(){if(null==this._extensionPoint)throw new Error("extensionPoint is required for HookCreationDetails");return{extensionPoint:this._extensionPoint,hookId:this._hookId,evmHook:null!=this._evmHook?this._evmHook._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null}}}class EvmHook{constructor(e={}){this._contractId=null,this._storageUpdates=[],null!=e.storageUpdates&&this.setStorageUpdates(e.storageUpdates),null!=e.contractId&&this.setContractId(e.contractId)}setContractId(e){return this._contractId=e,this}setStorageUpdates(e){return this._storageUpdates=e,this}get storageUpdates(){return this._storageUpdates}get contractId(){return this._contractId}_toProtobuf(){return{spec:{contractId:this._contractId?._toProtobuf()},storageUpdates:this._storageUpdates.map(e=>e._toProtobuf())}}}class HookEntityId{constructor(e={}){this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}setAccountId(e){return this._accountId=e,this}get accountId(){return this._accountId}_toProtobuf(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null}}static _fromProtobuf(e){return new HookEntityId({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):void 0})}}class HookId{constructor(e={}){this._entityId=null,this._hookId=null,null!=e.entityId&&this.setEntityId(e.entityId),null!=e.hookId&&this.setHookId(e.hookId)}setEntityId(e){return this._entityId=e,this}setHookId(e){return this._hookId=e,this}get entityId(){return this._entityId}get hookId(){return this._hookId}static _fromProtobuf(e){return new HookId({entityId:null!=e.entityId?HookEntityId._fromProtobuf(e.entityId):void 0,hookId:null!=e.hookId?e.hookId:void 0})}_toProtobuf(){return{entityId:null!=this._entityId?this._entityId._toProtobuf():null,hookId:this._hookId}}}class EvmHookMappingEntry{constructor(e={}){this._key=null,this._value=null,this._preimage=null,null!=e.preimage&&this.setPreimage(e.preimage),null!=e.key&&this.setKey(e.key),null!=e.value&&this.setValue(e.value)}setKey(e){return this._key=e,this._preimage=null,this}setValue(e){return this._value=e,this}setPreimage(e){return this._preimage=e,this._key=null,this}get key(){return this._key}get value(){return this._value}get preimage(){return this._preimage}static _fromProtobuf(e){return new EvmHookMappingEntry({key:null!=e.key?e.key:void 0,value:null!=e.value?e.value:void 0,preimage:null!=e.preimage?e.preimage:void 0})}_toProtobuf(){return{key:this._key,value:this._value,preimage:this._preimage}}}class EvmHookStorageUpdate{static _fromProtobuf(e){if(null!=e.storageSlot)return EvmHookStorageSlot._fromProtobuf(e);if(null!=e.mappingEntries)return EvmHookMappingEntries._fromProtobuf(e);throw new Error("EvmHookStorageUpdate must have either storage_slot or mapping_entries set")}_toProtobuf(){throw new Error("EvmHookStorageUpdate._toProtobuf must be implemented by a subclass")}}class EvmHookStorageSlot extends EvmHookStorageUpdate{constructor(e={}){super(),this._key=null,this._value=null,null!=e.key&&this.setKey(e.key),null!=e.value&&this.setValue(e.value)}setKey(e){return this._key=e,this}setValue(e){return this._value=e,this}get key(){return this._key}get value(){return this._value}static _fromProtobuf(e){if(null!=e.storageSlot)return new EvmHookStorageSlot({key:null!=e.storageSlot.key?e.storageSlot.key:void 0,value:null!=e.storageSlot.value?e.storageSlot.value:void 0});throw new Error("EvmHookStorageSlot._fromProtobuf must be implemented by a subclass")}_toProtobuf(){return{storageSlot:{key:this._key,value:this._value}}}}class EvmHookMappingEntries extends EvmHookStorageUpdate{constructor(e={}){super(),this._mappingSlot=null,this._entries=null,null!=e.mappingSlot&&this.setMappingSlot(e.mappingSlot),null!=e.entries&&this.setEntries(e.entries)}setMappingSlot(e){return this._mappingSlot=e,this}setEntries(e){return this._entries=e,this}get mappingSlot(){return this._mappingSlot}get entries(){return this._entries}static _fromProtobuf(e){return new EvmHookMappingEntries({mappingSlot:null!=e.mappingEntries?.mappingSlot?e.mappingEntries.mappingSlot:void 0,entries:e.mappingEntries?.entries?.map(e=>EvmHookMappingEntry._fromProtobuf(e))})}_toProtobuf(){return{mappingEntries:{mappingSlot:this._mappingSlot,entries:null!=this._entries?this._entries.map(e=>e._toProtobuf()):null}}}}class HookStoreTransaction extends Transaction{constructor(e={}){super(),this._hookId=null,this._storageUpdates=[],null!=e.hookId&&this.setHookId(e.hookId),null!=e.storageUpdates&&this.setStorageUpdates(e.storageUpdates)}get hookId(){return this._hookId}setHookId(e){return this._requireNotFrozen(),this._hookId=e,this}get storageUpdates(){return this._storageUpdates}setStorageUpdates(e){return this._requireNotFrozen(),this._storageUpdates=e,this}addStorageUpdate(e){return this._requireNotFrozen(),this._storageUpdates.push(e),this}_makeTransactionData(){return{hookId:this.hookId?._toProtobuf(),storageUpdates:this.storageUpdates?.map(e=>e._toProtobuf())}}_execute(e,t){return e.smartContract.hookStore(t)}_getTransactionDataCase(){return"hookStore"}_getLogId(){return`HookStoreTransaction:${this._transactionIds.current.validStart.toString()}`}static _fromProtobuf(e,t,n,r,o){const a=o[0].hookStore;return Transaction._fromProtobufTransactions(new HookStoreTransaction({hookId:null!=a.hookId?HookId._fromProtobuf(a.hookId):void 0,storageUpdates:null!=a.storageUpdates?a.storageUpdates.map(e=>EvmHookStorageUpdate._fromProtobuf(e)):void 0}),e,t,n,r,o)}}TRANSACTION_REGISTRY.set("hookStore",HookStoreTransaction._fromProtobuf);class FileContentsQuery extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e){const t=e.fileGetContents;return new FileContentsQuery({fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):void 0})}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.getFileContent(t)}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}_mapResponseHeader(e){return e.fileGetContents.header}_mapResponse(e){const t=e.fileGetContents.fileContents.contents;return Promise.resolve(t)}_onMakeRequest(e){return{fileGetContents:{header:e,fileID:null!=this._fileId?this._fileId._toProtobuf():null}}}_getLogId(){return`FileContentsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("fileGetContents",FileContentsQuery._fromProtobuf);const{proto:proto$2}=HieroProto;class FileInfo{constructor(e){this.fileId=e.fileId,this.size=e.size,this.expirationTime=e.expirationTime,this.isDeleted=e.isDeleted,this.keys=e.keys,this.fileMemo=e.fileMemo,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(e){const t=e.size;return new FileInfo({fileId:FileId._fromProtobuf(e.fileID),size:t instanceof Long?t:Long.fromValue(t),expirationTime:Timestamp._fromProtobuf(e.expirationTime),isDeleted:e.deleted,keys:null!=e.keys?KeyList.__fromProtobufKeyList(e.keys):new KeyList,fileMemo:null!=e.memo?e.memo:"",ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null})}_toProtobuf(){return{fileID:this.fileId._toProtobuf(),size:this.size,expirationTime:this.expirationTime._toProtobuf(),deleted:this.isDeleted,keys:this.keys._toProtobufKey().keyList,memo:this.fileMemo,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null}}static fromBytes(e){return FileInfo._fromProtobuf(libExports.proto.FileGetInfoResponse.FileInfo.decode(e))}toBytes(){return proto$2.FileGetInfoResponse.FileInfo.encode(this._toProtobuf()).finish()}}class FileInfoQuery extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e){const t=e.fileGetInfo;return new FileInfoQuery({fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):void 0})}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.getFileInfo(t)}_mapResponseHeader(e){return e.fileGetInfo.header}_mapResponse(e,t,n){const r=e.fileGetInfo;return Promise.resolve(FileInfo._fromProtobuf(r.fileInfo))}_onMakeRequest(e){return{fileGetInfo:{header:e,fileID:null!=this._fileId?this._fileId._toProtobuf():null}}}_getLogId(){return`FileInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("fileGetInfo",FileInfoQuery._fromProtobuf);class FileUpdateTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._keys=null,this._expirationTime=null,this._contents=null,this._fileMemo=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.keys&&this.setKeys(e.keys),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.contents&&this.setContents(e.contents),e.fileMemo&&null!=e.fileMemo&&this.setFileMemo(e.fileMemo)}static _fromProtobuf(e,t,n,r,o){const a=o[0].fileUpdate;return Transaction._fromProtobufTransactions(new FileUpdateTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,keys:null!=a.keys&&null!=a.keys.keys?a.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0,contents:null!=a.contents?a.contents:void 0,fileMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get keys(){return this._keys}setKeys(e){if(this._requireNotFrozen(),e instanceof KeyList&&null!=e.threshold)throw new Error("Cannot set threshold key as file key");return this._keys=e instanceof KeyList?e.toArray():e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode(e),this}get fileMemo(){return this._fileMemo}setFileMemo(e){return this._requireNotFrozen(),this._fileMemo=e,this}clearFileMemo(){return this._requireNotFrozen(),this._fileMemo=null,this}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.updateFile(t)}_getTransactionDataCase(){return"fileUpdate"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,contents:this._contents,memo:null!=this._fileMemo?{value:this._fileMemo}:null}}_getLogId(){return`FileUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileUpdate",FileUpdateTransaction._fromProtobuf);class LiveHashAddTransaction extends Transaction{constructor(e={}){super(),this._hash=null,this._keys=null,this._duration=null,this._accountId=null,null!=e.hash&&this.setHash(e.hash),null!=e.keys&&this.setKeys(e.keys),null!=e.duration&&this.setDuration(e.duration),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoAddLiveHash.liveHash;return Transaction._fromProtobufTransactions(new LiveHashAddTransaction({hash:null!=a.hash?a.hash:void 0,keys:null!=a.keys&&null!=a.keys.keys?a.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,duration:null!=a.duration&&null!=a.duration.seconds?a.duration.seconds:void 0,accountId:null!=a.accountId?AccountId._fromProtobuf(a.accountId):void 0}),e,t,n,r,o)}get hash(){return this._hash}setHash(e){return this._requireNotFrozen(),this._hash=e,this}get keys(){return this._keys}setKeys(e){return this._requireNotFrozen(),this._keys=e instanceof KeyList?e.toArray():e,this}get duration(){return this._duration}setDuration(e){return this._requireNotFrozen(),this._duration=e instanceof Duration?e:new Duration(e),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.addLiveHash(t)}_getTransactionDataCase(){return"cryptoAddLiveHash"}_makeTransactionData(){return{liveHash:{hash:this._hash,keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:void 0,duration:null!=this._duration?this._duration._toProtobuf():null,accountId:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`LiveHashAddTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoAddLiveHash",LiveHashAddTransaction._fromProtobuf);class LiveHashDeleteTransaction extends Transaction{constructor(e={}){super(),this._hash=null,this._accountId=null,null!=e.hash&&this.setHash(e.hash),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoDeleteLiveHash;return Transaction._fromProtobufTransactions(new LiveHashDeleteTransaction({hash:null!=a.liveHashToDelete?a.liveHashToDelete:void 0,accountId:null!=a.accountOfLiveHash?AccountId._fromProtobuf(a.accountOfLiveHash):void 0}),e,t,n,r,o)}get hash(){return this._hash}setHash(e){return this._requireNotFrozen(),this._hash=e,this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.deleteLiveHash(t)}_getTransactionDataCase(){return"cryptoDeleteLiveHash"}_makeTransactionData(){return{liveHashToDelete:this._hash,accountOfLiveHash:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`LiveHashDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDeleteLiveHash",LiveHashDeleteTransaction._fromProtobuf);class LiveHashQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._hash=null,null!=e.hash&&this.setHash(e.hash)}static _fromProtobuf(e){const t=e.cryptoGetLiveHash;return new LiveHashQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,hash:null!=t.hash?t.hash:void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get liveHash(){return this._hash}setHash(e){return this._hash=e,this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getLiveHash(t)}_mapResponseHeader(e){return e.cryptoGetLiveHash.header}_mapResponse(e){const t=e.cryptoGetLiveHash;return Promise.resolve(LiveHash._fromProtobuf(t.liveHash))}_onMakeRequest(e){return{cryptoGetLiveHash:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null,hash:this._hash}}}_getLogId(){return`LiveHashQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetLiveHash",LiveHashQuery._fromProtobuf);class MirrorNodeContractQuery{constructor(){this._contractId=null,this._contractEvmAddress=null,this._sender=null,this._senderEvmAddress=null,this._functionName=null,this._functionParameters=null,this._value=null,this._gasLimit=null,this._gasPrice=null,this._blockNumber=null}setContractId(e){return this._contractId=e,this}setSender(e){return this._sender=e,this}setSenderEvmAddress(e){return this._senderEvmAddress=e,this}setFunction(e,t){return this._functionParameters=null!=t?t._build(e):(new ContractFunctionParameters)._build(e),this}setValue(e){return this._value=e,this}setGasLimit(e){return this._gasLimit=e,this}setGasPrice(e){return this._gasPrice=e,this}setBlockNumber(e){return this._blockNumber=e,this}get contractId(){return this._contractId}get contractEvmAddress(){const e=this._contractId?.toEvmAddress();if(null==e)throw new Error("Contract ID is not set");return e}get sender(){return this._sender}get senderEvmAddress(){return this._senderEvmAddress}get callData(){return this._functionParameters}get value(){return this._value}get gasLimit(){return this._gasLimit}get gasPrice(){return this._gasPrice}get blockNumber(){return this._blockNumber}async performMirrorNodeRequest(e,t){if(null==this.contractId)throw new Error("Contract ID is not set");this._fillEvmAddress();let n=e.mirrorRestApiBaseUrl;const r=e._mirrorNetwork.getNextMirrorNode().address.address;if("localhost"===r||"127.0.0.1"===r){const e=new URL(n);e.protocol="http:",e.port="8545",n=e.toString()}const o=`${n}/contracts/call`,a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}_fillEvmAddress(){null==this.senderEvmAddress&&null!=this.sender&&(this._senderEvmAddress=this.sender.toEvmAddress())}get JSONPayload(){throw new Error("JSONPayload getter is not implemented. Please implement this method in the subclass.")}}class MirrorNodeContractCallQuery extends MirrorNodeContractQuery{get JSONPayload(){if(null==this.callData)throw new Error("Call data is required.");return{data:encode$4(this.callData),from:this.senderEvmAddress,to:this.contractEvmAddress,estimate:!1,gasPrice:this.gasPrice?.toString(),gas:this.gasLimit?.toString(),blockNumber:this.blockNumber?.toString(),value:this.value?.toString()}}async execute(e){return(await this.performMirrorNodeRequest(e,this.JSONPayload)).result}}class MirrorNodeContractEstimateQuery extends MirrorNodeContractQuery{get JSONPayload(){if(null==this.callData)throw new Error("Call data is required.");return{data:encode$4(this.callData),from:this.senderEvmAddress,to:this.contractEvmAddress,estimate:!0,gasPrice:this.gasPrice?.toString(),gas:this.gasLimit?.toString(),blockNumber:this.blockNumber?.toString(),value:this.value?.toString()}}async execute(e){const t=await this.performMirrorNodeRequest(e,this.JSONPayload);return Number(t.result)}}class IPv4AddressPart{constructor(e={}){this._left=null,null!=e.left&&this.setLeft(e.left),this._right=null,null!=e.right&&this.setRight(e.right)}get left(){return this._left}setLeft(e){return this._left=e,this}get right(){return this._right}setRight(e){return this._right=e,this}toString(){return null!=this._left&&null!=this._right?`${this._left.toString()}.${this._right.toString()}`:""}}class IPv4Address{constructor(e={}){this._network=null,null!=e.network&&this.setNetwork(e.network),this._host=null,null!=e.host&&this.setHost(e.host)}get newtork(){return this._network}setNetwork(e){return this._network=e,this}get host(){return this._host}setHost(e){return this._host=e,this}static _fromProtobuf(e){return new IPv4Address({network:(new IPv4AddressPart).setLeft(e[0]).setRight(e[1]),host:(new IPv4AddressPart).setLeft(e[2]).setRight(e[3])})}_toProtobuf(){return Uint8Array.of(null!=this._network&&null!=this._network._left?this._network._left:0,null!=this._network&&null!=this._network.right?this._network.right:0,null!=this._host&&null!=this._host.left?this._host.left:0,null!=this._host&&null!=this._host.right?this._host.right:0)}static _fromString(e){const t=e.split(".");if(4!==t.length)throw new Error("Invalid IPv4 address format");const n=(new IPv4AddressPart).setLeft(Number(t[0])).setRight(Number(t[1])),r=(new IPv4AddressPart).setLeft(Number(t[2])).setRight(Number(t[3]));return new IPv4Address({network:n,host:r})}toString(){return null!=this._network&&null!=this._host?`${this._network.toString()}.${this._host.toString()}`:""}}class EndPoint{constructor(e={}){this._address=null,null!=e.address&&this.setAddress(e.address),this._port=null,null!=e.port&&this.setPort(e.port)}get address(){return this._address}setAddress(e){return this._address=e,this}get port(){return this._port}setPort(e){return this._port=e,this}static _fromProtobuf(e){let t;return e.domainName?t=e.domainName:e.ipAddressV4&&(t=IPv4Address._fromProtobuf(e.ipAddressV4)),new EndPoint({address:t,port:null!=e.port?e.port:void 0})}_toProtobuf(){return"string"!=typeof this._address?{ipAddressV4:null!=this._address?this._address._toProtobuf():null,port:this._port}:{domainName:this._address,port:this._port}}static fromJSON(e){return new EndPoint({address:e.address||void 0,port:null!=e.port?parseInt(e.port,10):void 0})}toString(){return`${null!=this._address?this._address.toString():""}:${null!=this._port?this._port.toString():""}`}toJSON(){return{address:null!=this._address?this._address.toString():null,port:null!=this._port?this._port.toString():null}}}class NodeAddress{constructor(e={}){this._publicKey=null,null!=e.publicKey&&this.setPublicKey(e.publicKey),this._nodeId=null,null!=e.nodeId&&this.setNodeId(e.nodeId),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._certHash=null,null!=e.certHash&&this.setCertHash(e.certHash),this._addresses=[],null!=e.addresses&&this.setAddresses(e.addresses),this._description=null,null!=e.description&&this.setDescription(e.description),this._stake=null,null!=e.stake&&this.setStake(e.stake)}get publicKey(){return this._publicKey}setPublicKey(e){return this._publicKey=e,this}get nodeId(){return this._nodeId}setNodeId(e){return this._nodeId=e,this}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get certHash(){return this._certHash}setCertHash(e){return this._certHash=e,this}get addresses(){return this._addresses}setAddresses(e){return this._addresses=e,this}get description(){return this._description}setDescription(e){return this._description=e,this}get stake(){return this._stake}setStake(e){return this._stake=e,this}static _fromProtobuf(e){return new NodeAddress({publicKey:null!=e.RSA_PubKey?e.RSA_PubKey:void 0,nodeId:null!=e.nodeId?e.nodeId:void 0,accountId:null!=e.nodeAccountId?AccountId._fromProtobuf(e.nodeAccountId):void 0,certHash:null!=e.nodeCertHash?e.nodeCertHash:void 0,addresses:null!=e.serviceEndpoint?e.serviceEndpoint.map(e=>EndPoint._fromProtobuf(e)):void 0,description:null!=e.description?e.description:void 0,stake:null!=e.stake?e.stake:void 0})}_toProtobuf(){return{RSA_PubKey:this._publicKey,nodeId:this._nodeId,nodeAccountId:null!=this._accountId?this._accountId._toProtobuf():null,nodeCertHash:this._certHash,serviceEndpoint:this._addresses.map(e=>e._toProtobuf()),description:this._description,stake:this._stake}}static fromJSON(e){return new NodeAddress({publicKey:e.publicKey??void 0,nodeId:null!=e.nodeId?Long.fromString(e.nodeId):void 0,accountId:e.accountId?AccountId.fromString(e.accountId):void 0,certHash:null!=e.certHash?encode(e.certHash):void 0,addresses:null!=e.addresses?e.addresses.map(e=>EndPoint.fromJSON(e)):void 0,description:e.description??void 0,stake:null!=e.stake?Long.fromString(e.stake):void 0})}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{publicKey:this._publicKey,nodeId:null!=this._nodeId?this._nodeId.toString():null,accountId:null!=this._accountId?this._accountId.toString():null,certHash:null!=this._certHash?decode(this._certHash):null,addresses:this._addresses.map(e=>e.toJSON()),description:this._description,stake:null!=this._stake?this._stake.toString():null}}}class NodeAddressBook{constructor(e={}){this._nodeAddresses=[],null!=e.nodeAddresses&&this.setNodeAddresses(e.nodeAddresses)}get nodeAddresses(){return this._nodeAddresses}setNodeAddresses(e){return this._nodeAddresses=e,this}static fromBytes(e){return NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(e))}static _fromProtobuf(e){return new NodeAddressBook({nodeAddresses:null!=e.nodeAddress?e.nodeAddress.map(e=>NodeAddress._fromProtobuf(e)):void 0})}_toProtobuf(){return{nodeAddress:this._nodeAddresses.map(e=>e._toProtobuf())}}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{nodeAddresses:this._nodeAddresses.map(e=>e.toJSON())}}toBytes(){return libExports.proto.NodeAddressBook.encode(this._toProtobuf()).finish()}}class SemanticVersion{constructor(e){this.major=e.major,this.minor=e.minor,this.patch=e.patch,Object.freeze(this)}static _fromProtobuf(e){return new SemanticVersion({major:e.major,minor:e.minor,patch:e.patch})}_toProtobuf(){return{major:this.major,minor:this.minor,patch:this.patch}}static fromBytes(e){return SemanticVersion._fromProtobuf(libExports.proto.SemanticVersion.decode(e))}toBytes(){return libExports.proto.SemanticVersion.encode(this._toProtobuf()).finish()}}class NetworkVersionInfo{constructor(e){this.protobufVersion=e.protobufVersion,this.servicesVersion=e.servicesVersion,Object.freeze(this)}static _fromProtobuf(e){return new NetworkVersionInfo({protobufVersion:SemanticVersion._fromProtobuf(e.hapiProtoVersion),servicesVersion:SemanticVersion._fromProtobuf(e.hederaServicesVersion)})}_toProtobuf(){return{hapiProtoVersion:this.protobufVersion._toProtobuf(),hederaServicesVersion:this.servicesVersion._toProtobuf()}}static fromBytes(e){return NetworkVersionInfo._fromProtobuf(libExports.proto.NetworkGetVersionInfoResponse.decode(e))}toBytes(){return libExports.proto.NetworkGetVersionInfoResponse.encode(this._toProtobuf()).finish()}}class NetworkVersionInfoQuery extends Query{constructor(){super()}static _fromProtobuf(e){return new NetworkVersionInfoQuery}_execute(e,t){return e.network.getVersionInfo(t)}_mapResponseHeader(e){return e.networkGetVersionInfo.header}_mapResponse(e){const t=e.networkGetVersionInfo;return Promise.resolve(NetworkVersionInfo._fromProtobuf(t))}_onMakeRequest(e){return{networkGetVersionInfo:{header:e}}}_getLogId(){return`NetworkVersionInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("networkGetVersionInfo",NetworkVersionInfoQuery._fromProtobuf);var Provider={};class PrngTransaction extends Transaction{constructor(e={}){super(),this._range=null,null!=e.range&&this.setRange(e.range)}setRange(e){return this._range=e,this}get range(){return this._range}_validateChecksums(e){null!=this._range&&isNumber(this._range)&&this._validateChecksums(e)}_execute(e,t){return e.util.prng(t)}static _fromProtobuf(e,t,n,r,o){const a=o[0].utilPrng;return Transaction._fromProtobufTransactions(new PrngTransaction({range:a.range}),e,t,n,r,o)}_getTransactionDataCase(){return"utilPrng"}_makeTransactionData(){return{range:this.range}}_getLogId(){return`RandomGenerate:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("utilPrng",PrngTransaction._fromProtobuf);class ProxyStaker{constructor(e){this.accountId=e.accountId,this.amount=e.amount instanceof Hbar?e.amount:new Hbar(e.amount),Object.freeze(this)}static _fromProtobuf(e){return new ProxyStaker({accountId:AccountId._fromProtobuf(e.accountID),amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),amount:this.amount.toTinybars()}}}class ScheduleCreateTransaction extends Transaction{constructor(e={}){super(),this._adminKey=null,this._scheduledTransaction=null,this._payerAccountId=null,this._scheduleMemo=null,this._scheduledSignerPublicKeys=new Set,this._expirationTime=null,this._waitForExpiry=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.payerAccountID&&this.setPayerAccountId(e.payerAccountID),null!=e.scheduleMemo&&this.setScheduleMemo(e.scheduleMemo),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const a=o[0],i=a.scheduleCreate,s=new ScheduleCreateTransaction({adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,payerAccountID:null!=i.payerAccountID?AccountId._fromProtobuf(i.payerAccountID):void 0,scheduleMemo:null!=i.memo?i.memo:void 0,waitForExpiry:null!=i.waitForExpiry?i.waitForExpiry:void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0});if(null!=a.scheduleCreate){const e=a.scheduleCreate.scheduledTransactionBody,t=libExports.proto.TransactionBody.encode(e).finish(),n={signedTransactionBytes:libExports.proto.SignedTransaction.encode({bodyBytes:t}).finish()},r=libExports.proto.TransactionList.encode({transactionList:[n]}).finish(),o=Transaction.fromBytes(r);s._setScheduledTransaction(o)}return Transaction._fromProtobufTransactions(s,e,t,n,r,o)}_setScheduledTransaction(e){return this._scheduledTransaction=e,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get payerAccountId(){return this._payerAccountId}setPayerAccountId(e){return this._requireNotFrozen(),this._payerAccountId=e,this}setScheduleMemo(e){return this._requireNotFrozen(),this._scheduleMemo=e,this}get getScheduleMemo(){return this._requireNotFrozen(),this._scheduleMemo}setScheduledTransaction(e){return this._requireNotFrozen(),e._requireNotFrozen(),this._scheduledTransaction=e.schedule()._scheduledTransaction,this}_validateChecksums(e){null!=this._payerAccountId&&this._payerAccountId.validateChecksum(e)}_execute(e,t){return e.schedule.createSchedule(t)}_getTransactionDataCase(){return"scheduleCreate"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,payerAccountID:null!=this._payerAccountId?this._payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this._scheduledTransaction?this._scheduledTransaction._getScheduledTransactionBody():null,memo:this._scheduleMemo,waitForExpiry:this._waitForExpiry,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`ScheduleCreateTransaction:${this._transactionIds.current.validStart.toString()}`}setExpirationTime(e){return this._expirationTime=e,this}get expirationTime(){return this._requireNotFrozen(),this._expirationTime}setWaitForExpiry(e){return this._waitForExpiry=e,this}get waitForExpiry(){return this._requireNotFrozen(),this._waitForExpiry}}TRANSACTION_REGISTRY.set("scheduleCreate",ScheduleCreateTransaction._fromProtobuf),SCHEDULE_CREATE_TRANSACTION.push(()=>new ScheduleCreateTransaction);class ScheduleDeleteTransaction extends Transaction{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const a=o[0].scheduleDelete;return Transaction._fromProtobufTransactions(new ScheduleDeleteTransaction({scheduleId:null!=a.scheduleID?ScheduleId._fromProtobuf(a.scheduleID):void 0}),e,t,n,r,o)}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._requireNotFrozen(),this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.deleteSchedule(t)}_getTransactionDataCase(){return"scheduleDelete"}_makeTransactionData(){return{scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}_getLogId(){return`ScheduleDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("scheduleDelete",ScheduleDeleteTransaction._fromProtobuf);const{proto:proto$1}=HieroProto;class ScheduleInfo{constructor(e){this.scheduleId=e.scheduleId,this.creatorAccountId=e.creatorAccountID,this.payerAccountId=e.payerAccountID,this.schedulableTransactionBody=e.schedulableTransactionBody,this.signers=e.signers,this.scheduleMemo=e.scheduleMemo,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.executed=e.executed,this.deleted=e.deleted,this.scheduledTransactionId=e.scheduledTransactionId,this.waitForExpiry=e.waitForExpiry,Object.freeze(this)}static _fromProtobuf(e){return new ScheduleInfo({scheduleId:ScheduleId._fromProtobuf(e.scheduleID),creatorAccountID:null!=e.creatorAccountID?AccountId._fromProtobuf(e.creatorAccountID):null,payerAccountID:null!=e.payerAccountID?AccountId._fromProtobuf(e.payerAccountID):null,schedulableTransactionBody:null!=e.scheduledTransactionBody?e.scheduledTransactionBody:null,adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,signers:null!=e.signers?KeyList.__fromProtobufKeyList(e.signers):null,scheduleMemo:null!=e.memo?e.memo:null,expirationTime:null!=e.expirationTime?Timestamp._fromProtobuf(e.expirationTime):null,executed:null!=e.executionTime?Timestamp._fromProtobuf(e.executionTime):null,deleted:null!=e.deletionTime?Timestamp._fromProtobuf(e.deletionTime):null,scheduledTransactionId:null!=e.scheduledTransactionID?TransactionId._fromProtobuf(e.scheduledTransactionID):null,waitForExpiry:null!=e.waitForExpiry&&e.waitForExpiry})}_toProtobuf(){return{scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,creatorAccountID:null!=this.creatorAccountId?this.creatorAccountId._toProtobuf():null,payerAccountID:null!=this.payerAccountId?this.payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this.schedulableTransactionBody?this.schedulableTransactionBody:null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,signers:null!=this.signers?this.signers._toProtobufKey().keyList:null,memo:null!=this.scheduleMemo?this.scheduleMemo:"",expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,waitForExpiry:this.waitForExpiry}}get scheduledTransaction(){if(null==this.schedulableTransactionBody)throw new Error("Scheduled transaction body is empty");const e=new proto$1.SchedulableTransactionBody(this.schedulableTransactionBody),t=e.data;return Transaction.fromBytes(proto$1.TransactionList.encode({transactionList:[{signedTransactionBytes:proto$1.SignedTransaction.encode({bodyBytes:proto$1.TransactionBody.encode({transactionFee:this.schedulableTransactionBody.transactionFee,memo:this.schedulableTransactionBody.memo,[t]:e[t]}).finish()}).finish()}]}).finish())}}class ScheduleInfoQuery extends Query{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId)}static _fromProtobuf(e){const t=e.scheduleGetInfo;return new ScheduleInfoQuery({scheduleId:null!=t.scheduleID?ScheduleId._fromProtobuf(t.scheduleID):void 0})}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.getScheduleInfo(t)}_mapResponseHeader(e){return e.scheduleGetInfo.header}_mapResponse(e,t,n){const r=e.scheduleGetInfo;return Promise.resolve(ScheduleInfo._fromProtobuf(r.scheduleInfo))}_onMakeRequest(e){return{scheduleGetInfo:{header:e,scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}}_getLogId(){return`ScheduleInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("scheduleGetInfo",ScheduleInfoQuery._fromProtobuf);class ScheduleSignTransaction extends Transaction{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const a=o[0].scheduleSign;return Transaction._fromProtobufTransactions(new ScheduleSignTransaction({scheduleId:null!=a.scheduleID?ScheduleId._fromProtobuf(a.scheduleID):void 0}),e,t,n,r,o)}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._requireNotFrozen(),this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.signSchedule(t)}_getTransactionDataCase(){return"scheduleSign"}_makeTransactionData(){return{scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}_getLogId(){return`ScheduleSignTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("scheduleSign",ScheduleSignTransaction._fromProtobuf);var Signer={};class SignerSignature{constructor(e){this.publicKey=e.publicKey,this.signature=e.signature,this.accountId=e.accountId}}class SubscriptionHandle{constructor(){this._call=null,this._unsubscribed=!1}_setCall(e){this._call=e}unsubscribe(){null!=this._call&&(this._unsubscribed=!0,this._call())}}class SystemDeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contractId=null,this._expirationTime=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.contractId&&this.setContractId(e.contractId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(e,t,n,r,o){const a=o[0].systemDelete;return Transaction._fromProtobufTransactions(new SystemDeleteTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e instanceof FileId?e:FileId.fromString(e),this}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId=e instanceof ContractId?e:ContractId.fromString(e),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e,this}_execute(e,t){return null!=this._fileId?e.file.systemDelete(t):e.smartContract.systemDelete(t)}_getTransactionDataCase(){return"systemDelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`SystemDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("systemDelete",SystemDeleteTransaction._fromProtobuf);class SystemUndeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contractId=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].systemUndelete;return Transaction._fromProtobufTransactions(new SystemUndeleteTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e instanceof FileId?e:FileId.fromString(e),this}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId=e instanceof ContractId?e:ContractId.fromString(e),this}_execute(e,t){return null!=this._fileId?e.file.systemUndelete(t):e.smartContract.systemUndelete(t)}_getTransactionDataCase(){return"systemUndelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}_getLogId(){return`SystemUndeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("systemUndelete",SystemUndeleteTransaction._fromProtobuf);class TokenAssociateTransaction extends Transaction{constructor(e={}){super(),this._tokenIds=null,this._accountId=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenAssociate;return Transaction._fromProtobufTransactions(new TokenAssociateTransaction({tokenIds:null!=a.tokens?a.tokens.map(e=>TokenId._fromProtobuf(e)):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e.map(e=>"string"==typeof e?TokenId.fromString(e):e.clone()),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e);for(const t of null!=this._tokenIds?this._tokenIds:[])null!=t&&t.validateChecksum(e)}_execute(e,t){return e.token.associateTokens(t)}_getTransactionDataCase(){return"tokenAssociate"}_makeTransactionData(){return{tokens:null!=this._tokenIds?this._tokenIds.map(e=>e._toProtobuf()):null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenAssociateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenAssociate",TokenAssociateTransaction._fromProtobuf);class TokenBurnTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._amount=null,this._serials=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.amount&&this.setAmount(e.amount),null!=e.serials&&this.setSerials(e.serials)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenBurn;return Transaction._fromProtobufTransactions(new TokenBurnTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,amount:null!=a.amount?a.amount:void 0,serials:null!=a.serialNumbers?a.serialNumbers:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}get serials(){return this._serials}setSerials(e){return this._requireNotFrozen(),this._serials=e.map(e=>e instanceof Long?e:Long.fromValue(e)),this}_execute(e,t){return e.token.burnToken(t)}_getTransactionDataCase(){return"tokenBurn"}_makeTransactionData(){return{amount:this._amount,serialNumbers:this._serials,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenBurnTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenBurn",TokenBurnTransaction._fromProtobuf);class TokenReference{constructor(){this.fungibleToken=null,this.nft=null}static _fromProtobuf(e){return{fungibleToken:null!=e.fungibleToken?TokenId._fromProtobuf(e.fungibleToken):null,nft:null!=e.nft?NftId._fromProtobuf(e.nft):null}}}class TokenRejectTransaction extends Transaction{constructor(e={}){super(),this._owner=null,null!=e.owner&&this.setOwnerId(e.owner),this._tokenIds=[],this._nftIds=[],null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.nftIds&&this.setNftIds(e.nftIds)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenReject,i=a.rejections?.map(e=>TokenReference._fromProtobuf(e)),s=i?.filter(e=>e.fungibleToken).map(({fungibleToken:e})=>{if(null==e)throw new Error("Fungible Token cannot be null");return e}),c=i?.filter(e=>e.nft).map(({nft:e})=>{if(null==e)throw new Error("Nft cannot be null");return e});return Transaction._fromProtobufTransactions(new TokenRejectTransaction({owner:null!=a.owner?AccountId._fromProtobuf(a.owner):void 0,tokenIds:s,nftIds:c}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e,this}addTokenId(e){return this._requireNotFrozen(),this._tokenIds?.push(e),this}get nftIds(){return this._nftIds}setNftIds(e){return this._requireNotFrozen(),this._nftIds=e,this}addNftId(e){return this._requireNotFrozen(),this._nftIds?.push(e),this}get ownerId(){return this._owner}setOwnerId(e){return this._requireNotFrozen(),this._owner=e,this}_execute(e,t){return e.token.rejectToken(t)}_getTransactionDataCase(){return"tokenReject"}_makeTransactionData(){const e=[];for(const t of this._tokenIds)e.push({fungibleToken:t._toProtobuf()});for(const t of this._nftIds)e.push({nft:t._toProtobuf()});return{owner:this.ownerId?._toProtobuf()??null,rejections:e}}_getLogId(){return`TokenRejectTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenReject",TokenRejectTransaction._fromProtobuf);class TokenDissociateTransaction extends Transaction{constructor(e={}){super(),this._tokenIds=null,this._accountId=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenDissociate;return Transaction._fromProtobufTransactions(new TokenDissociateTransaction({tokenIds:null!=a.tokens?a.tokens.map(e=>TokenId._fromProtobuf(e)):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e.map(e=>"string"==typeof e?TokenId.fromString(e):e.clone()),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e);for(const t of null!=this._tokenIds?this._tokenIds:[])null!=t&&t.validateChecksum(e)}_execute(e,t){return e.token.dissociateTokens(t)}_getTransactionDataCase(){return"tokenDissociate"}_makeTransactionData(){return{tokens:null!=this._tokenIds?this._tokenIds.map(e=>e._toProtobuf()):null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenDissociateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenDissociate",TokenDissociateTransaction._fromProtobuf);class TokenRejectFlow{constructor(){this._ownerId=null,this._tokenIds=[],this._nftIds=[],this._freezeWithClient=null,this._signPrivateKey=null,this._signPublicKey=null,this._transactionSigner=null}setOwnerId(e){return this.requireNotFrozen(),this._ownerId=e,this}get ownerId(){return this._ownerId}setTokenIds(e){return this.requireNotFrozen(),this._tokenIds=e,this}addTokenId(e){return this.requireNotFrozen(),this._tokenIds.push(e),this}get tokenIds(){return this._tokenIds}setNftIds(e){return this.requireNotFrozen(),this._nftIds=e,this}addNftId(e){return this.requireNotFrozen(),this._nftIds.push(e),this}get nftIds(){return this._nftIds}sign(e){return this._signPrivateKey=e,this._signPublicKey=null,this._transactionSigner=null,this}signWith(e,t){return this._signPublicKey=e,this._transactionSigner=t,this._signPrivateKey=null,this}signWithOperator(e){const t=e.getOperator();if(null==t)throw new Error("Client operator must be set");return this._signPublicKey=t.publicKey,this._transactionSigner=t.transactionSigner,this._signPrivateKey=null,this}fillOutTransaction(e){this._freezeWithClient&&e.freezeWith(this._freezeWithClient),this._signPrivateKey?e.sign(this._signPrivateKey):this._signPublicKey&&this._transactionSigner&&e.signWith(this._signPublicKey,this._transactionSigner)}freezeWith(e){return this._freezeWithClient=e,this}async execute(e){const t=(new TokenRejectTransaction).setTokenIds(this.tokenIds).setNftIds(this.nftIds);this.ownerId&&t.setOwnerId(this.ownerId),this.fillOutTransaction(t);const n=this.nftIds.map(e=>e.tokenId).filter(function(e,t,n){return n.indexOf(e)===t}),r=(new TokenDissociateTransaction).setTokenIds([...this.tokenIds,...n]);null!=this.ownerId&&r.setAccountId(this.ownerId),this.fillOutTransaction(r);const o=await t.execute(e);await o.getReceipt(e);const a=await r.execute(e);return await a.getReceipt(e),o}requireNotFrozen(){if(null!=this._freezeWithClient)throw new Error("Transaction is already frozen and cannot be modified")}}class TokenType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenType.FungibleCommon:return"FUNGIBLE_COMMON";case TokenType.NonFungibleUnique:return"NON_FUNGIBLE_UNIQUE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenType.FungibleCommon;case 1:return TokenType.NonFungibleUnique}throw new Error(`(BUG) TokenType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenType.FungibleCommon=new TokenType(0),TokenType.NonFungibleUnique=new TokenType(1);class TokenSupplyType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenSupplyType.Infinite:return"INFINITE";case TokenSupplyType.Finite:return"FINITE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenSupplyType.Infinite;case 1:return TokenSupplyType.Finite}throw new Error(`(BUG) TokenSupplyType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenSupplyType.Infinite=new TokenSupplyType(0),TokenSupplyType.Finite=new TokenSupplyType(1);class TokenCreateTransaction extends Transaction{constructor(e={}){super(),this._tokenName=null,this._tokenSymbol=null,this._decimals=null,this._initialSupply=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._pauseKey=null,this._wipeKey=null,this._supplyKey=null,this._feeScheduleKey=null,this._freezeDefault=null,this._autoRenewAccountId=null,this._expirationTime=new Timestamp(Math.floor(Date.now()/1e3+DEFAULT_AUTO_RENEW_PERIOD.toNumber()),0),this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._tokenMemo=null,this._customFees=[],this._tokenType=null,this._supplyType=null,this._maxSupply=null,this._defaultMaxTransactionFee=new Hbar(30),this._metadataKey=null,this._metadata=null,null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.decimals&&this.setDecimals(e.decimals),null!=e.initialSupply&&this.setInitialSupply(e.initialSupply),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.freezeDefault&&this.setFreezeDefault(e.freezeDefault),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.tokenType&&this.setTokenType(e.tokenType),null!=e.supplyType&&this.setSupplyType(e.supplyType),null!=e.maxSupply&&this.setMaxSupply(e.maxSupply),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenCreation;return Transaction._fromProtobufTransactions(new TokenCreateTransaction({tokenName:null!=a.name?a.name:void 0,tokenSymbol:null!=a.symbol?a.symbol:void 0,decimals:null!=a.decimals?a.decimals:void 0,initialSupply:null!=a.initialSupply?a.initialSupply:void 0,treasuryAccountId:null!=a.treasury?AccountId._fromProtobuf(a.treasury):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,kycKey:null!=a.kycKey?Key._fromProtobufKey(a.kycKey):void 0,freezeKey:null!=a.freezeKey?Key._fromProtobufKey(a.freezeKey):void 0,pauseKey:null!=a.pauseKey?Key._fromProtobufKey(a.pauseKey):void 0,wipeKey:null!=a.wipeKey?Key._fromProtobufKey(a.wipeKey):void 0,supplyKey:null!=a.supplyKey?Key._fromProtobufKey(a.supplyKey):void 0,feeScheduleKey:null!=a.feeScheduleKey?Key._fromProtobufKey(a.feeScheduleKey):void 0,freezeDefault:null!=a.freezeDefault?a.freezeDefault:void 0,autoRenewAccountId:null!=a.autoRenewAccount?AccountId._fromProtobuf(a.autoRenewAccount):void 0,expirationTime:null!=a.expiry?Timestamp._fromProtobuf(a.expiry):void 0,autoRenewPeriod:null!=a.autoRenewPeriod?Duration._fromProtobuf(a.autoRenewPeriod):void 0,tokenMemo:null!=a.memo?a.memo:void 0,customFees:null!=a.customFees?a.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):void 0,tokenType:null!=a.tokenType?TokenType._fromCode(a.tokenType):void 0,supplyType:null!=a.supplyType?TokenSupplyType._fromCode(a.supplyType):void 0,maxSupply:null!=a.maxSupply?a.maxSupply:void 0,metadataKey:null!=a.metadataKey?Key._fromProtobufKey(a.metadataKey):void 0,metadata:null!=a.metadata?a.metadata:void 0}),e,t,n,r,o)}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get decimals(){return this._decimals}setDecimals(e){return this._requireNotFrozen(),this._decimals=e instanceof Long?e:Long.fromValue(e),this}get initialSupply(){return this._initialSupply}setInitialSupply(e){return this._requireNotFrozen(),this._initialSupply=convertAmountToLong(e),this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId&&null!=this.autoRenewPeriod?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&null!=this.autoRenewPeriod&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get freezeDefault(){return this._freezeDefault}setFreezeDefault(e){return this._requireNotFrozen(),this._freezeDefault=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this._autoRenewPeriod=null,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get customFees(){return this._customFees}setCustomFees(e){return this._customFees=e,this}get tokenType(){return this._tokenType}setTokenType(e){return this._tokenType=e,this}get supplyType(){return this._supplyType}setSupplyType(e){return this._supplyType=e,this}get maxSupply(){return this._maxSupply}setMaxSupply(e){return this._maxSupply=convertAmountToLong(e),this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.createToken(t)}_getTransactionDataCase(){return"tokenCreation"}_makeTransactionData(){return{name:this._tokenName,symbol:this._tokenSymbol,decimals:null!=this._decimals?this._decimals.toInt():null,initialSupply:this._initialSupply,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,freezeDefault:this._freezeDefault,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:this._tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this._tokenType?this._tokenType._code:null,supplyType:null!=this._supplyType?this._supplyType._code:null,maxSupply:this.maxSupply,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?this._metadata:void 0}}_getLogId(){return`TokenCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenCreation",TokenCreateTransaction._fromProtobuf);class TokenDeleteTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenDeletion;return Transaction._fromProtobufTransactions(new TokenDeleteTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.deleteToken(t)}_getTransactionDataCase(){return"tokenDeletion"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenDeletion",TokenDeleteTransaction._fromProtobuf);class TokenFeeScheduleUpdateTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._customFees=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.customFees&&this.setCustomFees(e.customFees)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenFeeScheduleUpdate;return Transaction._fromProtobufTransactions(new TokenFeeScheduleUpdateTransaction({tokenId:null!=a.tokenId?TokenId._fromProtobuf(a.tokenId):void 0,customFees:null!=a.customFees?a.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):TokenId._fromProtobuf(e._toProtobuf()),this}get customFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}_execute(e,t){return e.token.updateTokenFeeSchedule(t)}_getTransactionDataCase(){return"tokenFeeScheduleUpdate"}_makeTransactionData(){return{tokenId:null!=this._tokenId?this._tokenId._toProtobuf():null,customFees:this._customFees.map(e=>e._toProtobuf())}}_getLogId(){return`TokenFeeScheduleUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenFeeScheduleUpdate",TokenFeeScheduleUpdateTransaction._fromProtobuf);class TokenFreezeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenFreeze;return Transaction._fromProtobufTransactions(new TokenFreezeTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.freezeTokenAccount(t)}_getTransactionDataCase(){return"tokenFreeze"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenFreezeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenFreeze",TokenFreezeTransaction._fromProtobuf);class TokenGrantKycTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenGrantKyc;return Transaction._fromProtobufTransactions(new TokenGrantKycTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.grantKycToTokenAccount(t)}_getTransactionDataCase(){return"tokenGrantKyc"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenGrantKycTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenGrantKyc",TokenGrantKycTransaction._fromProtobuf);class TokenInfo{constructor(e){this.tokenId=e.tokenId,this.name=e.name,this.symbol=e.symbol,this.decimals=e.decimals,this.totalSupply=e.totalSupply,this.treasuryAccountId=e.treasuryAccountId,this.adminKey=e.adminKey,this.kycKey=e.kycKey,this.freezeKey=e.freezeKey,this.pauseKey=e.pauseKey,this.wipeKey=e.wipeKey,this.supplyKey=e.supplyKey,this.feeScheduleKey=e.feeScheduleKey,this.defaultFreezeStatus=e.defaultFreezeStatus,this.defaultKycStatus=e.defaultKycStatus,this.pauseStatus=e.pauseStatus,this.isDeleted=e.isDeleted,this.autoRenewAccountId=e.autoRenewAccountId,this.autoRenewPeriod=e.autoRenewPeriod,this.expirationTime=e.expirationTime,this.tokenMemo=e.tokenMemo,this.customFees=e.customFees,this.tokenType=e.tokenType,this.supplyType=e.supplyType,this.maxSupply=e.maxSupply,this.ledgerId=e.ledgerId,this.metadataKey=e.metadataKey,this.metadata=e.metadata}static _fromProtobuf(e){const t=e.defaultFreezeStatus,n=e.defaultKycStatus,r=e.pauseStatus,o=null!=e.autoRenewAccount?AccountId._fromProtobuf(e.autoRenewAccount):new AccountId(0);return new TokenInfo({tokenId:TokenId._fromProtobuf(e.tokenId),name:e.name,symbol:e.symbol,decimals:e.decimals,totalSupply:Long.fromValue(e.totalSupply),treasuryAccountId:null!=e.treasury?AccountId._fromProtobuf(e.treasury):null,adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,kycKey:null!=e.kycKey?Key._fromProtobufKey(e.kycKey):null,freezeKey:null!=e.freezeKey?Key._fromProtobufKey(e.freezeKey):null,pauseKey:null!=e.pauseKey?Key._fromProtobufKey(e.pauseKey):null,wipeKey:null!=e.wipeKey?Key._fromProtobufKey(e.wipeKey):null,supplyKey:null!=e.supplyKey?Key._fromProtobufKey(e.supplyKey):null,feeScheduleKey:null!=e.feeScheduleKey?Key._fromProtobufKey(e.feeScheduleKey):null,defaultFreezeStatus:0===t?null:1==t,defaultKycStatus:0===n?null:1==n,pauseStatus:0===r?null:1==r,isDeleted:e.deleted,autoRenewAccountId:0!=o.shard.toInt()||0!=o.realm.toInt()||0!=o.num.toInt()?o:null,autoRenewPeriod:null!=e.autoRenewPeriod?Duration._fromProtobuf(e.autoRenewPeriod):null,expirationTime:null!=e.expiry?Timestamp._fromProtobuf(e.expiry):null,tokenMemo:null!=e.memo?e.memo:"",customFees:null!=e.customFees?e.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):[],tokenType:null!=e.tokenType?TokenType._fromCode(e.tokenType):null,supplyType:null!=e.supplyType?TokenSupplyType._fromCode(e.supplyType):null,maxSupply:null!=e.maxSupply?e.maxSupply:null,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,metadataKey:null!=e.metadataKey?Key._fromProtobufKey(e.metadataKey):null,metadata:null!=e.metadata?e.metadata:new Uint8Array})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),name:this.name,symbol:this.symbol,decimals:this.decimals,totalSupply:this.totalSupply,treasury:null!=this.treasuryAccountId?this.treasuryAccountId._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,kycKey:null!=this.kycKey?this.kycKey._toProtobufKey():null,freezeKey:null!=this.freezeKey?this.freezeKey._toProtobufKey():null,pauseKey:null!=this.pauseKey?this.pauseKey._toProtobufKey():null,wipeKey:null!=this.wipeKey?this.wipeKey._toProtobufKey():null,supplyKey:null!=this.supplyKey?this.supplyKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,defaultFreezeStatus:null==this.defaultFreezeStatus?0:this.defaultFreezeStatus?1:2,defaultKycStatus:null==this.defaultKycStatus?0:this.defaultKycStatus?1:2,pauseStatus:null==this.pauseStatus?0:this.pauseStatus?1:2,deleted:this.isDeleted,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():void 0,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,expiry:null!=this.expirationTime?this.expirationTime._toProtobuf():null,memo:this.tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this.tokenType?this.tokenType._code:null,supplyType:null!=this.supplyType?this.supplyType._code:null,maxSupply:this.maxSupply,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,metadataKey:null!=this.metadataKey?this.metadataKey._toProtobufKey():null,metadata:null!=this.metadata?this.metadata:null}}static fromBytes(e){return TokenInfo._fromProtobuf(libExports.proto.TokenInfo.decode(e))}toBytes(){return libExports.proto.TokenInfo.encode(this._toProtobuf()).finish()}}class TokenInfoQuery extends Query{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e){const t=e.tokenGetInfo;return new TokenInfoQuery({tokenId:null!=t.token?TokenId._fromProtobuf(t.token):void 0})}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.getTokenInfo(t)}_mapResponseHeader(e){return e.tokenGetInfo.header}_mapResponse(e,t,n){const r=e.tokenGetInfo;return Promise.resolve(TokenInfo._fromProtobuf(r.tokenInfo))}_onMakeRequest(e){return{tokenGetInfo:{header:e,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}}_getLogId(){return`TokenInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("tokenGetInfo",TokenInfoQuery._fromProtobuf);class TokenMintTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._amount=null,this._metadata=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.amount&&this.setAmount(e.amount),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenMint;return Transaction._fromProtobufTransactions(new TokenMintTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,amount:null!=a.amount?a.amount:void 0,metadata:null!=a.metadata?a.metadata:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}get metadata(){return this._metadata}addMetadata(e){return this._requireNotFrozen(),"string"==typeof e&&console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead."),this._metadata.push("string"==typeof e?decode$7(e):e),this}setMetadata(e){this._requireNotFrozen();for(const t of e)if("string"==typeof t){console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.");break}return this._metadata=e.map(e=>"string"==typeof e?decode$7(e):e),this}_execute(e,t){return e.token.mintToken(t)}_getTransactionDataCase(){return"tokenMint"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,metadata:this._metadata}}_getLogId(){return`TokenMintTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenMint",TokenMintTransaction._fromProtobuf);class TokenNftInfo{constructor(e){this.nftId=e.nftId,this.accountId=e.accountId,this.creationTime=e.creationTime,this.metadata=e.metadata,this.ledgerId=e.ledgerId,this.spenderId=e.spenderId,Object.freeze(this)}static _fromProtobuf(e){return new TokenNftInfo({nftId:NftId._fromProtobuf(e.nftID),accountId:AccountId._fromProtobuf(e.accountID),creationTime:Timestamp._fromProtobuf(e.creationTime),metadata:void 0!==e.metadata?e.metadata:null,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,spenderId:null!=e.spenderId?AccountId._fromProtobuf(e.spenderId):null})}_toProtobuf(){return{nftID:this.nftId._toProtobuf(),accountID:this.accountId._toProtobuf(),creationTime:this.creationTime._toProtobuf(),metadata:this.metadata,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,spenderId:null!=this.spenderId?this.spenderId._toProtobuf():null}}toJson(){return{nftId:this.nftId.toString(),accountId:this.accountId.toString(),creationTime:this.creationTime.toString(),metadata:null!=this.metadata?encode$4(this.metadata):null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,spenderId:null!=this.spenderId?this.spenderId.toString():null}}toString(){return JSON.stringify(this.toJson())}}class TokenNftInfoQuery extends Query{constructor(e={}){super(),this._nftId=null,null!=e.nftId&&this.setNftId(e.nftId),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._start=null,null!=e.start&&this.setStart(e.start),this._end=null,null!=e.end&&this.setEnd(e.end)}static _fromProtobuf(e){if(null!=e.tokenGetNftInfo){const t=e.tokenGetNftInfo;return new TokenNftInfoQuery({nftId:null!=t.nftID?NftId._fromProtobuf(t.nftID):void 0})}if(null!=e.tokenGetAccountNftInfos){const t=e.tokenGetAccountNftInfos;return new TokenNftInfoQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,start:null!=t.start?t.start:void 0,end:null!=t.end?t.end:void 0})}{const t=e.tokenGetNftInfos;return new TokenNftInfoQuery({tokenId:null!=t.tokenID?TokenId._fromProtobuf(t.tokenID):void 0,start:null!=t.start?t.start:void 0,end:null!=t.end?t.end:void 0})}}get nftId(){return this._nftId}setNftId(e){return this._nftId="string"==typeof e?NftId.fromString(e):NftId._fromProtobuf(e._toProtobuf()),this}get accountId(){return console.warn("`TokenNftInfoQuery.accountId` is deprecated with no replacement"),this._accountId}setAccountId(e){return console.warn("`TokenNftInfoQuery.setAccountId()` is deprecated with no replacement"),this._accountId="string"==typeof e?AccountId.fromString(e):AccountId._fromProtobuf(e._toProtobuf()),this}get tokenId(){return console.warn("`TokenNftInfoQuery.tokenId` is deprecated with no replacement"),this._tokenId}setTokenId(e){return console.warn("`TokenNftInfoQuery.setTokenId()` is deprecated with no replacement"),this._tokenId="string"==typeof e?TokenId.fromString(e):TokenId._fromProtobuf(e._toProtobuf()),this}get start(){return console.warn("`TokenNftInfoQuery.start` is deprecated with no replacement"),this._start}setStart(e){return console.warn("`TokenNftInfoQuery.setStart()` is deprecated with no replacement"),this._start="number"==typeof e?Long.fromNumber(e):e,this}get end(){return console.warn("`TokenNftInfoQuery.end` is deprecated with no replacement"),this._end}setEnd(e){return console.warn("`TokenNftInfoQuery.setEnd()` is deprecated with no replacement"),this._end="number"==typeof e?Long.fromNumber(e):e,this}async getCost(e){return super.getCost(e)}_execute(e,t){return e.token.getTokenNftInfo(t)}_mapResponseHeader(e){return e.tokenGetNftInfo.header}_mapResponse(e,t,n){const r=[e.tokenGetNftInfo.nft];return Promise.resolve(r.map(e=>TokenNftInfo._fromProtobuf(e)))}_onMakeRequest(e){return{tokenGetNftInfo:{header:e,nftID:null!=this._nftId?this._nftId._toProtobuf():null}}}_getLogId(){return`TokenNftInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("tokenGetNftInfo",TokenNftInfoQuery._fromProtobuf);class TokenPauseTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenPause;return Transaction._fromProtobufTransactions(new TokenPauseTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.pauseToken(t)}_getTransactionDataCase(){return"tokenPause"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenPauseTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenPause",TokenPauseTransaction._fromProtobuf);class TokenRevokeKycTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenRevokeKyc;return Transaction._fromProtobufTransactions(new TokenRevokeKycTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.revokeKycFromTokenAccount(t)}_getTransactionDataCase(){return"tokenRevokeKyc"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenRevokeKycTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenRevokeKyc",TokenRevokeKycTransaction._fromProtobuf);class TokenUnfreezeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenUnfreeze;return Transaction._fromProtobufTransactions(new TokenUnfreezeTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.unfreezeTokenAccount(t)}_getTransactionDataCase(){return"tokenUnfreeze"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenUnfreezeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUnfreeze",TokenUnfreezeTransaction._fromProtobuf);class TokenUnpauseTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenUnpause;return Transaction._fromProtobufTransactions(new TokenUnpauseTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.unpauseToken(t)}_getTransactionDataCase(){return"tokenUnpause"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenUnpauseTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUnpause",TokenUnpauseTransaction._fromProtobuf);class TokenKeyValidation{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenKeyValidation.FullValidation:return"FULL_VALIDATION";case TokenKeyValidation.NoValidation:return"NO_VALIDATION";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenKeyValidation.FullValidation;case 1:return TokenKeyValidation.NoValidation}throw new Error(`(BUG) TokenKeyValidation.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenKeyValidation.FullValidation=new TokenKeyValidation(0),TokenKeyValidation.NoValidation=new TokenKeyValidation(1);class TokenUpdateTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._tokenName=null,this._tokenSymbol=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._wipeKey=null,this._supplyKey=null,this._autoRenewAccountId=null,this._expirationTime=null,this._autoRenewPeriod=null,this._tokenMemo=null,this._feeScheduleKey=null,this._pauseKey=null,this._metadataKey=null,this._metadata=null,this._keyVerificationMode=TokenKeyValidation.FullValidation,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata),null!=e.keyVerificationMode&&this.setKeyVerificationMode(e.keyVerificationMode)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenUpdate;return Transaction._fromProtobufTransactions(new TokenUpdateTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,tokenName:Object.hasOwn(a,"name")?a.name:void 0,tokenSymbol:Object.hasOwn(a,"symbol")?a.symbol:void 0,treasuryAccountId:null!=a.treasury?AccountId._fromProtobuf(a.treasury):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,kycKey:null!=a.kycKey?Key._fromProtobufKey(a.kycKey):void 0,freezeKey:null!=a.freezeKey?Key._fromProtobufKey(a.freezeKey):void 0,wipeKey:null!=a.wipeKey?Key._fromProtobufKey(a.wipeKey):void 0,supplyKey:null!=a.supplyKey?Key._fromProtobufKey(a.supplyKey):void 0,autoRenewAccountId:null!=a.autoRenewAccount?AccountId._fromProtobuf(a.autoRenewAccount):void 0,expirationTime:null!=a.expiry?Timestamp._fromProtobuf(a.expiry):void 0,autoRenewPeriod:null!=a.autoRenewPeriod?Duration._fromProtobuf(a.autoRenewPeriod):void 0,tokenMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0,feeScheduleKey:null!=a.feeScheduleKey?Key._fromProtobufKey(a.feeScheduleKey):void 0,pauseKey:null!=a.pauseKey?Key._fromProtobufKey(a.pauseKey):void 0,metadataKey:null!=a.metadataKey?Key._fromProtobufKey(a.metadataKey):void 0,metadata:null!=a.metadata&&Object.hasOwn(a.metadata,"value")?a.metadata.value:void 0,keyVerificationMode:null!=a.keyVerificationMode?TokenKeyValidation._fromCode(a.keyVerificationMode):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}setsupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}get keyVerificationMode(){return this._keyVerificationMode}setKeyVerificationMode(e){return this._requireNotFrozen(),this._keyVerificationMode=e,this}clearTokenMemo(){return this._requireNotFrozen(),this._tokenMemo=null,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.updateToken(t)}_getTransactionDataCase(){return"tokenUpdate"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,name:null!=this.tokenName?this.tokenName:null,symbol:this.tokenSymbol,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:null!=this._tokenMemo?{value:this._tokenMemo}:null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?{value:this._metadata}:null,keyVerificationMode:null!=this._keyVerificationMode?this._keyVerificationMode._code:void 0}}_getLogId(){return`TokenUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUpdate",TokenUpdateTransaction._fromProtobuf);class TokenWipeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,this._serials=[],this._amount=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId),null!=e.amount&&this.setAmount(e.amount),null!=e.serials&&this.setSerials(e.serials)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenWipe;return Transaction._fromProtobufTransactions(new TokenWipeTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0,amount:null!=a.amount?a.amount:void 0,serials:null!=a.serialNumbers?a.serialNumbers:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}get serials(){return this._serials}setSerials(e){return this._requireNotFrozen(),this._serials=e.map(e=>"number"==typeof e?Long.fromNumber(e):e),this}_execute(e,t){return e.token.wipeTokenAccount(t)}_getTransactionDataCase(){return"tokenWipe"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null,serialNumbers:this.serials}}_getLogId(){return`TokenWipeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenWipe",TokenWipeTransaction._fromProtobuf);class TopicCreateTransaction extends Transaction{constructor(e={}){super(),this._defaultMaxTransactionFee=new Hbar(25),this._adminKey=null,this._submitKey=null,this._feeScheduleKey=null,this._feeExemptKeys=[],this._autoRenewAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._customFees=[],this._topicMemo=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.submitKey&&this.setSubmitKey(e.submitKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.topicMemo&&this.setTopicMemo(e.topicMemo)}static _fromProtobuf(e,t,n,r,o){const a=o[0].consensusCreateTopic;return Transaction._fromProtobufTransactions(new TopicCreateTransaction({adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,submitKey:null!=a.submitKey?Key._fromProtobufKey(a.submitKey):void 0,feeScheduleKey:null!=a.feeScheduleKey?Key._fromProtobufKey(a.feeScheduleKey):void 0,feeExemptKeys:null!=a.feeExemptKeyList?a.feeExemptKeyList.map(e=>Key._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=a.autoRenewAccount?AccountId._fromProtobuf(a.autoRenewAccount):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,customFees:null!=a.customFees?a.customFees.map(e=>CustomFixedFee._fromProtobuf(e)):void 0,topicMemo:null!=a.memo?a.memo:void 0}),e,t,n,r,o)}get topicMemo(){return this._topicMemo}getTopicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}get adminKey(){return this._adminKey}getAdminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get submitKey(){return this._submitKey}getSubmitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}getAutoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}getAutoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}_execute(e,t){return e.consensus.createTopic(t)}_getTransactionDataCase(){return"consensusCreateTopic"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:this._feeExemptKeys.map(e=>e._toProtobufKey()),autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),customFees:this._customFees.map(e=>e._toTopicFeeProtobuf()),memo:this._topicMemo}}_getLogId(){return`TopicCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusCreateTopic",TopicCreateTransaction._fromProtobuf);class TopicDeleteTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].consensusDeleteTopic;return Transaction._fromProtobufTransactions(new TopicDeleteTransaction({topicId:null!=a.topicID?TopicId._fromProtobuf(a.topicID):void 0}),e,t,n,r,o)}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e)}_execute(e,t){return e.consensus.deleteTopic(t)}_getTransactionDataCase(){return"consensusDeleteTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null}}_getLogId(){return`TopicDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusDeleteTopic",TopicDeleteTransaction._fromProtobuf);class TopicInfo{constructor(e){this.topicId=e.topicId,this.topicMemo=e.topicMemo,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.expirationTime=e.expirationTime,this.adminKey=e.adminKey,this.submitKey=e.submitKey,this.feeScheduleKey=e.feeScheduleKey,this.feeExemptKeys=e.feeExemptKeys,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.customFees=e.customFees,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(e){const t=e.topicInfo;return new TopicInfo({topicId:TopicId._fromProtobuf(e.topicID),topicMemo:null!=t.memo?t.memo:"",runningHash:null!=t.runningHash?t.runningHash:new Uint8Array,sequenceNumber:null!=t.sequenceNumber?t.sequenceNumber instanceof Long?t.sequenceNumber:Long.fromValue(t.sequenceNumber):Long.ZERO,expirationTime:null!=t.expirationTime?Timestamp._fromProtobuf(t.expirationTime):null,adminKey:null!=t.adminKey?Key._fromProtobufKey(t.adminKey):null,submitKey:null!=t.submitKey?Key._fromProtobufKey(t.submitKey):null,feeScheduleKey:null!=t.feeScheduleKey?Key._fromProtobufKey(t.feeScheduleKey):null,feeExemptKeys:null!=t.feeExemptKeyList?t.feeExemptKeyList.map(e=>Key._fromProtobufKey(e)):null,autoRenewPeriod:null!=t.autoRenewPeriod?new Duration(t.autoRenewPeriod.seconds):null,autoRenewAccountId:null!=t.autoRenewAccount?AccountId._fromProtobuf(t.autoRenewAccount):null,customFees:null!=t.customFees?t.customFees.map(e=>CustomFixedFee._fromProtobuf(e)):null,ledgerId:null!=t.ledgerId?LedgerId.fromBytes(t.ledgerId):null})}_toProtobuf(){return{topicID:this.topicId._toProtobuf(),topicInfo:{memo:this.topicMemo,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber,expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,submitKey:null!=this.submitKey?this.submitKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this.feeExemptKeys?this.feeExemptKeys.map(e=>e._toProtobufKey()):null,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,customFees:null!=this.customFees?this.customFees.map(e=>e._toProtobuf()):null}}}static fromBytes(e){return TopicInfo._fromProtobuf(libExports.proto.ConsensusGetTopicInfoResponse.decode(e))}toBytes(){return libExports.proto.ConsensusGetTopicInfoResponse.encode(this._toProtobuf()).finish()}}class TopicInfoQuery extends Query{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId)}static _fromProtobuf(e){const t=e.consensusGetTopicInfo;return new TopicInfoQuery({topicId:null!=t.topicID?TopicId._fromProtobuf(t.topicID):void 0})}get topicId(){return this._topicId}setTopicId(e){return this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e)}_execute(e,t){return e.consensus.getTopicInfo(t)}_mapResponseHeader(e){return e.consensusGetTopicInfo.header}_mapResponse(e,t,n){return Promise.resolve(TopicInfo._fromProtobuf(e.consensusGetTopicInfo))}_onMakeRequest(e){return{consensusGetTopicInfo:{header:e,topicID:null!=this._topicId?this._topicId._toProtobuf():null}}}_getLogId(){return`TopicInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("consensusGetTopicInfo",TopicInfoQuery._fromProtobuf);class TopicMessageChunk{constructor(e){this.consensusTimestamp=e.consensusTimestamp,this.contents=e.contents,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,Object.freeze(this)}static _fromProtobuf(e){return new TopicMessageChunk({consensusTimestamp:Timestamp._fromProtobuf(e.consensusTimestamp),contents:null!=e.message?e.message:new Uint8Array,runningHash:null!=e.runningHash?e.runningHash:new Uint8Array,sequenceNumber:null!=e.sequenceNumber?e.sequenceNumber instanceof Long?e.sequenceNumber:Long.fromValue(e.sequenceNumber):Long.ZERO})}_toProtobuf(){return{consensusTimestamp:this.consensusTimestamp._toProtobuf(),message:this.contents,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber}}}class TopicMessage{constructor(e){this.consensusTimestamp=e.consensusTimestamp,this.contents=e.contents,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.chunks=e.chunks,this.initialTransactionId=e.initialTransactionId,Object.freeze(this)}static _ofSingle(e){return new TopicMessage({consensusTimestamp:Timestamp._fromProtobuf(e.consensusTimestamp),contents:null!=e.message?e.message:new Uint8Array,runningHash:null!=e.runningHash?e.runningHash:new Uint8Array,sequenceNumber:null!=e.sequenceNumber?e.sequenceNumber instanceof Long?e.sequenceNumber:Long.fromNumber(e.sequenceNumber):Long.ZERO,initialTransactionId:null!=e.chunkInfo&&null!=e.chunkInfo.initialTransactionID?TransactionId._fromProtobuf(e.chunkInfo.initialTransactionID):null,chunks:[TopicMessageChunk._fromProtobuf(e)]})}static _ofMany(e){const t=e[e.length-1],n=Timestamp._fromProtobuf(t.consensusTimestamp),r=t.runningHash,o=null!=t.sequenceNumber?t.sequenceNumber instanceof Long?t.sequenceNumber:Long.fromValue(t.sequenceNumber):Long.ZERO;e.sort((e,t)=>(null!=e&&null!=e.chunkInfo&&null!=e.chunkInfo.number?e.chunkInfo.number:0)<(null!=t&&null!=t.chunkInfo&&null!=t.chunkInfo.number?t.chunkInfo.number:0)?-1:1);const a=e.map(e=>TopicMessageChunk._fromProtobuf(e)),i=a.map(e=>e.contents.length).reduce((e,t)=>e+t,0),s=new Uint8Array(i);let c=0;e.forEach(e=>{s.set(e.message,c),c+=e.message.length});let u=null;return e.length>0&&null!=e[0].chunkInfo&&null!=e[0].chunkInfo.initialTransactionID&&(u=TransactionId._fromProtobuf(e[0].chunkInfo.initialTransactionID)),new TopicMessage({consensusTimestamp:n,contents:s,runningHash:r,sequenceNumber:o,chunks:a,initialTransactionId:u})}}class TopicMessageQuery{constructor(e={}){this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._startTime=null,null!=e.startTime&&this.setStartTime(e.startTime),this._endTime=null,null!=e.endTime&&this.setEndTime(e.endTime),this._limit=null,null!=e.limit&&this.setLimit(e.limit),this._errorHandler=(e,t)=>{console.error(`Error attempting to subscribe to topic: ${null!=this._topicId?this._topicId.toString():""}`)},null!=e.errorHandler&&(this._errorHandler=e.errorHandler),this._listener=null,this._completionHandler=()=>{console.log(`Subscription to topic ${null!=this._topicId?this._topicId.toString():""} complete`)},null!=e.completionHandler&&(this._completionHandler=e.completionHandler),this._maxAttempts=20,this._maxBackoff=8e3,this._retryHandler=e=>{if(null!=e){if(e instanceof Error)return!0;switch(e.code){case 13:return RST_STREAM.test(e.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},null!=e.retryHandler&&(this._retryHandler=e.retryHandler),this._attempt=0,this._handle=null,this.setMaxBackoff(8e3)}get topicId(){return this._topicId}setTopicId(e){return this.requireNotSubscribed(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}get startTime(){return this._startTime}setStartTime(e){return this.requireNotSubscribed(),this._startTime=e instanceof Timestamp?e:e instanceof Date?Timestamp.fromDate(e):new Timestamp(e,0),this}get endTime(){return this._endTime}setEndTime(e){return this.requireNotSubscribed(),this._endTime=e instanceof Timestamp?e:e instanceof Date?Timestamp.fromDate(e):new Timestamp(e,0),this}get limit(){return this._limit}setLimit(e){return this.requireNotSubscribed(),this._limit=e instanceof Long?e:Long.fromValue(e),this}setErrorHandler(e){return this._errorHandler=e,this}setCompletionHandler(e){return this.requireNotSubscribed(),this._completionHandler=e,this}setMaxAttempts(e){return this.requireNotSubscribed(),this._maxAttempts=e,this}setMaxBackoff(e){return this.requireNotSubscribed(),this._maxBackoff=e,this}subscribe(e,t,n){return this._handle=new SubscriptionHandle,this._listener=n,null!=t&&(this._errorHandler=t),this._makeServerStreamRequest(e),this._handle}_makeServerStreamRequest(e){const t=this._buildConsensusRequest(),n=new Map,r=e._mirrorNetwork.getNextMirrorNode().getChannel().makeServerStreamRequest("ConsensusService","subscribeTopic",t,e=>this._handleMessage(e,n),t=>this._handleError(t,e),this._completionHandler);null!=this._handle&&this._handle._setCall(()=>r())}requireNotSubscribed(){if(null!=this._handle)throw new Error("Cannot change fields on an already subscribed query")}_passTopicMessage(e){try{if(null==this._listener)throw new Error("(BUG) listener is unexpectedly not set");this._listener(e)}catch(t){this._errorHandler(e,t)}}_buildConsensusRequest(){return libExports.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode({topicID:this._topicId?._toProtobuf()??null,consensusStartTime:this._startTime?._toProtobuf()??null,consensusEndTime:this._endTime?._toProtobuf()??null,limit:this._limit}).finish()}_handleMessage(e,t){const n=libExports.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode(e);this._limit?.gt(0)&&(this._limit=this._limit.sub(1)),this._startTime=Timestamp._fromProtobuf(n.consensusTimestamp).plusNanos(1),null==n.chunkInfo||null!=n.chunkInfo&&1===n.chunkInfo.total?this._passTopicMessage(TopicMessage._ofSingle(n)):this._handleChunkedMessage(n,t)}_handleChunkedMessage(e,t){const n=e.chunkInfo,r=n.initialTransactionID,o=n.total,a=TransactionId._fromProtobuf(r).toString();let i=[];const s=t.get(a);if(null==s?t.set(a,i):i=s,i.push(e),i.length===o){const e=TopicMessage._ofMany(i);t.delete(a),this._passTopicMessage(e)}}_handleError(e,t){const n=e instanceof Error?e.message:e.details;this._handle?._unsubscribed||(this.shouldRetry(e)?this._scheduleRetry(t,n):this._errorHandler(null,new Error(n)))}shouldRetry(e){return this._attempt<this._maxAttempts&&this._retryHandler(e)}_scheduleRetry(e,t){const n=Math.min(250*2**this._attempt,this._maxBackoff);console.warn(`Error subscribing to topic ${this._topicId?.toString()??"UNKNOWN"} during attempt ${this._attempt}. Waiting ${n} ms before next attempt: ${t}`),this._attempt+=1,setTimeout(()=>this._makeServerStreamRequest(e),n)}}class TopicMessageSubmitTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._message=null,null!=e.message&&this.setMessage(e.message),this._maxChunks=20,this._chunkSize=CHUNK_SIZE,null!=e.maxChunks&&this.setMaxChunks(e.maxChunks),null!=e.chunkSize&&this.setChunkSize(e.chunkSize),this._chunkInfo=null}static _fromProtobuf(e,t,n,r,o){const a=o[0].consensusSubmitMessage;return Transaction._fromProtobufTransactions(new TopicMessageSubmitTransaction({topicId:null!=a.topicID?TopicId._fromProtobuf(a.topicID):void 0,message:null!=a.message?a.message:void 0}),e,t,n,r,o)}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}get message(){return this._message}getMessage(){return this._message}setMessage(e){return this._requireNotFrozen(),e=requireStringOrUint8Array(e),this._message=e instanceof Uint8Array?e:encode(e),this}getCustomFeeLimits(){return this._customFeeLimits}setCustomFeeLimits(e){return this._requireNotFrozen(),this._customFeeLimits=e,this}addCustomFeeLimit(e){return this._requireNotFrozen(),this._customFeeLimits.push(e),this}get maxChunks(){return this._maxChunks}getMaxChunks(){return this._maxChunks}setMaxChunks(e){return this._requireNotFrozen(),this._maxChunks=e,this}get chunkSize(){return this._chunkSize}getChunkSize(){return this._chunkSize}setChunkSize(e){return this._chunkSize=e,this}getRequiredChunks(){if(null==this._message)return 1;return Math.ceil(this._message.length/this._chunkSize)}freezeWith(e){if(super.freezeWith(e),null==this._message)return this;const t=Math.floor((this._message.length+(this._chunkSize-1))/this._chunkSize);if(t>this._maxChunks)throw new Error(`Message with size ${this._message.length} too long for ${this._maxChunks} chunks`);const n=this._getTransactionId()._toProtobuf();let r=this._getTransactionId();this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<t;e++){this._chunkInfo={initialTransactionID:n,total:t,number:e+1},this._transactionIds.push(r),this._transactionIds.advance();for(const e of this._nodeAccountIds.list)this._signedTransactions.push(this._makeSignedTransaction(e));r=new TransactionId(r.accountId,new Timestamp(r.validStart.seconds,r.validStart.nanos.add(1)))}return this._transactionIds.advance(),this._chunkInfo=null,this}schedule(){if(this._requireNotFrozen(),null!=this._message&&this._message.length>this._chunkSize)throw new Error(`cannot schedule \`TopicMessageSubmitTransaction\` with message over ${this._chunkSize} bytes`);return super.schedule()}async execute(e,t){return(await this.executeAll(e,t))[0]}async executeAll(e,t){super._isFrozen()||this.freezeWith(e);const n=this._getTransactionId(),r=e.operatorAccountId;null!=r&&r.equals(n.accountId)&&await super.signWithOperator(e);const o=[];let a=t;for(let t=0;t<this._transactionIds.length;t++){const t=Date.now();o.push(await super.execute(e,a)),null!=a&&(a=Date.now()-t)}return o}_execute(e,t){return e.consensus.submitMessage(t)}_getTransactionDataCase(){return"consensusSubmitMessage"}_makeTransactionData(){if(null!=this._chunkInfo&&null!=this._message){const e=(this._chunkInfo.number-1)*this._chunkSize;let t=e+this._chunkSize;return t>this._message.length&&(t=this._message.length),{topicID:null!=this._topicId?this._topicId._toProtobuf():null,message:this._message.slice(e,t),chunkInfo:this._chunkInfo}}return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,message:this._message}}_getLogId(){return`TopicMessageSubmitTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusSubmitMessage",TopicMessageSubmitTransaction._fromProtobuf);class TopicUpdateTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._topicMemo=null,null!=e.topicMemo&&this.setTopicMemo(e.topicMemo),this._submitKey=null,null!=e.submitKey&&this.setSubmitKey(e.submitKey),this._adminKey=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),this._feeScheduleKey=null,null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),this._feeExemptKeys=null,null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),this._autoRenewAccountId=null,null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),this._autoRenewPeriod=null,null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),this._customFees=null,null!=e.customFees&&this.setCustomFees(e.customFees),this._expirationTime=null,null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(e,t,n,r,o){const a=o[0].consensusUpdateTopic;return Transaction._fromProtobufTransactions(new TopicUpdateTransaction({topicId:null!=a.topicID?TopicId._fromProtobuf(a.topicID):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,submitKey:null!=a.submitKey?Key._fromProtobufKey(a.submitKey):void 0,feeScheduleKey:null!=a.feeScheduleKey?Key._fromProtobufKey(a.feeScheduleKey):void 0,feeExemptKeys:null!=a.feeExemptKeyList&&null!=a.feeExemptKeyList.keys?a?.feeExemptKeyList.keys.map(e=>Key._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=a.autoRenewAccount?AccountId._fromProtobuf(a.autoRenewAccount):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,customFees:null!=a.customFees&&null!=a.customFees.fees?a.customFees.fees.map(e=>CustomFixedFee._fromProtobuf(e)):void 0,topicMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0}),e,t,n,r,o)}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?Timestamp.fromDate(e):e,this}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}clearTopicId(){return this._requireNotFrozen(),this._topicId=null,this}get topicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}clearTopicMemo(){return this._requireNotFrozen(),this._topicMemo=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}clearAdminKey(){return this._requireNotFrozen(),this._adminKey=null,this}get submitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}clearSubmitKey(){return this._requireNotFrozen(),this._submitKey=null,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}clearFeeScheduleKey(){return this._requireNotFrozen(),this._feeScheduleKey=null,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),null==this._feeExemptKeys&&(this._feeExemptKeys=[]),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}clearAutoRenewAccountId(){return this._requireNotFrozen(),this._autoRenewAccountId=null,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),null==this._customFees&&(this._customFees=[]),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.consensus.updateTopic(t)}_getTransactionDataCase(){return"consensusUpdateTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this._feeExemptKeys?{keys:this._feeExemptKeys.map(e=>e._toProtobufKey())}:null,memo:null!=this._topicMemo?{value:this._topicMemo}:null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,customFees:null!=this._customFees?{fees:this._customFees.map(e=>e._toTopicFeeProtobuf())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`TopicUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusUpdateTopic",TopicUpdateTransaction._fromProtobuf);class HbarTransferMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromProtobuf(e){const t=new HbarTransferMap;for(const n of null!=e.accountAmounts?e.accountAmounts:[]){const e=AccountId._fromProtobuf(n.accountID);t._set(e,Hbar.fromTinybars(n.amount))}return t}}class TransferTransaction extends AbstractTokenTransferTransaction{constructor(e={}){super(),this._hbarTransfers=[],this._defaultMaxTransactionFee=new Hbar(1);for(const t of null!=e.hbarTransfers?e.hbarTransfers:[])this.addHbarTransfer(t.accountId,t.amount)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoTransfer,i=new TransferTransaction;return i._tokenTransfers=TokenTransfer._fromProtobuf(null!=a.tokenTransfers?a.tokenTransfers:[]),i._hbarTransfers=Transfer._fromProtobuf(null!=a.transfers&&null!=a.transfers.accountAmounts?a.transfers.accountAmounts:[]),i._nftTransfers=TokenNftTransfer._fromProtobuf(null!=a.tokenTransfers?a.tokenTransfers:[]),Transaction._fromProtobufTransactions(i,e,t,n,r,o)}get hbarTransfers(){const e=new HbarTransferMap;for(const t of this._hbarTransfers)e._set(t.accountId,t.amount);return e}get hbarTransfersList(){return this._hbarTransfers}_addHbarTransfer(e,t,n,r){this._requireNotFrozen();const o=e instanceof AccountId?e.clone():AccountId.fromString(e),a=t instanceof Hbar?t:new Hbar(t);for(const e of this._hbarTransfers)if(0===e.accountId.compare(o))return e.amount=Hbar.fromTinybars(e.amount.toTinybars().add(a.toTinybars())),this;return this._hbarTransfers.push(new Transfer({accountId:o,amount:a,isApproved:n,hookCall:r})),this}addHbarTransfer(e,t){return this._addHbarTransfer(e,t,!1)}addApprovedHbarTransfer(e,t){return this._addHbarTransfer(e,t,!0)}_validateChecksums(e){for(const t of this._hbarTransfers)t.accountId.validateChecksum(e);for(const t of this._tokenTransfers)t.tokenId.validateChecksum(e),t.accountId.validateChecksum(e);for(const t of this._nftTransfers)t.tokenId.validateChecksum(e),t.senderAccountId.validateChecksum(e),t.receiverAccountId.validateChecksum(e)}setHbarTransferApproval(e,t){const n="string"==typeof e?AccountId.fromString(e):e;for(const e of this._hbarTransfers)0===e.accountId.compare(n)&&(e.isApproved=t);return this}setTokenTransferApproval(e,t,n){const r="string"==typeof e?TokenId.fromString(e):e,o="string"==typeof t?AccountId.fromString(t):t;for(const e of this._tokenTransfers)0===e.tokenId.compare(r)&&0===e.accountId.compare(o)&&(e.isApproved=n);return this}setNftTransferApproval(e,t){const n="string"==typeof e?NftId.fromString(e):e;for(const e of this._nftTransfers)0===e.tokenId.compare(n.tokenId)&&0===e.serialNumber.compare(n.serial)&&(e.isApproved=t);return this}addHbarTransferWithHook(e,t,n){return this._addHbarTransfer(e,t,!1,new FungibleHookCall({hookId:n.hookId,evmHookCall:n.evmHookCall,type:n.type}))}addNftTransferWithHook(e,t,n,r,o){return this._addNftTransfer(!1,e,t,n,void 0,r,o)}addTokenTransferWithHook(e,t,n,r){const o=new FungibleHookCall({hookId:null!=r.hookId?r.hookId:void 0,evmHookCall:null!=r.evmHookCall?r.evmHookCall:void 0,type:r.type});return this._addTokenTransfer(e,t,n,!1,null,o)}_execute(e,t){return e.crypto.cryptoTransfer(t)}_getTransactionDataCase(){return"cryptoTransfer"}_makeTransactionData(){const{tokenTransfers:e}=super._makeTransactionData();return this._hbarTransfers.sort((e,t)=>e.accountId.compare(t.accountId)),{transfers:{accountAmounts:this._hbarTransfers.map(e=>e._toProtobuf())},tokenTransfers:e}}_getLogId(){return`TransferTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoTransfer",TransferTransaction._fromProtobuf.bind(null));class Wallet{constructor(e,t,n){let r;r="string"==typeof t&&PrivateKey.isDerKey(t)?PrivateKey.fromStringDer(t):"string"==typeof t?PrivateKey.fromString(t):t,this.publicKey=r.publicKey,this.signer=e=>Promise.resolve(r.sign(e)),this.provider=n,this.accountId="string"==typeof e?AccountId.fromString(e):e}static createRandomED25519(){const e=PrivateKey.generateED25519(),t=e.publicKey.toAccountId(0,0);return Promise.resolve(new Wallet(t,e))}static createRandomECDSA(){const e=PrivateKey.generateECDSA(),t=e.publicKey.toAccountId(0,0);return Promise.resolve(new Wallet(t,e))}getProvider(){return this.provider}getAccountId(){return this.accountId}getAccountKey(){return this.publicKey}getLedgerId(){return null==this.provider?null:this.provider.getLedgerId()}getNetwork(){return null==this.provider?{}:this.provider.getNetwork()}getMirrorNetwork(){return null==this.provider?[]:this.provider.getMirrorNetwork()}async sign(e){const t=[];for(const n of e)t.push(new SignerSignature({publicKey:this.publicKey,signature:await this.signer(n),accountId:this.accountId}));return t}getAccountBalance(){return this.call((new AccountBalanceQuery).setAccountId(this.accountId))}getAccountInfo(){return this.call((new AccountInfoQuery).setAccountId(this.accountId))}getAccountRecords(){return this.call((new AccountRecordsQuery).setAccountId(this.accountId))}signTransaction(e){return e.signWith(this.publicKey,this.signer)}checkTransaction(e){const t=e.transactionId;if(null!=t&&null!=t.accountId&&0!=t.accountId.compare(this.accountId))throw new Error("transaction's ID constructed with a different account ID");if(null==this.provider)return Promise.resolve(e);const n=(null!=e.nodeAccountIds?e.nodeAccountIds:[]).map(e=>e.toString()),r=Object.values(this.provider.getNetwork()).map(e=>e.toString());if(!n.reduce((e,t)=>e&&r.includes(t),!0))throw new Error("Transaction already set node account IDs to values not within the current network");return Promise.resolve(e)}populateTransaction(e){if(e._freezeWithAccountId(this.accountId),null==e.transactionId&&e.setTransactionId(TransactionId.generate(this.accountId)),null!=e.nodeAccountIds&&0!=e.nodeAccountIds.length)return Promise.resolve(e.freeze());if(null==this.provider)return Promise.resolve(e);const t=Object.values(this.provider.getNetwork()).map(e=>"string"==typeof e?AccountId.fromString(e):e);return shuffle(t),e.setNodeAccountIds(t.slice(0,(t.length+3-1)/3)),Promise.resolve(e.freeze())}call(e){if(null==this.provider)throw new Error("cannot send request with an wallet that doesn't contain a provider");return this.provider.call(e._setOperatorWith(this.accountId,this.publicKey,this.signer))}}var browser={exports:{}},quickFormatUnescaped,hasRequiredQuickFormatUnescaped,hasRequiredBrowser;function requireQuickFormatUnescaped(){if(hasRequiredQuickFormatUnescaped)return quickFormatUnescaped;function e(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}return hasRequiredQuickFormatUnescaped=1,quickFormatUnescaped=function(t,n,r){var o=r&&r.stringify||e;if("object"==typeof t&&null!==t){var a=n.length+1;if(1===a)return t;var i=new Array(a);i[0]=o(t);for(var s=1;s<a;s++)i[s]=o(n[s]);return i.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var u="",l=0,d=-1,p=t&&t.length||0,h=0;h<p;){if(37===t.charCodeAt(h)&&h+1<p){switch(d=d>-1?d:0,t.charCodeAt(h+1)){case 100:case 102:if(l>=c)break;if(null==n[l])break;d<h&&(u+=t.slice(d,h)),u+=Number(n[l]),d=h+2,h++;break;case 105:if(l>=c)break;if(null==n[l])break;d<h&&(u+=t.slice(d,h)),u+=Math.floor(Number(n[l])),d=h+2,h++;break;case 79:case 111:case 106:if(l>=c)break;if(void 0===n[l])break;d<h&&(u+=t.slice(d,h));var f=typeof n[l];if("string"===f){u+="'"+n[l]+"'",d=h+2,h++;break}if("function"===f){u+=n[l].name||"<anonymous>",d=h+2,h++;break}u+=o(n[l]),d=h+2,h++;break;case 115:if(l>=c)break;d<h&&(u+=t.slice(d,h)),u+=String(n[l]),d=h+2,h++;break;case 37:d<h&&(u+=t.slice(d,h)),u+="%",d=h+2,h++,l--}++l}++h}if(-1===d)return t;d<p&&(u+=t.slice(d));return u},quickFormatUnescaped}function requireBrowser(){if(hasRequiredBrowser)return browser.exports;hasRequiredBrowser=1;const e=requireQuickFormatUnescaped();browser.exports=c;const t=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},n={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:f,res:f,err:p,errWithCause:p};function r(e,t){return"silent"===e?1/0:t.levels.values[e]}const o=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),i={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function s(e,t){const n={logger:t,parent:e[a]};t[a]=n}function c(e){(e=e||{}).browser=e.browser||{};const n=e.browser.transmit;if(n&&"function"!=typeof n.send)throw Error("pino: transmit option must have a send function");const a=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const p=e.serializers||{},f=function(e,t){if(Array.isArray(e))return e.filter(function(e){return"!stdSerializers.err"!==e});return!0===e&&Object.keys(t)}(e.browser.serialize,p);let y=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(y=!1);const g=Object.keys(e.customLevels||{}),_=["error","fatal","warn","info","debug","trace"].concat(g);"function"==typeof a&&_.forEach(function(e){a[e]=a}),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const b=e.level||"info",I=Object.create(a);I.log||(I.log=m),function(e,n,r){const a={};n.forEach(e=>{a[e]=r[e]?r[e]:t[e]||t[i[e]||"log"]||m}),e[o]=a}(I,_,a),s({},I),Object.defineProperty(I,"levelVal",{get:function(){return r(this.level,this)}}),Object.defineProperty(I,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,u(this,k,I,"error"),u(this,k,I,"fatal"),u(this,k,I,"warn"),u(this,k,I,"info"),u(this,k,I,"debug"),u(this,k,I,"trace"),g.forEach(e=>{u(this,k,I,e)})}});const k={transmit:n,serialize:f,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:_,timestamp:h(e),messageKey:e.messageKey||"msg",onChild:e.onChild||m};function T(t,r,o){if(!r)throw new Error("missing bindings for child Pino");o=o||{},f&&r.serializers&&(o.serializers=r.serializers);const a=o.serializers;if(f&&a){var i=Object.assign({},p,a),c=!0===e.browser.serialize?Object.keys(i):f;delete r.serializers,l([r],c,i,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.bindings=r,i&&(this.serializers=i,this._serialize=c),n&&(this._logEvent=d([].concat(e._logEvent.bindings,r)))}u.prototype=this;const h=new u(this);return s(this,h),h.child=function(...e){return T.call(this,t,...e)},h.level=o.level||this.level,t.onChild(h),h}return I.levels=function(e){const t=e.customLevels||{},n=Object.assign({},c.levels.values,t),r=Object.assign({},c.levels.labels,function(e){const t={};return Object.keys(e).forEach(function(n){t[e[n]]=n}),t}(t));return{values:n,labels:r}}(e),I.level=b,I.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},I.setMaxListeners=I.getMaxListeners=I.emit=I.addListener=I.on=I.prependListener=I.once=I.prependOnceListener=I.removeListener=I.removeAllListeners=I.listeners=I.listenerCount=I.eventNames=I.write=I.flush=m,I.serializers=p,I._serialize=f,I._stdErrSerialize=y,I.child=function(...e){return T.call(this,k,...e)},n&&(I._logEvent=d()),I}function u(n,i,s,c){if(Object.defineProperty(n,c,{value:r(n.level,s)>r(c,s)?m:s[o][c],writable:!0,enumerable:!0,configurable:!0}),n[c]===m){if(!i.transmit)return;const e=r(i.transmit.level||n.level,s);if(r(c,s)<e)return}n[c]=function(n,a,i,s){return c=n[o][s],function(){const o=a.timestamp(),u=new Array(arguments.length),p=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var h=0;h<u.length;h++)u[h]=arguments[h];var f=!1;if(a.serialize&&(l(u,this._serialize,this.serializers,this._stdErrSerialize),f=!0),a.asObject||a.formatters?c.call(p,...function(t,n,r,o,a){const{level:i,log:s=e=>e}=a.formatters||{},c=r.slice();let u=c[0];const l={};let d=1+(0|t._childLevel);if(d<1&&(d=1),o&&(l.time=o),i){const e=i(n,t.levels.values[n]);Object.assign(l,e)}else l.level=t.levels.values[n];if(a.asObjectBindingsOnly){if(null!==u&&"object"==typeof u)for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());return[s(l),...c]}if(null!==u&&"object"==typeof u){for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());u=c.length?e(c.shift(),c):void 0}else"string"==typeof u&&(u=e(c.shift(),c));return void 0!==u&&(l[a.messageKey]=u),[s(l)]}(this,s,u,o,a)):c.apply(p,u),a.transmit){const e=r(a.transmit.level||n._level,i),t=r(s,i);if(t<e)return;!function(e,t,n,r=!1){const o=t.send,a=t.ts,i=t.methodLevel,s=t.methodValue,c=t.val,u=e._logEvent.bindings;r||l(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=a,e._logEvent.messages=n.filter(function(e){return-1===u.indexOf(e)}),e._logEvent.level.label=i,e._logEvent.level.value=s,o(i,e._logEvent,c),e._logEvent=d(u)}(this,{ts:o,methodLevel:s,methodValue:t,transmitValue:i.levels.values[a.transmit.level||n._level],send:a.transmit.send,val:r(n._level,i)},u,f)}};var c}(n,i,s,c);const u=function(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[a];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}(n);0!==u.length&&(n[c]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(u,n[c]))}function l(e,t,n,r){for(const o in e)if(r&&e[o]instanceof Error)e[o]=c.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const r in e[o])t.indexOf(r)>-1&&r in n&&(e[o][r]=n[r](e[o][r]))}function d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function p(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function h(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?g:_}function f(){return{}}function y(e){return e}function m(){}function g(){return!1}function _(){return Date.now()}return c.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},c.stdSerializers=n,c.stdTimeFunctions=Object.assign({},{nullTime:g,epochTime:_,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),browser.exports.default=c,browser.exports.pino=c,browser.exports}var browserExports=requireBrowser(),pino=getDefaultExportFromCjs(browserExports);class LogLevel{constructor(e){this._name=e,Object.freeze(this)}toString(){switch(this){case LogLevel.Silent:return"silent";case LogLevel.Trace:return"trace";case LogLevel.Debug:return"debug";case LogLevel.Info:return"info";case LogLevel.Warn:return"warn";case LogLevel.Error:return"error";case LogLevel.Fatal:return"fatal";default:return`Unknown log level (${this._name})`}}static _fromString(e){switch(e){case"silent":return LogLevel.Silent;case"trace":return LogLevel.Trace;case"debug":return LogLevel.Debug;case"info":return LogLevel.Info;case"warn":return LogLevel.Warn;case"error":return LogLevel.Error;case"fatal":return LogLevel.Fatal;default:throw new Error(`Unknown log level: ${e}`)}}}LogLevel.Silent=new LogLevel("silent"),LogLevel.Trace=new LogLevel("trace"),LogLevel.Debug=new LogLevel("debug"),LogLevel.Info=new LogLevel("info"),LogLevel.Warn=new LogLevel("warn"),LogLevel.Error=new LogLevel("error"),LogLevel.Fatal=new LogLevel("fatal");class Logger{constructor(e,t="",n=!0,r=!0,o=!0,a=0){let i,s;if("object"!=typeof e||null===e||e instanceof LogLevel?(i=e,s=!1):(({logFile:t="",silent:s=!1,sync:n=!0,fsync:r=!0,mkdir:o=!0,minLength:a=0}=e),i=e.level),this._previousLevel=i,s)return void(this._logger=pino({level:"silent",enabled:!1}));const c=t?pino.destination({dest:t,sync:n,fsync:r,mkdir:o,minLength:a}):null,u=c?{level:i.toString(),timestamp:pino.stdTimeFunctions.isoTime,formatters:{bindings:()=>({}),level:e=>({level:e.toUpperCase()})}}:{level:i.toString(),transport:{target:"pino-pretty",options:{translateTime:"SYS:dd-mm-yyyy HH:MM:ss",ignore:"pid,hostname"}}};this._logger=c?pino(u,c):pino(u)}setLogger(e){return this._logger=e,this}setLevel(e){return this._previousLevel=LogLevel._fromString(this._logger.level),this._logger.level=e.toString(),this}get level(){return LogLevel._fromString(this._logger.level)}get levels(){return this._logger.levels.labels}setSilent(e){return this._logger.level=e?LogLevel.Silent.toString():this._previousLevel.toString(),this}get silent(){return this._logger.level==LogLevel.Silent.toString()}trace(e){this._logger.trace(e)}debug(e){this._logger.debug(e)}info(e){this._logger.info(e)}warn(e){this._logger.warn(e)}error(e){this._logger.error(e)}fatal(e){this._logger.fatal(e)}}class TokenUpdateNftsTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._serialNumbers=[],this._metadata=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.serialNumbers&&this.setSerialNumbers(e.serialNumbers),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenUpdateNfts;return Transaction._fromProtobufTransactions(new TokenUpdateNftsTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,serialNumbers:null!=a.serialNumbers?a.serialNumbers:[],metadata:null!=a.metadata&&Object.hasOwn(a.metadata,"value")?a.metadata.value:void 0}),e,t,n,r,o)}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}setSerialNumbers(e){return this._requireNotFrozen(),this._serialNumbers=e,this}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.pauseToken(t)}_getTransactionDataCase(){return"tokenUpdateNfts"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,serialNumbers:null!=this._serialNumbers?this._serialNumbers:[],...null!=this._metadata?{metadata:{value:this._metadata}}:null}}_getLogId(){return`TokenUpdateNftsTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUpdateNfts",TokenUpdateNftsTransaction._fromProtobuf);class ServiceEndpoint{constructor(e){this._ipAddressV4=null!=e?.ipAddressV4?e.ipAddressV4:null,this._port=null!=e?.port?e.port:null,this._domainName=null!=e?.domainName?e.domainName:null}setIpAddressV4(e){if(null!=this._domainName)throw new Error("Cannot set IP address when domain name is already set.");return this._ipAddressV4=e,this}get getIpAddressV4(){return this._ipAddressV4}setPort(e){return this._port=e,this}get getPort(){return this._port}setDomainName(e){if(null!=this._ipAddressV4)throw new Error("Cannot set domain name when IP address is already set.");return this._domainName=e,this}get getDomainName(){return this._domainName}static _fromProtobuf(e){return new ServiceEndpoint({ipAddressV4:null!=e.ipAddressV4?e.ipAddressV4:void 0,port:null!=e.port?e.port:void 0,domainName:null!=e.domainName?e.domainName:void 0})}_toProtobuf(){return{ipAddressV4:this._ipAddressV4,port:this._port,domainName:this._domainName}}}const DESCRIPTION_MAX_LENGTH$1=100,GOSSIP_ENDPOINTS_MAX_LENGTH$1=10,SERVICE_ENDPOINTS_MAX_LENGTH$1=8;class NodeCreateTransaction extends Transaction{constructor(e){super(),this._accountId=null!=e?.accountId?e.accountId:null,this._description=null!=e?.description?e.description:null,this._gossipEndpoints=null!=e?.gossipEndpoints?e.gossipEndpoints:null,this._serviceEndpoints=null!=e?.serviceEndpoints?e.serviceEndpoints:null,this._gossipCaCertificate=null!=e?.gossipCaCertificate?e.gossipCaCertificate:null,this._grpcCertificateHash=null!=e?.grpcCertificateHash?e.grpcCertificateHash:null,this._grpcWebProxyEndpoint=e?.grpcWebProxyEndpoint||null,this._adminKey=null!=e?.adminKey?e.adminKey:null,this._declineReward=null!=e?.declineReward?e.declineReward:null}static _fromProtobuf(e,t,n,r,o){const a=o[0].nodeCreate;return Transaction._fromProtobufTransactions(new NodeCreateTransaction({accountId:null!=a.accountId?AccountId._fromProtobuf(a.accountId):void 0,description:null!=a.description?a.description:void 0,gossipEndpoints:null!=a.gossipEndpoint?a.gossipEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,serviceEndpoints:null!=a.serviceEndpoint?a.serviceEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,gossipCaCertificate:null!=a.gossipCaCertificate?a.gossipCaCertificate:void 0,grpcCertificateHash:null!=a.grpcCertificateHash?a.grpcCertificateHash:void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,declineReward:null!=a.declineReward?a.declineReward:void 0,grpcWebProxyEndpoint:null!=a.grpcProxyEndpoint?ServiceEndpoint._fromProtobuf(a.grpcProxyEndpoint):void 0}),e,t,n,r,o)}setAccountId(e){return this._requireNotFrozen(),this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get accountId(){return this._accountId}setDescription(e){if(this._requireNotFrozen(),e.length>DESCRIPTION_MAX_LENGTH$1)throw new Error(`Description must be at most ${DESCRIPTION_MAX_LENGTH$1} characters.`);return this._description=e,this}get description(){return this._description}setGossipEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipEndpoints list must not be empty.");if(e.length>GOSSIP_ENDPOINTS_MAX_LENGTH$1)throw new Error(`GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH$1} entries.`);return this._gossipEndpoints=[...e],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(e){return null!=this._gossipEndpoints&&this._gossipEndpoints.push(e),this}setServiceEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("ServiceEndpoints list must not be empty.");if(e.length>SERVICE_ENDPOINTS_MAX_LENGTH$1)throw new Error(`ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH$1} entries.`);return this._serviceEndpoints=[...e],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(e){return null!=this._serviceEndpoints&&this._serviceEndpoints.push(e),this}setGossipCaCertificate(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=e,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(e){return this._requireNotFrozen(),this._grpcCertificateHash=e,this}get certificateHash(){return this._grpcCertificateHash}setGrpcWebProxyEndpoint(e){return this._requireNotFrozen(),this._grpcWebProxyEndpoint=e,this}get grpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get adminKey(){return this._adminKey}setDeclineReward(e){return this._requireNotFrozen(),this._declineReward=e,this}get declineReward(){return this._declineReward}_execute(e,t){return e.addressBook.createNode(t)}_getTransactionDataCase(){return"nodeCreate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:null!=this._description?this._description:null,gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map(e=>e._toProtobuf()):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map(e=>e._toProtobuf()):null,gossipCaCertificate:null!=this._gossipCaCertificate?this._gossipCaCertificate:null,grpcCertificateHash:null!=this._grpcCertificateHash?this._grpcCertificateHash:null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,declineReward:null!=this._declineReward?this._declineReward:null,grpcProxyEndpoint:null!=this._grpcWebProxyEndpoint?this._grpcWebProxyEndpoint._toProtobuf():null}}_getLogId(){return`NodeCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeCreate",NodeCreateTransaction._fromProtobuf);class NodeDeleteTransaction extends Transaction{constructor(e){super(),this._nodeId=null!=e?.nodeId?e.nodeId:null}static _fromProtobuf(e,t,n,r,o){const a=o[0].nodeDelete;return Transaction._fromProtobufTransactions(new NodeDeleteTransaction({nodeId:null!=a.nodeId?a.nodeId:void 0}),e,t,n,r,o)}setNodeId(e){if(this._requireNotFrozen(),null==e)return this._nodeId=null,this;const t=Long.isLong(e)?e:Long.fromValue(e);if(t.toNumber()<0)throw new Error("NodeDeleteTransaction: 'nodeId' must be positive.");return this._nodeId=t,this}get nodeId(){return this._nodeId}freezeWith(e){if(null==this.nodeId)throw new Error("NodeDeleteTransaction: 'nodeId' must be explicitly set before calling freeze().");return super.freezeWith(e)}_execute(e,t){return e.addressBook.deleteNode(t)}_getTransactionDataCase(){return"nodeDelete"}_makeTransactionData(){return{nodeId:null!=this._nodeId?this._nodeId:null}}_getLogId(){return`NodeDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeDelete",NodeDeleteTransaction._fromProtobuf);const DESCRIPTION_MAX_LENGTH=100,GOSSIP_ENDPOINTS_MAX_LENGTH=10,SERVICE_ENDPOINTS_MAX_LENGTH=8;class NodeUpdateTransaction extends Transaction{constructor(e){super(),this._nodeId=null!=e?.nodeId?e.nodeId:null,this._accountId=null!=e?.accountId?e.accountId:null,this._description=null!=e?.description?e.description:null,this._gossipEndpoints=null!=e?.gossipEndpoints?e.gossipEndpoints:null,this._serviceEndpoints=null!=e?.serviceEndpoints?e.serviceEndpoints:null,this._gossipCaCertificate=null!=e?.gossipCaCertificate?e.gossipCaCertificate:null,this._grpcCertificateHash=null!=e?.grpcCertificateHash?e.grpcCertificateHash:null,this._grpcWebProxyEndpoint=e?.grpcWebProxyEndpoint||null,this._adminKey=null!=e?.adminKey?e.adminKey:null,this._declineReward=null!=e?.declineReward?e.declineReward:null}static _fromProtobuf(e,t,n,r,o){const a=o[0].nodeUpdate;return Transaction._fromProtobufTransactions(new NodeUpdateTransaction({nodeId:null!=a.nodeId?a.nodeId:void 0,accountId:null!=a.accountId?AccountId._fromProtobuf(a.accountId):void 0,description:null!=a.description&&Object.hasOwn(a.description,"value")?a.description.value:void 0,gossipEndpoints:null!=a.gossipEndpoint?a.gossipEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,serviceEndpoints:null!=a.serviceEndpoint?a.serviceEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,gossipCaCertificate:null!=a.gossipCaCertificate&&Object.hasOwn(a.gossipCaCertificate,"value")?a.gossipCaCertificate.value:void 0,grpcCertificateHash:null!=a.grpcCertificateHash&&Object.hasOwn(a.grpcCertificateHash,"value")?a.grpcCertificateHash.value:void 0,grpcWebProxyEndpoint:null!=a.grpcProxyEndpoint?ServiceEndpoint._fromProtobuf(a.grpcProxyEndpoint):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,declineReward:null!=a.declineReward?.value?a.declineReward.value:void 0}),e,t,n,r,o)}setNodeId(e){if(this._requireNotFrozen(),null==e)return this._nodeId=null,this;const t=Long.isLong(e)?e:Long.fromValue(e);if(t.toNumber()<0)throw new Error("NodeUpdateTransaction: 'nodeId' must be positive.");return this._nodeId=t,this}get nodeId(){return this._nodeId}setAccountId(e){return this._requireNotFrozen(),this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get accountId(){return this._accountId}setDescription(e){if(this._requireNotFrozen(),e.length>DESCRIPTION_MAX_LENGTH)throw new Error(`Description must be at most ${DESCRIPTION_MAX_LENGTH} characters.`);return this._description=e,this}clearDescription(){this._description=""}get description(){return this._description}setGossipEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipEndpoints list must not be empty.");if(e.length>GOSSIP_ENDPOINTS_MAX_LENGTH)throw new Error(`GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH} entries.`);return this._gossipEndpoints=[...e],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(e){return this._requireNotFrozen(),null!=this._gossipEndpoints&&this._gossipEndpoints.push(e),this}setServiceEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("ServiceEndpoints list must not be empty.");if(e.length>SERVICE_ENDPOINTS_MAX_LENGTH)throw new Error(`ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH} entries.`);return this._serviceEndpoints=[...e],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(e){return this._requireNotFrozen(),null!=this._serviceEndpoints&&this._serviceEndpoints.push(e),this}setGossipCaCertificate(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=e,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(e){return this._requireNotFrozen(),this._grpcCertificateHash=e,this}get certificateHash(){return this._grpcCertificateHash}setGrpcWebProxyEndpoint(e){return this._requireNotFrozen(),this._grpcWebProxyEndpoint=e,this}get grpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get adminKey(){return this._adminKey}setDeclineReward(e){return this._requireNotFrozen(),this._declineReward=e,this}get declineReward(){return this._declineReward}deleteGrpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint=new ServiceEndpoint,this}freezeWith(e){if(null==this.nodeId)throw new Error("NodeUpdateTransaction: 'nodeId' must be explicitly set before calling freeze().");return super.freezeWith(e)}_execute(e,t){return e.addressBook.updateNode(t)}_getTransactionDataCase(){return"nodeUpdate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:null!=this._description?{value:this._description}:null,gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map(e=>e._toProtobuf()):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map(e=>e._toProtobuf()):null,gossipCaCertificate:null!=this._gossipCaCertificate?{value:this._gossipCaCertificate}:null,grpcCertificateHash:null!=this._grpcCertificateHash?{value:this._grpcCertificateHash}:null,grpcProxyEndpoint:null!=this._grpcWebProxyEndpoint?this._grpcWebProxyEndpoint._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,nodeId:null!=this._nodeId?this._nodeId:null,declineReward:null!=this._declineReward?{value:this._declineReward}:null}}_getLogId(){return`NodeUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeUpdate",NodeUpdateTransaction._fromProtobuf);const HOST_AND_PORT=/^(\S+):(\d+)$/;class ManagedNodeAddress{constructor(e={}){if(null!=e.address){const t=HOST_AND_PORT.exec(e.address);if(null==t)throw new Error(`failed to parse address: ${e.address}`);this._address=t[1],this._port=null!=t[2]?parseInt(t[2]):null}else{if(null==e.host||null==e.port)throw new Error(`failed to create a managed node address: ${JSON.stringify(e)}`);this._address=e.host,this._port=e.port}Object.freeze(this)}static fromString(e){return new ManagedNodeAddress({address:e})}toInsecure(){let e=50212===this.port?50211:this.port;return new ManagedNodeAddress({host:this.address,port:e})}toSecure(){let e=50211===this.port?50212:this.port;return new ManagedNodeAddress({host:this.address,port:e})}get address(){return this._address}get port(){return this._port}isTransportSecurity(){return 50212==this._port||443==this._port}toString(){return null==this.port?this.address:`${this.address}:${this.port}`}}class ManagedNode{constructor(e={}){if(null!=e.newNode)this._address="string"==typeof e.newNode.address?ManagedNodeAddress.fromString(e.newNode.address):e.newNode.address,this._cert=void 0,this._channel=null,this._channelInitFunction=e.newNode.channelInitFunction,this._lastUsed=Date.now(),this._readmitTime=Date.now(),this._useCount=0,this._badGrpcStatusCount=0,this._minBackoff=8e3,this._maxBackoff=36e5,this._currentBackoff=this._minBackoff;else{if(null==e.cloneNode)throw new Error(`failed to create ManagedNode: ${JSON.stringify(e)}`);this._address=e.cloneNode.address,this._cert=e.cloneNode.node._cert,this._channel=e.cloneNode.node._channel,this._channelInitFunction=e.cloneNode.node._channelInitFunction,this._currentBackoff=e.cloneNode.node._currentBackoff,this._lastUsed=e.cloneNode.node._lastUsed,this._readmitTime=e.cloneNode.node._readmitTime,this._useCount=e.cloneNode.node._useCount,this._badGrpcStatusCount=e.cloneNode.node._badGrpcStatusCount,this._minBackoff=e.cloneNode.node._minBackoff,this._maxBackoff=e.cloneNode.node._minBackoff}}getKey(){throw new Error("not implemented")}setCert(e){return this}get address(){return this._address}get attempts(){return this._badGrpcStatusCount}get minBackoff(){return this._minBackoff}setMinBackoff(e){return this._currentBackoff<=e&&(this._currentBackoff=e),this._minBackoff=e,this}get maxBackoff(){return this._maxBackoff}setMaxBackoff(e){return this._currentBackoff<=e&&(this._currentBackoff=e),this._maxBackoff=e,this}getChannel(){return this._useCount++,this.__lastUsed=Date.now(),null!=this._channel||(this._channel=this._channelInitFunction(this.address.toString(),this._cert)),this._channel}isHealthy(){return this._readmitTime<=Date.now()}increaseBackoff(){this._currentBackoff=Math.min(2*this._currentBackoff,this._maxBackoff),this._readmitTime=Date.now()+this._currentBackoff}decreaseBackoff(){this._currentBackoff=Math.max(this._currentBackoff/2,this._minBackoff)}getRemainingTime(){return this._readmitTime-this._lastUsed}backoff(){return new Promise(e=>setTimeout(e,this.getRemainingTime()))}compare(e){let t=this.getRemainingTime()-e.getRemainingTime();return 0!=t?t:(t=this._currentBackoff-e._currentBackoff,0!=t?t:(t=this._badGrpcStatusCount-e._badGrpcStatusCount,0!=t?t:(t=this._useCount-e._useCount,0!=t?t:this._lastUsed-e._lastUsed)))}close(){null!=this._channel&&this._channel.close(),this._channel=null}}class Node extends ManagedNode{constructor(e={}){if(super(e),null!=e.newNode)this._accountId=e.newNode.accountId,this._nodeAddress=null;else{if(null==e.cloneNode)throw new Error(`failed to create node: ${JSON.stringify(e)}`);this._accountId=e.cloneNode.node._accountId,this._nodeAddress=e.cloneNode.node._nodeAddress}}getKey(){return this._accountId.toString()}toInsecure(){return new Node({cloneNode:{node:this,address:this._address.toInsecure()}})}toSecure(){return new Node({cloneNode:{node:this,address:this._address.toSecure()}})}get accountId(){return this._accountId}get nodeAddress(){return this._nodeAddress}setNodeAddress(e){return this._nodeAddress=e,this}}const PREVIEWNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$7("0ad0070a0e33352e3233312e3230382e31343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340acf070a0d332e3231312e3234382e31373210a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ace070a0c34302e3132312e36342e343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ad1070a0d33352e3139392e31352e31373710a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad1070a0d332e3133332e3231332e31343610a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad0070a0c34302e37302e31312e32303210a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad2070a0e33352e3232352e3230312e31393510a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d35322e31352e3130352e31333010a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d3130342e34332e3234382e363310a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad2070a0e33352e3234372e3130392e31333510a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b35342e3234312e33382e3110a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b31332e38382e32322e343710a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330ad0070a0c33352e3233352e36352e353110a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d35342e3137372e35312e31323710a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad0070a0c31332e36342e3137302e343010a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d33342e3130362e3234372e363510a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33352e38332e38392e31373110a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad1070a0d31332e37382e3233322e31393210a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33342e3132352e32332e343910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390acf070a0b35302e31382e31372e393310a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390ad1070a0d32302e3135302e3133362e383910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a60363465303938363135626634303566376564356134303133343436623839633438386366636436626232356134613637366463373765656131316433336437303236383266306136396138303330653863353737376430653432323033373939"))),TESTNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$7("0a7f0a0c33342e39342e3130362e363110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a80010a0d35302e31382e3133322e32313110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a81010a0e3133382e39312e3134322e32313910a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a82010a0d33352e3233372e3131392e353510a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a7f0a0a332e3231322e362e313310a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d35322e3136382e37362e32343110a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d33352e3234352e32372e31393310a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a80010a0b35322e32302e31382e383610a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a81010a0c34302e37392e38332e31323410a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a82010a0d33342e38332e3131322e31313610a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35342e37302e3139322e333310a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35322e3138332e34352e363510a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a80010a0b33342e39342e3136302e3410a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e35342e3137362e3139392e31303910a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a82010a0d31332e36342e3138312e31333610a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e33342e3130362e3130322e32313810a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a82010a0d33352e3135352e34392e31343710a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a81010a0c31332e37382e3233382e333210a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a83010a0e33342e3133332e3139372e32333010a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e31342e3235322e32303710a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e3136352e31372e32333110a388031a05302e302e392806320218093a60363938333261373361333630326538643166626535616435386431633236333761316236373264373165653837616631306462363438656239316166623232383235336231663437653537643364346134346666353437623333393461613232"))),MAINNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$7("0ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633435363165336332373863643635306538306334313363613434343233633163336331336366313437356636663639373664353937616534333262343961623432303836623739623834313332363035346238623364636635376438666364373962666330353831383363613234636434633163626335373465643131313765326635623762336336336365376230366439623465666366373337353633376234316665366635336338313162396465363134336633613532393537636466393536373735313230623333373033666635373632313430376162393537356263326433356330643434663039383366633165663633613466663532303966303730633932616631303632393536303163393662636564303634656331393031393730313963363831316334633864643830636234663461633731663961643736653761633839343536666266346630313166393061626432643930353336653832333436353166366265663932376533643564386237626634353930353039383362656361336162656632613964393761663334353737326137373430653936393932373562303138656130646632383661646436636539323365663930386662653736326137356632313131363836326462343464336463613164343462346432653864633130363663353030366262356137643935346164323535643462363033323733343735653531316165623438356430363961303637633061623563323435333863393333633036623561366165666139343030356332393135323133653463636461653663393432663632373266396464353238326436623839306631663230656664323339396364363734393234666135373034366163366461333265373339353161373331313365393166633262376666323965343835316238336666333966383362613965633666303863656664626236636262626666616266646661613931643933306637323030646134383133376333393463626431336537303165636463323631366664323162616436383161613466303031303230333031303030312804320218073a603665396138616263646364653665313134396133656265313766643538643839303538333961383664623732623036613365613230616131373666383638623235343838353261653432336437613963366237636666396537313436323961320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613163343037373135343330336363373263346662373639326333663934323531626465633132333961316637613839373261626539316133353332336662656361363235613766666165363430366338353564633261663231313039303062306466306536653664623736333634646661316666653835656461353637393336653239383562383536333461333261613532613635393964643663333062653166376136633562386635656563616632363231643861343539363832666364326462616164313536316431316633336663636237663535303061633536386431363564626561616365333238366432383934663634313239643738316436633732666437643539396339653164336166346161343333633233623931306661653463343834313634316636313532366164373837656265613533393837343136376539643361373363633066623135363432396431356563373633613664306630363131356137396239616637383364373762393864383330393661613437343366393734303864396531346263663464646666653435393137363838343762343063623864613763613337353235366432623933356430393566653235326661653831666636653337663834643761393064376535373061346638656633633764373636656564613437326630393230313939303135613839303832353961383733633534353466636262646361643265353238646538353435356234303833633764633461646335613938386530636464666463313539643564373132616264353434616137336563303239303839383134633938613434663236666330363434363539633138336533313834616132373266386431646330626661336530613536303438346362303535626134646262356363333339656338306264313164363432646333613730326538633730336162323139333038346439626436336630646665313261343333633235373665616637383163666164383637656637306264613631373638623262656631346635306336633362386230393666303230333031303030312805320218083a606464336233653763643361323537643832373665343635333533363162303138623730303931663438363635653832303031306538316563303539326236396264346265316662643765636435303964303730313364643034313238343266640ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623263636163363561643066633736343561383137626661626334383761643765343133313165376133313938623337666238343264383463333935623366363764366264383438663130633666303363323930653866376461613864303031613834343164633335326131393136306133313933653638623832656466313961653637363933613961333364346362383765373839613130373037313535313565613737326361613862383661353639623931633534353038333564396333353466306461636563393766653737303931623435623134373639386237663836303134323264636432323631653932386465346461633963343264636261666466393663303732333362613330323730373666333763393639653865643330623662356438663530333462653764393263353936663862653836316535316663633361323432626639643862653965326139653865306631353565626366663233656666613763643537633130353432383131643830373736633935383535323666646230656161333465653139353564353131313933393066653837336534633034646564643239313635383834623938623436333038373838616537666334643461613461386663396263323637346261333231343933623632343435356164343130633164653731626339356431643931666130663230313431386137393565333039656166323937623639396266323763396661323736336364353963656230323165313662383230306331303630663238313766643833636663373637313833343839343631653335393932393162333830643665393339626161346231393233326136613237326464653635316638303436666463333464623237366137373764366662326265633332353562326363323434623461663536366231303566333063363530366464616530656233646564646366393437626362396336306530303039383466336234613863366334656434626639306263313933326237663934646333616536623336303030386562393032303430663962303230333031303030312802320218053a603561383634313561303861306138323566336232656237353031303135353230326533313234336665343161303333333834653738633138633131653565386632303964343933623062326664343565303662333734663262363964663564370ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613365333762373663366364356636363232643639323434343464313263363737633339356632623539303266336262393862386138623530353561373037373036636130323863643735303630613264383730326432643862303439343762646366653061386331343161613238343462316530366536363139303031326538623633323661623066613331373937336263376362346432393439663231303861613034633462306339316261613537323866356235363232656337356162663537386131663762343165646532613637656264363963313865353831666466396336303230616330646539636132633331663063363436393030333331316662623563653764623439633738376531613764323761613432356565376238346461376536363933396639633830643065383266636535356530326466633862356337383431386132366161343336353036393837313962616663656366306264343930303061646463666134303537303862646265666262313937343964323264616230303765343464343565613233623130366638383334633135326532353036326434636632346666323533353663376562333732393130353339336662343962616239303461303266306630626234313763643931396433353238393031323865366262666634666163396639306465313138613937346632613664643031653033326137396231373866363066613166636262643032623537303466623436323935633135313930383136333733656464363633356338353639373866316239353033663166373362346230626538616261326564316665656164353939353362663832656664653933613334373161626435356364613362613861363733666262333739393734396662303036643030336630653633663636356333343631643261376232396463386232303462613539613635363638613436616532383738663030643166393439306466396532383066656266343331356561303465616135363861336139666434386336326336336236656364613639303230333031303030312803320218063a606434363430333938303337393230373965636364356134343331316361306463323262353065633839356235366535336431326232396637326463366462613363616665326535623831303466626461303338616635623434376430666231320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393361323135636334613761373232636165396331336162643633366466393963636565633661663964623436623639666135313637313665663530636532343930613938316530396162303139636132636234363831316235623631396431626431643565653666343661343263373737636264656536343261313438346563646635646464333732393634326333386336643433613838353838373434373566353832343434333636346330346466656439623839303435666230383565323563336566636234383431373333656666376335323963313339653639333530633263643739623263386431393637396137313265346538636166643332363735343162383332623365313061303132353564656636396466316539643362386438656166303331316465363764356531326232366464303164626264396433653432643335643964653237313330326530663166363964383763626337616361396538383637653964343238643363616230363636656234393064356662616233306266663366373835643033663230373261343362623962356535343635366135393263623631656166643561356566323834633763616563363666376634373332356363306434633164323766363631643861373438636135303731633036656631333464666639366634303836363838333636643436386132343738303031376530623536616261376661623433623362376330623737393036666165353438326633323831316332393265366231343435346531346238393438303161383661303363633437373934646430643734353237613732653432346564336166613034383939656362396136336632613961653732626537666139383961646630643635613332633835316439383031666334313034386466333335363466633762333137303765633866623830313430666537623761316661313230626131636236363033323463656666623462636332643962623764653063663534633831396632646433626365616465633963323566356531396463396231303230333031303030312806320218093a603365303261363732306334343636353965383633303564353562666565383230623335653635306665636163633535333039373435356532633465303332636339646564313662316262343464336235393262626163623663326266663165360ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303930323539663465336439663066333934323536353438653963373330386231306237333430336363393039346439376164313531623737303631373062393737326365623634643636326563656639303161386437643135643331396135396338623731303731616363643839356237633933363130646336393736663637633465313732396261383337336162376535326133663363386632363534393164646536396436653039393934373065373434353938313133316264393663333665363836353230336662326562643564353065616461666237323633393664656331643931373438393862346539626530346337346433303466656164643963626433323334633362376633333036633939636230633333396663323539363962343164353861326237636663313833326532323664383163313936333939336532323535613038376431363938633033643432313062643634353830363434643039356361373661613137393465646434306331633837623566383261386533396636303365393731313662613034353738653765383033343634393564373835643465663763663737313462396562366635663965306239613934663462373338383436313962393237346434613935656631353735346138396439376566356331613838623664363933653061383065626435333766633963663063613931643163363264393135646537656438313862393532653634633230303239336565386532383461343136613732613365313266633764343233623135386639623439363630636263323436366662656430666564326532346531303266646539343265623463666439346265633436643364393066633038633339666563626130336530636132343634616536363462393739353135626132396531663730326333666537303262653739333739366438656462313761613438633039323930623032343534396630363131663561653233656437653136343432646637643164616432323836633262623039643535323264643365643639386332663032303330313030303128093202180c3a606339373462623938326338313931336237333236643561336639646363343836313261313566376161643032663230376230663130636432303137613666626666353830336537636139626662343730396162323862366230396435623133660ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303962646438653834666164616133353332666334636530316138613137643463336232333266353061393739306532363236383465646334383233653831356131626435623230656365613762663536653239663662623762383331666233626636656663643134373566306238656435666662306231333835623936643136366236323966303339366138666566356630366534626361323565653461313334306565323633613464396262303230643866343732333036663364383836313338646537613031396530353962643061666339303263636261316132313361653264616136306338613031333735356665306134386530333466356234303233613264616465616138386335343836383335336163376137613364663132623266623634313837373465396231346265366561623863633237623838303132616436313632646137346530656562313631333539303566343337333734646162383538366437353061323662626433616332346165643837386334643533653635313037326338373165393464376163633537356339363733383137333461353366656166346437626136626364643234316363363435386336303837643836333032616132353163303466366435366239633332643764393636323437353065643035353738356430373733663433646330393962323863393232383131343865366338316632393766663964313636653030306163303462333132343138363737356663656637356635656261306331303332626631333064663663643761343632313164306466336530353834643932656136373334396438343930353038656234656638386635346338633364343836646538373139663130666139366665623835636337393630373663613738313331386565326439656439303363613133333630343063353961643931613464326636393865393130386165306564623962316362393561643333623139376666623138626431626138623536636265653261616539353835656365323038613165313462343835363436333032303330313030303128083202180b3a603937303834333033333130373866353638326337663332343464383263336233653238316139313837393537386465656163646363326132656265353431616631383831313561643265383338363565356635643234376234613138633165650ab50722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039303938383635646566326632616233373663376630663733386331643837613237616330316166643030383632306333356362366562666362623063333330303331393361333838633334366433303233313732373031323139336262373666643330303462383634333132633638396566353231336362623930313130313530396465616239346632366137333265363337393239646134633463623332353137653361646262333831316435306163346337376331666365386236353136303632313566333437303766336537323635353435653538633839343630396532383337366264623737373566653330343339653065313539326664636230633365653163333035373733643037326136623839353765616663653161313162653936356564616666333834333336366362366134346563323561383930313036653632343735363766373662353530666461343832626165633633303764363938656338383834316664363666323366323130653437623861396463626136626134653166613731366462333363383065333038313934393664636235653536303966623665376336313533373962646465643432376539323331623932353463326261663934333630386138366436393861653961336338363339646638383764366636623561373133383564323433333864393131613231326266373166316532616363386231383662393665633865363963383662366430353832313737373661303963396336383935336564623539313635373862356132363362326634363965336230633037656164613731613434376565613766386663316262383037343235353536376237663062643165366166623033353837313863393862343239653234623232393835393666633736636636616633393663613934333464373932366563376433376434623932616635366434356665666638313936303935323234613931366331666665366236363765323535666333616338636363656639323064633034346232353030333133326238373830363734326630323033303130303031320218033a603333373339306438666561313434616663313265383132353461323864616336656138323839333833366163303732656666643835653061373734383538306566323830393636343863356137663864626234636538313437363831353133370ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130306335376564623966663237366530323362323830323163623164383763646631393636623639386366343865346561616137633639323037376365656538636362323339613463393231353937653865383966376363303564336633313331353738393736633465333134343035643461346530336137323431306335633039636135323761643561383562393938363337653732613332653166626330643535343662323436356539653830366332646435303965623035306162356662323730363366643932383135623164643236383965323131316361656236663534396539346139663030663038323164346361366336613631313766356135333363393236336266303734613330643563626566353064316338633233383762636139373265646564613039383362356430613662353764636230303230303036383238623430653430373662343837306232346261643834303536656535326235663432326538383430303238633235303036333832643865396336363132323566346637366561373265333430363037653966633666336332303433333037366131636138636231356564303361633839363664303530376263646536383165346530323331656539663837643131316537623438616338663934643264383432623532646637336635373363633534313439363437393763363236393638666661653734313866336236313039623561306630396533323233663461346435653335303964643235303133386636626331376266366365636531373539343433306466313830613338653930616466326166666266616430633662386331623837663137386130363164636662666638623932633931363664383734633166663561663466626364626665386539643039393337306464663630626537343736333364333665653465623563643531663665336333333965313531653431626462356135636532633863393761306134336233636434636330383138383463383739663964326633373438343238633835373366313763393066336362643032303330313030303128073202180a3a603734306166366266373339653838336338386633333434633961306638623330316533396463393831633531363365306465326133666634326239396534323665643765353662363766343231383530333834356466363266343963396662300ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393133316161333638663933343532323966393762363235396363636166666561323365303063643565616430326533663639366331653731346565333933396461643836306533386266393561323937346639656234386539333433663861616334303565613935356430353332336531313762336231633934383133613361663432666538303832633364343362616631626434643833363765393364623030616436393665363237613130333661653533346630313165616435653536663337613666666534346236623965303939343031313932616435363061303334366234316138313030393566356632643766643332643665656236353562613735386336623532366331323933383661663731393763376135336165363033643632323833323235343936316631366430656661383037396137363835363138383862653733333439323231373935366262636166616562623631333563356662623234383464356234613566646630333336616330326532366331363532633162643865616633306461653164366433656230306637623466616238643634373866653864393565623931316466393636613064656134653532326462373662383936363537306563633561663039353136343234663061663566386565363665333836643536353037313339393731363961633337353733626635326664303538646539356162326666363865363831313161623233343035656139363462326262383864303263306631636165643731656364643465346534303835393438373666646238353030626335356337626130323036366530356162393864396637653034363664393730326562353765653337323266386663633835613735353035666633323632313730323838623738383732336164623937653464653536323063633930656164313338326663643735373138383966656662313165363737316263336636663366656231396337616335343238373864303361393032373035323663336565643234393465666635346531353363613966363839303230333031303030312801320218043a603765616236393661623935343336363538626331346666366234626534643932356364353162323230646632613164356336656531363061646166323961353165363934646533656531383463653232656164386437646239333231383266330ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038326465373330363566333466666332393334306435393439643232323062316534333636656435636637633665626436313663663934313661353365613030313766366262313136626664336633646566636331356237613464646630653434643032666536393536383830353365373961373730653230316263663731393333393030333965653866303836643466613734366337653035363931383330316639623565383465333932363238323830383561373962333232626361306235643835666539373232316132366262646532353863363230663064636561303261623165646431366363343961336632616239323838653364643166333764633462366136663731333366663932653534316337316237306432613266363664353537323561623138626638366430303965633364323466356431326530623565363830326431313531333732643462373634656265636234616638326636343934383565633537623561303164633637393538663561303363636161623763626139333534613137333732633133313662613437633935336161663934393031623366386332346536613361666436373538653766336231343363653264643363623037316232613734633932316365653934396134623561366265383739663163373930613662386436336231393264376565323961393439316664643638396139386330613763336436303332306631623461633264363232396466643934653432663361363034386137366265316562393538633861313837336265386433333861656339666335396162376633373632363738393430326331666435393566313930383735373565306265383237666334633061346662336433393361643734613934396363393836626662363463616264646165353339333566366463353630373464623933643737656133623831366264643662653533343439373237323238393835396666333463653531383630616666623632316431303438376463333834336631663836643534303334613633653438613161306430323033303130303031280a3202180d3a606132656363316232616539386264323862633161303864386633373161306434663734356337363864306337373339363235363265333433623235643833343235656565613765663865613134323935333432623865623738643332656333660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039383735356134303862353332316532363330353230303064366437643461326333613535346435653133383461396362356562663437346165383832633633623438366264303864313434646466316139346365396137643632353139363330303661666461616334353838343666313736343031393566653235333961363536393330656661383534663231343865363865633161303863316334396432303063336633303435666537313437663036643533346334626432363231303063623164643339373339643736306438316130626432306638336632353564323530376434636362313130366235333631386336613934343039633838376361653236326434636565396338363233323134376365633134303465306335376262613733313731333065653339363433383838616633643539386564643832623863363165363561653831613465316135366263303664333937313433613938643431636138376433656634333365663061656162363830313139316233653338343830393638663636623665383836363261663435613965323132393934663638623238386562393637626562393834373863323433653231333663316131353931663036316635626330346232316666326261343862323966313834333130383838373362646665393966386135326539343038393731383536653830346465613630326133313137383663393835363532393633633361333737303332396234303966373466646663373436623232613566383431383931323037316334636538343663396234623332306665646636653962363465326362653338346639613832623661616164346232303930373433316466316133336636393230376135363536303062653831303730643038333239303039393538353961343439386435623539333135626365626566656538303765623061336139343266316364663333363764643434343466646232393838366566636464306265346162653961313838383033393533383735656461333364623732393839663736336230323033303130303031280b3202180e3a603139366237623132303739376364623361396430303362393833643537646131303331303662313733306531376636376532633762616161646234333738396166313639366461313031316232353362636263383630333333383566303332380ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061396462376638626161313236383938666162373839313135613362356438393734346631393765323830343161653039386633653838366336393837313732316531316262306164313166336365393132346161393631643661306463383435663439373635633366616231393935383430323637366635363434363262663238316462613535383837383066303365393035373938653138343236396161613630663761313437323333316532666231646561646438373763383463626362363431636139653563386164366534356263313539636230373966636230643434396364636438643932333963316130343765376234343864613063646361323636313061323566323936643936653734363962363736643461343434353136653761353965383532393361383038366638343063303532383534653032613863623230303264616433353832356265346438336235326661393165386337336666303439373436313438383632373837633131313866393234643331636261633162343466656666323264343336623339373965616466396234336134626661373265313562343735356663616232363065303661323739633362623733626337663136613036306434643532326664343930353830333838616135393564383034343733366535323266363432343931356637383033623735383365303935636466373863333235313936393764653831623839666235303035343735336231613137663961616662303634643834633939326639616231316363626338636231303831346463616635323634616134356632316264656661633832636361636161663335386533313337336565316261346537343032666438613730656130633238636135636337346463343235313063393639636432633435396231656333363838613031656133396139393237313063643232393763393861383462363334386135373738303466646332333464336665313930336532633231653137326461323862353961653665346337653865646438623731633439643730323033303130303031280c3202180f3a603538343661353366343437353239666439636462373830346364333136383865643665656265336236336461326635663231316666626337333731393763663366316366626664613631626537643135313066306539323339383131376637340ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061386365616333363765623166316465356630643965663365616630646639623938343438666532303830383437363536326130363063353163323839373730623463616366653932636236353536393832336539363263326132633966656435336264333663613361313232646531633532356135383266323561346437643632386331613364356264623839333661656365373531306537353534656537303333303235633039326338323865656235373338626530326564393633646138316135393230353633346365393435343537376162383266343066313366316565353565306165373237653233633330323834623166343462393961636534646463356639616337616438386439666132323535393335623234646362613834303036343265313663663235333263306230643638393239303436303837313563343037366634366438346130653066656433366537366363646339363335356537613236313630393435633262353461653236636330306664303832333236333436656565656137646437356639313931316539396462636239396561346163366261303536633333323238643838316438353833316439636338373935393364613137343664643065653935646332623936666539336261666366663263643764393239353864373864663333663230356437313135656439666163346462366634636336306535366135343431646135623562353566613539393939303265393538613662366334346438313064646335363138313234316238376632326630353961363838306538303231373336643031383937646236353434396365383137613233373564303335353163623064653530376336303961306338303330656366346266646562323133633033646161373634613138323162373234333334663731663736386437616563623237373035326137303333373635663037323138303536633738663261383761663138333836643866363161356366636233663262613464643539393135663133643338363334643136393537353730323033303130303031280d320218103a603030306162636435396133306135333838633530306265363832663663613239343034363239356339323735383831633230643334626230643639306564613762333862366262643037613364643166646662366137303434626230396366660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061663062393134323537626637613436353563346135306430636164356530613165343538316564363632336630653837333066373936623866323963353831373862636363363933326331666333316633396566343462383264336334336233393837333733373366656362313239353232386130346664353061313466333634366438346665316634363763616562393864343633653239373565393935623864326531653339663362663661646463323561653335643635643032363038653033343535333739363665326162636534396238313462656164336331623735373137346165333063303062306334336539396238303439366237326433633133316631633665346663646130356632383131376566396532386334333033626534643863376530343264353862383363633132313934356132633635653739363263616139313835393338663337353764663763636139356366303262356533313934346133613631396130616333663165333462396230313364346332323463346631653730666439666433363938336566383661646535313833363263633833323263306637623631613961633735666238326537623836643638626330663039396130396131346361633561316438643338663961386137306363333766663563633362626432373432666664313436323535633137316536613137383038333237316463653066646536383165643439326362353962303739366432373031373538333864633539303831303765336136656133663961343036623364313133306363656333623437393165343962626332333136303362343661623264306639336434336265373561623961346437313065613934306532383561376231353362306361376364646565366439646365306164383335306334316439306332313562393538383531356166613061633333363561653037653831663362626233366264626561633462333162636231616134653832353635623937376639646164383564363236656566396161613965663864376533666230323033303130303031280e320218113a603933653238313031303462326231376230303935326235613431303264333365646230343363623136646533616433643364363832363066353562623065353837333765613539343463333338663763386362383863373833336663383630630ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038633037626533303561643630623930626132646162333962306565373736306531613232663835373532323534306437306230336233663965343837356133613239616230383038386631343466353765623235326534366261353933383564306536643432373031313764613061626331623362383036393463396135303538623836643631646661303665373136373039633838653866656163376333613065316432356663306165626636613866373666636239396638343566653138313436316361623638353862393763336134303237666233373132623134653663303738396465313764343137363435373765353131343137656231363236393265623037616531653733353532333565396262343339303437623663303136313337383265376464366636303464616134363734363631643533393631663436633366616136623765373637363264333733623562353432623739656139363365666266333361633638313938626232623636316366663637363931366566333732616434633236633231366334626334373837633834656333326431383464373763373531383663303963663364396639313433336361393835333131396261623331666136616432366634353365353936643962646563613638613537363962633866656537613533356438306338633666336566623164666232383861623661393739383534623763653833313234656330643130326166663934633362373466396333373839353863323565623933336464353363316538303561313836353464366439313836393930663635373034323966393630663334653862346637666439393732646362666539323430653037346461326433353561356637656639633161663632656635393832613831373435373862396331356334396563353636626461636233306363666365663039636466653730386164343837343234653963316265363533663965653736363065376439343263316566613564613238366531616464616230366139613333663964653934363739356230323033303130303031280f320218123a603934383235313739643163333934303137306233356432363665346366613830643737386335653966356261653764653833666638636334373431663362653336616336336431653761653439373261656466366263316533636632303638390ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030626531376339393634376365633635613434343037623533353835366233633362616566356235346635363561663538623834353662613863376365353335643561633732633631633434633736623363353763386538363438343136333762653130613833636665333963303932343736643064626534643663646364636437323061333062356266656235316130316131386635383263343566366338363939336663663764663138323933356465316438363930363034346463663335313836393335643962643765656137393532333532626562623465663961653066373636316537306134323337616661393839393636383763613438666366633562303064333830376630353462653066613863336266613432353033386265366566323935313634663232663733623765383863393465613962653861613466336132343563383962396431666435313932663761353062393538623265663831303462333666316266386664326366623238633134323138303063316334376534656639386166313530303730636336643639643137653865623932663138613661613161363532363661343935323338643130336638663639356235376563663337333635306130353230303837343537323162656138313536323739363763383037363336356466386334633761376434646438663263333835306331386662613731656236306536653864666264313936653035333766643730623334346563626363353330646663383364613666656466343964353161393034313935303262613964373063643335663163663363303639346532333534663930363466646266353335656232336332376330613433643062373863316638363763363164393836393564386465663762633261313062623636373463323266363661616230613931383133646466323763646238353263353965663739653162396531613037356661366565323761376533373734646266346232363436353432376536643561623931666537663066336137313738346563613138326235303230333031303030312810320218133a603038393039376465663031623037633764393734613537353532353161366161613061666236623332613534353334336432393138653732626164303433323163313131633234643432373538306633626131653236616139643735653632360ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613561643262373634336130346330353564326638636432353131623135313339666334353537353632313338386534396331313962326633393861636131313066363133393662306338363664653530363335323262623835343032373365313366366439346365316536303433386636616662303061616136343631326637313435653962636538626331613533623934313931336161373663396633613238333366616437636632383563376163326433376639396633633263646234396465346431353165363136373835363466323831663534313432346234316661376335316232613936303232383363376433326565303065623833386461313563333861666339366530363164393763656465323231363566663161613935396631633432373562326430393863343035383661353537396662623363623930303732373034313230613861363661353237306634666366643130383663393233363930613335653766643434356533336163303366313339633638363835353635373063646334616166323231303761366331613434323435366137633663373965653034303930653765356434663636626361363063613166343762366466623534336461633363626631396137373139613866353562366638336234613362386136366436303235366430613436353531666137303234626430353633316238613535383038373732353463326632663236386364633333643264626263666237333365396662653233336262396362353961623331613031343862323365386334323638306666313061663463373961346430383334366662373961393364393632393534386561663162623132343639386661656661346364643732343432633033613034623733333433326637343839303361333235633238336434353661623961653932316165376564333339316535643137383765666463323335343061376238356336393161653837306130376639306231316331336233326365343365616564313562333639363835636534393137376363393835303230333031303030312811320218143a603939666162633461646534653636326336653238323366346139366562323134343034383465356136643064333132623730633036386432326236323936333830376332333361343964626239383361376562623330653737303637373261340ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030386434356332316330633935656636356130323964353263393537666430663835663230313233646130333465363136373164646565353437356630373338326136366336366362346463353035303464646664333735383130383364663864313735373733306564386436663336346466346333366132363531353931393535646132303161323430376661386162396232333133383131323235613064613233306662653338306530393061613536656661346632303265633962343832336636353031643936616336393865626632366161636633656532643166333261373231633934376531303736636633356233373364613164383761333661313532653030653731303131373932323832653832356666313731633538333362383835373062666336646138343439653666393566386231323635616235353531393430333135353364316435373666393363343263306361363061616261633463386464313632643831313466326232313531313538336337323533396665353663343939613932396465336134306130643435633137633538396332643739383863653236656166633932613364333762376561303034326434336530336166613632373162323632353561366363636661653533373138323164383165306230356332353062353966306139303734316130653065383861303965643536633562393738306430393566303930366630623831643531323633393832616165303131333663303732643834346131316436646134623261363163363434653161623137663136666634386565323366656465383435326631653432653264333061303739306332356434323036306531643434613637316132656232336431313466363863373165333366313736646235386136386234333030353462633164323938336132336133326561366666393566613763346438653338306562323936653938623739363865636638343534643831376337333765656135646439323165623836633136633762323933303461346137656362653561336131303230333031303030312812320218153a606537396165396337313933643164326263393433383436346338616135663632323461653835323936366134336239383235383833663766373432633533393562643330393935383761393638363662393233396431656666336165353037610ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623035616265326162303066646430366339353565383637313062306530366631613932363234613438616431636263386466633666323231323936326230633330666462643238346133376335613337363538623633633336656138313632353631613865346639343663626535373232633032383830316630663238316337306638643838633763303061326632653239663539376237393938363965643833353664663537633437626539393434613261616666363530663962346262613064626335336463383830666462623639656134353139303564323830323230326638653239633034613736643237616632656237633534383438356266336634363934633930633431383130383838383433373932383438383335663738313637303764336538643736663465363766353738306263663038383133633535656336333961396264363234313738663565623134376435303061663335316539656631623165333432343834636132363064623763636261653438366631336366323635623562316162363838303636303038303533623230633364656463653737316339613038613033323061613963653435316562396439383361376234396361613130393666386164633039383331386463333865306537636566306438653564353537613036373536383561316339653235366132626339646261333232623362623331373263663731343037376263333830663861306134333361386266613766626663353966366230393365633862663665393339376330396231386531383034306331623536363836343733376338666137653239373935663361343538386464613763326261623439353636356363346139623833366532656239306336326133666361663539316662356638313830346337363138306536323666613236343461376465333435313164366334363637643938393337653237373333663464316539313338383333353465353466643733353137323165373666376235366333343833333838663461366238376232386165626562303230333031303030312813320218163a603962343038383566313362366163316337353336393262613366313739303061333838333165363934613061663937343934623834333838323039636235656662646339386136646162623265316337313833393166633133356264616163330ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396463643863306135336539306333353539353734663636323034313137643362353033653530613336643330393766616338343239653663656364333762623534303731383038663265653938323033356638353161306339626532313736333833613232653338633161626131363866333266393035373063623332333363666536323539383736363661663637623531346361656632316662386466366430666364333363663236303662393264646561353533366236303638643836373832653339626435633338343435393931643431396237643165633038353939343132633039343964316332343062333563313464633535323734646261373166666165393336313235613566383139663534313332653234333964346163353539373939366563653835653133646666333336316639313331663536636561633562396635353262343963663666396139616336653564636532646233363934363266393361663830653562353662366538626566613136326130363162346137363839326264633834363437333036633630303835386664643237303332373663326337303434303139386566643766653335343563663261623538306337346366643634343561616637626437663734356363323532656162643236356561626565383632343137313034653639343861353537353666646332323264663061313031353234646531633363303863636630343330313165633766653936346564643834353161313330313437633037333633613335663131666465656638663261326237363137353762343335386666383962373561343864363762646336303930363933653062623836373965636262393366666462336633656439366265633933656634363536653337313661623837636534366361386531323539633866656464653866326631656130663365623263343865393635353164653132333330333435373235663435656436396338353735623531363833616661343732363231383236646232326262326431633466316533363436346139303230333031303030312814320218173a60346630613033333466393737363738313632663830643936376637323139313431333630633062376637663033316233376336396536323137333933336564616434366263626139373636376565373262666435613933346261313532326330")));class ManagedNetwork{constructor(e){this._network=new Map,this._nodes=[],this._healthyNodes=[],this._createNetworkChannel=e,this._ledgerId=null,this._minBackoff=8e3,this._maxBackoff=36e5,this._maxNodeAttempts=-1,this._nodeMinReadmitPeriod=this._minBackoff,this._nodeMaxReadmitPeriod=this._maxBackoff,this._earliestReadmitTime=Date.now()+this._nodeMinReadmitPeriod}setNetworkName(e){return console.warn("Deprecated: Use `setLedgerId` instead"),this.setLedgerId(e)}get networkName(){return console.warn("Deprecated: Use `ledgerId` instead"),null!=this.ledgerId?this.ledgerId.toString():null}setLedgerId(e){return this._ledgerId="string"==typeof e?LedgerId.fromString(e):e,this}get ledgerId(){return null!=this._ledgerId?this._ledgerId:null}_createNodeFromNetworkEntry(e){throw new Error("not implemented")}_getNodesToRemove(e){throw new Error("not implemented")}_removeDeadNodes(){if(this._maxNodeAttempts>0)for(let e=this._nodes.length-1;e>=0;e--){this._nodes[e]._badGrpcStatusCount<this._maxNodeAttempts||this._closeNode(e)}}_readmitNodes(){const e=Date.now();if(this._earliestReadmitTime<=e){let t=Number.MAX_SAFE_INTEGER,n=!0;e:for(let r=0;r<this._nodes.length;r++){for(let o=0;o<this._healthyNodes.length;o++)if(n&&this._nodes[r]._readmitTime>e&&(t=Math.min(this._nodes[r]._readmitTime,t)),this._nodes[r]==this._healthyNodes[o])continue e;n=!1,this._nodes[r]._readmitTime<=e&&this._healthyNodes.push(this._nodes[r])}this._earliestReadmitTime=Math.min(Math.max(t,this._nodeMinReadmitPeriod),this._nodeMaxReadmitPeriod)}}_getNumberOfMostHealthyNodes(e){this._removeDeadNodes(),this._readmitNodes();const t=[];let n=this._healthyNodes.slice();e=Math.min(e,n.length);for(let r=0;r<e;r++){const e=n[Math.floor(Math.random()*n.length)];if(!e)break;t.push(e),n=n.filter(t=>t.getKey()!==e.getKey())}return t}_closeNode(e){const t=this._nodes[e];t.close(),this._removeNodeFromNetwork(t),this._nodes.splice(e,1)}_removeNodeFromNetwork(e){const t=this._network.get(e.getKey());for(let n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}0===t.length&&this._network.delete(e.getKey())}_setNetwork(e){const t=[],n=new Set,r=new Set,o=[],a=new Map;for(const t of this._getNodesToRemove(e))this._closeNode(t);for(const e of this._nodes)t.push(e),n.add(e.getKey()),r.add(e.address.toString());for(const[o,a]of e)n.has(a.toString())&&r.has(o)||t.push(this._createNodeFromNetworkEntry([o,a]));shuffle(t);for(const e of t){if(!e.isHealthy())continue;o.push(e);const t=a.has(e.getKey())?a.get(e.getKey()):[];t.push(e),a.set(e.getKey(),t)}return this._nodes=t,this._healthyNodes=o,this._network=a,this}get maxNodeAttempts(){return this._maxNodeAttempts}setMaxNodeAttempts(e){return this._maxNodeAttempts=e,this}get minBackoff(){return this._minBackoff}setMinBackoff(e){this._minBackoff=e;for(const t of this._nodes)t.setMinBackoff(e);return this}get maxBackoff(){return this._maxBackoff}setMaxBackoff(e){this._maxBackoff=e;for(const t of this._nodes)t.setMaxBackoff(e);return this}get nodeMinReadmitPeriod(){return this._nodeMinReadmitPeriod}setNodeMinReadmitPeriod(e){return this._nodeMinReadmitPeriod=e,this._earliestReadmitTime=Date.now()+this._nodeMinReadmitPeriod,this}get nodeMaxReadmitPeriod(){return this._nodeMaxReadmitPeriod}setNodeMaxReadmitPeriod(e){return this._nodeMaxReadmitPeriod=e,this}getNode(e){if(this._readmitNodes(),null!=e&&null!=e){const t=this._network.get(e.toString());if(t){return t[Math.floor(Math.random()*t.length)]}{const e=Array.from(this._network.keys()),t=e[Math.floor(Math.random()*e.length)],n=this._network.get(t);return n[Math.floor(Math.random()*n.length)]}}if(0==this._healthyNodes.length)throw new Error("failed to find a healthy working node");return this._healthyNodes[Math.floor(Math.random()*this._healthyNodes.length)]}increaseBackoff(e){e.increaseBackoff();for(let t=0;t<this._healthyNodes.length;t++)this._healthyNodes[t]==e&&this._healthyNodes.splice(t,1)}decreaseBackoff(e){e.decreaseBackoff()}close(){for(const e of this._nodes)e.close();this._network.clear(),this._nodes=[]}}class Network extends ManagedNetwork{constructor(e){super(e),this._maxNodesPerTransaction=-1,this._addressBook=null,this._transportSecurity=!1}setNetwork(e){this._setNetwork(new Map(Object.entries(e).map(([e,t])=>[e,"string"==typeof t?AccountId.fromString(t):t])))}setNetworkFromAddressBook(e){const t={},n=this.isTransportSecurity()?50212:50211;for(const r of e.nodeAddresses)for(const e of r.addresses)e.port===n&&null!=r.accountId&&(t[e.toString()]=r.accountId);return this.setNetwork(t),this}get network(){var e={};for(const t of this._nodes)e[t.address.toString()]=t.accountId;return e}setNetworkName(e){switch(super.setLedgerId(e),e){case"mainnet":this._addressBook=MAINNET_ADDRESS_BOOK;break;case"testnet":this._addressBook=TESTNET_ADDRESS_BOOK;break;case"previewnet":this._addressBook=PREVIEWNET_ADDRESS_BOOK}if(null!=this._addressBook)for(const e of this._nodes)for(const t of this._addressBook.nodeAddresses)null!=t.accountId&&t.accountId.toString()===e.accountId.toString()&&e.setNodeAddress(t);return this}get networkName(){return null!=this._ledgerId?this._ledgerId.toString():null}_createNodeFromNetworkEntry(e){const t="string"==typeof e[1]?AccountId.fromString(e[1]):e[1];return new Node({newNode:{address:e[0],accountId:t,channelInitFunction:this._createNetworkChannel}}).setMinBackoff(this._minBackoff)}_getNodesToRemove(e){const t=[];for(let n=this._nodes.length-1;n>=0;n--){const r=this._nodes[n],o=e.get(r.address.toString());null!=o&&o.toString()===r.accountId.toString()||t.push(n)}return t}_checkNetworkContainsEntry(e){for(const t of this._nodes)if(t.address.toString()===e[0])return!0;return!1}get maxNodesPerTransaction(){return this._maxNodesPerTransaction}setMaxNodesPerTransaction(e){return this._maxNodesPerTransaction=e,this}get maxNodeAttempts(){return this._maxNodeAttempts}setMaxNodeAttempts(e){return this._maxNodeAttempts=e,this}isTransportSecurity(){return this._transportSecurity}setTransportSecurity(e){if(this._transportSecurity==e)return this;this._network.clear();for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t];n.close(),n=e?n.toSecure().setCert(null!=this._ledgerId?this._ledgerId.toString():""):n.toInsecure(),this._nodes[t]=n;const r=null!=this._network.get(n.getKey())?this._network.get(n.getKey()):[];r.push(n),this._network.set(n.getKey(),r)}return this._healthyNodes=[...this._nodes],this._transportSecurity=e,this}getNumberOfNodesForTransaction(){return this._maxNodesPerTransaction>0?this._maxNodesPerTransaction:this._nodes.length}getNodeAccountIdsForExecute(){return this._getNumberOfMostHealthyNodes(this.getNumberOfNodesForTransaction()).map(e=>e.accountId)}}class MirrorNode extends ManagedNode{constructor(e={}){super(e)}getKey(){return this._address.toString()}get mirrorRestApiBaseUrl(){const e=this.address.address,t=this.address.port;if(!e||!t)throw new Error("Mirror node has invalid address configuration");if("localhost"===e||"127.0.0.1"===e)return`http://${e}:5551/api/v1`;return`${this._getSchemeFromHostAndPort(e,t)}://${e}:${t}/api/v1`}_getSchemeFromHostAndPort(e,t){return"localhost"===e||"127.0.0.1"===e||80===t?"http":"https"}}let MirrorNetwork$1=class extends ManagedNetwork{constructor(e){super(e)}setNetwork(e){this._setNetwork(new Map(e.map(e=>[e,e])))}get network(){var e=[];for(const t of this._nodes)e.push(t.address.toString());return e}_createNodeFromNetworkEntry(e){return new MirrorNode({newNode:{address:e[1],channelInitFunction:this._createNetworkChannel}}).setMinBackoff(this._minBackoff)}_getNodesToRemove(e){const t=[],n=Object.values(e);for(let e=this._nodes.length-1;e>=0;e--){const r=this._nodes[e];n.includes(r.address.toString())||t.push(e)}return t}getNextMirrorNode(){return this._getNumberOfMostHealthyNodes(1)[0]}get mirrorRestApiBaseUrl(){try{return this.getNextMirrorNode().mirrorRestApiBaseUrl}catch(e){throw new Error("Client has no mirror network configured or no healthy mirror nodes are available")}}};const DEFAULT_GRPC_DEADLINE=1e4,DEFAULT_MAX_ATTEMPTS=10,DEFAULT_LOCAL_MAX_ATTEMPTS=1e3,DEFAULT_REQUEST_TIMEOUT=12e4,MAINNET={"node00.swirldslabs.com:443":new AccountId(3),"node01-00-grpc.swirlds.com:443":new AccountId(4),"node03.swirldslabs.com:443":new AccountId(6),"node04.swirldslabs.com:443":new AccountId(7),"node05.swirldslabs.com:443":new AccountId(8),"node06.swirldslabs.com:443":new AccountId(9),"node07.swirldslabs.com:443":new AccountId(10),"node09.swirldslabs.com:443":new AccountId(12),"node10.swirldslabs.com:443":new AccountId(13),"node11.swirldslabs.com:443":new AccountId(14),"node12.swirldslabs.com:443":new AccountId(15),"node14.swirldslabs.com:443":new AccountId(17),"node15.swirldslabs.com:443":new AccountId(18),"node16.swirldslabs.com:443":new AccountId(19),"node17.swirldslabs.com:443":new AccountId(20),"node18.swirldslabs.com:443":new AccountId(21),"node19.swirldslabs.com:443":new AccountId(22),"node20.swirldslabs.com:443":new AccountId(23),"node21.swirldslabs.com:443":new AccountId(24),"node22.swirldslabs.com:443":new AccountId(25),"node24.swirldslabs.com:443":new AccountId(27),"node25.swirldslabs.com:443":new AccountId(28),"node26.swirldslabs.com:443":new AccountId(29),"node27.swirldslabs.com:443":new AccountId(30),"node28.swirldslabs.com:443":new AccountId(31),"node29.swirldslabs.com:443":new AccountId(32),"node30.swirldslabs.com:443":new AccountId(33),"node31.swirldslabs.com:443":new AccountId(34),"node32.swirldslabs.com:443":new AccountId(35),"node33.swirldslabs.com:443":new AccountId(36),"node34.swirldslabs.com:443":new AccountId(37)},WEB_TESTNET={"testnet-node00-00-grpc.hedera.com:443":new AccountId(3),"testnet-node01-00-grpc.hedera.com:443":new AccountId(4),"testnet-node02-00-grpc.hedera.com:443":new AccountId(5),"testnet-node03-00-grpc.hedera.com:443":new AccountId(6),"testnet-node04-00-grpc.hedera.com:443":new AccountId(7),"testnet-node05-00-grpc.hedera.com:443":new AccountId(8),"testnet-node06-00-grpc.hedera.com:443":new AccountId(9)},WEB_PREVIEWNET={"previewnet-node00-00-grpc.hedera.com:443":new AccountId(3),"previewnet-node01-00-grpc.hedera.com:443":new AccountId(4),"previewnet-node02-00-grpc.hedera.com:443":new AccountId(5),"previewnet-node03-00-grpc.hedera.com:443":new AccountId(6),"previewnet-node04-00-grpc.hedera.com:443":new AccountId(7),"previewnet-node05-00-grpc.hedera.com:443":new AccountId(8),"previewnet-node06-00-grpc.hedera.com:443":new AccountId(9)};new AccountId(3),new AccountId(3),new AccountId(3);const LocalNodeWebNetwork={"localhost:8080":new AccountId(3)},ALL_WEB_NETWORK_NODES={...MAINNET,...WEB_TESTNET,...WEB_PREVIEWNET},MirrorNetwork={fromName(e){switch(e){case"mainnet":return MirrorNetwork.MAINNET;case"testnet":return MirrorNetwork.TESTNET;case"previewnet":return MirrorNetwork.PREVIEWNET;case"local-node":return MirrorNetwork.LOCAL_NODE;default:throw new Error(`unknown network name: ${e}`)}},MAINNET:["mainnet-public.mirrornode.hedera.com:443"],TESTNET:["testnet.mirrornode.hedera.com:443"],PREVIEWNET:["previewnet.mirrornode.hedera.com:443"],LOCAL_NODE:["127.0.0.1:5600"]},WebMirrorNetwork={...MirrorNetwork,LOCAL_NODE:["127.0.0.1:5551"]},WebNetwork={MAINNET:MAINNET,TESTNET:WEB_TESTNET,PREVIEWNET:WEB_PREVIEWNET,LOCAL_NODE:LocalNodeWebNetwork},DEFAULT_PAGE_SIZE=25;class AddressBookQueryWeb extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId),this._limit=null,null!=e.limit&&this.setLimit(e.limit),this._retryHandler=e=>{if(null!=e){if(e instanceof Error)return!0;switch(e.code){case 13:return RST_STREAM.test(e.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},this._addresses=[]}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get limit(){return this._limit}setLimit(e){return this._limit=e,this}setMaxAttempts(e){return this._maxAttempts=e,this}setMaxBackoff(e){return this._maxBackoff=e,this}execute(e,t){return new Promise((n,r)=>{this._makeFetchRequest(e,n,r,t)})}async _makeFetchRequest(e,t,n,r){const{port:o,address:a}=e._mirrorNetwork.getNextMirrorNode().address;let i=`${a.includes("127.0.0.1")||a.includes("localhost")?"http":"https"}://${a}`;o&&(i=`${i}:${o}`),this._addresses=[];let s=null,c=!1;const u=new URL(`${i}/api/v1/network/nodes`);null!=this._fileId&&u.searchParams.append("file.id",this._fileId.toString());const l=null!=this._limit?this._limit:DEFAULT_PAGE_SIZE;u.searchParams.append("limit",l.toString());const d=this._maxAttempts??e.maxAttempts;for(;!c;){const t=s?new URL(s,i):u;for(let o=0;o<=d;o++)try{const n=await fetch(t.toString(),{method:"GET",headers:{Accept:"application/json"},signal:r?AbortSignal.timeout(r):void 0});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const o=await n.json(),a=(o.nodes||[]).map(t=>NodeAddress.fromJSON({nodeId:t.node_id.toString(),accountId:t.node_account_id,addresses:this._handleAddressesFromGrpcProxyEndpoint(t,e),certHash:t.node_cert_hash,publicKey:t.public_key,description:t.description,stake:t.stake?.toString()}));this._addresses.push(...a),s=o.links?.next||null,s||(c=!0);break}catch(t){console.error("Error in _makeFetchRequest:",t);const r=t instanceof Error?t.message:String(t);if(o<d&&!e.isClientShutDown&&this._retryHandler(t)){const e=Math.min(250*2**o,this._maxBackoff);this._logger&&this._logger.debug(`Error getting nodes from mirror for file ${null!=this._fileId?this._fileId.toString():"UNKNOWN"} during attempt ${o+1}. Waiting ${e} ms before next attempt: ${r}`),await new Promise(t=>setTimeout(t,e));continue}return void n(new Error(o>=d?`Failed to query address book after ${d+1} attempts. Last error: ${r}`:`Failed to query address book: ${r}`))}}t(new NodeAddressBook({nodeAddresses:this._addresses}))}_handleAddressesFromGrpcProxyEndpoint(e,t){const n=e.grpc_proxy_endpoint;if(n&&n.domain_name&&n.port)return[{address:n.domain_name,port:n.port.toString()}];let r;const o=t._network.ledgerId;if(o&&o.isMainnet())r=MAINNET;else if(o&&o.isTestnet())r=WEB_TESTNET;else{if(!o||!o.isPreviewnet())return[];r=WEB_PREVIEWNET}const a=e.node_account_id;for(const[e,t]of Object.entries(r))if(t.toString()===a){const[t,n]=e.split(":");return[{address:t,port:n}]}return[]}}class Client{constructor(e){this._mirrorNetwork=new MirrorNetwork$1(this._createMirrorNetworkChannel()),this._network=new Network(this._createNetworkChannel()),this._operator=null,this._defaultMaxTransactionFee=null,this._defaultMaxQueryPayment=new Hbar(1),null!=e&&null!=e.operator&&this.setOperator(e.operator.accountId,e.operator.privateKey),this._maxAttempts=null!=e&&this._isLocalNetwork(e.network)?DEFAULT_LOCAL_MAX_ATTEMPTS:DEFAULT_MAX_ATTEMPTS,this._signOnDemand=!1,this._autoValidateChecksums=!1,this._minBackoff=250,this._maxBackoff=8e3,this._defaultRegenerateTransactionId=!0,this._allowReceiptNodeFailover=!1,this._requestTimeout=DEFAULT_REQUEST_TIMEOUT,this._grpcDeadline=DEFAULT_GRPC_DEADLINE,this._isUpdatingNetwork=!1,this._networkUpdatePeriod=864e5,this._isShutdown=!1,this._shard=0,this._realm=0,null!=e&&!1!==e.scheduleNetworkUpdate&&this._scheduleNetworkUpdate(),null!=e&&null!=e.shard&&(this._shard=e.shard),null!=e&&null!=e.realm&&(this._realm=e.realm),null!=e&&null!=e.grpcDeadline&&this.setGrpcDeadline(e.grpcDeadline),null!=e&&null!=e.requestTimeout&&this.setRequestTimeout(e.requestTimeout),this._requestTimeout<=this._grpcDeadline&&console.warn(`DEPRECATION WARNING: requestTimeout (${this._requestTimeout}ms) should be larger than grpcDeadline (${this._grpcDeadline}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._timer,this._logger=null}setNetworkName(e){return console.warn("Deprecated: Use `setLedgerId` instead"),this.setLedgerId(e)}get networkName(){return console.warn("Deprecated: Use `ledgerId` instead"),null!=this.ledgerId?this.ledgerId.toString():null}setLedgerId(e){return this._network.setLedgerId("string"==typeof e?LedgerId.fromString(e):e),this}get ledgerId(){return null!=this._network._ledgerId?this._network.ledgerId:null}setNetwork(e){throw new Error("not implemented")}setNetworkFromAddressBook(e){return this._network.setNetworkFromAddressBook(e),this}get network(){return this._network.network}get shard(){return this._shard}get realm(){return this._realm}get isLocalNetwork(){return this._isLocalNetwork()}_isLocalNetwork(e=this.network){return"string"==typeof e?"local-node"===e:null!=e&&Object.keys(e).some(e=>e.includes("127.0.0.1")||e.includes("localhost"))}setMirrorNetwork(e){throw new Error("not implemented")}get mirrorNetwork(){return this._mirrorNetwork.network}get mirrorRestApiBaseUrl(){return this._mirrorNetwork.mirrorRestApiBaseUrl}get signOnDemand(){return this._signOnDemand}setSignOnDemand(e){this._signOnDemand=e}isTransportSecurity(){return this._network.isTransportSecurity()}setTransportSecurity(e){return this._network.setTransportSecurity(e),this}setOperator(e,t){const n="string"==typeof t?PrivateKey.fromStringDer(t):t;return this.setOperatorWith(e,n.publicKey,e=>Promise.resolve(n.sign(e)))}getOperator(){return this._operator}setOperatorWith(e,t,n){const r=e instanceof AccountId?e:AccountId.fromString(e);return null!=this._network._ledgerId&&r.validateChecksum(this),this._operator={transactionSigner:n,accountId:r,publicKey:t instanceof PublicKey?t:PublicKey.fromString(t)},this}setAutoValidateChecksums(e){return this._autoValidateChecksums=e,this}isAutoValidateChecksumsEnabled(){return this._autoValidateChecksums}get operatorAccountId(){return null!=this._operator?this._operator.accountId:null}get operatorPublicKey(){return null!=this._operator?this._operator.publicKey:null}get defaultMaxTransactionFee(){return this._defaultMaxTransactionFee}get maxTransactionFee(){return this.defaultMaxTransactionFee}setDefaultMaxTransactionFee(e){if(e.toTinybars().toInt()<0)throw new Error("defaultMaxTransactionFee must be non-negative");return this._defaultMaxTransactionFee=e,this}setMaxTransactionFee(e){return this.setDefaultMaxTransactionFee(e)}get defaultRegenerateTransactionId(){return this._defaultRegenerateTransactionId}setDefaultRegenerateTransactionId(e){return this._defaultRegenerateTransactionId=e,this}get allowReceiptNodeFailover(){return this._allowReceiptNodeFailover}setAllowReceiptNodeFailover(e){return this._allowReceiptNodeFailover=e,this}get defaultMaxQueryPayment(){return this._defaultMaxQueryPayment}get maxQueryPayment(){return this.defaultMaxQueryPayment}setDefaultMaxQueryPayment(e){if(convertToNumber(e.toTinybars())<0)throw new Error("defaultMaxQueryPayment must be non-negative");return this._defaultMaxQueryPayment=e,this}setMaxQueryPayment(e){return this.setDefaultMaxQueryPayment(e)}get maxAttempts(){return this._maxAttempts}setMaxAttempts(e){return this._maxAttempts=e,this}get maxNodeAttempts(){return this._network.maxNodeAttempts}setMaxNodeAttempts(e){return this._network.setMaxNodeAttempts(e),this}get nodeWaitTime(){return this._network.minBackoff}setNodeWaitTime(e){return this._network.setMinBackoff(e),this}get maxNodesPerTransaction(){return this._network.maxNodesPerTransaction}setMaxNodesPerTransaction(e){return this._network.setMaxNodesPerTransaction(e),this}setMinBackoff(e){if(null==e)throw new Error("minBackoff cannot be null.");if(e>this._maxBackoff)throw new Error("minBackoff cannot be larger than maxBackoff.");return this._minBackoff=e,this}get minBackoff(){return this._minBackoff}setMaxBackoff(e){if(null==e)throw new Error("maxBackoff cannot be null.");if(e<this._minBackoff)throw new Error("maxBackoff cannot be smaller than minBackoff.");return this._maxBackoff=e,this}get maxBackoff(){return this._maxBackoff}setNodeMinBackoff(e){return this._network.setMinBackoff(e),this}get nodeMinBackoff(){return this._network.minBackoff}setNodeMaxBackoff(e){return this._network.setMaxBackoff(e),this}get nodeMaxBackoff(){return this._network.maxBackoff}setNodeMinReadmitPeriod(e){return this._network.setNodeMinReadmitPeriod(e),this}get nodeMinReadmitPeriod(){return this._network.nodeMinReadmitPeriod}setNodeMaxReadmitPeriod(e){return this._network.setNodeMaxReadmitPeriod(e),this}get nodeMaxReadmitPeriod(){return this._network.nodeMaxReadmitPeriod}setRequestTimeout(e){if(e<=0)throw new Error("requestTimeout must be a positive number");return e<=this._grpcDeadline&&console.warn(`DEPRECATION WARNING: requestTimeout (${e}ms) should be larger than grpcDeadline (${this._grpcDeadline}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._requestTimeout=e,this}get requestTimeout(){return this._requestTimeout}setGrpcDeadline(e){if(e<=0)throw new Error("grpcDeadline must be a positive number");return e>=this._requestTimeout&&console.warn(`DEPRECATION WARNING: grpcDeadline (${e}ms) should be smaller than requestTimeout (${this._requestTimeout}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._grpcDeadline=e,this}get grpcDeadline(){return this._grpcDeadline}get networkUpdatePeriod(){return this._networkUpdatePeriod}setNetworkUpdatePeriod(e){return clearTimeout(this._timer),this._networkUpdatePeriod=e,this._scheduleNetworkUpdate(),this}setLogger(e){return this._logger=e,this}get logger(){return this._logger}async ping(e){await new AccountBalanceQuery({accountId:e}).setNodeAccountIds([e instanceof AccountId?e:AccountId.fromString(e)]).execute(this)}async pingAll(){for(const e of Object.values(this._network.network))await this.ping(e)}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const e=await(new AddressBookQueryWeb).setFileId(FileId.getAddressBookFileIdFor(this._shard,this._realm)).execute(this);this.setNetworkFromAddressBook(e)}catch(e){this._logger&&this._logger.trace(`failed to update client address book: ${e.toString()}`)}finally{this._isUpdatingNetwork=!1}return this}close(){this._network.close(),this._mirrorNetwork.close(),this._isShutdown=!0,clearTimeout(this._timer)}_createNetworkChannel(){return()=>{throw new Error("not implemented")}}_createMirrorNetworkChannel(){return()=>{throw new Error("not implemented")}}_scheduleNetworkUpdate(){this._timer=setTimeout(async()=>{await this.updateNetwork(),this._isShutdown||this._scheduleNetworkUpdate()},this._networkUpdatePeriod)}get isClientShutDown(){return this._isShutdown}static _validateNetworkConsistency(e){if(0===Object.keys(e).length)return;const[,t]=Object.entries(e)[0],n=t.toString(),[r,o]=n.split(".").map(Number),a=Object.values(e).every(e=>{const t=e.toString(),[n,a]=t.split(".").map(Number);return n===r&&a===o});if(!a)throw new Error("Network is not valid, all nodes must be in the same shard and realm")}static _extractShardRealm(e){const t=Object.entries(e);if(0===t.length)return{shard:0,realm:0};const[,n]=t[0],r=n.toString(),[o,a]=r.split(".").map(Number);return{shard:o,realm:a}}}const SDK_NAME="hiero-sdk-js",SDK_VERSION="2.83.0-beta.1",{proto:proto}=HieroProto;class Channel{constructor(e=DEFAULT_GRPC_DEADLINE){this._crypto=null,this._smartContract=null,this._file=null,this._consensus=null,this._freeze=null,this._network=null,this._token=null,this._schedule=null,this._util=null,this._addressBook=null,this._grpcDeadline=e}setGrpcDeadline(e){this._grpcDeadline=e}get grpcDeadline(){return this._grpcDeadline}close(){throw new Error("not implemented")}get crypto(){return null!=this._crypto||(this._crypto=proto.CryptoService.create(this._createUnaryClient("CryptoService"))),this._crypto}get smartContract(){return null!=this._smartContract||(this._smartContract=proto.SmartContractService.create(this._createUnaryClient("SmartContractService"))),this._smartContract}get file(){return null!=this._file||(this._file=proto.FileService.create(this._createUnaryClient("FileService"))),this._file}get consensus(){return null!=this._consensus||(this._consensus=proto.ConsensusService.create(this._createUnaryClient("ConsensusService"))),this._consensus}get freeze(){return null!=this._freeze||(this._freeze=proto.FreezeService.create(this._createUnaryClient("FreezeService"))),this._freeze}get network(){return null!=this._network||(this._network=proto.NetworkService.create(this._createUnaryClient("NetworkService"))),this._network}get token(){return null!=this._token||(this._token=proto.TokenService.create(this._createUnaryClient("TokenService"))),this._token}get schedule(){return null!=this._schedule||(this._schedule=proto.ScheduleService.create(this._createUnaryClient("ScheduleService"))),this._schedule}get util(){return null!=this._util||(this._util=proto.UtilService.create(this._createUnaryClient("UtilService"))),this._util}get addressBook(){return null!=this._addressBook||(this._addressBook=proto.AddressBookService.create(this._createUnaryClient("AddressBookService"))),this._addressBook}_createUnaryClient(e){throw new Error("not implemented")}}function encodeRequest(e){const t=new ArrayBuffer(e.byteLength+5);return new DataView(t,1,4).setUint32(0,e.length),new Uint8Array(t,5).set(e),t}function decodeUnaryResponse(e,t=0,n=e.byteLength){const r=new DataView(e,t,n);let o=0,a=null,i=0;for(;o<r.byteLength;){const t=r.getUint8(o+0)>>7,n=r.getUint32(o+1),s=o+5;if(s+n>r.byteLength)throw new Error("(BUG) unexpected frame length past the boundary");const c=new Uint8Array(e,r.byteOffset+s,n);if(0===t){if(null!=a)throw new Error("(BUG) unexpectedly received more than one data frame");a=c}else{if(1!==t)throw new Error(`(BUG) unexpected frame type: ${t}`);{const e=decode(c),[t,n]=e.split(":");if("grpc-status"!==t)throw new Error(`(BUG) unhandled trailer, ${e}`);i=parseInt(n)}}o+=n+5}if(0!==i)throw new Error(`(BUG) unhandled grpc-status: ${i}`);if(null==a)throw new Error("(BUG) unexpectedly received no response");return a}class WebChannel extends Channel{constructor(e,t){super(t),this._address=e,this._isReady=!1,this._healthCheckPromise=null}_shouldUseHttps(e){return!(e.includes("localhost")||e.includes("127.0.0.1")||e.includes(".cluster.local"))}_buildUrl(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;return this._shouldUseHttps(e)?`https://${e}`:`http://${e}`}async _waitForReady(e){if(!this._isReady){if(this._healthCheckPromise)return this._healthCheckPromise;this._healthCheckPromise=this._performHealthCheck(e);try{await this._healthCheckPromise}finally{this._healthCheckPromise=null}}}async _performHealthCheck(e){const t=this._buildUrl(this._address),n=e.getTime()-Date.now();if(n<=0)throw new GrpcServiceError(GrpcStatus.Timeout,ALL_WEB_NETWORK_NODES?.[this._address]?.toString());const r=new AbortController,o=setTimeout(()=>r.abort(),n);try{const e=await fetch(t,{method:"POST",headers:{"content-type":"application/grpc-web+proto","x-user-agent":`${SDK_NAME}/${SDK_VERSION}`,"x-grpc-web":"1"},body:new Uint8Array(0),signal:r.signal});if(clearTimeout(o),e.ok||e.status>=300&&e.status<400){const t=e.headers.get("grpc-status"),n=e.headers.get("grpc-message");if(null!=t||null!=n)return void(this._isReady=!0)}throw new GrpcServiceError(GrpcStatus.Unavailable,ALL_WEB_NETWORK_NODES?.[this._address]?.toString())}catch(e){if(clearTimeout(o),e instanceof Error&&"AbortError"===e.name)throw new GrpcServiceError(GrpcStatus.Timeout,ALL_WEB_NETWORK_NODES?.[this._address]?.toString());if(e instanceof GrpcServiceError)throw e;throw new GrpcServiceError(GrpcStatus.Unavailable,ALL_WEB_NETWORK_NODES?.[this._address]?.toString())}}close(){}_createUnaryClient(e){return async(t,n,r)=>{const o=new Date,a=this._grpcDeadline;o.setMilliseconds(o.getMilliseconds()+a);try{await this._waitForReady(o);const a=this._buildUrl(this._address),i=await fetch(`${a}/proto.${e}/${t.name}`,{method:"POST",headers:{"content-type":"application/grpc-web+proto","x-user-agent":`${SDK_NAME}/${SDK_VERSION}`,"x-grpc-web":"1"},body:encodeRequest(n)});if(!i.ok){return void r(new HttpError(HttpStatus._fromValue(i.status)),null)}const s=i.headers.get("grpc-status"),c=i.headers.get("grpc-message");if(null!=s&&null!=c){const e=new GrpcServiceError(GrpcStatus._fromValue(parseInt(s)),ALL_WEB_NETWORK_NODES?.[this._address]?.toString());return e.message=c,void r(e,null)}const u=await i.arrayBuffer();r(null,decodeUnaryResponse(u))}catch(e){if(e instanceof GrpcServiceError)return void r(e,null);r(new GrpcServiceError(GrpcStatus._fromValue(18),ALL_WEB_NETWORK_NODES?.[this._address]?.toString()),null)}}}}class WebClient extends Client{constructor(e){if(super(e),null!=e){if("string"==typeof e.network)this._setNetworkFromName(e.network);else if(null!=e.network){Client._validateNetworkConsistency(e.network);const{shard:t,realm:n}=Client._extractShardRealm(e.network);this._shard=t,this._realm=n,this.setNetwork(e.network)}if("string"==typeof e.mirrorNetwork)switch(e.mirrorNetwork){case"mainnet":this.setMirrorNetwork(WebMirrorNetwork.MAINNET);break;case"testnet":this.setMirrorNetwork(WebMirrorNetwork.TESTNET);break;case"previewnet":this.setMirrorNetwork(WebMirrorNetwork.PREVIEWNET);break;default:this.setMirrorNetwork([e.mirrorNetwork])}else null!=e.mirrorNetwork&&this.setMirrorNetwork(e.mirrorNetwork)}}static fromConfig(e){return new WebClient("string"==typeof e?JSON.parse(e):e)}static forNetwork(e){return new WebClient({network:e})}static forName(e){return new WebClient({network:e})}static forMainnet(){return new WebClient({network:"mainnet"})}static forTestnet(){return new WebClient({network:"testnet"})}static forPreviewnet(){return new WebClient({network:"previewnet"})}static forLocalNode(e={scheduleNetworkUpdate:!1}){return new WebClient({network:"local-node",...e})}static async forMainnetAsync(){return new WebClient({network:"mainnet"}).updateNetwork()}static async forTestnetAsync(){return new WebClient({network:"testnet"}).updateNetwork()}static async forPreviewnetAsync(){return new WebClient({network:"previewnet"}).updateNetwork()}static async forNameAsync(e){const t=new WebClient({network:e});return"local-node"!==e&&await t.updateNetwork(),t}static async forMirrorNetwork(e){const t=new WebClient({mirrorNetwork:e});return await t.updateNetwork(),t}setNetwork(e){if("string"==typeof e)switch(e){case"previewnet":this._network.setNetwork(WebNetwork.PREVIEWNET);break;case"testnet":this._network.setNetwork(WebNetwork.TESTNET);break;case"mainnet":this._network.setNetwork(WebNetwork.MAINNET);break;case"local-node":this._network.setNetwork(WebNetwork.LOCAL_NODE)}else{for(const[t]of Object.entries(e))(t.startsWith("https://")||t.startsWith("http://"))&&console.warn('[Deprecation Notice] Hiero SDK: Network endpoint "'+t+'" includes a URL scheme (e.g. "https://"). This format was accepted in earlier versions but is now deprecated. Please remove the scheme and use "host:port" instead (e.g. "node00.swirldslabs.com:443"). Support for scheme-prefixed endpoints will be removed in a future major release.');this._network.setNetwork(e)}}setMirrorNetwork(e){if("string"==typeof e)switch(e){case"local-node":this._mirrorNetwork.setNetwork(WebMirrorNetwork.LOCAL_NODE);break;case"previewnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.PREVIEWNET);break;case"testnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.TESTNET);break;case"mainnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.MAINNET);break;default:this._mirrorNetwork.setNetwork([e])}else this._mirrorNetwork.setNetwork(e);return this}_setNetworkFromName(e){switch(e){case"mainnet":this.setNetwork(WebNetwork.MAINNET),this.setMirrorNetwork(WebMirrorNetwork.MAINNET),this.setLedgerId(LedgerId.MAINNET);break;case"testnet":this.setNetwork(WebNetwork.TESTNET),this.setMirrorNetwork(WebMirrorNetwork.TESTNET),this.setLedgerId(LedgerId.TESTNET);break;case"previewnet":this.setNetwork(WebNetwork.PREVIEWNET),this.setMirrorNetwork(WebMirrorNetwork.PREVIEWNET),this.setLedgerId(LedgerId.PREVIEWNET);break;case"local-node":this.setNetwork(WebNetwork.LOCAL_NODE),this.setMirrorNetwork(WebMirrorNetwork.LOCAL_NODE),this.setLedgerId(LedgerId.LOCAL_NODE);break;default:throw new Error(`unknown network: ${e}`)}return this}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const e=await(new AddressBookQueryWeb).setFileId(FileId.getAddressBookFileIdFor(this.shard,this.realm)).execute(this),t={};for(const n of e.nodeAddresses)for(const e of n.addresses)null!=n.accountId&&(t[e.toString()]=n.accountId);this.setNetwork(t)}catch(e){if(this._logger){const t=e instanceof Error?e.message:String(e);this._logger.trace(`failed to update client address book: ${t}`)}}finally{this._isUpdatingNetwork=!1}return this}_createNetworkChannel(){return e=>new WebChannel(e,this.grpcDeadline)}_createMirrorNetworkChannel(){return()=>{throw new Error("mirror support is not supported in browsers")}}}const NetworkName={Mainnet:"mainnet",Testnet:"testnet",Previewnet:"previewnet"};class LocalProviderWeb{constructor(e={}){null==e||null==e.client?this._client=WebClient.forName(e.networkName||"local-node"):this._client=e.client}static fromClient(e){return new LocalProviderWeb({client:e})}getLedgerId(){return this._client.ledgerId}getNetwork(){return this._client.network}getMirrorNetwork(){return this._client.mirrorNetwork}getAccountBalance(e){return(new AccountBalanceQuery).setAccountId(e).execute(this._client)}getAccountInfo(e){return(new AccountInfoQuery).setAccountId(e).execute(this._client)}getAccountRecords(e){return(new AccountRecordsQuery).setAccountId(e).execute(this._client)}getTransactionReceipt(e){return(new TransactionReceiptQuery).setTransactionId(e).execute(this._client)}async sendTransaction(e){return await e.execute(this._client)}async sendQuery(e){return await e.execute(this._client)}async waitForReceipt(e){return await e.getReceipt(this._client)}async call(e){return await e.execute(this._client)}close(){this._client.close()}}exports.AccountAllowanceAdjustTransaction=AccountAllowanceAdjustTransaction,exports.AccountAllowanceApproveTransaction=AccountAllowanceApproveTransaction,exports.AccountAllowanceDeleteTransaction=AccountAllowanceDeleteTransaction,exports.AccountBalance=AccountBalance,exports.AccountBalanceQuery=AccountBalanceQuery,exports.AccountCreateTransaction=AccountCreateTransaction,exports.AccountDeleteTransaction=AccountDeleteTransaction,exports.AccountId=AccountId,exports.AccountInfo=AccountInfo,exports.AccountInfoFlow=AccountInfoFlow,exports.AccountInfoQuery=AccountInfoQuery,exports.AccountRecordsQuery=AccountRecordsQuery,exports.AccountUpdateTransaction=AccountUpdateTransaction,exports.AddressBookQuery=AddressBookQueryWeb,exports.AssessedCustomFee=AssessedCustomFee,exports.BadKeyError=BadKeyError,exports.BadMnemonicError=BadMnemonicError,exports.BadMnemonicReason=BadMnemonicReason,exports.BatchTransaction=BatchTransaction,exports.Cache=CACHE,exports.Client=WebClient,exports.ContractByteCodeQuery=ContractByteCodeQuery,exports.ContractCallQuery=ContractCallQuery,exports.ContractCreateFlow=ContractCreateFlow,exports.ContractCreateTransaction=ContractCreateTransaction,exports.ContractDeleteTransaction=ContractDeleteTransaction,exports.ContractExecuteTransaction=ContractExecuteTransaction,exports.ContractFunctionParameters=ContractFunctionParameters,exports.ContractFunctionResult=ContractFunctionResult,exports.ContractFunctionSelector=ContractFunctionSelector,exports.ContractId=ContractId,exports.ContractInfo=ContractInfo,exports.ContractInfoQuery=ContractInfoQuery,exports.ContractLogInfo=ContractLogInfo,exports.ContractNonceInfo=ContractNonceInfo,exports.ContractUpdateTransaction=ContractUpdateTransaction,exports.CustomFee=CustomFee,exports.CustomFeeLimit=CustomFeeLimit,exports.CustomFixedFee=CustomFixedFee,exports.CustomFractionalFee=CustomFractionalFee,exports.CustomRoyaltyFee=CustomRoyalyFee,exports.DelegateContractId=DelegateContractId,exports.EntityIdHelper=EntityIdHelper,exports.EthereumFlow=EthereumFlow,exports.EthereumTransaction=EthereumTransaction,exports.EthereumTransactionData=EthereumTransactionData,exports.EthereumTransactionDataEip1559=EthereumTransactionDataEip1559,exports.EthereumTransactionDataEip2930=EthereumTransactionDataEip2930,exports.EthereumTransactionDataEip7702=EthereumTransactionDataEip7702,exports.EthereumTransactionDataLegacy=EthereumTransactionDataLegacy,exports.EvmAddress=EvmAddress,exports.EvmHook=EvmHook,exports.EvmHookCall=EvmHookCall,exports.EvmHookMappingEntries=EvmHookMappingEntries,exports.EvmHookMappingEntry=EvmHookMappingEntry,exports.EvmHookStorageSlot=EvmHookStorageSlot,exports.EvmHookStorageUpdate=EvmHookStorageUpdate,exports.ExchangeRate=ExchangeRate,exports.ExchangeRates=ExchangeRates,exports.Executable=Executable,exports.FeeAssessmentMethod=FeeAssessmentMethod,exports.FeeComponents=FeeComponents,exports.FeeData=FeeData,exports.FeeDataType=FeeDataType,exports.FeeSchedule=FeeSchedule,exports.FeeSchedules=FeeSchedules,exports.FileAppendTransaction=FileAppendTransaction,exports.FileContentsQuery=FileContentsQuery,exports.FileCreateTransaction=FileCreateTransaction,exports.FileDeleteTransaction=FileDeleteTransaction,exports.FileId=FileId,exports.FileInfo=FileInfo,exports.FileInfoQuery=FileInfoQuery,exports.FileUpdateTransaction=FileUpdateTransaction,exports.FreezeTransaction=FreezeTransaction,exports.FreezeType=FreezeType,exports.FungibleHookCall=FungibleHookCall,exports.FungibleHookType=FungibleHookType,exports.HEDERA_PATH=HEDERA_PATH,exports.Hbar=Hbar,exports.HbarAllowance=HbarAllowance,exports.HbarUnit=HbarUnit,exports.HookCreationDetails=HookCreationDetails,exports.HookEntityId=HookEntityId,exports.HookExtensionPoint=HookExtensionPoint,exports.HookId=HookId,exports.HookStoreTransaction=HookStoreTransaction,exports.Key=Key,exports.KeyList=KeyList,exports.LedgerId=LedgerId,exports.LiveHash=LiveHash,exports.LiveHashAddTransaction=LiveHashAddTransaction,exports.LiveHashDeleteTransaction=LiveHashDeleteTransaction,exports.LiveHashQuery=LiveHashQuery,exports.LocalProvider=LocalProviderWeb,exports.LogLevel=LogLevel,exports.Logger=Logger,exports.Long=Long,exports.MaxAttemptsOrTimeoutError=MaxAttemptsOrTimeoutError,exports.MaxQueryPaymentExceeded=MaxQueryPaymentExceeded,exports.MirrorNodeContractCallQuery=MirrorNodeContractCallQuery,exports.MirrorNodeContractEstimateQuery=MirrorNodeContractEstimateQuery,exports.Mnemonic=Mnemonic,exports.NetworkName=NetworkName,exports.NetworkVersionInfo=NetworkVersionInfo,exports.NetworkVersionInfoQuery=NetworkVersionInfoQuery,exports.NftHookCall=NftHookCall,exports.NftHookType=NftHookType,exports.NftId=NftId,exports.NodeAddressBook=NodeAddressBook,exports.NodeCreateTransaction=NodeCreateTransaction,exports.NodeDeleteTransaction=NodeDeleteTransaction,exports.NodeUpdateTransaction=NodeUpdateTransaction,exports.PendingAirdropId=PendingAirdropId,exports.PrecheckStatusError=PrecheckStatusError,exports.PrivateKey=PrivateKey,exports.PrngTransaction=PrngTransaction,exports.Provider=Provider,exports.ProxyStaker=ProxyStaker,exports.PublicKey=PublicKey,exports.Query=Query,exports.ReceiptStatusError=ReceiptStatusError,exports.RequestType=RequestType,exports.SLIP44_ECDSA_ETH_PATH=SLIP44_ECDSA_ETH_PATH,exports.SLIP44_ECDSA_HEDERA_PATH=SLIP44_ECDSA_HEDERA_PATH,exports.ScheduleCreateTransaction=ScheduleCreateTransaction,exports.ScheduleDeleteTransaction=ScheduleDeleteTransaction,exports.ScheduleId=ScheduleId,exports.ScheduleInfo=ScheduleInfo,exports.ScheduleInfoQuery=ScheduleInfoQuery,exports.ScheduleSignTransaction=ScheduleSignTransaction,exports.SemanticVersion=SemanticVersion,exports.ServiceEndpoint=ServiceEndpoint,exports.SignatureMap=SignatureMap$1,exports.Signer=Signer,exports.SignerSignature=SignerSignature,exports.Status=Status,exports.StatusError=StatusError,exports.SubscriptionHandle=SubscriptionHandle,exports.SystemDeleteTransaction=SystemDeleteTransaction,exports.SystemUndeleteTransaction=SystemUndeleteTransaction,exports.Timestamp=Timestamp,exports.TokenAirdropTransaction=TokenAirdropTransaction,exports.TokenAllowance=TokenAllowance,exports.TokenAssociateTransaction=TokenAssociateTransaction,exports.TokenBurnTransaction=TokenBurnTransaction,exports.TokenCancelAirdropTransaction=TokenCancelAirdropTransaction,exports.TokenClaimAirdropTransaction=TokenClaimAirdropTransaction,exports.TokenCreateTransaction=TokenCreateTransaction,exports.TokenDeleteTransaction=TokenDeleteTransaction,exports.TokenDissociateTransaction=TokenDissociateTransaction,exports.TokenFeeScheduleUpdateTransaction=TokenFeeScheduleUpdateTransaction,exports.TokenFreezeTransaction=TokenFreezeTransaction,exports.TokenGrantKycTransaction=TokenGrantKycTransaction,exports.TokenId=TokenId,exports.TokenInfo=TokenInfo,exports.TokenInfoQuery=TokenInfoQuery,exports.TokenKeyValidation=TokenKeyValidation,exports.TokenMintTransaction=TokenMintTransaction,exports.TokenNftAllowance=TokenNftAllowance,exports.TokenNftInfo=TokenNftInfo,exports.TokenNftInfoQuery=TokenNftInfoQuery,exports.TokenPauseTransaction=TokenPauseTransaction,exports.TokenRejectFlow=TokenRejectFlow,exports.TokenRejectTransaction=TokenRejectTransaction,exports.TokenRevokeKycTransaction=TokenRevokeKycTransaction,exports.TokenSupplyType=TokenSupplyType,exports.TokenType=TokenType,exports.TokenUnfreezeTransaction=TokenUnfreezeTransaction,exports.TokenUnpauseTransaction=TokenUnpauseTransaction,exports.TokenUpdateNftsTransaction=TokenUpdateNftsTransaction,exports.TokenUpdateTransaction=TokenUpdateTransaction,exports.TokenWipeTransaction=TokenWipeTransaction,exports.TopicCreateTransaction=TopicCreateTransaction,exports.TopicDeleteTransaction=TopicDeleteTransaction,exports.TopicId=TopicId,exports.TopicInfo=TopicInfo,exports.TopicInfoQuery=TopicInfoQuery,exports.TopicMessage=TopicMessage,exports.TopicMessageChunk=TopicMessageChunk,exports.TopicMessageQuery=TopicMessageQuery,exports.TopicMessageSubmitTransaction=TopicMessageSubmitTransaction,exports.TopicUpdateTransaction=TopicUpdateTransaction,exports.Transaction=Transaction,exports.TransactionFeeSchedule=TransactionFeeSchedule,exports.TransactionId=TransactionId,exports.TransactionReceipt=TransactionReceipt,exports.TransactionReceiptQuery=TransactionReceiptQuery,exports.TransactionRecord=TransactionRecord,exports.TransactionRecordQuery=TransactionRecordQuery,exports.TransactionResponse=TransactionResponse,exports.Transfer=Transfer,exports.TransferTransaction=TransferTransaction,exports.Wallet=Wallet,exports.WebClient=WebClient});
|
|
116
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u8a=e=>e instanceof Uint8Array,u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function toBytes(e){if("string"==typeof e&&(e=utf8ToBytes(e)),!u8a(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class Hash{clone(){return this._cloneInto()}}function wrapConstructor(e){const t=t=>e().update(toBytes(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(e,t=!1){return t?{h:Number(e&U32_MASK64),l:Number(e>>_32n&U32_MASK64)}:{h:0|Number(e>>_32n&U32_MASK64),l:0|Number(e&U32_MASK64)}}function split(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:a,l:i}=fromBig(e[o],t);[n[o],r[o]]=[a,i]}return[n,r]}const rotlSH=(e,t,n)=>e<<n|t>>>32-n,rotlSL=(e,t,n)=>t<<n|e>>>32-n,rotlBH=(e,t,n)=>t<<n-32|e>>>64-n,rotlBL=(e,t,n)=>e<<n-32|t>>>64-n,[SHA3_PI,SHA3_ROTL,_SHA3_IOTA]=[[],[],[]],_0n=BigInt(0),_1n=BigInt(1),_2n=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let e=0,t=_1n,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],SHA3_PI.push(2*(5*r+n)),SHA3_ROTL.push((e+1)*(e+2)/2%64);let o=_0n;for(let e=0;e<7;e++)t=(t<<_1n^(t>>_7n)*_0x71n)%_256n,t&_2n&&(o^=_1n<<(_1n<<BigInt(e))-_1n);_SHA3_IOTA.push(o)}const[SHA3_IOTA_H,SHA3_IOTA_L]=split(_SHA3_IOTA,!0),rotlH=(e,t,n)=>n>32?rotlBH(e,t,n):rotlSH(e,t,n),rotlL=(e,t,n)=>n>32?rotlBL(e,t,n):rotlSL(e,t,n);function keccakP(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const r=(t+8)%10,o=(t+2)%10,a=n[o],i=n[o+1],s=rotlH(a,i,1)^n[r],c=rotlL(a,i,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],o=e[3];for(let n=0;n<24;n++){const r=SHA3_ROTL[n],a=rotlH(t,o,r),i=rotlL(t,o,r),s=SHA3_PI[n];t=e[s],o=e[s+1],e[s]=a,e[s+1]=i}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=SHA3_IOTA_H[r],e[1]^=SHA3_IOTA_L[r]}n.fill(0)}let Keccak$1=class e extends Hash{constructor(e,t,n,r=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){exists(this);const{blockLen:t,state:n}=this,r=(e=toBytes(e)).length;for(let o=0;o<r;){const a=Math.min(t-this.pos,r-o);for(let t=0;t<a;t++)n[this.pos++]^=e[o++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,128&t&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){exists(this,!1),bytes(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,o=e.length;r<o;){this.posOut>=n&&this.keccak();const a=Math.min(n-this.posOut,o-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:a,enableXOF:i}=this;return t||(t=new e(n,r,o,i,a)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}};const gen=(e,t,n)=>wrapConstructor(()=>new Keccak$1(t,e,n)),keccak_256=gen(1,136,32);let locked=!1;const _keccak256=function(e){return keccak_256(e)};let __keccak256=_keccak256;function keccak256$1(e){const t=getBytes(e,"data");return hexlify(__keccak256(t))}keccak256$1._=_keccak256,keccak256$1.lock=function(){locked=!0},keccak256$1.register=function(e){if(locked)throw new TypeError("keccak256 is locked");__keccak256=e},Object.freeze(keccak256$1);const BN_0$1=BigInt(0),BN_36=BigInt(36);function getChecksumAddress(e){const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=getBytes(keccak256$1(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const ibanLookup={};for(let e=0;e<10;e++)ibanLookup[String(e)]=String(e);for(let e=0;e<26;e++)ibanLookup[String.fromCharCode(65+e)]=String(10+e);const safeDigits=15;function ibanChecksum(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>ibanLookup[e]).join("");for(;t.length>=safeDigits;){let e=t.substring(0,safeDigits);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}const Base36=function(){const e={};for(let t=0;t<36;t++){e["0123456789abcdefghijklmnopqrstuvwxyz"[t]]=BigInt(t)}return e}();function fromBase36(e){e=e.toLowerCase();let t=BN_0$1;for(let n=0;n<e.length;n++)t=t*BN_36+Base36[e[n]];return t}function getAddress(e){if(assertArgument("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const t=getChecksumAddress(e);return assertArgument(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===e,"bad address checksum","address",e),t}if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){assertArgument(e.substring(2,4)===ibanChecksum(e),"bad icap checksum","address",e);let t=fromBase36(e.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return getChecksumAddress("0x"+t)}assertArgument(!1,"invalid address","address",e)}const _gaurd={};function n(e,t){let n=!1;return t<0&&(n=!0,t*=-1),new Typed(_gaurd,`${n?"":"u"}int${t}`,e,{signed:n,width:t})}function b(e,t){return new Typed(_gaurd,`bytes${t||""}`,e,{size:t})}const _typedSymbol=Symbol.for("_ethers_typed");class Typed{type;value;#l;_typedSymbol;constructor(e,t,n,r){null==r&&(r=null),assertPrivate(_gaurd,e,"Typed"),defineProperties(this,{_typedSymbol:_typedSymbol,type:t,value:n}),this.#l=r,this.format()}format(){if("array"===this.type)throw new Error("");if("dynamicArray"===this.type)throw new Error("");return"tuple"===this.type?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return"string"===this.type}get tupleName(){if("tuple"!==this.type)throw TypeError("not a tuple");return this.#l}get arrayLength(){if("array"!==this.type)throw TypeError("not an array");return!0===this.#l?-1:!1===this.#l?this.value.length:null}static from(e,t){return new Typed(_gaurd,e,t)}static uint8(e){return n(e,8)}static uint16(e){return n(e,16)}static uint24(e){return n(e,24)}static uint32(e){return n(e,32)}static uint40(e){return n(e,40)}static uint48(e){return n(e,48)}static uint56(e){return n(e,56)}static uint64(e){return n(e,64)}static uint72(e){return n(e,72)}static uint80(e){return n(e,80)}static uint88(e){return n(e,88)}static uint96(e){return n(e,96)}static uint104(e){return n(e,104)}static uint112(e){return n(e,112)}static uint120(e){return n(e,120)}static uint128(e){return n(e,128)}static uint136(e){return n(e,136)}static uint144(e){return n(e,144)}static uint152(e){return n(e,152)}static uint160(e){return n(e,160)}static uint168(e){return n(e,168)}static uint176(e){return n(e,176)}static uint184(e){return n(e,184)}static uint192(e){return n(e,192)}static uint200(e){return n(e,200)}static uint208(e){return n(e,208)}static uint216(e){return n(e,216)}static uint224(e){return n(e,224)}static uint232(e){return n(e,232)}static uint240(e){return n(e,240)}static uint248(e){return n(e,248)}static uint256(e){return n(e,256)}static uint(e){return n(e,256)}static int8(e){return n(e,-8)}static int16(e){return n(e,-16)}static int24(e){return n(e,-24)}static int32(e){return n(e,-32)}static int40(e){return n(e,-40)}static int48(e){return n(e,-48)}static int56(e){return n(e,-56)}static int64(e){return n(e,-64)}static int72(e){return n(e,-72)}static int80(e){return n(e,-80)}static int88(e){return n(e,-88)}static int96(e){return n(e,-96)}static int104(e){return n(e,-104)}static int112(e){return n(e,-112)}static int120(e){return n(e,-120)}static int128(e){return n(e,-128)}static int136(e){return n(e,-136)}static int144(e){return n(e,-144)}static int152(e){return n(e,-152)}static int160(e){return n(e,-160)}static int168(e){return n(e,-168)}static int176(e){return n(e,-176)}static int184(e){return n(e,-184)}static int192(e){return n(e,-192)}static int200(e){return n(e,-200)}static int208(e){return n(e,-208)}static int216(e){return n(e,-216)}static int224(e){return n(e,-224)}static int232(e){return n(e,-232)}static int240(e){return n(e,-240)}static int248(e){return n(e,-248)}static int256(e){return n(e,-256)}static int(e){return n(e,-256)}static bytes1(e){return b(e,1)}static bytes2(e){return b(e,2)}static bytes3(e){return b(e,3)}static bytes4(e){return b(e,4)}static bytes5(e){return b(e,5)}static bytes6(e){return b(e,6)}static bytes7(e){return b(e,7)}static bytes8(e){return b(e,8)}static bytes9(e){return b(e,9)}static bytes10(e){return b(e,10)}static bytes11(e){return b(e,11)}static bytes12(e){return b(e,12)}static bytes13(e){return b(e,13)}static bytes14(e){return b(e,14)}static bytes15(e){return b(e,15)}static bytes16(e){return b(e,16)}static bytes17(e){return b(e,17)}static bytes18(e){return b(e,18)}static bytes19(e){return b(e,19)}static bytes20(e){return b(e,20)}static bytes21(e){return b(e,21)}static bytes22(e){return b(e,22)}static bytes23(e){return b(e,23)}static bytes24(e){return b(e,24)}static bytes25(e){return b(e,25)}static bytes26(e){return b(e,26)}static bytes27(e){return b(e,27)}static bytes28(e){return b(e,28)}static bytes29(e){return b(e,29)}static bytes30(e){return b(e,30)}static bytes31(e){return b(e,31)}static bytes32(e){return b(e,32)}static address(e){return new Typed(_gaurd,"address",e)}static bool(e){return new Typed(_gaurd,"bool",!!e)}static bytes(e){return new Typed(_gaurd,"bytes",e)}static string(e){return new Typed(_gaurd,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new Typed(_gaurd,"overrides",Object.assign({},e))}static isTyped(e){return e&&"object"==typeof e&&"_typedSymbol"in e&&e._typedSymbol===_typedSymbol}static dereference(e,t){if(Typed.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}}class AddressCoder extends Coder{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let n=Typed.dereference(t,"string");try{n=getAddress(n)}catch(e){return this._throwError(e.message,t)}return e.writeValue(n)}decode(e){return getAddress(toBeHex(e.readValue(),20))}}class AnonymousCoder extends Coder{coder;constructor(e){super(e.name,e.type,"_",e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}function pack(e,t,n){let r=[];if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map(t=>{const r=t.localName;return assert(r,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:t},value:n}),assert(!e[r],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:t},value:n}),e[r]=!0,n[r]})}else assertArgument(!1,"invalid tuple value","tuple",n);assertArgument(t.length===r.length,"types/value length mismatch","tuple",n);let o=new Writer,a=new Writer,i=[];t.forEach((e,t)=>{let n=r[t];if(e.dynamic){let t=a.length;e.encode(a,n);let r=o.writeUpdatableValue();i.push(e=>{r(e+t)})}else e.encode(o,n)}),i.forEach(e=>{e(o.length)});let s=e.appendWriter(o);return s+=e.appendWriter(a),s}function unpack(e,t){let n=[],r=[],o=e.subReader(0);return t.forEach(t=>{let a=null;if(t.dynamic){let n=e.readIndex(),r=o.subReader(n);try{a=t.decode(r)}catch(e){if(isError(e,"BUFFER_OVERRUN"))throw e;a=e,a.baseType=t.name,a.name=t.localName,a.type=t.type}}else try{a=t.decode(e)}catch(e){if(isError(e,"BUFFER_OVERRUN"))throw e;a=e,a.baseType=t.name,a.name=t.localName,a.type=t.type}if(null==a)throw new Error("investigate");n.push(a),r.push(t.localName||null)}),Result.fromItems(n,r)}class ArrayCoder extends Coder{coder;length;constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),defineProperties(this,{coder:e,length:t})}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){const n=Typed.dereference(t,"array");Array.isArray(n)||this._throwError("expected array value",n);let r=this.length;-1===r&&(r=n.length,e.writeValue(n.length)),assertArgumentCount(n.length,r,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let e=0;e<n.length;e++)o.push(this.coder);return pack(e,o,n)}decode(e){let t=this.length;-1===t&&(t=e.readIndex(),assert(t*WordSize<=e.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:e.bytes,offset:t*WordSize,length:e.dataLength}));let n=[];for(let e=0;e<t;e++)n.push(new AnonymousCoder(this.coder));return unpack(e,n)}}class BooleanCoder extends Coder{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const n=Typed.dereference(t,"bool");return e.writeValue(n?1:0)}decode(e){return!!e.readValue()}}class DynamicBytesCoder extends Coder{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=getBytesCopy(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readIndex(),!0)}}class BytesCoder extends DynamicBytesCoder{constructor(e){super("bytes",e)}decode(e){return hexlify(super.decode(e))}}class FixedBytesCoder extends Coder{size;constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),defineProperties(this,{size:e},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=getBytesCopy(Typed.dereference(t,this.type));return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return hexlify(e.readBytes(this.size))}}const Empty=new Uint8Array([]);class NullCoder extends Coder{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes(Empty)}decode(e){return e.readBytes(0),null}}const BN_0=BigInt(0),BN_1=BigInt(1),BN_MAX_UINT256=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class NumberCoder extends Coder{size;signed;constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),defineProperties(this,{size:e,signed:t},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(e,t){let n=getBigInt(Typed.dereference(t,this.type)),r=mask(BN_MAX_UINT256,8*WordSize);if(this.signed){let e=mask(r,8*this.size-1);(n>e||n<-(e+BN_1))&&this._throwError("value out-of-bounds",t),n=toTwos(n,8*WordSize)}else(n<BN_0||n>mask(r,8*this.size))&&this._throwError("value out-of-bounds",t);return e.writeValue(n)}decode(e){let t=mask(e.readValue(),8*this.size);return this.signed&&(t=fromTwos(t,8*this.size)),t}}class StringCoder extends DynamicBytesCoder{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,toUtf8Bytes(Typed.dereference(t,"string")))}decode(e){return toUtf8String(super.decode(e))}}class TupleCoder extends Coder{coders;constructor(e,t){let n=!1;const r=[];e.forEach(e=>{e.dynamic&&(n=!0),r.push(e.type)});super("tuple","tuple("+r.join(",")+")",t,n),defineProperties(this,{coders:Object.freeze(e.slice())})}defaultValue(){const e=[];this.coders.forEach(t=>{e.push(t.defaultValue())});const t=this.coders.reduce((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});return this.coders.forEach((n,r)=>{let o=n.localName;o&&1===t[o]&&("length"===o&&(o="_length"),null==e[o]&&(e[o]=e[r]))}),Object.freeze(e)}encode(e,t){const n=Typed.dereference(t,"tuple");return pack(e,this.coders,n)}decode(e){return unpack(e,this.coders)}}function setify(e){const t=new Set;return e.forEach(e=>t.add(e)),Object.freeze(t)}const _kwVisibDeploy="external public payable override";setify(_kwVisibDeploy.split(" "));const _kwVisib="constant external internal payable private public pure view override";setify(_kwVisib.split(" "));const _kwTypes="constructor error event fallback function receive struct";setify(_kwTypes.split(" "));const _kwModifiers="calldata memory storage payable indexed",KwModifiers=setify(_kwModifiers.split(" ")),_kwOther="tuple returns",_keywords=[_kwTypes,_kwModifiers,_kwOther,_kwVisib].join(" "),Keywords=setify(_keywords.split(" ")),SimpleTokens={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},regexWhitespacePrefix=new RegExp("^(\\s*)"),regexNumberPrefix=new RegExp("^([0-9]+)"),regexIdPrefix=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),regexId=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),regexType=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");class TokenString{#o;#d;get offset(){return this.#o}get length(){return this.#d.length-this.#o}constructor(e){this.#o=0,this.#d=e.slice()}clone(){return new TokenString(this.#d)}reset(){this.#o=0}#p(e=0,t=0){return new TokenString(this.#d.slice(e,t).map(t=>Object.freeze(Object.assign({},t,{match:t.match-e,linkBack:t.linkBack-e,linkNext:t.linkNext-e}))))}popKeyword(e){const t=this.peek();if("KEYWORD"!==t.type||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if("OPEN_PAREN"!==e.type)throw new Error("bad start");const t=this.#p(this.#o+1,e.match+1);return this.#o=e.match+1,t}popParams(){const e=this.peek();if("OPEN_PAREN"!==e.type)throw new Error("bad start");const t=[];for(;this.#o<e.match-1;){const e=this.peek().linkNext;t.push(this.#p(this.#o+1,e)),this.#o=e}return this.#o=e.match+1,t}peek(){if(this.#o>=this.#d.length)throw new Error("out-of-bounds");return this.#d[this.#o]}peekKeyword(e){const t=this.peekType("KEYWORD");return null!=t&&e.has(t)?t:null}peekType(e){if(0===this.length)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return this.#o++,e}toString(){const e=[];for(let t=this.#o;t<this.#d.length;t++){const n=this.#d[t];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(" ")}>`}}function lex(e){const t=[],n=t=>{const n=a<e.length?JSON.stringify(e[a]):"$EOI";throw new Error(`invalid token ${n} at ${a}: ${t}`)};let r=[],o=[],a=0;for(;a<e.length;){let i=e.substring(a),s=i.match(regexWhitespacePrefix);s&&(a+=s[1].length,i=e.substring(a));const c={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:a,value:-1};t.push(c);let u=SimpleTokens[i[0]]||"";if(u){if(c.type=u,c.text=i[0],a++,"OPEN_PAREN"===u)r.push(t.length-1),o.push(t.length-1);else if("CLOSE_PAREN"==u)0===r.length&&n("no matching open bracket"),c.match=r.pop(),t[c.match].match=t.length-1,c.depth--,c.linkBack=o.pop(),t[c.linkBack].linkNext=t.length-1;else if("COMMA"===u)c.linkBack=o.pop(),t[c.linkBack].linkNext=t.length-1,o.push(t.length-1);else if("OPEN_BRACKET"===u)c.type="BRACKET";else if("CLOSE_BRACKET"===u){let e=t.pop().text;if(t.length>0&&"NUMBER"===t[t.length-1].type){const n=t.pop().text;e=n+e,t[t.length-1].value=getNumber(n)}if(0===t.length||"BRACKET"!==t[t.length-1].type)throw new Error("missing opening bracket");t[t.length-1].text+=e}}else if(s=i.match(regexIdPrefix),s){if(c.text=s[1],a+=c.text.length,Keywords.has(c.text)){c.type="KEYWORD";continue}if(c.text.match(regexType)){c.type="TYPE";continue}c.type="ID"}else{if(s=i.match(regexNumberPrefix),!s)throw new Error(`unexpected token ${JSON.stringify(i[0])} at position ${a}`);c.text=s[1],c.type="NUMBER",a+=c.text.length}}return new TokenString(t.map(e=>Object.freeze(e)))}function consumeKeywords(e,t){const n=new Set;for(;;){const r=e.peekType("KEYWORD");if(null==r||t&&!t.has(r))break;if(e.pop(),n.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}const regexArrayType=new RegExp(/^(.*)\[([0-9]*)\]$/);function verifyBasicType(e){const t=e.match(regexType);if(assertArgument(t,"invalid type","type",e),"uint"===e)return"uint256";if("int"===e)return"int256";if(t[2]){const n=parseInt(t[2]);assertArgument(0!==n&&n<=32,"invalid bytes length","type",e)}else if(t[3]){const n=parseInt(t[3]);assertArgument(0!==n&&n<=256&&n%8==0,"invalid numeric width","type",e)}return e}const _guard={},internal=Symbol.for("_ethers_internal"),ParamTypeInternal="_ParamTypeInternal";class ParamType{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,t,n,r,o,a,i,s){if(assertPrivate(e,_guard,"ParamType"),Object.defineProperty(this,internal,{value:ParamTypeInternal}),a&&(a=Object.freeze(a.slice())),"array"===r){if(null==i||null==s)throw new Error("")}else if(null!=i||null!=s)throw new Error("");if("tuple"===r){if(null==a)throw new Error("")}else if(null!=a)throw new Error("");defineProperties(this,{name:t,type:n,baseType:r,indexed:o,components:a,arrayLength:i,arrayChildren:s})}format(e){if(null==e&&(e="sighash"),"json"===e){const t=this.name||"";if(this.isArray()){const e=JSON.parse(this.arrayChildren.format("json"));return e.name=t,e.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(e)}const n={type:"tuple"===this.baseType?"tuple":this.type,name:t};return"boolean"==typeof this.indexed&&(n.indexed=this.indexed),this.isTuple()&&(n.components=this.components.map(t=>JSON.parse(t.format(e)))),JSON.stringify(n)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(t=>t.format(e)).join("full"===e?", ":",")+")":t+=this.type,"sighash"!==e&&(!0===this.indexed&&(t+=" indexed"),"full"===e&&this.name&&(t+=" "+this.name)),t}isArray(){return"array"===this.baseType}isTuple(){return"tuple"===this.baseType}isIndexable(){return null!=this.indexed}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(-1!==this.arrayLength&&e.length!==this.arrayLength)throw new Error("array is wrong length");const n=this;return e.map(e=>n.arrayChildren.walk(e,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const n=this;return e.map((e,r)=>n.components[r].walk(e,t))}return t(this.type,e)}#h(e,t,n,r){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(-1!==this.arrayLength&&t.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=t.slice();return a.forEach((t,r)=>{o.#h(e,t,n,e=>{a[r]=e})}),void r(a)}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(t))a=t.slice();else{if(null==t||"object"!=typeof t)throw new Error("invalid tuple value");a=o.map(e=>{if(!e.name)throw new Error("cannot use object value with unnamed components");if(!(e.name in t))throw new Error(`missing value for component ${e.name}`);return t[e.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");return a.forEach((t,r)=>{o[r].#h(e,t,n,e=>{a[r]=e})}),void r(a)}const o=n(this.type,t);o.then?e.push(async function(){r(await o)}()):r(o)}async walkAsync(e,t){const n=[],r=[e];return this.#h(n,e,t,e=>{r[0]=e}),n.length&&await Promise.all(n),r[0]}static from(e,t){if(ParamType.isParamType(e))return e;if("string"==typeof e)try{return ParamType.from(lex(e),t)}catch(t){assertArgument(!1,"invalid param type","obj",e)}else if(e instanceof TokenString){let n="",r="",o=null;consumeKeywords(e,setify(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(r="tuple",o=e.popParams().map(e=>ParamType.from(e)),n=`tuple(${o.map(e=>e.format()).join(",")})`):(n=verifyBasicType(e.popType("TYPE")),r=n);let a=null,i=null;for(;e.length&&e.peekType("BRACKET");){const t=e.pop();a=new ParamType(_guard,"",n,r,null,o,i,a),i=t.value,n+=t.text,r="array",o=null}let s=null;if(consumeKeywords(e,KwModifiers).has("indexed")){if(!t)throw new Error("");s=!0}const c=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new ParamType(_guard,c,n,r,s,o,i,a)}const n=e.name;assertArgument(!n||"string"==typeof n&&n.match(regexId),"invalid name","obj.name",n);let r=e.indexed;null!=r&&(assertArgument(t,"parameter cannot be indexed","obj.indexed",e.indexed),r=!!r);let o=e.type,a=o.match(regexArrayType);if(a){const t=parseInt(a[2]||"-1"),i=ParamType.from({type:a[1],components:e.components});return new ParamType(_guard,n||"",o,"array",r,null,t,i)}if("tuple"===o||o.startsWith("tuple(")||o.startsWith("(")){const t=null!=e.components?e.components.map(e=>ParamType.from(e)):null;return new ParamType(_guard,n||"",o,"tuple",r,t,null,null)}return o=verifyBasicType(e.type),new ParamType(_guard,n||"",o,o,r,null,null,null)}static isParamType(e){return e&&e[internal]===ParamTypeInternal}}const PanicReasons=new Map;PanicReasons.set(0,"GENERIC_PANIC"),PanicReasons.set(1,"ASSERT_FALSE"),PanicReasons.set(17,"OVERFLOW"),PanicReasons.set(18,"DIVIDE_BY_ZERO"),PanicReasons.set(33,"ENUM_RANGE_ERROR"),PanicReasons.set(34,"BAD_STORAGE_DATA"),PanicReasons.set(49,"STACK_UNDERFLOW"),PanicReasons.set(50,"ARRAY_RANGE_ERROR"),PanicReasons.set(65,"OUT_OF_MEMORY"),PanicReasons.set(81,"UNINITIALIZED_FUNCTION_CALL");const paramTypeBytes=new RegExp(/^bytes([0-9]*)$/),paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);let defaultCoder=null,defaultMaxInflation=1024;function getBuiltinCallException(e,t,n,r){let o="missing revert data",a=null;let i=null;if(n){o="execution reverted";const e=getBytes(n);if(n=hexlify(n),0===e.length)o+=" (no data present; likely require(false) occurred",a="require(false)";else if(e.length%32!=4)o+=" (could not decode reason; invalid data length)";else if("0x08c379a0"===hexlify(e.slice(0,4)))try{a=r.decode(["string"],e.slice(4))[0],i={signature:"Error(string)",name:"Error",args:[a]},o+=`: ${JSON.stringify(a)}`}catch(e){o+=" (could not decode reason; invalid string data)"}else if("0x4e487b71"===hexlify(e.slice(0,4)))try{const t=Number(r.decode(["uint256"],e.slice(4))[0]);i={signature:"Panic(uint256)",name:"Panic",args:[t]},a=`Panic due to ${PanicReasons.get(t)||"UNKNOWN"}(${t})`,o+=`: ${a}`}catch(e){o+=" (could not decode panic code)"}else o+=" (unknown custom error)"}const s={to:t.to?getAddress(t.to):null,data:t.data||"0x"};return t.from&&(s.from=getAddress(t.from)),makeError(o,"CALL_EXCEPTION",{action:e,data:n,reason:a,transaction:s,invocation:null,revert:i})}class AbiCoder{#f(e){if(e.isArray())return new ArrayCoder(this.#f(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new TupleCoder(e.components.map(e=>this.#f(e)),e.name);switch(e.baseType){case"address":return new AddressCoder(e.name);case"bool":return new BooleanCoder(e.name);case"string":return new StringCoder(e.name);case"bytes":return new BytesCoder(e.name);case"":return new NullCoder(e.name)}let t=e.type.match(paramTypeNumber);if(t){let n=parseInt(t[2]||"256");return assertArgument(0!==n&&n<=256&&n%8==0,"invalid "+t[1]+" bit length","param",e),new NumberCoder(n/8,"int"===t[1],e.name)}if(t=e.type.match(paramTypeBytes),t){let n=parseInt(t[1]);return assertArgument(0!==n&&n<=32,"invalid bytes length","param",e),new FixedBytesCoder(n,e.name)}assertArgument(!1,"invalid type","type",e.type)}getDefaultValue(e){const t=e.map(e=>this.#f(ParamType.from(e)));return new TupleCoder(t,"_").defaultValue()}encode(e,t){assertArgumentCount(t.length,e.length,"types/values length mismatch");const n=e.map(e=>this.#f(ParamType.from(e))),r=new TupleCoder(n,"_"),o=new Writer;return r.encode(o,t),o.data}decode(e,t,n){const r=e.map(e=>this.#f(ParamType.from(e)));return new TupleCoder(r,"_").decode(new Reader(t,n,defaultMaxInflation))}static _setDefaultMaxInflation(e){assertArgument("number"==typeof e&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),defaultMaxInflation=e}static defaultAbiCoder(){return null==defaultCoder&&(defaultCoder=new AbiCoder),defaultCoder}static getBuiltinCallException(e,t,n){return getBuiltinCallException(e,t,n,AbiCoder.defaultAbiCoder())}}class EvmAddress extends Key{constructor(e){super(),this._bytes=e}static fromString(e){if(40!==(e=e.startsWith("0x")?e.slice(2):e).length)throw new Error("Input EVM address string is not the correct size");return new EvmAddress(decode$7(e))}static fromBytes(e){return new EvmAddress(e)}toBytes(){return this._bytes}toString(){return encode$4(this._bytes)}equals(e){return arrayEqual$2(this._bytes,e._bytes)}}const regex=/"^(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))(?:-([a-z]{5}))?$/,ENTITY_ID_REGEX=/^(\d+)(?:\.(\d+)\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/,EVM_ADDRESS_LENGTH=20,LONG_ZERO_PREFIX_LENGTH=12,ENTITY_NUM_OFFSET=16;function constructor(e,t,n){if(null==t&&null!=n||null!=t&&null==n)throw new Error("invalid entity ID");const[r,o,a]="number"==typeof e||Long.isLong(e)?[null!=n?Long.fromValue(e):Long.ZERO,null!=t?Long.fromValue(t):Long.ZERO,null!=n?Long.fromValue(n):Long.fromValue(e)]:[null!=e.shard?Long.fromValue(e.shard):Long.ZERO,null!=e.realm?Long.fromValue(e.realm):Long.ZERO,Long.fromValue(e.num)];if(r.isNegative()||o.isNegative()||a.isNegative())throw new Error("negative numbers are not allowed in IDs");return{shard:r,realm:o,num:a}}function compare(e,t){let n=e[0].compare(t[0]);return 0!=n?n:(n=e[1].compare(t[1]),0!=n?n:e[2].compare(t[2]))}function fromStringSplitter(e){const t=ENTITY_ID_REGEX.exec(e);if(null==t)throw new Error(`failed to parse entity id: ${e}`);return null==t[2]&&null==t[3]?{shard:"0",realm:"0",numOrHex:t[1],checksum:t[4]}:{shard:t[1],realm:t[2],numOrHex:t[3],checksum:t[4]}}function fromString(e){const t=fromStringSplitter(e);if(Number.isNaN(t.shard)||Number.isNaN(t.realm)||Number.isNaN(t.numOrHex))throw new Error("invalid format for entity ID");return{shard:null!=t.shard?Long.fromString(t.shard):Long.ZERO,realm:null!=t.realm?Long.fromString(t.realm):Long.ZERO,num:Long.fromString(t.numOrHex),checksum:t.checksum}}function fromSolidityAddress(e){const t=e.startsWith("0x")?decode$7(e.slice(2)):decode$7(e);if(t.length!==EVM_ADDRESS_LENGTH)throw new Error(`Invalid hex encoded solidity address length:\n expected length 40, got length ${e.length}`);return[Long.fromBytesBE([0,0,0,0,...t.slice(0,4)]),Long.fromBytesBE(Array.from(t.slice(4,12))),Long.fromBytesBE(Array.from(t.slice(12,20)))]}function fromEvmAddress(e,t,n){if(!isHexString(n))throw new Error(`Invalid EVM address hex string: ${n}`);const r=n.startsWith("0x")?decode$7(n.slice(2)):decode$7(n);if(r.length!==EVM_ADDRESS_LENGTH)throw new Error(`Invalid hex encoded evm address length:\n expected length ${EVM_ADDRESS_LENGTH}, got length ${n.length}`);let o=Long.ZERO;return isLongZeroAddress(r)&&(o=Long.fromBytesBE(Array.from(r.slice(LONG_ZERO_PREFIX_LENGTH,EVM_ADDRESS_LENGTH)))),[e instanceof Long?e:Long.fromNumber(e),t instanceof Long?t:Long.fromNumber(t),o,o.isZero()?EvmAddress.fromBytes(r):null]}function toSolidityAddress(e){const t=new Uint8Array(20),n=safeView(t),[r,o,a]=e;return n.setUint32(0,convertToNumber(r)),n.setUint32(8,convertToNumber(o)),n.setUint32(16,convertToNumber(a)),encode$4(t)}function toEvmAddress(e){if(e instanceof Uint8Array)return encode$4(e);const t=e,n=new Uint8Array(EVM_ADDRESS_LENGTH);return safeView(n).setUint32(ENTITY_NUM_OFFSET,convertToNumber(t)),encode$4(n)}function _parseAddress(e,t){let n=regex.exec(t);if(null===n){return{status:0}}let r=[Long.fromString(n[1]),Long.fromString(n[2]),Long.fromString(n[3])],o=`${r[0].toString()}.${r[1].toString()}.${r[2].toString()}`,a=_checksum(e,o);return{status:void 0===n[4]?2:a==n[4]?3:1,num1:r[0],num2:r[1],num3:r[2],givenChecksum:n[4],correctChecksum:a,noChecksumFormat:o,withChecksumFormat:`${o}-${a}`}}function _checksum(e,t){let n="",r=[],o=0,a=0,i=0,s=0,c=0;const u=11881376,l="a".charCodeAt(0);let d=new Uint8Array(e.length+6);d.set(e,0),d.set([0,0,0,0,0,0],e.length);for(let e=0;e<t.length;e++)r.push("."===t[e]?10:parseInt(t[e],10));for(let e=0;e<r.length;e++)i=(31*i+r[e])%17576,e%2==0?o=(o+r[e])%11:a=(a+r[e])%11;for(let e=0;e<d.length;e++)s=(31*s+d[e])%u;c=(17576*(11*(t.length%5*11+o)+a)+i+s)%u,c=1000003*c%u;for(let e=0;e<5;e++)n=String.fromCharCode(l+c%26)+n,c/=26;return n}function validateChecksum(e,t,n,r,o){if(null==o._network._ledgerId||null==r)return;const a=_checksum(o._network._ledgerId._ledgerId,`${e.toString()}.${t.toString()}.${n.toString()}`);if(r!=a)throw new BadEntityIdError(e,t,n,r,a)}function toStringWithChecksum(e,t){if(null==t)throw new Error("client cannot be null");if(null==t._network._ledgerId)throw new Error("cannot calculate checksum with a client that does not contain a recognzied ledger ID");return`${e}-${_checksum(t._network._ledgerId._ledgerId,e)}`}function appendBuffer(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n}function toHexString(e){var t="0x";return e.forEach(function(e){t+=("0"+(255&e).toString(16)).slice(-2)}),t}function aliasToPublicKey(e){const t=base32.decode(e);if(!t)return null;let n;try{n=libExports.proto.Key.decode(t)}catch(e){throw new Error("The alias is created with hollow account. Please use aliasToEvmAddress!")}return null!=n.ed25519&&n.ed25519.byteLength>0?PublicKey.fromBytes(n.ed25519):null!=n.ECDSASecp256k1&&n.ECDSASecp256k1.byteLength>0?PublicKey.fromBytes(n.ECDSASecp256k1):null}function aliasToEvmAddress(e){const t=base32.decode(e);if(!t)return null;try{throw libExports.proto.Key.decode(t),new Error("The alias is created with ed25519 or ECDSASecp256k1 account. Please use aliasToPublicKey!")}catch(e){return toHexString(t)}}function publicKeyToAlias(e){if("string"==typeof e&&(e.startsWith("0x")&&42==e.length||40==e.length)){e.startsWith("0x")||(e=`0x${e}`);const t=getBytes(e);return t?base32.encode(t):null}const t="string"==typeof e?PublicKey.fromString(e):e;let n=t.toStringRaw(),r="";"secp256k1"===t._key._type&&(r="0x3A21"),"ED25519"===t._key._type&&(r="0x1220"),n.startsWith("0x")||(n=`0x${n}`);const o=appendBuffer(getBytes(r),getBytes(n));return base32.encode(o)}var EntityIdHelper=Object.freeze({__proto__:null,_checksum:_checksum,_parseAddress:_parseAddress,aliasToEvmAddress:aliasToEvmAddress,aliasToPublicKey:aliasToPublicKey,compare:compare,constructor:constructor,fromEvmAddress:fromEvmAddress,fromSolidityAddress:fromSolidityAddress,fromString:fromString,fromStringSplitter:fromStringSplitter,publicKeyToAlias:publicKeyToAlias,toEvmAddress:toEvmAddress,toSolidityAddress:toSolidityAddress,toStringWithChecksum:toStringWithChecksum,validateChecksum:validateChecksum});const HARDENED_BIT=2147483648;class Mnemonic{constructor(e){this._mnemonic=e}static async generate(){return new Mnemonic(await Mnemonic$1._generate(24))}static async generate12(){return new Mnemonic(await Mnemonic$1._generate(12))}static async fromWords(e){return new Mnemonic(await Mnemonic$1.fromWords(e))}async toPrivateKey(e=""){return CACHE.privateKeyConstructor(await this._mnemonic.toPrivateKey(e))}async toEd25519PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toEd25519PrivateKey(e,t))}async toStandardEd25519PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toStandardEd25519PrivateKey(e,t))}async toEcdsaPrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toEcdsaPrivateKey(e,t))}calculateDerivationPathValues(e){const t=/m\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)/.exec(e),n=new Array(5);if(t)for(let e=1;e<=5;e++){let r=t[e];r.endsWith("'")?(r=r.substring(0,r.length-1),n[e-1]=parseInt(r,10)|HARDENED_BIT):n[e-1]=parseInt(r,10)}return n}async toStandardECDSAsecp256k1PrivateKeyImpl(e,t){return await this.toEcdsaPrivateKey(e,t)}async toStandardECDSAsecp256k1PrivateKey(e="",t){return CACHE.privateKeyConstructor(await this._mnemonic.toStandardECDSAsecp256k1PrivateKey(e,t))}async toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath(e="",t){const n=this.calculateDerivationPathValues(t);return await this.toStandardECDSAsecp256k1PrivateKeyImpl(e,n)}static async fromString(e){return new Mnemonic(await Mnemonic$1.fromString(e))}async toLegacyPrivateKey(){return CACHE.privateKeyConstructor(await this._mnemonic.toLegacyPrivateKey())}async toSeed(e){return await Mnemonic$1.toSeed(this._mnemonic.words,e)}toString(){return this._mnemonic.toString()}}class ObjectMap{constructor(e){this._map=new Map,this.__map=new Map,this._fromString=e}get(e){const t="string"==typeof e?e:e.toString(),n=this._map.get(t);return null!=n?n:null}_set(e,t){const n="string"==typeof e?e:e.toString();this._map.set(n,t),this.__map.set(e,t)}values(){return this._map.values()}get size(){return this._map.size}keys(){return this.__map.keys()}[Symbol.iterator](){return this.__map[Symbol.iterator]()}toString(){const e={};for(const[t,n]of this._map)e[t]=n;return JSON.stringify(e)}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t}),e}}function decode$1(e){const t=e.startsWith("0x")?e.substring(2):e;if(t.length%2!=0)throw new Error("Invalid hex string: Must have an even number of characters.");if(/[^0-9a-fA-F]/.test(t))throw new Error("Invalid hex string: Contains non-hexadecimal characters.");const n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2){const r=parseInt(t.substring(e,e+2),16);n[e/2]=r}return Buffer.from(t,"hex")}class AccountId{constructor(e,t,n,r,o){const a=constructor(e,t,n);this.shard=a.shard,this.realm=a.realm,this.num=a.num,this.aliasKey=null!=r?r:null,this.evmAddress=null!=o?o:null,this._checksum=null}static fromString(e){let t,n,r=Long.ZERO,o=Long.ZERO,a=Long.ZERO;if(e.startsWith("0x")&&42==e.length||40==e.length)n=EvmAddress.fromString(e);else{const i=fromStringSplitter(e);if(Number.isNaN(i.shard)||Number.isNaN(i.realm))throw new Error("invalid format for entity ID");null!=i.shard&&(r=Long.fromString(i.shard)),null!=i.realm&&(o=Long.fromString(i.realm)),i.numOrHex.length<20?a=Long.fromString(i.numOrHex):40==i.numOrHex.length?n=EvmAddress.fromString(i.numOrHex):t=PublicKey.fromString(i.numOrHex)}return new AccountId(r,o,a,t,n)}static fromEvmAddress(e,t,n){const r="string"==typeof n?EvmAddress.fromString(n):n,[o,a,i,s]=fromEvmAddress(e,t,r.toString());return new AccountId(o,a,i,void 0,s||void 0)}static fromEvmPublicAddress(e){return new AccountId(0,0,0,void 0,e)}static _fromProtobuf(e){let t,n;return null!=e.alias&&(20===e.alias.length?n=EvmAddress.fromBytes(e.alias):t=Key._fromProtobufKey(libExports.proto.Key.decode(e.alias))),t instanceof PublicKey||(t=void 0),new AccountId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.accountNum?e.accountNum:0,t,n)}get checksum(){return this._checksum}getEvmAddress(){return this.evmAddress}async populateAccountNum(e){if(null===this.evmAddress)throw new Error("field `evmAddress` should not be null");const t=`${e.mirrorRestApiBaseUrl}/accounts/${this.evmAddress.toString()}`;await new Promise(e=>{setTimeout(e,3e3)});const n=await fetch(t),r=(await n.json()).account;return this.num=Long.fromString(r.slice(r.lastIndexOf(".")+1)),this}async populateAccountEvmAddress(e){if(null===this.num)throw new Error("field `num` should not be null");const t=`${e.mirrorRestApiBaseUrl}/accounts/${this.num.toString()}`;await new Promise(e=>{setTimeout(e,3e3)});const n=await fetch(t),r=(await n.json()).evm_address;return this.evmAddress=EvmAddress.fromString(r),this}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return AccountId._fromProtobuf(libExports.proto.AccountID.decode(e))}static fromSolidityAddress(e){return isLongZeroAddress(decode$1(e))?new AccountId(...fromSolidityAddress(e)):this.fromEvmAddress(0,0,e)}toSolidityAddress(){return null!=this.evmAddress?this.evmAddress.toString():null!=this.aliasKey&&"secp256k1"==this.aliasKey._key._type?this.aliasKey.toEvmAddress():toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?toEvmAddress(this.evmAddress.toBytes()):toEvmAddress(this.num)}_toProtobuf(){let e=null;null!=this.aliasKey?e=libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null!=this.evmAddress&&(e=this.evmAddress._bytes);const t=this.num.eq(Long.fromBigInt(0n))&&e;return e?{alias:t?e:null,accountNum:t?null:this.num,shardNum:this.shard,realmNum:this.realm}:{alias:null,accountNum:this.num,shardNum:this.shard,realmNum:this.realm}}toBytes(){return libExports.proto.AccountID.encode(this._toProtobuf()).finish()}toString(){let e=this.num.toString();return null!=this.aliasKey?e=this.aliasKey.toString():null!=this.evmAddress&&(e=this.evmAddress.toString()),`${this.shard.toString()}.${this.realm.toString()}.${e}`}toStringWithChecksum(e){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");return toStringWithChecksum(this.toString(),e)}equals(e){let t=!1;return null!=this.aliasKey&&null!=e.aliasKey?t=this.aliasKey.equals(e.aliasKey):null!=this.evmAddress&&null!=e.evmAddress?t=this.evmAddress.equals(e.evmAddress):null==this.aliasKey&&null==e.aliasKey&&null==this.evmAddress&&null==e.evmAddress&&(t=this.num.eq(e.num)),this.shard.eq(e.shard)&&this.realm.eq(e.realm)&&t}clone(){const e=new AccountId(this);return e._checksum=this._checksum,e.aliasKey=this.aliasKey,e.evmAddress=this.evmAddress,e}compare(e){let t=this.shard.compare(e.shard);if(0!=t)return t;if(t=this.realm.compare(e.realm),0!=t)return t;if(null!=this.aliasKey&&null!=e.aliasKey){const t=this.aliasKey.toString(),n=e.aliasKey.toString();return t>n?1:t<n?-1:0}if(null!=this.evmAddress&&null!=e.evmAddress){const t=this.evmAddress.toString(),n=e.evmAddress.toString();return t>n?1:t<n?-1:0}return null==this.aliasKey&&null==e.aliasKey&&null==this.evmAddress&&null==e.evmAddress?this.num.compare(e.num):1}}CACHE.setAccountIdConstructor((e,t,n)=>new AccountId(e,t,Long.ZERO,n));const MAX_NS=Long.fromNumber(1e9),generatedIds=new Set;class Timestamp{constructor(e,t){this.seconds=e instanceof Long?e:Long.fromNumber(e),this.nanos=t instanceof Long?t:Long.fromNumber(t),Object.freeze(this)}static generate(e=!0){let t;t=e?Math.floor(5e3*Math.random())+3e3:0;const n=Date.now()-t,r=Math.floor(n/1e3)+CACHE.timeDrift,o=1e6*Math.floor(n%1e3)+Math.floor(1e6*Math.random()),a=new Timestamp(r,o);return generatedIds.has(a.toString())?this.generate():(generatedIds.add(a.toString()),a)}static fromDate(e){let t;if("number"==typeof e)t=Long.fromNumber(e);else if("string"==typeof e)t=Long.fromNumber(Date.parse(e)).mul(1e6);else{if(!(e instanceof Date))throw new TypeError(`invalid type '${typeof e}' for 'data', expected 'Date'`);t=Long.fromNumber(e.getTime()).mul(1e6)}return new Timestamp(0,0).plusNanos(t)}toDate(){return new Date(1e3*this.seconds.toNumber()+Math.floor(this.nanos.toInt()/1e6))}plusNanos(e){const t=this.nanos.add(e);return new Timestamp(this.seconds.add(t.div(MAX_NS)),t.mod(MAX_NS))}_toProtobuf(){return{seconds:this.seconds,nanos:this.nanos.toInt()}}static _fromProtobuf(e){return new Timestamp(e.seconds instanceof Long||null!=e.seconds?e.seconds:0,null!=e.nanos?e.nanos:0)}toString(){const e=String(this.nanos).padStart(9,"0");return`${this.seconds.toString()}.${e}`}compare(e){const t=this.seconds.compare(e.seconds);return 0!=t?t:this.nanos.compare(e.nanos)}}class TransactionId{constructor(e,t,n=!1,r=null){this.accountId=e,this.validStart=t,this.scheduled=n,this.nonce=null,null!=r&&0!=r&&this.setNonce(r),Object.seal(this)}setNonce(e){return this.nonce="number"==typeof e?Long.fromNumber(e):e,this}static withValidStart(e,t){return new TransactionId(e,t)}static generate(e){return new TransactionId("string"==typeof e?AccountId.fromString(e):new AccountId(e),Timestamp.generate())}static fromString(e){let t,n,r,o,a,i;return[t,i]=e.split("@"),[n,i]=i.split("."),i.includes("?")?([r,i]=i.split("?scheduled"),o=!0,a=i.includes("/")?i.replace("/",""):null):i.includes("/")?([r,a]=i.split("/"),o=!1):r=i,new TransactionId(AccountId.fromString(t),new Timestamp(Long.fromValue(n),Long.fromValue(r)),o,null!=a?Long.fromString(a):null)}setScheduled(e){return this.scheduled=e,this}toString(){if(null!=this.accountId&&null!=this.validStart){const e=String(this.validStart.nanos).padStart(9,"0"),t=null!=this.nonce?"/".concat(this.nonce.toString()):"",n=this.scheduled?"?scheduled":"";return`${this.accountId.toString()}@${this.validStart.seconds.toString()}.${e}${n}${t}`}throw new Error("neither `accountId` nor `validStart` are set")}static _fromProtobuf(e){if(null!=e.accountID&&null!=e.transactionValidStart)return new TransactionId(AccountId._fromProtobuf(e.accountID),Timestamp._fromProtobuf(e.transactionValidStart),null!=e.scheduled?e.scheduled:void 0,null!=e.nonce?e.nonce:void 0);throw new Error("Neither `nonce` or `accountID` and `transactionValidStart` are set")}_toProtobuf(){return{accountID:null!=this.accountId?this.accountId._toProtobuf():null,transactionValidStart:null!=this.validStart?this.validStart._toProtobuf():null,scheduled:this.scheduled,nonce:null!=this.nonce?this.nonce.toInt():null}}static fromBytes(e){return TransactionId._fromProtobuf(libExports.proto.TransactionID.decode(e))}toBytes(){return libExports.proto.TransactionID.encode(this._toProtobuf()).finish()}clone(){return new TransactionId(this.accountId,this.validStart,this.scheduled,this.nonce)}compare(e){const t=this.accountId.compare(e.accountId);return 0!=t?t:this.validStart.compare(e.validStart)}getReceipt(e){return CACHE.transactionReceiptQueryConstructor().setTransactionId(this).execute(e)}async getRecord(e){return await this.getReceipt(e),CACHE.transactionRecordQueryConstructor().setTransactionId(this).execute(e)}}class SignaturePairMap extends ObjectMap{constructor(){super(e=>PublicKey.fromString(e))}static _fromTransactionSigMap(e){const t=new SignaturePairMap,n=null!=e.sigPair?e.sigPair:[];for(const e of n)null!=e.pubKeyPrefix&&(null!=e.ed25519?t._set(PublicKey.fromBytesED25519(e.pubKeyPrefix),e.ed25519):null!=e.ECDSASecp256k1&&t._set(PublicKey.fromBytesECDSA(e.pubKeyPrefix),e.ECDSASecp256k1));return t}addSignature(e,t){return this._set(e,t),this}}let NodeAccountIdSignatureMap$1=class e extends ObjectMap{constructor(){super(e=>TransactionId.fromString(e))}static _fromSignedTransactions(t){const n=new e;for(const{bodyBytes:e,sigMap:r}of t.list)if(null!=e&&null!=r){const t=libExports.proto.TransactionBody.decode(e);if(null!=t.transactionID){const e=TransactionId._fromProtobuf(t.transactionID);n._set(e,SignaturePairMap._fromTransactionSigMap(r))}}return n}addSignature(e,t,n){const r=this.get(e);r?r.addSignature(t,n):this._set(e,(new SignaturePairMap).addSignature(t,n))}};class List{constructor(){this.list=[],this.locked=!1,this.index=0}setList(e){if(this.locked)throw new Error("list is locked");return this.list=e,this.index=0,this}push(...e){if(this.locked)throw new Error("list is locked");return this.list.push(...e),this}setLocked(){return this.locked=!0,this}clear(){this.list=[],this.index=0,this.locked=!1}get(e){return this.list[e]}set(e,t){return e===this.length?this.list.push(t):this.list[e]=t,this}setIfAbsent(e,t){return e!=this.length&&null!=this.list[e]||this.set(e,t()),this}get next(){return this.get(this.advance())}get current(){return this.get(this.index)}advance(){const e=this.index;return this.index=(this.index+1)%this.list.length,e}get isEmpty(){return 0===this.length}get length(){return this.list.length}clone(){const e=new List;return e.list=this.list,e.locked=this.locked,e}}let SignatureMap$1=class e extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromTransaction(t){const n=new e,r=t._nodeAccountIds.length,o=t._signedTransactions.length/r;for(let e=0;e<r;e++){const a=new List;for(let n=0;n<o;n++)a.push(t._signedTransactions.get(n*r+e));n._set(t._nodeAccountIds.list[e],NodeAccountIdSignatureMap$1._fromSignedTransactions(a))}return n}addSignature(e,t,n,r){let o=this.get(e);return o||(o=new NodeAccountIdSignatureMap$1,this._set(e,o)),o.addSignature(t,n,r),this._set(e,o),this}getFlatSignatureList(){const e=[];for(const t of this.values())for(const n of t.values())e.push(n);return e}};class ASN1Decoder{constructor(e){this.data=new Uint8Array(e),this.pos=0,this.oids=[],this.oidMap={"1.3.132.0.10":"ecdsa","1.3.101.112":"ed25519","1.2.840.10045.2.1":"pubkey"},this.isPublicKey=!1}readLength(){let e=this.data[this.pos++];if(128&e){let t=127&e;e=0;for(let n=0;n<t;n++)e=e<<8|this.data[this.pos++]}return e}readType(){return this.data[this.pos++]}readInteger(){const e=this.readLength();let t=0;for(let n=0;n<e;n++)t=t<<8|this.data[this.pos++];return{integer:t}}readOctetString(){const e=this.readLength(),t=this.data.slice(this.pos,this.pos+e);return this.pos+=e,{pkey:t}}readBitString(){const e=this.readLength(),t=this.data[this.pos++],n=this.data.slice(this.pos,this.pos+e-1);return this.pos+=e-1,{unusedBits:t,pubkey:n}}readObjectIdentifier(){const e=this.readLength(),t=this.pos+e,n=[];let r=0;const o=this.data[this.pos++];for(n.push(Math.floor(o/40)),n.push(o%40);this.pos<t;){const e=this.data[this.pos++];r=r<<7|127&e,128&e||(n.push(r),r=0)}const a=n.join(".");return this.oids.push(a),{oid:a}}getOids(){return this.oids}getOidKeyTypes(){return this.oids.map(e=>this.oidMap[e]||"unknown")}readSequence(){const e=this.readLength(),t=this.pos+e,n=[];for(;this.pos<t;)n.push(this.read());return n}read(){const e=this.readType();switch(e){case 2:return this.readInteger();case 3:return this.readBitString();case 4:return this.readOctetString();case 6:return this.readObjectIdentifier();case 48:case 160:case 161:return this.readSequence();default:throw new Error(`Unsupported type: ${e}`)}}isPublicKeyType(){return this.isPublicKey}}class PrivateKey extends Key{constructor(e){super(),this._key=e}static generateED25519(){return new PrivateKey(PrivateKey$1.generateED25519())}static generateECDSA(){return new PrivateKey(PrivateKey$1.generateECDSA())}static generate(){return PrivateKey.generateED25519()}static async generateAsync(){return new PrivateKey(await PrivateKey$1.generateAsync())}static async generateED25519Async(){return new PrivateKey(await PrivateKey$1.generateED25519Async())}static async generateECDSAAsync(){return new PrivateKey(await PrivateKey$1.generateECDSAAsync())}static fromBytes(e){const t=hexlify(e);return PrivateKey.isDerKey(t)?"ecdsa"===PrivateKey.getAlgorithm(t)?new PrivateKey(PrivateKey$1.fromBytesECDSA(e)):new PrivateKey(PrivateKey$1.fromBytesED25519(e)):new PrivateKey(PrivateKey$1.fromBytes(e))}static fromBytesECDSA(e){return new PrivateKey(PrivateKey$1.fromBytesECDSA(e))}static fromBytesED25519(e){return new PrivateKey(PrivateKey$1.fromBytesED25519(e))}static fromString(e){return PrivateKey.isDerKey(e)?this.fromStringDer(e):new PrivateKey(PrivateKey$1.fromString(e))}static fromStringDer(e){return PrivateKey.isDerKey(e)?"ecdsa"===PrivateKey.getAlgorithm(e)?this.fromStringECDSA(e):this.fromStringED25519(e):PrivateKey.fromString(e)}static fromStringECDSA(e){return new PrivateKey(PrivateKey$1.fromStringECDSA(e))}static fromStringED25519(e){return new PrivateKey(PrivateKey$1.fromStringED25519(e))}static async fromSeedED25519(e){return new PrivateKey(await PrivateKey$1.fromSeedED25519(e))}static async fromSeedECDSAsecp256k1(e){return new PrivateKey(await PrivateKey$1.fromSeedECDSAsecp256k1(e))}static async fromMnemonic(e,t=""){return new PrivateKey(e instanceof Mnemonic?await PrivateKey$1.fromMnemonic(e._mnemonic,t):await PrivateKey$1.fromMnemonic(e,t))}static async fromKeystore(e,t=""){return new PrivateKey(await PrivateKey$1.fromKeystore(e,t))}static async fromPem(e,t=""){return new PrivateKey(await PrivateKey$1.fromPem(e,t))}async derive(e){return new PrivateKey(await this._key.derive(e))}async legacyDerive(e){return new PrivateKey(await this._key.legacyDerive(e))}get publicKey(){return new PublicKey(this._key.publicKey)}get chainCode(){return this._key._chainCode}sign(e){return this._key.sign(e)}signTransaction(e,t=!1){if(t)return this._signTransactionLegacy(e);const n=new SignatureMap$1;for(const t of e._signedTransactions.list){const e=t.bodyBytes;if(!e)throw new Error("Body bytes are missing");const r=libExports.proto.TransactionBody.decode(e);if(!r.transactionID||!r.nodeAccountID)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const o=AccountId._fromProtobuf(r.nodeAccountID),a=TransactionId._fromProtobuf(r.transactionID),i=this._key.sign(e);n.addSignature(o,a,this.publicKey,i)}return e.addSignature(this.publicKey,n),n}_signTransactionLegacy(e){const t=e._signedTransactions.list.map(e=>{const t=e.bodyBytes;return t?this._key.sign(t):new Uint8Array});return e.addSignature(this.publicKey,t),1===t.length?t[0]:t}isDerivable(){return this._key.isDerivable()}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this._key.toStringDer()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}toKeystore(e=""){return this._key.toKeystore(e)}_toProtobufKey(){return this.publicKey._toProtobufKey()}toAccountId(e,t){return this.publicKey.toAccountId(e,t)}get type(){return this._key._type}getRecoveryId(e,t,n){return this._key.getRecoveryId(e,t,n)}static getAlgorithm(e){if(!PrivateKey.isDerKey(e))throw new Error("Only der keys are supported");const t=new ASN1Decoder(Uint8Array.from(decode$7(e)));t.read();return t.getOidKeyTypes()[0]}static isDerKey(e){try{const t=Uint8Array.from(decode$7(e));return new ASN1Decoder(t).read(),!0}catch(e){return!1}}}CACHE.setPrivateKeyConstructor(e=>new PrivateKey(e));class KeyList extends Key{constructor(e,t){super(),this._keys=null==e?[]:e instanceof Key?[e]:e,this._threshold=null==t?null:t}static of(...e){return new KeyList(e,null)}static from(e,t,n){return new KeyList(null==t?Array.from(e):Array.from(e,t,n))}get threshold(){return this._threshold}setThreshold(e){return this._threshold=e,this}push(...e){return this._keys.push(...e)}splice(e,t,...n){return new KeyList(this._keys.splice(e,t,...n),this.threshold)}slice(e,t){return new KeyList(this._keys.slice(e,t),this.threshold)}[Symbol.iterator](){return this._keys[Symbol.iterator]()}toArray(){return this._keys.slice()}toString(){return JSON.stringify({threshold:this._threshold,keys:this._keys.toString()})}_toProtobufKey(){const e=this._keys.map(e=>e._toProtobufKey());return null==this.threshold?{keyList:{keys:e}}:{thresholdKey:{threshold:this.threshold,keys:{keys:e}}}}static __fromProtobufKeyList(e){const t=(null!=e.keys?e.keys:[]).map(e=>Key._fromProtobufKey(e));return new KeyList(t)}static __fromProtobufThresoldKey(e){const t=KeyList.__fromProtobufKeyList(null!=e.keys?e.keys:{});return t.setThreshold(null!=e.threshold?e.threshold:0),t}}function valueToLong(e){return BigNumber.isBigNumber(e)?e:new BigNumber(e.toString())}CACHE.setKeyList(e=>KeyList.__fromProtobufKeyList(e)),CACHE.setThresholdKey(e=>KeyList.__fromProtobufThresoldKey(e));class HbarUnit{constructor(e,t,n){this._name=e,this._symbol=t,this._tinybar=n,Object.freeze(this)}static fromString(e){switch(e){case HbarUnit.Hbar._symbol:return HbarUnit.Hbar;case HbarUnit.Tinybar._symbol:return HbarUnit.Tinybar;case HbarUnit.Microbar._symbol:return HbarUnit.Microbar;case HbarUnit.Millibar._symbol:return HbarUnit.Millibar;case HbarUnit.Kilobar._symbol:return HbarUnit.Kilobar;case HbarUnit.Megabar._symbol:return HbarUnit.Megabar;case HbarUnit.Gigabar._symbol:return HbarUnit.Gigabar;default:throw new Error("Unknown unit.")}}}HbarUnit.Tinybar=new HbarUnit("tinybar","tℏ",new BigNumber(1)),HbarUnit.Microbar=new HbarUnit("microbar","μℏ",new BigNumber(100)),HbarUnit.Millibar=new HbarUnit("millibar","mℏ",new BigNumber(1e5)),HbarUnit.Hbar=new HbarUnit("hbar","ℏ",new BigNumber("100000000")),HbarUnit.Kilobar=new HbarUnit("kilobar","kℏ",new BigNumber(1e3).multipliedBy(new BigNumber("100000000"))),HbarUnit.Megabar=new HbarUnit("megabar","Mℏ",new BigNumber(1e6).multipliedBy(new BigNumber("100000000"))),HbarUnit.Gigabar=new HbarUnit("gigabar","Gℏ",new BigNumber("1000000000").multipliedBy(new BigNumber("100000000")));class Hbar{constructor(e,t=HbarUnit.Hbar){if(t===HbarUnit.Tinybar)this._valueInTinybar=valueToLong(e);else{let n;n=Long.isLong(e)?new BigNumber(e.toString(10)):BigNumber.isBigNumber(e)||"string"==typeof e||"number"==typeof e?new BigNumber(e):new BigNumber(0),this._valueInTinybar=n.multipliedBy(t._tinybar)}if(!this._valueInTinybar.isInteger())throw new Error("Hbar in tinybars contains decimals")}static from(e,t){return new Hbar(e,t)}static fromTinybars(e){return"string"==typeof e?this.fromString(e,HbarUnit.Tinybar):new Hbar(e,HbarUnit.Tinybar)}static fromString(e,t=HbarUnit.Hbar){if(/^((?:\+|-)?\d+(?:\.\d+)?)(?: (tℏ|μℏ|mℏ|ℏ|kℏ|Mℏ|Gℏ))?$/.test(e)){let[n,r]=e.split(" ");return null!=r&&(t=HbarUnit.fromString(r)),new Hbar(new BigNumber(n),t)}throw new Error("invalid argument provided")}to(e){return this._valueInTinybar.dividedBy(e._tinybar)}toBigNumber(){return this.to(HbarUnit.Hbar)}toTinybars(){return Long.fromValue(this._valueInTinybar.toFixed())}negated(){return Hbar.fromTinybars(this._valueInTinybar.negated())}isNegative(){return this._valueInTinybar.isNegative()}toString(e){return null!=e?`${this._valueInTinybar.dividedBy(e._tinybar).toString()} ${e._symbol}`:this._valueInTinybar.isLessThan(1e4)&&this._valueInTinybar.isGreaterThan(-1e4)?`${this._valueInTinybar.toFixed()} ${HbarUnit.Tinybar._symbol}`:`${this.to(HbarUnit.Hbar).toString()} ${HbarUnit.Hbar._symbol}`}}class StatusError extends Error{constructor(e,t){super(t),this.name="StatusError",this.status=e.status,this.transactionId=e.transactionId,this.message=t,void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,StatusError)}toJSON(){return{name:this.name,status:this.status.toString(),transactionId:this.transactionId.toString(),message:this.message}}toString(){return JSON.stringify(this.toJSON())}valueOf(){return this.toJSON()}}class ReceiptStatusError extends StatusError{constructor(e){super(e,`receipt for transaction ${e.transactionId.toString()} contained error status ${e.status.toString()}`),this.transactionReceipt=e.transactionReceipt}}class Status{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case Status.Ok:return"OK";case Status.InvalidTransaction:return"INVALID_TRANSACTION";case Status.PayerAccountNotFound:return"PAYER_ACCOUNT_NOT_FOUND";case Status.InvalidNodeAccount:return"INVALID_NODE_ACCOUNT";case Status.TransactionExpired:return"TRANSACTION_EXPIRED";case Status.InvalidTransactionStart:return"INVALID_TRANSACTION_START";case Status.InvalidTransactionDuration:return"INVALID_TRANSACTION_DURATION";case Status.InvalidSignature:return"INVALID_SIGNATURE";case Status.MemoTooLong:return"MEMO_TOO_LONG";case Status.InsufficientTxFee:return"INSUFFICIENT_TX_FEE";case Status.InsufficientPayerBalance:return"INSUFFICIENT_PAYER_BALANCE";case Status.DuplicateTransaction:return"DUPLICATE_TRANSACTION";case Status.Busy:return"BUSY";case Status.NotSupported:return"NOT_SUPPORTED";case Status.InvalidFileId:return"INVALID_FILE_ID";case Status.InvalidAccountId:return"INVALID_ACCOUNT_ID";case Status.InvalidContractId:return"INVALID_CONTRACT_ID";case Status.InvalidTransactionId:return"INVALID_TRANSACTION_ID";case Status.ReceiptNotFound:return"RECEIPT_NOT_FOUND";case Status.RecordNotFound:return"RECORD_NOT_FOUND";case Status.InvalidSolidityId:return"INVALID_SOLIDITY_ID";case Status.Unknown:return"UNKNOWN";case Status.Success:return"SUCCESS";case Status.FailInvalid:return"FAIL_INVALID";case Status.FailFee:return"FAIL_FEE";case Status.FailBalance:return"FAIL_BALANCE";case Status.KeyRequired:return"KEY_REQUIRED";case Status.BadEncoding:return"BAD_ENCODING";case Status.InsufficientAccountBalance:return"INSUFFICIENT_ACCOUNT_BALANCE";case Status.InvalidSolidityAddress:return"INVALID_SOLIDITY_ADDRESS";case Status.InsufficientGas:return"INSUFFICIENT_GAS";case Status.ContractSizeLimitExceeded:return"CONTRACT_SIZE_LIMIT_EXCEEDED";case Status.LocalCallModificationException:return"LOCAL_CALL_MODIFICATION_EXCEPTION";case Status.ContractRevertExecuted:return"CONTRACT_REVERT_EXECUTED";case Status.ContractExecutionException:return"CONTRACT_EXECUTION_EXCEPTION";case Status.InvalidReceivingNodeAccount:return"INVALID_RECEIVING_NODE_ACCOUNT";case Status.MissingQueryHeader:return"MISSING_QUERY_HEADER";case Status.AccountUpdateFailed:return"ACCOUNT_UPDATE_FAILED";case Status.InvalidKeyEncoding:return"INVALID_KEY_ENCODING";case Status.NullSolidityAddress:return"NULL_SOLIDITY_ADDRESS";case Status.ContractUpdateFailed:return"CONTRACT_UPDATE_FAILED";case Status.InvalidQueryHeader:return"INVALID_QUERY_HEADER";case Status.InvalidFeeSubmitted:return"INVALID_FEE_SUBMITTED";case Status.InvalidPayerSignature:return"INVALID_PAYER_SIGNATURE";case Status.KeyNotProvided:return"KEY_NOT_PROVIDED";case Status.InvalidExpirationTime:return"INVALID_EXPIRATION_TIME";case Status.NoWaclKey:return"NO_WACL_KEY";case Status.FileContentEmpty:return"FILE_CONTENT_EMPTY";case Status.InvalidAccountAmounts:return"INVALID_ACCOUNT_AMOUNTS";case Status.EmptyTransactionBody:return"EMPTY_TRANSACTION_BODY";case Status.InvalidTransactionBody:return"INVALID_TRANSACTION_BODY";case Status.InvalidSignatureTypeMismatchingKey:return"INVALID_SIGNATURE_TYPE_MISMATCHING_KEY";case Status.InvalidSignatureCountMismatchingKey:return"INVALID_SIGNATURE_COUNT_MISMATCHING_KEY";case Status.EmptyLiveHashBody:return"EMPTY_LIVE_HASH_BODY";case Status.EmptyLiveHash:return"EMPTY_LIVE_HASH";case Status.EmptyLiveHashKeys:return"EMPTY_LIVE_HASH_KEYS";case Status.InvalidLiveHashSize:return"INVALID_LIVE_HASH_SIZE";case Status.EmptyQueryBody:return"EMPTY_QUERY_BODY";case Status.EmptyLiveHashQuery:return"EMPTY_LIVE_HASH_QUERY";case Status.LiveHashNotFound:return"LIVE_HASH_NOT_FOUND";case Status.AccountIdDoesNotExist:return"ACCOUNT_ID_DOES_NOT_EXIST";case Status.LiveHashAlreadyExists:return"LIVE_HASH_ALREADY_EXISTS";case Status.InvalidFileWacl:return"INVALID_FILE_WACL";case Status.SerializationFailed:return"SERIALIZATION_FAILED";case Status.TransactionOversize:return"TRANSACTION_OVERSIZE";case Status.TransactionTooManyLayers:return"TRANSACTION_TOO_MANY_LAYERS";case Status.ContractDeleted:return"CONTRACT_DELETED";case Status.PlatformNotActive:return"PLATFORM_NOT_ACTIVE";case Status.KeyPrefixMismatch:return"KEY_PREFIX_MISMATCH";case Status.PlatformTransactionNotCreated:return"PLATFORM_TRANSACTION_NOT_CREATED";case Status.InvalidRenewalPeriod:return"INVALID_RENEWAL_PERIOD";case Status.InvalidPayerAccountId:return"INVALID_PAYER_ACCOUNT_ID";case Status.AccountDeleted:return"ACCOUNT_DELETED";case Status.FileDeleted:return"FILE_DELETED";case Status.AccountRepeatedInAccountAmounts:return"ACCOUNT_REPEATED_IN_ACCOUNT_AMOUNTS";case Status.SettingNegativeAccountBalance:return"SETTING_NEGATIVE_ACCOUNT_BALANCE";case Status.ObtainerRequired:return"OBTAINER_REQUIRED";case Status.ObtainerSameContractId:return"OBTAINER_SAME_CONTRACT_ID";case Status.ObtainerDoesNotExist:return"OBTAINER_DOES_NOT_EXIST";case Status.ModifyingImmutableContract:return"MODIFYING_IMMUTABLE_CONTRACT";case Status.FileSystemException:return"FILE_SYSTEM_EXCEPTION";case Status.AutorenewDurationNotInRange:return"AUTORENEW_DURATION_NOT_IN_RANGE";case Status.ErrorDecodingBytestring:return"ERROR_DECODING_BYTESTRING";case Status.ContractFileEmpty:return"CONTRACT_FILE_EMPTY";case Status.ContractBytecodeEmpty:return"CONTRACT_BYTECODE_EMPTY";case Status.InvalidInitialBalance:return"INVALID_INITIAL_BALANCE";case Status.InvalidReceiveRecordThreshold:return"INVALID_RECEIVE_RECORD_THRESHOLD";case Status.InvalidSendRecordThreshold:return"INVALID_SEND_RECORD_THRESHOLD";case Status.AccountIsNotGenesisAccount:return"ACCOUNT_IS_NOT_GENESIS_ACCOUNT";case Status.PayerAccountUnauthorized:return"PAYER_ACCOUNT_UNAUTHORIZED";case Status.InvalidFreezeTransactionBody:return"INVALID_FREEZE_TRANSACTION_BODY";case Status.FreezeTransactionBodyNotFound:return"FREEZE_TRANSACTION_BODY_NOT_FOUND";case Status.TransferListSizeLimitExceeded:return"TRANSFER_LIST_SIZE_LIMIT_EXCEEDED";case Status.ResultSizeLimitExceeded:return"RESULT_SIZE_LIMIT_EXCEEDED";case Status.NotSpecialAccount:return"NOT_SPECIAL_ACCOUNT";case Status.ContractNegativeGas:return"CONTRACT_NEGATIVE_GAS";case Status.ContractNegativeValue:return"CONTRACT_NEGATIVE_VALUE";case Status.InvalidFeeFile:return"INVALID_FEE_FILE";case Status.InvalidExchangeRateFile:return"INVALID_EXCHANGE_RATE_FILE";case Status.InsufficientLocalCallGas:return"INSUFFICIENT_LOCAL_CALL_GAS";case Status.EntityNotAllowedToDelete:return"ENTITY_NOT_ALLOWED_TO_DELETE";case Status.AuthorizationFailed:return"AUTHORIZATION_FAILED";case Status.FileUploadedProtoInvalid:return"FILE_UPLOADED_PROTO_INVALID";case Status.FileUploadedProtoNotSavedToDisk:return"FILE_UPLOADED_PROTO_NOT_SAVED_TO_DISK";case Status.FeeScheduleFilePartUploaded:return"FEE_SCHEDULE_FILE_PART_UPLOADED";case Status.ExchangeRateChangeLimitExceeded:return"EXCHANGE_RATE_CHANGE_LIMIT_EXCEEDED";case Status.MaxContractStorageExceeded:return"MAX_CONTRACT_STORAGE_EXCEEDED";case Status.TransferAccountSameAsDeleteAccount:return"TRANSFER_ACCOUNT_SAME_AS_DELETE_ACCOUNT";case Status.TotalLedgerBalanceInvalid:return"TOTAL_LEDGER_BALANCE_INVALID";case Status.ExpirationReductionNotAllowed:return"EXPIRATION_REDUCTION_NOT_ALLOWED";case Status.MaxGasLimitExceeded:return"MAX_GAS_LIMIT_EXCEEDED";case Status.MaxFileSizeExceeded:return"MAX_FILE_SIZE_EXCEEDED";case Status.ReceiverSigRequired:return"RECEIVER_SIG_REQUIRED";case Status.InvalidTopicId:return"INVALID_TOPIC_ID";case Status.InvalidAdminKey:return"INVALID_ADMIN_KEY";case Status.InvalidSubmitKey:return"INVALID_SUBMIT_KEY";case Status.Unauthorized:return"UNAUTHORIZED";case Status.InvalidTopicMessage:return"INVALID_TOPIC_MESSAGE";case Status.InvalidAutorenewAccount:return"INVALID_AUTORENEW_ACCOUNT";case Status.AutorenewAccountNotAllowed:return"AUTORENEW_ACCOUNT_NOT_ALLOWED";case Status.TopicExpired:return"TOPIC_EXPIRED";case Status.InvalidChunkNumber:return"INVALID_CHUNK_NUMBER";case Status.InvalidChunkTransactionId:return"INVALID_CHUNK_TRANSACTION_ID";case Status.AccountFrozenForToken:return"ACCOUNT_FROZEN_FOR_TOKEN";case Status.TokensPerAccountLimitExceeded:return"TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED";case Status.InvalidTokenId:return"INVALID_TOKEN_ID";case Status.InvalidTokenDecimals:return"INVALID_TOKEN_DECIMALS";case Status.InvalidTokenInitialSupply:return"INVALID_TOKEN_INITIAL_SUPPLY";case Status.InvalidTreasuryAccountForToken:return"INVALID_TREASURY_ACCOUNT_FOR_TOKEN";case Status.InvalidTokenSymbol:return"INVALID_TOKEN_SYMBOL";case Status.TokenHasNoFreezeKey:return"TOKEN_HAS_NO_FREEZE_KEY";case Status.TransfersNotZeroSumForToken:return"TRANSFERS_NOT_ZERO_SUM_FOR_TOKEN";case Status.MissingTokenSymbol:return"MISSING_TOKEN_SYMBOL";case Status.TokenSymbolTooLong:return"TOKEN_SYMBOL_TOO_LONG";case Status.AccountKycNotGrantedForToken:return"ACCOUNT_KYC_NOT_GRANTED_FOR_TOKEN";case Status.TokenHasNoKycKey:return"TOKEN_HAS_NO_KYC_KEY";case Status.InsufficientTokenBalance:return"INSUFFICIENT_TOKEN_BALANCE";case Status.TokenWasDeleted:return"TOKEN_WAS_DELETED";case Status.TokenHasNoSupplyKey:return"TOKEN_HAS_NO_SUPPLY_KEY";case Status.TokenHasNoWipeKey:return"TOKEN_HAS_NO_WIPE_KEY";case Status.InvalidTokenMintAmount:return"INVALID_TOKEN_MINT_AMOUNT";case Status.InvalidTokenBurnAmount:return"INVALID_TOKEN_BURN_AMOUNT";case Status.TokenNotAssociatedToAccount:return"TOKEN_NOT_ASSOCIATED_TO_ACCOUNT";case Status.CannotWipeTokenTreasuryAccount:return"CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT";case Status.InvalidKycKey:return"INVALID_KYC_KEY";case Status.InvalidWipeKey:return"INVALID_WIPE_KEY";case Status.InvalidFreezeKey:return"INVALID_FREEZE_KEY";case Status.InvalidSupplyKey:return"INVALID_SUPPLY_KEY";case Status.MissingTokenName:return"MISSING_TOKEN_NAME";case Status.TokenNameTooLong:return"TOKEN_NAME_TOO_LONG";case Status.InvalidWipingAmount:return"INVALID_WIPING_AMOUNT";case Status.TokenIsImmutable:return"TOKEN_IS_IMMUTABLE";case Status.TokenAlreadyAssociatedToAccount:return"TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT";case Status.TransactionRequiresZeroTokenBalances:return"TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES";case Status.AccountIsTreasury:return"ACCOUNT_IS_TREASURY";case Status.TokenIdRepeatedInTokenList:return"TOKEN_ID_REPEATED_IN_TOKEN_LIST";case Status.TokenTransferListSizeLimitExceeded:return"TOKEN_TRANSFER_LIST_SIZE_LIMIT_EXCEEDED";case Status.EmptyTokenTransferBody:return"EMPTY_TOKEN_TRANSFER_BODY";case Status.EmptyTokenTransferAccountAmounts:return"EMPTY_TOKEN_TRANSFER_ACCOUNT_AMOUNTS";case Status.InvalidScheduleId:return"INVALID_SCHEDULE_ID";case Status.ScheduleIsImmutable:return"SCHEDULE_IS_IMMUTABLE";case Status.InvalidSchedulePayerId:return"INVALID_SCHEDULE_PAYER_ID";case Status.InvalidScheduleAccountId:return"INVALID_SCHEDULE_ACCOUNT_ID";case Status.NoNewValidSignatures:return"NO_NEW_VALID_SIGNATURES";case Status.UnresolvableRequiredSigners:return"UNRESOLVABLE_REQUIRED_SIGNERS";case Status.ScheduledTransactionNotInWhitelist:return"SCHEDULED_TRANSACTION_NOT_IN_WHITELIST";case Status.SomeSignaturesWereInvalid:return"SOME_SIGNATURES_WERE_INVALID";case Status.TransactionIdFieldNotAllowed:return"TRANSACTION_ID_FIELD_NOT_ALLOWED";case Status.IdenticalScheduleAlreadyCreated:return"IDENTICAL_SCHEDULE_ALREADY_CREATED";case Status.InvalidZeroByteInString:return"INVALID_ZERO_BYTE_IN_STRING";case Status.ScheduleAlreadyDeleted:return"SCHEDULE_ALREADY_DELETED";case Status.ScheduleAlreadyExecuted:return"SCHEDULE_ALREADY_EXECUTED";case Status.MessageSizeTooLarge:return"MESSAGE_SIZE_TOO_LARGE";case Status.OperationRepeatedInBucketGroups:return"OPERATION_REPEATED_IN_BUCKET_GROUPS";case Status.BucketCapacityOverflow:return"BUCKET_CAPACITY_OVERFLOW";case Status.NodeCapacityNotSufficientForOperation:return"NODE_CAPACITY_NOT_SUFFICIENT_FOR_OPERATION";case Status.BucketHasNoThrottleGroups:return"BUCKET_HAS_NO_THROTTLE_GROUPS";case Status.ThrottleGroupHasZeroOpsPerSec:return"THROTTLE_GROUP_HAS_ZERO_OPS_PER_SEC";case Status.SuccessButMissingExpectedOperation:return"SUCCESS_BUT_MISSING_EXPECTED_OPERATION";case Status.UnparseableThrottleDefinitions:return"UNPARSEABLE_THROTTLE_DEFINITIONS";case Status.InvalidThrottleDefinitions:return"INVALID_THROTTLE_DEFINITIONS";case Status.AccountExpiredAndPendingRemoval:return"ACCOUNT_EXPIRED_AND_PENDING_REMOVAL";case Status.InvalidTokenMaxSupply:return"INVALID_TOKEN_MAX_SUPPLY";case Status.InvalidTokenNftSerialNumber:return"INVALID_TOKEN_NFT_SERIAL_NUMBER";case Status.InvalidNftId:return"INVALID_NFT_ID";case Status.MetadataTooLong:return"METADATA_TOO_LONG";case Status.BatchSizeLimitExceeded:return"BATCH_SIZE_LIMIT_EXCEEDED";case Status.InvalidQueryRange:return"INVALID_QUERY_RANGE";case Status.FractionDividesByZero:return"FRACTION_DIVIDES_BY_ZERO";case Status.InsufficientPayerBalanceForCustomFee:return"INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE";case Status.CustomFeesListTooLong:return"CUSTOM_FEES_LIST_TOO_LONG";case Status.InvalidCustomFeeCollector:return"INVALID_CUSTOM_FEE_COLLECTOR";case Status.InvalidTokenIdInCustomFees:return"INVALID_TOKEN_ID_IN_CUSTOM_FEES";case Status.TokenNotAssociatedToFeeCollector:return"TOKEN_NOT_ASSOCIATED_TO_FEE_COLLECTOR";case Status.TokenMaxSupplyReached:return"TOKEN_MAX_SUPPLY_REACHED";case Status.SenderDoesNotOwnNftSerialNo:return"SENDER_DOES_NOT_OWN_NFT_SERIAL_NO";case Status.CustomFeeNotFullySpecified:return"CUSTOM_FEE_NOT_FULLY_SPECIFIED";case Status.CustomFeeMustBePositive:return"CUSTOM_FEE_MUST_BE_POSITIVE";case Status.TokenHasNoFeeScheduleKey:return"TOKEN_HAS_NO_FEE_SCHEDULE_KEY";case Status.CustomFeeOutsideNumericRange:return"CUSTOM_FEE_OUTSIDE_NUMERIC_RANGE";case Status.RoyaltyFractionCannotExceedOne:return"ROYALTY_FRACTION_CANNOT_EXCEED_ONE";case Status.FractionalFeeMaxAmountLessThanMinAmount:return"FRACTIONAL_FEE_MAX_AMOUNT_LESS_THAN_MIN_AMOUNT";case Status.CustomScheduleAlreadyHasNoFees:return"CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES";case Status.CustomFeeDenominationMustBeFungibleCommon:return"CUSTOM_FEE_DENOMINATION_MUST_BE_FUNGIBLE_COMMON";case Status.CustomFractionalFeeOnlyAllowedForFungibleCommon:return"CUSTOM_FRACTIONAL_FEE_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON";case Status.InvalidCustomFeeScheduleKey:return"INVALID_CUSTOM_FEE_SCHEDULE_KEY";case Status.InvalidTokenMintMetadata:return"INVALID_TOKEN_MINT_METADATA";case Status.InvalidTokenBurnMetadata:return"INVALID_TOKEN_BURN_METADATA";case Status.CurrentTreasuryStillOwnsNfts:return"CURRENT_TREASURY_STILL_OWNS_NFTS";case Status.AccountStillOwnsNfts:return"ACCOUNT_STILL_OWNS_NFTS";case Status.TreasuryMustOwnBurnedNft:return"TREASURY_MUST_OWN_BURNED_NFT";case Status.AccountDoesNotOwnWipedNft:return"ACCOUNT_DOES_NOT_OWN_WIPED_NFT";case Status.AccountAmountTransfersOnlyAllowedForFungibleCommon:return"ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON";case Status.MaxNftsInPriceRegimeHaveBeenMinted:return"MAX_NFTS_IN_PRICE_REGIME_HAVE_BEEN_MINTED";case Status.PayerAccountDeleted:return"PAYER_ACCOUNT_DELETED";case Status.CustomFeeChargingExceededMaxRecursionDepth:return"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_RECURSION_DEPTH";case Status.CustomFeeChargingExceededMaxAccountAmounts:return"CUSTOM_FEE_CHARGING_EXCEEDED_MAX_ACCOUNT_AMOUNTS";case Status.InsufficientSenderAccountBalanceForCustomFee:return"INSUFFICIENT_SENDER_ACCOUNT_BALANCE_FOR_CUSTOM_FEE";case Status.SerialNumberLimitReached:return"SERIAL_NUMBER_LIMIT_REACHED";case Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique:return"CUSTOM_ROYALTY_FEE_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE";case Status.NoRemainingAutomaticAssociations:return"NO_REMAINING_AUTOMATIC_ASSOCIATIONS";case Status.ExistingAutomaticAssociationsExceedGivenLimit:return"EXISTING_AUTOMATIC_ASSOCIATIONS_EXCEED_GIVEN_LIMIT";case Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit:return"REQUESTED_NUM_AUTOMATIC_ASSOCIATIONS_EXCEEDS_ASSOCIATION_LIMIT";case Status.TokenIsPaused:return"TOKEN_IS_PAUSED";case Status.TokenHasNoPauseKey:return"TOKEN_HAS_NO_PAUSE_KEY";case Status.InvalidPauseKey:return"INVALID_PAUSE_KEY";case Status.FreezeUpdateFileDoesNotExist:return"FREEZE_UPDATE_FILE_DOES_NOT_EXIST";case Status.FreezeUpdateFileHashDoesNotMatch:return"FREEZE_UPDATE_FILE_HASH_DOES_NOT_MATCH";case Status.NoUpgradeHasBeenPrepared:return"NO_UPGRADE_HAS_BEEN_PREPARED";case Status.NoFreezeIsScheduled:return"NO_FREEZE_IS_SCHEDULED";case Status.UpdateFileHashChangedSincePrepareUpgrade:return"UPDATE_FILE_HASH_CHANGED_SINCE_PREPARE_UPGRADE";case Status.FreezeStartTimeMustBeFuture:return"FREEZE_START_TIME_MUST_BE_FUTURE";case Status.PreparedUpdateFileIsImmutable:return"PREPARED_UPDATE_FILE_IS_IMMUTABLE";case Status.FreezeAlreadyScheduled:return"FREEZE_ALREADY_SCHEDULED";case Status.FreezeUpgradeInProgress:return"FREEZE_UPGRADE_IN_PROGRESS";case Status.UpdateFileIdDoesNotMatchPrepared:return"UPDATE_FILE_ID_DOES_NOT_MATCH_PREPARED";case Status.UpdateFileHashDoesNotMatchPrepared:return"UPDATE_FILE_HASH_DOES_NOT_MATCH_PREPARED";case Status.ConsensusGasExhausted:return"CONSENSUS_GAS_EXHAUSTED";case Status.RevertedSuccess:return"REVERTED_SUCCESS";case Status.MaxStorageInPriceRegimeHasBeenUsed:return"MAX_STORAGE_IN_PRICE_REGIME_HAS_BEEN_USED";case Status.InvalidAliasKey:return"INVALID_ALIAS_KEY";case Status.UnexpectedTokenDecimals:return"UNEXPECTED_TOKEN_DECIMALS";case Status.InvalidProxyAccountId:return"INVALID_PROXY_ACCOUNT_ID";case Status.InvalidTransferAccountId:return"INVALID_TRANSFER_ACCOUNT_ID";case Status.InvalidFeeCollectorAccountId:return"INVALID_FEE_COLLECTOR_ACCOUNT_ID";case Status.AliasIsImmutable:return"ALIAS_IS_IMMUTABLE";case Status.SpenderAccountSameAsOwner:return"SPENDER_ACCOUNT_SAME_AS_OWNER";case Status.AmountExceedsTokenMaxSupply:return"AMOUNT_EXCEEDS_TOKEN_MAX_SUPPLY";case Status.NegativeAllowanceAmount:return"NEGATIVE_ALLOWANCE_AMOUNT";case Status.CannotApproveForAllFungibleCommon:return"CANNOT_APPROVE_FOR_ALL_FUNGIBLE_COMMON";case Status.SpenderDoesNotHaveAllowance:return"SPENDER_DOES_NOT_HAVE_ALLOWANCE";case Status.AmountExceedsAllowance:return"AMOUNT_EXCEEDS_ALLOWANCE";case Status.MaxAllowancesExceeded:return"MAX_ALLOWANCES_EXCEEDED";case Status.EmptyAllowances:return"EMPTY_ALLOWANCES";case Status.SpenderAccountRepeatedInAllowances:return"SPENDER_ACCOUNT_REPEATED_IN_ALLOWANCES";case Status.RepeatedSerialNumsInNftAllowances:return"REPEATED_SERIAL_NUMS_IN_NFT_ALLOWANCES";case Status.FungibleTokenInNftAllowances:return"FUNGIBLE_TOKEN_IN_NFT_ALLOWANCES";case Status.NftInFungibleTokenAllowances:return"NFT_IN_FUNGIBLE_TOKEN_ALLOWANCES";case Status.InvalidAllowanceOwnerId:return"INVALID_ALLOWANCE_OWNER_ID";case Status.InvalidAllowanceSpenderId:return"INVALID_ALLOWANCE_SPENDER_ID";case Status.RepeatedAllowancesToDelete:return"REPEATED_ALLOWANCES_TO_DELETE";case Status.InvalidDelegatingSpender:return"INVALID_DELEGATING_SPENDER";case Status.DelegatingSpenderCannotGrantApproveForAll:return"DELEGATING_SPENDER_CANNOT_GRANT_APPROVE_FOR_ALL";case Status.DelegatingSpenderDoesNotHaveApproveForAll:return"DELEGATING_SPENDER_DOES_NOT_HAVE_APPROVE_FOR_ALL";case Status.ScheduleExpirationTimeTooFarInFuture:return"SCHEDULE_EXPIRATION_TIME_TOO_FAR_IN_FUTURE";case Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime:return"SCHEDULE_EXPIRATION_TIME_MUST_BE_HIGHER_THAN_CONSENSUS_TIME";case Status.ScheduleFutureThrottleExceeded:return"SCHEDULE_FUTURE_THROTTLE_EXCEEDED";case Status.ScheduleFutureGasLimitExceeded:return"SCHEDULE_FUTURE_GAS_LIMIT_EXCEEDED";case Status.InvalidEthereumTransaction:return"INVALID_ETHEREUM_TRANSACTION";case Status.WrongChainId:return"WRONG_CHAIN_ID";case Status.WrongNonce:return"WRONG_NONCE";case Status.AccessListUnsupported:return"ACCESS_LIST_UNSUPPORTED";case Status.SchedulePendingExpiration:return"SCHEDULE_PENDING_EXPIRATION";case Status.ContractIsTokenTreasury:return"CONTRACT_IS_TOKEN_TREASURY";case Status.ContractHasNonZeroTokenBalances:return"CONTRACT_HAS_NON_ZERO_TOKEN_BALANCES";case Status.ContractExpiredAndPendingRemoval:return"CONTRACT_EXPIRED_AND_PENDING_REMOVAL";case Status.ContractHasNoAutoRenewAccount:return"CONTRACT_HAS_NO_AUTO_RENEW_ACCOUNT";case Status.PermanentRemovalRequiresSystemInitiation:return"PERMANENT_REMOVAL_REQUIRES_SYSTEM_INITIATION";case Status.ProxyAccountIdFieldIsDeprecated:return"PROXY_ACCOUNT_ID_FIELD_IS_DEPRECATED";case Status.SelfStakingIsNotAllowed:return"SELF_STAKING_IS_NOT_ALLOWED";case Status.InvalidStakingId:return"INVALID_STAKING_ID";case Status.StakingNotEnabled:return"STAKING_NOT_ENABLED";case Status.InvalidPrngRange:return"INVALID_PRNG_RANGE";case Status.MaxEntitiesInPriceRegimeHaveBeenCreated:return"MAX_ENTITIES_IN_PRICE_REGIME_HAVE_BEEN_CREATED";case Status.InvalidFullPrefixSignatureForPrecompile:return"INVALID_FULL_PREFIX_SIGNATURE_FOR_PRECOMPILE";case Status.InsufficientBalancesForStorageRent:return"INSUFFICIENT_BALANCES_FOR_STORAGE_RENT";case Status.MaxChildRecordsExceeded:return"MAX_CHILD_RECORDS_EXCEEDED";case Status.InsufficientBalancesForRenewalFees:return"INSUFFICIENT_BALANCES_FOR_RENEWAL_FEES";case Status.TransactionHasUnknownFields:return"TRANSACTION_HAS_UNKNOWN_FIELDS";case Status.AccountIsImmutable:return"ACCOUNT_IS_IMMUTABLE";case Status.AliasAlreadyAssigned:return"ALIAS_ALREADY_ASSIGNED";case Status.InvalidMetadataKey:return"INVALID_METADATA_KEY";case Status.TokenHasNoMetadataKey:return"TOKEN_HAS_NO_METADATA_KEY";case Status.MissingTokenMetadata:return"MISSING_TOKEN_METADATA";case Status.MissingSerialNumbers:return"MISSING_SERIAL_NUMBERS";case Status.TokenHasNoAdminKey:return"TOKEN_HAS_NO_ADMIN_KEY";case Status.NodeDeleted:return"NODE_DELETED";case Status.InvalidNodeId:return"INVALID_NODE_ID";case Status.InvalidGossipEndpoint:return"INVALID_GOSSIP_ENDPOINT";case Status.InvalidNodeAccountId:return"INVALID_NODE_ACCOUNT_ID";case Status.InvalidNodeDescription:return"INVALID_NODE_DESCRIPTION";case Status.InvalidServiceEndpoint:return"INVALID_SERVICE_ENDPOINT";case Status.InvalidGossipCaCertificate:return"INVALID_GOSSIP_CA_CERTIFICATE";case Status.InvalidGrpcCertificate:return"INVALID_GRPC_CERTIFICATE";case Status.InvalidMaxAutoAssociations:return"INVALID_MAX_AUTO_ASSOCIATIONS";case Status.MaxNodesCreated:return"MAX_NODES_CREATED";case Status.IpFqdnCannotBeSetForSameEndpoint:return"IP_FQDN_CANNOT_BE_SET_FOR_SAME_ENDPOINT";case Status.GossipEndpointCannotHaveFqdn:return"GOSSIP_ENDPOINT_CANNOT_HAVE_FQDN";case Status.FqdnSizeTooLarge:return"FQDN_SIZE_TOO_LARGE";case Status.InvalidEndpoint:return"INVALID_ENDPOINT";case Status.GossipEndpointsExceededLimit:return"GOSSIP_ENDPOINTS_EXCEEDED_LIMIT";case Status.TokenReferenceRepeated:return"TOKEN_REFERENCE_REPEATED";case Status.InvalidOwnerId:return"INVALID_OWNER_ID";case Status.TokenReferenceListSizeLimitExceeded:return"TOKEN_REFERENCE_LIST_SIZE_LIMIT_EXCEEDED";case Status.ServiceEndpointsExceededLimit:return"SERVICE_ENDPOINTS_EXCEEDED_LIMIT";case Status.InvalidIpv4Address:return"INVALID_IPV4_ADDRESS";case Status.EmptyTokenReferenceList:return"EMPTY_TOKEN_REFERENCE_LIST";case Status.UpdateNodeAccountNotAllowed:return"UPDATE_NODE_ACCOUNT_NOT_ALLOWED";case Status.TokenHasNoMetadataOrSupplyKey:return"TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY";case Status.EmptyPendingAirdropIdList:return"EMPTY_PENDING_AIRDROP_ID_LIST";case Status.PendingAirdropIdRepeated:return"PENDING_AIRDROP_ID_REPEATED";case Status.PendingAirdropIdListTooLong:return"PENDING_AIRDROP_ID_LIST_TOO_LONG";case Status.PendingNftAirdropAlreadyExists:return"PENDING_NFT_AIRDROP_ALREADY_EXISTS";case Status.AccountHasPendingAirdrops:return"ACCOUNT_HAS_PENDING_AIRDROPS";case Status.ThrottledAtConsensus:return"THROTTLED_AT_CONSENSUS";case Status.InvalidPendingAirdropId:return"INVALID_PENDING_AIRDROP_ID";case Status.TokenAirdropWithFallbackRoyalty:return"TOKEN_AIRDROP_WITH_FALLBACK_ROYALTY";case Status.InvalidTokenInPendingAirdrop:return"INVALID_TOKEN_IN_PENDING_AIRDROP";case Status.ScheduleExpiryIsBusy:return"SCHEDULE_EXPIRY_IS_BUSY";case Status.InvalidGrpcCertificateHash:return"INVALID_GRPC_CERTIFICATE_HASH";case Status.MissingExpiryTime:return"MISSING_EXPIRY_TIME";case Status.NoSchedulingAllowedAfterScheduledRecursion:return"NO_SCHEDULING_ALLOWED_AFTER_SCHEDULED_RECURSION";case Status.RecursiveSchedulingLimitReached:return"RECURSIVE_SCHEDULING_LIMIT_REACHED";case Status.WaitingForLedgerId:return"WAITING_FOR_LEDGER_ID";case Status.MaxEntriesForFeeExemptKeyListExceeded:return"MAX_ENTRIES_FOR_FEE_EXEMPT_KEY_LIST_EXCEEDED";case Status.FeeExemptKeyListContainsDuplicatedKeys:return"FEE_EXEMPT_KEY_LIST_CONTAINS_DUPLICATED_KEYS";case Status.InvalidKeyInFeeExemptKeyList:return"INVALID_KEY_IN_FEE_EXEMPT_KEY_LIST";case Status.InvalidFeeScheduleKey:return"INVALID_FEE_SCHEDULE_KEY";case Status.FeeScheduleKeyCannotBeUpdated:return"FEE_SCHEDULE_KEY_CANNOT_BE_UPDATED";case Status.FeeScheduleKeyNotSet:return"FEE_SCHEDULE_KEY_NOT_SET";case Status.MaxCustomFeeLimitExceeded:return"MAX_CUSTOM_FEE_LIMIT_EXCEEDED";case Status.NoValidMaxCustomFee:return"NO_VALID_MAX_CUSTOM_FEE";case Status.InvalidMaxCustomFees:return"INVALID_MAX_CUSTOM_FEES";case Status.DuplicateDenominationInMaxCustomFeeList:return"DUPLICATE_DENOMINATION_IN_MAX_CUSTOM_FEE_LIST";case Status.DuplicateAccountIdInMaxCustomFeeList:return"DUPLICATE_ACCOUNT_ID_IN_MAX_CUSTOM_FEE_LIST";case Status.MaxCustomFeesIsNotSupported:return"MAX_CUSTOM_FEES_IS_NOT_SUPPORTED";case Status.BatchListEmpty:return"BATCH_LIST_EMPTY";case Status.BatchListContainsDuplicates:return"BATCH_LIST_CONTAINS_DUPLICATES";case Status.BatchTransactionInBlacklist:return"BATCH_TRANSACTION_IN_BLACKLIST";case Status.InnerTransactionFailed:return"INNER_TRANSACTION_FAILED";case Status.MissingBatchKey:return"MISSING_BATCH_KEY";case Status.BatchKeySetOnNonInnerTransaction:return"BATCH_KEY_SET_ON_NON_INNER_TRANSACTION";case Status.InvalidBatchKey:return"INVALID_BATCH_KEY";case Status.ScheduleExpiryNotConfigurable:return"SCHEDULE_EXPIRY_NOT_CONFIGURABLE";case Status.CreatingSystemEntities:return"CREATING_SYSTEM_ENTITIES";case Status.ThrottleGroupLcmOverflow:return"THROTTLE_GROUP_LCM_OVERFLOW";case Status.AirdropContainsMultipleSendersForAToken:return"AIRDROP_CONTAINS_MULTIPLE_SENDERS_FOR_A_TOKEN";case Status.GrpcWebProxyNotSupported:return"GRPC_WEB_PROXY_NOT_SUPPORTED";case Status.NftTransfersOnlyAllowedForNonFungibleUnique:return"NFT_TRANSFERS_ONLY_ALLOWED_FOR_NON_FUNGIBLE_UNIQUE";case Status.InvalidSerializedTxMessageHashAlgorithm:return"INVALID_SERIALIZED_TX_MESSAGE_HASH_ALGORITHM";case Status.WrongHookEntityType:return"WRONG_HOOK_ENTITY_TYPE";case Status.EvmHookGasThrottled:return"EVM_HOOK_GAS_THROTTLED";case Status.HookIdInUse:return"HOOK_ID_IN_USE";case Status.BadHookRequest:return"BAD_HOOK_REQUEST";case Status.RejectedByAccountAllowanceHook:return"REJECTED_BY_ACCOUNT_ALLOWANCE_HOOK";case Status.HookNotFound:return"HOOK_NOT_FOUND";case Status.EvmHookStorageUpdateBytesTooLong:return"EVM_HOOK_STORAGE_UPDATE_BYTES_TOO_LONG";case Status.EvmHookStorageUpdateBytesMustUseMinimalRepresentation:return"EVM_HOOK_STORAGE_UPDATE_BYTES_MUST_USE_MINIMAL_REPRESENTATION";case Status.InvalidHookId:return"INVALID_HOOK_ID";case Status.EmptyEvmHookStorageUpdate:return"EMPTY_EVM_HOOK_STORAGE_UPDATE";case Status.HookIdRepeatedInCreationDetails:return"HOOK_ID_REPEATED_IN_CREATION_DETAILS";case Status.HooksNotEnabled:return"HOOKS_NOT_ENABLED";case Status.HookIsNotAnEvmHook:return"HOOK_IS_NOT_AN_EVM_HOOK";case Status.HookDeleted:return"HOOK_DELETED";case Status.TooManyEvmHookStorageUpdates:return"TOO_MANY_EVM_HOOK_STORAGE_UPDATES";case Status.HookCreationBytesMustUseMinimalRepresentation:return"HOOK_CREATION_BYTES_MUST_USE_MINIMAL_REPRESENTATION";case Status.HookCreationBytesTooLong:return"HOOK_CREATION_BYTES_TOO_LONG";case Status.InvalidHookCreationSpec:return"INVALID_HOOK_CREATION_SPEC";case Status.HookExtensionEmpty:return"HOOK_EXTENSION_EMPTY";case Status.InvalidHookAdminKey:return"INVALID_HOOK_ADMIN_KEY";case Status.HookDeletionRequiresZeroStorageSlots:return"HOOK_DELETION_REQUIRES_ZERO_STORAGE_SLOTS";case Status.CannotSetHooksAndApproval:return"CANNOT_SET_HOOKS_AND_APPROVAL";case Status.TransactionRequiresZeroHooks:return"TRANSACTION_REQUIRES_ZERO_HOOKS";case Status.InvalidHookCall:return"INVALID_HOOK_CALL";case Status.HooksAreNotSupportedInAirdrops:return"HOOKS_ARE_NOT_SUPPORTED_IN_AIRDROPS";case Status.AccountIsLinkedToANode:return"ACCOUNT_IS_LINKED_TO_A_NODE";case Status.HooksExecutionsRequireTopLevelCryptoTransfer:return"HOOKS_EXECUTIONS_REQUIRE_TOP_LEVEL_CRYPTO_TRANSFER";case Status.NodeAccountHasZeroBalance:return"NODE_ACCOUNT_HAS_ZERO_BALANCE";case Status.TransferToFeeCollectionAccountNotAllowed:return"TRANSFER_TO_FEE_COLLECTION_ACCOUNT_NOT_ALLOWED";case Status.TooManyHookInvocations:return"TOO_MANY_HOOK_INVOCATIONS";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return Status.Ok;case 1:return Status.InvalidTransaction;case 2:return Status.PayerAccountNotFound;case 3:return Status.InvalidNodeAccount;case 4:return Status.TransactionExpired;case 5:return Status.InvalidTransactionStart;case 6:return Status.InvalidTransactionDuration;case 7:return Status.InvalidSignature;case 8:return Status.MemoTooLong;case 9:return Status.InsufficientTxFee;case 10:return Status.InsufficientPayerBalance;case 11:return Status.DuplicateTransaction;case 12:return Status.Busy;case 13:return Status.NotSupported;case 14:return Status.InvalidFileId;case 15:return Status.InvalidAccountId;case 16:return Status.InvalidContractId;case 17:return Status.InvalidTransactionId;case 18:return Status.ReceiptNotFound;case 19:return Status.RecordNotFound;case 20:return Status.InvalidSolidityId;case 21:return Status.Unknown;case 22:return Status.Success;case 23:return Status.FailInvalid;case 24:return Status.FailFee;case 25:return Status.FailBalance;case 26:return Status.KeyRequired;case 27:return Status.BadEncoding;case 28:return Status.InsufficientAccountBalance;case 29:return Status.InvalidSolidityAddress;case 30:return Status.InsufficientGas;case 31:return Status.ContractSizeLimitExceeded;case 32:return Status.LocalCallModificationException;case 33:return Status.ContractRevertExecuted;case 34:return Status.ContractExecutionException;case 35:return Status.InvalidReceivingNodeAccount;case 36:return Status.MissingQueryHeader;case 37:return Status.AccountUpdateFailed;case 38:return Status.InvalidKeyEncoding;case 39:return Status.NullSolidityAddress;case 40:return Status.ContractUpdateFailed;case 41:return Status.InvalidQueryHeader;case 42:return Status.InvalidFeeSubmitted;case 43:return Status.InvalidPayerSignature;case 44:return Status.KeyNotProvided;case 45:return Status.InvalidExpirationTime;case 46:return Status.NoWaclKey;case 47:return Status.FileContentEmpty;case 48:return Status.InvalidAccountAmounts;case 49:return Status.EmptyTransactionBody;case 50:return Status.InvalidTransactionBody;case 51:return Status.InvalidSignatureTypeMismatchingKey;case 52:return Status.InvalidSignatureCountMismatchingKey;case 53:return Status.EmptyLiveHashBody;case 54:return Status.EmptyLiveHash;case 55:return Status.EmptyLiveHashKeys;case 56:return Status.InvalidLiveHashSize;case 57:return Status.EmptyQueryBody;case 58:return Status.EmptyLiveHashQuery;case 59:return Status.LiveHashNotFound;case 60:return Status.AccountIdDoesNotExist;case 61:return Status.LiveHashAlreadyExists;case 62:return Status.InvalidFileWacl;case 63:return Status.SerializationFailed;case 64:return Status.TransactionOversize;case 65:return Status.TransactionTooManyLayers;case 66:return Status.ContractDeleted;case 67:return Status.PlatformNotActive;case 68:return Status.KeyPrefixMismatch;case 69:return Status.PlatformTransactionNotCreated;case 70:return Status.InvalidRenewalPeriod;case 71:return Status.InvalidPayerAccountId;case 72:return Status.AccountDeleted;case 73:return Status.FileDeleted;case 74:return Status.AccountRepeatedInAccountAmounts;case 75:return Status.SettingNegativeAccountBalance;case 76:return Status.ObtainerRequired;case 77:return Status.ObtainerSameContractId;case 78:return Status.ObtainerDoesNotExist;case 79:return Status.ModifyingImmutableContract;case 80:return Status.FileSystemException;case 81:return Status.AutorenewDurationNotInRange;case 82:return Status.ErrorDecodingBytestring;case 83:return Status.ContractFileEmpty;case 84:return Status.ContractBytecodeEmpty;case 85:return Status.InvalidInitialBalance;case 86:return Status.InvalidReceiveRecordThreshold;case 87:return Status.InvalidSendRecordThreshold;case 88:return Status.AccountIsNotGenesisAccount;case 89:return Status.PayerAccountUnauthorized;case 90:return Status.InvalidFreezeTransactionBody;case 91:return Status.FreezeTransactionBodyNotFound;case 92:return Status.TransferListSizeLimitExceeded;case 93:return Status.ResultSizeLimitExceeded;case 94:return Status.NotSpecialAccount;case 95:return Status.ContractNegativeGas;case 96:return Status.ContractNegativeValue;case 97:return Status.InvalidFeeFile;case 98:return Status.InvalidExchangeRateFile;case 99:return Status.InsufficientLocalCallGas;case 100:return Status.EntityNotAllowedToDelete;case 101:return Status.AuthorizationFailed;case 102:return Status.FileUploadedProtoInvalid;case 103:return Status.FileUploadedProtoNotSavedToDisk;case 104:return Status.FeeScheduleFilePartUploaded;case 105:return Status.ExchangeRateChangeLimitExceeded;case 106:return Status.MaxContractStorageExceeded;case 107:return Status.TransferAccountSameAsDeleteAccount;case 108:return Status.TotalLedgerBalanceInvalid;case 110:return Status.ExpirationReductionNotAllowed;case 111:return Status.MaxGasLimitExceeded;case 112:return Status.MaxFileSizeExceeded;case 113:return Status.ReceiverSigRequired;case 150:return Status.InvalidTopicId;case 155:return Status.InvalidAdminKey;case 156:return Status.InvalidSubmitKey;case 157:return Status.Unauthorized;case 158:return Status.InvalidTopicMessage;case 159:return Status.InvalidAutorenewAccount;case 160:return Status.AutorenewAccountNotAllowed;case 162:return Status.TopicExpired;case 163:return Status.InvalidChunkNumber;case 164:return Status.InvalidChunkTransactionId;case 165:return Status.AccountFrozenForToken;case 166:return Status.TokensPerAccountLimitExceeded;case 167:return Status.InvalidTokenId;case 168:return Status.InvalidTokenDecimals;case 169:return Status.InvalidTokenInitialSupply;case 170:return Status.InvalidTreasuryAccountForToken;case 171:return Status.InvalidTokenSymbol;case 172:return Status.TokenHasNoFreezeKey;case 173:return Status.TransfersNotZeroSumForToken;case 174:return Status.MissingTokenSymbol;case 175:return Status.TokenSymbolTooLong;case 176:return Status.AccountKycNotGrantedForToken;case 177:return Status.TokenHasNoKycKey;case 178:return Status.InsufficientTokenBalance;case 179:return Status.TokenWasDeleted;case 180:return Status.TokenHasNoSupplyKey;case 181:return Status.TokenHasNoWipeKey;case 182:return Status.InvalidTokenMintAmount;case 183:return Status.InvalidTokenBurnAmount;case 184:return Status.TokenNotAssociatedToAccount;case 185:return Status.CannotWipeTokenTreasuryAccount;case 186:return Status.InvalidKycKey;case 187:return Status.InvalidWipeKey;case 188:return Status.InvalidFreezeKey;case 189:return Status.InvalidSupplyKey;case 190:return Status.MissingTokenName;case 191:return Status.TokenNameTooLong;case 192:return Status.InvalidWipingAmount;case 193:return Status.TokenIsImmutable;case 194:return Status.TokenAlreadyAssociatedToAccount;case 195:return Status.TransactionRequiresZeroTokenBalances;case 196:return Status.AccountIsTreasury;case 197:return Status.TokenIdRepeatedInTokenList;case 198:return Status.TokenTransferListSizeLimitExceeded;case 199:return Status.EmptyTokenTransferBody;case 200:return Status.EmptyTokenTransferAccountAmounts;case 201:return Status.InvalidScheduleId;case 202:return Status.ScheduleIsImmutable;case 203:return Status.InvalidSchedulePayerId;case 204:return Status.InvalidScheduleAccountId;case 205:return Status.NoNewValidSignatures;case 206:return Status.UnresolvableRequiredSigners;case 207:return Status.ScheduledTransactionNotInWhitelist;case 208:return Status.SomeSignaturesWereInvalid;case 209:return Status.TransactionIdFieldNotAllowed;case 210:return Status.IdenticalScheduleAlreadyCreated;case 211:return Status.InvalidZeroByteInString;case 212:return Status.ScheduleAlreadyDeleted;case 213:return Status.ScheduleAlreadyExecuted;case 214:return Status.MessageSizeTooLarge;case 215:return Status.OperationRepeatedInBucketGroups;case 216:return Status.BucketCapacityOverflow;case 217:return Status.NodeCapacityNotSufficientForOperation;case 218:return Status.BucketHasNoThrottleGroups;case 219:return Status.ThrottleGroupHasZeroOpsPerSec;case 220:return Status.SuccessButMissingExpectedOperation;case 221:return Status.UnparseableThrottleDefinitions;case 222:return Status.InvalidThrottleDefinitions;case 223:return Status.AccountExpiredAndPendingRemoval;case 224:return Status.InvalidTokenMaxSupply;case 225:return Status.InvalidTokenNftSerialNumber;case 226:return Status.InvalidNftId;case 227:return Status.MetadataTooLong;case 228:return Status.BatchSizeLimitExceeded;case 229:return Status.InvalidQueryRange;case 230:return Status.FractionDividesByZero;case 231:return Status.InsufficientPayerBalanceForCustomFee;case 232:return Status.CustomFeesListTooLong;case 233:return Status.InvalidCustomFeeCollector;case 234:return Status.InvalidTokenIdInCustomFees;case 235:return Status.TokenNotAssociatedToFeeCollector;case 236:return Status.TokenMaxSupplyReached;case 237:return Status.SenderDoesNotOwnNftSerialNo;case 238:return Status.CustomFeeNotFullySpecified;case 239:return Status.CustomFeeMustBePositive;case 240:return Status.TokenHasNoFeeScheduleKey;case 241:return Status.CustomFeeOutsideNumericRange;case 242:return Status.RoyaltyFractionCannotExceedOne;case 243:return Status.FractionalFeeMaxAmountLessThanMinAmount;case 244:return Status.CustomScheduleAlreadyHasNoFees;case 245:return Status.CustomFeeDenominationMustBeFungibleCommon;case 246:return Status.CustomFractionalFeeOnlyAllowedForFungibleCommon;case 247:return Status.InvalidCustomFeeScheduleKey;case 248:return Status.InvalidTokenMintMetadata;case 249:return Status.InvalidTokenBurnMetadata;case 250:return Status.CurrentTreasuryStillOwnsNfts;case 251:return Status.AccountStillOwnsNfts;case 252:return Status.TreasuryMustOwnBurnedNft;case 253:return Status.AccountDoesNotOwnWipedNft;case 254:return Status.AccountAmountTransfersOnlyAllowedForFungibleCommon;case 255:return Status.MaxNftsInPriceRegimeHaveBeenMinted;case 256:return Status.PayerAccountDeleted;case 257:return Status.CustomFeeChargingExceededMaxRecursionDepth;case 258:return Status.CustomFeeChargingExceededMaxAccountAmounts;case 259:return Status.InsufficientSenderAccountBalanceForCustomFee;case 260:return Status.SerialNumberLimitReached;case 261:return Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique;case 262:return Status.NoRemainingAutomaticAssociations;case 263:return Status.ExistingAutomaticAssociationsExceedGivenLimit;case 264:return Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit;case 265:return Status.TokenIsPaused;case 266:return Status.TokenHasNoPauseKey;case 267:return Status.InvalidPauseKey;case 268:return Status.FreezeUpdateFileDoesNotExist;case 269:return Status.FreezeUpdateFileHashDoesNotMatch;case 270:return Status.NoUpgradeHasBeenPrepared;case 271:return Status.NoFreezeIsScheduled;case 272:return Status.UpdateFileHashChangedSincePrepareUpgrade;case 273:return Status.FreezeStartTimeMustBeFuture;case 274:return Status.PreparedUpdateFileIsImmutable;case 275:return Status.FreezeAlreadyScheduled;case 276:return Status.FreezeUpgradeInProgress;case 277:return Status.UpdateFileIdDoesNotMatchPrepared;case 278:return Status.UpdateFileHashDoesNotMatchPrepared;case 279:return Status.ConsensusGasExhausted;case 280:return Status.RevertedSuccess;case 281:return Status.MaxStorageInPriceRegimeHasBeenUsed;case 282:return Status.InvalidAliasKey;case 283:return Status.UnexpectedTokenDecimals;case 284:return Status.InvalidProxyAccountId;case 285:return Status.InvalidTransferAccountId;case 286:return Status.InvalidFeeCollectorAccountId;case 287:return Status.AliasIsImmutable;case 288:return Status.SpenderAccountSameAsOwner;case 289:return Status.AmountExceedsTokenMaxSupply;case 290:return Status.NegativeAllowanceAmount;case 291:return Status.CannotApproveForAllFungibleCommon;case 292:return Status.SpenderDoesNotHaveAllowance;case 293:return Status.AmountExceedsAllowance;case 294:return Status.MaxAllowancesExceeded;case 295:return Status.EmptyAllowances;case 296:return Status.SpenderAccountRepeatedInAllowances;case 297:return Status.RepeatedSerialNumsInNftAllowances;case 298:return Status.FungibleTokenInNftAllowances;case 299:return Status.NftInFungibleTokenAllowances;case 300:return Status.InvalidAllowanceOwnerId;case 301:return Status.InvalidAllowanceSpenderId;case 302:return Status.RepeatedAllowancesToDelete;case 303:return Status.InvalidDelegatingSpender;case 304:return Status.DelegatingSpenderCannotGrantApproveForAll;case 305:return Status.DelegatingSpenderDoesNotHaveApproveForAll;case 306:return Status.ScheduleExpirationTimeTooFarInFuture;case 307:return Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime;case 308:return Status.ScheduleFutureThrottleExceeded;case 309:return Status.ScheduleFutureGasLimitExceeded;case 310:return Status.InvalidEthereumTransaction;case 311:return Status.WrongChainId;case 312:return Status.WrongNonce;case 313:return Status.AccessListUnsupported;case 314:return Status.SchedulePendingExpiration;case 315:return Status.ContractIsTokenTreasury;case 316:return Status.ContractHasNonZeroTokenBalances;case 317:return Status.ContractExpiredAndPendingRemoval;case 318:return Status.ContractHasNoAutoRenewAccount;case 319:return Status.PermanentRemovalRequiresSystemInitiation;case 320:return Status.ProxyAccountIdFieldIsDeprecated;case 321:return Status.SelfStakingIsNotAllowed;case 322:return Status.InvalidStakingId;case 323:return Status.StakingNotEnabled;case 324:return Status.InvalidPrngRange;case 325:return Status.MaxEntitiesInPriceRegimeHaveBeenCreated;case 326:return Status.InvalidFullPrefixSignatureForPrecompile;case 327:return Status.InsufficientBalancesForStorageRent;case 328:return Status.MaxChildRecordsExceeded;case 329:return Status.InsufficientBalancesForRenewalFees;case 330:return Status.TransactionHasUnknownFields;case 331:return Status.AccountIsImmutable;case 332:return Status.AliasAlreadyAssigned;case 333:return Status.InvalidMetadataKey;case 334:return Status.TokenHasNoMetadataKey;case 335:return Status.MissingTokenMetadata;case 336:return Status.MissingSerialNumbers;case 337:return Status.TokenHasNoAdminKey;case 338:return Status.NodeDeleted;case 339:return Status.InvalidNodeId;case 340:return Status.InvalidGossipEndpoint;case 341:return Status.InvalidNodeAccountId;case 342:return Status.InvalidNodeDescription;case 343:return Status.InvalidServiceEndpoint;case 344:return Status.InvalidGossipCaCertificate;case 345:return Status.InvalidGrpcCertificate;case 346:return Status.InvalidMaxAutoAssociations;case 347:return Status.MaxNodesCreated;case 348:return Status.IpFqdnCannotBeSetForSameEndpoint;case 349:return Status.GossipEndpointCannotHaveFqdn;case 350:return Status.FqdnSizeTooLarge;case 351:return Status.InvalidEndpoint;case 352:return Status.GossipEndpointsExceededLimit;case 353:return Status.TokenReferenceRepeated;case 354:return Status.InvalidOwnerId;case 355:return Status.TokenReferenceListSizeLimitExceeded;case 356:return Status.ServiceEndpointsExceededLimit;case 357:return Status.InvalidIpv4Address;case 358:return Status.EmptyTokenReferenceList;case 359:return Status.UpdateNodeAccountNotAllowed;case 360:return Status.TokenHasNoMetadataOrSupplyKey;case 361:return Status.EmptyPendingAirdropIdList;case 362:return Status.PendingAirdropIdRepeated;case 363:return Status.PendingAirdropIdListTooLong;case 364:return Status.PendingNftAirdropAlreadyExists;case 365:return Status.AccountHasPendingAirdrops;case 366:return Status.ThrottledAtConsensus;case 367:return Status.InvalidPendingAirdropId;case 368:return Status.TokenAirdropWithFallbackRoyalty;case 369:return Status.InvalidTokenInPendingAirdrop;case 370:return Status.ScheduleExpiryIsBusy;case 371:return Status.InvalidGrpcCertificateHash;case 372:return Status.MissingExpiryTime;case 373:return Status.NoSchedulingAllowedAfterScheduledRecursion;case 374:return Status.RecursiveSchedulingLimitReached;case 375:return Status.WaitingForLedgerId;case 376:return Status.MaxEntriesForFeeExemptKeyListExceeded;case 377:return Status.FeeExemptKeyListContainsDuplicatedKeys;case 378:return Status.InvalidKeyInFeeExemptKeyList;case 379:return Status.InvalidFeeScheduleKey;case 380:return Status.FeeScheduleKeyCannotBeUpdated;case 381:return Status.FeeScheduleKeyNotSet;case 382:return Status.MaxCustomFeeLimitExceeded;case 383:return Status.NoValidMaxCustomFee;case 384:return Status.InvalidMaxCustomFees;case 385:return Status.DuplicateDenominationInMaxCustomFeeList;case 386:return Status.DuplicateAccountIdInMaxCustomFeeList;case 387:return Status.MaxCustomFeesIsNotSupported;case 388:return Status.BatchListEmpty;case 389:return Status.BatchListContainsDuplicates;case 390:return Status.BatchTransactionInBlacklist;case 391:return Status.InnerTransactionFailed;case 392:return Status.MissingBatchKey;case 393:return Status.BatchKeySetOnNonInnerTransaction;case 394:return Status.InvalidBatchKey;case 395:return Status.ScheduleExpiryNotConfigurable;case 396:return Status.CreatingSystemEntities;case 397:return Status.ThrottleGroupLcmOverflow;case 398:return Status.AirdropContainsMultipleSendersForAToken;case 399:return Status.GrpcWebProxyNotSupported;case 400:return Status.NftTransfersOnlyAllowedForNonFungibleUnique;case 401:return Status.InvalidSerializedTxMessageHashAlgorithm;case 499:return Status.WrongHookEntityType;case 500:return Status.EvmHookGasThrottled;case 501:return Status.HookIdInUse;case 502:return Status.BadHookRequest;case 503:return Status.RejectedByAccountAllowanceHook;case 504:return Status.HookNotFound;case 505:return Status.EvmHookStorageUpdateBytesTooLong;case 506:return Status.EvmHookStorageUpdateBytesMustUseMinimalRepresentation;case 507:return Status.InvalidHookId;case 508:return Status.EmptyEvmHookStorageUpdate;case 509:return Status.HookIdRepeatedInCreationDetails;case 510:return Status.HooksNotEnabled;case 511:return Status.HookIsNotAnEvmHook;case 512:return Status.HookDeleted;case 513:return Status.TooManyEvmHookStorageUpdates;case 514:return Status.HookCreationBytesMustUseMinimalRepresentation;case 515:return Status.HookCreationBytesTooLong;case 516:return Status.InvalidHookCreationSpec;case 517:return Status.HookExtensionEmpty;case 518:return Status.InvalidHookAdminKey;case 519:return Status.HookDeletionRequiresZeroStorageSlots;case 520:return Status.CannotSetHooksAndApproval;case 521:return Status.TransactionRequiresZeroHooks;case 522:return Status.InvalidHookCall;case 523:return Status.HooksAreNotSupportedInAirdrops;case 524:return Status.AccountIsLinkedToANode;case 525:return Status.HooksExecutionsRequireTopLevelCryptoTransfer;case 526:return Status.NodeAccountHasZeroBalance;case 527:return Status.TransferToFeeCollectionAccountNotAllowed;case 528:return Status.TooManyHookInvocations;default:throw new Error(`(BUG) Status.fromCode() does not handle code: ${e}`)}}valueOf(){return this._code}}Status.Ok=new Status(0),Status.InvalidTransaction=new Status(1),Status.PayerAccountNotFound=new Status(2),Status.InvalidNodeAccount=new Status(3),Status.TransactionExpired=new Status(4),Status.InvalidTransactionStart=new Status(5),Status.InvalidTransactionDuration=new Status(6),Status.InvalidSignature=new Status(7),Status.MemoTooLong=new Status(8),Status.InsufficientTxFee=new Status(9),Status.InsufficientPayerBalance=new Status(10),Status.DuplicateTransaction=new Status(11),Status.Busy=new Status(12),Status.NotSupported=new Status(13),Status.InvalidFileId=new Status(14),Status.InvalidAccountId=new Status(15),Status.InvalidContractId=new Status(16),Status.InvalidTransactionId=new Status(17),Status.ReceiptNotFound=new Status(18),Status.RecordNotFound=new Status(19),Status.InvalidSolidityId=new Status(20),Status.Unknown=new Status(21),Status.Success=new Status(22),Status.FailInvalid=new Status(23),Status.FailFee=new Status(24),Status.FailBalance=new Status(25),Status.KeyRequired=new Status(26),Status.BadEncoding=new Status(27),Status.InsufficientAccountBalance=new Status(28),Status.InvalidSolidityAddress=new Status(29),Status.InsufficientGas=new Status(30),Status.ContractSizeLimitExceeded=new Status(31),Status.LocalCallModificationException=new Status(32),Status.ContractRevertExecuted=new Status(33),Status.ContractExecutionException=new Status(34),Status.InvalidReceivingNodeAccount=new Status(35),Status.MissingQueryHeader=new Status(36),Status.AccountUpdateFailed=new Status(37),Status.InvalidKeyEncoding=new Status(38),Status.NullSolidityAddress=new Status(39),Status.ContractUpdateFailed=new Status(40),Status.InvalidQueryHeader=new Status(41),Status.InvalidFeeSubmitted=new Status(42),Status.InvalidPayerSignature=new Status(43),Status.KeyNotProvided=new Status(44),Status.InvalidExpirationTime=new Status(45),Status.NoWaclKey=new Status(46),Status.FileContentEmpty=new Status(47),Status.InvalidAccountAmounts=new Status(48),Status.EmptyTransactionBody=new Status(49),Status.InvalidTransactionBody=new Status(50),Status.InvalidSignatureTypeMismatchingKey=new Status(51),Status.InvalidSignatureCountMismatchingKey=new Status(52),Status.EmptyLiveHashBody=new Status(53),Status.EmptyLiveHash=new Status(54),Status.EmptyLiveHashKeys=new Status(55),Status.InvalidLiveHashSize=new Status(56),Status.EmptyQueryBody=new Status(57),Status.EmptyLiveHashQuery=new Status(58),Status.LiveHashNotFound=new Status(59),Status.AccountIdDoesNotExist=new Status(60),Status.LiveHashAlreadyExists=new Status(61),Status.InvalidFileWacl=new Status(62),Status.SerializationFailed=new Status(63),Status.TransactionOversize=new Status(64),Status.TransactionTooManyLayers=new Status(65),Status.ContractDeleted=new Status(66),Status.PlatformNotActive=new Status(67),Status.KeyPrefixMismatch=new Status(68),Status.PlatformTransactionNotCreated=new Status(69),Status.InvalidRenewalPeriod=new Status(70),Status.InvalidPayerAccountId=new Status(71),Status.AccountDeleted=new Status(72),Status.FileDeleted=new Status(73),Status.AccountRepeatedInAccountAmounts=new Status(74),Status.SettingNegativeAccountBalance=new Status(75),Status.ObtainerRequired=new Status(76),Status.ObtainerSameContractId=new Status(77),Status.ObtainerDoesNotExist=new Status(78),Status.ModifyingImmutableContract=new Status(79),Status.FileSystemException=new Status(80),Status.AutorenewDurationNotInRange=new Status(81),Status.ErrorDecodingBytestring=new Status(82),Status.ContractFileEmpty=new Status(83),Status.ContractBytecodeEmpty=new Status(84),Status.InvalidInitialBalance=new Status(85),Status.InvalidReceiveRecordThreshold=new Status(86),Status.InvalidSendRecordThreshold=new Status(87),Status.AccountIsNotGenesisAccount=new Status(88),Status.PayerAccountUnauthorized=new Status(89),Status.InvalidFreezeTransactionBody=new Status(90),Status.FreezeTransactionBodyNotFound=new Status(91),Status.TransferListSizeLimitExceeded=new Status(92),Status.ResultSizeLimitExceeded=new Status(93),Status.NotSpecialAccount=new Status(94),Status.ContractNegativeGas=new Status(95),Status.ContractNegativeValue=new Status(96),Status.InvalidFeeFile=new Status(97),Status.InvalidExchangeRateFile=new Status(98),Status.InsufficientLocalCallGas=new Status(99),Status.EntityNotAllowedToDelete=new Status(100),Status.AuthorizationFailed=new Status(101),Status.FileUploadedProtoInvalid=new Status(102),Status.FileUploadedProtoNotSavedToDisk=new Status(103),Status.FeeScheduleFilePartUploaded=new Status(104),Status.ExchangeRateChangeLimitExceeded=new Status(105),Status.MaxContractStorageExceeded=new Status(106),Status.TransferAccountSameAsDeleteAccount=new Status(107),Status.TotalLedgerBalanceInvalid=new Status(108),Status.ExpirationReductionNotAllowed=new Status(110),Status.MaxGasLimitExceeded=new Status(111),Status.MaxFileSizeExceeded=new Status(112),Status.ReceiverSigRequired=new Status(113),Status.InvalidTopicId=new Status(150),Status.InvalidAdminKey=new Status(155),Status.InvalidSubmitKey=new Status(156),Status.Unauthorized=new Status(157),Status.InvalidTopicMessage=new Status(158),Status.InvalidAutorenewAccount=new Status(159),Status.AutorenewAccountNotAllowed=new Status(160),Status.TopicExpired=new Status(162),Status.InvalidChunkNumber=new Status(163),Status.InvalidChunkTransactionId=new Status(164),Status.AccountFrozenForToken=new Status(165),Status.TokensPerAccountLimitExceeded=new Status(166),Status.InvalidTokenId=new Status(167),Status.InvalidTokenDecimals=new Status(168),Status.InvalidTokenInitialSupply=new Status(169),Status.InvalidTreasuryAccountForToken=new Status(170),Status.InvalidTokenSymbol=new Status(171),Status.TokenHasNoFreezeKey=new Status(172),Status.TransfersNotZeroSumForToken=new Status(173),Status.MissingTokenSymbol=new Status(174),Status.TokenSymbolTooLong=new Status(175),Status.AccountKycNotGrantedForToken=new Status(176),Status.TokenHasNoKycKey=new Status(177),Status.InsufficientTokenBalance=new Status(178),Status.TokenWasDeleted=new Status(179),Status.TokenHasNoSupplyKey=new Status(180),Status.TokenHasNoWipeKey=new Status(181),Status.InvalidTokenMintAmount=new Status(182),Status.InvalidTokenBurnAmount=new Status(183),Status.TokenNotAssociatedToAccount=new Status(184),Status.CannotWipeTokenTreasuryAccount=new Status(185),Status.InvalidKycKey=new Status(186),Status.InvalidWipeKey=new Status(187),Status.InvalidFreezeKey=new Status(188),Status.InvalidSupplyKey=new Status(189),Status.MissingTokenName=new Status(190),Status.TokenNameTooLong=new Status(191),Status.InvalidWipingAmount=new Status(192),Status.TokenIsImmutable=new Status(193),Status.TokenAlreadyAssociatedToAccount=new Status(194),Status.TransactionRequiresZeroTokenBalances=new Status(195),Status.AccountIsTreasury=new Status(196),Status.TokenIdRepeatedInTokenList=new Status(197),Status.TokenTransferListSizeLimitExceeded=new Status(198),Status.EmptyTokenTransferBody=new Status(199),Status.EmptyTokenTransferAccountAmounts=new Status(200),Status.InvalidScheduleId=new Status(201),Status.ScheduleIsImmutable=new Status(202),Status.InvalidSchedulePayerId=new Status(203),Status.InvalidScheduleAccountId=new Status(204),Status.NoNewValidSignatures=new Status(205),Status.UnresolvableRequiredSigners=new Status(206),Status.ScheduledTransactionNotInWhitelist=new Status(207),Status.SomeSignaturesWereInvalid=new Status(208),Status.TransactionIdFieldNotAllowed=new Status(209),Status.IdenticalScheduleAlreadyCreated=new Status(210),Status.InvalidZeroByteInString=new Status(211),Status.ScheduleAlreadyDeleted=new Status(212),Status.ScheduleAlreadyExecuted=new Status(213),Status.MessageSizeTooLarge=new Status(214),Status.OperationRepeatedInBucketGroups=new Status(215),Status.BucketCapacityOverflow=new Status(216),Status.NodeCapacityNotSufficientForOperation=new Status(217),Status.BucketHasNoThrottleGroups=new Status(218),Status.ThrottleGroupHasZeroOpsPerSec=new Status(219),Status.SuccessButMissingExpectedOperation=new Status(220),Status.UnparseableThrottleDefinitions=new Status(221),Status.InvalidThrottleDefinitions=new Status(222),Status.AccountExpiredAndPendingRemoval=new Status(223),Status.InvalidTokenMaxSupply=new Status(224),Status.InvalidTokenNftSerialNumber=new Status(225),Status.InvalidNftId=new Status(226),Status.MetadataTooLong=new Status(227),Status.BatchSizeLimitExceeded=new Status(228),Status.InvalidQueryRange=new Status(229),Status.FractionDividesByZero=new Status(230),Status.InsufficientPayerBalanceForCustomFee=new Status(231),Status.CustomFeesListTooLong=new Status(232),Status.InvalidCustomFeeCollector=new Status(233),Status.InvalidTokenIdInCustomFees=new Status(234),Status.TokenNotAssociatedToFeeCollector=new Status(235),Status.TokenMaxSupplyReached=new Status(236),Status.SenderDoesNotOwnNftSerialNo=new Status(237),Status.CustomFeeNotFullySpecified=new Status(238),Status.CustomFeeMustBePositive=new Status(239),Status.TokenHasNoFeeScheduleKey=new Status(240),Status.CustomFeeOutsideNumericRange=new Status(241),Status.RoyaltyFractionCannotExceedOne=new Status(242),Status.FractionalFeeMaxAmountLessThanMinAmount=new Status(243),Status.CustomScheduleAlreadyHasNoFees=new Status(244),Status.CustomFeeDenominationMustBeFungibleCommon=new Status(245),Status.CustomFractionalFeeOnlyAllowedForFungibleCommon=new Status(246),Status.InvalidCustomFeeScheduleKey=new Status(247),Status.InvalidTokenMintMetadata=new Status(248),Status.InvalidTokenBurnMetadata=new Status(249),Status.CurrentTreasuryStillOwnsNfts=new Status(250),Status.AccountStillOwnsNfts=new Status(251),Status.TreasuryMustOwnBurnedNft=new Status(252),Status.AccountDoesNotOwnWipedNft=new Status(253),Status.AccountAmountTransfersOnlyAllowedForFungibleCommon=new Status(254),Status.MaxNftsInPriceRegimeHaveBeenMinted=new Status(255),Status.PayerAccountDeleted=new Status(256),Status.CustomFeeChargingExceededMaxRecursionDepth=new Status(257),Status.CustomFeeChargingExceededMaxAccountAmounts=new Status(258),Status.InsufficientSenderAccountBalanceForCustomFee=new Status(259),Status.SerialNumberLimitReached=new Status(260),Status.CustomRoyaltyFeeOnlyAllowedForNonFungibleUnique=new Status(261),Status.NoRemainingAutomaticAssociations=new Status(262),Status.ExistingAutomaticAssociationsExceedGivenLimit=new Status(263),Status.RequestedNumAutomaticAssociationsExceedsAssociationLimit=new Status(264),Status.TokenIsPaused=new Status(265),Status.TokenHasNoPauseKey=new Status(266),Status.InvalidPauseKey=new Status(267),Status.FreezeUpdateFileDoesNotExist=new Status(268),Status.FreezeUpdateFileHashDoesNotMatch=new Status(269),Status.NoUpgradeHasBeenPrepared=new Status(270),Status.NoFreezeIsScheduled=new Status(271),Status.UpdateFileHashChangedSincePrepareUpgrade=new Status(272),Status.FreezeStartTimeMustBeFuture=new Status(273),Status.PreparedUpdateFileIsImmutable=new Status(274),Status.FreezeAlreadyScheduled=new Status(275),Status.FreezeUpgradeInProgress=new Status(276),Status.UpdateFileIdDoesNotMatchPrepared=new Status(277),Status.UpdateFileHashDoesNotMatchPrepared=new Status(278),Status.ConsensusGasExhausted=new Status(279),Status.RevertedSuccess=new Status(280),Status.MaxStorageInPriceRegimeHasBeenUsed=new Status(281),Status.InvalidAliasKey=new Status(282),Status.UnexpectedTokenDecimals=new Status(283),Status.InvalidProxyAccountId=new Status(284),Status.InvalidTransferAccountId=new Status(285),Status.InvalidFeeCollectorAccountId=new Status(286),Status.AliasIsImmutable=new Status(287),Status.SpenderAccountSameAsOwner=new Status(288),Status.AmountExceedsTokenMaxSupply=new Status(289),Status.NegativeAllowanceAmount=new Status(290),Status.CannotApproveForAllFungibleCommon=new Status(291),Status.SpenderDoesNotHaveAllowance=new Status(292),Status.AmountExceedsAllowance=new Status(293),Status.MaxAllowancesExceeded=new Status(294),Status.EmptyAllowances=new Status(295),Status.SpenderAccountRepeatedInAllowances=new Status(296),Status.RepeatedSerialNumsInNftAllowances=new Status(297),Status.FungibleTokenInNftAllowances=new Status(298),Status.NftInFungibleTokenAllowances=new Status(299),Status.InvalidAllowanceOwnerId=new Status(300),Status.InvalidAllowanceSpenderId=new Status(301),Status.RepeatedAllowancesToDelete=new Status(302),Status.InvalidDelegatingSpender=new Status(303),Status.DelegatingSpenderCannotGrantApproveForAll=new Status(304),Status.DelegatingSpenderDoesNotHaveApproveForAll=new Status(305),Status.ScheduleExpirationTimeTooFarInFuture=new Status(306),Status.ScheduleExpirationTimeMustBeHigherThanConsensusTime=new Status(307),Status.ScheduleFutureThrottleExceeded=new Status(308),Status.ScheduleFutureGasLimitExceeded=new Status(309),Status.InvalidEthereumTransaction=new Status(310),Status.WrongChainId=new Status(311),Status.WrongNonce=new Status(312),Status.AccessListUnsupported=new Status(313),Status.SchedulePendingExpiration=new Status(314),Status.ContractIsTokenTreasury=new Status(315),Status.ContractHasNonZeroTokenBalances=new Status(316),Status.ContractExpiredAndPendingRemoval=new Status(317),Status.ContractHasNoAutoRenewAccount=new Status(318),Status.PermanentRemovalRequiresSystemInitiation=new Status(319),Status.ProxyAccountIdFieldIsDeprecated=new Status(320),Status.SelfStakingIsNotAllowed=new Status(321),Status.InvalidStakingId=new Status(322),Status.StakingNotEnabled=new Status(323),Status.InvalidPrngRange=new Status(324),Status.MaxEntitiesInPriceRegimeHaveBeenCreated=new Status(325),Status.InvalidFullPrefixSignatureForPrecompile=new Status(326),Status.InsufficientBalancesForStorageRent=new Status(327),Status.MaxChildRecordsExceeded=new Status(328),Status.InsufficientBalancesForRenewalFees=new Status(329),Status.TransactionHasUnknownFields=new Status(330),Status.AccountIsImmutable=new Status(331),Status.AliasAlreadyAssigned=new Status(332),Status.InvalidMetadataKey=new Status(333),Status.TokenHasNoMetadataKey=new Status(334),Status.MissingTokenMetadata=new Status(335),Status.MissingSerialNumbers=new Status(336),Status.TokenHasNoAdminKey=new Status(337),Status.NodeDeleted=new Status(338),Status.InvalidNodeId=new Status(339),Status.InvalidGossipEndpoint=new Status(340),Status.InvalidNodeAccountId=new Status(341),Status.InvalidNodeDescription=new Status(342),Status.InvalidServiceEndpoint=new Status(343),Status.InvalidGossipCaCertificate=new Status(344),Status.InvalidGrpcCertificate=new Status(345),Status.InvalidMaxAutoAssociations=new Status(346),Status.MaxNodesCreated=new Status(347),Status.IpFqdnCannotBeSetForSameEndpoint=new Status(348),Status.GossipEndpointCannotHaveFqdn=new Status(349),Status.FqdnSizeTooLarge=new Status(350),Status.InvalidEndpoint=new Status(351),Status.GossipEndpointsExceededLimit=new Status(352),Status.TokenReferenceRepeated=new Status(353),Status.InvalidOwnerId=new Status(354),Status.TokenReferenceListSizeLimitExceeded=new Status(355),Status.ServiceEndpointsExceededLimit=new Status(356),Status.InvalidIpv4Address=new Status(357),Status.EmptyTokenReferenceList=new Status(358),Status.UpdateNodeAccountNotAllowed=new Status(359),Status.TokenHasNoMetadataOrSupplyKey=new Status(360),Status.EmptyPendingAirdropIdList=new Status(361),Status.PendingAirdropIdRepeated=new Status(362),Status.PendingAirdropIdListTooLong=new Status(363),Status.PendingNftAirdropAlreadyExists=new Status(364),Status.AccountHasPendingAirdrops=new Status(365),Status.ThrottledAtConsensus=new Status(366),Status.InvalidPendingAirdropId=new Status(367),Status.TokenAirdropWithFallbackRoyalty=new Status(368),Status.InvalidTokenInPendingAirdrop=new Status(369),Status.ScheduleExpiryIsBusy=new Status(370),Status.InvalidGrpcCertificateHash=new Status(371),Status.MissingExpiryTime=new Status(372),Status.NoSchedulingAllowedAfterScheduledRecursion=new Status(373),Status.RecursiveSchedulingLimitReached=new Status(374),Status.WaitingForLedgerId=new Status(375),Status.MaxEntriesForFeeExemptKeyListExceeded=new Status(376),Status.FeeExemptKeyListContainsDuplicatedKeys=new Status(377),Status.InvalidKeyInFeeExemptKeyList=new Status(378),Status.InvalidFeeScheduleKey=new Status(379),Status.FeeScheduleKeyCannotBeUpdated=new Status(380),Status.FeeScheduleKeyNotSet=new Status(381),Status.MaxCustomFeeLimitExceeded=new Status(382),Status.NoValidMaxCustomFee=new Status(383),Status.InvalidMaxCustomFees=new Status(384),Status.DuplicateDenominationInMaxCustomFeeList=new Status(385),Status.DuplicateAccountIdInMaxCustomFeeList=new Status(386),Status.MaxCustomFeesIsNotSupported=new Status(387),Status.BatchListEmpty=new Status(388),Status.BatchListContainsDuplicates=new Status(389),Status.BatchTransactionInBlacklist=new Status(390),Status.InnerTransactionFailed=new Status(391),Status.MissingBatchKey=new Status(392),Status.BatchKeySetOnNonInnerTransaction=new Status(393),Status.InvalidBatchKey=new Status(394),Status.ScheduleExpiryNotConfigurable=new Status(395),Status.CreatingSystemEntities=new Status(396),Status.ThrottleGroupLcmOverflow=new Status(397),Status.AirdropContainsMultipleSendersForAToken=new Status(398),Status.GrpcWebProxyNotSupported=new Status(399),Status.NftTransfersOnlyAllowedForNonFungibleUnique=new Status(400),Status.InvalidSerializedTxMessageHashAlgorithm=new Status(401),Status.WrongHookEntityType=new Status(499),Status.EvmHookGasThrottled=new Status(500),Status.HookIdInUse=new Status(501),Status.BadHookRequest=new Status(502),Status.RejectedByAccountAllowanceHook=new Status(503),Status.HookNotFound=new Status(504),Status.EvmHookStorageUpdateBytesTooLong=new Status(505),Status.EvmHookStorageUpdateBytesMustUseMinimalRepresentation=new Status(506),Status.InvalidHookId=new Status(507),Status.EmptyEvmHookStorageUpdate=new Status(508),Status.HookIdRepeatedInCreationDetails=new Status(509),Status.HooksNotEnabled=new Status(510),Status.HookIsNotAnEvmHook=new Status(511),Status.HookDeleted=new Status(512),Status.TooManyEvmHookStorageUpdates=new Status(513),Status.HookCreationBytesMustUseMinimalRepresentation=new Status(514),Status.HookCreationBytesTooLong=new Status(515),Status.InvalidHookCreationSpec=new Status(516),Status.HookExtensionEmpty=new Status(517),Status.InvalidHookAdminKey=new Status(518),Status.HookDeletionRequiresZeroStorageSlots=new Status(519),Status.CannotSetHooksAndApproval=new Status(520),Status.TransactionRequiresZeroHooks=new Status(521),Status.InvalidHookCall=new Status(522),Status.HooksAreNotSupportedInAirdrops=new Status(523),Status.AccountIsLinkedToANode=new Status(524),Status.HooksExecutionsRequireTopLevelCryptoTransfer=new Status(525),Status.NodeAccountHasZeroBalance=new Status(526),Status.TransferToFeeCollectionAccountNotAllowed=new Status(527),Status.TooManyHookInvocations=new Status(528);class GrpcStatus{constructor(e){this._code=e,Object.freeze(this)}static _fromValue(e){switch(e){case 0:return GrpcStatus.Ok;case 1:return GrpcStatus.Cancelled;case 2:return GrpcStatus.Unknown;case 3:return GrpcStatus.InvalidArgument;case 4:return GrpcStatus.DeadlineExceeded;case 5:return GrpcStatus.NotFound;case 6:return GrpcStatus.AlreadyExists;case 7:return GrpcStatus.PermissionDenied;case 8:return GrpcStatus.ResourceExhausted;case 9:return GrpcStatus.FailedPrecondition;case 10:return GrpcStatus.Aborted;case 11:return GrpcStatus.OutOfRange;case 12:return GrpcStatus.Unimplemented;case 13:return GrpcStatus.Internal;case 14:return GrpcStatus.Unavailable;case 15:return GrpcStatus.DataLoss;case 16:return GrpcStatus.Unauthenticated;case 17:return GrpcStatus.Timeout;case 18:return GrpcStatus.GrpcWeb;default:throw new Error("(BUG) non-exhaustive GrpcStatus switch statement")}}toString(){switch(this){case GrpcStatus.Ok:return"OK";case GrpcStatus.Cancelled:return"CANCELLED";case GrpcStatus.Unknown:return"UNKNOWN";case GrpcStatus.InvalidArgument:return"INVALID_ARGUMENT";case GrpcStatus.DeadlineExceeded:return"DEADLINE_EXCEEDED";case GrpcStatus.NotFound:return"NOT_FOUND";case GrpcStatus.AlreadyExists:return"ALREADY_EXISTS";case GrpcStatus.PermissionDenied:return"PERMISSION_DENIED";case GrpcStatus.Unauthenticated:return"UNAUTHENTICATED";case GrpcStatus.ResourceExhausted:return"RESOURCE_EXHAUSTED";case GrpcStatus.FailedPrecondition:return"FAILED_PRECONDITION";case GrpcStatus.Aborted:return"ABORTED";case GrpcStatus.OutOfRange:return"OUT_OF_RANGE";case GrpcStatus.Unimplemented:return"UNIMPLEMENTED";case GrpcStatus.Internal:return"INTERNAL";case GrpcStatus.Unavailable:return"UNAVAILABLE";case GrpcStatus.DataLoss:return"DATA_LOSS";case GrpcStatus.Timeout:return"TIMEOUT";case GrpcStatus.GrpcWeb:return"GRPC_WEB";default:return`UNKNOWN (${this._code})`}}valueOf(){return this._code}}GrpcStatus.Ok=new GrpcStatus(0),GrpcStatus.Cancelled=new GrpcStatus(1),GrpcStatus.Unknown=new GrpcStatus(2),GrpcStatus.InvalidArgument=new GrpcStatus(3),GrpcStatus.DeadlineExceeded=new GrpcStatus(4),GrpcStatus.NotFound=new GrpcStatus(5),GrpcStatus.AlreadyExists=new GrpcStatus(6),GrpcStatus.PermissionDenied=new GrpcStatus(7),GrpcStatus.ResourceExhausted=new GrpcStatus(8),GrpcStatus.FailedPrecondition=new GrpcStatus(9),GrpcStatus.Aborted=new GrpcStatus(10),GrpcStatus.OutOfRange=new GrpcStatus(11),GrpcStatus.Unimplemented=new GrpcStatus(12),GrpcStatus.Internal=new GrpcStatus(13),GrpcStatus.Unavailable=new GrpcStatus(14),GrpcStatus.DataLoss=new GrpcStatus(15),GrpcStatus.Unauthenticated=new GrpcStatus(16),GrpcStatus.Timeout=new GrpcStatus(17),GrpcStatus.GrpcWeb=new GrpcStatus(18);class GrpcServiceError extends Error{constructor(e,t){super(`gRPC service failed with: Status: ${e.toString()}, Code: ${e.valueOf()}`),this.status=e,this.nodeAccountId=t,this.name="GrpcServiceError",void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,GrpcServiceError)}static _fromResponse(e){if(null!=e.code&&null!=e.details){const t=GrpcStatus._fromValue(e.code),n=new GrpcServiceError(t);return n.stack+=`\nCaused by: ${e.stack?e.stack.toString():""}`,n.message+=`: ${e.details}`,n}return e}toString(){return`${this.name}: ${this.message}`}}class HttpStatus{constructor(e){this._code=e,Object.freeze(this)}static _fromValue(e){return new HttpStatus(e)}toString(){return this._code.toString()}valueOf(){return this._code}}class HttpError extends Error{constructor(e){super(`failed with error code: ${e.toString()}`),this.status=e,this.name="HttpError",void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,HttpError)}}class MaxAttemptsOrTimeoutError extends Error{constructor(e,t){super(e),this.nodeAccountId=t}toJSON(){return{message:this.message,nodeAccountId:this.nodeAccountId}}toString(){return JSON.stringify(this.toJSON())}valueOf(){return this.toJSON()}}const ExecutionState={Finished:"Finished",Retry:"Retry",Error:"Error"},RST_STREAM=/\brst[^0-9a-zA-Z]stream\b/i;class Executable{constructor(){this._maxAttempts=null,this._nodeAccountIds=new List,this.transactionNodeIds=[],this._signOnDemand=!1,this._minBackoff=null,this._maxBackoff=8e3,this._operator=null,this._requestTimeout=null,this._grpcDeadline=null,this._logger=null}get nodeAccountIds(){return this._nodeAccountIds.isEmpty?null:(this._nodeAccountIds.setLocked(),this._nodeAccountIds.list)}setNodeAccountIds(e){return this._nodeAccountIds.setList(e).setLocked(),this}get maxRetries(){return console.warn("Deprecated: use maxAttempts instead"),this.maxAttempts}setMaxRetries(e){return console.warn("Deprecated: use setMaxAttempts() instead"),this.setMaxAttempts(e)}get maxAttempts(){return this._maxAttempts}setMaxAttempts(e){return this._maxAttempts=e,this}get grpcDeadline(){return this._grpcDeadline}setGrpcDeadline(e){return this._grpcDeadline=e,this}setMinBackoff(e){if(null==e)throw new Error("minBackoff cannot be null.");if(null!=this._maxBackoff&&e>this._maxBackoff)throw new Error("minBackoff cannot be larger than maxBackoff.");return this._minBackoff=e,this}get minBackoff(){return this._minBackoff}setMaxBackoff(e){if(null==e)throw new Error("maxBackoff cannot be null.");if(null!=this._minBackoff&&e<this._minBackoff)throw new Error("maxBackoff cannot be smaller than minBackoff.");return this._maxBackoff=e,this}get maxBackoff(){return this._maxBackoff}_beforeExecute(e){throw new Error("not implemented")}_makeRequestAsync(){throw new Error("not implemented")}_mapStatusError(e,t,n){throw new Error("not implemented")}_mapResponse(e,t,n){throw new Error("not implemented")}_execute(e,t){throw new Error("not implemented")}_getTransactionId(){throw new Error("not implemented")}_getLogId(){throw new Error("not implemented")}_requestToBytes(e){throw new Error("not implemented")}_responseToBytes(e){throw new Error("not implemented")}_getStatusAndExecutionState(e,t){throw new Error("not implemented")}_shouldRetryExceptionally(e){return!(e instanceof GrpcServiceError)||(e.status._code===GrpcStatus.Timeout._code||e.status._code===GrpcStatus.DeadlineExceeded._code||e.status._code===GrpcStatus.Unavailable._code||e.status._code===GrpcStatus.ResourceExhausted._code||e.status._code===GrpcStatus.GrpcWeb._code||e.status._code===GrpcStatus.Internal._code&&RST_STREAM.test(e.message))}_shouldRetryRequestError(e,t){return(e instanceof GrpcServiceError||e instanceof HttpError)&&this._shouldRetryExceptionally(e)&&t<=this._maxAttempts}_setOperatorWith(e,t,n){return this._operator={transactionSigner:n,accountId:e,publicKey:t},this}async executeWithSigner(e){return e.call(this)}isBatchedAndNotBatchTransaction(){return!1}_validateTransactionNodeIds(){if(!this.transactionNodeIds.length)return;const e=this._nodeAccountIds.list.map(e=>e.toString());if(this.transactionNodeIds.some(t=>e.includes(t)))return;const t=e.length>2?`${e.slice(0,2).join(", ")} ...`:e.join(", "),n=1===e.length;throw new Error(`Attempting to execute a transaction against node${n?"":"s"} ${t}, which ${n?"is":"are"} not included in the Client's node list. Please review your Client configuration.`)}async _setupExecution(e,t){if(this.isBatchedAndNotBatchTransaction())throw new Error("Cannot execute batchified transaction outside of BatchTransaction");this._logger=this._logger??e._logger,null==this._requestTimeout&&(this._requestTimeout=t||e.requestTimeout),null==this._grpcDeadline&&(this._grpcDeadline=e.grpcDeadline),null==this._maxBackoff&&(this._maxBackoff=e.maxBackoff),null==this._minBackoff&&(this._minBackoff=e.minBackoff),null==this._maxAttempts&&(this._maxAttempts=e.maxAttempts),await this._beforeExecute(e)}_getExecutionNode(e){let t;if(this._nodeAccountIds.isEmpty?(t=e._network.getNode(),this._nodeAccountIds.setList([t.accountId])):t=e._network.getNode(this._nodeAccountIds.current),null==t)throw new Error(`NodeAccountId not recognized: ${this._nodeAccountIds.current.toString()}`);return t}_shouldSkipAttemptForNodeAccountId(e){if(!this.transactionNodeIds.length)return!1;return!this.transactionNodeIds.includes(e.toString())}async _handleUnhealthyNode(e,t,n,r){if(isTransactionReceiptOrRecordRequest(t)&&this._nodeAccountIds.length<=1||r)return void await delayForAttempt(r,n,this._minBackoff,this._maxBackoff);if(this._nodeAccountIds.index===this._nodeAccountIds.list.length-1)throw new Error(`Network connectivity issue: All nodes are unhealthy. Original node list: ${this._nodeAccountIds.list.join(", ")}`);this._logger?.debug(`[${this._getLogId()}] Node is not healthy, trying the next node.`),this._nodeAccountIds.advance()}async _handleInvalidNodeAccountId(e,t,n){this._logger?.debug(`[${this._getLogId()}] node with accountId: ${n.toString()} and proxy IP: ${t.address.toString()} has invalid node account ID, marking as unhealthy and updating network`),e._network.increaseBackoff(t);try{e.mirrorNetwork.length>0?await e.updateNetwork():this._logger?.warn(`[${this._getLogId()}] Cannot update address book: no mirror network configured. Retrying with existing network configuration.`)}catch(e){const t=e instanceof Error?e.message:String(e);this._logger?.trace(`[${this._getLogId()}] failed to update client address book after INVALID_NODE_ACCOUNT_ID: ${t}`)}}async _executeRequestWithGrpcDeadline(e,t){const n=[];let r=null;null!=this._grpcDeadline&&n.push(new Promise((e,t)=>{r=setTimeout(()=>t(new GrpcServiceError(GrpcStatus.DeadlineExceeded)),this._grpcDeadline)})),this._logger?.trace(`[${this._getLogId()}] sending protobuf ${encode$4(this._requestToBytes(t))}`),n.push(this._execute(e,t));try{return await Promise.race(n)}finally{null!=r&&clearTimeout(r)}}async execute(e,t){await this._setupExecution(e,t);const n=e.isLocalNetwork;this._validateTransactionNodeIds();const r=Date.now();let o=null;for(let t=1;t<=this._maxAttempts;t+=1){if(null!=this._requestTimeout&&r+this._requestTimeout<=Date.now())throw new MaxAttemptsOrTimeoutError("timeout exceeded",this._nodeAccountIds.isEmpty?"No node account ID set":this._nodeAccountIds.current.toString());if(this._shouldSkipAttemptForNodeAccountId(this._nodeAccountIds.current)){console.error(`Attempting to execute a transaction against node ${this._nodeAccountIds.current.toString()}, which is not included in the Client's node list. Please review your Client configuration.`),this._nodeAccountIds.advance();continue}const a=this._getExecutionNode(e);this._logger?.debug(`[${this._getLogId()}] Node AccountID: ${a.accountId.toString()}, IP: ${a.address.toString()}`);const i=a.getChannel();null!=this._grpcDeadline&&i.setGrpcDeadline(this._grpcDeadline);const s=await this._makeRequestAsync();if(!a.isHealthy()){await this._handleUnhealthyNode(a,s,t,n);continue}let c;this._nodeAccountIds.advance();try{c=await this._executeRequestWithGrpcDeadline(i,s)}catch(n){const r=GrpcServiceError._fromResponse(n);if(o=r,this._logger?.debug(`[${this._getLogId()}] received error ${JSON.stringify(r)}`),this._shouldRetryRequestError(r,t)){this._logger?.debug(`[${this._getLogId()}] node with accountId: ${a.accountId.toString()} and proxy IP: ${a.address.toString()} is unhealthy`),a.isHealthy()&&e._network.increaseBackoff(a);continue}throw n}this._logger?.trace(`[${this._getLogId()}] sending protobuf ${encode$4(this._responseToBytes(c))}`),e._network.decreaseBackoff(a);const[u,l]=this._getStatusAndExecutionState(s,c);switch(u.toString()!==Status.Ok.toString()&&u.toString()!==Status.Success.toString()&&(o=u),l){case ExecutionState.Retry:u===Status.InvalidNodeAccount&&await this._handleInvalidNodeAccountId(e,a,a.accountId),await delayForAttempt(n,t,this._minBackoff,this._maxBackoff);continue;case ExecutionState.Finished:return this._mapResponse(c,a.accountId,s);case ExecutionState.Error:throw this._mapStatusError(s,c,a.accountId);default:throw new Error("(BUG) non-exhaustive switch statement for `ExecutionState`")}}throw new MaxAttemptsOrTimeoutError(`max attempts of ${this._maxAttempts.toString()} was reached for request with last error being: ${null!=o?o.toString():""}`,this._nodeAccountIds.current.toString())}toBytes(){throw new Error("not implemented")}setLogger(e){return this._logger=e,this}get logger(){return this._logger}}function isTransactionReceiptOrRecordRequest(e){return"object"==typeof e&&null!==e&&("transactionGetReceipt"in e||"transactionGetRecord"in e)}function delayForAttempt(e,t,n,r){if(e)return new Promise(e=>setTimeout(e,n));const o=Math.min(Math.floor(n*Math.pow(2,t)),r);return new Promise(e=>setTimeout(e,o))}class PrecheckStatusError extends StatusError{constructor(e){super(e,`transaction ${e.transactionId.toString()} failed precheck with status ${e.status.toString()} against node account id ${e.nodeId.toString()}`),this.contractFunctionResult=e.contractFunctionResult,this.nodeId=e.nodeId}toJSON(){return{name:this.name,status:this.status.toString(),transactionId:this.transactionId.toString(),nodeId:this.nodeId.toString(),message:this.message,contractFunctionResult:this.contractFunctionResult}}}class MaxQueryPaymentExceeded extends Error{constructor(e,t){super(),this.message=`query cost of ${e.toString()} HBAR exceeds max set on client: ${t.toString()} HBAR`,this.name="MaxQueryPaymentExceededError",this.queryCost=e,this.maxQueryPayment=t}}class QueryBase extends Executable{constructor(){super()}async _makePaymentTransaction(e,t,n,r){const o=[];null!=n?(o.push({accountID:n.accountId._toProtobuf(),amount:r.negated().toTinybars()}),o.push({accountID:t._toProtobuf(),amount:r.toTinybars()})):(o.push({accountID:new AccountId(0)._toProtobuf(),amount:r.negated().toTinybars()}),o.push({accountID:t._toProtobuf(),amount:r.toTinybars()}));const a={transactionID:e._toProtobuf(),nodeAccountID:t._toProtobuf(),transactionFee:new Hbar(1).toTinybars(),transactionValidDuration:{seconds:Long.fromNumber(120)},cryptoTransfer:{transfers:{accountAmounts:o}}},i={bodyBytes:libExports.proto.TransactionBody.encode(a).finish()};if(null!=n){const e=await n.transactionSigner(i.bodyBytes);i.sigMap={sigPair:[n.publicKey._toProtobufSignature(e)]}}return{signedTransactionBytes:libExports.proto.SignedTransaction.encode(i).finish()}}}class CostQuery extends QueryBase{constructor(e){super(),this._query=e,this._grpcDeadline=e._grpcDeadline,this._requestTimeout=e._requestTimeout,this._nodeAccountIds=e._nodeAccountIds.clone(),this._operator=e._operator,this._header=null}_getTransactionId(){return this._query._getTransactionId()}_getLogId(){return`CostQuery:${this._query._getLogId()}`}async _beforeExecute(e){if(null==e)throw new Error("Cannot do CostQuery without Client");const t=null!=this._operator?this._operator:e._operator;if(null==t)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._query._nodeAccountIds.isEmpty&&this._query._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute());const n=TransactionId.generate(t.accountId);null==this._query.paymentTransactionId&&this._query.setPaymentTransactionId(n);const r=this._getLogId(),o=new AccountId(0),a=TransactionId.generate(new AccountId(0)),i=new Hbar(0);this._logger&&this._logger.debug(`[${r}] making a payment transaction for node ${o.toString()} and transaction ID ${a.toString()} with amount ${i.toString()}`),this._header={payment:await this._makePaymentTransaction(a,new AccountId(0),t,i),responseType:libExports.proto.ResponseType.COST_ANSWER}}_makeRequestAsync(){return Promise.resolve(this._query._onMakeRequest(this._header))}_getStatusAndExecutionState(e,t){return this._query._getStatusAndExecutionState(e,t)}_mapStatusError(e,t,n){return this._query._mapStatusError(e,t,n)}_mapResponse(e,t,n){const r=this._query._mapResponseHeader(e).cost;return Promise.resolve(Hbar.fromTinybars(r))}_execute(e,t){return this._query._execute(e,t)}_requestToBytes(e){return this._query._requestToBytes(e)}_responseToBytes(e){return this._query._responseToBytes(e)}}const QUERY_REGISTRY=new Map;class Query extends QueryBase{constructor(){super(),this._paymentTransactionId=null,this._paymentTransactions=[],this._queryPayment=null,this._maxQueryPayment=null,this._timestamp=Date.now()}static fromBytes(e){const t=libExports.proto.Query.decode(e);if(null==t.query)throw new Error("(BUG) query.query was not set in the protobuf");const n=QUERY_REGISTRY.get(t.query);if(null==n)throw new Error(`(BUG) Query.fromBytes() not implemented for type ${t.query}`);return n(t)}toBytes(){return libExports.proto.Query.encode(this._makeRequest()).finish()}setQueryPayment(e){return this._queryPayment=e,this}setMaxQueryPayment(e){return this._maxQueryPayment=e,this}async getCost(e){this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute()),this._timestamp=Date.now();const t=await new CostQuery(this).execute(e);return Hbar.fromTinybars(t._valueInTinybar.multipliedBy(1.1).toFixed(0))}setPaymentTransactionId(e){return this._paymentTransactionId=e,this}get paymentTransactionId(){return this._paymentTransactionId}_getTransactionId(){if(null==this._paymentTransactionId)throw new Error("Query.PaymentTransactionId was not set duration execution");return this._paymentTransactionId}_isPaymentRequired(){return!0}_validateChecksums(e){}async _beforeExecute(e){if(this._paymentTransactions.length>0)return;if(e.isAutoValidateChecksumsEnabled()&&this._validateChecksums(e),this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute()),this._operator=null!=this._operator?this._operator:e._operator,this._isPaymentRequired()){if(this.transactionNodeIds=Object.values(e.network).map(e=>e.toString()),null==this._operator)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._paymentTransactionId=TransactionId.generate(this._operator.accountId)}else this._paymentTransactionId=TransactionId.generate(new AccountId(0));let t=new Hbar(0);const n=null!=this._maxQueryPayment?this._maxQueryPayment:e.defaultMaxQueryPayment;if(null!=this._queryPayment)t=this._queryPayment;else if(0===this._paymentTransactions.length&&this._isPaymentRequired()){const r=await this.getCost(e);if(n.toTinybars().toInt()<r.toTinybars().toInt())throw new MaxQueryPaymentExceeded(r,n);t=r,this._logger&&this._logger.debug(`[${this._getLogId()}] received cost for query ${t.toString()}`)}this._queryPayment=t,this._timestamp=Date.now(),this._nodeAccountIds.setLocked();for(const e of this._nodeAccountIds.list){const t=this._getLogId(),n=this._paymentTransactionId,r=this._queryPayment;this._logger&&this._logger.debug(`[${t}] making a payment transaction for node ${e.toString()} and transaction ID ${n.toString()} with amount ${r.toString()}`),this._paymentTransactions.push(await this._makePaymentTransaction(n,e,this._isPaymentRequired()?this._operator:null,r))}}_mapResponseHeader(e){throw new Error("not implemented")}_makeRequestHeader(){let e={};return this._isPaymentRequired()&&this._paymentTransactions.length>0&&(e={responseType:libExports.proto.ResponseType.ANSWER_ONLY,payment:this._paymentTransactions[this._nodeAccountIds.index]}),e}_onMakeRequest(e){throw new Error("not implemented")}_makeRequest(){let e={};return this._isPaymentRequired()&&null!=this._paymentTransactions&&(e={payment:this._paymentTransactions[this._nodeAccountIds.index],responseType:libExports.proto.ResponseType.ANSWER_ONLY}),this._onMakeRequest(e)}async _makeRequestAsync(){let e={responseType:libExports.proto.ResponseType.ANSWER_ONLY};const t=this._getLogId(),n=this._nodeAccountIds.current,r=TransactionId.generate(this._operator?this._operator.accountId:new AccountId(0)),o=this._queryPayment;return this._logger&&this._logger.debug(`[${t}] making a payment transaction for node ${n.toString()} and transaction ID ${r.toString()} with amount ${o.toString()}`),e.payment=await this._makePaymentTransaction(r,n,this._isPaymentRequired()?this._operator:null,o),this._onMakeRequest(e)}_getStatusAndExecutionState(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t),r=Status._fromCode(null!=n?n:libExports.proto.ResponseCodeEnum.OK);switch(this._logger?.debug(`[${this._getLogId()}] received status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.PlatformTransactionNotCreated:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:return[r,ExecutionState.Finished];default:return[r,ExecutionState.Error]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t),o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}_requestToBytes(e){return libExports.proto.Query.encode(e).finish()}_responseToBytes(e){return libExports.proto.Response.encode(e).finish()}}class ContractId extends Key{constructor(e,t,n,r){super();const o=constructor(e,t,n);this.shard=o.shard,this.realm=o.realm,this.num=o.num,this.evmAddress=null!=r?r:null,this._checksum=null}static fromEvmAddress(e,t,n){const r=EvmAddress.fromString(n),[o,a,i,s]=fromEvmAddress(e,t,r.toString());return new ContractId(o,a,i,s?.toBytes())}static fromString(e){const t=fromStringSplitter(e);if(Number.isNaN(t.shard)||Number.isNaN(t.realm))throw new Error("invalid format for entity ID");const n=null!=t.shard?Long.fromString(t.shard):Long.ZERO,r=null!=t.realm?Long.fromString(t.realm):Long.ZERO,[o,a]=t.numOrHex.length<40?[Long.fromString(t.numOrHex),void 0]:[Long.ZERO,decode$7(t.numOrHex)];return new ContractId(n,r,o,a)}static _fromProtobuf(e){return new ContractId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.contractNum?e.contractNum:0)}get checksum(){return this._checksum}async populateAccountNum(e){const t=`${e.mirrorRestApiBaseUrl}/contracts/${this.toEvmAddress()}`,n=await fetch(t),r=(await n.json()).contract_id;return this.num=Long.fromString(r.slice(r.lastIndexOf(".")+1)),this}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return ContractId._fromProtobuf(libExports.proto.ContractID.decode(e))}static fromSolidityAddress(e){return isLongZeroAddress(decode$7(e))?new ContractId(...fromSolidityAddress(e)):this.fromEvmAddress(0,0,e)}toSolidityAddress(){return null!=this.evmAddress?encode$4(this.evmAddress):toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?toEvmAddress(this.evmAddress):toEvmAddress(this.num)}_toProtobuf(){return{contractNum:this.num,shardNum:this.shard,realmNum:this.realm,evmAddress:this.evmAddress}}toString(){return null!=this.evmAddress?`${this.shard.toString()}.${this.realm.toString()}.${encode$4(this.evmAddress)}`:`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.ContractID.encode(this._toProtobuf()).finish()}clone(){const e=new ContractId(this);return e._checksum=this._checksum,e.evmAddress=this.evmAddress,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}equals(e){let t=!1;return null!=this.evmAddress&&null!=e.evmAddress&&(t=arrayEqual(this.evmAddress,e.evmAddress)),this.shard.eq(e.shard)&&this.realm.eq(e.realm)&&this.num.eq(e.num)&&t}_toProtobufKey(){return{contractID:this._toProtobuf()}}static __fromProtobufKey(e){return ContractId._fromProtobuf(e)}}CACHE.setContractId(e=>ContractId.__fromProtobufKey(e));class FileId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static getAddressBookFileIdFor(e=0,t=0){return new FileId({num:102,shard:e,realm:t})}static getFeeScheduleFileIdFor(e=0,t=0){return new FileId({num:111,shard:e,realm:t})}static getExchangeRatesFileIdFor(e=0,t=0){return new FileId({num:112,shard:e,realm:t})}static fromString(e){const t=fromString(e),n=new FileId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new FileId(null!=e.shardNum?Long.fromString(e.shardNum.toString()):0,null!=e.realmNum?Long.fromString(e.realmNum.toString()):0,null!=e.fileNum?Long.fromString(e.fileNum.toString()):0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return FileId._fromProtobuf(libExports.proto.FileID.decode(e))}static fromSolidityAddress(e){const[t,n,r]=fromSolidityAddress(e);return new FileId(t,n,r)}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("FileId.fromEvmAddress does not support non-long-zero addresses");const[r,o,a]=fromEvmAddress(e,t,n);return new FileId(r,o,a)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{fileNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.FileID.encode(this._toProtobuf()).finish()}clone(){const e=new FileId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}FileId.ADDRESS_BOOK=new FileId(102),FileId.FEE_SCHEDULE=new FileId(111),FileId.EXCHANGE_RATES=new FileId(112);class TopicId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new TopicId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new TopicId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.topicNum?e.topicNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return TopicId._fromProtobuf(libExports.proto.TopicID.decode(e))}static fromSolidityAddress(e){const[t,n,r]=fromSolidityAddress(e);return new TopicId(t,n,r)}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("TopicId.fromEvmAddress does not support non-long-zero addresses");const[r,o,a]=fromEvmAddress(e,t,n);return new TopicId(r,o,a)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{topicNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.TopicID.encode(this._toProtobuf()).finish()}clone(){const e=new TopicId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class TokenId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new TokenId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new TokenId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.tokenNum?e.tokenNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return TokenId._fromProtobuf(libExports.proto.TokenID.decode(e))}static fromSolidityAddress(e){return new TokenId(...fromSolidityAddress(e))}static fromEvmAddress(e,t,n){if(!isLongZeroAddress(EvmAddress.fromString(n).toBytes()))throw new Error("TokenId.fromEvmAddress does not support non-long-zero addresses");const[r,o,a]=fromEvmAddress(e,t,n);return new TokenId(r,o,a)}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}toEvmAddress(){return toEvmAddress(this.num)}_toProtobuf(){return{tokenNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.TokenID.encode(this._toProtobuf()).finish()}clone(){const e=new TokenId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class ScheduleId{constructor(e,t,n){const r=constructor(e,t,n);this.shard=r.shard,this.realm=r.realm,this.num=r.num,this._checksum=null}static fromString(e){const t=fromString(e),n=new ScheduleId(t);return n._checksum=t.checksum,n}static _fromProtobuf(e){return new ScheduleId(null!=e.shardNum?e.shardNum:0,null!=e.realmNum?e.realmNum:0,null!=e.scheduleNum?e.scheduleNum:0)}get checksum(){return this._checksum}validate(e){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(e)}validateChecksum(e){validateChecksum(this.shard,this.realm,this.num,this._checksum,e)}static fromBytes(e){return ScheduleId._fromProtobuf(libExports.proto.ScheduleID.decode(e))}static fromSolidityAddress(e){return new ScheduleId(...fromSolidityAddress(e))}toSolidityAddress(){return toSolidityAddress([this.shard,this.realm,this.num])}_toProtobuf(){return{scheduleNum:this.num,shardNum:this.shard,realmNum:this.realm}}toString(){return`${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`}toStringWithChecksum(e){return toStringWithChecksum(this.toString(),e)}toBytes(){return libExports.proto.ScheduleID.encode(this._toProtobuf()).finish()}clone(){const e=new ScheduleId(this);return e._checksum=this._checksum,e}compare(e){return compare([this.shard,this.realm,this.num],[e.shard,e.realm,e.num])}}class ExchangeRate{constructor(e){this.hbars=e.hbars,this.cents=e.cents,this.expirationTime=e.expirationTime,this.exchangeRateInCents=e.cents/e.hbars,Object.freeze(this)}static _fromProtobuf(e){return new ExchangeRate({hbars:e.hbarEquiv,cents:e.centEquiv,expirationTime:new Date(null!=e.expirationTime&&null!=e.expirationTime.seconds?Long.isLong(e.expirationTime.seconds)?1e3*e.expirationTime.seconds.toNumber():1e3*e.expirationTime.seconds:0)})}_toProtobuf(){return{hbarEquiv:this.hbars,centEquiv:this.cents,expirationTime:{seconds:Long.fromNumber(Math.trunc(this.expirationTime.getTime()/1e3))}}}toJSON(){return{hbars:this.hbars,cents:this.cents,expirationTime:this.expirationTime,exchangeRateInCents:this.exchangeRateInCents}}toString(){return JSON.stringify(this.toJSON())}}class TransactionReceipt{constructor(e){this.status=e.status,this.accountId=e.accountId,this.fileId=e.fileId,this.contractId=e.contractId,this.topicId=e.topicId,this.tokenId=e.tokenId,this.scheduleId=e.scheduleId,this.exchangeRate=e.exchangeRate,this.nextExchangeRate=e.nextExchangeRate,this.topicSequenceNumber=e.topicSequenceNumber,this.topicRunningHash=e.topicRunningHash,this.totalSupply=e.totalSupply,this.scheduledTransactionId=e.scheduledTransactionId,this.serials=e.serials??[],this.duplicates=e.duplicates??[],this.children=e.children??[],this.nodeId=e.nodeId,Object.freeze(this)}_toProtobuf(){return{duplicateTransactionReceipts:this.duplicates.map(e=>e._toProtobuf().receipt),childTransactionReceipts:this.children.map(e=>e._toProtobuf().receipt),receipt:{status:this.status.valueOf(),accountID:null!=this.accountId?this.accountId._toProtobuf():null,fileID:null!=this.fileId?this.fileId._toProtobuf():null,contractID:null!=this.contractId?this.contractId._toProtobuf():null,topicID:null!=this.topicId?this.topicId._toProtobuf():null,tokenID:null!=this.tokenId?this.tokenId._toProtobuf():null,scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,topicRunningHash:null==this.topicRunningHash?null:this.topicRunningHash,topicSequenceNumber:this.topicSequenceNumber,exchangeRate:{nextRate:null!=this.nextExchangeRate?this.nextExchangeRate._toProtobuf():null,currentRate:null!=this.exchangeRate?this.exchangeRate._toProtobuf():null},scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,serialNumbers:this.serials,newTotalSupply:this.totalSupply,nodeId:this.nodeId}}}static _fromProtobuf(e){const t=e.receipt,n=null!=e.childTransactionReceipts?e.childTransactionReceipts.map(e=>TransactionReceipt._fromProtobuf({receipt:e})):[],r=null!=e.duplicateTransactionReceipts?e.duplicateTransactionReceipts.map(e=>TransactionReceipt._fromProtobuf({receipt:e})):[];return new TransactionReceipt({status:Status._fromCode(null!=t.status?t.status:0),accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):null,fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):null,contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):null,topicId:null!=t.topicID?TopicId._fromProtobuf(t.topicID):null,tokenId:null!=t.tokenID?TokenId._fromProtobuf(t.tokenID):null,scheduleId:null!=t.scheduleID?ScheduleId._fromProtobuf(t.scheduleID):null,exchangeRate:null!=t.exchangeRate?ExchangeRate._fromProtobuf(t.exchangeRate.currentRate):null,nextExchangeRate:null!=t.exchangeRate?ExchangeRate._fromProtobuf(t.exchangeRate.nextRate):null,topicSequenceNumber:null==t.topicSequenceNumber?null:Long.fromString(t.topicSequenceNumber.toString()),topicRunningHash:null!=t.topicRunningHash?new Uint8Array(t.topicRunningHash):null,totalSupply:null!=t.newTotalSupply?Long.fromString(t.newTotalSupply.toString()):null,scheduledTransactionId:null!=t.scheduledTransactionID?TransactionId._fromProtobuf(t.scheduledTransactionID):null,serials:null!=t.serialNumbers?t.serialNumbers.map(e=>Long.fromValue(e)):[],children:n,duplicates:r,nodeId:null!=t.nodeId?t.nodeId:null})}static fromBytes(e){return TransactionReceipt._fromProtobuf(libExports.proto.TransactionGetReceiptResponse.decode(e))}toBytes(){return libExports.proto.TransactionGetReceiptResponse.encode(this._toProtobuf()).finish()}toJSON(){return{status:this.status.toString(),accountId:this.accountId?.toString()||null,filedId:this.fileId?.toString()||null,contractId:this.contractId?.toString()||null,topicId:this.topicId?.toString()||null,tokenId:this.tokenId?.toString()||null,scheduleId:this.scheduleId?.toString()||null,exchangeRate:this.exchangeRate?.toJSON()||null,nextExchangeRate:this.nextExchangeRate?.toJSON()||null,topicSequenceNumber:this.topicSequenceNumber?.toString()||null,topicRunningHash:null!=this.topicRunningHash?encode$4(this.topicRunningHash):null,totalSupply:this.totalSupply?.toString()||null,scheduledTransactionId:this.scheduledTransactionId?.toString()||null,serials:this.serials.map(e=>e.toString()),duplicates:this.duplicates.map(e=>e.toJSON()),children:this.children.map(e=>e.toJSON()),nodeId:this.nodeId?.toString()||null}}toString(){return JSON.stringify(this.toJSON())}}const{proto:proto$7}=HieroProto;class TransactionReceiptQuery extends Query{constructor(e={}){super(),this._transactionId=null,this._includeChildren=null,this._includeDuplicates=null,this._validateStatus=!0,null!=e.transactionId&&this.setTransactionId(e.transactionId),null!=e.includeChildren&&this.setIncludeChildren(e.includeChildren),null!=e.includeDuplicates&&this.setIncludeDuplicates(e.includeDuplicates),null!=e.validateStatus&&this.setValidateStatus(e.validateStatus)}static _fromProtobuf(e){const t=e.transactionGetReceipt;return new TransactionReceiptQuery({transactionId:t.transactionID?TransactionId._fromProtobuf(t.transactionID):void 0,includeDuplicates:null!=t.includeDuplicates?t.includeDuplicates:void 0,includeChildren:null!=t.includeChildReceipts?t.includeChildReceipts:void 0})}get transactionId(){return this._transactionId}setTransactionId(e){return this._transactionId="string"==typeof e?TransactionId.fromString(e):e.clone(),this}setIncludeDuplicates(e){return this._includeDuplicates=e,this}get includeDuplicates(){return null!=this._includeDuplicates&&this._includeDuplicates}setIncludeChildren(e){return this._includeChildren=e,this}get includeChildren(){return null!=this._includeChildren&&this._includeChildren}setValidateStatus(e){return this._validateStatus=e,this}get validateStatus(){return this._validateStatus}_isPaymentRequired(){return!1}_getStatusAndExecutionState(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t);let r=Status._fromCode(null!=n?n:proto$7.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received node precheck status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:break;default:return[r,ExecutionState.Error]}const o=t.transactionGetReceipt.receipt.status;switch(r=Status._fromCode(o),this._logger&&this._logger.debug(`[${this._getLogId()}] received receipt status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:return[r,ExecutionState.Retry];case Status.Success:case Status.FeeScheduleFilePartUploaded:return[r,ExecutionState.Finished];default:return[r,this._validateStatus?ExecutionState.Error:ExecutionState.Finished]}}_getTransactionId(){return null!=this._transactionId?this._transactionId:super._getTransactionId()}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t);let o=Status._fromCode(null!=r?r:proto$7.ResponseCodeEnum.OK);if(o!==Status.Ok)return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null});const a=t.transactionGetReceipt,i=a.receipt.status;if(o=Status._fromCode(i),null==this._transactionId)throw new Error("Failed to construct `ReceiptStatusError` because `transactionId` is `null`");return new ReceiptStatusError({status:o,transactionId:this._transactionId,transactionReceipt:TransactionReceipt._fromProtobuf(a)})}_validateChecksums(e){null!=this._transactionId&&null!=this._transactionId.accountId&&this._transactionId.accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getTransactionReceipts(t)}_mapResponseHeader(e){return e.transactionGetReceipt.header}_mapResponse(e,t,n){const r=e.transactionGetReceipt;return Promise.resolve(TransactionReceipt._fromProtobuf(r))}_onMakeRequest(e){return{transactionGetReceipt:{header:e,transactionID:null!=this._transactionId?this._transactionId._toProtobuf():null,includeDuplicates:this._includeDuplicates,includeChildReceipts:this._includeChildren}}}_getLogId(){return`TransactionReceiptQuery:${this._timestamp.toString()}`}}QUERY_REGISTRY.set("transactionGetReceipt",TransactionReceiptQuery._fromProtobuf);class EvmHookCall{constructor(e={}){this._data=null,this._gasLimit=null,null!=e.data&&this.setData(e.data),null!=e.gasLimit&&this.setGasLimit(e.gasLimit)}setData(e){return this._data=e,this}setGasLimit(e){return this._gasLimit=e,this}get data(){return this._data}get gasLimit(){return this._gasLimit}static _fromProtobuf(e){return new EvmHookCall({data:e.data?e.data:void 0,gasLimit:e.gasLimit?e.gasLimit:void 0})}_toProtobuf(){return{data:this._data,gasLimit:this._gasLimit?this._gasLimit:null}}}class HookCall{constructor(e={}){void 0!==e.hookId&&this.setHookId(e.hookId),void 0!==e.evmHookCall&&this.setCall(e.evmHookCall)}setHookId(e){return this._hookId=e,this}setCall(e){return this._evmHookCall=e,this}get hookId(){return this._hookId}get evmHookCall(){return this._evmHookCall}static _fromProtobuf(e){return new HookCall({hookId:e.hookId??void 0,evmHookCall:e.evmHookCall?EvmHookCall._fromProtobuf(e.evmHookCall):void 0})}_toProtobuf(){return{hookId:this._hookId,evmHookCall:this._evmHookCall?._toProtobuf()}}}const FungibleHookType=Object.freeze({PRE_TX_ALLOWANCE_HOOK:0,PRE_POST_TX_ALLOWANCE_HOOK:1});class FungibleHookCall extends HookCall{constructor(e){if(super(e),null==e.type)throw new Error("type cannot be null");this._type=e.type}get type(){return this._type}static _fromProtobufWithType(e,t){return new FungibleHookCall({hookId:null!=e.hookId?e.hookId:void 0,evmHookCall:e.evmHookCall?EvmHookCall._fromProtobuf(e.evmHookCall):void 0,type:t})}}class Transfer{constructor(e){this.accountId=e.accountId instanceof AccountId?e.accountId:AccountId.fromString(e.accountId),this.amount=e.amount instanceof Hbar?e.amount:new Hbar(e.amount),this.isApproved=e.isApproved,this.hookCall=e.hookCall}static _fromProtobuf(e){const t=[];for(const n of e){let e;null!=n.preTxAllowanceHook?e=FungibleHookCall._fromProtobufWithType(n.preTxAllowanceHook,FungibleHookType.PRE_TX_ALLOWANCE_HOOK):null!=n.prePostTxAllowanceHook&&(e=FungibleHookCall._fromProtobufWithType(n.prePostTxAllowanceHook,FungibleHookType.PRE_POST_TX_ALLOWANCE_HOOK)),t.push(new Transfer({accountId:AccountId._fromProtobuf(n.accountID),amount:Hbar.fromTinybars(null!=n.amount?n.amount:0),isApproved:n.isApproval,hookCall:e}))}return t}_toProtobuf(){const e={accountID:this.accountId._toProtobuf(),amount:this.amount.toTinybars(),isApproval:this.isApproved};if(null!=this.hookCall)switch(this.hookCall.type){case FungibleHookType.PRE_TX_ALLOWANCE_HOOK:e.preTxAllowanceHook=this.hookCall._toProtobuf();break;case FungibleHookType.PRE_POST_TX_ALLOWANCE_HOOK:e.prePostTxAllowanceHook=this.hookCall._toProtobuf()}return e}toJSON(){return{accountId:this.accountId.toString(),amount:this.amount.toTinybars().toString(),isApproved:this.isApproved}}toString(){return JSON.stringify(this.toJSON())}}class ContractLogInfo{constructor(e){this.contractId=e.contractId,this.bloom=e.bloom,this.topics=e.topics,this.data=e.data,Object.freeze(this)}static _fromProtobuf(e){return new ContractLogInfo({contractId:ContractId._fromProtobuf(e.contractID),bloom:null!=e.bloom?e.bloom:new Uint8Array,topics:null!=e.topic?e.topic:[],data:null!=e.data?e.data:new Uint8Array})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),bloom:this.bloom,topic:this.topics,data:this.data}}}function decode(e){return(new TextDecoder).decode(e)}function encode(e){return(new TextEncoder).encode(e)}const{proto:proto$6}=HieroProto;class ContractNonceInfo{constructor(e){this.contractId=e.contractId,this.nonce=e.nonce,Object.freeze(this)}static _fromProtobuf(e){return new ContractNonceInfo({contractId:ContractId._fromProtobuf(e.contractId),nonce:null!=e.nonce?e.nonce:Long.ZERO})}_toProtobuf(){return{contractId:this.contractId._toProtobuf(),nonce:this.nonce}}static fromBytes(e){return ContractNonceInfo._fromProtobuf(proto$6.ContractNonceInfo.decode(e))}toBytes(){return proto$6.ContractNonceInfo.encode(this._toProtobuf()).finish()}toJSON(){return{contractId:this.contractId.toString(),nonce:this.nonce.toNumber()}}toString(){return JSON.stringify(this.toJSON())}equals(e){return this.contractId.equals(e.contractId)&&this.nonce.eq(e.nonce)}}const defaultAbiCoder$1=AbiCoder.defaultAbiCoder();class ContractFunctionResult{constructor(e){this._createResult=e._createResult,this.contractId=e.contractId,this.bytes=e.bytes,this.errorMessage=e.errorMessage,this.bloom=e.bloom,this.gasUsed=e.gasUsed,this.logs=e.logs,this.createdContractIds=e.createdContractIds,this.evmAddress=e.evmAddress,this.stateChanges=e.stateChanges,this.gas=e.gas,this.amount=e.amount,this.functionParameters=e.functionParameters,this.senderAccountId=e.senderAccountId,this.contractNonces=e.contractNonces,this.signerNonce=e.signerNonce}static _fromProtobuf(e,t){const n=e.contractID,r=e.gasUsed,o=e.gas?e.gas:-1,a=e.amount?e.amount:-1;return new ContractFunctionResult({_createResult:t,bytes:e.contractCallResult,contractId:null!=n?ContractId._fromProtobuf(n):null,errorMessage:null!=e.errorMessage?e.errorMessage:null,bloom:e.bloom,gasUsed:r instanceof Long?r:Long.fromValue(r),logs:(null!=e.logInfo?e.logInfo:[]).map(e=>ContractLogInfo._fromProtobuf(e)),createdContractIds:(null!=e.createdContractIDs?e.createdContractIDs:[]).map(e=>ContractId._fromProtobuf(e)),evmAddress:null!=e.evmAddress&&Object.hasOwn(e.evmAddress,"value")&&null!=e.evmAddress.value?e.evmAddress.value:null,stateChanges:[],gas:o instanceof Long?o:Long.fromValue(o),amount:a instanceof Long?a:Long.fromValue(a),functionParameters:e.functionParameters,senderAccountId:null!=e.senderId?AccountId._fromProtobuf(e.senderId):null,contractNonces:(null!=e.contractNonces?e.contractNonces:[]).map(e=>ContractNonceInfo._fromProtobuf(e)),signerNonce:null!=e.signerNonce&&Object.hasOwn(e.signerNonce,"value")&&e.signerNonce.value||null})}asBytes(){return this.bytes}getString(e){return decode(this.getBytes(e))}getBytes(e){const t=this.getInt32(e),n=safeView(this.bytes).getInt32(t+28);return this.bytes.subarray(t+32,t+32+n)}getBytes32(e){return this.bytes.subarray(32*(null!=e?e:0),32*(null!=e?e:0)+32)}getBool(e){return 0!==this.bytes[32*(null!=e?e:0)+31]}getInt8(e){const t=32*(null!=e?e:0)+31;return safeView(this.bytes).getInt8(t)}getUint8(e){return this.bytes[32*(null!=e?e:0)+31]}getInt16(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint16(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt24(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint24(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt32(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getInt32(t)}getUint32(e){const t=32*(null!=e?e:0)+28;return safeView(this.bytes).getUint32(t)}getInt40(e){const t=defaultAbiCoder$1.decode(["int40"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint40(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(27,32)),16)}getInt48(e){const t=defaultAbiCoder$1.decode(["int48"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint48(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(26,32)),16)}getInt56(e){const t=defaultAbiCoder$1.decode(["int56"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint56(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(25,32)),16)}getInt64(e){const t=defaultAbiCoder$1.decode(["int64"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint64(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(24,32)),16)}getInt72(e){const t=defaultAbiCoder$1.decode(["int72"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint72(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(23,32)),16)}getInt80(e){const t=defaultAbiCoder$1.decode(["int80"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint80(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(22,32)),16)}getInt88(e){const t=defaultAbiCoder$1.decode(["int88"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint88(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(21,32)),16)}getInt96(e){const t=defaultAbiCoder$1.decode(["int96"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint96(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(20,32)),16)}getInt104(e){const t=defaultAbiCoder$1.decode(["int104"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint104(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(19,32)),16)}getInt112(e){const t=defaultAbiCoder$1.decode(["int112"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint112(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(18,32)),16)}getInt120(e){const t=defaultAbiCoder$1.decode(["int120"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint120(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(17,32)),16)}getInt128(e){const t=defaultAbiCoder$1.decode(["int128"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint128(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(16,32)),16)}getInt136(e){const t=defaultAbiCoder$1.decode(["int136"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint136(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(15,32)),16)}getInt144(e){const t=defaultAbiCoder$1.decode(["int144"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint144(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(14,32)),16)}getInt152(e){const t=defaultAbiCoder$1.decode(["int152"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint152(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(13,32)),16)}getInt160(e){const t=defaultAbiCoder$1.decode(["int160"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint160(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(12,32)),16)}getInt168(e){const t=defaultAbiCoder$1.decode(["int168"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint168(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(11,32)),16)}getInt176(e){const t=defaultAbiCoder$1.decode(["int176"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint176(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(10,32)),16)}getInt184(e){const t=defaultAbiCoder$1.decode(["int184"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint184(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(9,32)),16)}getInt192(e){const t=defaultAbiCoder$1.decode(["int192"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint192(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(8,32)),16)}getInt200(e){const t=defaultAbiCoder$1.decode(["int200"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint200(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(7,32)),16)}getInt208(e){const t=defaultAbiCoder$1.decode(["int208"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint208(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(6,32)),16)}getInt216(e){const t=defaultAbiCoder$1.decode(["int216"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint216(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(5,32)),16)}getInt224(e){const t=defaultAbiCoder$1.decode(["int224"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint224(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(4,32)),16)}getInt232(e){const t=defaultAbiCoder$1.decode(["int232"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint232(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(3,32)),16)}getInt240(e){const t=defaultAbiCoder$1.decode(["int240"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint240(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(2,32)),16)}getInt248(e){const t=defaultAbiCoder$1.decode(["int248"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint248(e){return new BigNumber(encode$4(this._getBytes32(e).subarray(1,32)),16)}getInt256(e){const t=defaultAbiCoder$1.decode(["int256"],this._getBytes32(null!=e?e:0));return new BigNumber(t.toString())}getUint256(e){return new BigNumber(encode$4(this._getBytes32(e)),16)}getAddress(e){return encode$4(this.bytes.subarray(32*(null!=e?e:0)+12,32*(null!=e?e:0)+32))}getResult(e){const t=defaultAbiCoder$1.decode(e,this.bytes),n=[];for(let r=0;r<t.length;r++)n.push(this._convertEthersValue(t[r],e[r]));return n}_convertEthersValue(e,t){const n="string"==typeof t?t:t.type||String(t);if(Array.isArray(e)){const t=n.replace(/\[]$/,"");return e.map(e=>this._convertEthersValue(e,t))}if("bigint"!=typeof e)return e;const r=n.match(/^u?int(\d+)?$/);if(r){if((r[1]?parseInt(r[1],10):256)<=32)return Number(e)}return new BigNumber(e.toString())}_getBytes32(e){return this.bytes.subarray(32*(null!=e?e:0),32*(null!=e?e:0)+32)}_toProtobuf(){return{contractID:null!=this.contractId?this.contractId._toProtobuf():null,contractCallResult:this.bytes,errorMessage:this.errorMessage,bloom:this.bloom,gasUsed:this.gasUsed,logInfo:this.logs.map(e=>e._toProtobuf()),createdContractIDs:this.createdContractIds.map(e=>e._toProtobuf()),evmAddress:null!=this.evmAddress?{value:this.evmAddress}:null,gas:this.gas,amount:this.amount,functionParameters:this.functionParameters,senderId:null!=this.senderAccountId?this.senderAccountId._toProtobuf():null,contractNonces:this.contractNonces.map(e=>e._toProtobuf()),signerNonce:null!=this.signerNonce?{value:this.signerNonce}:null}}}class TokenTransferAccountMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t.toString()}),e}}class TokenTransferMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}__set(e,t,n){const r=e.toString();let o=this._map.get(r);null==o&&(o=new TokenTransferAccountMap,this._map.set(r,o),this.__map.set(e,o)),o._set(t,convertAmountToLong(n))}static _fromProtobuf(e){const t=new TokenTransferMap;for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.transfers?n.transfers:[]){const n=AccountId._fromProtobuf(r.accountID);t.__set(e,n,r.amount)}}return t}_toProtobuf(){const e=[];for(const[t,n]of this){const r=[];for(const[e,t]of n)r.push({accountID:e._toProtobuf(),amount:t});e.push({token:t._toProtobuf(),transfers:r})}return e}}class TokenNftTransferMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}__set(e,t){const n=e.toString();let r=this._map.get(n);null==r&&(r=[],this._map.set(n,r),this.__map.set(e,r)),r.push(t)}static _fromProtobuf(e){const t=new TokenNftTransferMap;for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.nftTransfers?n.nftTransfers:[]){const n=AccountId._fromProtobuf(r.senderAccountID),o=AccountId._fromProtobuf(r.receiverAccountID);t.__set(e,{sender:n,recipient:o,serial:Long.fromValue(r.serialNumber),isApproved:!1})}}return t}_toProtobuf(){const e=[];for(const[t,n]of this){const r=[];for(const e of n)r.push({senderAccountID:e.sender._toProtobuf(),receiverAccountID:e.recipient._toProtobuf(),serialNumber:e.serial});e.push({token:t._toProtobuf(),nftTransfers:r})}return e}toJSON(){const e={};return this._map.forEach((t,n)=>{e[n]=t.map(e=>({sender:e.sender.toString(),recipient:e.recipient.toString(),serial:e.serial,isApproved:e.isApproved}))}),e}}class AssessedCustomFee{constructor(e={}){this._feeCollectorAccountId=null,null!=e.feeCollectorAccountId&&this.setFeeCollectorAccountId(e.feeCollectorAccountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._amount=null,null!=e.amount&&this.setAmount(e.amount),this._payerAccountIds=null,null!=e.payerAccountIds&&this.setPayerAccountIds(e.payerAccountIds)}get feeCollectorAccountId(){return this._feeCollectorAccountId}setFeeCollectorAccountId(e){return this._feeCollectorAccountId="string"==typeof e?AccountId.fromString(e):e,this}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}get amount(){return this._amount}setAmount(e){return this._amount=convertAmountToLong(e),this}get payerAccountIds(){return this._payerAccountIds}setPayerAccountIds(e){return this._payerAccountIds=e,this}static _fromProtobuf(e){return new AssessedCustomFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,tokenId:null!=e.tokenId?TokenId._fromProtobuf(e.tokenId):void 0,amount:null!=e.amount?e.amount:void 0,payerAccountIds:null!=e.effectivePayerAccountId?e.effectivePayerAccountId.map(e=>AccountId._fromProtobuf(e)):void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,tokenId:null!=this._tokenId?this._tokenId._toProtobuf():null,amount:this._amount,effectivePayerAccountId:null!=this._payerAccountIds?this._payerAccountIds.map(e=>e._toProtobuf()):null}}toJSON(){return{feeCollectorAccountId:this.feeCollectorAccountId?.toString()||null,tokenId:this._tokenId?.toString()||null,amount:this._amount?.toString()||null,payerAccountIds:this._payerAccountIds?.map(e=>e.toString())||[]}}}class TokenAssociation{constructor(e={}){this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._defaultMaxTransactionFee=new Hbar(5)}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e,this}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}static _fromProtobuf(e){return new TokenAssociation({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):void 0,tokenId:null!=e.tokenId?TokenId._fromProtobuf(e.tokenId):void 0})}_toProtobuf(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():void 0,tokenId:null!=this._tokenId?this._tokenId._toProtobuf():void 0}}toJSON(){return{accountId:this._accountId?.toString()||null,tokenId:this._tokenId?.toString()||null}}}class TokenTransfer{constructor(e){this.tokenId=e.tokenId instanceof TokenId?e.tokenId:TokenId.fromString(e.tokenId),this.accountId=e.accountId instanceof AccountId?e.accountId:AccountId.fromString(e.accountId),this.expectedDecimals=e.expectedDecimals,this.amount=convertAmountToLong(e.amount),this.isApproved=e.isApproved,this.hookCall=e.hookCall||null}static _fromProtobuf(e){const t=[];for(const n of e){const e=TokenId._fromProtobuf(n.token),r=null!=n.expectedDecimals&&Object.hasOwn(n.expectedDecimals,"value")?n.expectedDecimals.value:null;for(const o of null!=n.transfers?n.transfers:[]){let n=null;null!=o.preTxAllowanceHook?n=FungibleHookCall._fromProtobufWithType(o.preTxAllowanceHook,FungibleHookType.PRE_TX_ALLOWANCE_HOOK):null!=o.prePostTxAllowanceHook&&(n=FungibleHookCall._fromProtobufWithType(o.prePostTxAllowanceHook,FungibleHookType.PRE_POST_TX_ALLOWANCE_HOOK)),t.push(new TokenTransfer({tokenId:e,accountId:AccountId._fromProtobuf(o.accountID),expectedDecimals:r||null,amount:null!=o.amount?o.amount:Long.ZERO,isApproved:1==o.isApproval,hookCall:n??void 0}))}}return t}_toProtobuf(){const e={accountID:this.accountId._toProtobuf(),amount:this.amount,isApproval:this.isApproved};if(null!=this.hookCall)switch(this.hookCall.type){case FungibleHookType.PRE_TX_ALLOWANCE_HOOK:e.preTxAllowanceHook=this.hookCall._toProtobuf();break;case FungibleHookType.PRE_POST_TX_ALLOWANCE_HOOK:e.prePostTxAllowanceHook=this.hookCall._toProtobuf()}return e}toJSON(){return{tokenId:this.tokenId.toString(),accountId:this.accountId.toString(),expectedDecimals:this.expectedDecimals,amount:this.amount.toString(),isApproved:this.isApproved}}toString(){return JSON.stringify(this.toJSON())}}class NftId{constructor(e,t){this.tokenId=e,this.serial="number"==typeof t?Long.fromNumber(t):t,Object.freeze(this)}static fromString(e){const t=e.split("/").length>1?e.split("/"):e.split("@");for(const e of t)if(""===e)throw new Error("invalid format for NftId: use [token]/[serial] or [token]@[serial]");const n=TokenId.fromString(t[0]),r=Long.fromString(t[1]);return new NftId(n,r)}static _fromProtobuf(e){return new NftId(TokenId._fromProtobuf(e.token_ID),null!=e.serialNumber?e.serialNumber:Long.ZERO)}static fromBytes(e){return NftId._fromProtobuf(libExports.proto.NftID.decode(e))}_toProtobuf(){return{token_ID:this.tokenId._toProtobuf(),serialNumber:Long.fromValue(void 0!==this.serial?this.serial:0)}}toString(){return`${this.tokenId.toString()}/${this.serial.toString()}`}toBytes(){return libExports.proto.NftID.encode(this._toProtobuf()).finish()}}class PendingAirdropId{constructor(e={}){this._senderId=null,this._receiverId=null,this._tokenId=null,this._nftId=null,null!=e.receiverId&&this.setReceiverId(e.receiverId),null!=e.senderId&&this.setSenderid(e.senderId),null!=e.tokenId?this.setTokenId(e.tokenId):null!=e.nftId&&this.setNftId(e.nftId)}static fromBytes(e){if(null==e.senderId)throw new Error("senderId is required");if(null==e.receiverId)throw new Error("receiverId is required");if(null==e.fungibleTokenType&&null==e.nonFungibleToken)throw new Error("Either fungibleTokenType or nonFungibleToken is required");return new PendingAirdropId({senderId:AccountId._fromProtobuf(e.senderId),receiverId:AccountId._fromProtobuf(e.receiverId),nftId:null!=e.nonFungibleToken?NftId._fromProtobuf(e.nonFungibleToken):null,tokenId:null!=e.fungibleTokenType?TokenId._fromProtobuf(e.fungibleTokenType):null})}setSenderid(e){return this._senderId="string"==typeof e?AccountId.fromString(e):e,this}setReceiverId(e){return this._receiverId="string"==typeof e?AccountId.fromString(e):e,this}setTokenId(e){return this._nftId=null,this._tokenId="string"==typeof e?TokenId.fromString(e):e,this}setNftId(e){return this._tokenId=null,this._nftId="string"==typeof e?NftId.fromString(e):e,this}get senderId(){return this._senderId}get receiverId(){return this._receiverId}get tokenId(){return this._tokenId}get nftId(){return this._nftId}toBytes(){return{senderId:this._senderId?._toProtobuf(),receiverId:this._receiverId?._toProtobuf(),fungibleTokenType:this._tokenId?._toProtobuf(),nonFungibleToken:this._nftId?._toProtobuf()}}}class PendingAirdropRecord{constructor(e){this.airdropId=e.airdropId,this.amount=convertAmountToLong(e.amount)}toBytes(){return{pendingAirdropId:this.airdropId.toBytes(),pendingAirdropValue:{amount:this.amount}}}static fromBytes(e){if(null==e.pendingAirdropId)throw new Error("pendingAirdropId is required");const t=PendingAirdropId.fromBytes(e.pendingAirdropId),n=e.pendingAirdropValue?.amount;return new PendingAirdropRecord({airdropId:t,amount:n||Long.ZERO})}}class TransactionRecord{constructor(e){this.receipt=e.receipt,this.transactionHash=e.transactionHash,this.consensusTimestamp=e.consensusTimestamp,this.transactionId=e.transactionId,this.transactionMemo=e.transactionMemo,this.transactionFee=e.transactionFee,this.transfers=e.transfers,this.contractFunctionResult=null!=e.contractFunctionResult?e.contractFunctionResult:null,this.tokenTransfers=e.tokenTransfers,this.tokenTransfersList=e.tokenTransfersList,this.scheduleRef=e.scheduleRef,this.assessedCustomFees=e.assessedCustomFees,this.nftTransfers=e.nftTransfers,this.automaticTokenAssociations=e.automaticTokenAssociations,this.parentConsensusTimestamp=e.parentConsensusTimestamp,this.aliasKey=e.aliasKey,this.duplicates=e.duplicates,this.children=e.children,this.hbarAllowanceAdjustments=e.hbarAllowanceAdjustments,this.tokenAllowanceAdjustments=e.tokenAllowanceAdjustments,this.nftAllowanceAdjustments=e.nftAllowanceAdjustments,this.ethereumHash=e.ethereumHash,this.paidStakingRewards=e.paidStakingRewards,this.prngBytes=e.prngBytes,this.prngNumber=e.prngNumber,this.evmAddress=e.evmAddress,this.newPendingAirdrops=e.newPendingAirdrops,Object.freeze(this)}_toProtobuf(){const e=this.tokenTransfers._toProtobuf(),t=this.nftTransfers._toProtobuf(),n=[];for(const r of e)for(const e of t)null!=r.token&&null!=e.token&&r.token.shardNum===e.token.shardNum&&r.token.realmNum===e.token.realmNum&&r.token.tokenNum===e.token.tokenNum?n.push({token:r.token,transfers:r.transfers,nftTransfers:r.nftTransfers}):(n.push(r),n.push(e));return{duplicateTransactionRecords:this.duplicates.map(e=>e._toProtobuf().transactionRecord),childTransactionRecords:this.children.map(e=>e._toProtobuf().transactionRecord),transactionRecord:{receipt:this.receipt._toProtobuf().receipt,transactionHash:null!=this.transactionHash?this.transactionHash:null,consensusTimestamp:null!=this.consensusTimestamp?this.consensusTimestamp._toProtobuf():null,transactionID:null!=this.transactionId?this.transactionId._toProtobuf():null,memo:null!=this.transactionMemo?this.transactionMemo:null,transactionFee:null!=this.transactionFee?this.transactionFee.toTinybars():null,contractCallResult:null==this.contractFunctionResult||this.contractFunctionResult._createResult?null:this.contractFunctionResult._toProtobuf(),contractCreateResult:null!=this.contractFunctionResult&&this.contractFunctionResult._createResult?this.contractFunctionResult._toProtobuf():null,transferList:null!=this.transfers?{accountAmounts:this.transfers.map(e=>e._toProtobuf())}:null,tokenTransferLists:n,scheduleRef:null!=this.scheduleRef?this.scheduleRef._toProtobuf():null,assessedCustomFees:this.assessedCustomFees.map(e=>e._toProtobuf()),automaticTokenAssociations:this.automaticTokenAssociations.map(e=>e._toProtobuf()),parentConsensusTimestamp:null!=this.parentConsensusTimestamp?this.parentConsensusTimestamp._toProtobuf():null,alias:null!=this.aliasKey?libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ethereumHash:this.ethereumHash,paidStakingRewards:this.paidStakingRewards.map(e=>e._toProtobuf()),prngBytes:this.prngBytes,prngNumber:null!=this.prngNumber?this.prngNumber:null,evmAddress:null!=this.evmAddress?this.evmAddress.toBytes():null,newPendingAirdrops:this.newPendingAirdrops.map(e=>e.toBytes())}}}static _fromProtobuf(e){const t=e.transactionRecord;let n=null!=t.alias&&t.alias.length>0?Key._fromProtobufKey(libExports.proto.Key.decode(t.alias)):null;n instanceof PublicKey||(n=null);const r=null!=e.childTransactionRecords?e.childTransactionRecords.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})):[],o=null!=e.duplicateTransactionRecords?e.duplicateTransactionRecords.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})):[],a=null!=t.contractCallResult?ContractFunctionResult._fromProtobuf(t.contractCallResult,!1):null!=t.contractCreateResult?ContractFunctionResult._fromProtobuf(t.contractCreateResult,!0):void 0,i=null!=t.newPendingAirdrops?t.newPendingAirdrops.map(e=>PendingAirdropRecord.fromBytes(e)):[];return new TransactionRecord({receipt:TransactionReceipt._fromProtobuf({receipt:t.receipt}),transactionHash:null!=t.transactionHash?t.transactionHash:new Uint8Array,consensusTimestamp:Timestamp._fromProtobuf(t.consensusTimestamp),transactionId:TransactionId._fromProtobuf(t.transactionID),transactionMemo:null!=t.memo?t.memo:"",transactionFee:Hbar.fromTinybars(null!=t.transactionFee?t.transactionFee:0),transfers:Transfer._fromProtobuf(null!=t.transferList&&null!=t.transferList.accountAmounts?t.transferList.accountAmounts:[]),contractFunctionResult:a,tokenTransfers:TokenTransferMap._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),tokenTransfersList:TokenTransfer._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),scheduleRef:null!=t.scheduleRef?ScheduleId._fromProtobuf(t.scheduleRef):null,assessedCustomFees:null!=t.assessedCustomFees?t.assessedCustomFees.map(e=>AssessedCustomFee._fromProtobuf(e)):[],nftTransfers:TokenNftTransferMap._fromProtobuf(null!=t.tokenTransferLists?t.tokenTransferLists:[]),automaticTokenAssociations:null!=t.automaticTokenAssociations?t.automaticTokenAssociations.map(e=>TokenAssociation._fromProtobuf(e)):[],parentConsensusTimestamp:null!=t.parentConsensusTimestamp?Timestamp._fromProtobuf(t.parentConsensusTimestamp):null,aliasKey:n,duplicates:o,children:r,hbarAllowanceAdjustments:[],tokenAllowanceAdjustments:[],nftAllowanceAdjustments:[],ethereumHash:null!=t.ethereumHash?t.ethereumHash:null,paidStakingRewards:null!=t.paidStakingRewards?Transfer._fromProtobuf(t.paidStakingRewards):[],prngBytes:null!=t.prngBytes?t.prngBytes:null,prngNumber:null!=t.prngNumber?t.prngNumber:null,evmAddress:null!=t.evmAddress?EvmAddress.fromBytes(t.evmAddress):null,newPendingAirdrops:i})}static fromBytes(e){return TransactionRecord._fromProtobuf(libExports.proto.TransactionGetRecordResponse.decode(e))}toBytes(){return libExports.proto.TransactionGetRecordResponse.encode(this._toProtobuf()).finish()}toJSON(){return{receipt:this.receipt.toJSON(),transactionHash:encode$4(this.transactionHash),consensusTimestamp:this.consensusTimestamp.toDate(),transactionId:this.transactionId.toString(),transactionMemo:this.transactionMemo,transactionFee:this.transactionFee.toTinybars().toString(),transfers:this.transfers.map(e=>e.toJSON()),tokenTransfers:this.tokenTransfers,tokenTransfersList:this.tokenTransfersList.map(e=>e.toJSON()),scheduleRef:this.scheduleRef?.toString()||null,assessedCustomFees:this.assessedCustomFees,nftTransfers:this.nftTransfers,automaticTokenAssociations:this.automaticTokenAssociations,parentConsensusTimestamp:this.parentConsensusTimestamp?.toDate()||null,aliasKey:this.aliasKey?.toString()||null,duplicates:this.duplicates,children:this.children,ethereumHash:null!=this.ethereumHash?encode$4(this.ethereumHash):null,paidStakingRewards:this.paidStakingRewards,prngBytes:null!=this.prngBytes?encode$4(this.prngBytes):null,prngNumber:this.prngNumber,evmAddress:this.evmAddress?.toString()||null}}toString(){return JSON.stringify(this.toJSON())}}class RecordStatusError extends StatusError{constructor(e){super(e,`Record for transaction ${e.transactionId.toString()} contained error status ${e.status.toString()}`),this.transactionRecord=e.transactionRecord}}const{proto:proto$5}=HieroProto;class TransactionRecordQuery extends Query{constructor(e={}){super(),this._transactionId=null,this._includeChildren=null,this._includeDuplicates=null,this._validateReceiptStatus=!0,null!=e.transactionId&&this.setTransactionId(e.transactionId),null!=e.includeChildren&&this.setIncludeChildren(e.includeChildren),null!=e.includeDuplicates&&this.setIncludeDuplicates(e.includeDuplicates),null!=e.validateReceiptStatus&&this.setValidateReceiptStatus(e.validateReceiptStatus)}get transactionId(){return this._transactionId}static _fromProtobuf(e){const t=e.transactionGetRecord;return new TransactionRecordQuery({transactionId:t.transactionID?TransactionId._fromProtobuf(t.transactionID):void 0,includeChildren:null!=t.includeChildRecords?t.includeChildRecords:void 0,includeDuplicates:null!=t.includeDuplicates?t.includeDuplicates:void 0})}setTransactionId(e){return this._transactionId="string"==typeof e?TransactionId.fromString(e):e.clone(),this}setIncludeChildren(e){return this._includeChildren=e,this}get includeChildren(){return null!=this._includeChildren&&this._includeChildren}setIncludeDuplicates(e){return this._duplicates=e,this}get includeDuplicates(){return null!=this._duplicates&&this._duplicates}setValidateReceiptStatus(e){return this._validateReceiptStatus=e,this}get validateReceiptStatus(){return this._validateReceiptStatus}_getStatusAndExecutionState(e,t){const{nodeTransactionPrecheckCode:n}=this._mapResponseHeader(t);let r=Status._fromCode(null!=n?n:proto$5.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received node precheck status ${r.toString()}`),r){case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.RecordNotFound:case Status.PlatformNotActive:return[r,ExecutionState.Retry];case Status.Ok:break;default:return[r,ExecutionState.Error]}const o=t.transactionGetRecord;if(o.header.responseType===libExports.proto.ResponseType.COST_ANSWER)return[r,ExecutionState.Finished];const a=o.transactionRecord.receipt.status;switch(r=Status._fromCode(a),this._logger&&this._logger.debug(`[${this._getLogId()}] received record's receipt ${r.toString()}`),r){case Status.Ok:case Status.Busy:case Status.Unknown:case Status.ReceiptNotFound:case Status.RecordNotFound:return[r,ExecutionState.Retry];case Status.Success:return[r,ExecutionState.Finished];default:return[r,this._validateReceiptStatus?ExecutionState.Error:ExecutionState.Finished]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t);let o=Status._fromCode(null!=r?r:proto$5.ResponseCodeEnum.OK);switch(o){case Status.Ok:break;case Status.ContractRevertExecuted:return new RecordStatusError({status:o,transactionId:this._getTransactionId(),transactionRecord:TransactionRecord._fromProtobuf({transactionRecord:t.transactionGetRecord.transactionRecord})});default:return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}const a=t.transactionGetRecord.transactionRecord.receipt,i=a.status;return o=Status._fromCode(i),o===Status.ContractRevertExecuted?new RecordStatusError({status:o,transactionId:this._getTransactionId(),transactionRecord:TransactionRecord._fromProtobuf({transactionRecord:t.transactionGetRecord.transactionRecord})}):new ReceiptStatusError({status:o,transactionId:this._getTransactionId(),transactionReceipt:TransactionReceipt._fromProtobuf({receipt:a})})}_validateChecksums(e){null!=this._transactionId&&null!=this._transactionId.accountId&&this._transactionId.accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getTxRecordByTxID(t)}_mapResponseHeader(e){return e.transactionGetRecord.header}_mapResponse(e,t,n){const r=e.transactionGetRecord;return Promise.resolve(TransactionRecord._fromProtobuf(r))}_onMakeRequest(e){return{transactionGetRecord:{header:e,transactionID:null!=this._transactionId?this._transactionId._toProtobuf():null,includeChildRecords:this._includeChildren,includeDuplicates:this._includeDuplicates}}}_getLogId(){return`TransactionRecordQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("transactionGetRecord",TransactionRecordQuery._fromProtobuf);class TransactionResponse{constructor(e){this.nodeId=e.nodeId,this.transactionHash=e.transactionHash,this.transactionId=e.transactionId,this.transaction=e.transaction,this.logger=e.logger,this.transactionNodeAccountIds=e.transactionNodeAccountIds}static fromJSON(e){return new TransactionResponse({nodeId:AccountId.fromString(e.nodeId),transactionHash:decode$7(e.transactionHash),transactionId:TransactionId.fromString(e.transactionId)})}async getReceipt(e){let t;try{t=await this.getReceiptQuery(e).execute(e)}catch(t){if(t instanceof ReceiptStatusError&&t.status===Status.ThrottledAtConsensus)return this.logger?.info("Transaction throttled at consensus"),this._retryTransaction(e);throw t}if(t.status!==Status.Success&&t.status!==Status.FeeScheduleFilePartUploaded)throw new ReceiptStatusError({transactionReceipt:t,status:t.status,transactionId:this.transactionId});return t}async getRecord(e){return await this.getReceipt(e),this.getRecordQuery(e).execute(e)}async getVerboseRecord(e){try{return await this.getReceiptQuery(e).execute(e),this.getRecordQuery(e).execute(e)}catch(t){return this.getRecordQuery(e).execute(e)}}async getReceiptWithSigner(e){const t=await this.getReceiptQuery().executeWithSigner(e);if(t.status!==Status.Success)throw new ReceiptStatusError({transactionReceipt:t,status:t.status,transactionId:this.transactionId});return t}async getRecordWithSigner(e){return await this.getReceiptWithSigner(e),this.getRecordQuery().executeWithSigner(e)}getReceiptQuery(e){const t=(new TransactionReceiptQuery).setTransactionId(this.transactionId);if(null!=e&&e.allowReceiptNodeFailover){const n=null!=this.transactionNodeAccountIds&&this.transactionNodeAccountIds.length>0?this.transactionNodeAccountIds:e._network.getNodeAccountIdsForExecute(),r=[this.nodeId];for(const e of n)e.equals(this.nodeId)||r.push(e);t.setNodeAccountIds(r)}else t.setNodeAccountIds([this.nodeId]);return t}getRecordQuery(e){const t=(new TransactionRecordQuery).setTransactionId(this.transactionId);if(null!=e&&e.allowReceiptNodeFailover){const n=null!=this.transactionNodeAccountIds&&this.transactionNodeAccountIds.length>0?this.transactionNodeAccountIds:e._network.getNodeAccountIdsForExecute(),r=[this.nodeId];for(const e of n)e.equals(this.nodeId)||r.push(e);t.setNodeAccountIds(r)}else t.setNodeAccountIds([this.nodeId]);return t}toJSON(){return{nodeId:this.nodeId.toString(),transactionHash:encode$4(this.transactionHash),transactionId:this.transactionId.toString()}}async _retryTransaction(e){if(!this.transaction)throw new Error("If you retry transaction you should have the transaction set");if(e.operatorAccountId?.toString()!==this.transaction.transactionId?.accountId?.toString())throw new Error("Retry mechanism is not supported when tx id is not generated by the operator account");if(null===e.operatorAccountId)throw new Error("Operator account is not set");let t=250;for(let n=0;n<5;n++){if(this.logger?.trace(`Transaction throttled, retry attempt ${n}`),this.transaction?._resetTransaction(e),null==this.transaction||null==this.transaction.transactionId)throw new Error("Transaction or Transaction ID is null after reset");this.transactionId=this.transaction.transactionId,n>0&&(await wait(Math.min(t,16e3)),t*=2);try{this.transaction._resetTransaction(e);const t=await this.transaction.execute(e),r=await(new TransactionReceiptQuery).setTransactionId(t.transactionId).setNodeAccountIds([t.nodeId]).execute(e);if(r.status!==Status.ThrottledAtConsensus)return this.logger?.info(`Transaction throttle retry succeeded after attempt ${n}`),r}catch(e){if(e instanceof ReceiptStatusError&&e.status===Status.ThrottledAtConsensus){this.logger?.info("Transaction throttled at consensus");continue}throw this.logger?.error(`An error occurred after throttle retry: ${e instanceof Error?e.message:String(e)}`),e}}throw this.logger?.error("Transaction throttle retry failed after maximum attempts"),new Error("Transaction retry failed after maximum attempts")}toString(){return JSON.stringify(this.toJSON())}}async function digest(e){const t=e.buffer instanceof ArrayBuffer?e:new Uint8Array(e);return new Uint8Array(await window.crypto.subtle.digest("SHA-384",t))}class TransactionHashMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static async _fromTransaction(e){const t=new TransactionHashMap;for(let n=0;n<e._nodeAccountIds.length;n++){const r=e._nodeAccountIds.list[n],o=e._transactions.get(n),a=await digest(o.signedTransactionBytes);t._set(r,a)}return t}}class NodeAccountIdSignatureMap extends ObjectMap{constructor(){super(e=>PublicKey.fromString(e))}static _fromTransactionSigMap(e){const t=new NodeAccountIdSignatureMap,n=null!=e.sigPair?e.sigPair:[];for(const e of n)null!=e.pubKeyPrefix&&(null!=e.ed25519?t._set(PublicKey.fromBytesED25519(e.pubKeyPrefix),e.ed25519):null!=e.ECDSASecp256k1&&t._set(PublicKey.fromBytesECDSA(e.pubKeyPrefix),e.ECDSASecp256k1));return t}}class SignatureMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromTransaction(e){const t=new SignatureMap;for(let n=0;n<e._nodeAccountIds.length;n++){const r=e._signedTransactions.get(n).sigMap;null!=r&&t._set(e._nodeAccountIds.list[n],NodeAccountIdSignatureMap._fromTransactionSigMap(r))}return t}}class CustomFee{constructor(e={}){this._feeCollectorAccountId=null,this._allCollectorsAreExempt=!1,null!=e.feeCollectorAccountId&&this.setFeeCollectorAccountId(e.feeCollectorAccountId),null!=e.allCollectorsAreExempt&&this.setAllCollectorsAreExempt(e.allCollectorsAreExempt)}get feeCollectorAccountId(){return this._feeCollectorAccountId}setFeeCollectorAccountId(e){return this._feeCollectorAccountId="string"==typeof e?AccountId.fromString(e):e,this}get allCollectorsAreExempt(){return this._allCollectorsAreExempt}setAllCollectorsAreExempt(e){return this._allCollectorsAreExempt=e,this}static _fromProtobuf(e){throw new Error("not implemented")}_toProtobuf(){throw new Error("not implemented")}}class CustomFixedFee extends CustomFee{constructor(e={}){super(e),this._denominatingTokenId=null,null!=e.denominatingTokenId&&this.setDenominatingTokenId(e.denominatingTokenId),this._amount=null,null!=e.amount&&this.setAmount(e.amount)}setHbarAmount(e){return this._amount=e.toTinybars(),this._denominatingTokenId=null,this}get hbarAmount(){return null!=this._denominatingTokenId?null:Hbar.fromTinybars(null!=this._amount?this._amount:0)}setDenominatingTokenToSameToken(){return this._denominatingTokenId=new TokenId(0,0,0),this}get denominatingTokenId(){return this._denominatingTokenId}setDenominatingTokenId(e){return this._denominatingTokenId="string"==typeof e?TokenId.fromString(e):e,this}get amount(){return this._amount}setAmount(e){return this._amount=convertAmountToLong(e),this}static _fromProtobuf(e){const t=e.fixedFee;return new CustomFixedFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,denominatingTokenId:null!=t.denominatingTokenId?TokenId._fromProtobuf(t.denominatingTokenId):void 0,amount:null!=t.amount?t.amount:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}_toTopicFeeProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,fixedFee:{denominatingTokenId:null!=this._denominatingTokenId?this._denominatingTokenId._toProtobuf():null,amount:this._amount}}}}class CustomFeeLimit{constructor(e={}){this._accountId=null,e.accountId&&this.setAccountId(e.accountId),this._fees=null,e.fees&&this.setFees(e.fees)}static _fromProtobuf(e){return new CustomFeeLimit({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):null,fees:null!=e.fees?e.fees.map(e=>CustomFixedFee._fromProtobuf({fixedFee:e})):null})}getAccountId(){return this._accountId}setAccountId(e){return this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}getFees(){return this._fees}setFees(e){return this._fees=e,this}_toProtobuf(){const e=[];return null!=this._fees&&this._fees.forEach(t=>{const n=t._toProtobuf();null!=n.fixedFee&&e.push(n.fixedFee)}),{accountId:null!=this._accountId?this._accountId._toProtobuf():null,fees:e}}}class SignableNodeTransactionBodyBytes{constructor(e,t,n){this.nodeAccountId=e,this.transactionId=t,this.signableTransactionBodyBytes=n}}const DEFAULT_AUTO_RENEW_PERIOD=Long.fromValue(7776e3),DEFAULT_RECORD_THRESHOLD=Hbar.fromTinybars(Long.fromString("9223372036854775807")),NODE_ACCOUNT_BATCH_ID=new AccountId(0,0,0),DEFAULT_TRANSACTION_VALID_DURATION=120,CHUNK_SIZE=1024;function isMultiTransactionIdType(e){return"fileAppend"===e||"consensusSubmitMessage"===e}const TRANSACTION_REGISTRY=new Map;class Transaction extends Executable{constructor(){super(),this._transactions=new List,this._signedTransactions=new List,this._signerPublicKeys=new Set,this._transactionValidDuration=DEFAULT_TRANSACTION_VALID_DURATION,this._defaultMaxTransactionFee=new Hbar(2),this._customFeeLimits=[],this._maxTransactionFee=null,this._transactionMemo="",this._transactionIds=new List,this._publicKeys=[],this._transactionSigners=[],this._regenerateTransactionId=null,this._batchKey=null,this._isThrottled=!1}static fromBytes(e){const t=[],n=[],r=[],o=[],a=[],i=[],s=libExports.proto.TransactionList.decode(e).transactionList;if(0===s.length){const t=libExports.proto.Transaction.decode(e);0!==t.signedTransactionBytes.length?s.push(t):s.push({signedTransactionBytes:libExports.proto.SignedTransaction.encode({sigMap:t.sigMap,bodyBytes:t.bodyBytes}).finish()})}for(const e of s){if(null==e.bodyBytes&&null==e.signedTransactionBytes)throw new Error("bodyBytes and signedTransactionBytes are null");if(e.bodyBytes&&0!=e.bodyBytes.length){const t=libExports.proto.TransactionBody.decode(e.bodyBytes);if(null!=t.transactionID){const e=TransactionId._fromProtobuf(t.transactionID);o.includes(e.toString())||(n.push(e),o.push(e.toString()))}if(null!=t.nodeAccountID){const e=AccountId._fromProtobuf(t.nodeAccountID);a.includes(e.toString())||(r.push(e),a.push(e.toString()))}if(null==t.data)throw new Error("(BUG) body.data was not set in the protobuf");i.push(t)}if(e.signedTransactionBytes&&0!=e.signedTransactionBytes.length){const s=libExports.proto.SignedTransaction.decode(e.signedTransactionBytes);t.push(s);const c=libExports.proto.TransactionBody.decode(s.bodyBytes);if(null!=c.transactionID){const e=TransactionId._fromProtobuf(c.transactionID);o.includes(e.toString())||(n.push(e),o.push(e.toString()))}if(null!=c.nodeAccountID){const e=AccountId._fromProtobuf(c.nodeAccountID);a.includes(e.toString())||(r.push(e),a.push(e.toString()))}if(null==c.data)throw new Error("(BUG) body.data was not set in the protobuf");i.push(c)}}const c=i[0];if(null==c||null==c.data)throw new Error("No transaction found in bytes or failed to decode TransactionBody");const u=TRANSACTION_REGISTRY.get(c.data);if(null==u)throw new Error(`(BUG) Transaction.fromBytes() not implemented for type ${c.data}`);return u(s,t,n,r,i)}schedule(){if(this._requireNotFrozen(),1!=SCHEDULE_CREATE_TRANSACTION.length)throw new Error("ScheduleCreateTransaction has not been loaded yet");return SCHEDULE_CREATE_TRANSACTION[0]()._setScheduledTransaction(this)}async batchify(e,t){return this._requireNotFrozen(),this.setBatchKey(t),await this.signWithOperator(e)}static _validateTransactionBodies(e,t,n,r){const o=0===t.length,a=0===r.length;if(o||a)return;const i=t.length,s=n.length,c=0===s?1:s,u=isMultiTransactionIdType(e),l=!u&&1!==i;if(0===s){if(r.length!==i||l)throw new Error("failed to validate transaction bodies");return}const d=i*c;if(r.length!==d||l)throw new Error("failed to validate transaction bodies");const p=new Set;p.add("nodeAccountID");for(let e=0;e<i;e++){const t=e*s,n=r[t];for(let e=1;e<s;e++)if(!compare$1(n,r[t+e],p))throw new Error("failed to validate transaction bodies")}u&&Transaction._validateChunkedTransactionBodies(e,r,c)}static _validateChunkedTransactionBodies(e,t,n){const r=Transaction._getChunkedTransactionIgnoredFields(e),o=t[0];for(let e=n;e<t.length;e+=n)if(!compare$1(o,t[e],r))throw new Error("failed to validate transaction bodies")}static _getChunkedTransactionIgnoredFields(e){const t=new Set;return t.add("nodeAccountID"),t.add("transactionID"),"fileAppend"===e?t.add("contents"):"consensusSubmitMessage"===e&&(t.add("message"),t.add("chunkInfo")),t}static _fromProtobufTransactions(e,t,n,r,o,a){const i=a[0];Transaction._validateTransactionBodies(e._getTransactionDataCase(),r,o,a);const s=new AccountId(0);for(let e=0;e<o.length;e++)o[e].equals(s)&&o.splice(e--,1);e._transactions.setList(t),e._signedTransactions.setList(n),e._transactionIds.setList(r),e._nodeAccountIds.setList(o),e._transactionValidDuration=null!=i.transactionValidDuration&&null!=i.transactionValidDuration.seconds?Long.fromValue(i.transactionValidDuration.seconds).toInt():DEFAULT_TRANSACTION_VALID_DURATION,e._maxTransactionFee=null!=i.transactionFee&&i.transactionFee>new Long(0,0,!0)?Hbar.fromTinybars(i.transactionFee):null,e._customFeeLimits=null!=i.maxCustomFees?i.maxCustomFees?.map(e=>CustomFeeLimit._fromProtobuf(e)):[],e._batchKey=null!=i.batchKey?Key._fromProtobufKey(i?.batchKey):null,e._transactionMemo=null!=i.memo?i.memo:"";for(let r=0;r<o.length;r++){const o=n[r]||t[r];if(null!=o.sigMap&&null!=o.sigMap.sigPair)for(const t of o.sigMap.sigPair)e._signerPublicKeys.add(encode$4(t.pubKeyPrefix)),e._publicKeys.push(PublicKey.fromBytes(t.pubKeyPrefix)),e._transactionSigners.push(null)}return e}setNodeAccountIds(e){return this._requireNotFrozen(),super.setNodeAccountIds(e),this}get transactionValidDuration(){return this._transactionValidDuration}get size(){return this._requireFrozen(),this._makeRequestAsync().then(e=>libExports.proto.Transaction.encode(e).finish().length)}get bodySize(){const e=this._makeTransactionBody(AccountId.fromString("0.0.0"));return libExports.proto.TransactionBody.encode(e).finish().length}setTransactionValidDuration(e){return this._requireNotFrozen(),this._transactionValidDuration=e,this}get maxTransactionFee(){return this._maxTransactionFee}setMaxTransactionFee(e){return this._requireNotFrozen(),this._maxTransactionFee=e instanceof Hbar?e:new Hbar(e),this}get regenerateTransactionId(){return this._regenerateTransactionId}setRegenerateTransactionId(e){return this._requireNotFrozen(),this._regenerateTransactionId=e,this}get transactionMemo(){return this._transactionMemo}setTransactionMemo(e){return this._requireNotFrozen(),this._transactionMemo=e,this}get transactionId(){return this._transactionIds.isEmpty?null:(this._transactionIds.setLocked(),this._transactionIds.current)}setTransactionId(e){return this._requireNotFrozen(),this._transactionIds.setList([e]).setLocked(),this}getRequiredChunks(){return 1}get bodySizeAllChunks(){const e=[];for(let t=0;t<this.getRequiredChunks();t++)this._transactionIds.index=t,e.push(this.bodySize);return this._transactionIds.index=0,e}sign(e){return this.signWith(e.publicKey,t=>Promise.resolve(e.sign(t)))}_validateSignedTransactionBodies(){if(0===this._transactionIds.length||0===this._signedTransactions.length)return;const e=[];for(const t of this._signedTransactions.list){if(null==t.bodyBytes)throw new Error("failed to validate transaction bodies");e.push(libExports.proto.TransactionBody.decode(t.bodyBytes))}Transaction._validateTransactionBodies(this._getTransactionDataCase(),this._transactionIds.list,this._nodeAccountIds.list,e)}async signWith(e,t){this._signOnDemand||this._requireFrozen();const n=encode$4(e.toBytesRaw());if(this._signerPublicKeys.has(n))return this;if(this._validateSignedTransactionBodies(),this._transactions.clear(),this._signerPublicKeys.add(n),this._publicKeys.push(e),this._transactionSigners.push(t),this._signOnDemand)return this;this._transactionIds.setLocked(),this._nodeAccountIds.setLocked();for(const n of this._signedTransactions.list){const r=n.bodyBytes,o=await t(r);null==n.sigMap&&(n.sigMap={}),null==n.sigMap.sigPair&&(n.sigMap.sigPair=[]),n.sigMap.sigPair.push(e._toProtobufSignature(o))}return this}signWithOperator(e){const t=e._operator;if(null==t)throw new Error("`client` must have an operator to sign with the operator");return this._isFrozen()||this.freezeWith(e),this.signWith(t.publicKey,t.transactionSigner)}_resetTransaction(e){if(!e.operatorAccountId)throw new Error("Client must have an operator account ID");this.logger?.info("Resetting transaction id and resigning");const t=TransactionId.generate(e.operatorAccountId);this._transactionIds.clear(),this._signedTransactions.clear(),this._transactionIds.setList([t]),this._isThrottled=!0}addSignature(e,t){if(!(t instanceof SignatureMap$1))return this._addSignatureLegacy(e,t);this.isFrozen()||this.freeze();const n=encode$4(e.toBytesRaw());if(this._signerPublicKeys.has(n))return this;this._transactions.clear(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._signedTransactions.setLocked();for(let n=0;n<this._signedTransactions.length;n++){const r=this._signedTransactions.get(n);if(null==r.sigMap&&(r.sigMap={}),null==r.sigMap.sigPair&&(r.sigMap.sigPair=[]),r.bodyBytes){const{transactionID:n,nodeAccountID:o}=libExports.proto.TransactionBody.decode(r.bodyBytes);if(!n||!o)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const a=TransactionId._fromProtobuf(n),i=AccountId._fromProtobuf(o),s=t.get(i),c=s?.get(a),u=c?.get(e);if(!u)throw new Error("Signature not found for the transaction and public key");const l=e._toProtobufSignature(u);r.sigMap?.sigPair?.push(l)}}return this._signerPublicKeys.add(n),this._publicKeys.push(e),this._transactionSigners.push(null),this}_addSignatureLegacy(e,t){const n=t instanceof Uint8Array,r=Array.isArray(t);if(this.getRequiredChunks()>1)throw new Error("Add signature is not supported for chunked transactions");if(n&&1!==this._signedTransactions.length)throw new Error("Signature array must match the number of transactions");if(r&&t.length!==this._signedTransactions.length)throw new Error("Signature array must match the number of transactions");this.isFrozen()||this.freeze();const o=encode$4(e.toBytesRaw());if(this._signerPublicKeys.has(o))return this;this._transactions.clear(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._signedTransactions.setLocked();const a=n?[t]:t;for(let t=0;t<this._signedTransactions.length;t++){const n=this._signedTransactions.get(t);null==n.sigMap&&(n.sigMap={}),null==n.sigMap.sigPair&&(n.sigMap.sigPair=[]),n.sigMap.sigPair.push(e._toProtobufSignature(a[t]))}return this._signerPublicKeys.add(o),this._publicKeys.push(e),this._transactionSigners.push(null),this}getSignaturesLegacy(){return this._requireFrozen(),this._requireNotSignOnDemand(),this._buildAllTransactions(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),SignatureMap._fromTransaction(this)}removeSignature(e){this.isFrozen()||this.freeze();const t=encode$4(e.toBytesRaw());if(!this._signerPublicKeys.has(t))throw new Error("The public key has not signed this transaction");const n=[];for(const e of this._signedTransactions.list){const r=this._removeSignaturesFromTransaction(e,t);n.push(...r)}return this._signerPublicKeys.delete(t),this._publicKeys=this._publicKeys.filter(t=>!t.equals(e)),this._transactionSigners.pop(),n}removeAllSignatures(){this.isFrozen()||this.freeze();const e=this._collectSignaturesByPublicKey();for(const e of this._signedTransactions.list)e.sigMap&&e.sigMap.sigPair&&(e.sigMap.sigPair=[]);return this._signerPublicKeys.clear(),this._publicKeys=[],this._transactionSigners=[],e}getSignatures(e){return e?this.getSignaturesLegacy():(this._requireFrozen(),this._requireNotSignOnDemand(),this._buildAllTransactions(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),SignatureMap$1._fromTransaction(this))}async getSignaturesAsync(){return this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),SignatureMap$1._fromTransaction(this)}_setTransactionId(){if(null==this._operatorAccountId&&this._transactionIds.isEmpty)throw new Error("`transactionId` must be set or `client` must be provided with `freezeWith`")}_setNodeAccountIds(e){if(this._nodeAccountIds.isEmpty){if(null==e)throw new Error("`nodeAccountId` must be set or `client` must be provided with `freezeWith`");this._nodeAccountIds.setList(e._network.getNodeAccountIdsForExecute())}}_applyMaxNodesPerTransactionLimit(e){const t=e.maxNodesPerTransaction;if(t<=0||this._nodeAccountIds.length<=t)return;this._logger&&this._logger.debug(`Trimming frozen transaction from ${this._nodeAccountIds.length} nodes to ${t} nodes based on maxNodesPerTransaction setting`);const n=this._nodeAccountIds.list.slice(0,t),r=this._nodeAccountIds.length,o=this._transactionIds.length,a=[];for(let e=0;e<o;e++){const n=e*r;for(let e=0;e<t;e++){const t=n+e;t<this._signedTransactions.length&&a.push(this._signedTransactions.get(t))}}this._transactions.clear(),this._nodeAccountIds.locked=!1,this._nodeAccountIds.setList(n),this._nodeAccountIds.locked=!0,this._signedTransactions.setList(a)}setBatchKey(e){return this._requireNotFrozen(),this._batchKey=e,this}get batchKey(){return this._batchKey}get signableNodeBodyBytesList(){return this._requireFrozen(),this._signedTransactions.list.map(e=>{if(!e.bodyBytes)throw new Error("Missing bodyBytes in signed transaction.");const t=libExports.proto.TransactionBody.decode(e.bodyBytes);if(!t.nodeAccountID)throw new Error("Missing nodeAccountID in transaction body.");const n=AccountId._fromProtobuf(t.nodeAccountID);if(!t.transactionID)throw new Error("Missing transactionID in transaction body.");const r=TransactionId._fromProtobuf(t.transactionID);return new SignableNodeTransactionBodyBytes(n,r,e.bodyBytes)})}_buildSignedTransactions(){this._signedTransactions.locked||this._signedTransactions.setList(this._nodeAccountIds.list.map(e=>this._makeSignedTransaction(e)))}_buildIncompleteTransactions(){0==this._nodeAccountIds.length?this._transactions.setList([this._makeSignedTransaction(null)]):this._transactions.setList(this._nodeAccountIds.list.map(e=>this._makeSignedTransaction(e)))}freeze(){return this.freezeWith(null)}_freezeWithAccountId(e){null==this._operatorAccountId&&(this._operatorAccountId=e)}freezeWith(e){if(this._signOnDemand=null!=e&&e.signOnDemand,this._operator=null!=e?e._operator:null,this._freezeWithAccountId(null!=e?e.operatorAccountId:null),this._maxTransactionFee=null==this._maxTransactionFee?null!=e&&null!=e.defaultMaxTransactionFee?e.defaultMaxTransactionFee:this._defaultMaxTransactionFee:this._maxTransactionFee,this._regenerateTransactionId=null!=e&&null==this._regenerateTransactionId?e.defaultRegenerateTransactionId:this._regenerateTransactionId,this.batchKey?this._nodeAccountIds.setList([NODE_ACCOUNT_BATCH_ID]):this._setNodeAccountIds(e),this._setTransactionId(),null!=e)for(const t of this._transactionIds.list)null!=t.accountId&&t.accountId.validateChecksum(e);return this._buildNewTransactionIdList(),this._signOnDemand||this._buildSignedTransactions(),this}async signWithSigner(e){return await e.signTransaction(this),this}async freezeWithSigner(e){return await e.populateTransaction(this),this.freeze(),this}toBytes(){return this._requireNotSignOnDemand(),this._isFrozen()?(this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),this._buildAllTransactions()):this._buildIncompleteTransactions(),libExports.proto.TransactionList.encode({transactionList:this._transactions.list}).finish()}async toBytesAsync(){return this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),libExports.proto.TransactionList.encode({transactionList:this._transactions.list}).finish()}async getTransactionHash(){return this._requireFrozen(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),this._transactions.setLocked(),this._signedTransactions.setLocked(),digest(this._transactions.get(0).signedTransactionBytes)}async getTransactionHashPerNode(){return this._requireFrozen(),this._transactionIds.setLocked(),this._nodeAccountIds.setLocked(),await this._buildAllTransactionsAsync(),await TransactionHashMap._fromTransaction(this)}isFrozen(){return this._signedTransactions.length>0}_getTransactionId(){const e=this.transactionId;if(null==e)throw new Error("transaction must have been frozen before getting the transaction ID, try calling `freeze`");return e}_validateChecksums(e){}async _beforeExecute(e){this.transactionNodeIds=Object.values(e.network).map(e=>e.toString()),this._logger&&this._logger.info(`Network used: ${e._network.networkName}`),this._isFrozen()||this.freezeWith(e),this._applyMaxNodesPerTransactionLimit(e),e.isAutoValidateChecksumsEnabled()&&this._validateChecksums(e),null!=this._operator&&null!=this._operator||(this._operator=null!=e?e._operator:null),null!=this._operatorAccountId&&null!=this._operatorAccountId||(this._operatorAccountId=null!=e&&null!=e._operator?e._operator.accountId:null),null!=this._operator&&await this.signWith(this._operator.publicKey,this._operator.transactionSigner)}async _makeRequestAsync(){const e=this._transactionIds.index*this._nodeAccountIds.length+this._nodeAccountIds.index;return this._signOnDemand||this._isThrottled?await this._buildTransactionAsync():(this._buildTransaction(e),this._transactions.get(e))}async _signTransaction(){const e=this._makeSignedTransaction(this._nodeAccountIds.next),t=e.bodyBytes;for(let n=0;n<this._publicKeys.length;n++){const r=this._publicKeys[n],o=this._transactionSigners[n];if(null==o)continue;const a=await o(t);null==e.sigMap&&(e.sigMap={}),null==e.sigMap.sigPair&&(e.sigMap.sigPair=[]),e.sigMap.sigPair.push(r._toProtobufSignature(a))}return e}_buildNewTransactionIdList(){if(this._transactionIds.locked||null==this._operatorAccountId)return;const e=TransactionId.withValidStart(this._operatorAccountId,Timestamp.generate());this._transactionIds.set(this._transactionIds.index,e)}_buildAllTransactions(){for(let e=0;e<this._signedTransactions.length;e++)this._buildTransaction(e)}async _buildAllTransactionsAsync(){if(this._signOnDemand){if(this._buildSignedTransactions(),!this._transactions.locked)for(let e=0;e<this._signedTransactions.length;e++)this._transactions.push(await this._buildTransactionAsync())}else this._buildAllTransactions()}_buildTransaction(e){if(this._transactions.length<e)for(let t=this._transactions.length;t<e;t++)this._transactions.push(null);null!=this._transactions.list[e]&&this._transactions.set(e,{signedTransactionBytes:libExports.proto.SignedTransaction.encode(this._signedTransactions.get(e)).finish()}),this._transactions.setIfAbsent(e,()=>({signedTransactionBytes:libExports.proto.SignedTransaction.encode(this._signedTransactions.get(e)).finish()}))}async _buildTransactionAsync(){return{signedTransactionBytes:libExports.proto.SignedTransaction.encode(await this._signTransaction()).finish()}}_getStatusAndExecutionState(e,t){const{nodeTransactionPrecheckCode:n}=t,r=Status._fromCode(null!=n?n:libExports.proto.ResponseCodeEnum.OK);switch(this._logger&&(this._logger.debug(`[${this._getLogId()}] received status ${r.toString()}`),this._logger.info(`SDK Transaction Status Response: ${r.toString()}`)),r){case Status.Busy:case Status.Unknown:case Status.PlatformTransactionNotCreated:case Status.PlatformNotActive:case Status.InvalidNodeAccount:return[r,ExecutionState.Retry];case Status.Ok:return[r,ExecutionState.Finished];case Status.TransactionExpired:return this._transactionIds.locked||null!=this._regenerateTransactionId&&!this._regenerateTransactionId?[r,ExecutionState.Error]:(this._buildNewTransactionIdList(),[r,ExecutionState.Retry]);default:return[r,ExecutionState.Error]}}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=t,o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);return this._logger&&this._logger.info(`Transaction Error Info: ${o.toString()}, ${this.transactionId.toString()}`),new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null})}async _mapResponse(e,t,n){const r=await digest(n.signedTransactionBytes),o=this._getTransactionId();return this._transactionIds.advance(),this._logger&&this._logger.info(`Transaction Info: ${JSON.stringify(new TransactionResponse({nodeId:t,transactionHash:r,transactionId:o,logger:this._logger}).toJSON())}`),new TransactionResponse({nodeId:t,transactionHash:r,transactionId:o,transaction:this,logger:this._logger,transactionNodeAccountIds:this._nodeAccountIds.isEmpty?void 0:this._nodeAccountIds.list})}_makeSignedTransaction(e){const t=this._makeTransactionBody(e);this._logger&&this._logger.info(`Transaction Body: ${JSON.stringify(t)}`);return{sigMap:{sigPair:[]},bodyBytes:libExports.proto.TransactionBody.encode(t).finish()}}isBatchedAndNotBatchTransaction(){return null!=this.batchKey&&"atomicBatch"!=this._getTransactionDataCase()}_makeTransactionBody(e){return{[this._getTransactionDataCase()]:this._makeTransactionData(),transactionFee:null!=this._maxTransactionFee?this._maxTransactionFee.toTinybars():null,memo:this._transactionMemo,transactionID:null!=this._transactionIds.current?this._transactionIds.current._toProtobuf():null,nodeAccountID:null!=e?e._toProtobuf():null,transactionValidDuration:{seconds:Long.fromNumber(this._transactionValidDuration)},maxCustomFees:null!=this._customFeeLimits?this._customFeeLimits.map(e=>e._toProtobuf()):null,batchKey:this.batchKey?._toProtobufKey()}}_getTransactionDataCase(){throw new Error("not implemented")}_getScheduledTransactionBody(){return{memo:this.transactionMemo,transactionFee:null==this._maxTransactionFee?this._defaultMaxTransactionFee.toTinybars():this._maxTransactionFee.toTinybars(),maxCustomFees:null!=this._customFeeLimits?this._customFeeLimits.map(e=>e._toProtobuf()):null,[this._getTransactionDataCase()]:this._makeTransactionData()}}_makeTransactionData(){throw new Error("not implemented")}_isFrozen(){return this._signOnDemand||this._signedTransactions.length>0}_requireNotFrozen(){if(this._isFrozen())throw new Error("transaction is immutable; it has at least one signature or has been explicitly frozen")}_requireNotSignOnDemand(){if(this._signOnDemand)throw new Error("Please use `toBytesAsync()` if `signOnDemand` is enabled")}_requireFrozen(){if(!this._isFrozen())throw new Error("transaction must have been frozen before calculating the hash will be stable, try calling `freeze`")}_requireOneNodeAccountId(){if(1!=this._nodeAccountIds.length)throw"transaction did not have exactly one node ID set"}_requestToBytes(e){return libExports.proto.Transaction.encode(e).finish()}_responseToBytes(e){return libExports.proto.TransactionResponse.encode(e).finish()}_removeSignaturesFromTransaction(e,t){const n=[];return e.sigMap&&e.sigMap.sigPair?(e.sigMap.sigPair=e.sigMap.sigPair.filter(e=>{const r=this._shouldRemoveSignature(e,t),o=e.ed25519??e.ECDSASecp256k1;return r&&o&&n.push(o),!r}),n):[]}_shouldRemoveSignature=(e,t)=>encode$4(e?.pubKeyPrefix||new Uint8Array)===t;_collectSignaturesByPublicKey(){const e=new Map,t={};for(const n of this._signedTransactions.list){if(!n.sigMap||!n.sigMap.sigPair)return new Map;for(const r of n.sigMap.sigPair){const n=r.ed25519??r.ECDSASecp256k1;if(!n||!r.pubKeyPrefix)return new Map;const o=encode$4(r.pubKeyPrefix);let a=t[o];a||(a=PublicKey.fromString(o),t[o]=a),e.has(a)||e.set(a,[]);const i=e.get(a);i&&i.push(n)}}return e}}const SCHEDULE_CREATE_TRANSACTION=[],NftHookType=Object.freeze({PRE_HOOK_SENDER:0,PRE_POST_HOOK_SENDER:1,PRE_HOOK_RECEIVER:2,PRE_POST_HOOK_RECEIVER:3});class NftHookCall extends HookCall{constructor(e){if(super(e),null==e.type)throw new Error("type cannot be null");this._type=e.type}get type(){return this._type}static _fromProtobufWithType(e,t){return new NftHookCall({hookId:null!=e.hookId?e.hookId:void 0,evmHookCall:e.evmHookCall?EvmHookCall._fromProtobuf(e.evmHookCall):void 0,type:t})}}class TokenNftTransfer{constructor(e){this.tokenId=e.tokenId instanceof TokenId?e.tokenId:TokenId.fromString(e.tokenId),this.senderAccountId=e.senderAccountId instanceof AccountId?e.senderAccountId:AccountId.fromString(e.senderAccountId),this.receiverAccountId=e.receiverAccountId instanceof AccountId?e.receiverAccountId:AccountId.fromString(e.receiverAccountId),this.serialNumber=Long.fromValue(e.serialNumber),this.senderHookCall=e.senderHookCall,this.receiverHookCall=e.receiverHookCall,this.isApproved=e.isApproved}static _fromProtobuf(e){const t=[];for(const n of e){const e=TokenId._fromProtobuf(n.token);for(const r of null!=n.nftTransfers?n.nftTransfers:[]){let n,o;null!=r.preTxSenderAllowanceHook?n=NftHookCall._fromProtobufWithType(r.preTxSenderAllowanceHook,NftHookType.PRE_HOOK_SENDER):null!=r.prePostTxSenderAllowanceHook&&(n=NftHookCall._fromProtobufWithType(r.prePostTxSenderAllowanceHook,NftHookType.PRE_POST_HOOK_SENDER)),null!=r.preTxReceiverAllowanceHook?o=NftHookCall._fromProtobufWithType(r.preTxReceiverAllowanceHook,NftHookType.PRE_HOOK_RECEIVER):null!=r.prePostTxReceiverAllowanceHook&&(o=NftHookCall._fromProtobufWithType(r.prePostTxReceiverAllowanceHook,NftHookType.PRE_POST_HOOK_RECEIVER)),t.push(new TokenNftTransfer({tokenId:e,senderAccountId:AccountId._fromProtobuf(r.senderAccountID),receiverAccountId:AccountId._fromProtobuf(r.receiverAccountID),serialNumber:null!=r.serialNumber?r.serialNumber:Long.ZERO,isApproved:1==r.isApproval,senderHookCall:n,receiverHookCall:o}))}}return t}_toProtobuf(){const e={senderAccountID:this.senderAccountId._toProtobuf(),receiverAccountID:this.receiverAccountId._toProtobuf(),serialNumber:this.serialNumber,isApproval:this.isApproved};if(null!=this.senderHookCall)switch(this.senderHookCall.type){case NftHookType.PRE_HOOK_SENDER:e.preTxSenderAllowanceHook=this.senderHookCall._toProtobuf();break;case NftHookType.PRE_POST_HOOK_SENDER:e.prePostTxSenderAllowanceHook=this.senderHookCall._toProtobuf()}if(null!=this.receiverHookCall)switch(this.receiverHookCall.type){case NftHookType.PRE_HOOK_RECEIVER:e.preTxReceiverAllowanceHook=this.receiverHookCall._toProtobuf();break;case NftHookType.PRE_POST_HOOK_RECEIVER:e.prePostTxReceiverAllowanceHook=this.receiverHookCall._toProtobuf()}return e}}class NullableTokenDecimalMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class AbstractTokenTransferTransaction extends Transaction{constructor(e={}){super(),this._tokenTransfers=[],this._nftTransfers=[];for(const t of null!=e.tokenTransfers?e.tokenTransfers:[])this.addTokenTransfer(t.tokenId,t.accountId,t.amount);for(const t of null!=e.nftTransfers?e.nftTransfers:[])this.addNftTransfer(t.tokenId,t.serial,t.sender,t.recipient)}addNftTransfer(e,t,n,r){return this._addNftTransfer(!1,e,t,n,r)}_addTokenTransfer(e,t,n,r,o,a){this._requireNotFrozen();const i=e instanceof TokenId?e:TokenId.fromString(e),s=t instanceof AccountId?t:AccountId.fromString(t),c=convertAmountToLong(n);for(const e of this._tokenTransfers)if(0===e.tokenId.compare(i)&&0===e.accountId.compare(s))return e.amount=e.amount.add(c),e.expectedDecimals=o,this;return this._tokenTransfers.push(new TokenTransfer({tokenId:e,accountId:t,expectedDecimals:o,amount:n,isApproved:r,hookCall:a})),this}addTokenTransfer(e,t,n){return this._addTokenTransfer(e,t,n,!1,null)}_addNftTransfer(e,t,n,r,o,a,i){let s,c,u;if(this._requireNotFrozen(),t instanceof NftId)s=t,c="string"==typeof n?AccountId.fromString(n):n,u="string"==typeof r?AccountId.fromString(r):r;else if(t instanceof TokenId)s=new NftId(t,n),c="string"==typeof r?AccountId.fromString(r):r,u="string"==typeof o?AccountId.fromString(o):o;else try{s=NftId.fromString(t),c="string"==typeof n?AccountId.fromString(n):n,u="string"==typeof r?AccountId.fromString(r):r}catch(e){const a=TokenId.fromString(t);s=new NftId(a,n),c="string"==typeof r?AccountId.fromString(r):r,u="string"==typeof o?AccountId.fromString(o):o}for(const e of this._nftTransfers)if(0===e.tokenId.compare(s.tokenId)&&0===e.serialNumber.compare(s.serial))return e.senderAccountId=c,e.receiverAccountId=u,this;return this._nftTransfers.push(new TokenNftTransfer({tokenId:s.tokenId,serialNumber:s.serial,senderAccountId:c,receiverAccountId:u,isApproved:e,senderHookCall:a,receiverHookCall:i})),this}addApprovedNftTransfer(e,t,n,r){return this._addNftTransfer(!0,e,t,n,r)}addApprovedTokenTransfer(e,t,n){return this._addTokenTransfer(e,t,n,!0,null)}addTokenTransferWithDecimals(e,t,n,r){this._requireNotFrozen();const o=e instanceof TokenId?e:TokenId.fromString(e),a=t instanceof AccountId?t:AccountId.fromString(t),i=convertAmountToLong(n);let s=!1;for(const e of this._tokenTransfers)if(0===e.tokenId.compare(o)){if(null!=e.expectedDecimals&&e.expectedDecimals!==r)throw new Error("expected decimals mis-match");e.expectedDecimals=r,0===e.accountId.compare(a)&&(e.amount=e.amount.add(i),e.expectedDecimals=r,s=!0)}return s||this._tokenTransfers.push(new TokenTransfer({tokenId:e,accountId:t,expectedDecimals:r,amount:n,isApproved:!1})),this}get tokenIdDecimals(){const e=new NullableTokenDecimalMap;for(const t of this._tokenTransfers)e._set(t.tokenId,t.expectedDecimals);return e}get nftTransfers(){const e=new TokenNftTransferMap;for(const t of this._nftTransfers){const n=e.get(t.tokenId),r={sender:t.senderAccountId,recipient:t.receiverAccountId,serial:t.serialNumber,isApproved:t.isApproved};null!=n?n.push(r):e._set(t.tokenId,[r])}return e}get tokenTransfers(){const e=new TokenTransferMap;for(const t of this._tokenTransfers){let n=e.get(t.tokenId);null!=n?n._set(t.accountId,t.amount):(n=new TokenTransferAccountMap,n._set(t.accountId,t.amount),e._set(t.tokenId,n))}return e}_makeTransactionData(){const e=[];this._tokenTransfers.sort((e,t)=>{const n=e.tokenId.compare(t.tokenId);return 0!==n?n:e.accountId.compare(t.accountId)}),this._nftTransfers.sort((e,t)=>{const n=e.senderAccountId.compare(t.senderAccountId);if(0!=n)return n;const r=e.receiverAccountId.compare(t.receiverAccountId);return 0!=r?r:e.serialNumber.compare(t.serialNumber)});let t=0,n=0;for(;t<this._tokenTransfers.length||n<this._nftTransfers.length;)if(t<this._tokenTransfers.length&&n<this._nftTransfers.length){const r=this._tokenTransfers[t].tokenId,o=this._nftTransfers[n].tokenId,a=e.length>0?e[e.length-1]:null,i=null!=a?a.tokenId:null;if(null!=a&&null!=i&&0===i.compare(r)){a.transfers.push(this._tokenTransfers[t++]);continue}if(null!=a&&null!=i&&0===i.compare(o)){a.nftTransfers.push(this._nftTransfers[n++]);continue}const s=r.compare(o);0===s?e.push({tokenId:r,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[this._nftTransfers[n++]]}):s<0?e.push({tokenId:r,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[]}):e.push({tokenId:o,expectedDecimals:null,transfers:[],nftTransfers:[this._nftTransfers[n++]]})}else if(t<this._tokenTransfers.length){const n=this._tokenTransfers[t].tokenId;let r;for(const t of e)0===t.tokenId.compare(n)&&(r=t);const o=null!=r?r.tokenId:null;if(null!=r&&null!=o&&0===o.compare(n)){r.transfers.push(this._tokenTransfers[t++]);continue}e.push({tokenId:n,expectedDecimals:this._tokenTransfers[t].expectedDecimals,transfers:[this._tokenTransfers[t++]],nftTransfers:[]})}else if(n<this._nftTransfers.length){const t=this._nftTransfers[n].tokenId;let r;for(const n of e)0===n.tokenId.compare(t)&&(r=n);const o=null!=r?r.tokenId:null;if(null!=r&&null!=o&&0===o.compare(t)){r.nftTransfers.push(this._nftTransfers[n++]);continue}e.push({tokenId:t,expectedDecimals:null,transfers:[],nftTransfers:[this._nftTransfers[n++]]})}return{tokenTransfers:e.map(e=>({token:e.tokenId._toProtobuf(),expectedDecimals:null!=e.expectedDecimals?{value:e.expectedDecimals}:null,transfers:e.transfers.map(e=>e._toProtobuf()),nftTransfers:e.nftTransfers.map(e=>e._toProtobuf())}))}}}class TokenAirdropTransaction extends AbstractTokenTransferTransaction{constructor(e={}){if(super(),null!=e.tokenTransfers)for(const t of e.tokenTransfers)this._addTokenTransfer(t.tokenId,t.accountId,t.amount,t.isApproved,t.expectedDecimals);if(this._nftTransfers=[],null!=e.nftTransfers)for(const t of e.nftTransfers)this._addNftTransfer(t.isApproved,t.tokenId,t.serialNumber,t.senderAccountId,t.receiverAccountId)}addApprovedTokenTransferWithDecimals(e,t,n,r){return this._requireNotFrozen(),this._addTokenTransfer(e,t,n,!0,r,void 0),this}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenAirdrop,i=TokenTransfer._fromProtobuf(a.tokenTransfers??[]),s=TokenNftTransfer._fromProtobuf(a.tokenTransfers??[]);return Transaction._fromProtobufTransactions(new TokenAirdropTransaction({nftTransfers:s,tokenTransfers:i}),e,t,n,r,o)}_execute(e,t){return e.token.airdropTokens(t)}_getTransactionDataCase(){return"tokenAirdrop"}_getLogId(){return`TokenAirdropTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenAirdrop",TokenAirdropTransaction._fromProtobuf);class AirdropPendingTransaction extends Transaction{constructor(e){super(),this._pendingAirdropIds=[],null!=e?.pendingAirdropIds&&(this._pendingAirdropIds=e.pendingAirdropIds)}get pendingAirdropIds(){return this._pendingAirdropIds}addPendingAirdropId(e){return this._requireNotFrozen(),this._pendingAirdropIds.push(e),this}setPendingAirdropIds(e){return this._requireNotFrozen(),this._pendingAirdropIds=e,this}}class TokenClaimAirdropTransaction extends AirdropPendingTransaction{constructor(e={}){super(e)}_execute(e,t){return e.token.claimAirdrop(t)}_makeTransactionData(){return{pendingAirdrops:this.pendingAirdropIds.map(e=>e.toBytes())}}static _fromProtobuf(e,t,n,r,o){const a=o[0],{pendingAirdrops:i}=a.tokenClaimAirdrop;return Transaction._fromProtobufTransactions(new TokenClaimAirdropTransaction({pendingAirdropIds:i?.map(e=>PendingAirdropId.fromBytes(e))}),e,t,n,r,o)}_getTransactionDataCase(){return"tokenClaimAirdrop"}_getLogId(){return`TokenClaimAirdropTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenClaimAirdrop",TokenClaimAirdropTransaction._fromProtobuf);class TokenCancelAirdropTransaction extends AirdropPendingTransaction{constructor(e={}){super(e)}_makeTransactionData(){return{pendingAirdrops:this.pendingAirdropIds.map(e=>e.toBytes())}}_execute(e,t){return e.token.cancelAirdrop(t)}_getTransactionDataCase(){return"tokenCancelAirdrop"}static _fromProtobuf(e,t,n,r,o){const a=o[0],{pendingAirdrops:i}=a.tokenCancelAirdrop;return Transaction._fromProtobufTransactions(new TokenCancelAirdropTransaction({pendingAirdropIds:i?.map(e=>PendingAirdropId.fromBytes(e))}),e,t,n,r,o)}_getLogId(){return`TokenCancelAirdrop:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenCancelAirdrop",TokenCancelAirdropTransaction._fromProtobuf);class HbarAllowance{constructor(e){this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.amount=e.amount,Object.freeze(this)}static _fromProtobuf(e){return new HbarAllowance({spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}static _fromGrantedProtobuf(e,t){return new HbarAllowance({spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}_toProtobuf(){return{owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,amount:null!=this.amount?this.amount.toTinybars():null}}_validateChecksums(e){null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}toJSON(){return{ownerAccountId:null!=this.ownerAccountId?this.ownerAccountId.toString():null,spenderAccountId:null!=this.spenderAccountId?this.spenderAccountId.toString():null,amount:null!=this.amount?this.amount.toString():null}}}class TokenAllowance{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.amount=null!=e.amount?convertAmountToLong(e.amount):null,Object.freeze(this)}static _fromProtobuf(e){return new TokenAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,amount:null!=e.amount?Long.fromValue(e.amount):null})}static _fromGrantedProtobuf(e,t){return new TokenAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,amount:null!=e.amount?Long.fromValue(e.amount):null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,amount:this.amount}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}class TokenNftAllowance{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.serialNumbers=e.serialNumbers,this.allSerials=e.allSerials,this.delegatingSpender=e.delegatingSpender,Object.freeze(this)}static _fromProtobuf(e){const t=null!=e.approvedForAll&&1==e.approvedForAll.value;return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:null!=e.spender?AccountId._fromProtobuf(e.spender):null,ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,serialNumbers:t?null:null!=e.serialNumbers?e.serialNumbers.map(e=>Long.fromValue(e)):[],allSerials:t,delegatingSpender:null!=e.delegatingSpender?AccountId._fromProtobuf(e.delegatingSpender):null})}static _fromGrantedProtobuf(e,t){return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:AccountId._fromProtobuf(e.spender),ownerAccountId:t,serialNumbers:[],allSerials:null,delegatingSpender:null})}static _fromRemoveProtobuf(e){return new TokenNftAllowance({tokenId:TokenId._fromProtobuf(e.tokenId),spenderAccountId:null,ownerAccountId:null!=e.owner?AccountId._fromProtobuf(e.owner):null,serialNumbers:null!=e.serialNumbers?e.serialNumbers.map(e=>Long.fromValue(e)):[],allSerials:null,delegatingSpender:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,approvedForAll:null==this.serialNumbers?{value:this.allSerials}:null,serialNumbers:this.serialNumbers,delegatingSpender:null!=this.delegatingSpender?this.delegatingSpender._toProtobuf():null}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}class AccountAllowanceAdjustTransaction extends Transaction{constructor(e={}){super(),this._hbarAllowances=null!=e.hbarAllowances?e.hbarAllowances:[],this._tokenAllowances=null!=e.tokenAllowances?e.tokenAllowances:[],this._nftAllowances=null!=e.nftAllowances?e.nftAllowances:[]}get hbarAllowances(){return this._hbarAllowances}addHbarAllowance(e,t){const n=t instanceof Hbar?t:new Hbar(t);return this._adjustHbarAllowance(null,e,requireNotNegative(n))}_adjustHbarAllowance(e,t,n){return this._requireNotFrozen(),this._hbarAllowances.push(new HbarAllowance({spenderAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,ownerAccountId:"string"==typeof e?AccountId.fromString(e):e instanceof ContractId?AccountId.fromEvmAddress(e.shard,e.realm,e.toEvmAddress()):e,amount:n})),this}grantHbarAllowance(e,t,n){const r=n instanceof Hbar?n:new Hbar(n);return this._adjustHbarAllowance(e,t,requireNotNegative(r))}revokeHbarAllowance(e,t,n){const r=n instanceof Hbar?n:new Hbar(n);return this._adjustHbarAllowance(e,t,requireNotNegative(r).negated())}get tokenAllowances(){return this._tokenAllowances}addTokenAllowance(e,t,n){return this._adjustTokenAllowance(e,null,t,requireNotNegative(Long.fromValue(n)))}_adjustTokenAllowance(e,t,n,r){return this._requireNotFrozen(),this._tokenAllowances.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,amount:"number"==typeof r?Long.fromNumber(r):r})),this}grantTokenAllowance(e,t,n,r){return this._adjustTokenAllowance(e,t,n,requireNotNegative(Long.fromValue(r)))}revokeTokenAllowance(e,t,n,r){return this._adjustTokenAllowance(e,t,n,requireNotNegative(Long.fromValue(r)))}addTokenNftAllowance(e,t){const n="string"==typeof e?NftId.fromString(e):e;return this._adjustTokenNftAllowance(n,null,t)}_adjustTokenNftAllowance(e,t,n){this._requireNotFrozen();const r="string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,o="string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t;let a=!1;for(const t of this._nftAllowances)if(0===t.tokenId.compare(e.tokenId)&&null!=t.spenderAccountId&&0===t.spenderAccountId.compare(r)){null!=t.serialNumbers&&t.serialNumbers.push(e.serial),a=!0;break}return a||this._nftAllowances.push(new TokenNftAllowance({tokenId:e.tokenId,spenderAccountId:r,serialNumbers:[e.serial],ownerAccountId:o,allSerials:!1,delegatingSpender:null})),this}grantTokenNftAllowance(e,t,n){const r="string"==typeof e?NftId.fromString(e):e;return requireNotNegative(r.serial),this._adjustTokenNftAllowance(r,t,n)}revokeTokenNftAllowance(e,t,n){const r="string"==typeof e?NftId.fromString(e):e;return requireNotNegative(r.serial),this._adjustTokenNftAllowance(new NftId(r.tokenId,r.serial.negate()),t,n)}addAllTokenNftAllowance(e,t){return this._adjustTokenNftAllowanceAllSerials(e,null,t,!0)}grantTokenNftAllowanceAllSerials(e,t,n){return this._adjustTokenNftAllowanceAllSerials(e,t,n,!0)}revokeTokenNftAllowanceAllSerials(e,t,n){return this._adjustTokenNftAllowanceAllSerials(e,t,n,!1)}_adjustTokenNftAllowanceAllSerials(e,t,n,r){return this._requireNotFrozen(),this._nftAllowances.push(new TokenNftAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,ownerAccountId:null!=t?"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t:null,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,serialNumbers:null,allSerials:r,delegatingSpender:null})),this}_validateChecksums(e){this._hbarAllowances.map(t=>t._validateChecksums(e)),this._tokenAllowances.map(t=>t._validateChecksums(e)),this._nftAllowances.map(t=>t._validateChecksums(e))}_execute(e,t){return Promise.reject(new Error("This feature has been deprecated for this class."))}_getTransactionDataCase(){throw new Error("This feature has been deprecated for this class.")}_makeTransactionData(){throw new Error("This feature has been deprecated.")}_getLogId(){return`AccountAllowanceAdjustTransaction:${this._transactionIds.current.validStart.toString()}`}}class AccountAllowanceApproveTransaction extends Transaction{constructor(e={}){super(),this._hbarApprovals=null!=e.hbarApprovals?e.hbarApprovals:[],this._tokenApprovals=null!=e.tokenApprovals?e.tokenApprovals:[],this._nftApprovals=null!=e.nftApprovals?e.nftApprovals:[]}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoApproveAllowance;return Transaction._fromProtobufTransactions(new AccountAllowanceApproveTransaction({hbarApprovals:(null!=a.cryptoAllowances?a.cryptoAllowances:[]).map(e=>HbarAllowance._fromProtobuf(e)),tokenApprovals:(null!=a.tokenAllowances?a.tokenAllowances:[]).map(e=>TokenAllowance._fromProtobuf(e)),nftApprovals:(null!=a.nftAllowances?a.nftAllowances:[]).map(e=>TokenNftAllowance._fromProtobuf(e))}),e,t,n,r,o)}get hbarApprovals(){return this._hbarApprovals}approveHbarAllowance(e,t,n){return this._requireNotFrozen(),this._hbarApprovals.push(new HbarAllowance({spenderAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,ownerAccountId:"string"==typeof e?AccountId.fromString(e):e instanceof ContractId?AccountId.fromEvmAddress(e.shard,e.realm,e.toEvmAddress()):e,amount:n instanceof Hbar?n:new Hbar(n)})),this}addHbarAllowance(e,t){return this._requireNotFrozen(),this._hbarApprovals.push(new HbarAllowance({spenderAccountId:"string"==typeof e?AccountId.fromString(e):e,amount:t instanceof Hbar?t:new Hbar(t),ownerAccountId:null})),this}get tokenApprovals(){return this._tokenApprovals}approveTokenAllowance(e,t,n,r){this._requireNotFrozen();const o=convertAmountToLong(r);return this._tokenApprovals.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,amount:o})),this}addTokenAllowance(e,t,n){this._requireNotFrozen();const r=convertAmountToLong(n);return this._tokenApprovals.push(new TokenAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof t?AccountId.fromString(t):t,amount:r,ownerAccountId:null})),this}addTokenNftAllowance(e,t){return this._approveTokenNftAllowance(e,null,t,null)}get tokenNftApprovals(){return this._nftApprovals}_approveTokenNftAllowance(e,t,n,r){this._requireNotFrozen();const o="string"==typeof e?NftId.fromString(e):e,a="string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n;let i=!1;for(const e of this._nftApprovals)if(0===e.tokenId.compare(o.tokenId)&&null!=e.spenderAccountId&&0===e.spenderAccountId.compare(a)){null!=e.serialNumbers&&e.serialNumbers.push(o.serial),i=!0;break}return i||this._nftApprovals.push(new TokenNftAllowance({tokenId:o.tokenId,spenderAccountId:a,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,serialNumbers:[o.serial],allSerials:!1,delegatingSpender:"string"==typeof r?AccountId.fromString(r):r})),this}approveTokenNftAllowance(e,t,n){return this._approveTokenNftAllowance(e,t,n,null)}approveTokenNftAllowanceWithDelegatingSpender(e,t,n,r){return this._approveTokenNftAllowance(e,t,n,r)}_approveAllTokenNftAllowance(e,t,n,r){return this._requireNotFrozen(),this._nftApprovals.push(new TokenNftAllowance({tokenId:"string"==typeof e?TokenId.fromString(e):e,spenderAccountId:"string"==typeof n?AccountId.fromString(n):n instanceof ContractId?AccountId.fromEvmAddress(n.shard,n.realm,n.toEvmAddress()):n,ownerAccountId:"string"==typeof t?AccountId.fromString(t):t instanceof ContractId?AccountId.fromEvmAddress(t.shard,t.realm,t.toEvmAddress()):t,serialNumbers:null,allSerials:r,delegatingSpender:null})),this}addAllTokenNftAllowance(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!0)}approveTokenNftAllowanceAllSerials(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!0)}deleteTokenNftAllowanceAllSerials(e,t,n){return this._approveAllTokenNftAllowance(e,t,n,!1)}_validateChecksums(e){this._hbarApprovals.map(t=>t._validateChecksums(e)),this._tokenApprovals.map(t=>t._validateChecksums(e)),this._nftApprovals.map(t=>t._validateChecksums(e))}_execute(e,t){return e.crypto.approveAllowances(t)}_getTransactionDataCase(){return"cryptoApproveAllowance"}_makeTransactionData(){return{cryptoAllowances:this._hbarApprovals.map(e=>e._toProtobuf()),tokenAllowances:this._tokenApprovals.map(e=>e._toProtobuf()),nftAllowances:this._nftApprovals.map(e=>e._toProtobuf())}}_getLogId(){return`AccountAllowanceApproveTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoApproveAllowance",AccountAllowanceApproveTransaction._fromProtobuf);class AccountAllowanceDeleteTransaction extends Transaction{constructor(e={}){super(),this._nftAllowances=null!=e.nftAllowances?e.nftAllowances:[]}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoDeleteAllowance;return Transaction._fromProtobufTransactions(new AccountAllowanceDeleteTransaction({nftAllowances:(null!=a.nftAllowances?a.nftAllowances:[]).map(e=>TokenNftAllowance._fromProtobuf(e))}),e,t,n,r,o)}get tokenNftAllowanceDeletions(){return this._nftAllowances}deleteAllTokenNftAllowances(e,t){this._requireNotFrozen();const n="string"==typeof e?NftId.fromString(e):e,r="string"==typeof t?AccountId.fromString(t):t;let o=!1;for(const e of this._nftAllowances)if(0===e.tokenId.compare(n.tokenId)){null!=e.serialNumbers&&e.serialNumbers.push(n.serial),o=!0;break}return o||this._nftAllowances.push(new TokenNftAllowance({tokenId:n.tokenId,spenderAccountId:null,serialNumbers:[n.serial],ownerAccountId:r,allSerials:!1,delegatingSpender:null})),this}_validateChecksums(e){this._nftAllowances.map(t=>t._validateChecksums(e))}_execute(e,t){return e.crypto.deleteAllowances(t)}_getTransactionDataCase(){return"cryptoDeleteAllowance"}_makeTransactionData(){return{nftAllowances:this._nftAllowances.map(e=>e._toProtobuf())}}_getLogId(){return`AccountAllowanceDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDeleteAllowance",AccountAllowanceDeleteTransaction._fromProtobuf);class TokenBalanceMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class TokenDecimalMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}}class AccountBalance{constructor(e){this.hbars=e.hbars,this.tokens=e.tokens||new TokenBalanceMap,this.tokenDecimals=e.tokenDecimals||new TokenDecimalMap,Object.freeze(this)}static fromBytes(e){return AccountBalance._fromProtobuf(libExports.proto.CryptoGetAccountBalanceResponse.decode(e))}static _fromProtobuf(e){const t=new TokenBalanceMap,n=new TokenDecimalMap;if(null!=e.tokenBalances)for(const r of e.tokenBalances){const e=TokenId._fromProtobuf(r.tokenId);n._set(e,null!=r.decimals?r.decimals:0),t._set(e,Long.fromValue(r.balance))}return new AccountBalance({hbars:Hbar.fromTinybars(e.balance),tokens:t,tokenDecimals:n})}_toProtobuf(){const e=[];for(const[t,n]of this.tokens)e.push({tokenId:t._toProtobuf(),balance:n,decimals:this.tokenDecimals.get(t)});return{balance:this.hbars.toTinybars(),tokenBalances:e}}toBytes(){return libExports.proto.CryptoGetAccountBalanceResponse.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){const e=[];for(const[t,n]of this.tokens){const r=this.tokenDecimals.get(t);e.push({tokenId:t.toString(),balance:n.toString(),decimals:null!=r?r:0})}return{hbars:this.hbars.toString(),tokens:e}}}class AccountBalanceQuery extends Query{constructor(e={}){super(),this._accountId=null,this._contractId=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.cryptogetAccountBalance;return new AccountBalanceQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_isPaymentRequired(){return!1}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.crypto.cryptoGetBalance(t)}_mapResponseHeader(e){return e.cryptogetAccountBalance.header}_mapResponse(e){const t=e.cryptogetAccountBalance;return Promise.resolve(AccountBalance._fromProtobuf(t))}_onMakeRequest(e){return{cryptogetAccountBalance:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`AccountBalanceQuery:${this._timestamp.toString()}`}}QUERY_REGISTRY.set("cryptogetAccountBalance",AccountBalanceQuery._fromProtobuf.bind(null));class Duration{constructor(e){this.seconds=e instanceof Long?e:Long.fromNumber(e),Object.freeze(this)}_toProtobuf(){return{seconds:this.seconds}}static _fromProtobuf(e){return new Duration(e.seconds)}}class AccountCreateTransaction extends Transaction{constructor(e={}){super(),this._key=null,this._initialBalance=null,this._sendRecordThreshold=DEFAULT_RECORD_THRESHOLD,this._receiveRecordThreshold=DEFAULT_RECORD_THRESHOLD,this._receiverSignatureRequired=!1,this._proxyAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._accountMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=!1,this._alias=null,this._hooks=[],null!=e.hooks&&e.hooks.forEach(e=>{this.addHook(e)}),null!=e.key&&this.setKeyWithoutAlias(e.key),null!=e.receiverSignatureRequired&&this.setReceiverSignatureRequired(e.receiverSignatureRequired),null!=e.initialBalance&&this.setInitialBalance(e.initialBalance),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.accountMemo&&this.setAccountMemo(e.accountMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.alias&&this.setAlias(e.alias)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoCreateAccount;let i;return null!=a.alias&&a.alias.length>0&&20===a.alias.length&&(i=EvmAddress.fromBytes(a.alias)),Transaction._fromProtobufTransactions(new AccountCreateTransaction({key:null!=a.key?Key._fromProtobufKey(a.key):void 0,initialBalance:null!=a.initialBalance?Hbar.fromTinybars(a.initialBalance):void 0,receiverSignatureRequired:null!=a.receiverSigRequired?a.receiverSigRequired:void 0,proxyAccountId:null!=a.proxyAccountID?AccountId._fromProtobuf(a.proxyAccountID):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,accountMemo:null!=a.memo?a.memo:void 0,maxAutomaticTokenAssociations:null!=a.maxAutomaticTokenAssociations?a.maxAutomaticTokenAssociations:void 0,stakedAccountId:null!=a.stakedAccountId?AccountId._fromProtobuf(a.stakedAccountId):void 0,stakedNodeId:null!=a.stakedNodeId?a.stakedNodeId:void 0,declineStakingReward:1==a.declineReward,alias:i}),e,t,n,r,o)}get key(){return this._key}setKey(e){return this._requireNotFrozen(),this._key=e,this}setECDSAKeyWithAlias(e){this.setKeyWithoutAlias(e);const t=this._deriveECDSAKeyAlias(e);return this.setAlias(t),this}setKeyWithAlias(e,t){this.setKeyWithoutAlias(e);const n=this._deriveECDSAKeyAlias(t);return this.setAlias(n),this}setKeyWithoutAlias(e){return this._requireNotFrozen(),this._key=e,this}get initialBalance(){return this._initialBalance}setInitialBalance(e){return this._requireNotFrozen(),this._initialBalance=e instanceof Hbar?e:new Hbar(e),this}get receiverSignatureRequired(){return this._receiverSignatureRequired}setReceiverSignatureRequired(e){return this._requireNotFrozen(),this._receiverSignatureRequired=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get accountMemo(){return this._accountMemo}setAccountMemo(e){return this._requireNotFrozen(),this._accountMemo=e,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations="number"==typeof e?Long.fromNumber(e):e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get alias(){return this._alias}setAlias(e){if("string"==typeof e){if(!(e.startsWith("0x")&&42==e.length||40==e.length))throw new Error('evmAddress must be a valid EVM address with or without "0x" prefix');this._alias=EvmAddress.fromString(e)}else this._alias=e;return this}_validateChecksums(e){null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_deriveECDSAKeyAlias(e){const t=e instanceof PrivateKey&&"secp256k1"===e.type,n=e instanceof PublicKey&&"secp256k1"===e.type;if(t)return e.publicKey.toEvmAddress();if(n)return e.toEvmAddress();throw new Error("Invalid key for alias derivation provided: expected an ECDSA (secp256k1) PrivateKey or PublicKey.")}_execute(e,t){return e.crypto.createAccount(t)}_getTransactionDataCase(){return"cryptoCreateAccount"}_makeTransactionData(){let e=null;return null!=this._alias&&(e=this._alias.toBytes()),{key:null!=this._key?this._key._toProtobufKey():null,initialBalance:null!=this._initialBalance?this._initialBalance.toTinybars():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,receiveRecordThreshold:this._receiveRecordThreshold.toTinybars(),sendRecordThreshold:this._sendRecordThreshold.toTinybars(),receiverSigRequired:this._receiverSignatureRequired,memo:this._accountMemo,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?this._maxAutomaticTokenAssociations.toInt():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:this.declineStakingRewards,hookCreationDetails:this._hooks.map(e=>e._toProtobuf()),alias:e}}addHook(e){return this._hooks.push(e),this}setHooks(e){return this._hooks=e,this}get hooks(){return this._hooks}_getLogId(){return`AccountCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoCreateAccount",AccountCreateTransaction._fromProtobuf);class AccountDeleteTransaction extends Transaction{constructor(e={}){super(),this._accountId=null,this._transferAccountId=null,null!=e.accountId&&this.setAccountId(e.accountId),null!=e.transferAccountId&&this.setTransferAccountId(e.transferAccountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoDelete;return Transaction._fromProtobufTransactions(new AccountDeleteTransaction({accountId:null!=a.deleteAccountID?AccountId._fromProtobuf(a.deleteAccountID):void 0,transferAccountId:null!=a.transferAccountID?AccountId._fromProtobuf(a.transferAccountID):void 0}),e,t,n,r,o)}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(e){return this._requireNotFrozen(),this._transferAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(e)}_execute(e,t){return e.crypto.cryptoDelete(t)}_getTransactionDataCase(){return"cryptoDelete"}_makeTransactionData(){return{deleteAccountID:null!=this._accountId?this._accountId._toProtobuf():null,transferAccountID:null!=this._transferAccountId?this._transferAccountId._toProtobuf():null}}_getLogId(){return`AccountDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDelete",AccountDeleteTransaction._fromProtobuf);class StakingInfo{constructor(e){this.declineStakingReward=e.declineStakingReward,this.stakePeriodStart=e.stakePeriodStart,this.pendingReward=e.pendingReward,this.stakedToMe=e.stakedToMe,this.stakedAccountId=e.stakedAccountId,this.stakedNodeId=e.stakedNodeId,Object.freeze(this)}static _fromProtobuf(e){return new StakingInfo({declineStakingReward:1==e.declineReward,stakePeriodStart:null!=e.stakePeriodStart?Timestamp._fromProtobuf(e.stakePeriodStart):null,pendingReward:null!=e.pendingReward?Hbar.fromTinybars(e.pendingReward):null,stakedToMe:null!=e.stakedToMe?Hbar.fromTinybars(e.stakedToMe):null,stakedAccountId:null!=e.stakedAccountId?AccountId._fromProtobuf(e.stakedAccountId):null,stakedNodeId:null!=e.stakedNodeId?e.stakedNodeId:null})}_toProtobuf(){return{declineReward:this.declineStakingReward,stakePeriodStart:null!=this.stakePeriodStart?this.stakePeriodStart._toProtobuf():null,pendingReward:null!=this.pendingReward?this.pendingReward.toTinybars():null,stakedToMe:null!=this.stakedToMe?this.stakedToMe.toTinybars():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId}}static fromBytes(e){return StakingInfo._fromProtobuf(libExports.proto.StakingInfo.decode(e))}toBytes(){return libExports.proto.StakingInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{declineStakingReward:this.declineStakingReward,stakePeriodStart:null!=this.stakePeriodStart?this.stakePeriodStart.toString():null,pendingReward:null!=this.pendingReward?this.pendingReward.toString():null,stakedToMe:null!=this.stakedToMe?this.stakedToMe.toString():null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId.toString():null,stakedNodeId:null!=this.stakedNodeId?this.stakedNodeId.toString():null}}}class LiveHash{constructor(e){this.accountId=e.accountId,this.hash=e.hash,this.keys=e.keys,this.duration=e.duration,Object.freeze(this)}static _fromProtobuf(e){const t=e;return new LiveHash({accountId:AccountId._fromProtobuf(t.accountId),hash:null!=t.hash?t.hash:new Uint8Array,keys:null!=t.keys?KeyList.__fromProtobufKeyList(t.keys):new KeyList,duration:Duration._fromProtobuf(t.duration)})}_toProtobuf(){return{accountId:this.accountId._toProtobuf(),hash:this.hash,keys:this.keys._toProtobufKey().keyList,duration:this.duration._toProtobuf()}}}class TokenRelationship{constructor(e){this.tokenId=e.tokenId,this.symbol=e.symbol,this.balance=e.balance,this.isKycGranted=e.isKycGranted,this.isFrozen=e.isFrozen,this.automaticAssociation=e.automaticAssociation,Object.freeze(this)}static _fromProtobuf(e){const t=TokenId._fromProtobuf(e.tokenId),n=null==e.kycStatus||0===e.kycStatus?null:1===e.kycStatus,r=null==e.freezeStatus||0===e.freezeStatus?null:1===e.freezeStatus;return new TokenRelationship({tokenId:t,symbol:e.symbol,balance:null!=e.balance?e.balance instanceof Long?e.balance:Long.fromValue(e.balance):Long.ZERO,isKycGranted:n,isFrozen:r,automaticAssociation:null!=e.automaticAssociation?e.automaticAssociation:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),symbol:this.symbol,balance:this.balance,kycStatus:null==this.isKycGranted?0:this.isKycGranted?1:2,freezeStatus:null==this.isFrozen?0:this.isFrozen?1:2,automaticAssociation:this.automaticAssociation}}}class TokenRelationshipMap extends ObjectMap{constructor(){super(e=>TokenId.fromString(e))}static _fromProtobuf(e){const t=new TokenRelationshipMap;for(const n of e){const e=TokenId._fromProtobuf(n.tokenId);t._set(e,TokenRelationship._fromProtobuf(n))}return t}_toProtobuf(){const e=[];for(const[t,n]of this)e.push(n._toProtobuf());return e}}class LedgerId{constructor(e){this._ledgerId=e,Object.freeze(this)}static fromString(e){switch(e){case NETNAMES[0]:case"0":return LedgerId.MAINNET;case NETNAMES[1]:case"1":return LedgerId.TESTNET;case NETNAMES[2]:case"2":return LedgerId.PREVIEWNET;case NETNAMES[3]:case"3":return LedgerId.LOCAL_NODE;default:try{let t=decode$7(e);return new LedgerId(t)}catch(e){throw new Error("Default reached for fromString")}}}toString(){if(1!=this._ledgerId.length)return encode$4(this._ledgerId);switch(this._ledgerId[0]){case 0:return NETNAMES[0];case 1:return NETNAMES[1];case 2:return NETNAMES[2];case 3:return NETNAMES[3];default:return encode$4(this._ledgerId)}}static fromBytes(e){return new LedgerId(e)}toBytes(){return this._ledgerId}isMainnet(){return this.toString()==NETNAMES[0]}isTestnet(){return this.toString()==NETNAMES[1]}isPreviewnet(){return this.toString()==NETNAMES[2]}isLocalNode(){return this.toString()==NETNAMES[3]}}const NETNAMES=["mainnet","testnet","previewnet","local-node"];LedgerId.MAINNET=new LedgerId(new Uint8Array([0])),LedgerId.TESTNET=new LedgerId(new Uint8Array([1])),LedgerId.PREVIEWNET=new LedgerId(new Uint8Array([2])),LedgerId.LOCAL_NODE=new LedgerId(new Uint8Array([3]));class AccountInfo{constructor(e){this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.isDeleted=e.isDeleted,this.proxyAccountId=e.proxyAccountId,this.proxyReceived=e.proxyReceived,this.key=e.key,this.balance=e.balance,this.sendRecordThreshold=e.sendRecordThreshold,this.receiveRecordThreshold=e.receiveRecordThreshold,this.isReceiverSignatureRequired=e.isReceiverSignatureRequired,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.liveHashes=e.liveHashes,this.tokenRelationships=e.tokenRelationships,this.accountMemo=e.accountMemo,this.ownedNfts=e.ownedNfts,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.aliasKey=e.aliasKey,this.ledgerId=e.ledgerId,this.hbarAllowances=e.hbarAllowances,this.tokenAllowances=e.tokenAllowances,this.nftAllowances=e.nftAllowances,this.ethereumNonce=e.ethereumNonce,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(e){let t=null!=e.alias&&e.alias.length>0?Key._fromProtobufKey(libExports.proto.Key.decode(e.alias)):null;t instanceof PublicKey||(t=null);const n=AccountId._fromProtobuf(e.accountID);return new AccountInfo({accountId:n,contractAccountId:null!=e.contractAccountID?e.contractAccountID:null,isDeleted:null!=e.deleted&&e.deleted,key:Key._fromProtobufKey(e.key),balance:Hbar.fromTinybars(null!=e.balance?e.balance:0),sendRecordThreshold:Hbar.fromTinybars(null!=e.generateSendRecordThreshold?e.generateSendRecordThreshold:0),receiveRecordThreshold:Hbar.fromTinybars(null!=e.generateReceiveRecordThreshold?e.generateReceiveRecordThreshold:0),isReceiverSignatureRequired:null!=e.receiverSigRequired&&e.receiverSigRequired,expirationTime:Timestamp._fromProtobuf(e.expirationTime),autoRenewPeriod:null!=e.autoRenewPeriod?new Duration(e.autoRenewPeriod.seconds):new Duration(0),proxyAccountId:null!=e.proxyAccountID&&0!==Long.fromValue(e.proxyAccountID.shardNum).toInt()&&0!==Long.fromValue(e.proxyAccountID.realmNum).toInt()&&0!==Long.fromValue(e.proxyAccountID.accountNum).toInt()?AccountId._fromProtobuf(e.proxyAccountID):null,proxyReceived:Hbar.fromTinybars(null!=e.proxyReceived?e.proxyReceived:0),liveHashes:(null!=e.liveHashes?e.liveHashes:[]).map(e=>LiveHash._fromProtobuf(e)),tokenRelationships:TokenRelationshipMap._fromProtobuf(null!=e.tokenRelationships?e.tokenRelationships:[]),accountMemo:null!=e.memo?e.memo:"",ownedNfts:e.ownedNfts?e.ownedNfts:Long.ZERO,maxAutomaticTokenAssociations:e.maxAutomaticTokenAssociations?Long.fromNumber(e.maxAutomaticTokenAssociations):Long.ZERO,aliasKey:t,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,hbarAllowances:[],tokenAllowances:[],nftAllowances:[],ethereumNonce:null!=e.ethereumNonce?e.ethereumNonce:null,stakingInfo:null!=e.stakingInfo?StakingInfo._fromProtobuf(e.stakingInfo):null})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,deleted:this.isDeleted,proxyAccountID:null!=this.proxyAccountId?this.proxyAccountId._toProtobuf():null,proxyReceived:this.proxyReceived.toTinybars(),key:this.key._toProtobufKey(),balance:this.balance.toTinybars(),generateSendRecordThreshold:this.sendRecordThreshold.toTinybars(),generateReceiveRecordThreshold:this.receiveRecordThreshold.toTinybars(),receiverSigRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:this.autoRenewPeriod._toProtobuf(),liveHashes:this.liveHashes.map(e=>e._toProtobuf()),tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,memo:this.accountMemo,ownedNfts:this.ownedNfts,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toInt(),alias:null!=this.aliasKey?libExports.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,ethereumNonce:this.ethereumNonce,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null}}static fromBytes(e){return AccountInfo._fromProtobuf(libExports.proto.CryptoGetInfoResponse.AccountInfo.decode(e))}toBytes(){return libExports.proto.CryptoGetInfoResponse.AccountInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{balance:this.balance.toString(),accountId:this.accountId.toString(),contractAccountId:this.contractAccountId,isDeleted:this.isDeleted,proxyAccountId:null!=this.proxyAccountId?this.proxyAccountId.toString():null,proxyReceived:this.proxyReceived.toString(),key:null!=this.key?this.key.toString():null,sendRecordThreshold:this.sendRecordThreshold.toString(),receiveRecordThreshold:this.receiveRecordThreshold.toString(),isReceiverSignatureRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime.toString(),autoRenewPeriod:this.autoRenewPeriod.toString(),accountMemo:this.accountMemo,ownedNfts:this.ownedNfts.toString(),maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toString(),aliasKey:null!=this.aliasKey?this.aliasKey.toString():null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,ethereumNonce:null!=this.ethereumNonce?this.ethereumNonce.toString():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo.toJSON():null}}}class AccountInfoQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e){const t=e.cryptoGetInfo;return new AccountInfoQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getAccountInfo(t)}async getCost(e){return super.getCost(e)}_mapResponseHeader(e){return e.cryptoGetInfo.header}_mapResponse(e,t,n){const r=e.cryptoGetInfo;return Promise.resolve(AccountInfo._fromProtobuf(r.accountInfo))}_onMakeRequest(e){return{cryptoGetInfo:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetInfo",AccountInfoQuery._fromProtobuf);class AccountInfoFlow{static async verifySignature(e,t,n,r){const o=await(new AccountInfoQuery).setAccountId(t).execute(e);return!(o.key instanceof KeyList)&&o.key.verify(n,r)}static async verifyTransaction(e,t,n){const r=await(new AccountInfoQuery).setAccountId(t).execute(e);return!(r.key instanceof KeyList)&&r.key.verifyTransaction(n)}static async verifySignatureWithSigner(e,t,n,r){const o=await(new AccountInfoQuery).setAccountId(t).executeWithSigner(e);return!(o.key instanceof KeyList)&&o.key.verify(n,r)}static async verifyTransactionWithSigner(e,t,n){const r=await(new AccountInfoQuery).setAccountId(t).executeWithSigner(e);return!(r.key instanceof KeyList)&&r.key.verifyTransaction(n)}}class AccountRecordsQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e){const t=e.cryptoGetAccountRecords;return new AccountRecordsQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getAccountRecords(t)}_mapResponseHeader(e){return e.cryptoGetAccountRecords.header}_mapResponse(e,t,n){const r=e.cryptoGetAccountRecords.records;return Promise.resolve(r.map(e=>TransactionRecord._fromProtobuf({transactionRecord:e})))}_onMakeRequest(e){return{cryptoGetAccountRecords:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountRecordsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetAccountRecords",AccountRecordsQuery._fromProtobuf);class AccountUpdateTransaction extends Transaction{constructor(e={}){super(),this._accountId=null,this._key=null,this._receiverSignatureRequired=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._expirationTime=null,this._accountMemo=null,this._maxAutomaticTokenAssociations=null,this._aliasKey=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,this._hooksToBeCreated=[],this._hooksToBeDeleted=[],null!=e.accountId&&this.setAccountId(e.accountId),null!=e.key&&this.setKey(e.key),null!=e.receiverSignatureRequired&&this.setReceiverSignatureRequired(e.receiverSignatureRequired),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.accountMemo&&this.setAccountMemo(e.accountMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.hooksToBeCreated&&this.setHooksToCreate(e.hooksToBeCreated),null!=e.hooksToBeDeleted&&this.setHooksToDelete(e.hooksToBeDeleted)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoUpdateAccount;return Transaction._fromProtobufTransactions(new AccountUpdateTransaction({accountId:null!=a.accountIDToUpdate?AccountId._fromProtobuf(a.accountIDToUpdate):void 0,key:null!=a.key?Key._fromProtobufKey(a.key):void 0,receiverSignatureRequired:null!=a.receiverSigRequiredWrapper&&Object.hasOwn(a.receiverSigRequiredWrapper,"value")?a.receiverSigRequiredWrapper.value:void 0,proxyAccountId:null!=a.proxyAccountID?AccountId._fromProtobuf(a.proxyAccountID):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0,accountMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0,maxAutomaticTokenAssociations:null!=a.maxAutomaticTokenAssociations&&null!=a.maxAutomaticTokenAssociations.value&&Object.hasOwn(a.maxAutomaticTokenAssociations,"value")?Long.fromNumber(a.maxAutomaticTokenAssociations.value):void 0,stakedAccountId:null!=a.stakedAccountId?AccountId._fromProtobuf(a.stakedAccountId):void 0,stakedNodeId:null!=a.stakedNodeId?a.stakedNodeId:void 0,declineStakingReward:null!=a.declineReward&&Object.hasOwn(a.declineReward,"value")?a.declineReward.value:void 0}),e,t,n,r,o)}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get key(){return this._key}setKey(e){return this._requireNotFrozen(),this._key=e,this}get receiverSignatureRequired(){return this._receiverSignatureRequired}setReceiverSignatureRequired(e){return this._requireNotFrozen(),this._receiverSignatureRequired=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?Timestamp.fromDate(e):e,this}get accountMemo(){return this._accountMemo}setAccountMemo(e){return this._requireNotFrozen(),this._accountMemo=e,this}clearAccountMemo(){return this._requireNotFrozen(),this._accountMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations="number"==typeof e?Long.fromNumber(e):e,this}get aliasKey(){return null}setAliasKey(e){return this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}clearStakedAccountId(){return this._requireNotFrozen(),this._stakedAccountId=new AccountId(0,0,0),this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}clearStakedNodeId(){return this._requireNotFrozen(),this._stakedNodeId=Long.fromNumber(-1),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}addHookToCreate(e){return this._hooksToBeCreated.push(e),this}setHooksToCreate(e){return this._hooksToBeCreated=e,this}get hooksToCreate(){return this._hooksToBeCreated}addHookToDelete(e){return this._hooksToBeDeleted.push(e),this}setHooksToDelete(e){return this._hooksToBeDeleted=e,this}get hooksToDelete(){return this._hooksToBeDeleted}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}_execute(e,t){return e.crypto.updateAccount(t)}_getTransactionDataCase(){return"cryptoUpdateAccount"}_makeTransactionData(){return{accountIDToUpdate:null!=this._accountId?this._accountId._toProtobuf():null,key:null!=this._key?this._key._toProtobufKey():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,receiverSigRequiredWrapper:null==this._receiverSignatureRequired?null:{value:this._receiverSignatureRequired},memo:null!=this._accountMemo?{value:this._accountMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations.toInt()}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null,hookIdsToDelete:this._hooksToBeDeleted,hookCreationDetails:this._hooksToBeCreated.map(e=>e._toProtobuf())}}_getLogId(){return`AccountUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoUpdateAccount",AccountUpdateTransaction._fromProtobuf);class FreezeType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case FreezeType.UnknownFreezeType:return"UNKNOWN_FREEZE_TYPE";case FreezeType.FreezeOnly:return"FREEZE_ONLY";case FreezeType.PrepareUpgrade:return"PREPARE_UPGRADE";case FreezeType.FreezeUpgrade:return"FREEZE_UPGRADE";case FreezeType.FreezeAbort:return"FREEZE_ABORT";case FreezeType.TelemetryUpgrade:return"TELEMETRY_UPGRADE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return FreezeType.UnknownFreezeType;case 1:return FreezeType.FreezeOnly;case 2:return FreezeType.PrepareUpgrade;case 3:return FreezeType.FreezeUpgrade;case 4:return FreezeType.FreezeAbort;case 5:return FreezeType.TelemetryUpgrade;default:throw new Error(`(BUG) Status.fromCode() does not handle code: ${e}`)}}valueOf(){return this._code}}FreezeType.UnknownFreezeType=new FreezeType(0),FreezeType.FreezeOnly=new FreezeType(1),FreezeType.PrepareUpgrade=new FreezeType(2),FreezeType.FreezeUpgrade=new FreezeType(3),FreezeType.FreezeAbort=new FreezeType(4),FreezeType.TelemetryUpgrade=new FreezeType(5);class FreezeTransaction extends Transaction{constructor(e={}){super(),this._startTime=null,this._startTimestamp=null,this._endTime=null,this._fileId=null,this._fileHash=null,this._freezeType=null,null!=e.startTime&&this.setStartTime(e.startTime.hour,e.startTime.minute),null!=e.endTime&&this.setEndTime(e.endTime.hour,e.endTime.minute),null!=e.startTimestamp&&this.setStartTimestamp(e.startTimestamp),null!=e.updateFileId&&this.setUpdateFileId(e.updateFileId),null!=e.fileId&&this.setFileId(e.fileId),null!=e.fileHash&&this.setFileHash(e.fileHash),null!=e.freezeType&&this.setFreezeType(e.freezeType)}static _fromProtobuf(e,t,n,r,o){const a=o[0].freeze;return Transaction._fromProtobufTransactions(new FreezeTransaction({startTime:null!=a.startHour&&null!=a.startMin?{hour:a.startHour,minute:a.startMin}:void 0,endTime:null!=a.endHour&&null!=a.endMin?{hour:a.endHour,minute:a.endMin}:void 0,startTimestamp:null!=a.startTime?Timestamp._fromProtobuf(a.startTime):void 0,updateFileId:null!=a.updateFile?FileId._fromProtobuf(a.updateFile):void 0,fileHash:null!=a.fileHash?a.fileHash:void 0,freezeType:null!=a.freezeType?FreezeType._fromCode(a.freezeType):void 0}),e,t,n,r,o)}get startTime(){return null}setStartTime(e,t){if(this._requireNotFrozen(),"string"==typeof e){const t=e.split(":");this._startTime={hour:Number(t[0]),minute:Number(t[1])}}else this._startTime={hour:e,minute:t};return this}get startTimestamp(){return this._startTimestamp}setStartTimestamp(e){return this._requireNotFrozen(),this._startTimestamp=e,this}get endTime(){return console.warn("`FreezeTransaction.endTime` is deprecated"),this._endTime}setEndTime(e,t){if(console.warn("`FreezeTransaction.endTime` is deprecated"),this._requireNotFrozen(),"string"==typeof e){const t=e.split(":");this._endTime={hour:Number(t[0]),minute:Number(t[1])}}else this._endTime={hour:e,minute:t};return this}get updateFileId(){return this.fileId}setUpdateFileId(e){return this.setFileId(e)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e,this}get fileHash(){return this._fileHash}setFileHash(e){return this._requireNotFrozen(),this._fileHash="string"==typeof e?decode$7(e):e,this}get freezeType(){return this._freezeType}setFreezeType(e){return this._requireNotFrozen(),this._freezeType=e,this}_getTransactionDataCase(){return"freeze"}_makeTransactionData(){return{startTime:null!=this._startTimestamp?this._startTimestamp._toProtobuf():null,updateFile:null!=this._fileId?this._fileId._toProtobuf():null,fileHash:this._fileHash,freezeType:null!=this._freezeType?this._freezeType.valueOf():null}}_getLogId(){return`FreezeTransaction:${this._transactionIds.current.validStart.toString()}`}_execute(e,t){return e.freeze.freeze(t)}}TRANSACTION_REGISTRY.set("freeze",FreezeTransaction._fromProtobuf);class BatchTransaction extends Transaction{constructor(e){super(),this._batchTransactions=e?.transactions||[]}setInnerTransactions(e){return e.forEach(e=>this._validateTransaction(e)),this._batchTransactions=e,this}addInnerTransaction(e){return this._validateTransaction(e),this._requireNotFrozen(),this._batchTransactions.push(e),this}get innerTransactions(){return this._batchTransactions}get innerTransactionIds(){return Array.isArray(this._batchTransactions)?this._batchTransactions.map(e=>e.transactionId):[]}_makeTransactionData(){if(!Array.isArray(this._batchTransactions))return{transactions:[]};return{transactions:this._batchTransactions.map(e=>libExports.proto.SignedTransaction.encode(e._signedTransactions.get(0)).finish())}}static _fromProtobuf(e,t,n,r,o){const a=o[0],i=a.atomicBatch?.transactions,s=i?.map(e=>libExports.proto.SignedTransaction.decode(e)),c=s?.map(e=>{const t=libExports.proto.TransactionBody.decode(e.bodyBytes),n=t.data;if(!n)throw new Error("Transaction type not found");const r=TRANSACTION_REGISTRY.get(n);if(!r)throw new Error("fromProtobuf not found");return r([],[e],[],[],[t])});return Transaction._fromProtobufTransactions(new BatchTransaction({transactions:c}),e,t,n,r,o)}_getTransactionDataCase(){return"atomicBatch"}_getLogId(){return`AtomicBatch:${this._transactionIds.current.validStart.toString()}`}_execute(e,t){return e.util.atomicBatch(t)}_validateTransaction(e){if(e instanceof BatchTransaction||e instanceof FreezeTransaction)throw new Error("Transaction is not allowed to be added to a batch");if(!e.isFrozen())throw new Error("Transaction must be frozen before being added to a batch");if(!e.batchKey)throw new Error("Transaction must have a batch key")}}TRANSACTION_REGISTRY.set("atomicBatch",BatchTransaction._fromProtobuf);class ContractByteCodeQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.contractGetBytecode;return new ContractByteCodeQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.contractGetBytecode(t)}_mapResponseHeader(e){return e.contractGetBytecodeResponse.header}_mapResponse(e){const t=e.contractGetBytecodeResponse;return Promise.resolve(null!=t.bytecode?t.bytecode:new Uint8Array)}_onMakeRequest(e){return{contractGetBytecode:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`ContractByteCodeQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractGetBytecode",ContractByteCodeQuery._fromProtobuf);const HEX_CHARS="0123456789abcdef".split(""),KECCAK_PADDING=[1,256,65536,16777216],SHIFT=[0,8,16,24],RC=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],Keccak=e=>{return{blocks:[],reset:!0,block:0,start:0,blockCount:1600-(e<<1)>>5,outputBlocks:e>>5,s:(t=[0,0,0,0,0,0,0,0,0,0],[].concat(t,t,t,t,t))};var t},update=(e,t)=>{for(var n,r,o=t.length,a=e.blocks,i=e.blockCount<<2,s=e.blockCount,c=e.outputBlocks,u=e.s,l=0;l<o;){if(e.reset)for(e.reset=!1,a[0]=e.block,n=1;n<s+1;++n)a[n]=0;if("string"!=typeof t)for(n=e.start;l<o&&n<i;++l)a[n>>2]|=t[l]<<SHIFT[3&n++];else for(n=e.start;l<o&&n<i;++l)(r=t.charCodeAt(l))<128?a[n>>2]|=r<<SHIFT[3&n++]:r<2048?(a[n>>2]|=(192|r>>6)<<SHIFT[3&n++],a[n>>2]|=(128|63&r)<<SHIFT[3&n++]):r<55296||r>=57344?(a[n>>2]|=(224|r>>12)<<SHIFT[3&n++],a[n>>2]|=(128|r>>6&63)<<SHIFT[3&n++],a[n>>2]|=(128|63&r)<<SHIFT[3&n++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++l)),a[n>>2]|=(240|r>>18)<<SHIFT[3&n++],a[n>>2]|=(128|r>>12&63)<<SHIFT[3&n++],a[n>>2]|=(128|r>>6&63)<<SHIFT[3&n++],a[n>>2]|=(128|63&r)<<SHIFT[3&n++]);if(e.lastByteIndex=n,n>=i){for(e.start=n-i,e.block=a[s],n=0;n<s;++n)u[n]^=a[n];f(u),e.reset=!0}else e.start=n}if(a[(n=e.lastByteIndex)>>2]|=KECCAK_PADDING[3&n],e.lastByteIndex===i)for(a[0]=a[s],n=1;n<s+1;++n)a[n]=0;for(a[s-1]|=2147483648,n=0;n<s;++n)u[n]^=a[n];f(u);var d,p="",h=0;for(n=0;h<c;){for(n=0;n<s&&h<c;++n,++h)d=u[n],p+=HEX_CHARS[d>>4&15]+HEX_CHARS[15&d]+HEX_CHARS[d>>12&15]+HEX_CHARS[d>>8&15]+HEX_CHARS[d>>20&15]+HEX_CHARS[d>>16&15]+HEX_CHARS[d>>28&15]+HEX_CHARS[d>>24&15];h%s===0&&(f(u),n=0)}return"0x"+p},f=e=>{var t,n,r,o,a,i,s,c,u,l,d,p,h,f,y,m,g,_,b,I,k,T,S,w,A,v,E,O,N,P,R,C,D,B,L,x,F,U,H,K,j,M,G,q,V,$,z,W,Y,Q,X,Z,J,ee,te,ne,re,oe,ae,ie,se,ce,ue;for(r=0;r<48;r+=2)o=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(i<<1|s>>>31),n=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|i>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=o^(c<<1|u>>>31),n=a^(u<<1|c>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=i^(l<<1|d>>>31),n=s^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=c^(p<<1|h>>>31),n=u^(h<<1|p>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(o<<1|a>>>31),n=d^(a<<1|o>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,f=e[0],y=e[1],$=e[11]<<4|e[10]>>>28,z=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ie=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,M=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,B=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,W=e[22]<<10|e[23]>>>22,Y=e[23]<<10|e[22]>>>22,P=e[33]<<13|e[32]>>>19,R=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,ue=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,x=e[14]<<6|e[15]>>>26,F=e[15]<<6|e[14]>>>26,_=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,Q=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,D=e[44]<<29|e[45]>>>3,w=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,re=e[16]<<23|e[17]>>>9,U=e[26]<<25|e[27]>>>7,H=e[27]<<25|e[26]>>>7,I=e[36]<<21|e[37]>>>11,k=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,J=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,v=e[18]<<20|e[19]>>>12,E=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,K=e[38]<<8|e[39]>>>24,j=e[39]<<8|e[38]>>>24,T=e[48]<<14|e[49]>>>18,S=e[49]<<14|e[48]>>>18,e[0]=f^~m&_,e[1]=y^~g&b,e[10]=w^~v&O,e[11]=A^~E&N,e[20]=B^~x&U,e[21]=L^~F&H,e[30]=q^~$&W,e[31]=V^~z&Y,e[40]=ee^~ne&oe,e[41]=te^~re&ae,e[2]=m^~_&I,e[3]=g^~b&k,e[12]=v^~O&P,e[13]=E^~N&R,e[22]=x^~U&K,e[23]=F^~H&j,e[32]=$^~W&Q,e[33]=z^~Y&X,e[42]=ne^~oe&ie,e[43]=re^~ae&se,e[4]=_^~I&T,e[5]=b^~k&S,e[14]=O^~P&C,e[15]=N^~R&D,e[24]=U^~K&M,e[25]=H^~j&G,e[34]=W^~Q&Z,e[35]=Y^~X&J,e[44]=oe^~ie&ce,e[45]=ae^~se&ue,e[6]=I^~T&f,e[7]=k^~S&y,e[16]=P^~C&w,e[17]=R^~D&A,e[26]=K^~M&B,e[27]=j^~G&L,e[36]=Q^~Z&q,e[37]=X^~J&V,e[46]=ie^~ce&ee,e[47]=se^~ue&te,e[8]=T^~f&m,e[9]=S^~y&g,e[18]=C^~w&v,e[19]=D^~A&E,e[28]=M^~B&x,e[29]=G^~L&F,e[38]=Z^~q&$,e[39]=J^~V&z,e[48]=ce^~ee&ne,e[49]=ue^~te&re,e[0]^=RC[r],e[1]^=RC[r+1]},keccak=e=>t=>{var n;if("0x"===t.slice(0,2)){n=[];for(var r=2,o=t.length;r<o;r+=2)n.push(parseInt(t.slice(r,r+2),16))}else n=t;return update(Keccak(e),n)},keccak256=keccak(256),ArgumentType={uint8:0,int8:1,uint16:2,int16:3,uint24:4,int24:5,uint32:6,int32:7,uint40:8,int40:9,uint48:10,int48:11,uint56:12,int56:13,uint64:14,int64:15,uint72:16,int72:17,uint80:18,int80:19,uint88:20,int88:21,uint96:22,int96:23,uint104:24,int104:25,uint112:26,int112:27,uint120:28,int120:29,uint128:30,int128:31,uint136:32,int136:33,uint144:34,int144:35,uint152:36,int152:37,uint160:38,int160:39,uint168:40,int168:41,uint176:42,int176:43,uint184:44,int184:45,uint192:46,int192:47,uint200:48,int200:49,uint208:50,int208:51,uint216:52,int216:53,uint224:54,int224:55,uint232:56,int232:57,uint240:58,int240:59,uint248:60,int248:61,uint256:62,int256:63,string:64,bool:65,bytes:66,bytes32:67,address:68,func:69};class ContractFunctionSelector{constructor(e){this.name=null,this._params="",this._paramTypes=[],null!=e&&(this._name=e)}addString(){return this._addParam({ty:ArgumentType.string,array:!1})}addStringArray(){return this._addParam({ty:ArgumentType.string,array:!0})}addBytes(){return this._addParam({ty:ArgumentType.bytes,array:!1})}addBytes32(){return this._addParam({ty:ArgumentType.bytes32,array:!1})}addBytesArray(){return this._addParam({ty:ArgumentType.bytes,array:!0})}addBytes32Array(){return this._addParam({ty:ArgumentType.bytes32,array:!0})}addInt8(){return this._addParam({ty:ArgumentType.int8,array:!1})}addUint8(){return this._addParam({ty:ArgumentType.uint8,array:!1})}addInt16(){return this._addParam({ty:ArgumentType.int16,array:!1})}addUint16(){return this._addParam({ty:ArgumentType.uint16,array:!1})}addInt24(){return this._addParam({ty:ArgumentType.int24,array:!1})}addUint24(){return this._addParam({ty:ArgumentType.uint24,array:!1})}addInt32(){return this._addParam({ty:ArgumentType.int32,array:!1})}addUint32(){return this._addParam({ty:ArgumentType.uint32,array:!1})}addInt40(){return this._addParam({ty:ArgumentType.int40,array:!1})}addUint40(){return this._addParam({ty:ArgumentType.uint40,array:!1})}addInt48(){return this._addParam({ty:ArgumentType.int48,array:!1})}addUint48(){return this._addParam({ty:ArgumentType.uint48,array:!1})}addInt56(){return this._addParam({ty:ArgumentType.int56,array:!1})}addUint56(){return this._addParam({ty:ArgumentType.uint56,array:!1})}addInt64(){return this._addParam({ty:ArgumentType.int64,array:!1})}addUint64(){return this._addParam({ty:ArgumentType.uint64,array:!1})}addInt72(){return this._addParam({ty:ArgumentType.int72,array:!1})}addUint72(){return this._addParam({ty:ArgumentType.uint72,array:!1})}addInt80(){return this._addParam({ty:ArgumentType.int80,array:!1})}addUint80(){return this._addParam({ty:ArgumentType.uint80,array:!1})}addInt88(){return this._addParam({ty:ArgumentType.int88,array:!1})}addUint88(){return this._addParam({ty:ArgumentType.uint88,array:!1})}addInt96(){return this._addParam({ty:ArgumentType.int96,array:!1})}addUint96(){return this._addParam({ty:ArgumentType.uint96,array:!1})}addInt104(){return this._addParam({ty:ArgumentType.int104,array:!1})}addUint104(){return this._addParam({ty:ArgumentType.uint104,array:!1})}addInt112(){return this._addParam({ty:ArgumentType.int112,array:!1})}addUint112(){return this._addParam({ty:ArgumentType.uint112,array:!1})}addInt120(){return this._addParam({ty:ArgumentType.int120,array:!1})}addUint120(){return this._addParam({ty:ArgumentType.uint120,array:!1})}addInt128(){return this._addParam({ty:ArgumentType.int128,array:!1})}addUint128(){return this._addParam({ty:ArgumentType.uint128,array:!1})}addInt136(){return this._addParam({ty:ArgumentType.int136,array:!1})}addUint136(){return this._addParam({ty:ArgumentType.uint136,array:!1})}addInt144(){return this._addParam({ty:ArgumentType.int144,array:!1})}addUint144(){return this._addParam({ty:ArgumentType.uint144,array:!1})}addInt152(){return this._addParam({ty:ArgumentType.int152,array:!1})}addUint152(){return this._addParam({ty:ArgumentType.uint152,array:!1})}addInt160(){return this._addParam({ty:ArgumentType.int160,array:!1})}addUint160(){return this._addParam({ty:ArgumentType.uint160,array:!1})}addInt168(){return this._addParam({ty:ArgumentType.int168,array:!1})}addUint168(){return this._addParam({ty:ArgumentType.uint168,array:!1})}addInt176(){return this._addParam({ty:ArgumentType.int176,array:!1})}addUint176(){return this._addParam({ty:ArgumentType.uint176,array:!1})}addInt184(){return this._addParam({ty:ArgumentType.int184,array:!1})}addUint184(){return this._addParam({ty:ArgumentType.uint184,array:!1})}addInt192(){return this._addParam({ty:ArgumentType.int192,array:!1})}addUint192(){return this._addParam({ty:ArgumentType.uint192,array:!1})}addInt200(){return this._addParam({ty:ArgumentType.int200,array:!1})}addUint200(){return this._addParam({ty:ArgumentType.uint200,array:!1})}addInt208(){return this._addParam({ty:ArgumentType.int208,array:!1})}addUint208(){return this._addParam({ty:ArgumentType.uint208,array:!1})}addInt216(){return this._addParam({ty:ArgumentType.int216,array:!1})}addUint216(){return this._addParam({ty:ArgumentType.uint216,array:!1})}addInt224(){return this._addParam({ty:ArgumentType.int224,array:!1})}addUint224(){return this._addParam({ty:ArgumentType.uint224,array:!1})}addInt232(){return this._addParam({ty:ArgumentType.int232,array:!1})}addUint232(){return this._addParam({ty:ArgumentType.uint232,array:!1})}addInt240(){return this._addParam({ty:ArgumentType.int240,array:!1})}addUint240(){return this._addParam({ty:ArgumentType.uint240,array:!1})}addInt248(){return this._addParam({ty:ArgumentType.int248,array:!1})}addUint248(){return this._addParam({ty:ArgumentType.uint248,array:!1})}addInt256(){return this._addParam({ty:ArgumentType.int256,array:!1})}addUint256(){return this._addParam({ty:ArgumentType.uint256,array:!1})}addInt8Array(){return this._addParam({ty:ArgumentType.int8,array:!0})}addUint8Array(){return this._addParam({ty:ArgumentType.uint8,array:!0})}addInt16Array(){return this._addParam({ty:ArgumentType.int16,array:!0})}addUint16Array(){return this._addParam({ty:ArgumentType.uint16,array:!0})}addInt24Array(){return this._addParam({ty:ArgumentType.int24,array:!0})}addUint24Array(){return this._addParam({ty:ArgumentType.uint24,array:!0})}addInt32Array(){return this._addParam({ty:ArgumentType.int32,array:!0})}addUint32Array(){return this._addParam({ty:ArgumentType.uint32,array:!0})}addInt40Array(){return this._addParam({ty:ArgumentType.int40,array:!0})}addUint40Array(){return this._addParam({ty:ArgumentType.uint40,array:!0})}addInt48Array(){return this._addParam({ty:ArgumentType.int48,array:!0})}addUint48Array(){return this._addParam({ty:ArgumentType.uint48,array:!0})}addInt56Array(){return this._addParam({ty:ArgumentType.int56,array:!0})}addUint56Array(){return this._addParam({ty:ArgumentType.uint56,array:!0})}addInt64Array(){return this._addParam({ty:ArgumentType.int64,array:!0})}addUint64Array(){return this._addParam({ty:ArgumentType.uint64,array:!0})}addInt72Array(){return this._addParam({ty:ArgumentType.int72,array:!0})}addUint72Array(){return this._addParam({ty:ArgumentType.uint72,array:!0})}addInt80Array(){return this._addParam({ty:ArgumentType.int80,array:!0})}addUint80Array(){return this._addParam({ty:ArgumentType.uint80,array:!0})}addInt88Array(){return this._addParam({ty:ArgumentType.int88,array:!0})}addUint88Array(){return this._addParam({ty:ArgumentType.uint88,array:!0})}addInt96Array(){return this._addParam({ty:ArgumentType.int96,array:!0})}addUint96Array(){return this._addParam({ty:ArgumentType.uint96,array:!0})}addInt104Array(){return this._addParam({ty:ArgumentType.int104,array:!0})}addUint104Array(){return this._addParam({ty:ArgumentType.uint104,array:!0})}addInt112Array(){return this._addParam({ty:ArgumentType.int112,array:!0})}addUint112Array(){return this._addParam({ty:ArgumentType.uint112,array:!0})}addInt120Array(){return this._addParam({ty:ArgumentType.int120,array:!0})}addUint120Array(){return this._addParam({ty:ArgumentType.uint120,array:!0})}addInt128Array(){return this._addParam({ty:ArgumentType.int128,array:!0})}addUint128Array(){return this._addParam({ty:ArgumentType.uint128,array:!0})}addInt136Array(){return this._addParam({ty:ArgumentType.int136,array:!0})}addUint136Array(){return this._addParam({ty:ArgumentType.uint136,array:!0})}addInt144Array(){return this._addParam({ty:ArgumentType.int144,array:!0})}addUint144Array(){return this._addParam({ty:ArgumentType.uint144,array:!0})}addInt152Array(){return this._addParam({ty:ArgumentType.int152,array:!0})}addUint152Array(){return this._addParam({ty:ArgumentType.uint152,array:!0})}addInt160Array(){return this._addParam({ty:ArgumentType.int160,array:!0})}addUint160Array(){return this._addParam({ty:ArgumentType.uint160,array:!0})}addInt168Array(){return this._addParam({ty:ArgumentType.int168,array:!0})}addUint168Array(){return this._addParam({ty:ArgumentType.uint168,array:!0})}addInt176Array(){return this._addParam({ty:ArgumentType.int176,array:!0})}addUint176Array(){return this._addParam({ty:ArgumentType.uint176,array:!0})}addInt184Array(){return this._addParam({ty:ArgumentType.int184,array:!0})}addUint184Array(){return this._addParam({ty:ArgumentType.uint184,array:!0})}addInt192Array(){return this._addParam({ty:ArgumentType.int192,array:!0})}addUint192Array(){return this._addParam({ty:ArgumentType.uint192,array:!0})}addInt200Array(){return this._addParam({ty:ArgumentType.int200,array:!0})}addUint200Array(){return this._addParam({ty:ArgumentType.uint200,array:!0})}addInt208Array(){return this._addParam({ty:ArgumentType.int208,array:!0})}addUint208Array(){return this._addParam({ty:ArgumentType.uint208,array:!0})}addInt216Array(){return this._addParam({ty:ArgumentType.int216,array:!0})}addUint216Array(){return this._addParam({ty:ArgumentType.uint216,array:!0})}addInt224Array(){return this._addParam({ty:ArgumentType.int224,array:!0})}addUint224Array(){return this._addParam({ty:ArgumentType.uint224,array:!0})}addInt232Array(){return this._addParam({ty:ArgumentType.int232,array:!0})}addUint232Array(){return this._addParam({ty:ArgumentType.uint232,array:!0})}addInt240Array(){return this._addParam({ty:ArgumentType.int240,array:!0})}addUint240Array(){return this._addParam({ty:ArgumentType.uint240,array:!0})}addInt248Array(){return this._addParam({ty:ArgumentType.int248,array:!0})}addUint248Array(){return this._addParam({ty:ArgumentType.uint248,array:!0})}addInt256Array(){return this._addParam({ty:ArgumentType.int256,array:!0})}addUint256Array(){return this._addParam({ty:ArgumentType.uint256,array:!0})}addBool(){return this._addParam({ty:ArgumentType.bool,array:!1})}addAddress(){return this._addParam({ty:ArgumentType.address,array:!1})}addAddressArray(){return this._addParam({ty:ArgumentType.address,array:!0})}addFunction(){return this._addParam({ty:ArgumentType.func,array:!1})}_addParam(e){return this._paramTypes.length>0&&(this._params+=","),this._params+=solidityTypeToString(e),this._paramTypes.push(e),this}_build(e){if(null!=e)this._name=e;else if(null==this._name)throw new Error("`name` required for ContractFunctionSelector");const t=encode$4(encode(this.toString()));return decode$7(keccak256(`0x${t}`)).slice(0,4)}toString(){return`${null!=this._name?this._name.toString():""}(${this._params})`}}function solidityTypeToString(e){let t="";switch(e.ty){case ArgumentType.uint8:t="uint8";break;case ArgumentType.int8:t="int8";break;case ArgumentType.uint16:t="uint16";break;case ArgumentType.int16:t="int16";break;case ArgumentType.uint24:t="uint24";break;case ArgumentType.int24:t="int24";break;case ArgumentType.uint32:t="uint32";break;case ArgumentType.int32:t="int32";break;case ArgumentType.uint40:t="uint40";break;case ArgumentType.int40:t="int40";break;case ArgumentType.uint48:t="uint48";break;case ArgumentType.int48:t="int48";break;case ArgumentType.uint56:t="uint56";break;case ArgumentType.int56:t="int56";break;case ArgumentType.uint64:t="uint64";break;case ArgumentType.int64:t="int64";break;case ArgumentType.uint72:t="uint72";break;case ArgumentType.int72:t="int72";break;case ArgumentType.uint80:t="uint80";break;case ArgumentType.int80:t="int80";break;case ArgumentType.uint88:t="uint88";break;case ArgumentType.int88:t="int88";break;case ArgumentType.uint96:t="uint96";break;case ArgumentType.int96:t="int96";break;case ArgumentType.uint104:t="uint104";break;case ArgumentType.int104:t="int104";break;case ArgumentType.uint112:t="uint112";break;case ArgumentType.int112:t="int112";break;case ArgumentType.uint120:t="uint120";break;case ArgumentType.int120:t="int120";break;case ArgumentType.uint128:t="uint128";break;case ArgumentType.int128:t="int128";break;case ArgumentType.uint136:t="uint136";break;case ArgumentType.int136:t="int136";break;case ArgumentType.uint144:t="uint144";break;case ArgumentType.int144:t="int144";break;case ArgumentType.uint152:t="uint152";break;case ArgumentType.int152:t="int152";break;case ArgumentType.uint160:t="uint160";break;case ArgumentType.int160:t="int160";break;case ArgumentType.uint168:t="uint168";break;case ArgumentType.int168:t="int168";break;case ArgumentType.uint176:t="uint176";break;case ArgumentType.int176:t="int176";break;case ArgumentType.uint184:t="uint184";break;case ArgumentType.int184:t="int184";break;case ArgumentType.uint192:t="uint192";break;case ArgumentType.int192:t="int192";break;case ArgumentType.uint200:t="uint200";break;case ArgumentType.int200:t="int200";break;case ArgumentType.uint208:t="uint208";break;case ArgumentType.int208:t="int208";break;case ArgumentType.uint216:t="uint216";break;case ArgumentType.int216:t="int216";break;case ArgumentType.uint224:t="uint224";break;case ArgumentType.int224:t="int224";break;case ArgumentType.uint232:t="uint232";break;case ArgumentType.int232:t="int232";break;case ArgumentType.uint240:t="uint240";break;case ArgumentType.int240:t="int240";break;case ArgumentType.uint248:t="uint248";break;case ArgumentType.int248:t="int248";break;case ArgumentType.uint256:t="uint256";break;case ArgumentType.int256:t="int256";break;case ArgumentType.string:t="string";break;case ArgumentType.bool:t="bool";break;case ArgumentType.bytes:t="bytes";break;case ArgumentType.bytes32:t="bytes32";break;case ArgumentType.address:t="address";break;case ArgumentType.func:t="function";break;default:t=""}return e.array&&(t+="[]"),t}const defaultAbiCoder=AbiCoder.defaultAbiCoder();class ContractFunctionParameters{constructor(){this._selector=new ContractFunctionSelector,this._arguments=[]}addString(e){return this._selector.addString(),this._addParam(e,!0)}addStringArray(e){return this._selector.addStringArray(),this._addParam(e,!0)}addBytes(e){return this._selector.addBytes(),this._addParam(e,!0)}addBytes32(e){if(32!==e.length)throw new Error(`addBytes32 expected array to be of length 32, but received ${e.length}`);return this._selector.addBytes32(),this._addParam(e,!1)}addBytesArray(e){return this._selector.addBytesArray(),this._addParam(e,!0)}addBytes32Array(e){for(const[t,n]of e.entries())if(32!==n.length)throw new Error(`addBytes32 expected array to be of length 32, but received ${n.length}`);return this._selector.addBytes32Array(),this._addParam(e,!0)}addBool(e){return this._selector.addBool(),this._addParam(e,!1)}addInt8(e){return this._selector.addInt8(),this._addParam(convertToBigNumber(e),!1)}addUint8(e){return this._selector.addUint8(),this._addParam(convertToBigNumber(e),!1)}addInt16(e){return this._selector.addInt16(),this._addParam(convertToBigNumber(e),!1)}addUint16(e){return this._selector.addUint16(),this._addParam(convertToBigNumber(e),!1)}addInt24(e){return this._selector.addInt24(),this._addParam(convertToBigNumber(e),!1)}addUint24(e){return this._selector.addUint24(),this._addParam(convertToBigNumber(e),!1)}addInt32(e){return this._selector.addInt32(),this._addParam(convertToBigNumber(e),!1)}addUint32(e){return this._selector.addUint32(),this._addParam(convertToBigNumber(e),!1)}addInt40(e){return this._selector.addInt40(),this._addParam(convertToBigNumber(e),!1)}addUint40(e){return this._selector.addUint40(),this._addParam(convertToBigNumber(e),!1)}addInt48(e){return this._selector.addInt48(),this._addParam(convertToBigNumber(e),!1)}addUint48(e){return this._selector.addUint48(),this._addParam(convertToBigNumber(e),!1)}addInt56(e){return this._selector.addInt56(),this._addParam(convertToBigNumber(e),!1)}addUint56(e){return this._selector.addUint56(),this._addParam(convertToBigNumber(e),!1)}addInt64(e){return this._selector.addInt64(),this._addParam(convertToBigNumber(e),!1)}addUint64(e){return this._selector.addUint64(),this._addParam(convertToBigNumber(e),!1)}addInt72(e){return this._selector.addInt72(),this._addParam(convertToBigNumber(e),!1)}addUint72(e){return this._selector.addUint72(),this._addParam(convertToBigNumber(e),!1)}addInt80(e){return this._selector.addInt80(),this._addParam(convertToBigNumber(e),!1)}addUint80(e){return this._selector.addUint80(),this._addParam(convertToBigNumber(e),!1)}addInt88(e){return this._selector.addInt88(),this._addParam(convertToBigNumber(e),!1)}addUint88(e){return this._selector.addUint88(),this._addParam(convertToBigNumber(e),!1)}addInt96(e){return this._selector.addInt96(),this._addParam(convertToBigNumber(e),!1)}addUint96(e){return this._selector.addUint96(),this._addParam(convertToBigNumber(e),!1)}addInt104(e){return this._selector.addInt104(),this._addParam(convertToBigNumber(e),!1)}addUint104(e){return this._selector.addUint104(),this._addParam(convertToBigNumber(e),!1)}addInt112(e){return this._selector.addInt112(),this._addParam(convertToBigNumber(e),!1)}addUint112(e){return this._selector.addUint112(),this._addParam(convertToBigNumber(e),!1)}addInt120(e){return this._selector.addInt120(),this._addParam(convertToBigNumber(e),!1)}addUint120(e){return this._selector.addUint120(),this._addParam(convertToBigNumber(e),!1)}addInt128(e){return this._selector.addInt128(),this._addParam(convertToBigNumber(e),!1)}addUint128(e){return this._selector.addUint128(),this._addParam(convertToBigNumber(e),!1)}addInt136(e){return this._selector.addInt136(),this._addParam(convertToBigNumber(e),!1)}addUint136(e){return this._selector.addUint136(),this._addParam(convertToBigNumber(e),!1)}addInt144(e){return this._selector.addInt144(),this._addParam(convertToBigNumber(e),!1)}addUint144(e){return this._selector.addUint144(),this._addParam(convertToBigNumber(e),!1)}addInt152(e){return this._selector.addInt152(),this._addParam(convertToBigNumber(e),!1)}addUint152(e){return this._selector.addUint152(),this._addParam(convertToBigNumber(e),!1)}addInt160(e){return this._selector.addInt160(),this._addParam(convertToBigNumber(e),!1)}addUint160(e){return this._selector.addUint160(),this._addParam(convertToBigNumber(e),!1)}addInt168(e){return this._selector.addInt168(),this._addParam(convertToBigNumber(e),!1)}addUint168(e){return this._selector.addUint168(),this._addParam(convertToBigNumber(e),!1)}addInt176(e){return this._selector.addInt176(),this._addParam(convertToBigNumber(e),!1)}addUint176(e){return this._selector.addUint176(),this._addParam(convertToBigNumber(e),!1)}addInt184(e){return this._selector.addInt184(),this._addParam(convertToBigNumber(e),!1)}addUint184(e){return this._selector.addUint184(),this._addParam(convertToBigNumber(e),!1)}addInt192(e){return this._selector.addInt192(),this._addParam(convertToBigNumber(e),!1)}addUint192(e){return this._selector.addUint192(),this._addParam(convertToBigNumber(e),!1)}addInt200(e){return this._selector.addInt200(),this._addParam(convertToBigNumber(e),!1)}addUint200(e){return this._selector.addUint200(),this._addParam(convertToBigNumber(e),!1)}addInt208(e){return this._selector.addInt208(),this._addParam(convertToBigNumber(e),!1)}addUint208(e){return this._selector.addUint208(),this._addParam(convertToBigNumber(e),!1)}addInt216(e){return this._selector.addInt216(),this._addParam(convertToBigNumber(e),!1)}addUint216(e){return this._selector.addUint216(),this._addParam(convertToBigNumber(e),!1)}addInt224(e){return this._selector.addInt224(),this._addParam(convertToBigNumber(e),!1)}addUint224(e){return this._selector.addUint224(),this._addParam(convertToBigNumber(e),!1)}addInt232(e){return this._selector.addInt232(),this._addParam(convertToBigNumber(e),!1)}addUint232(e){return this._selector.addUint232(),this._addParam(convertToBigNumber(e),!1)}addInt240(e){return this._selector.addInt240(),this._addParam(convertToBigNumber(e),!1)}addUint240(e){return this._selector.addUint240(),this._addParam(convertToBigNumber(e),!1)}addInt248(e){return this._selector.addInt248(),this._addParam(convertToBigNumber(e),!1)}addUint248(e){return this._selector.addUint248(),this._addParam(convertToBigNumber(e),!1)}addInt256(e){return this._selector.addInt256(),this._addParam(convertToBigNumber(e),!1)}addUint256(e){return this._selector.addUint256(),this._addParam(convertToBigNumber(e),!1)}addInt8Array(e){return this._selector.addInt8Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint8Array(e){return this._selector.addUint8Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt16Array(e){return this._selector.addInt16Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint16Array(e){return this._selector.addUint16Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt24Array(e){return this._selector.addInt24Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint24Array(e){return this._selector.addUint24Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt32Array(e){return this._selector.addInt32Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint32Array(e){return this._selector.addUint32Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt40Array(e){return this._selector.addInt40Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint40Array(e){return this._selector.addUint40Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt48Array(e){return this._selector.addInt48Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint48Array(e){return this._selector.addUint48Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt56Array(e){return this._selector.addInt56Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint56Array(e){return this._selector.addUint56Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt64Array(e){return this._selector.addInt64Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint64Array(e){return this._selector.addUint64Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt72Array(e){return this._selector.addInt72Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint72Array(e){return this._selector.addUint72Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt80Array(e){return this._selector.addInt80Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint80Array(e){return this._selector.addUint80Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt88Array(e){return this._selector.addInt88Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint88Array(e){return this._selector.addUint88Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt96Array(e){return this._selector.addInt96Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint96Array(e){return this._selector.addUint96Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt104Array(e){return this._selector.addInt104Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint104Array(e){return this._selector.addUint104Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt112Array(e){return this._selector.addInt112Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint112Array(e){return this._selector.addUint112Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt120Array(e){return this._selector.addInt120Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint120Array(e){return this._selector.addUint120Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt128Array(e){return this._selector.addInt128Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint128Array(e){return this._selector.addUint128Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt136Array(e){return this._selector.addInt136Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint136Array(e){return this._selector.addUint136Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt144Array(e){return this._selector.addInt144Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint144Array(e){return this._selector.addUint144Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt152Array(e){return this._selector.addInt152Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint152Array(e){return this._selector.addUint152Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt160Array(e){return this._selector.addInt160Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint160Array(e){return this._selector.addUint160Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt168Array(e){return this._selector.addInt168Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint168Array(e){return this._selector.addUint168Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt176Array(e){return this._selector.addInt176Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint176Array(e){return this._selector.addUint176Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt184Array(e){return this._selector.addInt184Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint184Array(e){return this._selector.addUint184Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt192Array(e){return this._selector.addInt192Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint192Array(e){return this._selector.addUint192Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt200Array(e){return this._selector.addInt200Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint200Array(e){return this._selector.addUint200Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt208Array(e){return this._selector.addInt208Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint208Array(e){return this._selector.addUint208Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt216Array(e){return this._selector.addInt216Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint216Array(e){return this._selector.addUint216Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt224Array(e){return this._selector.addInt224Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint224Array(e){return this._selector.addUint224Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt232Array(e){return this._selector.addInt232Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint232Array(e){return this._selector.addUint232Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt240Array(e){return this._selector.addInt240Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint240Array(e){return this._selector.addUint240Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt248Array(e){return this._selector.addInt248Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint248Array(e){return this._selector.addUint248Array(),this._addParam(convertToBigNumberArray(e),!0)}addInt256Array(e){return this._selector.addInt256Array(),this._addParam(convertToBigNumberArray(e),!0)}addUint256Array(e){return this._selector.addUint256Array(),this._addParam(convertToBigNumberArray(e),!0)}addAddress(e){let t;if("string"==typeof e){if(40!==e.length&&42!==e.length)throw new Error("`address` type requires parameter to be 40 or 42 characters");t=e}else t=e.toString();const n=40===t.length?decode$7(t):decode$7(t.substring(2));return this._selector.addAddress(),this._addParam(n,!1)}addAddressArray(e){const t=[];for(const[n,r]of e.entries()){let e;if("string"==typeof r){if(40!==r.length&&42!==r.length)throw new Error("`address` type requires parameter to be 40 or 42 characters");e=r}else e=r.toString();const n=40===e.length?decode$7(e):decode$7(e.substring(2));t.push(n)}return this._selector.addAddressArray(),this._addParam(t,!0)}addFunction(e,t){const n=decode$7(e),r=t._build();if(20!==n.length)throw new Error("`function` type requires parameter `address` to be exactly 20 bytes");this._selector.addFunction();const o=new Uint8Array(24);return o.set(n,0),o.set(r,20),this._addParam(o,!1)}_addParam(e,t){const n=this._selector._paramTypes.length-1,r=argumentToBytes(e,this._selector._paramTypes[n]);return this._arguments.push({dynamic:t,value:r}),this}_build(e){const t=null!=e,n=t?4:0,r=0===this._arguments.length?n:32*this._arguments.length+this._arguments.map(e=>e.dynamic?e.value.length:0).reduce((e,t)=>e+t)+n,o=new Uint8Array(r);t&&o.set(this._selector._build(e),0);let a=32*this._arguments.length;for(const[e,{dynamic:t,value:r}]of this._arguments.entries())if(t){const t=safeView(o,n+32*e+28);t.setUint32(0,a),o.set(r,t.getUint32(0)+n),a+=r.length}else o.set(r,n+32*e);return o}}function argumentToBytes(e,t){let n,r=new Uint8Array(32),o=safeView(r);if(t.array){if(!Array.isArray(e))throw new TypeError("SolidityType indicates type is array, but parameter is not an array");const n=[];for(const[r,o]of e.entries()){const e=argumentToBytes(o,{ty:t.ty,array:!1});n.push(e)}const a=n.map(e=>e.length).reduce((e,t)=>e+t,0);switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.uint256:case ArgumentType.int256:case ArgumentType.bool:case ArgumentType.bytes32:case ArgumentType.address:case ArgumentType.func:r=new Uint8Array(a+32);break;case ArgumentType.bytes:case ArgumentType.string:r=new Uint8Array(32*n.length+a+32);break;default:throw new TypeError(`Expected param type to be ArgumentType, but received ${t.ty}`)}o=safeView(r,28),o.setUint32(0,n.length);let i=32*n.length;for(const[e,o]of n.entries())switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.uint256:case ArgumentType.int256:case ArgumentType.bool:case ArgumentType.bytes32:case ArgumentType.address:case ArgumentType.func:r.set(o,32*e+32);break;case ArgumentType.bytes:case ArgumentType.string:const n=safeView(r,32*(e+1)+28);n.setUint32(0,i),r.set(o,n.getUint32(0)+32),i+=o.length;break;default:throw new TypeError(`Expected param type to be ArgumentType, but received ${t.ty}`)}return r}switch(t.ty){case ArgumentType.uint8:case ArgumentType.int8:case ArgumentType.uint16:case ArgumentType.int16:case ArgumentType.uint24:case ArgumentType.int24:case ArgumentType.uint32:case ArgumentType.int32:case ArgumentType.uint40:case ArgumentType.int40:case ArgumentType.uint48:case ArgumentType.int48:case ArgumentType.uint56:case ArgumentType.int56:case ArgumentType.uint64:case ArgumentType.int64:case ArgumentType.uint72:case ArgumentType.int72:case ArgumentType.uint80:case ArgumentType.int80:case ArgumentType.uint88:case ArgumentType.int88:case ArgumentType.uint96:case ArgumentType.int96:case ArgumentType.uint104:case ArgumentType.int104:case ArgumentType.uint112:case ArgumentType.int112:case ArgumentType.uint120:case ArgumentType.int120:case ArgumentType.uint128:case ArgumentType.int128:case ArgumentType.uint136:case ArgumentType.int136:case ArgumentType.uint144:case ArgumentType.int144:case ArgumentType.uint152:case ArgumentType.int152:case ArgumentType.uint160:case ArgumentType.int160:case ArgumentType.uint168:case ArgumentType.int168:case ArgumentType.uint176:case ArgumentType.int176:case ArgumentType.uint184:case ArgumentType.int184:case ArgumentType.uint192:case ArgumentType.int192:case ArgumentType.uint200:case ArgumentType.int200:case ArgumentType.uint208:case ArgumentType.int208:case ArgumentType.uint216:case ArgumentType.int216:case ArgumentType.uint224:case ArgumentType.int224:case ArgumentType.uint232:case ArgumentType.int232:case ArgumentType.uint240:case ArgumentType.int240:case ArgumentType.uint248:case ArgumentType.int248:case ArgumentType.int256:case ArgumentType.uint256:{let n=e.toString(16);n=e>0||0==e?"0x"+n:n.slice(0,1)+"0x"+n.slice(1);return getBytes(defaultAbiCoder.encode([solidityTypeToString(t)],[n]))}case ArgumentType.address:return r.set(e,12),r;case ArgumentType.bool:return r[31]=e?1:0,r;case ArgumentType.func:return r.set(e,8),r;case ArgumentType.bytes32:return r.set(e,0),r;case ArgumentType.bytes:case ArgumentType.string:return n=e instanceof Uint8Array?e:encode(e),r=Math.floor(n.length/32)>=0?0!==Math.floor(n.length%32)?new Uint8Array(32*(Math.floor(n.length/32)+1)+32):new Uint8Array(32*Math.floor(n.length/32)+32):new Uint8Array(64),r.set(n,32),o=safeView(r,28),o.setUint32(0,n.length),r;default:throw new Error(`Unsupported argument type: ${t.toString()}`)}}class ContractCallQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId),this._gas=null,null!=e.gas&&this.setGas(e.gas),this._functionParameters=null,null!=e.functionParameters&&(e.functionParameters instanceof Uint8Array?this.setFunctionParameters(e.functionParameters):this.setFunction(e.functionParameters.name,e.functionParameters.parameters)),this._maxResultSize=null,null!=e.maxResultSize&&this.setMaxResultSize(e.maxResultSize),this._senderAccountId=null,null!=e.senderAccountId&&this.setSenderAccountId(e.senderAccountId)}static _fromProtobuf(e){const t=e.contractCallLocal;return new ContractCallQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0,gas:null!=t.gas?t.gas:void 0,functionParameters:null!=t.functionParameters?t.functionParameters:void 0,maxResultSize:null!=t.maxResultSize?t.maxResultSize:void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get gas(){return this._gas}setGas(e){return this._gas=e instanceof Long?e:Long.fromValue(e),this}get senderAccountId(){return this._senderAccountId}setSenderAccountId(e){return this._senderAccountId="string"==typeof e?AccountId.fromString(e):e,this}get functionParameters(){return this._functionParameters}setFunctionParameters(e){return this._functionParameters=e,this}setFunction(e,t){return this._functionParameters=(null!=t?t:new ContractFunctionParameters)._build(e),this}setMaxResultSize(e){return this._maxResultSize=e instanceof Long?e:Long.fromValue(e),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_mapStatusError(e,t,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(t),o=Status._fromCode(null!=r?r:libExports.proto.ResponseCodeEnum.OK);if(!t.contractCallLocal.functionResult)return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:null});const a=this._mapResponseSync(t);return new PrecheckStatusError({nodeId:n,status:o,transactionId:this._getTransactionId(),contractFunctionResult:a})}_execute(e,t){return e.smartContract.contractCallLocalMethod(t)}_mapResponseHeader(e){return e.contractCallLocal.header}_mapResponse(e){const t=e.contractCallLocal;return Promise.resolve(ContractFunctionResult._fromProtobuf(t.functionResult,!1))}_mapResponseSync(e){const t=e.contractCallLocal;return ContractFunctionResult._fromProtobuf(t.functionResult,!1)}_onMakeRequest(e){return{contractCallLocal:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null,gas:this._gas,maxResultSize:this._maxResultSize,functionParameters:this._functionParameters,senderId:null!=this._senderAccountId?this._senderAccountId._toProtobuf():null}}}_getLogId(){return`ContractCallQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractCallLocal",ContractCallQuery._fromProtobuf);class FileCreateTransaction extends Transaction{constructor(e={}){super(),this._keys=null,this._expirationTime=new Timestamp(0,0).plusNanos(Long.fromNumber(Date.now()).mul(1e6).add(DEFAULT_AUTO_RENEW_PERIOD.mul(1e9))),this._contents=null,this._fileMemo=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.keys&&this.setKeys(e.keys),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.contents&&this.setContents(e.contents),e.fileMemo&&null!=e.fileMemo&&this.setFileMemo(e.fileMemo)}static _fromProtobuf(e,t,n,r,o){const a=o[0].fileCreate;return Transaction._fromProtobufTransactions(new FileCreateTransaction({keys:null!=a.keys&&null!=a.keys.keys?a.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0,contents:null!=a.contents?a.contents:void 0,fileMemo:null!=a.memo?a.memo:void 0}),e,t,n,r,o)}get keys(){return this._keys}setKeys(e){if(this._requireNotFrozen(),e instanceof KeyList&&null!=e.threshold)throw new Error("Cannot set threshold key as file key");return this._keys=e instanceof KeyList?e.toArray():e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode(e),this}get fileMemo(){return this._fileMemo}setFileMemo(e){return this._requireNotFrozen(),this._fileMemo=e,this}_execute(e,t){return e.file.createFile(t)}_getTransactionDataCase(){return"fileCreate"}_makeTransactionData(){return{keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:null,expirationTime:this._expirationTime._toProtobuf(),contents:this._contents,memo:this._fileMemo}}_getLogId(){return`FileCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileCreate",FileCreateTransaction._fromProtobuf);class FileAppendTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contents=null,this._maxChunks=20,this._chunkSize=4096,this._chunkInterval=10,this._defaultMaxTransactionFee=new Hbar(5),null!=e.fileId&&this.setFileId(e.fileId),null!=e.contents&&this.setContents(e.contents),null!=e.maxChunks&&this.setMaxChunks(e.maxChunks),null!=e.chunkSize&&this.setChunkSize(e.chunkSize),null!=e.chunkInterval&&this.setChunkInterval(e.chunkInterval),this._transactionIds=new List}static _fromProtobuf(e,t,n,r,o){const a=o[0].fileAppend;let i;const s=r.length>0?r.length:1;for(let e=0;e<o.length;e+=s){const t=o[e].fileAppend;if(null==t.contents)break;if(null==i){i=new Uint8Array(t.contents);continue}const n=new Uint8Array(i.length+t.contents.length);n.set(i,0),n.set(t.contents,i.length),i=n}const c=a.contents?.length||void 0,u=o.length?o.length/s:void 0;let l;if(n.length>1){const e=n[0].validStart,t=n[1].validStart;e&&t&&(l=t.nanos.sub(e.nanos).toNumber())}return Transaction._fromProtobufTransactions(new FileAppendTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,contents:i,chunkSize:c,maxChunks:u,chunkInterval:l}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}getRequiredChunks(){if(null==this._contents)return 1;return Math.ceil(this._contents.length/this._chunkSize)}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode(e),this}get maxChunks(){return this._maxChunks}setMaxChunks(e){if(e<=0)throw new Error("Max chunks must be greater than 0");return this._requireNotFrozen(),this._maxChunks=e,this}get chunkSize(){return this._chunkSize}setChunkSize(e){if(e<=0)throw new Error("Chunk size must be greater than 0");return this._chunkSize=e,this}get chunkInterval(){return this._chunkInterval}setChunkInterval(e){return this._chunkInterval=e,this}freezeWith(e){if(super.freezeWith(e),null==this._contents)return this;let t=this._getTransactionId();this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<this.getRequiredChunks();e++){this._transactionIds.push(t),this._transactionIds.advance();for(const e of this._nodeAccountIds.list)this._signedTransactions.push(this._makeSignedTransaction(e));t=new TransactionId(t.accountId,new Timestamp(t.validStart.seconds,t.validStart.nanos.add(this._chunkInterval)))}return this._transactionIds.advance(),this._transactionIds.setLocked(),this}schedule(){if(this._requireNotFrozen(),null!=this._contents&&this._contents.length>this._chunkSize)throw new Error(`cannot schedule \`FileAppendTransaction\` with message over ${this._chunkSize} bytes`);return super.schedule()}async execute(e,t){return(await this.executeAll(e,t))[0]}async executeAll(e,t){if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot execute \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);super._isFrozen()||this.freezeWith(e);const n=this._getTransactionId(),r=e.operatorAccountId;null!=r&&r.equals(n.accountId)&&await super.signWithOperator(e);const o=[];let a=t;for(let t=0;t<this._transactionIds.length;t++){const t=Date.now(),n=await super.execute(e,a);null!=a&&(a=Date.now()-t),await n.getReceipt(e),o.push(n)}return o}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.appendContent(t)}_getTransactionDataCase(){return"fileAppend"}_buildIncompleteTransactions(){const e=AccountId.fromString("0.0.0"),t=this.transactionId?.accountId||e,n=this.transactionId?.validStart||Timestamp.fromDate(new Date);if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<this.getRequiredChunks();e++){let r=TransactionId.withValidStart(t,n.plusNanos(this._chunkInterval*e));if(this._transactionIds.push(r),this._transactionIds.advance(),0===this._nodeAccountIds.list.length)this._transactions.push(this._makeSignedTransaction(null));else for(const e of this._nodeAccountIds.list)this._transactions.push(this._makeSignedTransaction(e))}this._transactionIds.advance(),this._transactionIds.setLocked()}_buildAllTransactions(){if(this.maxChunks&&this.getRequiredChunks()>this.maxChunks)throw new Error(`cannot build \`FileAppendTransaction\` with more than ${this.maxChunks} chunks`);for(let e=0;e<this._signedTransactions.length;e++)this._buildTransaction(e)}_getLogId(){return`FileAppendTransaction:${this._transactionIds.current.validStart.toString()}`}_makeTransactionData(){const e=null!=this._contents?this._contents.length:0,t=this._transactionIds.index*this._chunkSize,n=Math.min(t+this._chunkSize,e);return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contents:null!=this._contents?this._contents.slice(t,n):null}}}TRANSACTION_REGISTRY.set("fileAppend",FileAppendTransaction._fromProtobuf);class FileDeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].fileDelete;return Transaction._fromProtobufTransactions(new FileDeleteTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.deleteFile(t)}_getTransactionDataCase(){return"fileDelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null}}_getLogId(){return`FileDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileDelete",FileDeleteTransaction._fromProtobuf);class ContractCreateTransaction extends Transaction{constructor(e={}){super(),this._bytecodeFileId=null,this._bytecode=null,this._adminKey=null,this._gas=null,this._initialBalance=null,this._proxyAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._constructorParameters=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._defaultMaxTransactionFee=new Hbar(20),this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=!1,this._autoRenewAccountId=null,this._hooks=[],null!=e.hooks&&(this._hooks=e.hooks),null!=e.bytecodeFileId&&this.setBytecodeFileId(e.bytecodeFileId),null!=e.bytecode&&this.setBytecode(e.bytecode),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.gas&&this.setGas(e.gas),null!=e.initialBalance&&this.setInitialBalance(e.initialBalance),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.constructorParameters&&this.setConstructorParameters(e.constructorParameters),null!=e.contractMemo&&this.setContractMemo(e.contractMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].contractCreateInstance;return Transaction._fromProtobufTransactions(new ContractCreateTransaction({bytecodeFileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,gas:null!=a.gas?a.gas:void 0,initialBalance:null!=a.initialBalance?Hbar.fromTinybars(a.initialBalance):void 0,proxyAccountId:null!=a.proxyAccountID?AccountId._fromProtobuf(a.proxyAccountID):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,constructorParameters:null!=a.constructorParameters?a.constructorParameters:void 0,contractMemo:null!=a.memo?a.memo:void 0,maxAutomaticTokenAssociations:null!=a.maxAutomaticTokenAssociations?a.maxAutomaticTokenAssociations:void 0,stakedAccountId:null!=a.stakedAccountId?AccountId._fromProtobuf(a.stakedAccountId):void 0,stakedNodeId:null!=a.stakedNodeId?a.stakedNodeId:void 0,declineStakingReward:1==a.declineReward,autoRenewAccountId:null!=a.autoRenewAccountId?AccountId._fromProtobuf(a.autoRenewAccountId):void 0}),e,t,n,r,o)}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(e){return this._requireNotFrozen(),this._bytecodeFileId="string"==typeof e?FileId.fromString(e):e.clone(),this._bytecode=null,this}get bytecode(){return this._bytecode}setBytecode(e){return this._requireNotFrozen(),this._bytecode=e,this._bytecodeFileId=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get gas(){return this._gas}setGas(e){if(this._requireNotFrozen(),this._gas=e instanceof Long?e:Long.fromValue(e),this._gas.lessThan(0))throw new Error("Gas cannot be negative number");return this}get initialBalance(){return this._initialBalance}setInitialBalance(e){return this._requireNotFrozen(),this._initialBalance=e instanceof Hbar?e:new Hbar(e),this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get constructorParameters(){return this._constructorParameters}setConstructorParameters(e){return this._requireNotFrozen(),this._constructorParameters=e instanceof ContractFunctionParameters?e._build():e,this}get contractMemo(){return this._contractMemo}setContractMemo(e){return this._requireNotFrozen(),this._contractMemo=e,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._maxAutomaticTokenAssociations=e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this._stakedNodeId=null,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this._stakedAccountId=null,this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?AccountId.fromString(e):e,this}_validateChecksums(e){null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}addHook(e){return this._hooks.push(e),this}setHooks(e){return this._hooks=e,this}get hooks(){return this._hooks}_execute(e,t){return e.smartContract.createContract(t)}_getTransactionDataCase(){return"contractCreateInstance"}_makeTransactionData(){return{fileID:null!=this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,initcode:this._bytecode,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,gas:this._gas,initialBalance:null!=this._initialBalance?this._initialBalance.toTinybars():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),constructorParameters:this._constructorParameters,memo:this._contractMemo,maxAutomaticTokenAssociations:this._maxAutomaticTokenAssociations,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:this.declineStakingRewards,autoRenewAccountId:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,hookCreationDetails:this.hooks.map(e=>e._toProtobuf())}}_getLogId(){return`ContractCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractCreateInstance",ContractCreateTransaction._fromProtobuf);class ContractCreateFlow{constructor(){this._bytecode=null,this._contractCreate=new ContractCreateTransaction,this._signerPublicKeys=new Set,this._publicKeys=[],this._transactionSigners=[],this._maxChunks=null}get maxChunks(){return this._maxChunks}setMaxChunks(e){return this._maxChunks=e,this}get bytecode(){return this._bytecode}setBytecode(e){return this._bytecode=e instanceof Uint8Array?e:encode(e),this}get adminKey(){return this._contractCreate.adminKey}setAdminKey(e){return this._contractCreate.setAdminKey(e),this}get gas(){return this._contractCreate.gas}setGas(e){return this._contractCreate.setGas(e),this}get initialBalance(){return this._contractCreate.initialBalance}setInitialBalance(e){return this._contractCreate.setInitialBalance(e),this}get proxyAccountId(){return this._contractCreate.proxyAccountId}setProxyAccountId(e){return this._contractCreate.setProxyAccountId(e),this}get autoRenewPeriod(){return this._contractCreate.autoRenewPeriod}setAutoRenewPeriod(e){return this._contractCreate.setAutoRenewPeriod(e),this}get constructorParameters(){return this._contractCreate.constructorParameters}setConstructorParameters(e){return this._contractCreate.setConstructorParameters(e),this}get contractMemo(){return this._contractCreate.contractMemo}setContractMemo(e){return this._contractCreate.setContractMemo(e),this}get maxAutomaticTokenAssociation(){return this._contractCreate.maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._contractCreate.setMaxAutomaticTokenAssociations(e),this}get stakedAccountId(){return this._contractCreate.stakedAccountId}setStakedAccountId(e){return this._contractCreate.setStakedAccountId(e),this}get stakedNodeId(){return this._contractCreate.stakedNodeId}setStakedNodeId(e){return this._contractCreate.setStakedNodeId(e),this}get declineStakingRewards(){return this._contractCreate.declineStakingRewards}setDeclineStakingReward(e){return this._contractCreate.setDeclineStakingReward(e),this}get autoRenewAccountId(){return this._contractCreate.autoRenewAccountId}setAutoRenewAccountId(e){return this._contractCreate.setAutoRenewAccountId(e),this}sign(e){return this.signWith(e.publicKey,t=>Promise.resolve(e.sign(t)))}signWith(e,t){const n=encode$4(e.toBytesRaw());return this._signerPublicKeys.has(n)||(this._publicKeys.push(e),this._transactionSigners.push(t)),this}async execute(e,t){if(null==this._bytecode)throw new Error("cannot create contract with no bytecode");const n=e.operatorPublicKey,r=(new FileCreateTransaction).setKeys(null!=n?[n]:[]).setContents(this._bytecode.subarray(0,Math.min(this._bytecode.length,2048))).freezeWith(e);await addSignersToTransaction(r,this._publicKeys,this._transactionSigners);let o=await r.execute(e,t);const a=(await o.getReceipt(e)).fileId;if(this._bytecode.length>2048){const n=(new FileAppendTransaction).setFileId(a).setContents(this._bytecode.subarray(2048)).freezeWith(e);await addSignersToTransaction(n,this._publicKeys,this._transactionSigners),await n.execute(e,t)}if(this._contractCreate.setBytecodeFileId(a).freezeWith(e),await addSignersToTransaction(this._contractCreate,this._publicKeys,this._transactionSigners),o=await this._contractCreate.execute(e,t),await o.getReceipt(e),null!=n){const n=(new FileDeleteTransaction).setFileId(a).freezeWith(e);await addSignersToTransaction(n,this._publicKeys,this._transactionSigners),await(await n.execute(e,t)).getReceipt(e)}return o}async executeWithSigner(e){if(null==this._bytecode)throw new Error("cannot create contract with no bytecode");if(null==e.getAccountKey)throw new Error("`Signer.getAccountKey()` is not implemented, but is required for `ContractCreateFlow`");const t=await e.getAccountKey();let n;if(t instanceof PublicKey)n=t;else{const e=Object.values(t._key._key._keyData),r=new Uint8Array(e);n=PublicKey.fromBytes(r)}const r=await(new FileCreateTransaction).setKeys(null!=n?[n]:[]).setContents(this._bytecode.subarray(0,Math.min(this._bytecode.length,2048))).freezeWithSigner(e);await r.signWithSigner(e),await addSignersToTransaction(r,this._publicKeys,this._transactionSigners);let o=await r.executeWithSigner(e);const a=(await o.getReceiptWithSigner(e)).fileId;if(this._bytecode.length>2048){let t=(new FileAppendTransaction).setFileId(a).setContents(this._bytecode.subarray(2048));null!=this._maxChunks&&t.setMaxChunks(this._maxChunks),t=await t.freezeWithSigner(e),await t.signWithSigner(e),await addSignersToTransaction(t,this._publicKeys,this._transactionSigners),await t.executeWithSigner(e)}if(this._contractCreate=await this._contractCreate.setBytecodeFileId(a).freezeWithSigner(e),this._contractCreate=await this._contractCreate.signWithSigner(e),await addSignersToTransaction(this._contractCreate,this._publicKeys,this._transactionSigners),o=await this._contractCreate.executeWithSigner(e),await o.getReceiptWithSigner(e),null!=t){const t=await(new FileDeleteTransaction).setFileId(a).freezeWithSigner(e);await t.signWithSigner(e),await addSignersToTransaction(t,this._publicKeys,this._transactionSigners),await(await t.executeWithSigner(e)).getReceiptWithSigner(e)}return o}}async function addSignersToTransaction(e,t,n){for(let r=0;r<t.length;r++)await e.signWith(t[r],n[r])}class ContractDeleteTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._transferAccountId=null,this._transferContractId=null,this._permanentRemoval=!1,null!=e.contractId&&this.setContractId(e.contractId),null!=e.transferAccountId&&this.setTransferAccountId(e.transferAccountId),null!=e.transferContractId&&this.setTransferContractId(e.transferContractId),null!=e.permanentRemoval&&this.setPermanentRemoval(e.permanentRemoval)}static _fromProtobuf(e,t,n,r,o){const a=o[0].contractDeleteInstance;return Transaction._fromProtobufTransactions(new ContractDeleteTransaction({contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0,transferAccountId:null!=a.transferAccountID?AccountId._fromProtobuf(a.transferAccountID):void 0,transferContractId:null!=a.transferContractID?ContractId._fromProtobuf(a.transferContractID):void 0,permanentRemoval:a.permanentRemoval??!1}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get transferContractId(){return this._transferContractId}setTransferContractId(e){return this._requireNotFrozen(),this._transferContractId=e instanceof ContractId?e:ContractId.fromString(e),this._transferAccountId=null,this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(e){return this._requireNotFrozen(),this._transferAccountId=e instanceof AccountId?e:AccountId.fromString(e),this._transferContractId=null,this}get permanentRemoval(){return this._permanentRemoval}setPermanentRemoval(e){return this._requireNotFrozen(),this._permanentRemoval=e,this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(e),null!=this._transferContractId&&this._transferContractId.validateChecksum(e)}_execute(e,t){return e.smartContract.deleteContract(t)}_getTransactionDataCase(){return"contractDeleteInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,transferAccountID:this._transferAccountId?this._transferAccountId._toProtobuf():null,transferContractID:null!=this._transferContractId?this._transferContractId._toProtobuf():null,permanentRemoval:this._permanentRemoval}}_getLogId(){return`ContractDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractDeleteInstance",ContractDeleteTransaction._fromProtobuf);class ContractExecuteTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._gas=null,this._amount=null,this._functionParameters=null,null!=e.contractId&&this.setContractId(e.contractId),null!=e.gas&&this.setGas(e.gas),null!=e.amount&&this.setPayableAmount(e.amount),null!=e.functionParameters?this.setFunctionParameters(e.functionParameters):null!=e.function&&this.setFunction(e.function.name,e.function.parameters)}static _fromProtobuf(e,t,n,r,o){const a=o[0].contractCall;return Transaction._fromProtobufTransactions(new ContractExecuteTransaction({contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0,gas:null!=a.gas?a.gas:void 0,amount:null!=a.amount?Hbar.fromTinybars(a.amount):void 0,functionParameters:null!=a.functionParameters?a.functionParameters:void 0}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get gas(){return this._gas}setGas(e){this._requireNotFrozen();const t=e instanceof Long?e:Long.fromValue(e);if(t.lt(0))throw new Error("Gas must be greater than 0");return this._gas=t,this}get payableAmount(){return this._amount}setPayableAmount(e,t=HbarUnit.Hbar){return this._requireNotFrozen(),this._amount=e instanceof Hbar?e:Hbar.from(e,t),this}get functionParameters(){return this._functionParameters}setFunctionParameters(e){return this._requireNotFrozen(),this._functionParameters=e,this}setFunction(e,t){return this._requireNotFrozen(),this._functionParameters=null!=t?t._build(e):(new ContractFunctionParameters)._build(e),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.contractCallMethod(t)}_getTransactionDataCase(){return"contractCall"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,gas:this._gas,amount:null!=this._amount?this._amount.toTinybars():null,functionParameters:this._functionParameters}}_getLogId(){return`ContractExecuteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractCall",ContractExecuteTransaction._fromProtobuf);const{proto:proto$4}=HieroProto;class ContractInfo{constructor(e){this.contractId=e.contractId,this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.storage=e.storage,this.contractMemo=e.contractMemo,this.balance=e.balance,this.isDeleted=e.isDeleted,this.tokenRelationships=e.tokenRelationships,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.ledgerId=e.ledgerId,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(e){const t=e.autoRenewPeriod.seconds;return new ContractInfo({contractId:ContractId._fromProtobuf(e.contractID),accountId:AccountId._fromProtobuf(e.accountID),contractAccountId:null!=e.contractAccountID?e.contractAccountID:"",adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,expirationTime:Timestamp._fromProtobuf(e.expirationTime),autoRenewPeriod:new Duration(t),autoRenewAccountId:null!=e.autoRenewAccountId?AccountId._fromProtobuf(e.autoRenewAccountId):null,storage:null!=e.storage?e.storage instanceof Long?e.storage:Long.fromValue(e.storage):Long.ZERO,contractMemo:null!=e.memo?e.memo:"",balance:Hbar.fromTinybars(null!=e.balance?e.balance:0),isDeleted:e.deleted,tokenRelationships:TokenRelationshipMap._fromProtobuf(null!=e.tokenRelationships?e.tokenRelationships:[]),ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,stakingInfo:null!=e.stakingInfo?StakingInfo._fromProtobuf(e.stakingInfo):null,maxAutomaticTokenAssociations:null!=e.maxAutomaticTokenAssociations?Long.isLong(e.maxAutomaticTokenAssociations)?e.maxAutomaticTokenAssociations:Long.fromValue(e.maxAutomaticTokenAssociations):Long.ZERO})}_toProtobuf(){return{contractID:this.contractId._toProtobuf(),accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccountId:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,storage:this.storage,memo:this.contractMemo,balance:this.balance.toTinybars(),deleted:this.isDeleted,tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toNumber()}}static fromBytes(e){return ContractInfo._fromProtobuf(proto$4.ContractGetInfoResponse.ContractInfo.decode(e))}toBytes(){return proto$4.ContractGetInfoResponse.ContractInfo.encode(this._toProtobuf()).finish()}}class ContractInfoQuery extends Query{constructor(e={}){super(),this._contractId=null,null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e){const t=e.contractGetInfo;return new ContractInfoQuery({contractId:null!=t.contractID?ContractId._fromProtobuf(t.contractID):void 0})}get contractId(){return this._contractId}setContractId(e){return this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e)}_execute(e,t){return e.smartContract.getContractInfo(t)}async getCost(e){return super.getCost(e)}_mapResponseHeader(e){return e.contractGetInfo.header}_mapResponse(e,t,n){const r=e.contractGetInfo;return Promise.resolve(ContractInfo._fromProtobuf(r.contractInfo))}_onMakeRequest(e){return{contractGetInfo:{header:e,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}}_getLogId(){return`ContractInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("contractGetInfo",ContractInfoQuery._fromProtobuf);class ContractUpdateTransaction extends Transaction{constructor(e={}){super(),this._contractId=null,this._expirationTime=null,this._adminKey=null,this._proxyAccountId=null,this._autoRenewPeriod=null,this._bytecodeFileId=null,this._contractMemo=null,this._maxAutomaticTokenAssociations=null,this._stakedAccountId=null,this._stakedNodeId=null,this._declineStakingReward=null,this._autoRenewAccountId=null,this._hooksToBeCreated=[],this._hooksToBeDeleted=[],null!=e.contractId&&this.setContractId(e.contractId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.proxyAccountId&&this.setProxyAccountId(e.proxyAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.bytecodeFileId&&this.setBytecodeFileId(e.bytecodeFileId),null!=e.contractMemo&&this.setContractMemo(e.contractMemo),null!=e.maxAutomaticTokenAssociations&&this.setMaxAutomaticTokenAssociations(e.maxAutomaticTokenAssociations),null!=e.stakedAccountId&&this.setStakedAccountId(e.stakedAccountId),null!=e.stakedNodeId&&this.setStakedNodeId(e.stakedNodeId),null!=e.declineStakingReward&&this.setDeclineStakingReward(e.declineStakingReward),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.hooksToBeCreated&&this.setHooksToCreate(e.hooksToBeCreated),null!=e.hooksToBeDeleted&&this.setHooksToDelete(e.hooksToBeDeleted)}static _fromProtobuf(e,t,n,r,o){const a=o[0].contractUpdateInstance;let i,s,c;return null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds&&(i=a.autoRenewPeriod.seconds),null!=a.memoWrapper&&Object.hasOwn(a.memoWrapper,"value")&&null!=a.memoWrapper.value&&(s=a.memoWrapper.value),null!=a.maxAutomaticTokenAssociations&&null!=a.maxAutomaticTokenAssociations.value&&(c=a.maxAutomaticTokenAssociations.value),Transaction._fromProtobufTransactions(new ContractUpdateTransaction({contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0,bytecodeFileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,proxyAccountId:null!=a.proxyAccountID?AccountId._fromProtobuf(a.proxyAccountID):void 0,autoRenewPeriod:i,contractMemo:s,maxAutomaticTokenAssociations:c,stakedAccountId:null!=a.stakedAccountId?AccountId._fromProtobuf(a.stakedAccountId):void 0,stakedNodeId:null!=a.stakedNodeId?a.stakedNodeId:void 0,declineStakingReward:null!=a.declineReward&&1==Boolean(a.declineReward),autoRenewAccountId:null!=a.autoRenewAccountId?AccountId._fromProtobuf(a.autoRenewAccountId):void 0}),e,t,n,r,o)}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId="string"==typeof e?ContractId.fromString(e):e.clone(),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get proxyAccountId(){return this._proxyAccountId}setProxyAccountId(e){return this._requireNotFrozen(),this._proxyAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get bytecodeFileId(){return this._bytecodeFileId}setBytecodeFileId(e){return console.warn("Deprecated: there is no replacement"),this._requireNotFrozen(),this._bytecodeFileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get contractMemo(){return this._contractMemo}setContractMemo(e){return this._requireNotFrozen(),this._contractMemo=e,this}clearContractMemo(){return this._requireNotFrozen(),this._contractMemo=null,this}get maxAutomaticTokenAssociations(){return this._maxAutomaticTokenAssociations}setMaxAutomaticTokenAssociations(e){return this._requireNotFrozen(),this._maxAutomaticTokenAssociations=e,this}get stakedAccountId(){return this._stakedAccountId}setStakedAccountId(e){return this._requireNotFrozen(),this._stakedAccountId="string"==typeof e?AccountId.fromString(e):e,this}get stakedNodeId(){return this._stakedNodeId}setStakedNodeId(e){return this._requireNotFrozen(),this._stakedNodeId=Long.fromValue(e),this}get declineStakingRewards(){return this._declineStakingReward}setDeclineStakingReward(e){return this._requireNotFrozen(),this._declineStakingReward=e,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId="string"==typeof e?AccountId.fromString(e):e,this}clearAutoRenewAccountId(){return this._autoRenewAccountId=new AccountId(0),this}_validateChecksums(e){null!=this._contractId&&this._contractId.validateChecksum(e),null!=this._bytecodeFileId&&this._bytecodeFileId.validateChecksum(e),null!=this._proxyAccountId&&this._proxyAccountId.validateChecksum(e)}addHookToCreate(e){return this._hooksToBeCreated.push(e),this}setHooksToCreate(e){return this._hooksToBeCreated=e,this}get hooksToCreate(){return this._hooksToBeCreated}addHookToDelete(e){return this._hooksToBeDeleted.push(e),this}setHooksToDelete(e){return this._hooksToBeDeleted=e,this}get hooksToDelete(){return this._hooksToBeDeleted}_execute(e,t){return e.smartContract.updateContract(t)}_getTransactionDataCase(){return"contractUpdateInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,proxyAccountID:null!=this._proxyAccountId?this._proxyAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,fileID:this._bytecodeFileId?this._bytecodeFileId._toProtobuf():null,memoWrapper:null!=this._contractMemo?{value:this._contractMemo}:null,maxAutomaticTokenAssociations:null!=this._maxAutomaticTokenAssociations?{value:this._maxAutomaticTokenAssociations}:null,stakedAccountId:null!=this.stakedAccountId?this.stakedAccountId._toProtobuf():null,stakedNodeId:this.stakedNodeId,declineReward:null!=this.declineStakingRewards?{value:this.declineStakingRewards}:null,autoRenewAccountId:null!=this._autoRenewAccountId?"0.0.0"==this._autoRenewAccountId.toString()?libExports.proto.AccountID.create():this._autoRenewAccountId._toProtobuf():null,hookIdsToDelete:null!=this._hooksToBeDeleted?this._hooksToBeDeleted:null,hookCreationDetails:null!=this._hooksToBeCreated?this._hooksToBeCreated.map(e=>e._toProtobuf()):null}}_getLogId(){return`ContractUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("contractUpdateInstance",ContractUpdateTransaction._fromProtobuf);class FeeAssessmentMethod{constructor(e){this._value=e,Object.freeze(this)}toString(){switch(this){case FeeAssessmentMethod.Inclusive:return"INCLUSIVE";case FeeAssessmentMethod.Exclusive:return"EXCLUSIVE";default:return`UNKNOWN (${this._value.toString()})`}}static _fromValue(e){switch(e){case!1:return FeeAssessmentMethod.Inclusive;case!0:return FeeAssessmentMethod.Exclusive}}valueOf(){return this._value}}FeeAssessmentMethod.Inclusive=new FeeAssessmentMethod(!1),FeeAssessmentMethod.Exclusive=new FeeAssessmentMethod(!0);class CustomFractionalFee extends CustomFee{constructor(e={}){super(e),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator),this._min=null,null!=e.min&&this.setMin(e.min),this._max,null!=e.max&&this.setMax(e.max),this._assessmentMethod,null!=e.assessmentMethod&&this.setAssessmentMethod(e.assessmentMethod)}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?Long.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?Long.fromNumber(e):e,this}get min(){return this._min}setMin(e){return this._min="number"==typeof e?Long.fromNumber(e):e,this}get max(){return this._max}setMax(e){return this._max="number"==typeof e?Long.fromNumber(e):e,this}get assessmentMethod(){return this._assessmentMethod}setAssessmentMethod(e){return this._assessmentMethod=e,this}static _fromProtobuf(e){const t=e.fractionalFee,n=t.fractionalAmount;return new CustomFractionalFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0,min:null!=t.minimumAmount?t.minimumAmount:void 0,max:null!=t.maximumAmount?t.maximumAmount:void 0,assessmentMethod:null!=t.netOfTransfers?new FeeAssessmentMethod(t.netOfTransfers):void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,fractionalFee:{fractionalAmount:{numerator:this._numerator,denominator:this._denominator},minimumAmount:this._min,maximumAmount:this._max,netOfTransfers:null!=this._assessmentMethod&&this._assessmentMethod.valueOf()}}}}class CustomRoyalyFee extends CustomFee{constructor(e={}){super(e),this._fallbackFee=null,null!=e.fallbackFee&&this.setFallbackFee(e.fallbackFee),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator)}get fallbackFee(){return this._fallbackFee}setFallbackFee(e){return this._fallbackFee=e,this}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?Long.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?Long.fromNumber(e):e,this}static _fromProtobuf(e){const t=e.royaltyFee,n=t.exchangeValueFraction;return new CustomRoyalyFee({feeCollectorAccountId:null!=e.feeCollectorAccountId?AccountId._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,fallbackFee:null!=t.fallbackFee?CustomFixedFee._fromProtobuf({fixedFee:t.fallbackFee}):void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,royaltyFee:{exchangeValueFraction:{numerator:this._numerator,denominator:this._denominator},fallbackFee:null!=this._fallbackFee?this._fallbackFee._toProtobuf().fixedFee:null}}}}class DelegateContractId extends ContractId{constructor(e,t,n,r){super(e,t,n,r)}static fromString(e){return new DelegateContractId(ContractId.fromString(e))}static _fromProtobuf(e){return new DelegateContractId(ContractId._fromProtobuf(e))}static fromBytes(e){return new DelegateContractId(ContractId.fromBytes(e))}static fromSolidityAddress(e){return new DelegateContractId(ContractId.fromSolidityAddress(e))}clone(){const e=new DelegateContractId(this);return e._checksum=this._checksum,e}_toProtobufKey(){return{delegatableContractId:this._toProtobuf()}}static __fromProtobufKey(e){return DelegateContractId._fromProtobuf(e)}}CACHE.setDelegateContractId(e=>DelegateContractId.__fromProtobufKey(e));class EthereumTransaction extends Transaction{constructor(e={}){super(),this._ethereumData=null,this._callDataFileId=null,this._maxGasAllowance=null,null!=e.ethereumData&&this.setEthereumData(e.ethereumData),null!=e.callData&&this.setCallDataFileId(e.callData),null!=e.callDataFileId&&this.setCallDataFileId(e.callDataFileId),null!=e.maxGasAllowance&&this.setMaxGasAllowanceHbar(e.maxGasAllowance)}static _fromProtobuf(e,t,n,r,o){const a=o[0].ethereumTransaction;return Transaction._fromProtobufTransactions(new EthereumTransaction({ethereumData:null!=a.ethereumData?a.ethereumData:void 0,callData:null!=a.callData?FileId._fromProtobuf(a.callData):void 0,maxGasAllowance:null!=a.maxGasAllowance?Hbar.fromTinybars(a.maxGasAllowance):void 0}),e,t,n,r,o)}get ethereumData(){return this._ethereumData}setEthereumData(e){return this._requireNotFrozen(),this._ethereumData=e,this}get callData(){return this.callDataFileId}setCallData(e){return this.setCallDataFileId(e)}get callDataFileId(){return this._callDataFileId}setCallDataFileId(e){return this._requireNotFrozen(),this._callDataFileId=e,this}get maxGasAllowance(){return this._maxGasAllowance}setMaxGasAllowance(e){return this.setMaxGasAllowanceHbar(e)}setMaxGasAllowanceHbar(e){return this._requireNotFrozen(),this._maxGasAllowance=e instanceof Hbar?e:new Hbar(e),this}_validateChecksums(e){null!=this._ethereumData&&this._ethereumData instanceof FileId&&this._ethereumData.validateChecksum(e)}_execute(e,t){return e.smartContract.callEthereum(t)}_getTransactionDataCase(){return"ethereumTransaction"}_makeTransactionData(){return{ethereumData:this._ethereumData,callData:null!=this._callDataFileId?this._callDataFileId._toProtobuf():null,maxGasAllowance:null!=this._maxGasAllowance?this._maxGasAllowance.toTinybars():null}}_getLogId(){return`EthereumTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("ethereumTransaction",EthereumTransaction._fromProtobuf);class EthereumTransactionData{constructor(e){this.callData=e.callData}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");switch(e[0]){case 1:return CACHE.ethereumTransactionDataEip2930FromBytes(e);case 2:return CACHE.ethereumTransactionDataEip1559FromBytes(e);case 4:return CACHE.ethereumTransactionDataEip7702FromBytes(e);default:return CACHE.ethereumTransactionDataLegacyFromBytes(e)}}toBytes(){throw new Error("not implemented")}toString(){throw new Error("not implemented")}toJSON(){throw new Error("not implemented")}}class EthereumTransactionDataLegacy extends EthereumTransactionData{constructor(e){super(e),this.nonce=e.nonce,this.gasPrice=e.gasPrice,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.v=e.v,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decodeRlp(e);if(9!=t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataLegacy({nonce:decode$7(t[0]),gasPrice:decode$7(t[1]),gasLimit:decode$7(t[2]),to:decode$7(t[3]),value:decode$7(t[4]),callData:decode$7(t[5]),v:decode$7(t[6]),r:decode$7(t[7]),s:decode$7(t[8])})}toBytes(){return decode$7(encodeRlp([this.nonce,this.gasPrice,this.gasLimit,this.to,this.value,this.callData,this.v,this.r,this.s]))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{nonce:encode$4(this.nonce),gasPrice:encode$4(this.gasPrice),gasLimit:encode$4(this.gasLimit),to:encode$4(this.to),value:encode$4(this.value),callData:encode$4(this.callData),v:encode$4(this.v),r:encode$4(this.r),s:encode$4(this.s)}}}CACHE.setEthereumTransactionDataLegacyFromBytes(e=>EthereumTransactionDataLegacy.fromBytes(e));class EthereumTransactionDataEip1559 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.maxPriorityGas=e.maxPriorityGas,this.maxGas=e.maxGas,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decodeRlp(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(12!=t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataEip1559({chainId:decode$7(t[0]),nonce:decode$7(t[1]),maxPriorityGas:decode$7(t[2]),maxGas:decode$7(t[3]),gasLimit:decode$7(t[4]),to:decode$7(t[5]),value:decode$7(t[6]),callData:decode$7(t[7]),accessList:t[8].map(e=>{if(!Array.isArray(e)||2!==e.length)throw new Error("invalid access list entry: must be [address, storageKeys[]]");return[decode$7(e[0]),e[1].map(e=>decode$7(e))]}),recId:decode$7(t[9]),r:decode$7(t[10]),s:decode$7(t[11])})}toBytes(){return decode$7("02"+encodeRlp([this.chainId,this.nonce,this.maxPriorityGas,this.maxGas,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$4(this.chainId),nonce:encode$4(this.nonce),maxPriorityGas:encode$4(this.maxPriorityGas),maxGas:encode$4(this.maxGas),gasLimit:encode$4(this.gasLimit),to:encode$4(this.to),value:encode$4(this.value),callData:encode$4(this.callData),accessList:this.accessList.map(([e,t])=>({address:encode$4(e),storageKeys:t.map(e=>encode$4(e))})),recId:encode$4(this.recId),r:encode$4(this.r),s:encode$4(this.s)}}}CACHE.setEthereumTransactionDataEip1559FromBytes(e=>EthereumTransactionDataEip1559.fromBytes(e));class EthereumTransactionDataEip2930 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.gasPrice=e.gasPrice,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decodeRlp(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(11!==t.length)throw new Error("invalid ethereum transaction data");return new EthereumTransactionDataEip2930({chainId:decode$7(t[0]),nonce:decode$7(t[1]),gasPrice:decode$7(t[2]),gasLimit:decode$7(t[3]),to:decode$7(t[4]),value:decode$7(t[5]),callData:decode$7(t[6]),accessList:t[7].map(e=>{if(!Array.isArray(e)||2!==e.length)throw new Error("invalid access list entry: must be [address, storageKeys[]]");return[decode$7(e[0]),e[1].map(e=>decode$7(e))]}),recId:decode$7(t[8]),r:decode$7(t[9]),s:decode$7(t[10])})}toBytes(){return decode$7("01"+encodeRlp([this.chainId,this.nonce,this.gasPrice,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$4(this.chainId),nonce:encode$4(this.nonce),gasPrice:encode$4(this.gasPrice),gasLimit:encode$4(this.gasLimit),to:encode$4(this.to),value:encode$4(this.value),callData:encode$4(this.callData),accessList:this.accessList.map(([e,t])=>({address:encode$4(e),storageKeys:t.map(e=>encode$4(e))})),recId:encode$4(this.recId),r:encode$4(this.r),s:encode$4(this.s)}}}CACHE.setEthereumTransactionDataEip2930FromBytes(e=>EthereumTransactionDataEip2930.fromBytes(e));class EthereumTransactionDataEip7702 extends EthereumTransactionData{constructor(e){super(e),this.chainId=e.chainId,this.nonce=e.nonce,this.maxPriorityGas=e.maxPriorityGas,this.maxGas=e.maxGas,this.gasLimit=e.gasLimit,this.to=e.to,this.value=e.value,this.callData=e.callData,this.authorizationList=e.authorizationList,this.accessList=e.accessList,this.recId=e.recId,this.r=e.r,this.s=e.s}static fromBytes(e){if(0===e.length)throw new Error("empty bytes");const t=decodeRlp(e.subarray(1));if(!Array.isArray(t))throw new Error("ethereum data is not a list");if(13!==t.length)throw new Error("invalid ethereum transaction data");if(!Array.isArray(t[9]))throw new Error("authorization list must be an array");const n=t[9].map(e=>{if(!Array.isArray(e)||6!==e.length)throw new Error("invalid authorization list entry: must be [chainId, contractAddress, nonce, yParity, r, s]");return[decode$7(e[0]),decode$7(e[1]),decode$7(e[2]),decode$7(e[3]),decode$7(e[4]),decode$7(e[5])]});return new EthereumTransactionDataEip7702({chainId:decode$7(t[0]),nonce:decode$7(t[1]),maxPriorityGas:decode$7(t[2]),maxGas:decode$7(t[3]),gasLimit:decode$7(t[4]),to:decode$7(t[5]),value:decode$7(t[6]),callData:decode$7(t[7]),accessList:t[8].map(e=>{if(!Array.isArray(e)||2!==e.length)throw new Error("invalid access list entry: must be [address, storageKeys[]]");return[decode$7(e[0]),e[1].map(e=>decode$7(e))]}),authorizationList:n,recId:decode$7(t[10]),r:decode$7(t[11]),s:decode$7(t[12])})}toBytes(){return decode$7("04"+encodeRlp([this.chainId,this.nonce,this.maxPriorityGas,this.maxGas,this.gasLimit,this.to,this.value,this.callData,this.accessList,this.authorizationList,this.recId,this.r,this.s]).substring(2))}toString(){return JSON.stringify(this.toJSON(),null,2)}toJSON(){return{chainId:encode$4(this.chainId),nonce:encode$4(this.nonce),maxPriorityGas:encode$4(this.maxPriorityGas),maxGas:encode$4(this.maxGas),gasLimit:encode$4(this.gasLimit),to:encode$4(this.to),value:encode$4(this.value),callData:encode$4(this.callData),authorizationList:this.authorizationList.map(([e,t,n,r,o,a])=>[encode$4(e),encode$4(t),encode$4(n),encode$4(r),encode$4(o),encode$4(a)]),accessList:this.accessList.map(([e,t])=>({address:encode$4(e),storageKeys:t.map(e=>encode$4(e))})),recId:encode$4(this.recId),r:encode$4(this.r),s:encode$4(this.s)}}}CACHE.setEthereumTransactionDataEip7702FromBytes(e=>EthereumTransactionDataEip7702.fromBytes(e));class EthereumFlow{constructor(e={}){this._ethereumData=null,this._callDataFileId=null,this._maxGasAllowance=null,null!=e.ethereumData&&this.setEthereumData(e.ethereumData),null!=e.maxGasAllowance&&this.setMaxGasAllowanceHbar(e.maxGasAllowance),this._maxChunks=null}get maxChunks(){return this._maxChunks}setMaxChunks(e){return this._maxChunks=e,this}get ethereumData(){return this._ethereumData}setEthereumData(e){return this._ethereumData=e instanceof Uint8Array?EthereumTransactionData.fromBytes(e):e,this}get maxGasAllowance(){return this._maxGasAllowance}setMaxGasAllowance(e){return this.setMaxGasAllowanceHbar(e)}setMaxGasAllowanceHbar(e){return this._maxGasAllowance=e instanceof Hbar?e:new Hbar(e),this}async execute(e){if(null==this._ethereumData)throw new Error("cannot submit ethereum transaction with no ethereum data");const t=new EthereumTransaction,n=this._ethereumData.toBytes();if(null!=this._maxGasAllowance&&t.setMaxGasAllowanceHbar(this._maxGasAllowance),null!=this._callDataFileId){if(0===this._ethereumData.callData.length)throw new Error("call data file ID provided, but ethereum data already contains call data");t.setEthereumData(n).setCallDataFileId(this._callDataFileId)}else if(n.length<=128e3)t.setEthereumData(n);else{const n=await createFile(this._ethereumData.callData,e,this._maxChunks);this._ethereumData.callData=new Uint8Array,t.setEthereumData(this._ethereumData.toBytes()).setCallDataFileId(n)}return t.execute(e)}}async function createFile(e,t,n){const r=encode$4(e),o=(await(await(new FileCreateTransaction).setContents(r.substring(0,4096)).setKeys(t.operatorPublicKey?[t.operatorPublicKey]:[]).execute(t)).getReceipt(t)).fileId;if(e.length>4096){let e=(new FileAppendTransaction).setFileId(o).setContents(r.substring(4096,r.length));null!=n&&e.setMaxChunks(n),await(await e.execute(t)).getReceipt(t)}return o}const{proto:proto$3}=HieroProto;class ExchangeRates{constructor(e){this.currentRate=e.currentRate,this.nextRate=e.nextRate,Object.freeze(this)}static _fromProtobuf(e){return new ExchangeRates({currentRate:ExchangeRate._fromProtobuf(e.currentRate),nextRate:ExchangeRate._fromProtobuf(e.nextRate)})}_toProtobuf(){return{currentRate:this.currentRate._toProtobuf(),nextRate:this.nextRate._toProtobuf()}}static fromBytes(e){return ExchangeRates._fromProtobuf(proto$3.ExchangeRateSet.decode(e))}}class FeeComponents{constructor(e={}){this.min=e.min,this.max=e.max,this.constant=e.constant,this.transactionBandwidthByte=e.transactionBandwidthByte,this.transactionVerification=e.transactionVerification,this.transactionRamByteHour=e.transactionRamByteHour,this.transactionStorageByteHour=e.transactionStorageByteHour,this.contractTransactionGas=e.contractTransactionGas,this.transferVolumeHbar=e.transferVolumeHbar,this.responseMemoryByte=e.responseMemoryByte,this.responseDiskByte=e.responseDiskByte}static fromBytes(e){return FeeComponents._fromProtobuf(libExports.proto.FeeComponents.decode(e))}static _fromProtobuf(e){return new FeeComponents({min:null!=e.min?e.min:void 0,max:null!=e.max?e.max:void 0,constant:null!=e.constant?e.constant:void 0,transactionBandwidthByte:null!=e.bpt?e.bpt:void 0,transactionVerification:null!=e.vpt?e.vpt:void 0,transactionRamByteHour:null!=e.rbh?e.rbh:void 0,transactionStorageByteHour:null!=e.sbh?e.sbh:void 0,contractTransactionGas:null!=e.gas?e.gas:void 0,transferVolumeHbar:null!=e.tv?e.tv:void 0,responseMemoryByte:null!=e.bpr?e.bpr:void 0,responseDiskByte:null!=e.sbpr?e.sbpr:void 0})}_toProtobuf(){return{min:null!=this.min?this.min:void 0,max:null!=this.max?this.max:void 0,constant:null!=this.constant?this.constant:void 0,bpt:null!=this.transactionBandwidthByte?this.transactionBandwidthByte:void 0,vpt:null!=this.transactionVerification?this.transactionVerification:void 0,rbh:null!=this.transactionRamByteHour?this.transactionRamByteHour:void 0,sbh:null!=this.transactionStorageByteHour?this.transactionStorageByteHour:void 0,gas:null!=this.contractTransactionGas?this.contractTransactionGas:void 0,tv:null!=this.transferVolumeHbar?this.transferVolumeHbar:void 0,bpr:null!=this.responseMemoryByte?this.responseMemoryByte:void 0,sbpr:null!=this.responseDiskByte?this.responseDiskByte:void 0}}toBytes(){return libExports.proto.FeeComponents.encode(this._toProtobuf()).finish()}}class FeeDataType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case FeeDataType.Default:return"DEFAULT";case FeeDataType.TokenFungibleCommon:return"TOKEN_FUNGIBLE_COMMON";case FeeDataType.TokenNonFungibleUnique:return"TOKEN_NON_FUNGIBLE_UNIQUE";case FeeDataType.TokenFungibleCommonWithCustomFees:return"TOKEN_FUNGIBLE_COMMON_WITH_CUSTOM_FEES";case FeeDataType.TokenNonFungibleUniqueWithCustomFees:return"TOKEN_NON_FUNGIBLE_UNIQUE_WITH_CUSTOM_FEES";case FeeDataType.ScheduleCreateContractCall:return"SCHEDULE_CREATE_CONTRACT_CALL";case FeeDataType.TopicCreateWithCustomFees:return"TOPIC_CREATE_WITH_CUSTOM_FEES";case FeeDataType.SubmitMessageWithCustomFees:return"SUBMIT_MESSAGE_WITH_CUSTOM_FEES";case FeeDataType.CryptoTransferWithHooks:return"CRYPTO_TRANSFER_WITH_HOOKS";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return FeeDataType.Default;case 1:return FeeDataType.TokenFungibleCommon;case 2:return FeeDataType.TokenNonFungibleUnique;case 3:return FeeDataType.TokenFungibleCommonWithCustomFees;case 4:return FeeDataType.TokenNonFungibleUniqueWithCustomFees;case 5:return FeeDataType.ScheduleCreateContractCall;case 6:return FeeDataType.TopicCreateWithCustomFees;case 7:return FeeDataType.SubmitMessageWithCustomFees;case 8:return FeeDataType.CryptoTransferWithHooks}throw new Error(`(BUG) SubType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}FeeDataType.Default=new FeeDataType(0),FeeDataType.TokenFungibleCommon=new FeeDataType(1),FeeDataType.TokenNonFungibleUnique=new FeeDataType(2),FeeDataType.TokenFungibleCommonWithCustomFees=new FeeDataType(3),FeeDataType.TokenNonFungibleUniqueWithCustomFees=new FeeDataType(4),FeeDataType.ScheduleCreateContractCall=new FeeDataType(5),FeeDataType.TopicCreateWithCustomFees=new FeeDataType(6),FeeDataType.SubmitMessageWithCustomFees=new FeeDataType(7),FeeDataType.CryptoTransferWithHooks=new FeeDataType(8);class FeeData{constructor(e={}){this.nodedata=e.nodedata,this.networkdata=e.networkdata,this.servicedata=e.servicedata,this.feeDataType=e.feeDataType}static fromBytes(e){return FeeData._fromProtobuf(libExports.proto.FeeData.decode(e))}static _fromProtobuf(e){return new FeeData({nodedata:null!=e.nodedata?FeeComponents._fromProtobuf(e.nodedata):void 0,networkdata:null!=e.networkdata?FeeComponents._fromProtobuf(e.networkdata):void 0,servicedata:null!=e.servicedata?FeeComponents._fromProtobuf(e.servicedata):void 0,feeDataType:null!=e.subType?FeeDataType._fromCode(e.subType):void 0})}_toProtobuf(){return{nodedata:null!=this.nodedata?this.nodedata._toProtobuf():void 0,networkdata:null!=this.networkdata?this.networkdata._toProtobuf():void 0,servicedata:null!=this.servicedata?this.servicedata._toProtobuf():void 0,subType:null!=this.feeDataType?this.feeDataType.valueOf():void 0}}toBytes(){return libExports.proto.FeeData.encode(this._toProtobuf()).finish()}}class RequestType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case RequestType.None:return"NONE";case RequestType.CryptoTransfer:return"CryptoTransfer";case RequestType.CryptoUpdate:return"CryptoUpdate";case RequestType.CryptoDelete:return"CryptoDelete";case RequestType.CryptoAddLiveHash:return"CryptoAddLiveHash";case RequestType.CryptoDeleteLiveHash:return"CryptoDeleteLiveHash";case RequestType.ContractCall:return"ContractCall";case RequestType.ContractCreate:return"ContractCreate";case RequestType.ContractUpdate:return"ContractUpdate";case RequestType.FileCreate:return"FileCreate";case RequestType.FileAppend:return"FileAppend";case RequestType.FileUpdate:return"FileUpdate";case RequestType.FileDelete:return"FileDelete";case RequestType.CryptoGetAccountBalance:return"CryptoGetAccountBalance";case RequestType.CryptoGetAccountRecords:return"CryptoGetAccountRecords";case RequestType.CryptoGetInfo:return"CryptoGetInfo";case RequestType.ContractCallLocal:return"ContractCallLocal";case RequestType.ContractGetInfo:return"ContractGetInfo";case RequestType.ContractGetBytecode:return"ContractGetBytecode";case RequestType.GetBySolidityID:return"GetBySolidityID";case RequestType.GetByKey:return"GetByKey";case RequestType.CryptoGetLiveHash:return"CryptoGetLiveHash";case RequestType.CryptoGetStakers:return"CryptoGetStakers";case RequestType.FileGetContents:return"FileGetContents";case RequestType.FileGetInfo:return"FileGetInfo";case RequestType.TransactionGetRecord:return"TransactionGetRecord";case RequestType.ContractGetRecords:return"ContractGetRecords";case RequestType.CryptoCreate:return"CryptoCreate";case RequestType.SystemDelete:return"SystemDelete";case RequestType.SystemUndelete:return"SystemUndelete";case RequestType.ContractDelete:return"ContractDelete";case RequestType.Freeze:return"Freeze";case RequestType.CreateTransactionRecord:return"CreateTransactionRecord";case RequestType.CryptoAccountAutoRenew:return"CryptoAccountAutoRenew";case RequestType.ContractAutoRenew:return"ContractAutoRenew";case RequestType.GetVersionInfo:return"GetVersionInfo";case RequestType.TransactionGetReceipt:return"TransactionGetReceipt";case RequestType.ConsensusCreateTopic:return"ConsensusCreateTopic";case RequestType.ConsensusUpdateTopic:return"ConsensusUpdateTopic";case RequestType.ConsensusDeleteTopic:return"ConsensusDeleteTopic";case RequestType.ConsensusGetTopicInfo:return"ConsensusGetTopicInfo";case RequestType.ConsensusSubmitMessage:return"ConsensusSubmitMessage";case RequestType.UncheckedSubmit:return"UncheckedSubmit";case RequestType.TokenCreate:return"TokenCreate";case RequestType.TokenGetInfo:return"TokenGetInfo";case RequestType.TokenFreezeAccount:return"TokenFreezeAccount";case RequestType.TokenUnfreezeAccount:return"TokenUnfreezeAccount";case RequestType.TokenGrantKycToAccount:return"TokenGrantKycToAccount";case RequestType.TokenRevokeKycFromAccount:return"TokenRevokeKycFromAccount";case RequestType.TokenDelete:return"TokenDelete";case RequestType.TokenUpdate:return"TokenUpdate";case RequestType.TokenMint:return"TokenMint";case RequestType.TokenBurn:return"TokenBurn";case RequestType.TokenAccountWipe:return"TokenAccountWipe";case RequestType.TokenAssociateToAccount:return"TokenAssociateToAccount";case RequestType.TokenDissociateFromAccount:return"TokenDissociateFromAccount";case RequestType.ScheduleCreate:return"ScheduleCreate";case RequestType.ScheduleDelete:return"ScheduleDelete";case RequestType.ScheduleSign:return"ScheduleSign";case RequestType.ScheduleGetInfo:return"ScheduleGetInfo";case RequestType.TokenGetAccountNftInfos:return"TokenGetAccountNftInfos";case RequestType.TokenGetNftInfo:return"TokenGetNftInfo";case RequestType.TokenGetNftInfos:return"TokenGetNftInfos";case RequestType.TokenFeeScheduleUpdate:return"TokenFeeScheduleUpdate";case RequestType.NetworkGetExecutionTime:return"NetworkGetExecutionTime";case RequestType.TokenPause:return"TokenPause";case RequestType.TokenUnpause:return"TokenUnpause";case RequestType.CryptoApproveAllowance:return"CryptoApproveAllowance";case RequestType.CryptoDeleteAllowance:return"CryptoDeleteAllowance";case RequestType.GetAccountDetails:return"GetAccountDetails";case RequestType.EthereumTransaction:return"EthereumTransaction";case RequestType.NodeStakeUpdate:return"NodeStakeUpdate";case RequestType.Prng:return"UtilPrng";case RequestType.TransactionGetFastRecord:return"TransactionGetFastRecord";case RequestType.TokenUpdateNfts:return"TokenUpdateNfts";case RequestType.NodeCreate:return"NodeCreate";case RequestType.NodeUpdate:return"NodeUpdate";case RequestType.NodeDelete:return"NodeDelete";case RequestType.TokenReject:return"TokenReject";case RequestType.TokenAirdrop:return"TokenAirdrop";case RequestType.TokenCancelAirdrop:return"TokenCancelAirdrop";case RequestType.TokenClaimAirdrop:return"TokenClaimAirdrop";case RequestType.TssMessage:return"TssMessage";case RequestType.TssVote:return"TssVote";case RequestType.TssShareSignature:return"TssShareSignature";case RequestType.TssEncryptionKey:return"TssEncryptionKey";case RequestType.StateSignatureTransaction:return"StateSignatureTransaction";case RequestType.HistoryAssemblySignature:return"HistoryAssemblySignature";case RequestType.HistoryProofKeyPublication:return"HistoryProofKeyPublication";case RequestType.HistoryProofVote:return"HistoryProofVote";case RequestType.HintsKeyPublication:return"HintsKeyPublication";case RequestType.HintsPreprocessingVote:return"HintsPreprocessingVote";case RequestType.HintsPartialSignature:return"HintsPartialSignature";case RequestType.CrsPublication:return"CrsPublication";case RequestType.AtomicBatch:return"AtomicBatch";case RequestType.LambdaSStore:return"LambdaSStore";case RequestType.HookDispatch:return"HookDispatch";case RequestType.HookStore:return"HookStore";case RequestType.LedgerIdPublication:return"LedgerIdPublication";case RequestType.RegisteredNodeCreate:return"RegisteredNodeCreate";case RequestType.RegisteredNodeUpdate:return"RegisteredNodeUpdate";case RequestType.RegisteredNodeDelete:return"RegisteredNodeDelete";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return RequestType.None;case 1:return RequestType.CryptoTransfer;case 2:return RequestType.CryptoUpdate;case 3:return RequestType.CryptoDelete;case 4:return RequestType.CryptoAddLiveHash;case 5:return RequestType.CryptoDeleteLiveHash;case 6:return RequestType.ContractCall;case 7:return RequestType.ContractCreate;case 8:return RequestType.ContractUpdate;case 9:return RequestType.FileCreate;case 10:return RequestType.FileAppend;case 11:return RequestType.FileUpdate;case 12:return RequestType.FileDelete;case 13:return RequestType.CryptoGetAccountBalance;case 14:return RequestType.CryptoGetAccountRecords;case 15:return RequestType.CryptoGetInfo;case 16:return RequestType.ContractCallLocal;case 17:return RequestType.ContractGetInfo;case 18:return RequestType.ContractGetBytecode;case 19:return RequestType.GetBySolidityID;case 20:return RequestType.GetByKey;case 21:return RequestType.CryptoGetLiveHash;case 22:return RequestType.CryptoGetStakers;case 23:return RequestType.FileGetContents;case 24:return RequestType.FileGetInfo;case 25:return RequestType.TransactionGetRecord;case 26:return RequestType.ContractGetRecords;case 27:return RequestType.CryptoCreate;case 28:return RequestType.SystemDelete;case 29:return RequestType.SystemUndelete;case 30:return RequestType.ContractDelete;case 31:return RequestType.Freeze;case 32:return RequestType.CreateTransactionRecord;case 33:return RequestType.CryptoAccountAutoRenew;case 34:return RequestType.ContractAutoRenew;case 35:return RequestType.GetVersionInfo;case 36:return RequestType.TransactionGetReceipt;case 50:return RequestType.ConsensusCreateTopic;case 51:return RequestType.ConsensusUpdateTopic;case 52:return RequestType.ConsensusDeleteTopic;case 53:return RequestType.ConsensusGetTopicInfo;case 54:return RequestType.ConsensusSubmitMessage;case 55:return RequestType.UncheckedSubmit;case 56:return RequestType.TokenCreate;case 58:return RequestType.TokenGetInfo;case 59:return RequestType.TokenFreezeAccount;case 60:return RequestType.TokenUnfreezeAccount;case 61:return RequestType.TokenGrantKycToAccount;case 62:return RequestType.TokenRevokeKycFromAccount;case 63:return RequestType.TokenDelete;case 64:return RequestType.TokenUpdate;case 65:return RequestType.TokenMint;case 66:return RequestType.TokenBurn;case 67:return RequestType.TokenAccountWipe;case 68:return RequestType.TokenAssociateToAccount;case 69:return RequestType.TokenDissociateFromAccount;case 70:return RequestType.ScheduleCreate;case 71:return RequestType.ScheduleDelete;case 72:return RequestType.ScheduleSign;case 73:return RequestType.ScheduleGetInfo;case 74:return RequestType.TokenGetAccountNftInfos;case 75:return RequestType.TokenGetNftInfo;case 76:return RequestType.TokenGetNftInfos;case 77:return RequestType.TokenFeeScheduleUpdate;case 78:return RequestType.NetworkGetExecutionTime;case 79:return RequestType.TokenPause;case 80:return RequestType.TokenUnpause;case 81:return RequestType.CryptoApproveAllowance;case 82:return RequestType.CryptoDeleteAllowance;case 83:return RequestType.GetAccountDetails;case 84:return RequestType.EthereumTransaction;case 85:return RequestType.NodeStakeUpdate;case 86:return RequestType.Prng;case 87:return RequestType.TransactionGetFastRecord;case 88:return RequestType.TokenUpdateNfts;case 89:return RequestType.NodeCreate;case 90:return RequestType.NodeUpdate;case 91:return RequestType.NodeDelete;case 92:return RequestType.TokenReject;case 93:return RequestType.TokenAirdrop;case 94:return RequestType.TokenCancelAirdrop;case 95:return RequestType.TokenClaimAirdrop;case 96:return RequestType.TssMessage;case 97:return RequestType.TssVote;case 98:return RequestType.TssShareSignature;case 99:return RequestType.TssEncryptionKey;case 100:return RequestType.StateSignatureTransaction;case 101:return RequestType.HintsKeyPublication;case 102:return RequestType.HintsPreprocessingVote;case 103:return RequestType.HintsPartialSignature;case 104:return RequestType.HistoryAssemblySignature;case 105:return RequestType.HistoryProofKeyPublication;case 106:return RequestType.HistoryProofVote;case 107:return RequestType.CrsPublication;case 108:return RequestType.AtomicBatch;case 109:return RequestType.LambdaSStore;case 110:return RequestType.HookDispatch;case 111:return RequestType.HookStore;case 112:return RequestType.LedgerIdPublication;case 113:return RequestType.RegisteredNodeCreate;case 114:return RequestType.RegisteredNodeUpdate;case 115:return RequestType.RegisteredNodeDelete}throw new Error(`(BUG) RequestType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}RequestType.None=new RequestType(0),RequestType.CryptoTransfer=new RequestType(1),RequestType.CryptoUpdate=new RequestType(2),RequestType.CryptoDelete=new RequestType(3),RequestType.CryptoAddLiveHash=new RequestType(4),RequestType.CryptoDeleteLiveHash=new RequestType(5),RequestType.ContractCall=new RequestType(6),RequestType.ContractCreate=new RequestType(7),RequestType.ContractUpdate=new RequestType(8),RequestType.FileCreate=new RequestType(9),RequestType.FileAppend=new RequestType(10),RequestType.FileUpdate=new RequestType(11),RequestType.FileDelete=new RequestType(12),RequestType.CryptoGetAccountBalance=new RequestType(13),RequestType.CryptoGetAccountRecords=new RequestType(14),RequestType.CryptoGetInfo=new RequestType(15),RequestType.ContractCallLocal=new RequestType(16),RequestType.ContractGetInfo=new RequestType(17),RequestType.ContractGetBytecode=new RequestType(18),RequestType.GetBySolidityID=new RequestType(19),RequestType.GetByKey=new RequestType(20),RequestType.CryptoGetLiveHash=new RequestType(21),RequestType.CryptoGetStakers=new RequestType(22),RequestType.FileGetContents=new RequestType(23),RequestType.FileGetInfo=new RequestType(24),RequestType.TransactionGetRecord=new RequestType(25),RequestType.ContractGetRecords=new RequestType(26),RequestType.CryptoCreate=new RequestType(27),RequestType.SystemDelete=new RequestType(28),RequestType.SystemUndelete=new RequestType(29),RequestType.ContractDelete=new RequestType(30),RequestType.Freeze=new RequestType(31),RequestType.CreateTransactionRecord=new RequestType(32),RequestType.CryptoAccountAutoRenew=new RequestType(33),RequestType.ContractAutoRenew=new RequestType(34),RequestType.GetVersionInfo=new RequestType(35),RequestType.TransactionGetReceipt=new RequestType(36),RequestType.ConsensusCreateTopic=new RequestType(50),RequestType.ConsensusUpdateTopic=new RequestType(51),RequestType.ConsensusDeleteTopic=new RequestType(52),RequestType.ConsensusGetTopicInfo=new RequestType(53),RequestType.ConsensusSubmitMessage=new RequestType(54),RequestType.UncheckedSubmit=new RequestType(55),RequestType.TokenCreate=new RequestType(56),RequestType.TokenGetInfo=new RequestType(58),RequestType.TokenFreezeAccount=new RequestType(59),RequestType.TokenUnfreezeAccount=new RequestType(60),RequestType.TokenGrantKycToAccount=new RequestType(61),RequestType.TokenRevokeKycFromAccount=new RequestType(62),RequestType.TokenDelete=new RequestType(63),RequestType.TokenUpdate=new RequestType(64),RequestType.TokenMint=new RequestType(65),RequestType.TokenBurn=new RequestType(66),RequestType.TokenAccountWipe=new RequestType(67),RequestType.TokenAssociateToAccount=new RequestType(68),RequestType.TokenDissociateFromAccount=new RequestType(69),RequestType.ScheduleCreate=new RequestType(70),RequestType.ScheduleDelete=new RequestType(71),RequestType.ScheduleSign=new RequestType(72),RequestType.ScheduleGetInfo=new RequestType(73),RequestType.TokenGetAccountNftInfos=new RequestType(74),RequestType.TokenGetNftInfo=new RequestType(75),RequestType.TokenGetNftInfos=new RequestType(76),RequestType.TokenFeeScheduleUpdate=new RequestType(77),RequestType.NetworkGetExecutionTime=new RequestType(78),RequestType.TokenPause=new RequestType(79),RequestType.TokenUnpause=new RequestType(80),RequestType.CryptoApproveAllowance=new RequestType(81),RequestType.CryptoDeleteAllowance=new RequestType(82),RequestType.GetAccountDetails=new RequestType(83),RequestType.EthereumTransaction=new RequestType(84),RequestType.NodeStakeUpdate=new RequestType(85),RequestType.Prng=new RequestType(86),RequestType.TransactionGetFastRecord=new RequestType(87),RequestType.TokenUpdateNfts=new RequestType(88),RequestType.NodeCreate=new RequestType(89),RequestType.NodeUpdate=new RequestType(90),RequestType.NodeDelete=new RequestType(91),RequestType.TokenReject=new RequestType(92),RequestType.TokenAirdrop=new RequestType(93),RequestType.TokenCancelAirdrop=new RequestType(94),RequestType.TokenClaimAirdrop=new RequestType(95),RequestType.TssMessage=new RequestType(96),RequestType.TssVote=new RequestType(97),RequestType.TssShareSignature=new RequestType(98),RequestType.TssEncryptionKey=new RequestType(99),RequestType.StateSignatureTransaction=new RequestType(100),RequestType.HintsKeyPublication=new RequestType(101),RequestType.HintsPreprocessingVote=new RequestType(102),RequestType.HintsPartialSignature=new RequestType(103),RequestType.HistoryAssemblySignature=new RequestType(104),RequestType.HistoryProofKeyPublication=new RequestType(105),RequestType.HistoryProofVote=new RequestType(106),RequestType.CrsPublication=new RequestType(107),RequestType.HistoryAssemblySignature=new RequestType(104),RequestType.HistoryProofKeyPublication=new RequestType(105),RequestType.HistoryProofVote=new RequestType(106),RequestType.AtomicBatch=new RequestType(108),RequestType.LambdaSStore=new RequestType(109),RequestType.HookDispatch=new RequestType(110),RequestType.HookStore=new RequestType(111),RequestType.LedgerIdPublication=new RequestType(112),RequestType.RegisteredNodeCreate=new RequestType(113),RequestType.RegisteredNodeUpdate=new RequestType(114),RequestType.RegisteredNodeDelete=new RequestType(115);class TransactionFeeSchedule{constructor(e={}){this.hederaFunctionality=e.hederaFunctionality,this.feeData=e.feeData,this.fees=e.fees}static fromBytes(e){return TransactionFeeSchedule._fromProtobuf(libExports.proto.TransactionFeeSchedule.decode(e))}static _fromProtobuf(e){return new TransactionFeeSchedule({hederaFunctionality:null!=e.hederaFunctionality?RequestType._fromCode(e.hederaFunctionality):void 0,feeData:null!=e.feeData?FeeData._fromProtobuf(e.feeData):void 0,fees:null!=e.fees?e.fees.map(e=>FeeData._fromProtobuf(e)):void 0})}_toProtobuf(){return{hederaFunctionality:null!=this.hederaFunctionality?this.hederaFunctionality.valueOf():void 0,feeData:null!=this.feeData?this.feeData._toProtobuf():void 0,fees:null!=this.fees?this.fees.map(e=>e._toProtobuf()):void 0}}toBytes(){return libExports.proto.TransactionFeeSchedule.encode(this._toProtobuf()).finish()}}class FeeSchedule{constructor(e={}){this.transactionFeeSchedule=e.transactionFeeSchedule,this.expirationTime=e.expirationTime}static fromBytes(e){return FeeSchedule._fromProtobuf(libExports.proto.FeeSchedule.decode(e))}static _fromProtobuf(e){return new FeeSchedule({transactionFeeSchedule:null!=e.transactionFeeSchedule?e.transactionFeeSchedule.map(e=>TransactionFeeSchedule._fromProtobuf(e)):void 0,expirationTime:null!=e.expiryTime?Timestamp._fromProtobuf(e.expiryTime):void 0})}_toProtobuf(){return{transactionFeeSchedule:null!=this.transactionFeeSchedule?this.transactionFeeSchedule.map(e=>e._toProtobuf()):void 0,expiryTime:null!=this.expirationTime?this.expirationTime._toProtobuf():void 0}}toBytes(){return libExports.proto.FeeSchedule.encode(this._toProtobuf()).finish()}}class FeeSchedules{constructor(e={}){this.current=e.currentFeeSchedule,this.next=e.nextFeeSchedule}static fromBytes(e){return FeeSchedules._fromProtobuf(libExports.proto.CurrentAndNextFeeSchedule.decode(e))}static _fromProtobuf(e){return new FeeSchedules({currentFeeSchedule:null!=e.currentFeeSchedule?FeeSchedule._fromProtobuf(e.currentFeeSchedule):void 0,nextFeeSchedule:null!=e.nextFeeSchedule?FeeSchedule._fromProtobuf(e.nextFeeSchedule):void 0})}_toProtobuf(){return{currentFeeSchedule:null!=this.current?this.current._toProtobuf():void 0,nextFeeSchedule:null!=this.next?this.next._toProtobuf():void 0}}toBytes(){return libExports.proto.CurrentAndNextFeeSchedule.encode(this._toProtobuf()).finish()}}class HookExtensionPoint{constructor(){}static get ACCOUNT_ALLOWANCE_HOOK(){return 0}}class HookCreationDetails{constructor(e={}){this._extensionPoint=null,this._hookId=null,this._evmHook=null,this._adminKey=null,null!=e.extensionPoint&&this.setExtensionPoint(e.extensionPoint),null!=e.hookId&&this.setHookId(e.hookId),null!=e.evmHook&&this.setEvmHook(e.evmHook),null!=e.adminKey&&this.setAdminKey(e.adminKey)}setExtensionPoint(e){return this._extensionPoint=e,this}setHookId(e){return this._hookId=e instanceof Long?e:Long.fromNumber(e),this}setEvmHook(e){return this._evmHook=e,this}setAdminKey(e){return this._adminKey=e,this}get extensionPoint(){return this._extensionPoint}get hookId(){return this._hookId}get evmHook(){return this._evmHook}get adminKey(){return this._adminKey}_toProtobuf(){if(null==this._extensionPoint)throw new Error("extensionPoint is required for HookCreationDetails");return{extensionPoint:this._extensionPoint,hookId:this._hookId,evmHook:null!=this._evmHook?this._evmHook._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null}}}class EvmHook{constructor(e={}){this._contractId=null,this._storageUpdates=[],null!=e.storageUpdates&&this.setStorageUpdates(e.storageUpdates),null!=e.contractId&&this.setContractId(e.contractId)}setContractId(e){return this._contractId=e,this}setStorageUpdates(e){return this._storageUpdates=e,this}get storageUpdates(){return this._storageUpdates}get contractId(){return this._contractId}_toProtobuf(){return{spec:{contractId:this._contractId?._toProtobuf()},storageUpdates:this._storageUpdates.map(e=>e._toProtobuf())}}}class HookEntityId{constructor(e={}){this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId)}setAccountId(e){return this._accountId=e,this}get accountId(){return this._accountId}_toProtobuf(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null}}static _fromProtobuf(e){return new HookEntityId({accountId:null!=e.accountId?AccountId._fromProtobuf(e.accountId):void 0})}}class HookId{constructor(e={}){this._entityId=null,this._hookId=null,null!=e.entityId&&this.setEntityId(e.entityId),null!=e.hookId&&this.setHookId(e.hookId)}setEntityId(e){return this._entityId=e,this}setHookId(e){return this._hookId=e,this}get entityId(){return this._entityId}get hookId(){return this._hookId}static _fromProtobuf(e){return new HookId({entityId:null!=e.entityId?HookEntityId._fromProtobuf(e.entityId):void 0,hookId:null!=e.hookId?e.hookId:void 0})}_toProtobuf(){return{entityId:null!=this._entityId?this._entityId._toProtobuf():null,hookId:this._hookId}}}class EvmHookMappingEntry{constructor(e={}){this._key=null,this._value=null,this._preimage=null,null!=e.preimage&&this.setPreimage(e.preimage),null!=e.key&&this.setKey(e.key),null!=e.value&&this.setValue(e.value)}setKey(e){return this._key=e,this._preimage=null,this}setValue(e){return this._value=e,this}setPreimage(e){return this._preimage=e,this._key=null,this}get key(){return this._key}get value(){return this._value}get preimage(){return this._preimage}static _fromProtobuf(e){return new EvmHookMappingEntry({key:null!=e.key?e.key:void 0,value:null!=e.value?e.value:void 0,preimage:null!=e.preimage?e.preimage:void 0})}_toProtobuf(){return{key:this._key,value:this._value,preimage:this._preimage}}}class EvmHookStorageUpdate{static _fromProtobuf(e){if(null!=e.storageSlot)return EvmHookStorageSlot._fromProtobuf(e);if(null!=e.mappingEntries)return EvmHookMappingEntries._fromProtobuf(e);throw new Error("EvmHookStorageUpdate must have either storage_slot or mapping_entries set")}_toProtobuf(){throw new Error("EvmHookStorageUpdate._toProtobuf must be implemented by a subclass")}}class EvmHookStorageSlot extends EvmHookStorageUpdate{constructor(e={}){super(),this._key=null,this._value=null,null!=e.key&&this.setKey(e.key),null!=e.value&&this.setValue(e.value)}setKey(e){return this._key=e,this}setValue(e){return this._value=e,this}get key(){return this._key}get value(){return this._value}static _fromProtobuf(e){if(null!=e.storageSlot)return new EvmHookStorageSlot({key:null!=e.storageSlot.key?e.storageSlot.key:void 0,value:null!=e.storageSlot.value?e.storageSlot.value:void 0});throw new Error("EvmHookStorageSlot._fromProtobuf must be implemented by a subclass")}_toProtobuf(){return{storageSlot:{key:this._key,value:this._value}}}}class EvmHookMappingEntries extends EvmHookStorageUpdate{constructor(e={}){super(),this._mappingSlot=null,this._entries=null,null!=e.mappingSlot&&this.setMappingSlot(e.mappingSlot),null!=e.entries&&this.setEntries(e.entries)}setMappingSlot(e){return this._mappingSlot=e,this}setEntries(e){return this._entries=e,this}get mappingSlot(){return this._mappingSlot}get entries(){return this._entries}static _fromProtobuf(e){return new EvmHookMappingEntries({mappingSlot:null!=e.mappingEntries?.mappingSlot?e.mappingEntries.mappingSlot:void 0,entries:e.mappingEntries?.entries?.map(e=>EvmHookMappingEntry._fromProtobuf(e))})}_toProtobuf(){return{mappingEntries:{mappingSlot:this._mappingSlot,entries:null!=this._entries?this._entries.map(e=>e._toProtobuf()):null}}}}class HookStoreTransaction extends Transaction{constructor(e={}){super(),this._hookId=null,this._storageUpdates=[],null!=e.hookId&&this.setHookId(e.hookId),null!=e.storageUpdates&&this.setStorageUpdates(e.storageUpdates)}get hookId(){return this._hookId}setHookId(e){return this._requireNotFrozen(),this._hookId=e,this}get storageUpdates(){return this._storageUpdates}setStorageUpdates(e){return this._requireNotFrozen(),this._storageUpdates=e,this}addStorageUpdate(e){return this._requireNotFrozen(),this._storageUpdates.push(e),this}_makeTransactionData(){return{hookId:this.hookId?._toProtobuf(),storageUpdates:this.storageUpdates?.map(e=>e._toProtobuf())}}_execute(e,t){return e.smartContract.hookStore(t)}_getTransactionDataCase(){return"hookStore"}_getLogId(){return`HookStoreTransaction:${this._transactionIds.current.validStart.toString()}`}static _fromProtobuf(e,t,n,r,o){const a=o[0].hookStore;return Transaction._fromProtobufTransactions(new HookStoreTransaction({hookId:null!=a.hookId?HookId._fromProtobuf(a.hookId):void 0,storageUpdates:null!=a.storageUpdates?a.storageUpdates.map(e=>EvmHookStorageUpdate._fromProtobuf(e)):void 0}),e,t,n,r,o)}}TRANSACTION_REGISTRY.set("hookStore",HookStoreTransaction._fromProtobuf);class FileContentsQuery extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e){const t=e.fileGetContents;return new FileContentsQuery({fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):void 0})}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.getFileContent(t)}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}_mapResponseHeader(e){return e.fileGetContents.header}_mapResponse(e){const t=e.fileGetContents.fileContents.contents;return Promise.resolve(t)}_onMakeRequest(e){return{fileGetContents:{header:e,fileID:null!=this._fileId?this._fileId._toProtobuf():null}}}_getLogId(){return`FileContentsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("fileGetContents",FileContentsQuery._fromProtobuf);const{proto:proto$2}=HieroProto;class FileInfo{constructor(e){this.fileId=e.fileId,this.size=e.size,this.expirationTime=e.expirationTime,this.isDeleted=e.isDeleted,this.keys=e.keys,this.fileMemo=e.fileMemo,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(e){const t=e.size;return new FileInfo({fileId:FileId._fromProtobuf(e.fileID),size:t instanceof Long?t:Long.fromValue(t),expirationTime:Timestamp._fromProtobuf(e.expirationTime),isDeleted:e.deleted,keys:null!=e.keys?KeyList.__fromProtobufKeyList(e.keys):new KeyList,fileMemo:null!=e.memo?e.memo:"",ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null})}_toProtobuf(){return{fileID:this.fileId._toProtobuf(),size:this.size,expirationTime:this.expirationTime._toProtobuf(),deleted:this.isDeleted,keys:this.keys._toProtobufKey().keyList,memo:this.fileMemo,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null}}static fromBytes(e){return FileInfo._fromProtobuf(libExports.proto.FileGetInfoResponse.FileInfo.decode(e))}toBytes(){return proto$2.FileGetInfoResponse.FileInfo.encode(this._toProtobuf()).finish()}}class FileInfoQuery extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId)}static _fromProtobuf(e){const t=e.fileGetInfo;return new FileInfoQuery({fileId:null!=t.fileID?FileId._fromProtobuf(t.fileID):void 0})}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.getFileInfo(t)}_mapResponseHeader(e){return e.fileGetInfo.header}_mapResponse(e,t,n){const r=e.fileGetInfo;return Promise.resolve(FileInfo._fromProtobuf(r.fileInfo))}_onMakeRequest(e){return{fileGetInfo:{header:e,fileID:null!=this._fileId?this._fileId._toProtobuf():null}}}_getLogId(){return`FileInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("fileGetInfo",FileInfoQuery._fromProtobuf);class FileUpdateTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._keys=null,this._expirationTime=null,this._contents=null,this._fileMemo=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.keys&&this.setKeys(e.keys),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.contents&&this.setContents(e.contents),e.fileMemo&&null!=e.fileMemo&&this.setFileMemo(e.fileMemo)}static _fromProtobuf(e,t,n,r,o){const a=o[0].fileUpdate;return Transaction._fromProtobufTransactions(new FileUpdateTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,keys:null!=a.keys&&null!=a.keys.keys?a.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0,contents:null!=a.contents?a.contents:void 0,fileMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get keys(){return this._keys}setKeys(e){if(this._requireNotFrozen(),e instanceof KeyList&&null!=e.threshold)throw new Error("Cannot set threshold key as file key");return this._keys=e instanceof KeyList?e.toArray():e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get contents(){return this._contents}setContents(e){return this._requireNotFrozen(),this._contents=e instanceof Uint8Array?e:encode(e),this}get fileMemo(){return this._fileMemo}setFileMemo(e){return this._requireNotFrozen(),this._fileMemo=e,this}clearFileMemo(){return this._requireNotFrozen(),this._fileMemo=null,this}_validateChecksums(e){null!=this._fileId&&this._fileId.validateChecksum(e)}_execute(e,t){return e.file.updateFile(t)}_getTransactionDataCase(){return"fileUpdate"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null,contents:this._contents,memo:null!=this._fileMemo?{value:this._fileMemo}:null}}_getLogId(){return`FileUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("fileUpdate",FileUpdateTransaction._fromProtobuf);class LiveHashAddTransaction extends Transaction{constructor(e={}){super(),this._hash=null,this._keys=null,this._duration=null,this._accountId=null,null!=e.hash&&this.setHash(e.hash),null!=e.keys&&this.setKeys(e.keys),null!=e.duration&&this.setDuration(e.duration),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoAddLiveHash.liveHash;return Transaction._fromProtobufTransactions(new LiveHashAddTransaction({hash:null!=a.hash?a.hash:void 0,keys:null!=a.keys&&null!=a.keys.keys?a.keys.keys.map(e=>Key._fromProtobufKey(e)):void 0,duration:null!=a.duration&&null!=a.duration.seconds?a.duration.seconds:void 0,accountId:null!=a.accountId?AccountId._fromProtobuf(a.accountId):void 0}),e,t,n,r,o)}get hash(){return this._hash}setHash(e){return this._requireNotFrozen(),this._hash=e,this}get keys(){return this._keys}setKeys(e){return this._requireNotFrozen(),this._keys=e instanceof KeyList?e.toArray():e,this}get duration(){return this._duration}setDuration(e){return this._requireNotFrozen(),this._duration=e instanceof Duration?e:new Duration(e),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.addLiveHash(t)}_getTransactionDataCase(){return"cryptoAddLiveHash"}_makeTransactionData(){return{liveHash:{hash:this._hash,keys:null!=this._keys?{keys:this._keys.map(e=>e._toProtobufKey())}:void 0,duration:null!=this._duration?this._duration._toProtobuf():null,accountId:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`LiveHashAddTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoAddLiveHash",LiveHashAddTransaction._fromProtobuf);class LiveHashDeleteTransaction extends Transaction{constructor(e={}){super(),this._hash=null,this._accountId=null,null!=e.hash&&this.setHash(e.hash),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoDeleteLiveHash;return Transaction._fromProtobufTransactions(new LiveHashDeleteTransaction({hash:null!=a.liveHashToDelete?a.liveHashToDelete:void 0,accountId:null!=a.accountOfLiveHash?AccountId._fromProtobuf(a.accountOfLiveHash):void 0}),e,t,n,r,o)}get hash(){return this._hash}setHash(e){return this._requireNotFrozen(),this._hash=e,this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.deleteLiveHash(t)}_getTransactionDataCase(){return"cryptoDeleteLiveHash"}_makeTransactionData(){return{liveHashToDelete:this._hash,accountOfLiveHash:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`LiveHashDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoDeleteLiveHash",LiveHashDeleteTransaction._fromProtobuf);class LiveHashQuery extends Query{constructor(e={}){super(),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._hash=null,null!=e.hash&&this.setHash(e.hash)}static _fromProtobuf(e){const t=e.cryptoGetLiveHash;return new LiveHashQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,hash:null!=t.hash?t.hash:void 0})}get accountId(){return this._accountId}setAccountId(e){return this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get liveHash(){return this._hash}setHash(e){return this._hash=e,this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.crypto.getLiveHash(t)}_mapResponseHeader(e){return e.cryptoGetLiveHash.header}_mapResponse(e){const t=e.cryptoGetLiveHash;return Promise.resolve(LiveHash._fromProtobuf(t.liveHash))}_onMakeRequest(e){return{cryptoGetLiveHash:{header:e,accountID:null!=this._accountId?this._accountId._toProtobuf():null,hash:this._hash}}}_getLogId(){return`LiveHashQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("cryptoGetLiveHash",LiveHashQuery._fromProtobuf);class MirrorNodeContractQuery{constructor(){this._contractId=null,this._contractEvmAddress=null,this._sender=null,this._senderEvmAddress=null,this._functionName=null,this._functionParameters=null,this._value=null,this._gasLimit=null,this._gasPrice=null,this._blockNumber=null}setContractId(e){return this._contractId=e,this}setSender(e){return this._sender=e,this}setSenderEvmAddress(e){return this._senderEvmAddress=e,this}setFunction(e,t){return this._functionParameters=null!=t?t._build(e):(new ContractFunctionParameters)._build(e),this}setValue(e){return this._value=e,this}setGasLimit(e){return this._gasLimit=e,this}setGasPrice(e){return this._gasPrice=e,this}setBlockNumber(e){return this._blockNumber=e,this}get contractId(){return this._contractId}get contractEvmAddress(){const e=this._contractId?.toEvmAddress();if(null==e)throw new Error("Contract ID is not set");return e}get sender(){return this._sender}get senderEvmAddress(){return this._senderEvmAddress}get callData(){return this._functionParameters}get value(){return this._value}get gasLimit(){return this._gasLimit}get gasPrice(){return this._gasPrice}get blockNumber(){return this._blockNumber}async performMirrorNodeRequest(e,t){if(null==this.contractId)throw new Error("Contract ID is not set");this._fillEvmAddress();let n=e.mirrorRestApiBaseUrl;const r=e._mirrorNetwork.getNextMirrorNode().address.address;if("localhost"===r||"127.0.0.1"===r){const e=new URL(n);e.protocol="http:",e.port="8545",n=e.toString()}const o=`${n}/contracts/call`,a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return await a.json()}_fillEvmAddress(){null==this.senderEvmAddress&&null!=this.sender&&(this._senderEvmAddress=this.sender.toEvmAddress())}get JSONPayload(){throw new Error("JSONPayload getter is not implemented. Please implement this method in the subclass.")}}class MirrorNodeContractCallQuery extends MirrorNodeContractQuery{get JSONPayload(){if(null==this.callData)throw new Error("Call data is required.");return{data:encode$4(this.callData),from:this.senderEvmAddress,to:this.contractEvmAddress,estimate:!1,gasPrice:this.gasPrice?.toString(),gas:this.gasLimit?.toString(),blockNumber:this.blockNumber?.toString(),value:this.value?.toString()}}async execute(e){return(await this.performMirrorNodeRequest(e,this.JSONPayload)).result}}class MirrorNodeContractEstimateQuery extends MirrorNodeContractQuery{get JSONPayload(){if(null==this.callData)throw new Error("Call data is required.");return{data:encode$4(this.callData),from:this.senderEvmAddress,to:this.contractEvmAddress,estimate:!0,gasPrice:this.gasPrice?.toString(),gas:this.gasLimit?.toString(),blockNumber:this.blockNumber?.toString(),value:this.value?.toString()}}async execute(e){const t=await this.performMirrorNodeRequest(e,this.JSONPayload);return Number(t.result)}}class IPv4AddressPart{constructor(e={}){this._left=null,null!=e.left&&this.setLeft(e.left),this._right=null,null!=e.right&&this.setRight(e.right)}get left(){return this._left}setLeft(e){return this._left=e,this}get right(){return this._right}setRight(e){return this._right=e,this}toString(){return null!=this._left&&null!=this._right?`${this._left.toString()}.${this._right.toString()}`:""}}class IPv4Address{constructor(e={}){this._network=null,null!=e.network&&this.setNetwork(e.network),this._host=null,null!=e.host&&this.setHost(e.host)}get newtork(){return this._network}setNetwork(e){return this._network=e,this}get host(){return this._host}setHost(e){return this._host=e,this}static _fromProtobuf(e){return new IPv4Address({network:(new IPv4AddressPart).setLeft(e[0]).setRight(e[1]),host:(new IPv4AddressPart).setLeft(e[2]).setRight(e[3])})}_toProtobuf(){return Uint8Array.of(null!=this._network&&null!=this._network._left?this._network._left:0,null!=this._network&&null!=this._network.right?this._network.right:0,null!=this._host&&null!=this._host.left?this._host.left:0,null!=this._host&&null!=this._host.right?this._host.right:0)}static _fromString(e){const t=e.split(".");if(4!==t.length)throw new Error("Invalid IPv4 address format");const n=(new IPv4AddressPart).setLeft(Number(t[0])).setRight(Number(t[1])),r=(new IPv4AddressPart).setLeft(Number(t[2])).setRight(Number(t[3]));return new IPv4Address({network:n,host:r})}toString(){return null!=this._network&&null!=this._host?`${this._network.toString()}.${this._host.toString()}`:""}}class EndPoint{constructor(e={}){this._address=null,null!=e.address&&this.setAddress(e.address),this._port=null,null!=e.port&&this.setPort(e.port)}get address(){return this._address}setAddress(e){return this._address=e,this}get port(){return this._port}setPort(e){return this._port=e,this}static _fromProtobuf(e){let t;return e.domainName?t=e.domainName:e.ipAddressV4&&(t=IPv4Address._fromProtobuf(e.ipAddressV4)),new EndPoint({address:t,port:null!=e.port?e.port:void 0})}_toProtobuf(){return"string"!=typeof this._address?{ipAddressV4:null!=this._address?this._address._toProtobuf():null,port:this._port}:{domainName:this._address,port:this._port}}static fromJSON(e){return new EndPoint({address:e.address||void 0,port:null!=e.port?parseInt(e.port,10):void 0})}toString(){return`${null!=this._address?this._address.toString():""}:${null!=this._port?this._port.toString():""}`}toJSON(){return{address:null!=this._address?this._address.toString():null,port:null!=this._port?this._port.toString():null}}}class NodeAddress{constructor(e={}){this._publicKey=null,null!=e.publicKey&&this.setPublicKey(e.publicKey),this._nodeId=null,null!=e.nodeId&&this.setNodeId(e.nodeId),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._certHash=null,null!=e.certHash&&this.setCertHash(e.certHash),this._addresses=[],null!=e.addresses&&this.setAddresses(e.addresses),this._description=null,null!=e.description&&this.setDescription(e.description),this._stake=null,null!=e.stake&&this.setStake(e.stake)}get publicKey(){return this._publicKey}setPublicKey(e){return this._publicKey=e,this}get nodeId(){return this._nodeId}setNodeId(e){return this._nodeId=e,this}get accountId(){return this._accountId}setAccountId(e){return this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get certHash(){return this._certHash}setCertHash(e){return this._certHash=e,this}get addresses(){return this._addresses}setAddresses(e){return this._addresses=e,this}get description(){return this._description}setDescription(e){return this._description=e,this}get stake(){return this._stake}setStake(e){return this._stake=e,this}static _fromProtobuf(e){return new NodeAddress({publicKey:null!=e.RSA_PubKey?e.RSA_PubKey:void 0,nodeId:null!=e.nodeId?e.nodeId:void 0,accountId:null!=e.nodeAccountId?AccountId._fromProtobuf(e.nodeAccountId):void 0,certHash:null!=e.nodeCertHash?e.nodeCertHash:void 0,addresses:null!=e.serviceEndpoint?e.serviceEndpoint.map(e=>EndPoint._fromProtobuf(e)):void 0,description:null!=e.description?e.description:void 0,stake:null!=e.stake?e.stake:void 0})}_toProtobuf(){return{RSA_PubKey:this._publicKey,nodeId:this._nodeId,nodeAccountId:null!=this._accountId?this._accountId._toProtobuf():null,nodeCertHash:this._certHash,serviceEndpoint:this._addresses.map(e=>e._toProtobuf()),description:this._description,stake:this._stake}}static fromJSON(e){return new NodeAddress({publicKey:e.publicKey??void 0,nodeId:null!=e.nodeId?Long.fromString(e.nodeId):void 0,accountId:e.accountId?AccountId.fromString(e.accountId):void 0,certHash:null!=e.certHash?encode(e.certHash):void 0,addresses:null!=e.addresses?e.addresses.map(e=>EndPoint.fromJSON(e)):void 0,description:e.description??void 0,stake:null!=e.stake?Long.fromString(e.stake):void 0})}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{publicKey:this._publicKey,nodeId:null!=this._nodeId?this._nodeId.toString():null,accountId:null!=this._accountId?this._accountId.toString():null,certHash:null!=this._certHash?decode(this._certHash):null,addresses:this._addresses.map(e=>e.toJSON()),description:this._description,stake:null!=this._stake?this._stake.toString():null}}}class NodeAddressBook{constructor(e={}){this._nodeAddresses=[],null!=e.nodeAddresses&&this.setNodeAddresses(e.nodeAddresses)}get nodeAddresses(){return this._nodeAddresses}setNodeAddresses(e){return this._nodeAddresses=e,this}static fromBytes(e){return NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(e))}static _fromProtobuf(e){return new NodeAddressBook({nodeAddresses:null!=e.nodeAddress?e.nodeAddress.map(e=>NodeAddress._fromProtobuf(e)):void 0})}_toProtobuf(){return{nodeAddress:this._nodeAddresses.map(e=>e._toProtobuf())}}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{nodeAddresses:this._nodeAddresses.map(e=>e.toJSON())}}toBytes(){return libExports.proto.NodeAddressBook.encode(this._toProtobuf()).finish()}}class SemanticVersion{constructor(e){this.major=e.major,this.minor=e.minor,this.patch=e.patch,Object.freeze(this)}static _fromProtobuf(e){return new SemanticVersion({major:e.major,minor:e.minor,patch:e.patch})}_toProtobuf(){return{major:this.major,minor:this.minor,patch:this.patch}}static fromBytes(e){return SemanticVersion._fromProtobuf(libExports.proto.SemanticVersion.decode(e))}toBytes(){return libExports.proto.SemanticVersion.encode(this._toProtobuf()).finish()}}class NetworkVersionInfo{constructor(e){this.protobufVersion=e.protobufVersion,this.servicesVersion=e.servicesVersion,Object.freeze(this)}static _fromProtobuf(e){return new NetworkVersionInfo({protobufVersion:SemanticVersion._fromProtobuf(e.hapiProtoVersion),servicesVersion:SemanticVersion._fromProtobuf(e.hederaServicesVersion)})}_toProtobuf(){return{hapiProtoVersion:this.protobufVersion._toProtobuf(),hederaServicesVersion:this.servicesVersion._toProtobuf()}}static fromBytes(e){return NetworkVersionInfo._fromProtobuf(libExports.proto.NetworkGetVersionInfoResponse.decode(e))}toBytes(){return libExports.proto.NetworkGetVersionInfoResponse.encode(this._toProtobuf()).finish()}}class NetworkVersionInfoQuery extends Query{constructor(){super()}static _fromProtobuf(e){return new NetworkVersionInfoQuery}_execute(e,t){return e.network.getVersionInfo(t)}_mapResponseHeader(e){return e.networkGetVersionInfo.header}_mapResponse(e){const t=e.networkGetVersionInfo;return Promise.resolve(NetworkVersionInfo._fromProtobuf(t))}_onMakeRequest(e){return{networkGetVersionInfo:{header:e}}}_getLogId(){return`NetworkVersionInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("networkGetVersionInfo",NetworkVersionInfoQuery._fromProtobuf);var Provider={};class PrngTransaction extends Transaction{constructor(e={}){super(),this._range=null,null!=e.range&&this.setRange(e.range)}setRange(e){return this._range=e,this}get range(){return this._range}_validateChecksums(e){null!=this._range&&isNumber(this._range)&&this._validateChecksums(e)}_execute(e,t){return e.util.prng(t)}static _fromProtobuf(e,t,n,r,o){const a=o[0].utilPrng;return Transaction._fromProtobufTransactions(new PrngTransaction({range:a.range}),e,t,n,r,o)}_getTransactionDataCase(){return"utilPrng"}_makeTransactionData(){return{range:this.range}}_getLogId(){return`RandomGenerate:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("utilPrng",PrngTransaction._fromProtobuf);class ProxyStaker{constructor(e){this.accountId=e.accountId,this.amount=e.amount instanceof Hbar?e.amount:new Hbar(e.amount),Object.freeze(this)}static _fromProtobuf(e){return new ProxyStaker({accountId:AccountId._fromProtobuf(e.accountID),amount:Hbar.fromTinybars(null!=e.amount?e.amount:0)})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),amount:this.amount.toTinybars()}}}class ScheduleCreateTransaction extends Transaction{constructor(e={}){super(),this._adminKey=null,this._scheduledTransaction=null,this._payerAccountId=null,this._scheduleMemo=null,this._scheduledSignerPublicKeys=new Set,this._expirationTime=null,this._waitForExpiry=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.payerAccountID&&this.setPayerAccountId(e.payerAccountID),null!=e.scheduleMemo&&this.setScheduleMemo(e.scheduleMemo),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const a=o[0],i=a.scheduleCreate,s=new ScheduleCreateTransaction({adminKey:null!=i.adminKey?Key._fromProtobufKey(i.adminKey):void 0,payerAccountID:null!=i.payerAccountID?AccountId._fromProtobuf(i.payerAccountID):void 0,scheduleMemo:null!=i.memo?i.memo:void 0,waitForExpiry:null!=i.waitForExpiry?i.waitForExpiry:void 0,expirationTime:null!=i.expirationTime?Timestamp._fromProtobuf(i.expirationTime):void 0});if(null!=a.scheduleCreate){const e=a.scheduleCreate.scheduledTransactionBody,t=libExports.proto.TransactionBody.encode(e).finish(),n={signedTransactionBytes:libExports.proto.SignedTransaction.encode({bodyBytes:t}).finish()},r=libExports.proto.TransactionList.encode({transactionList:[n]}).finish(),o=Transaction.fromBytes(r);s._setScheduledTransaction(o)}return Transaction._fromProtobufTransactions(s,e,t,n,r,o)}_setScheduledTransaction(e){return this._scheduledTransaction=e,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get payerAccountId(){return this._payerAccountId}setPayerAccountId(e){return this._requireNotFrozen(),this._payerAccountId=e,this}setScheduleMemo(e){return this._requireNotFrozen(),this._scheduleMemo=e,this}get getScheduleMemo(){return this._requireNotFrozen(),this._scheduleMemo}setScheduledTransaction(e){return this._requireNotFrozen(),e._requireNotFrozen(),this._scheduledTransaction=e.schedule()._scheduledTransaction,this}_validateChecksums(e){null!=this._payerAccountId&&this._payerAccountId.validateChecksum(e)}_execute(e,t){return e.schedule.createSchedule(t)}_getTransactionDataCase(){return"scheduleCreate"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,payerAccountID:null!=this._payerAccountId?this._payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this._scheduledTransaction?this._scheduledTransaction._getScheduledTransactionBody():null,memo:this._scheduleMemo,waitForExpiry:this._waitForExpiry,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`ScheduleCreateTransaction:${this._transactionIds.current.validStart.toString()}`}setExpirationTime(e){return this._expirationTime=e,this}get expirationTime(){return this._requireNotFrozen(),this._expirationTime}setWaitForExpiry(e){return this._waitForExpiry=e,this}get waitForExpiry(){return this._requireNotFrozen(),this._waitForExpiry}}TRANSACTION_REGISTRY.set("scheduleCreate",ScheduleCreateTransaction._fromProtobuf),SCHEDULE_CREATE_TRANSACTION.push(()=>new ScheduleCreateTransaction);class ScheduleDeleteTransaction extends Transaction{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const a=o[0].scheduleDelete;return Transaction._fromProtobufTransactions(new ScheduleDeleteTransaction({scheduleId:null!=a.scheduleID?ScheduleId._fromProtobuf(a.scheduleID):void 0}),e,t,n,r,o)}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._requireNotFrozen(),this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.deleteSchedule(t)}_getTransactionDataCase(){return"scheduleDelete"}_makeTransactionData(){return{scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}_getLogId(){return`ScheduleDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("scheduleDelete",ScheduleDeleteTransaction._fromProtobuf);const{proto:proto$1}=HieroProto;class ScheduleInfo{constructor(e){this.scheduleId=e.scheduleId,this.creatorAccountId=e.creatorAccountID,this.payerAccountId=e.payerAccountID,this.schedulableTransactionBody=e.schedulableTransactionBody,this.signers=e.signers,this.scheduleMemo=e.scheduleMemo,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.executed=e.executed,this.deleted=e.deleted,this.scheduledTransactionId=e.scheduledTransactionId,this.waitForExpiry=e.waitForExpiry,Object.freeze(this)}static _fromProtobuf(e){return new ScheduleInfo({scheduleId:ScheduleId._fromProtobuf(e.scheduleID),creatorAccountID:null!=e.creatorAccountID?AccountId._fromProtobuf(e.creatorAccountID):null,payerAccountID:null!=e.payerAccountID?AccountId._fromProtobuf(e.payerAccountID):null,schedulableTransactionBody:null!=e.scheduledTransactionBody?e.scheduledTransactionBody:null,adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,signers:null!=e.signers?KeyList.__fromProtobufKeyList(e.signers):null,scheduleMemo:null!=e.memo?e.memo:null,expirationTime:null!=e.expirationTime?Timestamp._fromProtobuf(e.expirationTime):null,executed:null!=e.executionTime?Timestamp._fromProtobuf(e.executionTime):null,deleted:null!=e.deletionTime?Timestamp._fromProtobuf(e.deletionTime):null,scheduledTransactionId:null!=e.scheduledTransactionID?TransactionId._fromProtobuf(e.scheduledTransactionID):null,waitForExpiry:null!=e.waitForExpiry&&e.waitForExpiry})}_toProtobuf(){return{scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,creatorAccountID:null!=this.creatorAccountId?this.creatorAccountId._toProtobuf():null,payerAccountID:null!=this.payerAccountId?this.payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this.schedulableTransactionBody?this.schedulableTransactionBody:null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,signers:null!=this.signers?this.signers._toProtobufKey().keyList:null,memo:null!=this.scheduleMemo?this.scheduleMemo:"",expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,waitForExpiry:this.waitForExpiry}}get scheduledTransaction(){if(null==this.schedulableTransactionBody)throw new Error("Scheduled transaction body is empty");const e=new proto$1.SchedulableTransactionBody(this.schedulableTransactionBody),t=e.data;return Transaction.fromBytes(proto$1.TransactionList.encode({transactionList:[{signedTransactionBytes:proto$1.SignedTransaction.encode({bodyBytes:proto$1.TransactionBody.encode({transactionFee:this.schedulableTransactionBody.transactionFee,memo:this.schedulableTransactionBody.memo,[t]:e[t]}).finish()}).finish()}]}).finish())}}class ScheduleInfoQuery extends Query{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId)}static _fromProtobuf(e){const t=e.scheduleGetInfo;return new ScheduleInfoQuery({scheduleId:null!=t.scheduleID?ScheduleId._fromProtobuf(t.scheduleID):void 0})}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.getScheduleInfo(t)}_mapResponseHeader(e){return e.scheduleGetInfo.header}_mapResponse(e,t,n){const r=e.scheduleGetInfo;return Promise.resolve(ScheduleInfo._fromProtobuf(r.scheduleInfo))}_onMakeRequest(e){return{scheduleGetInfo:{header:e,scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}}_getLogId(){return`ScheduleInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("scheduleGetInfo",ScheduleInfoQuery._fromProtobuf);class ScheduleSignTransaction extends Transaction{constructor(e={}){super(),this._scheduleId=null,null!=e.scheduleId&&this.setScheduleId(e.scheduleId),this._defaultMaxTransactionFee=new Hbar(5)}static _fromProtobuf(e,t,n,r,o){const a=o[0].scheduleSign;return Transaction._fromProtobufTransactions(new ScheduleSignTransaction({scheduleId:null!=a.scheduleID?ScheduleId._fromProtobuf(a.scheduleID):void 0}),e,t,n,r,o)}get scheduleId(){return this._scheduleId}setScheduleId(e){return this._requireNotFrozen(),this._scheduleId="string"==typeof e?ScheduleId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._scheduleId&&this._scheduleId.validateChecksum(e)}_execute(e,t){return e.schedule.signSchedule(t)}_getTransactionDataCase(){return"scheduleSign"}_makeTransactionData(){return{scheduleID:null!=this._scheduleId?this._scheduleId._toProtobuf():null}}_getLogId(){return`ScheduleSignTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("scheduleSign",ScheduleSignTransaction._fromProtobuf);var Signer={};class SignerSignature{constructor(e){this.publicKey=e.publicKey,this.signature=e.signature,this.accountId=e.accountId}}class SubscriptionHandle{constructor(){this._call=null,this._unsubscribed=!1}_setCall(e){this._call=e}unsubscribe(){null!=this._call&&(this._unsubscribed=!0,this._call())}}class SystemDeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contractId=null,this._expirationTime=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.contractId&&this.setContractId(e.contractId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(e,t,n,r,o){const a=o[0].systemDelete;return Transaction._fromProtobufTransactions(new SystemDeleteTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e instanceof FileId?e:FileId.fromString(e),this}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId=e instanceof ContractId?e:ContractId.fromString(e),this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e,this}_execute(e,t){return null!=this._fileId?e.file.systemDelete(t):e.smartContract.systemDelete(t)}_getTransactionDataCase(){return"systemDelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`SystemDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("systemDelete",SystemDeleteTransaction._fromProtobuf);class SystemUndeleteTransaction extends Transaction{constructor(e={}){super(),this._fileId=null,this._contractId=null,null!=e.fileId&&this.setFileId(e.fileId),null!=e.contractId&&this.setContractId(e.contractId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].systemUndelete;return Transaction._fromProtobufTransactions(new SystemUndeleteTransaction({fileId:null!=a.fileID?FileId._fromProtobuf(a.fileID):void 0,contractId:null!=a.contractID?ContractId._fromProtobuf(a.contractID):void 0}),e,t,n,r,o)}get fileId(){return this._fileId}setFileId(e){return this._requireNotFrozen(),this._fileId=e instanceof FileId?e:FileId.fromString(e),this}get contractId(){return this._contractId}setContractId(e){return this._requireNotFrozen(),this._contractId=e instanceof ContractId?e:ContractId.fromString(e),this}_execute(e,t){return null!=this._fileId?e.file.systemUndelete(t):e.smartContract.systemUndelete(t)}_getTransactionDataCase(){return"systemUndelete"}_makeTransactionData(){return{fileID:null!=this._fileId?this._fileId._toProtobuf():null,contractID:null!=this._contractId?this._contractId._toProtobuf():null}}_getLogId(){return`SystemUndeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("systemUndelete",SystemUndeleteTransaction._fromProtobuf);class TokenAssociateTransaction extends Transaction{constructor(e={}){super(),this._tokenIds=null,this._accountId=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenAssociate;return Transaction._fromProtobufTransactions(new TokenAssociateTransaction({tokenIds:null!=a.tokens?a.tokens.map(e=>TokenId._fromProtobuf(e)):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e.map(e=>"string"==typeof e?TokenId.fromString(e):e.clone()),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e);for(const t of null!=this._tokenIds?this._tokenIds:[])null!=t&&t.validateChecksum(e)}_execute(e,t){return e.token.associateTokens(t)}_getTransactionDataCase(){return"tokenAssociate"}_makeTransactionData(){return{tokens:null!=this._tokenIds?this._tokenIds.map(e=>e._toProtobuf()):null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenAssociateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenAssociate",TokenAssociateTransaction._fromProtobuf);class TokenBurnTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._amount=null,this._serials=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.amount&&this.setAmount(e.amount),null!=e.serials&&this.setSerials(e.serials)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenBurn;return Transaction._fromProtobufTransactions(new TokenBurnTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,amount:null!=a.amount?a.amount:void 0,serials:null!=a.serialNumbers?a.serialNumbers:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}get serials(){return this._serials}setSerials(e){return this._requireNotFrozen(),this._serials=e.map(e=>e instanceof Long?e:Long.fromValue(e)),this}_execute(e,t){return e.token.burnToken(t)}_getTransactionDataCase(){return"tokenBurn"}_makeTransactionData(){return{amount:this._amount,serialNumbers:this._serials,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenBurnTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenBurn",TokenBurnTransaction._fromProtobuf);class TokenReference{constructor(){this.fungibleToken=null,this.nft=null}static _fromProtobuf(e){return{fungibleToken:null!=e.fungibleToken?TokenId._fromProtobuf(e.fungibleToken):null,nft:null!=e.nft?NftId._fromProtobuf(e.nft):null}}}class TokenRejectTransaction extends Transaction{constructor(e={}){super(),this._owner=null,null!=e.owner&&this.setOwnerId(e.owner),this._tokenIds=[],this._nftIds=[],null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.nftIds&&this.setNftIds(e.nftIds)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenReject,i=a.rejections?.map(e=>TokenReference._fromProtobuf(e)),s=i?.filter(e=>e.fungibleToken).map(({fungibleToken:e})=>{if(null==e)throw new Error("Fungible Token cannot be null");return e}),c=i?.filter(e=>e.nft).map(({nft:e})=>{if(null==e)throw new Error("Nft cannot be null");return e});return Transaction._fromProtobufTransactions(new TokenRejectTransaction({owner:null!=a.owner?AccountId._fromProtobuf(a.owner):void 0,tokenIds:s,nftIds:c}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e,this}addTokenId(e){return this._requireNotFrozen(),this._tokenIds?.push(e),this}get nftIds(){return this._nftIds}setNftIds(e){return this._requireNotFrozen(),this._nftIds=e,this}addNftId(e){return this._requireNotFrozen(),this._nftIds?.push(e),this}get ownerId(){return this._owner}setOwnerId(e){return this._requireNotFrozen(),this._owner=e,this}_execute(e,t){return e.token.rejectToken(t)}_getTransactionDataCase(){return"tokenReject"}_makeTransactionData(){const e=[];for(const t of this._tokenIds)e.push({fungibleToken:t._toProtobuf()});for(const t of this._nftIds)e.push({nft:t._toProtobuf()});return{owner:this.ownerId?._toProtobuf()??null,rejections:e}}_getLogId(){return`TokenRejectTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenReject",TokenRejectTransaction._fromProtobuf);class TokenDissociateTransaction extends Transaction{constructor(e={}){super(),this._tokenIds=null,this._accountId=null,this._defaultMaxTransactionFee=new Hbar(5),null!=e.tokenIds&&this.setTokenIds(e.tokenIds),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenDissociate;return Transaction._fromProtobufTransactions(new TokenDissociateTransaction({tokenIds:null!=a.tokens?a.tokens.map(e=>TokenId._fromProtobuf(e)):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenIds(){return this._tokenIds}setTokenIds(e){return this._requireNotFrozen(),this._tokenIds=e.map(e=>"string"==typeof e?TokenId.fromString(e):e.clone()),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._accountId&&this._accountId.validateChecksum(e);for(const t of null!=this._tokenIds?this._tokenIds:[])null!=t&&t.validateChecksum(e)}_execute(e,t){return e.token.dissociateTokens(t)}_getTransactionDataCase(){return"tokenDissociate"}_makeTransactionData(){return{tokens:null!=this._tokenIds?this._tokenIds.map(e=>e._toProtobuf()):null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenDissociateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenDissociate",TokenDissociateTransaction._fromProtobuf);class TokenRejectFlow{constructor(){this._ownerId=null,this._tokenIds=[],this._nftIds=[],this._freezeWithClient=null,this._signPrivateKey=null,this._signPublicKey=null,this._transactionSigner=null}setOwnerId(e){return this.requireNotFrozen(),this._ownerId=e,this}get ownerId(){return this._ownerId}setTokenIds(e){return this.requireNotFrozen(),this._tokenIds=e,this}addTokenId(e){return this.requireNotFrozen(),this._tokenIds.push(e),this}get tokenIds(){return this._tokenIds}setNftIds(e){return this.requireNotFrozen(),this._nftIds=e,this}addNftId(e){return this.requireNotFrozen(),this._nftIds.push(e),this}get nftIds(){return this._nftIds}sign(e){return this._signPrivateKey=e,this._signPublicKey=null,this._transactionSigner=null,this}signWith(e,t){return this._signPublicKey=e,this._transactionSigner=t,this._signPrivateKey=null,this}signWithOperator(e){const t=e.getOperator();if(null==t)throw new Error("Client operator must be set");return this._signPublicKey=t.publicKey,this._transactionSigner=t.transactionSigner,this._signPrivateKey=null,this}fillOutTransaction(e){this._freezeWithClient&&e.freezeWith(this._freezeWithClient),this._signPrivateKey?e.sign(this._signPrivateKey):this._signPublicKey&&this._transactionSigner&&e.signWith(this._signPublicKey,this._transactionSigner)}freezeWith(e){return this._freezeWithClient=e,this}async execute(e){const t=(new TokenRejectTransaction).setTokenIds(this.tokenIds).setNftIds(this.nftIds);this.ownerId&&t.setOwnerId(this.ownerId),this.fillOutTransaction(t);const n=this.nftIds.map(e=>e.tokenId).filter(function(e,t,n){return n.indexOf(e)===t}),r=(new TokenDissociateTransaction).setTokenIds([...this.tokenIds,...n]);null!=this.ownerId&&r.setAccountId(this.ownerId),this.fillOutTransaction(r);const o=await t.execute(e);await o.getReceipt(e);const a=await r.execute(e);return await a.getReceipt(e),o}requireNotFrozen(){if(null!=this._freezeWithClient)throw new Error("Transaction is already frozen and cannot be modified")}}class TokenType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenType.FungibleCommon:return"FUNGIBLE_COMMON";case TokenType.NonFungibleUnique:return"NON_FUNGIBLE_UNIQUE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenType.FungibleCommon;case 1:return TokenType.NonFungibleUnique}throw new Error(`(BUG) TokenType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenType.FungibleCommon=new TokenType(0),TokenType.NonFungibleUnique=new TokenType(1);class TokenSupplyType{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenSupplyType.Infinite:return"INFINITE";case TokenSupplyType.Finite:return"FINITE";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenSupplyType.Infinite;case 1:return TokenSupplyType.Finite}throw new Error(`(BUG) TokenSupplyType.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenSupplyType.Infinite=new TokenSupplyType(0),TokenSupplyType.Finite=new TokenSupplyType(1);class TokenCreateTransaction extends Transaction{constructor(e={}){super(),this._tokenName=null,this._tokenSymbol=null,this._decimals=null,this._initialSupply=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._pauseKey=null,this._wipeKey=null,this._supplyKey=null,this._feeScheduleKey=null,this._freezeDefault=null,this._autoRenewAccountId=null,this._expirationTime=new Timestamp(Math.floor(Date.now()/1e3+DEFAULT_AUTO_RENEW_PERIOD.toNumber()),0),this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._tokenMemo=null,this._customFees=[],this._tokenType=null,this._supplyType=null,this._maxSupply=null,this._defaultMaxTransactionFee=new Hbar(30),this._metadataKey=null,this._metadata=null,null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.decimals&&this.setDecimals(e.decimals),null!=e.initialSupply&&this.setInitialSupply(e.initialSupply),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.freezeDefault&&this.setFreezeDefault(e.freezeDefault),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.tokenType&&this.setTokenType(e.tokenType),null!=e.supplyType&&this.setSupplyType(e.supplyType),null!=e.maxSupply&&this.setMaxSupply(e.maxSupply),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenCreation;return Transaction._fromProtobufTransactions(new TokenCreateTransaction({tokenName:null!=a.name?a.name:void 0,tokenSymbol:null!=a.symbol?a.symbol:void 0,decimals:null!=a.decimals?a.decimals:void 0,initialSupply:null!=a.initialSupply?a.initialSupply:void 0,treasuryAccountId:null!=a.treasury?AccountId._fromProtobuf(a.treasury):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,kycKey:null!=a.kycKey?Key._fromProtobufKey(a.kycKey):void 0,freezeKey:null!=a.freezeKey?Key._fromProtobufKey(a.freezeKey):void 0,pauseKey:null!=a.pauseKey?Key._fromProtobufKey(a.pauseKey):void 0,wipeKey:null!=a.wipeKey?Key._fromProtobufKey(a.wipeKey):void 0,supplyKey:null!=a.supplyKey?Key._fromProtobufKey(a.supplyKey):void 0,feeScheduleKey:null!=a.feeScheduleKey?Key._fromProtobufKey(a.feeScheduleKey):void 0,freezeDefault:null!=a.freezeDefault?a.freezeDefault:void 0,autoRenewAccountId:null!=a.autoRenewAccount?AccountId._fromProtobuf(a.autoRenewAccount):void 0,expirationTime:null!=a.expiry?Timestamp._fromProtobuf(a.expiry):void 0,autoRenewPeriod:null!=a.autoRenewPeriod?Duration._fromProtobuf(a.autoRenewPeriod):void 0,tokenMemo:null!=a.memo?a.memo:void 0,customFees:null!=a.customFees?a.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):void 0,tokenType:null!=a.tokenType?TokenType._fromCode(a.tokenType):void 0,supplyType:null!=a.supplyType?TokenSupplyType._fromCode(a.supplyType):void 0,maxSupply:null!=a.maxSupply?a.maxSupply:void 0,metadataKey:null!=a.metadataKey?Key._fromProtobufKey(a.metadataKey):void 0,metadata:null!=a.metadata?a.metadata:void 0}),e,t,n,r,o)}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get decimals(){return this._decimals}setDecimals(e){return this._requireNotFrozen(),this._decimals=e instanceof Long?e:Long.fromValue(e),this}get initialSupply(){return this._initialSupply}setInitialSupply(e){return this._requireNotFrozen(),this._initialSupply=convertAmountToLong(e),this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId&&null!=this.autoRenewPeriod?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&null!=this.autoRenewPeriod&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get freezeDefault(){return this._freezeDefault}setFreezeDefault(e){return this._requireNotFrozen(),this._freezeDefault=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this._autoRenewPeriod=null,this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get customFees(){return this._customFees}setCustomFees(e){return this._customFees=e,this}get tokenType(){return this._tokenType}setTokenType(e){return this._tokenType=e,this}get supplyType(){return this._supplyType}setSupplyType(e){return this._supplyType=e,this}get maxSupply(){return this._maxSupply}setMaxSupply(e){return this._maxSupply=convertAmountToLong(e),this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.createToken(t)}_getTransactionDataCase(){return"tokenCreation"}_makeTransactionData(){return{name:this._tokenName,symbol:this._tokenSymbol,decimals:null!=this._decimals?this._decimals.toInt():null,initialSupply:this._initialSupply,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,freezeDefault:this._freezeDefault,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:this._tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this._tokenType?this._tokenType._code:null,supplyType:null!=this._supplyType?this._supplyType._code:null,maxSupply:this.maxSupply,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?this._metadata:void 0}}_getLogId(){return`TokenCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenCreation",TokenCreateTransaction._fromProtobuf);class TokenDeleteTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenDeletion;return Transaction._fromProtobufTransactions(new TokenDeleteTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.deleteToken(t)}_getTransactionDataCase(){return"tokenDeletion"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenDeletion",TokenDeleteTransaction._fromProtobuf);class TokenFeeScheduleUpdateTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._customFees=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.customFees&&this.setCustomFees(e.customFees)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenFeeScheduleUpdate;return Transaction._fromProtobufTransactions(new TokenFeeScheduleUpdateTransaction({tokenId:null!=a.tokenId?TokenId._fromProtobuf(a.tokenId):void 0,customFees:null!=a.customFees?a.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):TokenId._fromProtobuf(e._toProtobuf()),this}get customFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}_execute(e,t){return e.token.updateTokenFeeSchedule(t)}_getTransactionDataCase(){return"tokenFeeScheduleUpdate"}_makeTransactionData(){return{tokenId:null!=this._tokenId?this._tokenId._toProtobuf():null,customFees:this._customFees.map(e=>e._toProtobuf())}}_getLogId(){return`TokenFeeScheduleUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenFeeScheduleUpdate",TokenFeeScheduleUpdateTransaction._fromProtobuf);class TokenFreezeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenFreeze;return Transaction._fromProtobufTransactions(new TokenFreezeTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.freezeTokenAccount(t)}_getTransactionDataCase(){return"tokenFreeze"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenFreezeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenFreeze",TokenFreezeTransaction._fromProtobuf);class TokenGrantKycTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenGrantKyc;return Transaction._fromProtobufTransactions(new TokenGrantKycTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.grantKycToTokenAccount(t)}_getTransactionDataCase(){return"tokenGrantKyc"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenGrantKycTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenGrantKyc",TokenGrantKycTransaction._fromProtobuf);class TokenInfo{constructor(e){this.tokenId=e.tokenId,this.name=e.name,this.symbol=e.symbol,this.decimals=e.decimals,this.totalSupply=e.totalSupply,this.treasuryAccountId=e.treasuryAccountId,this.adminKey=e.adminKey,this.kycKey=e.kycKey,this.freezeKey=e.freezeKey,this.pauseKey=e.pauseKey,this.wipeKey=e.wipeKey,this.supplyKey=e.supplyKey,this.feeScheduleKey=e.feeScheduleKey,this.defaultFreezeStatus=e.defaultFreezeStatus,this.defaultKycStatus=e.defaultKycStatus,this.pauseStatus=e.pauseStatus,this.isDeleted=e.isDeleted,this.autoRenewAccountId=e.autoRenewAccountId,this.autoRenewPeriod=e.autoRenewPeriod,this.expirationTime=e.expirationTime,this.tokenMemo=e.tokenMemo,this.customFees=e.customFees,this.tokenType=e.tokenType,this.supplyType=e.supplyType,this.maxSupply=e.maxSupply,this.ledgerId=e.ledgerId,this.metadataKey=e.metadataKey,this.metadata=e.metadata}static _fromProtobuf(e){const t=e.defaultFreezeStatus,n=e.defaultKycStatus,r=e.pauseStatus,o=null!=e.autoRenewAccount?AccountId._fromProtobuf(e.autoRenewAccount):new AccountId(0);return new TokenInfo({tokenId:TokenId._fromProtobuf(e.tokenId),name:e.name,symbol:e.symbol,decimals:e.decimals,totalSupply:Long.fromValue(e.totalSupply),treasuryAccountId:null!=e.treasury?AccountId._fromProtobuf(e.treasury):null,adminKey:null!=e.adminKey?Key._fromProtobufKey(e.adminKey):null,kycKey:null!=e.kycKey?Key._fromProtobufKey(e.kycKey):null,freezeKey:null!=e.freezeKey?Key._fromProtobufKey(e.freezeKey):null,pauseKey:null!=e.pauseKey?Key._fromProtobufKey(e.pauseKey):null,wipeKey:null!=e.wipeKey?Key._fromProtobufKey(e.wipeKey):null,supplyKey:null!=e.supplyKey?Key._fromProtobufKey(e.supplyKey):null,feeScheduleKey:null!=e.feeScheduleKey?Key._fromProtobufKey(e.feeScheduleKey):null,defaultFreezeStatus:0===t?null:1==t,defaultKycStatus:0===n?null:1==n,pauseStatus:0===r?null:1==r,isDeleted:e.deleted,autoRenewAccountId:0!=o.shard.toInt()||0!=o.realm.toInt()||0!=o.num.toInt()?o:null,autoRenewPeriod:null!=e.autoRenewPeriod?Duration._fromProtobuf(e.autoRenewPeriod):null,expirationTime:null!=e.expiry?Timestamp._fromProtobuf(e.expiry):null,tokenMemo:null!=e.memo?e.memo:"",customFees:null!=e.customFees?e.customFees.map(e=>null!=e.fixedFee?CustomFixedFee._fromProtobuf(e):null!=e.fractionalFee?CustomFractionalFee._fromProtobuf(e):CustomRoyalyFee._fromProtobuf(e)):[],tokenType:null!=e.tokenType?TokenType._fromCode(e.tokenType):null,supplyType:null!=e.supplyType?TokenSupplyType._fromCode(e.supplyType):null,maxSupply:null!=e.maxSupply?e.maxSupply:null,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,metadataKey:null!=e.metadataKey?Key._fromProtobufKey(e.metadataKey):null,metadata:null!=e.metadata?e.metadata:new Uint8Array})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),name:this.name,symbol:this.symbol,decimals:this.decimals,totalSupply:this.totalSupply,treasury:null!=this.treasuryAccountId?this.treasuryAccountId._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,kycKey:null!=this.kycKey?this.kycKey._toProtobufKey():null,freezeKey:null!=this.freezeKey?this.freezeKey._toProtobufKey():null,pauseKey:null!=this.pauseKey?this.pauseKey._toProtobufKey():null,wipeKey:null!=this.wipeKey?this.wipeKey._toProtobufKey():null,supplyKey:null!=this.supplyKey?this.supplyKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,defaultFreezeStatus:null==this.defaultFreezeStatus?0:this.defaultFreezeStatus?1:2,defaultKycStatus:null==this.defaultKycStatus?0:this.defaultKycStatus?1:2,pauseStatus:null==this.pauseStatus?0:this.pauseStatus?1:2,deleted:this.isDeleted,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():void 0,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,expiry:null!=this.expirationTime?this.expirationTime._toProtobuf():null,memo:this.tokenMemo,customFees:this.customFees.map(e=>e._toProtobuf()),tokenType:null!=this.tokenType?this.tokenType._code:null,supplyType:null!=this.supplyType?this.supplyType._code:null,maxSupply:this.maxSupply,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,metadataKey:null!=this.metadataKey?this.metadataKey._toProtobufKey():null,metadata:null!=this.metadata?this.metadata:null}}static fromBytes(e){return TokenInfo._fromProtobuf(libExports.proto.TokenInfo.decode(e))}toBytes(){return libExports.proto.TokenInfo.encode(this._toProtobuf()).finish()}}class TokenInfoQuery extends Query{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e){const t=e.tokenGetInfo;return new TokenInfoQuery({tokenId:null!=t.token?TokenId._fromProtobuf(t.token):void 0})}get tokenId(){return this._tokenId}setTokenId(e){return this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.getTokenInfo(t)}_mapResponseHeader(e){return e.tokenGetInfo.header}_mapResponse(e,t,n){const r=e.tokenGetInfo;return Promise.resolve(TokenInfo._fromProtobuf(r.tokenInfo))}_onMakeRequest(e){return{tokenGetInfo:{header:e,token:null!=this._tokenId?this._tokenId._toProtobuf():null}}}_getLogId(){return`TokenInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("tokenGetInfo",TokenInfoQuery._fromProtobuf);class TokenMintTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._amount=null,this._metadata=[],null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.amount&&this.setAmount(e.amount),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenMint;return Transaction._fromProtobufTransactions(new TokenMintTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,amount:null!=a.amount?a.amount:void 0,metadata:null!=a.metadata?a.metadata:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}get metadata(){return this._metadata}addMetadata(e){return this._requireNotFrozen(),"string"==typeof e&&console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead."),this._metadata.push("string"==typeof e?decode$7(e):e),this}setMetadata(e){this._requireNotFrozen();for(const t of e)if("string"==typeof t){console.warn("Passing a `string` for token metadata is considered a bug, and has been removed. Please provide a `Uint8Array` instead.");break}return this._metadata=e.map(e=>"string"==typeof e?decode$7(e):e),this}_execute(e,t){return e.token.mintToken(t)}_getTransactionDataCase(){return"tokenMint"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,metadata:this._metadata}}_getLogId(){return`TokenMintTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenMint",TokenMintTransaction._fromProtobuf);class TokenNftInfo{constructor(e){this.nftId=e.nftId,this.accountId=e.accountId,this.creationTime=e.creationTime,this.metadata=e.metadata,this.ledgerId=e.ledgerId,this.spenderId=e.spenderId,Object.freeze(this)}static _fromProtobuf(e){return new TokenNftInfo({nftId:NftId._fromProtobuf(e.nftID),accountId:AccountId._fromProtobuf(e.accountID),creationTime:Timestamp._fromProtobuf(e.creationTime),metadata:void 0!==e.metadata?e.metadata:null,ledgerId:null!=e.ledgerId?LedgerId.fromBytes(e.ledgerId):null,spenderId:null!=e.spenderId?AccountId._fromProtobuf(e.spenderId):null})}_toProtobuf(){return{nftID:this.nftId._toProtobuf(),accountID:this.accountId._toProtobuf(),creationTime:this.creationTime._toProtobuf(),metadata:this.metadata,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,spenderId:null!=this.spenderId?this.spenderId._toProtobuf():null}}toJson(){return{nftId:this.nftId.toString(),accountId:this.accountId.toString(),creationTime:this.creationTime.toString(),metadata:null!=this.metadata?encode$4(this.metadata):null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,spenderId:null!=this.spenderId?this.spenderId.toString():null}}toString(){return JSON.stringify(this.toJson())}}class TokenNftInfoQuery extends Query{constructor(e={}){super(),this._nftId=null,null!=e.nftId&&this.setNftId(e.nftId),this._accountId=null,null!=e.accountId&&this.setAccountId(e.accountId),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),this._start=null,null!=e.start&&this.setStart(e.start),this._end=null,null!=e.end&&this.setEnd(e.end)}static _fromProtobuf(e){if(null!=e.tokenGetNftInfo){const t=e.tokenGetNftInfo;return new TokenNftInfoQuery({nftId:null!=t.nftID?NftId._fromProtobuf(t.nftID):void 0})}if(null!=e.tokenGetAccountNftInfos){const t=e.tokenGetAccountNftInfos;return new TokenNftInfoQuery({accountId:null!=t.accountID?AccountId._fromProtobuf(t.accountID):void 0,start:null!=t.start?t.start:void 0,end:null!=t.end?t.end:void 0})}{const t=e.tokenGetNftInfos;return new TokenNftInfoQuery({tokenId:null!=t.tokenID?TokenId._fromProtobuf(t.tokenID):void 0,start:null!=t.start?t.start:void 0,end:null!=t.end?t.end:void 0})}}get nftId(){return this._nftId}setNftId(e){return this._nftId="string"==typeof e?NftId.fromString(e):NftId._fromProtobuf(e._toProtobuf()),this}get accountId(){return console.warn("`TokenNftInfoQuery.accountId` is deprecated with no replacement"),this._accountId}setAccountId(e){return console.warn("`TokenNftInfoQuery.setAccountId()` is deprecated with no replacement"),this._accountId="string"==typeof e?AccountId.fromString(e):AccountId._fromProtobuf(e._toProtobuf()),this}get tokenId(){return console.warn("`TokenNftInfoQuery.tokenId` is deprecated with no replacement"),this._tokenId}setTokenId(e){return console.warn("`TokenNftInfoQuery.setTokenId()` is deprecated with no replacement"),this._tokenId="string"==typeof e?TokenId.fromString(e):TokenId._fromProtobuf(e._toProtobuf()),this}get start(){return console.warn("`TokenNftInfoQuery.start` is deprecated with no replacement"),this._start}setStart(e){return console.warn("`TokenNftInfoQuery.setStart()` is deprecated with no replacement"),this._start="number"==typeof e?Long.fromNumber(e):e,this}get end(){return console.warn("`TokenNftInfoQuery.end` is deprecated with no replacement"),this._end}setEnd(e){return console.warn("`TokenNftInfoQuery.setEnd()` is deprecated with no replacement"),this._end="number"==typeof e?Long.fromNumber(e):e,this}async getCost(e){return super.getCost(e)}_execute(e,t){return e.token.getTokenNftInfo(t)}_mapResponseHeader(e){return e.tokenGetNftInfo.header}_mapResponse(e,t,n){const r=[e.tokenGetNftInfo.nft];return Promise.resolve(r.map(e=>TokenNftInfo._fromProtobuf(e)))}_onMakeRequest(e){return{tokenGetNftInfo:{header:e,nftID:null!=this._nftId?this._nftId._toProtobuf():null}}}_getLogId(){return`TokenNftInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("tokenGetNftInfo",TokenNftInfoQuery._fromProtobuf);class TokenPauseTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenPause;return Transaction._fromProtobufTransactions(new TokenPauseTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.pauseToken(t)}_getTransactionDataCase(){return"tokenPause"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenPauseTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenPause",TokenPauseTransaction._fromProtobuf);class TokenRevokeKycTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenRevokeKyc;return Transaction._fromProtobufTransactions(new TokenRevokeKycTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.revokeKycFromTokenAccount(t)}_getTransactionDataCase(){return"tokenRevokeKyc"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenRevokeKycTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenRevokeKyc",TokenRevokeKycTransaction._fromProtobuf);class TokenUnfreezeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenUnfreeze;return Transaction._fromProtobufTransactions(new TokenUnfreezeTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}_execute(e,t){return e.token.unfreezeTokenAccount(t)}_getTransactionDataCase(){return"tokenUnfreeze"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null}}_getLogId(){return`TokenUnfreezeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUnfreeze",TokenUnfreezeTransaction._fromProtobuf);class TokenUnpauseTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,null!=e.tokenId&&this.setTokenId(e.tokenId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenUnpause;return Transaction._fromProtobufTransactions(new TokenUnpauseTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.unpauseToken(t)}_getTransactionDataCase(){return"tokenUnpause"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null}}_getLogId(){return`TokenUnpauseTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUnpause",TokenUnpauseTransaction._fromProtobuf);class TokenKeyValidation{constructor(e){this._code=e,Object.freeze(this)}toString(){switch(this){case TokenKeyValidation.FullValidation:return"FULL_VALIDATION";case TokenKeyValidation.NoValidation:return"NO_VALIDATION";default:return`UNKNOWN (${this._code})`}}static _fromCode(e){switch(e){case 0:return TokenKeyValidation.FullValidation;case 1:return TokenKeyValidation.NoValidation}throw new Error(`(BUG) TokenKeyValidation.fromCode() does not handle code: ${e}`)}valueOf(){return this._code}}TokenKeyValidation.FullValidation=new TokenKeyValidation(0),TokenKeyValidation.NoValidation=new TokenKeyValidation(1);class TokenUpdateTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._tokenName=null,this._tokenSymbol=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._wipeKey=null,this._supplyKey=null,this._autoRenewAccountId=null,this._expirationTime=null,this._autoRenewPeriod=null,this._tokenMemo=null,this._feeScheduleKey=null,this._pauseKey=null,this._metadataKey=null,this._metadata=null,this._keyVerificationMode=TokenKeyValidation.FullValidation,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata),null!=e.keyVerificationMode&&this.setKeyVerificationMode(e.keyVerificationMode)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenUpdate;return Transaction._fromProtobufTransactions(new TokenUpdateTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,tokenName:Object.hasOwn(a,"name")?a.name:void 0,tokenSymbol:Object.hasOwn(a,"symbol")?a.symbol:void 0,treasuryAccountId:null!=a.treasury?AccountId._fromProtobuf(a.treasury):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,kycKey:null!=a.kycKey?Key._fromProtobufKey(a.kycKey):void 0,freezeKey:null!=a.freezeKey?Key._fromProtobufKey(a.freezeKey):void 0,wipeKey:null!=a.wipeKey?Key._fromProtobufKey(a.wipeKey):void 0,supplyKey:null!=a.supplyKey?Key._fromProtobufKey(a.supplyKey):void 0,autoRenewAccountId:null!=a.autoRenewAccount?AccountId._fromProtobuf(a.autoRenewAccount):void 0,expirationTime:null!=a.expiry?Timestamp._fromProtobuf(a.expiry):void 0,autoRenewPeriod:null!=a.autoRenewPeriod?Duration._fromProtobuf(a.autoRenewPeriod):void 0,tokenMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0,feeScheduleKey:null!=a.feeScheduleKey?Key._fromProtobufKey(a.feeScheduleKey):void 0,pauseKey:null!=a.pauseKey?Key._fromProtobufKey(a.pauseKey):void 0,metadataKey:null!=a.metadataKey?Key._fromProtobufKey(a.metadataKey):void 0,metadata:null!=a.metadata&&Object.hasOwn(a.metadata,"value")?a.metadata.value:void 0,keyVerificationMode:null!=a.keyVerificationMode?TokenKeyValidation._fromCode(a.keyVerificationMode):void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}setsupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Timestamp?e:Timestamp.fromDate(e),this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}get keyVerificationMode(){return this._keyVerificationMode}setKeyVerificationMode(e){return this._requireNotFrozen(),this._keyVerificationMode=e,this}clearTokenMemo(){return this._requireNotFrozen(),this._tokenMemo=null,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.updateToken(t)}_getTransactionDataCase(){return"tokenUpdate"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,name:null!=this.tokenName?this.tokenName:null,symbol:this.tokenSymbol,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:null!=this._tokenMemo?{value:this._tokenMemo}:null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?{value:this._metadata}:null,keyVerificationMode:null!=this._keyVerificationMode?this._keyVerificationMode._code:void 0}}_getLogId(){return`TokenUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUpdate",TokenUpdateTransaction._fromProtobuf);class TokenWipeTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._accountId=null,this._serials=[],this._amount=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.accountId&&this.setAccountId(e.accountId),null!=e.amount&&this.setAmount(e.amount),null!=e.serials&&this.setSerials(e.serials)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenWipe;return Transaction._fromProtobufTransactions(new TokenWipeTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,accountId:null!=a.account?AccountId._fromProtobuf(a.account):void 0,amount:null!=a.amount?a.amount:void 0,serials:null!=a.serialNumbers?a.serialNumbers:void 0}),e,t,n,r,o)}get tokenId(){return this._tokenId}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}get accountId(){return this._accountId}setAccountId(e){return this._requireNotFrozen(),this._accountId="string"==typeof e?AccountId.fromString(e):e.clone(),this}get amount(){return this._amount}setAmount(e){return this._requireNotFrozen(),this._amount=convertAmountToLong(e),this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._accountId&&this._accountId.validateChecksum(e)}get serials(){return this._serials}setSerials(e){return this._requireNotFrozen(),this._serials=e.map(e=>"number"==typeof e?Long.fromNumber(e):e),this}_execute(e,t){return e.token.wipeTokenAccount(t)}_getTransactionDataCase(){return"tokenWipe"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null,serialNumbers:this.serials}}_getLogId(){return`TokenWipeTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenWipe",TokenWipeTransaction._fromProtobuf);class TopicCreateTransaction extends Transaction{constructor(e={}){super(),this._defaultMaxTransactionFee=new Hbar(25),this._adminKey=null,this._submitKey=null,this._feeScheduleKey=null,this._feeExemptKeys=[],this._autoRenewAccountId=null,this._autoRenewPeriod=new Duration(DEFAULT_AUTO_RENEW_PERIOD),this._customFees=[],this._topicMemo=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.submitKey&&this.setSubmitKey(e.submitKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.topicMemo&&this.setTopicMemo(e.topicMemo)}static _fromProtobuf(e,t,n,r,o){const a=o[0].consensusCreateTopic;return Transaction._fromProtobufTransactions(new TopicCreateTransaction({adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,submitKey:null!=a.submitKey?Key._fromProtobufKey(a.submitKey):void 0,feeScheduleKey:null!=a.feeScheduleKey?Key._fromProtobufKey(a.feeScheduleKey):void 0,feeExemptKeys:null!=a.feeExemptKeyList?a.feeExemptKeyList.map(e=>Key._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=a.autoRenewAccount?AccountId._fromProtobuf(a.autoRenewAccount):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,customFees:null!=a.customFees?a.customFees.map(e=>CustomFixedFee._fromProtobuf(e)):void 0,topicMemo:null!=a.memo?a.memo:void 0}),e,t,n,r,o)}get topicMemo(){return this._topicMemo}getTopicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}get adminKey(){return this._adminKey}getAdminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get submitKey(){return this._submitKey}getSubmitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}getAutoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}getAutoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}_execute(e,t){return e.consensus.createTopic(t)}_getTransactionDataCase(){return"consensusCreateTopic"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:this._feeExemptKeys.map(e=>e._toProtobufKey()),autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),customFees:this._customFees.map(e=>e._toTopicFeeProtobuf()),memo:this._topicMemo}}_getLogId(){return`TopicCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusCreateTopic",TopicCreateTransaction._fromProtobuf);class TopicDeleteTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId)}static _fromProtobuf(e,t,n,r,o){const a=o[0].consensusDeleteTopic;return Transaction._fromProtobufTransactions(new TopicDeleteTransaction({topicId:null!=a.topicID?TopicId._fromProtobuf(a.topicID):void 0}),e,t,n,r,o)}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e)}_execute(e,t){return e.consensus.deleteTopic(t)}_getTransactionDataCase(){return"consensusDeleteTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null}}_getLogId(){return`TopicDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusDeleteTopic",TopicDeleteTransaction._fromProtobuf);class TopicInfo{constructor(e){this.topicId=e.topicId,this.topicMemo=e.topicMemo,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.expirationTime=e.expirationTime,this.adminKey=e.adminKey,this.submitKey=e.submitKey,this.feeScheduleKey=e.feeScheduleKey,this.feeExemptKeys=e.feeExemptKeys,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.customFees=e.customFees,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(e){const t=e.topicInfo;return new TopicInfo({topicId:TopicId._fromProtobuf(e.topicID),topicMemo:null!=t.memo?t.memo:"",runningHash:null!=t.runningHash?t.runningHash:new Uint8Array,sequenceNumber:null!=t.sequenceNumber?t.sequenceNumber instanceof Long?t.sequenceNumber:Long.fromValue(t.sequenceNumber):Long.ZERO,expirationTime:null!=t.expirationTime?Timestamp._fromProtobuf(t.expirationTime):null,adminKey:null!=t.adminKey?Key._fromProtobufKey(t.adminKey):null,submitKey:null!=t.submitKey?Key._fromProtobufKey(t.submitKey):null,feeScheduleKey:null!=t.feeScheduleKey?Key._fromProtobufKey(t.feeScheduleKey):null,feeExemptKeys:null!=t.feeExemptKeyList?t.feeExemptKeyList.map(e=>Key._fromProtobufKey(e)):null,autoRenewPeriod:null!=t.autoRenewPeriod?new Duration(t.autoRenewPeriod.seconds):null,autoRenewAccountId:null!=t.autoRenewAccount?AccountId._fromProtobuf(t.autoRenewAccount):null,customFees:null!=t.customFees?t.customFees.map(e=>CustomFixedFee._fromProtobuf(e)):null,ledgerId:null!=t.ledgerId?LedgerId.fromBytes(t.ledgerId):null})}_toProtobuf(){return{topicID:this.topicId._toProtobuf(),topicInfo:{memo:this.topicMemo,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber,expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,submitKey:null!=this.submitKey?this.submitKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this.feeExemptKeys?this.feeExemptKeys.map(e=>e._toProtobufKey()):null,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,customFees:null!=this.customFees?this.customFees.map(e=>e._toProtobuf()):null}}}static fromBytes(e){return TopicInfo._fromProtobuf(libExports.proto.ConsensusGetTopicInfoResponse.decode(e))}toBytes(){return libExports.proto.ConsensusGetTopicInfoResponse.encode(this._toProtobuf()).finish()}}class TopicInfoQuery extends Query{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId)}static _fromProtobuf(e){const t=e.consensusGetTopicInfo;return new TopicInfoQuery({topicId:null!=t.topicID?TopicId._fromProtobuf(t.topicID):void 0})}get topicId(){return this._topicId}setTopicId(e){return this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}async getCost(e){return super.getCost(e)}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e)}_execute(e,t){return e.consensus.getTopicInfo(t)}_mapResponseHeader(e){return e.consensusGetTopicInfo.header}_mapResponse(e,t,n){return Promise.resolve(TopicInfo._fromProtobuf(e.consensusGetTopicInfo))}_onMakeRequest(e){return{consensusGetTopicInfo:{header:e,topicID:null!=this._topicId?this._topicId._toProtobuf():null}}}_getLogId(){return`TopicInfoQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}QUERY_REGISTRY.set("consensusGetTopicInfo",TopicInfoQuery._fromProtobuf);class TopicMessageChunk{constructor(e){this.consensusTimestamp=e.consensusTimestamp,this.contents=e.contents,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,Object.freeze(this)}static _fromProtobuf(e){return new TopicMessageChunk({consensusTimestamp:Timestamp._fromProtobuf(e.consensusTimestamp),contents:null!=e.message?e.message:new Uint8Array,runningHash:null!=e.runningHash?e.runningHash:new Uint8Array,sequenceNumber:null!=e.sequenceNumber?e.sequenceNumber instanceof Long?e.sequenceNumber:Long.fromValue(e.sequenceNumber):Long.ZERO})}_toProtobuf(){return{consensusTimestamp:this.consensusTimestamp._toProtobuf(),message:this.contents,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber}}}class TopicMessage{constructor(e){this.consensusTimestamp=e.consensusTimestamp,this.contents=e.contents,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.chunks=e.chunks,this.initialTransactionId=e.initialTransactionId,Object.freeze(this)}static _ofSingle(e){return new TopicMessage({consensusTimestamp:Timestamp._fromProtobuf(e.consensusTimestamp),contents:null!=e.message?e.message:new Uint8Array,runningHash:null!=e.runningHash?e.runningHash:new Uint8Array,sequenceNumber:null!=e.sequenceNumber?e.sequenceNumber instanceof Long?e.sequenceNumber:Long.fromNumber(e.sequenceNumber):Long.ZERO,initialTransactionId:null!=e.chunkInfo&&null!=e.chunkInfo.initialTransactionID?TransactionId._fromProtobuf(e.chunkInfo.initialTransactionID):null,chunks:[TopicMessageChunk._fromProtobuf(e)]})}static _ofMany(e){const t=e[e.length-1],n=Timestamp._fromProtobuf(t.consensusTimestamp),r=t.runningHash,o=null!=t.sequenceNumber?t.sequenceNumber instanceof Long?t.sequenceNumber:Long.fromValue(t.sequenceNumber):Long.ZERO;e.sort((e,t)=>(null!=e&&null!=e.chunkInfo&&null!=e.chunkInfo.number?e.chunkInfo.number:0)<(null!=t&&null!=t.chunkInfo&&null!=t.chunkInfo.number?t.chunkInfo.number:0)?-1:1);const a=e.map(e=>TopicMessageChunk._fromProtobuf(e)),i=a.map(e=>e.contents.length).reduce((e,t)=>e+t,0),s=new Uint8Array(i);let c=0;e.forEach(e=>{s.set(e.message,c),c+=e.message.length});let u=null;return e.length>0&&null!=e[0].chunkInfo&&null!=e[0].chunkInfo.initialTransactionID&&(u=TransactionId._fromProtobuf(e[0].chunkInfo.initialTransactionID)),new TopicMessage({consensusTimestamp:n,contents:s,runningHash:r,sequenceNumber:o,chunks:a,initialTransactionId:u})}}class TopicMessageQuery{constructor(e={}){this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._startTime=null,null!=e.startTime&&this.setStartTime(e.startTime),this._endTime=null,null!=e.endTime&&this.setEndTime(e.endTime),this._limit=null,null!=e.limit&&this.setLimit(e.limit),this._errorHandler=(e,t)=>{console.error(`Error attempting to subscribe to topic: ${null!=this._topicId?this._topicId.toString():""}`)},null!=e.errorHandler&&(this._errorHandler=e.errorHandler),this._listener=null,this._completionHandler=()=>{console.log(`Subscription to topic ${null!=this._topicId?this._topicId.toString():""} complete`)},null!=e.completionHandler&&(this._completionHandler=e.completionHandler),this._maxAttempts=20,this._maxBackoff=8e3,this._retryHandler=e=>{if(null!=e){if(e instanceof Error)return!0;switch(e.code){case 13:return RST_STREAM.test(e.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},null!=e.retryHandler&&(this._retryHandler=e.retryHandler),this._attempt=0,this._handle=null,this.setMaxBackoff(8e3)}get topicId(){return this._topicId}setTopicId(e){return this.requireNotSubscribed(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}get startTime(){return this._startTime}setStartTime(e){return this.requireNotSubscribed(),this._startTime=e instanceof Timestamp?e:e instanceof Date?Timestamp.fromDate(e):new Timestamp(e,0),this}get endTime(){return this._endTime}setEndTime(e){return this.requireNotSubscribed(),this._endTime=e instanceof Timestamp?e:e instanceof Date?Timestamp.fromDate(e):new Timestamp(e,0),this}get limit(){return this._limit}setLimit(e){return this.requireNotSubscribed(),this._limit=e instanceof Long?e:Long.fromValue(e),this}setErrorHandler(e){return this._errorHandler=e,this}setCompletionHandler(e){return this.requireNotSubscribed(),this._completionHandler=e,this}setMaxAttempts(e){return this.requireNotSubscribed(),this._maxAttempts=e,this}setMaxBackoff(e){return this.requireNotSubscribed(),this._maxBackoff=e,this}subscribe(e,t,n){return this._handle=new SubscriptionHandle,this._listener=n,null!=t&&(this._errorHandler=t),this._makeServerStreamRequest(e),this._handle}_makeServerStreamRequest(e){const t=this._buildConsensusRequest(),n=new Map,r=e._mirrorNetwork.getNextMirrorNode().getChannel().makeServerStreamRequest("ConsensusService","subscribeTopic",t,e=>this._handleMessage(e,n),t=>this._handleError(t,e),this._completionHandler);null!=this._handle&&this._handle._setCall(()=>r())}requireNotSubscribed(){if(null!=this._handle)throw new Error("Cannot change fields on an already subscribed query")}_passTopicMessage(e){try{if(null==this._listener)throw new Error("(BUG) listener is unexpectedly not set");this._listener(e)}catch(t){this._errorHandler(e,t)}}_buildConsensusRequest(){return libExports.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode({topicID:this._topicId?._toProtobuf()??null,consensusStartTime:this._startTime?._toProtobuf()??null,consensusEndTime:this._endTime?._toProtobuf()??null,limit:this._limit}).finish()}_handleMessage(e,t){const n=libExports.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode(e);this._limit?.gt(0)&&(this._limit=this._limit.sub(1)),this._startTime=Timestamp._fromProtobuf(n.consensusTimestamp).plusNanos(1),null==n.chunkInfo||null!=n.chunkInfo&&1===n.chunkInfo.total?this._passTopicMessage(TopicMessage._ofSingle(n)):this._handleChunkedMessage(n,t)}_handleChunkedMessage(e,t){const n=e.chunkInfo,r=n.initialTransactionID,o=n.total,a=TransactionId._fromProtobuf(r).toString();let i=[];const s=t.get(a);if(null==s?t.set(a,i):i=s,i.push(e),i.length===o){const e=TopicMessage._ofMany(i);t.delete(a),this._passTopicMessage(e)}}_handleError(e,t){const n=e instanceof Error?e.message:e.details;this._handle?._unsubscribed||(this.shouldRetry(e)?this._scheduleRetry(t,n):this._errorHandler(null,new Error(n)))}shouldRetry(e){return this._attempt<this._maxAttempts&&this._retryHandler(e)}_scheduleRetry(e,t){const n=Math.min(250*2**this._attempt,this._maxBackoff);console.warn(`Error subscribing to topic ${this._topicId?.toString()??"UNKNOWN"} during attempt ${this._attempt}. Waiting ${n} ms before next attempt: ${t}`),this._attempt+=1,setTimeout(()=>this._makeServerStreamRequest(e),n)}}class TopicMessageSubmitTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._message=null,null!=e.message&&this.setMessage(e.message),this._maxChunks=20,this._chunkSize=CHUNK_SIZE,null!=e.maxChunks&&this.setMaxChunks(e.maxChunks),null!=e.chunkSize&&this.setChunkSize(e.chunkSize),this._chunkInfo=null}static _fromProtobuf(e,t,n,r,o){const a=o[0].consensusSubmitMessage;return Transaction._fromProtobufTransactions(new TopicMessageSubmitTransaction({topicId:null!=a.topicID?TopicId._fromProtobuf(a.topicID):void 0,message:null!=a.message?a.message:void 0}),e,t,n,r,o)}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}get message(){return this._message}getMessage(){return this._message}setMessage(e){return this._requireNotFrozen(),e=requireStringOrUint8Array(e),this._message=e instanceof Uint8Array?e:encode(e),this}getCustomFeeLimits(){return this._customFeeLimits}setCustomFeeLimits(e){return this._requireNotFrozen(),this._customFeeLimits=e,this}addCustomFeeLimit(e){return this._requireNotFrozen(),this._customFeeLimits.push(e),this}get maxChunks(){return this._maxChunks}getMaxChunks(){return this._maxChunks}setMaxChunks(e){return this._requireNotFrozen(),this._maxChunks=e,this}get chunkSize(){return this._chunkSize}getChunkSize(){return this._chunkSize}setChunkSize(e){return this._chunkSize=e,this}getRequiredChunks(){if(null==this._message)return 1;return Math.ceil(this._message.length/this._chunkSize)}freezeWith(e){if(super.freezeWith(e),null==this._message)return this;const t=Math.floor((this._message.length+(this._chunkSize-1))/this._chunkSize);if(t>this._maxChunks)throw new Error(`Message with size ${this._message.length} too long for ${this._maxChunks} chunks`);const n=this._getTransactionId()._toProtobuf();let r=this._getTransactionId();this._transactionIds.locked=!1,this._transactions.clear(),this._transactionIds.clear(),this._signedTransactions.clear();for(let e=0;e<t;e++){this._chunkInfo={initialTransactionID:n,total:t,number:e+1},this._transactionIds.push(r),this._transactionIds.advance();for(const e of this._nodeAccountIds.list)this._signedTransactions.push(this._makeSignedTransaction(e));r=new TransactionId(r.accountId,new Timestamp(r.validStart.seconds,r.validStart.nanos.add(1)))}return this._transactionIds.advance(),this._chunkInfo=null,this}schedule(){if(this._requireNotFrozen(),null!=this._message&&this._message.length>this._chunkSize)throw new Error(`cannot schedule \`TopicMessageSubmitTransaction\` with message over ${this._chunkSize} bytes`);return super.schedule()}async execute(e,t){return(await this.executeAll(e,t))[0]}async executeAll(e,t){super._isFrozen()||this.freezeWith(e);const n=this._getTransactionId(),r=e.operatorAccountId;null!=r&&r.equals(n.accountId)&&await super.signWithOperator(e);const o=[];let a=t;for(let t=0;t<this._transactionIds.length;t++){const t=Date.now();o.push(await super.execute(e,a)),null!=a&&(a=Date.now()-t)}return o}_execute(e,t){return e.consensus.submitMessage(t)}_getTransactionDataCase(){return"consensusSubmitMessage"}_makeTransactionData(){if(null!=this._chunkInfo&&null!=this._message){const e=(this._chunkInfo.number-1)*this._chunkSize;let t=e+this._chunkSize;return t>this._message.length&&(t=this._message.length),{topicID:null!=this._topicId?this._topicId._toProtobuf():null,message:this._message.slice(e,t),chunkInfo:this._chunkInfo}}return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,message:this._message}}_getLogId(){return`TopicMessageSubmitTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusSubmitMessage",TopicMessageSubmitTransaction._fromProtobuf);class TopicUpdateTransaction extends Transaction{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._topicMemo=null,null!=e.topicMemo&&this.setTopicMemo(e.topicMemo),this._submitKey=null,null!=e.submitKey&&this.setSubmitKey(e.submitKey),this._adminKey=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),this._feeScheduleKey=null,null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),this._feeExemptKeys=null,null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),this._autoRenewAccountId=null,null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),this._autoRenewPeriod=null,null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),this._customFees=null,null!=e.customFees&&this.setCustomFees(e.customFees),this._expirationTime=null,null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(e,t,n,r,o){const a=o[0].consensusUpdateTopic;return Transaction._fromProtobufTransactions(new TopicUpdateTransaction({topicId:null!=a.topicID?TopicId._fromProtobuf(a.topicID):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,submitKey:null!=a.submitKey?Key._fromProtobufKey(a.submitKey):void 0,feeScheduleKey:null!=a.feeScheduleKey?Key._fromProtobufKey(a.feeScheduleKey):void 0,feeExemptKeys:null!=a.feeExemptKeyList&&null!=a.feeExemptKeyList.keys?a?.feeExemptKeyList.keys.map(e=>Key._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=a.autoRenewAccount?AccountId._fromProtobuf(a.autoRenewAccount):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,customFees:null!=a.customFees&&null!=a.customFees.fees?a.customFees.fees.map(e=>CustomFixedFee._fromProtobuf(e)):void 0,topicMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0,expirationTime:null!=a.expirationTime?Timestamp._fromProtobuf(a.expirationTime):void 0}),e,t,n,r,o)}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?Timestamp.fromDate(e):e,this}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?TopicId.fromString(e):e.clone(),this}clearTopicId(){return this._requireNotFrozen(),this._topicId=null,this}get topicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}clearTopicMemo(){return this._requireNotFrozen(),this._topicMemo=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}clearAdminKey(){return this._requireNotFrozen(),this._adminKey=null,this}get submitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}clearSubmitKey(){return this._requireNotFrozen(),this._submitKey=null,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}clearFeeScheduleKey(){return this._requireNotFrozen(),this._feeScheduleKey=null,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),null==this._feeExemptKeys&&(this._feeExemptKeys=[]),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof AccountId?e:AccountId.fromString(e),this}clearAutoRenewAccountId(){return this._requireNotFrozen(),this._autoRenewAccountId=null,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof Duration?e:new Duration(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),null==this._customFees&&(this._customFees=[]),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.consensus.updateTopic(t)}_getTransactionDataCase(){return"consensusUpdateTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this._feeExemptKeys?{keys:this._feeExemptKeys.map(e=>e._toProtobufKey())}:null,memo:null!=this._topicMemo?{value:this._topicMemo}:null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,customFees:null!=this._customFees?{fees:this._customFees.map(e=>e._toTopicFeeProtobuf())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`TopicUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("consensusUpdateTopic",TopicUpdateTransaction._fromProtobuf);class HbarTransferMap extends ObjectMap{constructor(){super(e=>AccountId.fromString(e))}static _fromProtobuf(e){const t=new HbarTransferMap;for(const n of null!=e.accountAmounts?e.accountAmounts:[]){const e=AccountId._fromProtobuf(n.accountID);t._set(e,Hbar.fromTinybars(n.amount))}return t}}class TransferTransaction extends AbstractTokenTransferTransaction{constructor(e={}){super(),this._hbarTransfers=[],this._defaultMaxTransactionFee=new Hbar(1);for(const t of null!=e.hbarTransfers?e.hbarTransfers:[])this.addHbarTransfer(t.accountId,t.amount)}static _fromProtobuf(e,t,n,r,o){const a=o[0].cryptoTransfer,i=new TransferTransaction;return i._tokenTransfers=TokenTransfer._fromProtobuf(null!=a.tokenTransfers?a.tokenTransfers:[]),i._hbarTransfers=Transfer._fromProtobuf(null!=a.transfers&&null!=a.transfers.accountAmounts?a.transfers.accountAmounts:[]),i._nftTransfers=TokenNftTransfer._fromProtobuf(null!=a.tokenTransfers?a.tokenTransfers:[]),Transaction._fromProtobufTransactions(i,e,t,n,r,o)}get hbarTransfers(){const e=new HbarTransferMap;for(const t of this._hbarTransfers)e._set(t.accountId,t.amount);return e}get hbarTransfersList(){return this._hbarTransfers}_addHbarTransfer(e,t,n,r){this._requireNotFrozen();const o=e instanceof AccountId?e.clone():AccountId.fromString(e),a=t instanceof Hbar?t:new Hbar(t);for(const e of this._hbarTransfers)if(0===e.accountId.compare(o))return e.amount=Hbar.fromTinybars(e.amount.toTinybars().add(a.toTinybars())),this;return this._hbarTransfers.push(new Transfer({accountId:o,amount:a,isApproved:n,hookCall:r})),this}addHbarTransfer(e,t){return this._addHbarTransfer(e,t,!1)}addApprovedHbarTransfer(e,t){return this._addHbarTransfer(e,t,!0)}_validateChecksums(e){for(const t of this._hbarTransfers)t.accountId.validateChecksum(e);for(const t of this._tokenTransfers)t.tokenId.validateChecksum(e),t.accountId.validateChecksum(e);for(const t of this._nftTransfers)t.tokenId.validateChecksum(e),t.senderAccountId.validateChecksum(e),t.receiverAccountId.validateChecksum(e)}setHbarTransferApproval(e,t){const n="string"==typeof e?AccountId.fromString(e):e;for(const e of this._hbarTransfers)0===e.accountId.compare(n)&&(e.isApproved=t);return this}setTokenTransferApproval(e,t,n){const r="string"==typeof e?TokenId.fromString(e):e,o="string"==typeof t?AccountId.fromString(t):t;for(const e of this._tokenTransfers)0===e.tokenId.compare(r)&&0===e.accountId.compare(o)&&(e.isApproved=n);return this}setNftTransferApproval(e,t){const n="string"==typeof e?NftId.fromString(e):e;for(const e of this._nftTransfers)0===e.tokenId.compare(n.tokenId)&&0===e.serialNumber.compare(n.serial)&&(e.isApproved=t);return this}addHbarTransferWithHook(e,t,n){return this._addHbarTransfer(e,t,!1,new FungibleHookCall({hookId:n.hookId,evmHookCall:n.evmHookCall,type:n.type}))}addNftTransferWithHook(e,t,n,r,o){return this._addNftTransfer(!1,e,t,n,void 0,r,o)}addTokenTransferWithHook(e,t,n,r){const o=new FungibleHookCall({hookId:null!=r.hookId?r.hookId:void 0,evmHookCall:null!=r.evmHookCall?r.evmHookCall:void 0,type:r.type});return this._addTokenTransfer(e,t,n,!1,null,o)}_execute(e,t){return e.crypto.cryptoTransfer(t)}_getTransactionDataCase(){return"cryptoTransfer"}_makeTransactionData(){const{tokenTransfers:e}=super._makeTransactionData();return this._hbarTransfers.sort((e,t)=>e.accountId.compare(t.accountId)),{transfers:{accountAmounts:this._hbarTransfers.map(e=>e._toProtobuf())},tokenTransfers:e}}_getLogId(){return`TransferTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("cryptoTransfer",TransferTransaction._fromProtobuf.bind(null));class Wallet{constructor(e,t,n){let r;r="string"==typeof t&&PrivateKey.isDerKey(t)?PrivateKey.fromStringDer(t):"string"==typeof t?PrivateKey.fromString(t):t,this.publicKey=r.publicKey,this.signer=e=>Promise.resolve(r.sign(e)),this.provider=n,this.accountId="string"==typeof e?AccountId.fromString(e):e}static createRandomED25519(){const e=PrivateKey.generateED25519(),t=e.publicKey.toAccountId(0,0);return Promise.resolve(new Wallet(t,e))}static createRandomECDSA(){const e=PrivateKey.generateECDSA(),t=e.publicKey.toAccountId(0,0);return Promise.resolve(new Wallet(t,e))}getProvider(){return this.provider}getAccountId(){return this.accountId}getAccountKey(){return this.publicKey}getLedgerId(){return null==this.provider?null:this.provider.getLedgerId()}getNetwork(){return null==this.provider?{}:this.provider.getNetwork()}getMirrorNetwork(){return null==this.provider?[]:this.provider.getMirrorNetwork()}async sign(e){const t=[];for(const n of e)t.push(new SignerSignature({publicKey:this.publicKey,signature:await this.signer(n),accountId:this.accountId}));return t}getAccountBalance(){return this.call((new AccountBalanceQuery).setAccountId(this.accountId))}getAccountInfo(){return this.call((new AccountInfoQuery).setAccountId(this.accountId))}getAccountRecords(){return this.call((new AccountRecordsQuery).setAccountId(this.accountId))}signTransaction(e){return e.signWith(this.publicKey,this.signer)}checkTransaction(e){const t=e.transactionId;if(null!=t&&null!=t.accountId&&0!=t.accountId.compare(this.accountId))throw new Error("transaction's ID constructed with a different account ID");if(null==this.provider)return Promise.resolve(e);const n=(null!=e.nodeAccountIds?e.nodeAccountIds:[]).map(e=>e.toString()),r=Object.values(this.provider.getNetwork()).map(e=>e.toString());if(!n.reduce((e,t)=>e&&r.includes(t),!0))throw new Error("Transaction already set node account IDs to values not within the current network");return Promise.resolve(e)}populateTransaction(e){if(e._freezeWithAccountId(this.accountId),null==e.transactionId&&e.setTransactionId(TransactionId.generate(this.accountId)),null!=e.nodeAccountIds&&0!=e.nodeAccountIds.length)return Promise.resolve(e.freeze());if(null==this.provider)return Promise.resolve(e);const t=Object.values(this.provider.getNetwork()).map(e=>"string"==typeof e?AccountId.fromString(e):e);return shuffle(t),e.setNodeAccountIds(t.slice(0,(t.length+3-1)/3)),Promise.resolve(e.freeze())}call(e){if(null==this.provider)throw new Error("cannot send request with an wallet that doesn't contain a provider");return this.provider.call(e._setOperatorWith(this.accountId,this.publicKey,this.signer))}}var browser={exports:{}},quickFormatUnescaped,hasRequiredQuickFormatUnescaped,hasRequiredBrowser;function requireQuickFormatUnescaped(){if(hasRequiredQuickFormatUnescaped)return quickFormatUnescaped;function e(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}return hasRequiredQuickFormatUnescaped=1,quickFormatUnescaped=function(t,n,r){var o=r&&r.stringify||e;if("object"==typeof t&&null!==t){var a=n.length+1;if(1===a)return t;var i=new Array(a);i[0]=o(t);for(var s=1;s<a;s++)i[s]=o(n[s]);return i.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var u="",l=0,d=-1,p=t&&t.length||0,h=0;h<p;){if(37===t.charCodeAt(h)&&h+1<p){switch(d=d>-1?d:0,t.charCodeAt(h+1)){case 100:case 102:if(l>=c)break;if(null==n[l])break;d<h&&(u+=t.slice(d,h)),u+=Number(n[l]),d=h+2,h++;break;case 105:if(l>=c)break;if(null==n[l])break;d<h&&(u+=t.slice(d,h)),u+=Math.floor(Number(n[l])),d=h+2,h++;break;case 79:case 111:case 106:if(l>=c)break;if(void 0===n[l])break;d<h&&(u+=t.slice(d,h));var f=typeof n[l];if("string"===f){u+="'"+n[l]+"'",d=h+2,h++;break}if("function"===f){u+=n[l].name||"<anonymous>",d=h+2,h++;break}u+=o(n[l]),d=h+2,h++;break;case 115:if(l>=c)break;d<h&&(u+=t.slice(d,h)),u+=String(n[l]),d=h+2,h++;break;case 37:d<h&&(u+=t.slice(d,h)),u+="%",d=h+2,h++,l--}++l}++h}if(-1===d)return t;d<p&&(u+=t.slice(d));return u},quickFormatUnescaped}function requireBrowser(){if(hasRequiredBrowser)return browser.exports;hasRequiredBrowser=1;const e=requireQuickFormatUnescaped();browser.exports=c;const t=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},n={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:f,res:f,err:p,errWithCause:p};function r(e,t){return"silent"===e?1/0:t.levels.values[e]}const o=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),i={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function s(e,t){const n={logger:t,parent:e[a]};t[a]=n}function c(e){(e=e||{}).browser=e.browser||{};const n=e.browser.transmit;if(n&&"function"!=typeof n.send)throw Error("pino: transmit option must have a send function");const a=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const p=e.serializers||{},f=function(e,t){if(Array.isArray(e))return e.filter(function(e){return"!stdSerializers.err"!==e});return!0===e&&Object.keys(t)}(e.browser.serialize,p);let y=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(y=!1);const g=Object.keys(e.customLevels||{}),_=["error","fatal","warn","info","debug","trace"].concat(g);"function"==typeof a&&_.forEach(function(e){a[e]=a}),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const b=e.level||"info",I=Object.create(a);I.log||(I.log=m),function(e,n,r){const a={};n.forEach(e=>{a[e]=r[e]?r[e]:t[e]||t[i[e]||"log"]||m}),e[o]=a}(I,_,a),s({},I),Object.defineProperty(I,"levelVal",{get:function(){return r(this.level,this)}}),Object.defineProperty(I,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,u(this,k,I,"error"),u(this,k,I,"fatal"),u(this,k,I,"warn"),u(this,k,I,"info"),u(this,k,I,"debug"),u(this,k,I,"trace"),g.forEach(e=>{u(this,k,I,e)})}});const k={transmit:n,serialize:f,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:_,timestamp:h(e),messageKey:e.messageKey||"msg",onChild:e.onChild||m};function T(t,r,o){if(!r)throw new Error("missing bindings for child Pino");o=o||{},f&&r.serializers&&(o.serializers=r.serializers);const a=o.serializers;if(f&&a){var i=Object.assign({},p,a),c=!0===e.browser.serialize?Object.keys(i):f;delete r.serializers,l([r],c,i,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.bindings=r,i&&(this.serializers=i,this._serialize=c),n&&(this._logEvent=d([].concat(e._logEvent.bindings,r)))}u.prototype=this;const h=new u(this);return s(this,h),h.child=function(...e){return T.call(this,t,...e)},h.level=o.level||this.level,t.onChild(h),h}return I.levels=function(e){const t=e.customLevels||{},n=Object.assign({},c.levels.values,t),r=Object.assign({},c.levels.labels,function(e){const t={};return Object.keys(e).forEach(function(n){t[e[n]]=n}),t}(t));return{values:n,labels:r}}(e),I.level=b,I.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},I.setMaxListeners=I.getMaxListeners=I.emit=I.addListener=I.on=I.prependListener=I.once=I.prependOnceListener=I.removeListener=I.removeAllListeners=I.listeners=I.listenerCount=I.eventNames=I.write=I.flush=m,I.serializers=p,I._serialize=f,I._stdErrSerialize=y,I.child=function(...e){return T.call(this,k,...e)},n&&(I._logEvent=d()),I}function u(n,i,s,c){if(Object.defineProperty(n,c,{value:r(n.level,s)>r(c,s)?m:s[o][c],writable:!0,enumerable:!0,configurable:!0}),n[c]===m){if(!i.transmit)return;const e=r(i.transmit.level||n.level,s);if(r(c,s)<e)return}n[c]=function(n,a,i,s){return c=n[o][s],function(){const o=a.timestamp(),u=new Array(arguments.length),p=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var h=0;h<u.length;h++)u[h]=arguments[h];var f=!1;if(a.serialize&&(l(u,this._serialize,this.serializers,this._stdErrSerialize),f=!0),a.asObject||a.formatters?c.call(p,...function(t,n,r,o,a){const{level:i,log:s=e=>e}=a.formatters||{},c=r.slice();let u=c[0];const l={};let d=1+(0|t._childLevel);if(d<1&&(d=1),o&&(l.time=o),i){const e=i(n,t.levels.values[n]);Object.assign(l,e)}else l.level=t.levels.values[n];if(a.asObjectBindingsOnly){if(null!==u&&"object"==typeof u)for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());return[s(l),...c]}if(null!==u&&"object"==typeof u){for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());u=c.length?e(c.shift(),c):void 0}else"string"==typeof u&&(u=e(c.shift(),c));return void 0!==u&&(l[a.messageKey]=u),[s(l)]}(this,s,u,o,a)):c.apply(p,u),a.transmit){const e=r(a.transmit.level||n._level,i),t=r(s,i);if(t<e)return;!function(e,t,n,r=!1){const o=t.send,a=t.ts,i=t.methodLevel,s=t.methodValue,c=t.val,u=e._logEvent.bindings;r||l(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=a,e._logEvent.messages=n.filter(function(e){return-1===u.indexOf(e)}),e._logEvent.level.label=i,e._logEvent.level.value=s,o(i,e._logEvent,c),e._logEvent=d(u)}(this,{ts:o,methodLevel:s,methodValue:t,transmitValue:i.levels.values[a.transmit.level||n._level],send:a.transmit.send,val:r(n._level,i)},u,f)}};var c}(n,i,s,c);const u=function(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[a];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}(n);0!==u.length&&(n[c]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(u,n[c]))}function l(e,t,n,r){for(const o in e)if(r&&e[o]instanceof Error)e[o]=c.stdSerializers.err(e[o]);else if("object"==typeof e[o]&&!Array.isArray(e[o])&&t)for(const r in e[o])t.indexOf(r)>-1&&r in n&&(e[o][r]=n[r](e[o][r]))}function d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function p(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function h(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?g:_}function f(){return{}}function y(e){return e}function m(){}function g(){return!1}function _(){return Date.now()}return c.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},c.stdSerializers=n,c.stdTimeFunctions=Object.assign({},{nullTime:g,epochTime:_,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),browser.exports.default=c,browser.exports.pino=c,browser.exports}var browserExports=requireBrowser(),pino=getDefaultExportFromCjs(browserExports);class LogLevel{constructor(e){this._name=e,Object.freeze(this)}toString(){switch(this){case LogLevel.Silent:return"silent";case LogLevel.Trace:return"trace";case LogLevel.Debug:return"debug";case LogLevel.Info:return"info";case LogLevel.Warn:return"warn";case LogLevel.Error:return"error";case LogLevel.Fatal:return"fatal";default:return`Unknown log level (${this._name})`}}static _fromString(e){switch(e){case"silent":return LogLevel.Silent;case"trace":return LogLevel.Trace;case"debug":return LogLevel.Debug;case"info":return LogLevel.Info;case"warn":return LogLevel.Warn;case"error":return LogLevel.Error;case"fatal":return LogLevel.Fatal;default:throw new Error(`Unknown log level: ${e}`)}}}LogLevel.Silent=new LogLevel("silent"),LogLevel.Trace=new LogLevel("trace"),LogLevel.Debug=new LogLevel("debug"),LogLevel.Info=new LogLevel("info"),LogLevel.Warn=new LogLevel("warn"),LogLevel.Error=new LogLevel("error"),LogLevel.Fatal=new LogLevel("fatal");class Logger{constructor(e,t="",n=!0,r=!0,o=!0,a=0){let i,s;if("object"!=typeof e||null===e||e instanceof LogLevel?(i=e,s=!1):(({logFile:t="",silent:s=!1,sync:n=!0,fsync:r=!0,mkdir:o=!0,minLength:a=0}=e),i=e.level),this._previousLevel=i,s)return void(this._logger=pino({level:"silent",enabled:!1}));const c=t?pino.destination({dest:t,sync:n,fsync:r,mkdir:o,minLength:a}):null,u=c?{level:i.toString(),timestamp:pino.stdTimeFunctions.isoTime,formatters:{bindings:()=>({}),level:e=>({level:e.toUpperCase()})}}:{level:i.toString(),transport:{target:"pino-pretty",options:{translateTime:"SYS:dd-mm-yyyy HH:MM:ss",ignore:"pid,hostname"}}};this._logger=c?pino(u,c):pino(u)}setLogger(e){return this._logger=e,this}setLevel(e){return this._previousLevel=LogLevel._fromString(this._logger.level),this._logger.level=e.toString(),this}get level(){return LogLevel._fromString(this._logger.level)}get levels(){return this._logger.levels.labels}setSilent(e){return this._logger.level=e?LogLevel.Silent.toString():this._previousLevel.toString(),this}get silent(){return this._logger.level==LogLevel.Silent.toString()}trace(e){this._logger.trace(e)}debug(e){this._logger.debug(e)}info(e){this._logger.info(e)}warn(e){this._logger.warn(e)}error(e){this._logger.error(e)}fatal(e){this._logger.fatal(e)}}class TokenUpdateNftsTransaction extends Transaction{constructor(e={}){super(),this._tokenId=null,this._serialNumbers=[],this._metadata=null,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.serialNumbers&&this.setSerialNumbers(e.serialNumbers),null!=e.metadata&&this.setMetadata(e.metadata)}static _fromProtobuf(e,t,n,r,o){const a=o[0].tokenUpdateNfts;return Transaction._fromProtobufTransactions(new TokenUpdateNftsTransaction({tokenId:null!=a.token?TokenId._fromProtobuf(a.token):void 0,serialNumbers:null!=a.serialNumbers?a.serialNumbers:[],metadata:null!=a.metadata&&Object.hasOwn(a.metadata,"value")?a.metadata.value:void 0}),e,t,n,r,o)}setTokenId(e){return this._requireNotFrozen(),this._tokenId="string"==typeof e?TokenId.fromString(e):e.clone(),this}setSerialNumbers(e){return this._requireNotFrozen(),this._serialNumbers=e,this}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e)}_execute(e,t){return e.token.pauseToken(t)}_getTransactionDataCase(){return"tokenUpdateNfts"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,serialNumbers:null!=this._serialNumbers?this._serialNumbers:[],...null!=this._metadata?{metadata:{value:this._metadata}}:null}}_getLogId(){return`TokenUpdateNftsTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("tokenUpdateNfts",TokenUpdateNftsTransaction._fromProtobuf);class ServiceEndpoint{constructor(e){this._ipAddressV4=null!=e?.ipAddressV4?e.ipAddressV4:null,this._port=null!=e?.port?e.port:null,this._domainName=null!=e?.domainName?e.domainName:null}setIpAddressV4(e){if(null!=this._domainName)throw new Error("Cannot set IP address when domain name is already set.");return this._ipAddressV4=e,this}get getIpAddressV4(){return this._ipAddressV4}setPort(e){return this._port=e,this}get getPort(){return this._port}setDomainName(e){if(null!=this._ipAddressV4)throw new Error("Cannot set domain name when IP address is already set.");return this._domainName=e,this}get getDomainName(){return this._domainName}static _fromProtobuf(e){return new ServiceEndpoint({ipAddressV4:null!=e.ipAddressV4?e.ipAddressV4:void 0,port:null!=e.port?e.port:void 0,domainName:null!=e.domainName?e.domainName:void 0})}_toProtobuf(){return{ipAddressV4:this._ipAddressV4,port:this._port,domainName:this._domainName}}}const DESCRIPTION_MAX_LENGTH$1=100,GOSSIP_ENDPOINTS_MAX_LENGTH$1=10,SERVICE_ENDPOINTS_MAX_LENGTH$1=8;class NodeCreateTransaction extends Transaction{constructor(e){super(),this._accountId=null!=e?.accountId?e.accountId:null,this._description=null!=e?.description?e.description:null,this._gossipEndpoints=null!=e?.gossipEndpoints?e.gossipEndpoints:null,this._serviceEndpoints=null!=e?.serviceEndpoints?e.serviceEndpoints:null,this._gossipCaCertificate=null!=e?.gossipCaCertificate?e.gossipCaCertificate:null,this._grpcCertificateHash=null!=e?.grpcCertificateHash?e.grpcCertificateHash:null,this._grpcWebProxyEndpoint=e?.grpcWebProxyEndpoint||null,this._adminKey=null!=e?.adminKey?e.adminKey:null,this._declineReward=null!=e?.declineReward?e.declineReward:null}static _fromProtobuf(e,t,n,r,o){const a=o[0].nodeCreate;return Transaction._fromProtobufTransactions(new NodeCreateTransaction({accountId:null!=a.accountId?AccountId._fromProtobuf(a.accountId):void 0,description:null!=a.description?a.description:void 0,gossipEndpoints:null!=a.gossipEndpoint?a.gossipEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,serviceEndpoints:null!=a.serviceEndpoint?a.serviceEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,gossipCaCertificate:null!=a.gossipCaCertificate?a.gossipCaCertificate:void 0,grpcCertificateHash:null!=a.grpcCertificateHash?a.grpcCertificateHash:void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,declineReward:null!=a.declineReward?a.declineReward:void 0,grpcWebProxyEndpoint:null!=a.grpcProxyEndpoint?ServiceEndpoint._fromProtobuf(a.grpcProxyEndpoint):void 0}),e,t,n,r,o)}setAccountId(e){return this._requireNotFrozen(),this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get accountId(){return this._accountId}setDescription(e){if(this._requireNotFrozen(),e.length>DESCRIPTION_MAX_LENGTH$1)throw new Error(`Description must be at most ${DESCRIPTION_MAX_LENGTH$1} characters.`);return this._description=e,this}get description(){return this._description}setGossipEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipEndpoints list must not be empty.");if(e.length>GOSSIP_ENDPOINTS_MAX_LENGTH$1)throw new Error(`GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH$1} entries.`);return this._gossipEndpoints=[...e],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(e){return null!=this._gossipEndpoints&&this._gossipEndpoints.push(e),this}setServiceEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("ServiceEndpoints list must not be empty.");if(e.length>SERVICE_ENDPOINTS_MAX_LENGTH$1)throw new Error(`ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH$1} entries.`);return this._serviceEndpoints=[...e],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(e){return null!=this._serviceEndpoints&&this._serviceEndpoints.push(e),this}setGossipCaCertificate(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=e,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(e){return this._requireNotFrozen(),this._grpcCertificateHash=e,this}get certificateHash(){return this._grpcCertificateHash}setGrpcWebProxyEndpoint(e){return this._requireNotFrozen(),this._grpcWebProxyEndpoint=e,this}get grpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get adminKey(){return this._adminKey}setDeclineReward(e){return this._requireNotFrozen(),this._declineReward=e,this}get declineReward(){return this._declineReward}_execute(e,t){return e.addressBook.createNode(t)}_getTransactionDataCase(){return"nodeCreate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:null!=this._description?this._description:null,gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map(e=>e._toProtobuf()):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map(e=>e._toProtobuf()):null,gossipCaCertificate:null!=this._gossipCaCertificate?this._gossipCaCertificate:null,grpcCertificateHash:null!=this._grpcCertificateHash?this._grpcCertificateHash:null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,declineReward:null!=this._declineReward?this._declineReward:null,grpcProxyEndpoint:null!=this._grpcWebProxyEndpoint?this._grpcWebProxyEndpoint._toProtobuf():null}}_getLogId(){return`NodeCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeCreate",NodeCreateTransaction._fromProtobuf);class NodeDeleteTransaction extends Transaction{constructor(e){super(),this._nodeId=null!=e?.nodeId?e.nodeId:null}static _fromProtobuf(e,t,n,r,o){const a=o[0].nodeDelete;return Transaction._fromProtobufTransactions(new NodeDeleteTransaction({nodeId:null!=a.nodeId?a.nodeId:void 0}),e,t,n,r,o)}setNodeId(e){if(this._requireNotFrozen(),null==e)return this._nodeId=null,this;const t=Long.isLong(e)?e:Long.fromValue(e);if(t.toNumber()<0)throw new Error("NodeDeleteTransaction: 'nodeId' must be positive.");return this._nodeId=t,this}get nodeId(){return this._nodeId}freezeWith(e){if(null==this.nodeId)throw new Error("NodeDeleteTransaction: 'nodeId' must be explicitly set before calling freeze().");return super.freezeWith(e)}_execute(e,t){return e.addressBook.deleteNode(t)}_getTransactionDataCase(){return"nodeDelete"}_makeTransactionData(){return{nodeId:null!=this._nodeId?this._nodeId:null}}_getLogId(){return`NodeDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeDelete",NodeDeleteTransaction._fromProtobuf);const DESCRIPTION_MAX_LENGTH=100,GOSSIP_ENDPOINTS_MAX_LENGTH=10,SERVICE_ENDPOINTS_MAX_LENGTH=8;class NodeUpdateTransaction extends Transaction{constructor(e){super(),this._nodeId=null!=e?.nodeId?e.nodeId:null,this._accountId=null!=e?.accountId?e.accountId:null,this._description=null!=e?.description?e.description:null,this._gossipEndpoints=null!=e?.gossipEndpoints?e.gossipEndpoints:null,this._serviceEndpoints=null!=e?.serviceEndpoints?e.serviceEndpoints:null,this._gossipCaCertificate=null!=e?.gossipCaCertificate?e.gossipCaCertificate:null,this._grpcCertificateHash=null!=e?.grpcCertificateHash?e.grpcCertificateHash:null,this._grpcWebProxyEndpoint=e?.grpcWebProxyEndpoint||null,this._adminKey=null!=e?.adminKey?e.adminKey:null,this._declineReward=null!=e?.declineReward?e.declineReward:null}static _fromProtobuf(e,t,n,r,o){const a=o[0].nodeUpdate;return Transaction._fromProtobufTransactions(new NodeUpdateTransaction({nodeId:null!=a.nodeId?a.nodeId:void 0,accountId:null!=a.accountId?AccountId._fromProtobuf(a.accountId):void 0,description:null!=a.description&&Object.hasOwn(a.description,"value")?a.description.value:void 0,gossipEndpoints:null!=a.gossipEndpoint?a.gossipEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,serviceEndpoints:null!=a.serviceEndpoint?a.serviceEndpoint.map(e=>ServiceEndpoint._fromProtobuf(e)):void 0,gossipCaCertificate:null!=a.gossipCaCertificate&&Object.hasOwn(a.gossipCaCertificate,"value")?a.gossipCaCertificate.value:void 0,grpcCertificateHash:null!=a.grpcCertificateHash&&Object.hasOwn(a.grpcCertificateHash,"value")?a.grpcCertificateHash.value:void 0,grpcWebProxyEndpoint:null!=a.grpcProxyEndpoint?ServiceEndpoint._fromProtobuf(a.grpcProxyEndpoint):void 0,adminKey:null!=a.adminKey?Key._fromProtobufKey(a.adminKey):void 0,declineReward:null!=a.declineReward?.value?a.declineReward.value:void 0}),e,t,n,r,o)}setNodeId(e){if(this._requireNotFrozen(),null==e)return this._nodeId=null,this;const t=Long.isLong(e)?e:Long.fromValue(e);if(t.toNumber()<0)throw new Error("NodeUpdateTransaction: 'nodeId' must be positive.");return this._nodeId=t,this}get nodeId(){return this._nodeId}setAccountId(e){return this._requireNotFrozen(),this._accountId=e instanceof AccountId?e:AccountId.fromString(e),this}get accountId(){return this._accountId}setDescription(e){if(this._requireNotFrozen(),e.length>DESCRIPTION_MAX_LENGTH)throw new Error(`Description must be at most ${DESCRIPTION_MAX_LENGTH} characters.`);return this._description=e,this}clearDescription(){this._description=""}get description(){return this._description}setGossipEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipEndpoints list must not be empty.");if(e.length>GOSSIP_ENDPOINTS_MAX_LENGTH)throw new Error(`GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH} entries.`);return this._gossipEndpoints=[...e],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(e){return this._requireNotFrozen(),null!=this._gossipEndpoints&&this._gossipEndpoints.push(e),this}setServiceEndpoints(e){if(this._requireNotFrozen(),0==e.length)throw new Error("ServiceEndpoints list must not be empty.");if(e.length>SERVICE_ENDPOINTS_MAX_LENGTH)throw new Error(`ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH} entries.`);return this._serviceEndpoints=[...e],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(e){return this._requireNotFrozen(),null!=this._serviceEndpoints&&this._serviceEndpoints.push(e),this}setGossipCaCertificate(e){if(this._requireNotFrozen(),0==e.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=e,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(e){return this._requireNotFrozen(),this._grpcCertificateHash=e,this}get certificateHash(){return this._grpcCertificateHash}setGrpcWebProxyEndpoint(e){return this._requireNotFrozen(),this._grpcWebProxyEndpoint=e,this}get grpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get adminKey(){return this._adminKey}setDeclineReward(e){return this._requireNotFrozen(),this._declineReward=e,this}get declineReward(){return this._declineReward}deleteGrpcWebProxyEndpoint(){return this._grpcWebProxyEndpoint=new ServiceEndpoint,this}freezeWith(e){if(null==this.nodeId)throw new Error("NodeUpdateTransaction: 'nodeId' must be explicitly set before calling freeze().");return super.freezeWith(e)}_execute(e,t){return e.addressBook.updateNode(t)}_getTransactionDataCase(){return"nodeUpdate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:null!=this._description?{value:this._description}:null,gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map(e=>e._toProtobuf()):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map(e=>e._toProtobuf()):null,gossipCaCertificate:null!=this._gossipCaCertificate?{value:this._gossipCaCertificate}:null,grpcCertificateHash:null!=this._grpcCertificateHash?{value:this._grpcCertificateHash}:null,grpcProxyEndpoint:null!=this._grpcWebProxyEndpoint?this._grpcWebProxyEndpoint._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,nodeId:null!=this._nodeId?this._nodeId:null,declineReward:null!=this._declineReward?{value:this._declineReward}:null}}_getLogId(){return`NodeUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}TRANSACTION_REGISTRY.set("nodeUpdate",NodeUpdateTransaction._fromProtobuf);const HOST_AND_PORT=/^(\S+):(\d+)$/;class ManagedNodeAddress{constructor(e={}){if(null!=e.address){const t=HOST_AND_PORT.exec(e.address);if(null==t)throw new Error(`failed to parse address: ${e.address}`);this._address=t[1],this._port=null!=t[2]?parseInt(t[2]):null}else{if(null==e.host||null==e.port)throw new Error(`failed to create a managed node address: ${JSON.stringify(e)}`);this._address=e.host,this._port=e.port}Object.freeze(this)}static fromString(e){return new ManagedNodeAddress({address:e})}toInsecure(){let e=50212===this.port?50211:this.port;return new ManagedNodeAddress({host:this.address,port:e})}toSecure(){let e=50211===this.port?50212:this.port;return new ManagedNodeAddress({host:this.address,port:e})}get address(){return this._address}get port(){return this._port}isTransportSecurity(){return 50212==this._port||443==this._port}toString(){return null==this.port?this.address:`${this.address}:${this.port}`}}class ManagedNode{constructor(e={}){if(null!=e.newNode)this._address="string"==typeof e.newNode.address?ManagedNodeAddress.fromString(e.newNode.address):e.newNode.address,this._cert=void 0,this._channel=null,this._channelInitFunction=e.newNode.channelInitFunction,this._lastUsed=Date.now(),this._readmitTime=Date.now(),this._useCount=0,this._badGrpcStatusCount=0,this._minBackoff=8e3,this._maxBackoff=36e5,this._currentBackoff=this._minBackoff;else{if(null==e.cloneNode)throw new Error(`failed to create ManagedNode: ${JSON.stringify(e)}`);this._address=e.cloneNode.address,this._cert=e.cloneNode.node._cert,this._channel=e.cloneNode.node._channel,this._channelInitFunction=e.cloneNode.node._channelInitFunction,this._currentBackoff=e.cloneNode.node._currentBackoff,this._lastUsed=e.cloneNode.node._lastUsed,this._readmitTime=e.cloneNode.node._readmitTime,this._useCount=e.cloneNode.node._useCount,this._badGrpcStatusCount=e.cloneNode.node._badGrpcStatusCount,this._minBackoff=e.cloneNode.node._minBackoff,this._maxBackoff=e.cloneNode.node._minBackoff}}getKey(){throw new Error("not implemented")}setCert(e){return this}get address(){return this._address}get attempts(){return this._badGrpcStatusCount}get minBackoff(){return this._minBackoff}setMinBackoff(e){return this._currentBackoff<=e&&(this._currentBackoff=e),this._minBackoff=e,this}get maxBackoff(){return this._maxBackoff}setMaxBackoff(e){return this._currentBackoff<=e&&(this._currentBackoff=e),this._maxBackoff=e,this}getChannel(){return this._useCount++,this.__lastUsed=Date.now(),null!=this._channel||(this._channel=this._channelInitFunction(this.address.toString(),this._cert)),this._channel}isHealthy(){return this._readmitTime<=Date.now()}increaseBackoff(){this._currentBackoff=Math.min(2*this._currentBackoff,this._maxBackoff),this._readmitTime=Date.now()+this._currentBackoff}decreaseBackoff(){this._currentBackoff=Math.max(this._currentBackoff/2,this._minBackoff)}getRemainingTime(){return this._readmitTime-this._lastUsed}backoff(){return new Promise(e=>setTimeout(e,this.getRemainingTime()))}compare(e){let t=this.getRemainingTime()-e.getRemainingTime();return 0!=t?t:(t=this._currentBackoff-e._currentBackoff,0!=t?t:(t=this._badGrpcStatusCount-e._badGrpcStatusCount,0!=t?t:(t=this._useCount-e._useCount,0!=t?t:this._lastUsed-e._lastUsed)))}close(){null!=this._channel&&this._channel.close(),this._channel=null}}class Node extends ManagedNode{constructor(e={}){if(super(e),null!=e.newNode)this._accountId=e.newNode.accountId,this._nodeAddress=null;else{if(null==e.cloneNode)throw new Error(`failed to create node: ${JSON.stringify(e)}`);this._accountId=e.cloneNode.node._accountId,this._nodeAddress=e.cloneNode.node._nodeAddress}}getKey(){return this._accountId.toString()}toInsecure(){return new Node({cloneNode:{node:this,address:this._address.toInsecure()}})}toSecure(){return new Node({cloneNode:{node:this,address:this._address.toSecure()}})}get accountId(){return this._accountId}get nodeAddress(){return this._nodeAddress}setNodeAddress(e){return this._nodeAddress=e,this}}const PREVIEWNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$7("0ad0070a0e33352e3233312e3230382e31343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340acf070a0d332e3231312e3234382e31373210a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ace070a0c34302e3132312e36342e343810a388031a05302e302e3322cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039663166386131323163326664366337366664353038643365343239663063363462636234346338326137303537333535326161646361643037313536396537323139353866356135643039663935383766666166636662653533343161326630313134616361653334366566336339303231336433343336656262323766343335306339393063356338633366386531653336373037626330386434323536303832336533663234653039613033616430393535613530393830313936323964643034623237623235316463653035356633646463623061343164363666303934316230623837636466653334393864343630333861623564663036663632613561646530383539383537336138386338663538363064633134393261366531383634383561396231333235306536643137623830636433396335633831393130396537336361373332646232336566386261613737366563383563653030393162656362326564656662616135656433653564626662643166383835613466613838316166336631343461386135363538353335333364383933393335393230383662326431643336326534356266653166623435363833616261366336343039373961643662343638373731383437323663366562643538623265616538356337636665336662616265663566366363656438353030333462333834373230366332643637386333363138373630323662386433353165303032616635653066666536663562316632393566646332663436396361613264323338316561306234386361393837636332633865363335653862313963653565313732613933373631613864343930613961343531386437323535383830613134643737623762613737343839326239326134306262383133363265333466633664353137386439623330313132393334323035636237376662396132383234323733393435363461383535346561343732383661343766383632333965373563393437383963653938633939383434373832343632393434663631333136376437623530323033303130303031320218033a606666643661646137346133613334613930346265613437363033303836663862656633623662653138616265643434633464343065313266623133306239376264366238353561656335643062393062306238633733353464356633623065340ad1070a0d33352e3139392e31352e31373710a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad1070a0d332e3133332e3231332e31343610a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad0070a0c34302e37302e31312e32303210a388031a05302e302e3422cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633535376166353739666138333530316265383939623238393037373635626664666364353261623433326230313935613166316563643836666330306162366335353039623066646439376564643363623563656135366132393566333132616262353530383331646266393633663435303131386234666363366532326366343637363230306365396363386564666262663535386463363966303234323634616437643364616232336265643231333363323734653639333434383931353564623130383766393033373039303563363431383561363231316463373432666239613639303964383231383639343762323737343633646662336666306163643437656666313265616431663639373265663263313230333739336334356537373537356265346661313130633765343066613864623963363138376431313366343730343031343137393037316162663539626537643262306465383264653432313564633235353036623163396332366534393137343031633939373530366533373765366266303362363838373237653739343066616436396335653064613363643563626432626537373733353061656132643064343765393761343438633834626536636531333464363462656530393835633239313632663463316535363763636139336430366133633162653861626365333562353537666237376634666536373161363664656337393037353664306538383138313635663262616361613839316161653761633734333766633731373562366562366465623734373233373837353162623662663962306531343833663936363865396664626435363034633339623134643965326265646565633834366139383064373034643137316537626134623766636431613330643934356361313266343761333235643933393861613138663937303636303534643464313566633839393465326465626537336539323731643534383638336636316561343466623235303731653335313861373865643365623337653731613036393166323637303230333031303030312801320218043a606630643934616363663664666633373238373463396462643864373939326562333137616635303031636134313936616261323635383039636233643230306261393631613534333863336135656430356338336264663963643131356432320ad2070a0e33352e3232352e3230312e31393510a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d35322e31352e3130352e31333010a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad1070a0d3130342e34332e3234382e363310a388031a05302e302e3522cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396261343537623733333035663034613931636334366231623936356334653834313735316162633862313431356130626164666431663332633234383233383661323237323565623765633734646561323165353036313764363438656135616333393337343161623031623865666233323132333962386434666462316466626562396533663339616134363538306464303435643138636134346430303263333764646235323763636534646463333262666337333431393637316634636134343634613366326138346663383563373161636630653561383936323664663639613831343734656431363532396638303161386166613937653433356334653034613936346133353735323732383838343365353866306130356366353135336565343530376232633638623364376662353461653661393561393539633837613132663633306539356337623162336333363935653835383636323431373932366437366331363938336661663631323235303338373435393037653963663133643637633261636435303363613435316338353933336163343131386163633237393830316362393638333439393033313435636564323736323964643038393136333137303933353837613737633232303563666135323534336235336333623665613135623834653364326333306331656437353261343633336333366232356239383933656130326164353632656239623738363862336234663437663461323565333536303634393632616337623235653538323934346630306433303739386132363266393231346438633565373464306138333736636332643662613634653138663565346134306166616336323530363264326361323363643238303037303833323164333833343331346630653538343438353932333236373361333265373061653064373131653331303538316263646231346538373133343639346336653039333066343662333762393664343961363435373339343733333165376535303764396535366465356536313436663266303230333031303030312802320218053a606361363738656263626433646338363438663765643033666235396630653231616636373531336561656535313331386536623534396265356163653930366564633166666132366439336135376163656339626537376634306561656564370ad2070a0e33352e3234372e3130392e31333510a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b35342e3234312e33382e3110a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330acf070a0b31332e38382e32322e343710a388031a05302e302e3622cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633432636361633566626336393166626265626461383766666431653735626463643839323234393463663434666462636365653439373838353231633337386266373764623039333465633064323138336437633531646236366638363463313161623764653161633363346366646331663039336132643666333765326233346362653463383133316639363833616434323837386338336433353534633634356161313637626366623036346138336463343563356231313538343939663964393235383766666637616263643566323231636438313530353438343133303030666136653536353930383962316466643635373636656137386561656466636136623435343535666438616235393834646265333565353739356432633633356561373937346434336538656165346665626666653439326537303762343862316230666336343831616539653039643339313333303039623764323634303265366535326535653931623262333830643838663062653766623462333033653730323139373835303537616139346365393234633439323665393136353639323836653836623362613635316361326130613633646634663639303766656665333438336439336234636531643464303363373134323131313337356232633263353164346562383339653337616635333062326362643666353064346362333665323739333731373064396364646163306163653263633234623830346230613237333531636638333062373635323565323664666239646266343961303536363234613736383632343934653732363364306437306365626165393532393433653535383432663563616431336663663630613265366463663761316435333366336135626235346563323139313863373665353235626132393134363637353833316531376533366336316665383534393838323864303962373632303135343132623265353237383439626165633163666663373764653463323934633535303831316535393866663234646131356133343536396464303230333031303030312803320218063a603234373166336665383134303638316665393139313364326363303633663036356534343930616536326666356435343861356162653133316432616639366362653361633235626265323433363663613466386630653736636639343566330ad0070a0c33352e3233352e36352e353110a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d35342e3137372e35312e31323710a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad0070a0c31332e36342e3137302e343010a388031a05302e302e3722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393032663034393061396237663564326364316330643936633661363939306635373362356630656235626462626133393636316566303233303932343139333434363639393639613638613463373037316433323939393066623137393265393030316362353539386561373163326436363736383234333230656534636162663164643335376165376632616462656463316231623061396439353632333737396234633463376234376334373837613136656537313838633732313731373736323461393236346162333963343166376666306234356138396264613430633461643037633464353936643566303964373035366263623561333566343466393561353963323636653039383932646362653436616435316632643262336539393161386636363538653166326362393463373733656234346334346538393264316535356331303736663136303833313965653635376534306631393239363735343361623432616232323233383664313735383665323533373438646162643032356535306235306165363035303732306532333964363465653666623435303763303631346464346265376166646231333330383930666633613665313736353237633331313661663132396139616335653333366439663630316537313237613664376438323061643266393032646163396232343836363861316261623038643130333432656136396137303937313332666637313230636336346663646537383430633635366261313733326261393565396333363735313137356534656333643834613765306432383834326234316262626264366632386534366333613636333365313832373936356335353832306435306461653262303436356363306434326531393562396431353332653632323565623939386436613439303739613861316364346430313735646533633837663937363134383437623363626231376161333462653832306237623361643938616333666165663939336136373738393734373832633063346165336661626263633433303230333031303030312804320218073a606633353738373364343131346131616566303361646336626136396566616632363930653232376162633136613666633665353034396136336662643936383830303462313465343633633230653338343336613361323464333138326464380ad1070a0d33342e3130362e3234372e363510a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33352e38332e38392e31373110a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad1070a0d31332e37382e3233322e31393210a388031a05302e302e3822cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393164376466666637386634656662653538393034353063356263396533353334626666616461643933666237616662313562633762636636376433643362343133626439393934306464383235363461646130346162326534656466306131633062386662376531613830393265393133386539363062653263633638623562393766353764323831633538373265393761343739666338343833363331363065333836336235376233336534383639623138356163653565333662643433616535666136373863396562363666316634303134373836383236623266386661376530303630663434303563306138663964613732303566663436383361323433666130663331356631616662623461346431343064303232333465343437336662393266636233386633656232386336306366376362666236346530363963313830383665346464363139333839323061653066643763313933653665313034653635623831376564393339386532333232333766646630383332326339636563303964343039393237326137633031356432326234646363393639663665613166353138393032313035646636303039326235356134316234663332623935376235376438346535623232333930356538363938393531373333656139663265323436316563306436353232656538313664353835306661636665623431326366663962393939343361383764633064303436343437636539336239376531366437336239366234323633393632663831666366393435386535373537376337383061366631363135616137613132333236373338653236396262373331663839653839313632326535373765613534343230626630636134366265366663346637316366323638316163303235326161383835653133626536373263643238343539303432376463643133376366333131363235653862656533623038666463616166343635623338376365376362333338313666326331346136623939616337643733343331386366633539623765643933396261666566383739303230333031303030312805320218083a603439333161373832303264353566313062333135373537383563336634333964623638313962643131303033646637626332636539326532396135313762376332313838306465623463303137393537343462353736636434336238343938640ad0070a0c33342e3132352e32332e343910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390acf070a0b35302e31382e31372e393310a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a603634653039383631356266343035663765643561343031333434366238396334383863666364366262323561346136373664633737656561313164333364373032363832663061363961383033306538633537373764306534323230333739390ad1070a0d32302e3135302e3133362e383910a388031a05302e302e3922cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633665313863386662663463643465623130343534326362323061616161323532643935663035326631303836643538316334346164373337626636363736633063336637383961663532363562386166623739623530393132646138346530616663663735343763623166666630386430353237303137656236646335636466383362353139363964343433333661363338376364373062393462663463396261663230323938343065356634663836336437303831663066613831653038363361646564623862383961356461633262623535326436653762396662613232326163323863353730373535333866633935373939323934326433343166613238373665366235303765396365376564353732653863666461356465666133363466646638643865323338323961346363626234373866313165656533623332616238356530373239353163356439343230313135666261333237303733343934663433623566366265626638343135326533353665376231366261373634623761336235326362323733343634303136336265313436356536643166613463366536663636363834613633356339613535366161373130306462653634356466386634633432336165343561303863623335623462633138373838366532323939623563303231306135666261336239343439663438336566393465643932326531653938633131336265313636623839633733353832323433313335643434323330366162653561373162373730313866663333356436646437393534323639376231363832333862393637323766643133333962356638326133623661353937643937363033376165323530363435366338623334653966626633626333323431303434316334626663386562613538353937323534656665626661613738383039613563383835343732396135626137386563653139666338343037646438383934613662633738343430333764383738636163653663313532633265383965386136346230363861366332333765303939393362653830363839303230333031303030312806320218093a60363465303938363135626634303566376564356134303133343436623839633438386366636436626232356134613637366463373765656131316433336437303236383266306136396138303330653863353737376430653432323033373939"))),TESTNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$7("0a7f0a0c33342e39342e3130362e363110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a80010a0d35302e31382e3133322e32313110a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a81010a0e3133382e39312e3134322e32313910a388031a05302e302e33320218033a606131373165336261383334373637343761656232653261633464306531313563616161623931383230336230646665316364656162343433343338666332383961626338626138613661666638336462356631623333343034366461383863380a82010a0d33352e3233372e3131392e353510a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a7f0a0a332e3231322e362e313310a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d35322e3136382e37362e32343110a388031a05302e302e342801320218043a603734303964656332653439346236323765653439633639623239346265316365616562636133666463616633363738396538386663376435623065656635353631663532623832643335313931613339633266626564363032373236373136360a82010a0d33352e3234352e32372e31393310a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a80010a0b35322e32302e31382e383610a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a81010a0c34302e37392e38332e31323410a388031a05302e302e352802320218053a603962313431363538346134613338306262383661366337643732303764386165646462633362363365613330353939383235356263653833353162613462356463613532633932383261353461366265643630646536336365303361616132340a82010a0d33342e38332e3131322e31313610a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35342e37302e3139322e333310a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a81010a0c35322e3138332e34352e363510a388031a05302e302e362803320218063a603634383636383562346536653063623936333437326330316665393939333166643965346334343838376261383334323361653766656564323264363438343834636638613362633563636361366133373338376266393664333836373238300a80010a0b33342e39342e3136302e3410a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e35342e3137362e3139392e31303910a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a82010a0d31332e36342e3138312e31333610a388031a05302e302e372804320218073a603339653930393931356138353238303330313534613663373730393530633762343737376261343031333537633065363138373635343231356363323061616363646438653566663239653963346439356366343130316661363862653435630a83010a0e33342e3130362e3130322e32313810a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a82010a0d33352e3135352e34392e31343710a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a81010a0c31332e37382e3233382e333210a388031a05302e302e382805320218083a606134343837346137616131623337373431613037316164616165373866623135326236393664316335386438646566626531643832333034353332613063303139656539366363313964373536383635373864333961316536633331613165650a83010a0e33342e3133332e3139372e32333010a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e31342e3235322e32303710a388031a05302e302e392806320218093a603639383332613733613336303265386431666265356164353864316332363337613162363732643731656538376166313064623634386562393161666232323832353362316634376535376433643461343466663534376233333934616132320a82010a0d35322e3136352e31372e32333110a388031a05302e302e392806320218093a60363938333261373361333630326538643166626535616435386431633236333761316236373264373165653837616631306462363438656239316166623232383235336231663437653537643364346134346666353437623333393461613232"))),MAINNET_ADDRESS_BOOK=NodeAddressBook._fromProtobuf(libExports.proto.NodeAddressBook.decode(decode$7("0ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030633435363165336332373863643635306538306334313363613434343233633163336331336366313437356636663639373664353937616534333262343961623432303836623739623834313332363035346238623364636635376438666364373962666330353831383363613234636434633163626335373465643131313765326635623762336336336365376230366439623465666366373337353633376234316665366635336338313162396465363134336633613532393537636466393536373735313230623333373033666635373632313430376162393537356263326433356330643434663039383366633165663633613466663532303966303730633932616631303632393536303163393662636564303634656331393031393730313963363831316334633864643830636234663461633731663961643736653761633839343536666266346630313166393061626432643930353336653832333436353166366265663932376533643564386237626634353930353039383362656361336162656632613964393761663334353737326137373430653936393932373562303138656130646632383661646436636539323365663930386662653736326137356632313131363836326462343464336463613164343462346432653864633130363663353030366262356137643935346164323535643462363033323733343735653531316165623438356430363961303637633061623563323435333863393333633036623561366165666139343030356332393135323133653463636461653663393432663632373266396464353238326436623839306631663230656664323339396364363734393234666135373034366163366461333265373339353161373331313365393166633262376666323965343835316238336666333966383362613965633666303863656664626236636262626666616266646661613931643933306637323030646134383133376333393463626431336537303165636463323631366664323162616436383161613466303031303230333031303030312804320218073a603665396138616263646364653665313134396133656265313766643538643839303538333961383664623732623036613365613230616131373666383638623235343838353261653432336437613963366237636666396537313436323961320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613163343037373135343330336363373263346662373639326333663934323531626465633132333961316637613839373261626539316133353332336662656361363235613766666165363430366338353564633261663231313039303062306466306536653664623736333634646661316666653835656461353637393336653239383562383536333461333261613532613635393964643663333062653166376136633562386635656563616632363231643861343539363832666364326462616164313536316431316633336663636237663535303061633536386431363564626561616365333238366432383934663634313239643738316436633732666437643539396339653164336166346161343333633233623931306661653463343834313634316636313532366164373837656265613533393837343136376539643361373363633066623135363432396431356563373633613664306630363131356137396239616637383364373762393864383330393661613437343366393734303864396531346263663464646666653435393137363838343762343063623864613763613337353235366432623933356430393566653235326661653831666636653337663834643761393064376535373061346638656633633764373636656564613437326630393230313939303135613839303832353961383733633534353466636262646361643265353238646538353435356234303833633764633461646335613938386530636464666463313539643564373132616264353434616137336563303239303839383134633938613434663236666330363434363539633138336533313834616132373266386431646330626661336530613536303438346362303535626134646262356363333339656338306264313164363432646333613730326538633730336162323139333038346439626436336630646665313261343333633235373665616637383163666164383637656637306264613631373638623262656631346635306336633362386230393666303230333031303030312805320218083a606464336233653763643361323537643832373665343635333533363162303138623730303931663438363635653832303031306538316563303539326236396264346265316662643765636435303964303730313364643034313238343266640ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623263636163363561643066633736343561383137626661626334383761643765343133313165376133313938623337666238343264383463333935623366363764366264383438663130633666303363323930653866376461613864303031613834343164633335326131393136306133313933653638623832656466313961653637363933613961333364346362383765373839613130373037313535313565613737326361613862383661353639623931633534353038333564396333353466306461636563393766653737303931623435623134373639386237663836303134323264636432323631653932386465346461633963343264636261666466393663303732333362613330323730373666333763393639653865643330623662356438663530333462653764393263353936663862653836316535316663633361323432626639643862653965326139653865306631353565626366663233656666613763643537633130353432383131643830373736633935383535323666646230656161333465653139353564353131313933393066653837336534633034646564643239313635383834623938623436333038373838616537666334643461613461386663396263323637346261333231343933623632343435356164343130633164653731626339356431643931666130663230313431386137393565333039656166323937623639396266323763396661323736336364353963656230323165313662383230306331303630663238313766643833636663373637313833343839343631653335393932393162333830643665393339626161346231393233326136613237326464653635316638303436666463333464623237366137373764366662326265633332353562326363323434623461663536366231303566333063363530366464616530656233646564646366393437626362396336306530303039383466336234613863366334656434626639306263313933326237663934646333616536623336303030386562393032303430663962303230333031303030312802320218053a603561383634313561303861306138323566336232656237353031303135353230326533313234336665343161303333333834653738633138633131653565386632303964343933623062326664343565303662333734663262363964663564370ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613365333762373663366364356636363232643639323434343464313263363737633339356632623539303266336262393862386138623530353561373037373036636130323863643735303630613264383730326432643862303439343762646366653061386331343161613238343462316530366536363139303031326538623633323661623066613331373937336263376362346432393439663231303861613034633462306339316261613537323866356235363232656337356162663537386131663762343165646532613637656264363963313865353831666466396336303230616330646539636132633331663063363436393030333331316662623563653764623439633738376531613764323761613432356565376238346461376536363933396639633830643065383266636535356530326466633862356337383431386132366161343336353036393837313962616663656366306264343930303061646463666134303537303862646265666262313937343964323264616230303765343464343565613233623130366638383334633135326532353036326434636632346666323533353663376562333732393130353339336662343962616239303461303266306630626234313763643931396433353238393031323865366262666634666163396639306465313138613937346632613664643031653033326137396231373866363066613166636262643032623537303466623436323935633135313930383136333733656464363633356338353639373866316239353033663166373362346230626538616261326564316665656164353939353362663832656664653933613334373161626435356364613362613861363733666262333739393734396662303036643030336630653633663636356333343631643261376232396463386232303462613539613635363638613436616532383738663030643166393439306466396532383066656266343331356561303465616135363861336139666434386336326336336236656364613639303230333031303030312803320218063a606434363430333938303337393230373965636364356134343331316361306463323262353065633839356235366535336431326232396637326463366462613363616665326535623831303466626461303338616635623434376430666231320ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393361323135636334613761373232636165396331336162643633366466393963636565633661663964623436623639666135313637313665663530636532343930613938316530396162303139636132636234363831316235623631396431626431643565653666343661343263373737636264656536343261313438346563646635646464333732393634326333386336643433613838353838373434373566353832343434333636346330346466656439623839303435666230383565323563336566636234383431373333656666376335323963313339653639333530633263643739623263386431393637396137313265346538636166643332363735343162383332623365313061303132353564656636396466316539643362386438656166303331316465363764356531326232366464303164626264396433653432643335643964653237313330326530663166363964383763626337616361396538383637653964343238643363616230363636656234393064356662616233306266663366373835643033663230373261343362623962356535343635366135393263623631656166643561356566323834633763616563363666376634373332356363306434633164323766363631643861373438636135303731633036656631333464666639366634303836363838333636643436386132343738303031376530623536616261376661623433623362376330623737393036666165353438326633323831316332393265366231343435346531346238393438303161383661303363633437373934646430643734353237613732653432346564336166613034383939656362396136336632613961653732626537666139383961646630643635613332633835316439383031666334313034386466333335363466633762333137303765633866623830313430666537623761316661313230626131636236363033323463656666623462636332643962623764653063663534633831396632646433626365616465633963323566356531396463396231303230333031303030312806320218093a603365303261363732306334343636353965383633303564353562666565383230623335653635306665636163633535333039373435356532633465303332636339646564313662316262343464336235393262626163623663326266663165360ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303930323539663465336439663066333934323536353438653963373330386231306237333430336363393039346439376164313531623737303631373062393737326365623634643636326563656639303161386437643135643331396135396338623731303731616363643839356237633933363130646336393736663637633465313732396261383337336162376535326133663363386632363534393164646536396436653039393934373065373434353938313133316264393663333665363836353230336662326562643564353065616461666237323633393664656331643931373438393862346539626530346337346433303466656164643963626433323334633362376633333036633939636230633333396663323539363962343164353861326237636663313833326532323664383163313936333939336532323535613038376431363938633033643432313062643634353830363434643039356361373661613137393465646434306331633837623566383261386533396636303365393731313662613034353738653765383033343634393564373835643465663763663737313462396562366635663965306239613934663462373338383436313962393237346434613935656631353735346138396439376566356331613838623664363933653061383065626435333766633963663063613931643163363264393135646537656438313862393532653634633230303239336565386532383461343136613732613365313266633764343233623135386639623439363630636263323436366662656430666564326532346531303266646539343265623463666439346265633436643364393066633038633339666563626130336530636132343634616536363462393739353135626132396531663730326333666537303262653739333739366438656462313761613438633039323930623032343534396630363131663561653233656437653136343432646637643164616432323836633262623039643535323264643365643639386332663032303330313030303128093202180c3a606339373462623938326338313931336237333236643561336639646363343836313261313566376161643032663230376230663130636432303137613666626666353830336537636139626662343730396162323862366230396435623133660ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130303962646438653834666164616133353332666334636530316138613137643463336232333266353061393739306532363236383465646334383233653831356131626435623230656365613762663536653239663662623762383331666233626636656663643134373566306238656435666662306231333835623936643136366236323966303339366138666566356630366534626361323565653461313334306565323633613464396262303230643866343732333036663364383836313338646537613031396530353962643061666339303263636261316132313361653264616136306338613031333735356665306134386530333466356234303233613264616465616138386335343836383335336163376137613364663132623266623634313837373465396231346265366561623863633237623838303132616436313632646137346530656562313631333539303566343337333734646162383538366437353061323662626433616332346165643837386334643533653635313037326338373165393464376163633537356339363733383137333461353366656166346437626136626364643234316363363435386336303837643836333032616132353163303466366435366239633332643764393636323437353065643035353738356430373733663433646330393962323863393232383131343865366338316632393766663964313636653030306163303462333132343138363737356663656637356635656261306331303332626631333064663663643761343632313164306466336530353834643932656136373334396438343930353038656234656638386635346338633364343836646538373139663130666139366665623835636337393630373663613738313331386565326439656439303363613133333630343063353961643931613464326636393865393130386165306564623962316362393561643333623139376666623138626431626138623536636265653261616539353835656365323038613165313462343835363436333032303330313030303128083202180b3a603937303834333033333130373866353638326337663332343464383263336233653238316139313837393537386465656163646363326132656265353431616631383831313561643265383338363565356635643234376234613138633165650ab50722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039303938383635646566326632616233373663376630663733386331643837613237616330316166643030383632306333356362366562666362623063333330303331393361333838633334366433303233313732373031323139336262373666643330303462383634333132633638396566353231336362623930313130313530396465616239346632366137333265363337393239646134633463623332353137653361646262333831316435306163346337376331666365386236353136303632313566333437303766336537323635353435653538633839343630396532383337366264623737373566653330343339653065313539326664636230633365653163333035373733643037326136623839353765616663653161313162653936356564616666333834333336366362366134346563323561383930313036653632343735363766373662353530666461343832626165633633303764363938656338383834316664363666323366323130653437623861396463626136626134653166613731366462333363383065333038313934393664636235653536303966623665376336313533373962646465643432376539323331623932353463326261663934333630386138366436393861653961336338363339646638383764366636623561373133383564323433333864393131613231326266373166316532616363386231383662393665633865363963383662366430353832313737373661303963396336383935336564623539313635373862356132363362326634363965336230633037656164613731613434376565613766386663316262383037343235353536376237663062643165366166623033353837313863393862343239653234623232393835393666633736636636616633393663613934333464373932366563376433376434623932616635366434356665666638313936303935323234613931366331666665366236363765323535666333616338636363656639323064633034346232353030333133326238373830363734326630323033303130303031320218033a603333373339306438666561313434616663313265383132353461323864616336656138323839333833366163303732656666643835653061373734383538306566323830393636343863356137663864626234636538313437363831353133370ab70722cc063330383230316132333030643036303932613836343838366637306430313031303130353030303338323031386630303330383230313861303238323031383130306335376564623966663237366530323362323830323163623164383763646631393636623639386366343865346561616137633639323037376365656538636362323339613463393231353937653865383966376363303564336633313331353738393736633465333134343035643461346530336137323431306335633039636135323761643561383562393938363337653732613332653166626330643535343662323436356539653830366332646435303965623035306162356662323730363366643932383135623164643236383965323131316361656236663534396539346139663030663038323164346361366336613631313766356135333363393236336266303734613330643563626566353064316338633233383762636139373265646564613039383362356430613662353764636230303230303036383238623430653430373662343837306232346261643834303536656535326235663432326538383430303238633235303036333832643865396336363132323566346637366561373265333430363037653966633666336332303433333037366131636138636231356564303361633839363664303530376263646536383165346530323331656539663837643131316537623438616338663934643264383432623532646637336635373363633534313439363437393763363236393638666661653734313866336236313039623561306630396533323233663461346435653335303964643235303133386636626331376266366365636531373539343433306466313830613338653930616466326166666266616430633662386331623837663137386130363164636662666638623932633931363664383734633166663561663466626364626665386539643039393337306464663630626537343736333364333665653465623563643531663665336333333965313531653431626462356135636532633863393761306134336233636434636330383138383463383739663964326633373438343238633835373366313763393066336362643032303330313030303128073202180a3a603734306166366266373339653838336338386633333434633961306638623330316533396463393831633531363365306465326133666634326239396534323665643765353662363766343231383530333834356466363266343963396662300ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030393133316161333638663933343532323966393762363235396363636166666561323365303063643565616430326533663639366331653731346565333933396461643836306533386266393561323937346639656234386539333433663861616334303565613935356430353332336531313762336231633934383133613361663432666538303832633364343362616631626434643833363765393364623030616436393665363237613130333661653533346630313165616435653536663337613666666534346236623965303939343031313932616435363061303334366234316138313030393566356632643766643332643665656236353562613735386336623532366331323933383661663731393763376135336165363033643632323833323235343936316631366430656661383037396137363835363138383862653733333439323231373935366262636166616562623631333563356662623234383464356234613566646630333336616330326532366331363532633162643865616633306461653164366433656230306637623466616238643634373866653864393565623931316466393636613064656134653532326462373662383936363537306563633561663039353136343234663061663566386565363665333836643536353037313339393731363961633337353733626635326664303538646539356162326666363865363831313161623233343035656139363462326262383864303263306631636165643731656364643465346534303835393438373666646238353030626335356337626130323036366530356162393864396637653034363664393730326562353765653337323266386663633835613735353035666633323632313730323838623738383732336164623937653464653536323063633930656164313338326663643735373138383966656662313165363737316263336636663366656231396337616335343238373864303361393032373035323663336565643234393465666635346531353363613966363839303230333031303030312801320218043a603765616236393661623935343336363538626331346666366234626534643932356364353162323230646632613164356336656531363061646166323961353165363934646533656531383463653232656164386437646239333231383266330ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038326465373330363566333466666332393334306435393439643232323062316534333636656435636637633665626436313663663934313661353365613030313766366262313136626664336633646566636331356237613464646630653434643032666536393536383830353365373961373730653230316263663731393333393030333965653866303836643466613734366337653035363931383330316639623565383465333932363238323830383561373962333232626361306235643835666539373232316132366262646532353863363230663064636561303261623165646431366363343961336632616239323838653364643166333764633462366136663731333366663932653534316337316237306432613266363664353537323561623138626638366430303965633364323466356431326530623565363830326431313531333732643462373634656265636234616638326636343934383565633537623561303164633637393538663561303363636161623763626139333534613137333732633133313662613437633935336161663934393031623366386332346536613361666436373538653766336231343363653264643363623037316232613734633932316365653934396134623561366265383739663163373930613662386436336231393264376565323961393439316664643638396139386330613763336436303332306631623461633264363232396466643934653432663361363034386137366265316562393538633861313837336265386433333861656339666335396162376633373632363738393430326331666435393566313930383735373565306265383237666334633061346662336433393361643734613934396363393836626662363463616264646165353339333566366463353630373464623933643737656133623831366264643662653533343439373237323238393835396666333463653531383630616666623632316431303438376463333834336631663836643534303334613633653438613161306430323033303130303031280a3202180d3a606132656363316232616539386264323862633161303864386633373161306434663734356337363864306337373339363235363265333433623235643833343235656565613765663865613134323935333432623865623738643332656333660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303039383735356134303862353332316532363330353230303064366437643461326333613535346435653133383461396362356562663437346165383832633633623438366264303864313434646466316139346365396137643632353139363330303661666461616334353838343666313736343031393566653235333961363536393330656661383534663231343865363865633161303863316334396432303063336633303435666537313437663036643533346334626432363231303063623164643339373339643736306438316130626432306638336632353564323530376434636362313130366235333631386336613934343039633838376361653236326434636565396338363233323134376365633134303465306335376262613733313731333065653339363433383838616633643539386564643832623863363165363561653831613465316135366263303664333937313433613938643431636138376433656634333365663061656162363830313139316233653338343830393638663636623665383836363261663435613965323132393934663638623238386562393637626562393834373863323433653231333663316131353931663036316635626330346232316666326261343862323966313834333130383838373362646665393966386135326539343038393731383536653830346465613630326133313137383663393835363532393633633361333737303332396234303966373466646663373436623232613566383431383931323037316334636538343663396234623332306665646636653962363465326362653338346639613832623661616164346232303930373433316466316133336636393230376135363536303062653831303730643038333239303039393538353961343439386435623539333135626365626566656538303765623061336139343266316364663333363764643434343466646232393838366566636464306265346162653961313838383033393533383735656461333364623732393839663736336230323033303130303031280b3202180e3a603139366237623132303739376364623361396430303362393833643537646131303331303662313733306531376636376532633762616161646234333738396166313639366461313031316232353362636263383630333333383566303332380ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061396462376638626161313236383938666162373839313135613362356438393734346631393765323830343161653039386633653838366336393837313732316531316262306164313166336365393132346161393631643661306463383435663439373635633366616231393935383430323637366635363434363262663238316462613535383837383066303365393035373938653138343236396161613630663761313437323333316532666231646561646438373763383463626362363431636139653563386164366534356263313539636230373966636230643434396364636438643932333963316130343765376234343864613063646361323636313061323566323936643936653734363962363736643461343434353136653761353965383532393361383038366638343063303532383534653032613863623230303264616433353832356265346438336235326661393165386337336666303439373436313438383632373837633131313866393234643331636261633162343466656666323264343336623339373965616466396234336134626661373265313562343735356663616232363065303661323739633362623733626337663136613036306434643532326664343930353830333838616135393564383034343733366535323266363432343931356637383033623735383365303935636466373863333235313936393764653831623839666235303035343735336231613137663961616662303634643834633939326639616231316363626338636231303831346463616635323634616134356632316264656661633832636361636161663335386533313337336565316261346537343032666438613730656130633238636135636337346463343235313063393639636432633435396231656333363838613031656133396139393237313063643232393763393861383462363334386135373738303466646332333464336665313930336532633231653137326461323862353961653665346337653865646438623731633439643730323033303130303031280c3202180f3a603538343661353366343437353239666439636462373830346364333136383865643665656265336236336461326635663231316666626337333731393763663366316366626664613631626537643135313066306539323339383131376637340ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061386365616333363765623166316465356630643965663365616630646639623938343438666532303830383437363536326130363063353163323839373730623463616366653932636236353536393832336539363263326132633966656435336264333663613361313232646531633532356135383266323561346437643632386331613364356264623839333661656365373531306537353534656537303333303235633039326338323865656235373338626530326564393633646138316135393230353633346365393435343537376162383266343066313366316565353565306165373237653233633330323834623166343462393961636534646463356639616337616438386439666132323535393335623234646362613834303036343265313663663235333263306230643638393239303436303837313563343037366634366438346130653066656433366537366363646339363335356537613236313630393435633262353461653236636330306664303832333236333436656565656137646437356639313931316539396462636239396561346163366261303536633333323238643838316438353833316439636338373935393364613137343664643065653935646332623936666539336261666366663263643764393239353864373864663333663230356437313135656439666163346462366634636336306535366135343431646135623562353566613539393939303265393538613662366334346438313064646335363138313234316238376632326630353961363838306538303231373336643031383937646236353434396365383137613233373564303335353163623064653530376336303961306338303330656366346266646562323133633033646161373634613138323162373234333334663731663736386437616563623237373035326137303333373635663037323138303536633738663261383761663138333836643866363161356366636233663262613464643539393135663133643338363334643136393537353730323033303130303031280d320218103a603030306162636435396133306135333838633530306265363832663663613239343034363239356339323735383831633230643334626230643639306564613762333862366262643037613364643166646662366137303434626230396366660ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303061663062393134323537626637613436353563346135306430636164356530613165343538316564363632336630653837333066373936623866323963353831373862636363363933326331666333316633396566343462383264336334336233393837333733373366656362313239353232386130346664353061313466333634366438346665316634363763616562393864343633653239373565393935623864326531653339663362663661646463323561653335643635643032363038653033343535333739363665326162636534396238313462656164336331623735373137346165333063303062306334336539396238303439366237326433633133316631633665346663646130356632383131376566396532386334333033626534643863376530343264353862383363633132313934356132633635653739363263616139313835393338663337353764663763636139356366303262356533313934346133613631396130616333663165333462396230313364346332323463346631653730666439666433363938336566383661646535313833363263633833323263306637623631613961633735666238326537623836643638626330663039396130396131346361633561316438643338663961386137306363333766663563633362626432373432666664313436323535633137316536613137383038333237316463653066646536383165643439326362353962303739366432373031373538333864633539303831303765336136656133663961343036623364313133306363656333623437393165343962626332333136303362343661623264306639336434336265373561623961346437313065613934306532383561376231353362306361376364646565366439646365306164383335306334316439306332313562393538383531356166613061633333363561653037653831663362626233366264626561633462333162636231616134653832353635623937376639646164383564363236656566396161613965663864376533666230323033303130303031280e320218113a603933653238313031303462326231376230303935326235613431303264333365646230343363623136646533616433643364363832363066353562623065353837333765613539343463333338663763386362383863373833336663383630630ab70722cc0633303832303161323330306430363039326138363438383666373064303130313031303530303033383230313866303033303832303138613032383230313831303038633037626533303561643630623930626132646162333962306565373736306531613232663835373532323534306437306230336233663965343837356133613239616230383038386631343466353765623235326534366261353933383564306536643432373031313764613061626331623362383036393463396135303538623836643631646661303665373136373039633838653866656163376333613065316432356663306165626636613866373666636239396638343566653138313436316361623638353862393763336134303237666233373132623134653663303738396465313764343137363435373765353131343137656231363236393265623037616531653733353532333565396262343339303437623663303136313337383265376464366636303464616134363734363631643533393631663436633366616136623765373637363264333733623562353432623739656139363365666266333361633638313938626232623636316366663637363931366566333732616434633236633231366334626334373837633834656333326431383464373763373531383663303963663364396639313433336361393835333131396261623331666136616432366634353365353936643962646563613638613537363962633866656537613533356438306338633666336566623164666232383861623661393739383534623763653833313234656330643130326166663934633362373466396333373839353863323565623933336464353363316538303561313836353464366439313836393930663635373034323966393630663334653862346637666439393732646362666539323430653037346461326433353561356637656639633161663632656635393832613831373435373862396331356334396563353636626461636233306363666365663039636466653730386164343837343234653963316265363533663965653736363065376439343263316566613564613238366531616464616230366139613333663964653934363739356230323033303130303031280f320218123a603934383235313739643163333934303137306233356432363665346366613830643737386335653966356261653764653833666638636334373431663362653336616336336431653761653439373261656466366263316533636632303638390ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030626531376339393634376365633635613434343037623533353835366233633362616566356235346635363561663538623834353662613863376365353335643561633732633631633434633736623363353763386538363438343136333762653130613833636665333963303932343736643064626534643663646364636437323061333062356266656235316130316131386635383263343566366338363939336663663764663138323933356465316438363930363034346463663335313836393335643962643765656137393532333532626562623465663961653066373636316537306134323337616661393839393636383763613438666366633562303064333830376630353462653066613863336266613432353033386265366566323935313634663232663733623765383863393465613962653861613466336132343563383962396431666435313932663761353062393538623265663831303462333666316266386664326366623238633134323138303063316334376534656639386166313530303730636336643639643137653865623932663138613661613161363532363661343935323338643130336638663639356235376563663337333635306130353230303837343537323162656138313536323739363763383037363336356466386334633761376434646438663263333835306331386662613731656236306536653864666264313936653035333766643730623334346563626363353330646663383364613666656466343964353161393034313935303262613964373063643335663163663363303639346532333534663930363466646266353335656232336332376330613433643062373863316638363763363164393836393564386465663762633261313062623636373463323266363661616230613931383133646466323763646238353263353965663739653162396531613037356661366565323761376533373734646266346232363436353432376536643561623931666537663066336137313738346563613138326235303230333031303030312810320218133a603038393039376465663031623037633764393734613537353532353161366161613061666236623332613534353334336432393138653732626164303433323163313131633234643432373538306633626131653236616139643735653632360ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030613561643262373634336130346330353564326638636432353131623135313339666334353537353632313338386534396331313962326633393861636131313066363133393662306338363664653530363335323262623835343032373365313366366439346365316536303433386636616662303061616136343631326637313435653962636538626331613533623934313931336161373663396633613238333366616437636632383563376163326433376639396633633263646234396465346431353165363136373835363466323831663534313432346234316661376335316232613936303232383363376433326565303065623833386461313563333861666339366530363164393763656465323231363566663161613935396631633432373562326430393863343035383661353537396662623363623930303732373034313230613861363661353237306634666366643130383663393233363930613335653766643434356533336163303366313339633638363835353635373063646334616166323231303761366331613434323435366137633663373965653034303930653765356434663636626361363063613166343762366466623534336461633363626631396137373139613866353562366638336234613362386136366436303235366430613436353531666137303234626430353633316238613535383038373732353463326632663236386364633333643264626263666237333365396662653233336262396362353961623331613031343862323365386334323638306666313061663463373961346430383334366662373961393364393632393534386561663162623132343639386661656661346364643732343432633033613034623733333433326637343839303361333235633238336434353661623961653932316165376564333339316535643137383765666463323335343061376238356336393161653837306130376639306231316331336233326365343365616564313562333639363835636534393137376363393835303230333031303030312811320218143a603939666162633461646534653636326336653238323366346139366562323134343034383465356136643064333132623730633036386432326236323936333830376332333361343964626239383361376562623330653737303637373261340ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030386434356332316330633935656636356130323964353263393537666430663835663230313233646130333465363136373164646565353437356630373338326136366336366362346463353035303464646664333735383130383364663864313735373733306564386436663336346466346333366132363531353931393535646132303161323430376661386162396232333133383131323235613064613233306662653338306530393061613536656661346632303265633962343832336636353031643936616336393865626632366161636633656532643166333261373231633934376531303736636633356233373364613164383761333661313532653030653731303131373932323832653832356666313731633538333362383835373062666336646138343439653666393566386231323635616235353531393430333135353364316435373666393363343263306361363061616261633463386464313632643831313466326232313531313538336337323533396665353663343939613932396465336134306130643435633137633538396332643739383863653236656166633932613364333762376561303034326434336530336166613632373162323632353561366363636661653533373138323164383165306230356332353062353966306139303734316130653065383861303965643536633562393738306430393566303930366630623831643531323633393832616165303131333663303732643834346131316436646134623261363163363434653161623137663136666634386565323366656465383435326631653432653264333061303739306332356434323036306531643434613637316132656232336431313466363863373165333366313736646235386136386234333030353462633164323938336132336133326561366666393566613763346438653338306562323936653938623739363865636638343534643831376337333765656135646439323165623836633136633762323933303461346137656362653561336131303230333031303030312812320218153a606537396165396337313933643164326263393433383436346338616135663632323461653835323936366134336239383235383833663766373432633533393562643330393935383761393638363662393233396431656666336165353037610ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030623035616265326162303066646430366339353565383637313062306530366631613932363234613438616431636263386466633666323231323936326230633330666462643238346133376335613337363538623633633336656138313632353631613865346639343663626535373232633032383830316630663238316337306638643838633763303061326632653239663539376237393938363965643833353664663537633437626539393434613261616666363530663962346262613064626335336463383830666462623639656134353139303564323830323230326638653239633034613736643237616632656237633534383438356266336634363934633930633431383130383838383433373932383438383335663738313637303764336538643736663465363766353738306263663038383133633535656336333961396264363234313738663565623134376435303061663335316539656631623165333432343834636132363064623763636261653438366631336366323635623562316162363838303636303038303533623230633364656463653737316339613038613033323061613963653435316562396439383361376234396361613130393666386164633039383331386463333865306537636566306438653564353537613036373536383561316339653235366132626339646261333232623362623331373263663731343037376263333830663861306134333361386266613766626663353966366230393365633862663665393339376330396231386531383034306331623536363836343733376338666137653239373935663361343538386464613763326261623439353636356363346139623833366532656239306336326133666361663539316662356638313830346337363138306536323666613236343461376465333435313164366334363637643938393337653237373333663464316539313338383333353465353466643733353137323165373666376235366333343833333838663461366238376232386165626562303230333031303030312813320218163a603962343038383566313362366163316337353336393262613366313739303061333838333165363934613061663937343934623834333838323039636235656662646339386136646162623265316337313833393166633133356264616163330ab70722cc06333038323031613233303064303630393261383634383836663730643031303130313035303030333832303138663030333038323031386130323832303138313030396463643863306135336539306333353539353734663636323034313137643362353033653530613336643330393766616338343239653663656364333762623534303731383038663265653938323033356638353161306339626532313736333833613232653338633161626131363866333266393035373063623332333363666536323539383736363661663637623531346361656632316662386466366430666364333363663236303662393264646561353533366236303638643836373832653339626435633338343435393931643431396237643165633038353939343132633039343964316332343062333563313464633535323734646261373166666165393336313235613566383139663534313332653234333964346163353539373939366563653835653133646666333336316639313331663536636561633562396635353262343963663666396139616336653564636532646233363934363266393361663830653562353662366538626566613136326130363162346137363839326264633834363437333036633630303835386664643237303332373663326337303434303139386566643766653335343563663261623538306337346366643634343561616637626437663734356363323532656162643236356561626565383632343137313034653639343861353537353666646332323264663061313031353234646531633363303863636630343330313165633766653936346564643834353161313330313437633037333633613335663131666465656638663261326237363137353762343335386666383962373561343864363762646336303930363933653062623836373965636262393366666462336633656439366265633933656634363536653337313661623837636534366361386531323539633866656464653866326631656130663365623263343865393635353164653132333330333435373235663435656436396338353735623531363833616661343732363231383236646232326262326431633466316533363436346139303230333031303030312814320218173a60346630613033333466393737363738313632663830643936376637323139313431333630633062376637663033316233376336396536323137333933336564616434366263626139373636376565373262666435613933346261313532326330")));class ManagedNetwork{constructor(e){this._network=new Map,this._nodes=[],this._healthyNodes=[],this._createNetworkChannel=e,this._ledgerId=null,this._minBackoff=8e3,this._maxBackoff=36e5,this._maxNodeAttempts=-1,this._nodeMinReadmitPeriod=this._minBackoff,this._nodeMaxReadmitPeriod=this._maxBackoff,this._earliestReadmitTime=Date.now()+this._nodeMinReadmitPeriod}setNetworkName(e){return console.warn("Deprecated: Use `setLedgerId` instead"),this.setLedgerId(e)}get networkName(){return console.warn("Deprecated: Use `ledgerId` instead"),null!=this.ledgerId?this.ledgerId.toString():null}setLedgerId(e){return this._ledgerId="string"==typeof e?LedgerId.fromString(e):e,this}get ledgerId(){return null!=this._ledgerId?this._ledgerId:null}_createNodeFromNetworkEntry(e){throw new Error("not implemented")}_getNodesToRemove(e){throw new Error("not implemented")}_removeDeadNodes(){if(this._maxNodeAttempts>0)for(let e=this._nodes.length-1;e>=0;e--){this._nodes[e]._badGrpcStatusCount<this._maxNodeAttempts||this._closeNode(e)}}_readmitNodes(){const e=Date.now();if(this._earliestReadmitTime<=e){let t=Number.MAX_SAFE_INTEGER,n=!0;e:for(let r=0;r<this._nodes.length;r++){for(let o=0;o<this._healthyNodes.length;o++)if(n&&this._nodes[r]._readmitTime>e&&(t=Math.min(this._nodes[r]._readmitTime,t)),this._nodes[r]==this._healthyNodes[o])continue e;n=!1,this._nodes[r]._readmitTime<=e&&this._healthyNodes.push(this._nodes[r])}this._earliestReadmitTime=Math.min(Math.max(t,this._nodeMinReadmitPeriod),this._nodeMaxReadmitPeriod)}}_getNumberOfMostHealthyNodes(e){this._removeDeadNodes(),this._readmitNodes();const t=[];let n=this._healthyNodes.slice();e=Math.min(e,n.length);for(let r=0;r<e;r++){const e=n[Math.floor(Math.random()*n.length)];if(!e)break;t.push(e),n=n.filter(t=>t.getKey()!==e.getKey())}return t}_closeNode(e){const t=this._nodes[e];t.close(),this._removeNodeFromNetwork(t),this._nodes.splice(e,1)}_removeNodeFromNetwork(e){const t=this._network.get(e.getKey());for(let n=0;n<t.length;n++)if(t[n]===e){t.splice(n,1);break}0===t.length&&this._network.delete(e.getKey())}_setNetwork(e){const t=[],n=new Set,r=new Set,o=[],a=new Map;for(const t of this._getNodesToRemove(e))this._closeNode(t);for(const e of this._nodes)t.push(e),n.add(e.getKey()),r.add(e.address.toString());for(const[o,a]of e)n.has(a.toString())&&r.has(o)||t.push(this._createNodeFromNetworkEntry([o,a]));shuffle(t);for(const e of t){if(!e.isHealthy())continue;o.push(e);const t=a.has(e.getKey())?a.get(e.getKey()):[];t.push(e),a.set(e.getKey(),t)}return this._nodes=t,this._healthyNodes=o,this._network=a,this}get maxNodeAttempts(){return this._maxNodeAttempts}setMaxNodeAttempts(e){return this._maxNodeAttempts=e,this}get minBackoff(){return this._minBackoff}setMinBackoff(e){this._minBackoff=e;for(const t of this._nodes)t.setMinBackoff(e);return this}get maxBackoff(){return this._maxBackoff}setMaxBackoff(e){this._maxBackoff=e;for(const t of this._nodes)t.setMaxBackoff(e);return this}get nodeMinReadmitPeriod(){return this._nodeMinReadmitPeriod}setNodeMinReadmitPeriod(e){return this._nodeMinReadmitPeriod=e,this._earliestReadmitTime=Date.now()+this._nodeMinReadmitPeriod,this}get nodeMaxReadmitPeriod(){return this._nodeMaxReadmitPeriod}setNodeMaxReadmitPeriod(e){return this._nodeMaxReadmitPeriod=e,this}getNode(e){if(this._readmitNodes(),null!=e&&null!=e){const t=this._network.get(e.toString());if(t){return t[Math.floor(Math.random()*t.length)]}{const e=Array.from(this._network.keys()),t=e[Math.floor(Math.random()*e.length)],n=this._network.get(t);return n[Math.floor(Math.random()*n.length)]}}if(0==this._healthyNodes.length)throw new Error("failed to find a healthy working node");return this._healthyNodes[Math.floor(Math.random()*this._healthyNodes.length)]}increaseBackoff(e){e.increaseBackoff();for(let t=0;t<this._healthyNodes.length;t++)this._healthyNodes[t]==e&&this._healthyNodes.splice(t,1)}decreaseBackoff(e){e.decreaseBackoff()}close(){for(const e of this._nodes)e.close();this._network.clear(),this._nodes=[]}}class Network extends ManagedNetwork{constructor(e){super(e),this._maxNodesPerTransaction=-1,this._addressBook=null,this._transportSecurity=!1}setNetwork(e){this._setNetwork(new Map(Object.entries(e).map(([e,t])=>[e,"string"==typeof t?AccountId.fromString(t):t])))}setNetworkFromAddressBook(e){const t={},n=this.isTransportSecurity()?50212:50211;for(const r of e.nodeAddresses)for(const e of r.addresses)e.port===n&&null!=r.accountId&&(t[e.toString()]=r.accountId);return this.setNetwork(t),this}get network(){var e={};for(const t of this._nodes)e[t.address.toString()]=t.accountId;return e}setNetworkName(e){switch(super.setLedgerId(e),e){case"mainnet":this._addressBook=MAINNET_ADDRESS_BOOK;break;case"testnet":this._addressBook=TESTNET_ADDRESS_BOOK;break;case"previewnet":this._addressBook=PREVIEWNET_ADDRESS_BOOK}if(null!=this._addressBook)for(const e of this._nodes)for(const t of this._addressBook.nodeAddresses)null!=t.accountId&&t.accountId.toString()===e.accountId.toString()&&e.setNodeAddress(t);return this}get networkName(){return null!=this._ledgerId?this._ledgerId.toString():null}_createNodeFromNetworkEntry(e){const t="string"==typeof e[1]?AccountId.fromString(e[1]):e[1];return new Node({newNode:{address:e[0],accountId:t,channelInitFunction:this._createNetworkChannel}}).setMinBackoff(this._minBackoff)}_getNodesToRemove(e){const t=[];for(let n=this._nodes.length-1;n>=0;n--){const r=this._nodes[n],o=e.get(r.address.toString());null!=o&&o.toString()===r.accountId.toString()||t.push(n)}return t}_checkNetworkContainsEntry(e){for(const t of this._nodes)if(t.address.toString()===e[0])return!0;return!1}get maxNodesPerTransaction(){return this._maxNodesPerTransaction}setMaxNodesPerTransaction(e){return this._maxNodesPerTransaction=e,this}get maxNodeAttempts(){return this._maxNodeAttempts}setMaxNodeAttempts(e){return this._maxNodeAttempts=e,this}isTransportSecurity(){return this._transportSecurity}setTransportSecurity(e){if(this._transportSecurity==e)return this;this._network.clear();for(let t=0;t<this._nodes.length;t++){let n=this._nodes[t];n.close(),n=e?n.toSecure().setCert(null!=this._ledgerId?this._ledgerId.toString():""):n.toInsecure(),this._nodes[t]=n;const r=null!=this._network.get(n.getKey())?this._network.get(n.getKey()):[];r.push(n),this._network.set(n.getKey(),r)}return this._healthyNodes=[...this._nodes],this._transportSecurity=e,this}getNumberOfNodesForTransaction(){return this._maxNodesPerTransaction>0?this._maxNodesPerTransaction:this._nodes.length}getNodeAccountIdsForExecute(){return this._getNumberOfMostHealthyNodes(this.getNumberOfNodesForTransaction()).map(e=>e.accountId)}}class MirrorNode extends ManagedNode{constructor(e={}){super(e)}getKey(){return this._address.toString()}get mirrorRestApiBaseUrl(){const e=this.address.address,t=this.address.port;if(!e||!t)throw new Error("Mirror node has invalid address configuration");if("localhost"===e||"127.0.0.1"===e)return`http://${e}:5551/api/v1`;return`${this._getSchemeFromHostAndPort(e,t)}://${e}:${t}/api/v1`}_getSchemeFromHostAndPort(e,t){return"localhost"===e||"127.0.0.1"===e||80===t?"http":"https"}}let MirrorNetwork$1=class extends ManagedNetwork{constructor(e){super(e)}setNetwork(e){this._setNetwork(new Map(e.map(e=>[e,e])))}get network(){var e=[];for(const t of this._nodes)e.push(t.address.toString());return e}_createNodeFromNetworkEntry(e){return new MirrorNode({newNode:{address:e[1],channelInitFunction:this._createNetworkChannel}}).setMinBackoff(this._minBackoff)}_getNodesToRemove(e){const t=[],n=Object.values(e);for(let e=this._nodes.length-1;e>=0;e--){const r=this._nodes[e];n.includes(r.address.toString())||t.push(e)}return t}getNextMirrorNode(){return this._getNumberOfMostHealthyNodes(1)[0]}get mirrorRestApiBaseUrl(){try{return this.getNextMirrorNode().mirrorRestApiBaseUrl}catch(e){throw new Error("Client has no mirror network configured or no healthy mirror nodes are available")}}};const DEFAULT_GRPC_DEADLINE=1e4,DEFAULT_MAX_ATTEMPTS=10,DEFAULT_LOCAL_MAX_ATTEMPTS=1e3,DEFAULT_REQUEST_TIMEOUT=12e4,MAINNET={"node00.swirldslabs.com:443":new AccountId(3),"node01-00-grpc.swirlds.com:443":new AccountId(4),"node03.swirldslabs.com:443":new AccountId(6),"node04.swirldslabs.com:443":new AccountId(7),"node05.swirldslabs.com:443":new AccountId(8),"node06.swirldslabs.com:443":new AccountId(9),"node07.swirldslabs.com:443":new AccountId(10),"node09.swirldslabs.com:443":new AccountId(12),"node10.swirldslabs.com:443":new AccountId(13),"node11.swirldslabs.com:443":new AccountId(14),"node12.swirldslabs.com:443":new AccountId(15),"node14.swirldslabs.com:443":new AccountId(17),"node15.swirldslabs.com:443":new AccountId(18),"node16.swirldslabs.com:443":new AccountId(19),"node17.swirldslabs.com:443":new AccountId(20),"node18.swirldslabs.com:443":new AccountId(21),"node19.swirldslabs.com:443":new AccountId(22),"node20.swirldslabs.com:443":new AccountId(23),"node21.swirldslabs.com:443":new AccountId(24),"node22.swirldslabs.com:443":new AccountId(25),"node24.swirldslabs.com:443":new AccountId(27),"node25.swirldslabs.com:443":new AccountId(28),"node26.swirldslabs.com:443":new AccountId(29),"node27.swirldslabs.com:443":new AccountId(30),"node28.swirldslabs.com:443":new AccountId(31),"node29.swirldslabs.com:443":new AccountId(32),"node30.swirldslabs.com:443":new AccountId(33),"node31.swirldslabs.com:443":new AccountId(34),"node32.swirldslabs.com:443":new AccountId(35),"node33.swirldslabs.com:443":new AccountId(36),"node34.swirldslabs.com:443":new AccountId(37)},WEB_TESTNET={"testnet-node00-00-grpc.hedera.com:443":new AccountId(3),"testnet-node01-00-grpc.hedera.com:443":new AccountId(4),"testnet-node02-00-grpc.hedera.com:443":new AccountId(5),"testnet-node03-00-grpc.hedera.com:443":new AccountId(6),"testnet-node04-00-grpc.hedera.com:443":new AccountId(7),"testnet-node05-00-grpc.hedera.com:443":new AccountId(8),"testnet-node06-00-grpc.hedera.com:443":new AccountId(9)},WEB_PREVIEWNET={"previewnet-node00-00-grpc.hedera.com:443":new AccountId(3),"previewnet-node01-00-grpc.hedera.com:443":new AccountId(4),"previewnet-node02-00-grpc.hedera.com:443":new AccountId(5),"previewnet-node03-00-grpc.hedera.com:443":new AccountId(6),"previewnet-node04-00-grpc.hedera.com:443":new AccountId(7),"previewnet-node05-00-grpc.hedera.com:443":new AccountId(8),"previewnet-node06-00-grpc.hedera.com:443":new AccountId(9)};new AccountId(3),new AccountId(3),new AccountId(3);const LocalNodeWebNetwork={"localhost:8080":new AccountId(3)},ALL_WEB_NETWORK_NODES={...MAINNET,...WEB_TESTNET,...WEB_PREVIEWNET},MirrorNetwork={fromName(e){switch(e){case"mainnet":return MirrorNetwork.MAINNET;case"testnet":return MirrorNetwork.TESTNET;case"previewnet":return MirrorNetwork.PREVIEWNET;case"local-node":return MirrorNetwork.LOCAL_NODE;default:throw new Error(`unknown network name: ${e}`)}},MAINNET:["mainnet-public.mirrornode.hedera.com:443"],TESTNET:["testnet.mirrornode.hedera.com:443"],PREVIEWNET:["previewnet.mirrornode.hedera.com:443"],LOCAL_NODE:["127.0.0.1:5600"]},WebMirrorNetwork={...MirrorNetwork,LOCAL_NODE:["127.0.0.1:5551"]},WebNetwork={MAINNET:MAINNET,TESTNET:WEB_TESTNET,PREVIEWNET:WEB_PREVIEWNET,LOCAL_NODE:LocalNodeWebNetwork},DEFAULT_PAGE_SIZE=25;class AddressBookQueryWeb extends Query{constructor(e={}){super(),this._fileId=null,null!=e.fileId&&this.setFileId(e.fileId),this._limit=null,null!=e.limit&&this.setLimit(e.limit),this._retryHandler=e=>{if(null!=e){if(e instanceof Error)return!0;switch(e.code){case 13:return RST_STREAM.test(e.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},this._addresses=[]}get fileId(){return this._fileId}setFileId(e){return this._fileId="string"==typeof e?FileId.fromString(e):e.clone(),this}get limit(){return this._limit}setLimit(e){return this._limit=e,this}setMaxAttempts(e){return this._maxAttempts=e,this}setMaxBackoff(e){return this._maxBackoff=e,this}execute(e,t){return new Promise((n,r)=>{this._makeFetchRequest(e,n,r,t)})}async _makeFetchRequest(e,t,n,r){const{port:o,address:a}=e._mirrorNetwork.getNextMirrorNode().address;let i=`${a.includes("127.0.0.1")||a.includes("localhost")?"http":"https"}://${a}`;o&&(i=`${i}:${o}`),this._addresses=[];let s=null,c=!1;const u=new URL(`${i}/api/v1/network/nodes`);null!=this._fileId&&u.searchParams.append("file.id",this._fileId.toString());const l=null!=this._limit?this._limit:DEFAULT_PAGE_SIZE;u.searchParams.append("limit",l.toString());const d=this._maxAttempts??e.maxAttempts;for(;!c;){const t=s?new URL(s,i):u;for(let o=0;o<=d;o++)try{const n=await fetch(t.toString(),{method:"GET",headers:{Accept:"application/json"},signal:r?AbortSignal.timeout(r):void 0});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const o=await n.json(),a=(o.nodes||[]).map(t=>NodeAddress.fromJSON({nodeId:t.node_id.toString(),accountId:t.node_account_id,addresses:this._handleAddressesFromGrpcProxyEndpoint(t,e),certHash:t.node_cert_hash,publicKey:t.public_key,description:t.description,stake:t.stake?.toString()}));this._addresses.push(...a),s=o.links?.next||null,s||(c=!0);break}catch(t){console.error("Error in _makeFetchRequest:",t);const r=t instanceof Error?t.message:String(t);if(o<d&&!e.isClientShutDown&&this._retryHandler(t)){const e=Math.min(250*2**o,this._maxBackoff);this._logger&&this._logger.debug(`Error getting nodes from mirror for file ${null!=this._fileId?this._fileId.toString():"UNKNOWN"} during attempt ${o+1}. Waiting ${e} ms before next attempt: ${r}`),await new Promise(t=>setTimeout(t,e));continue}return void n(new Error(o>=d?`Failed to query address book after ${d+1} attempts. Last error: ${r}`:`Failed to query address book: ${r}`))}}t(new NodeAddressBook({nodeAddresses:this._addresses}))}_handleAddressesFromGrpcProxyEndpoint(e,t){const n=e.grpc_proxy_endpoint;if(n&&n.domain_name&&n.port)return[{address:n.domain_name,port:n.port.toString()}];let r;const o=t._network.ledgerId;if(o&&o.isMainnet())r=MAINNET;else if(o&&o.isTestnet())r=WEB_TESTNET;else{if(!o||!o.isPreviewnet())return[];r=WEB_PREVIEWNET}const a=e.node_account_id;for(const[e,t]of Object.entries(r))if(t.toString()===a){const[t,n]=e.split(":");return[{address:t,port:n}]}return[]}}class Client{constructor(e){this._mirrorNetwork=new MirrorNetwork$1(this._createMirrorNetworkChannel()),this._network=new Network(this._createNetworkChannel()),this._operator=null,this._defaultMaxTransactionFee=null,this._defaultMaxQueryPayment=new Hbar(1),null!=e&&null!=e.operator&&this.setOperator(e.operator.accountId,e.operator.privateKey),this._maxAttempts=null!=e&&this._isLocalNetwork(e.network)?DEFAULT_LOCAL_MAX_ATTEMPTS:DEFAULT_MAX_ATTEMPTS,this._signOnDemand=!1,this._autoValidateChecksums=!1,this._minBackoff=250,this._maxBackoff=8e3,this._defaultRegenerateTransactionId=!0,this._allowReceiptNodeFailover=!1,this._requestTimeout=DEFAULT_REQUEST_TIMEOUT,this._grpcDeadline=DEFAULT_GRPC_DEADLINE,this._isUpdatingNetwork=!1,this._networkUpdatePeriod=864e5,this._isShutdown=!1,this._shard=0,this._realm=0,null!=e&&!1!==e.scheduleNetworkUpdate&&this._scheduleNetworkUpdate(),null!=e&&null!=e.shard&&(this._shard=e.shard),null!=e&&null!=e.realm&&(this._realm=e.realm),null!=e&&null!=e.grpcDeadline&&this.setGrpcDeadline(e.grpcDeadline),null!=e&&null!=e.requestTimeout&&this.setRequestTimeout(e.requestTimeout),this._requestTimeout<=this._grpcDeadline&&console.warn(`DEPRECATION WARNING: requestTimeout (${this._requestTimeout}ms) should be larger than grpcDeadline (${this._grpcDeadline}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._timer,this._logger=null}setNetworkName(e){return console.warn("Deprecated: Use `setLedgerId` instead"),this.setLedgerId(e)}get networkName(){return console.warn("Deprecated: Use `ledgerId` instead"),null!=this.ledgerId?this.ledgerId.toString():null}setLedgerId(e){return this._network.setLedgerId("string"==typeof e?LedgerId.fromString(e):e),this}get ledgerId(){return null!=this._network._ledgerId?this._network.ledgerId:null}setNetwork(e){throw new Error("not implemented")}setNetworkFromAddressBook(e){return this._network.setNetworkFromAddressBook(e),this}get network(){return this._network.network}get shard(){return this._shard}get realm(){return this._realm}get isLocalNetwork(){return this._isLocalNetwork()}_isLocalNetwork(e=this.network){return"string"==typeof e?"local-node"===e:null!=e&&Object.keys(e).some(e=>e.includes("127.0.0.1")||e.includes("localhost"))}setMirrorNetwork(e){throw new Error("not implemented")}get mirrorNetwork(){return this._mirrorNetwork.network}get mirrorRestApiBaseUrl(){return this._mirrorNetwork.mirrorRestApiBaseUrl}get signOnDemand(){return this._signOnDemand}setSignOnDemand(e){this._signOnDemand=e}isTransportSecurity(){return this._network.isTransportSecurity()}setTransportSecurity(e){return this._network.setTransportSecurity(e),this}setOperator(e,t){const n="string"==typeof t?PrivateKey.fromStringDer(t):t;return this.setOperatorWith(e,n.publicKey,e=>Promise.resolve(n.sign(e)))}getOperator(){return this._operator}setOperatorWith(e,t,n){const r=e instanceof AccountId?e:AccountId.fromString(e);return null!=this._network._ledgerId&&r.validateChecksum(this),this._operator={transactionSigner:n,accountId:r,publicKey:t instanceof PublicKey?t:PublicKey.fromString(t)},this}setAutoValidateChecksums(e){return this._autoValidateChecksums=e,this}isAutoValidateChecksumsEnabled(){return this._autoValidateChecksums}get operatorAccountId(){return null!=this._operator?this._operator.accountId:null}get operatorPublicKey(){return null!=this._operator?this._operator.publicKey:null}get defaultMaxTransactionFee(){return this._defaultMaxTransactionFee}get maxTransactionFee(){return this.defaultMaxTransactionFee}setDefaultMaxTransactionFee(e){if(e.toTinybars().toInt()<0)throw new Error("defaultMaxTransactionFee must be non-negative");return this._defaultMaxTransactionFee=e,this}setMaxTransactionFee(e){return this.setDefaultMaxTransactionFee(e)}get defaultRegenerateTransactionId(){return this._defaultRegenerateTransactionId}setDefaultRegenerateTransactionId(e){return this._defaultRegenerateTransactionId=e,this}get allowReceiptNodeFailover(){return this._allowReceiptNodeFailover}setAllowReceiptNodeFailover(e){return this._allowReceiptNodeFailover=e,this}get defaultMaxQueryPayment(){return this._defaultMaxQueryPayment}get maxQueryPayment(){return this.defaultMaxQueryPayment}setDefaultMaxQueryPayment(e){if(convertToNumber(e.toTinybars())<0)throw new Error("defaultMaxQueryPayment must be non-negative");return this._defaultMaxQueryPayment=e,this}setMaxQueryPayment(e){return this.setDefaultMaxQueryPayment(e)}get maxAttempts(){return this._maxAttempts}setMaxAttempts(e){return this._maxAttempts=e,this}get maxNodeAttempts(){return this._network.maxNodeAttempts}setMaxNodeAttempts(e){return this._network.setMaxNodeAttempts(e),this}get nodeWaitTime(){return this._network.minBackoff}setNodeWaitTime(e){return this._network.setMinBackoff(e),this}get maxNodesPerTransaction(){return this._network.maxNodesPerTransaction}setMaxNodesPerTransaction(e){return this._network.setMaxNodesPerTransaction(e),this}setMinBackoff(e){if(null==e)throw new Error("minBackoff cannot be null.");if(e>this._maxBackoff)throw new Error("minBackoff cannot be larger than maxBackoff.");return this._minBackoff=e,this}get minBackoff(){return this._minBackoff}setMaxBackoff(e){if(null==e)throw new Error("maxBackoff cannot be null.");if(e<this._minBackoff)throw new Error("maxBackoff cannot be smaller than minBackoff.");return this._maxBackoff=e,this}get maxBackoff(){return this._maxBackoff}setNodeMinBackoff(e){return this._network.setMinBackoff(e),this}get nodeMinBackoff(){return this._network.minBackoff}setNodeMaxBackoff(e){return this._network.setMaxBackoff(e),this}get nodeMaxBackoff(){return this._network.maxBackoff}setNodeMinReadmitPeriod(e){return this._network.setNodeMinReadmitPeriod(e),this}get nodeMinReadmitPeriod(){return this._network.nodeMinReadmitPeriod}setNodeMaxReadmitPeriod(e){return this._network.setNodeMaxReadmitPeriod(e),this}get nodeMaxReadmitPeriod(){return this._network.nodeMaxReadmitPeriod}setRequestTimeout(e){if(e<=0)throw new Error("requestTimeout must be a positive number");return e<=this._grpcDeadline&&console.warn(`DEPRECATION WARNING: requestTimeout (${e}ms) should be larger than grpcDeadline (${this._grpcDeadline}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._requestTimeout=e,this}get requestTimeout(){return this._requestTimeout}setGrpcDeadline(e){if(e<=0)throw new Error("grpcDeadline must be a positive number");return e>=this._requestTimeout&&console.warn(`DEPRECATION WARNING: grpcDeadline (${e}ms) should be smaller than requestTimeout (${this._requestTimeout}ms). This configuration may cause operations to fail unexpectedly. This will throw an error in the next major version. Please adjust your timeout values.`),this._grpcDeadline=e,this}get grpcDeadline(){return this._grpcDeadline}get networkUpdatePeriod(){return this._networkUpdatePeriod}setNetworkUpdatePeriod(e){return clearTimeout(this._timer),this._networkUpdatePeriod=e,this._scheduleNetworkUpdate(),this}setLogger(e){return this._logger=e,this}get logger(){return this._logger}async ping(e){await new AccountBalanceQuery({accountId:e}).setNodeAccountIds([e instanceof AccountId?e:AccountId.fromString(e)]).execute(this)}async pingAll(){for(const e of Object.values(this._network.network))await this.ping(e)}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const e=await(new AddressBookQueryWeb).setFileId(FileId.getAddressBookFileIdFor(this._shard,this._realm)).execute(this);this.setNetworkFromAddressBook(e)}catch(e){this._logger&&this._logger.trace(`failed to update client address book: ${e.toString()}`)}finally{this._isUpdatingNetwork=!1}return this}close(){this._network.close(),this._mirrorNetwork.close(),this._isShutdown=!0,clearTimeout(this._timer)}_createNetworkChannel(){return()=>{throw new Error("not implemented")}}_createMirrorNetworkChannel(){return()=>{throw new Error("not implemented")}}_scheduleNetworkUpdate(){this._timer=setTimeout(async()=>{await this.updateNetwork(),this._isShutdown||this._scheduleNetworkUpdate()},this._networkUpdatePeriod)}get isClientShutDown(){return this._isShutdown}static _validateNetworkConsistency(e){if(0===Object.keys(e).length)return;const[,t]=Object.entries(e)[0],n=t.toString(),[r,o]=n.split(".").map(Number),a=Object.values(e).every(e=>{const t=e.toString(),[n,a]=t.split(".").map(Number);return n===r&&a===o});if(!a)throw new Error("Network is not valid, all nodes must be in the same shard and realm")}static _extractShardRealm(e){const t=Object.entries(e);if(0===t.length)return{shard:0,realm:0};const[,n]=t[0],r=n.toString(),[o,a]=r.split(".").map(Number);return{shard:o,realm:a}}}const SDK_NAME="hiero-sdk-js",SDK_VERSION="2.83.0-beta.2",{proto:proto}=HieroProto;class Channel{constructor(e=DEFAULT_GRPC_DEADLINE){this._crypto=null,this._smartContract=null,this._file=null,this._consensus=null,this._freeze=null,this._network=null,this._token=null,this._schedule=null,this._util=null,this._addressBook=null,this._grpcDeadline=e}setGrpcDeadline(e){this._grpcDeadline=e}get grpcDeadline(){return this._grpcDeadline}close(){throw new Error("not implemented")}get crypto(){return null!=this._crypto||(this._crypto=proto.CryptoService.create(this._createUnaryClient("CryptoService"))),this._crypto}get smartContract(){return null!=this._smartContract||(this._smartContract=proto.SmartContractService.create(this._createUnaryClient("SmartContractService"))),this._smartContract}get file(){return null!=this._file||(this._file=proto.FileService.create(this._createUnaryClient("FileService"))),this._file}get consensus(){return null!=this._consensus||(this._consensus=proto.ConsensusService.create(this._createUnaryClient("ConsensusService"))),this._consensus}get freeze(){return null!=this._freeze||(this._freeze=proto.FreezeService.create(this._createUnaryClient("FreezeService"))),this._freeze}get network(){return null!=this._network||(this._network=proto.NetworkService.create(this._createUnaryClient("NetworkService"))),this._network}get token(){return null!=this._token||(this._token=proto.TokenService.create(this._createUnaryClient("TokenService"))),this._token}get schedule(){return null!=this._schedule||(this._schedule=proto.ScheduleService.create(this._createUnaryClient("ScheduleService"))),this._schedule}get util(){return null!=this._util||(this._util=proto.UtilService.create(this._createUnaryClient("UtilService"))),this._util}get addressBook(){return null!=this._addressBook||(this._addressBook=proto.AddressBookService.create(this._createUnaryClient("AddressBookService"))),this._addressBook}_createUnaryClient(e){throw new Error("not implemented")}}function encodeRequest(e){const t=new ArrayBuffer(e.byteLength+5);return new DataView(t,1,4).setUint32(0,e.length),new Uint8Array(t,5).set(e),t}function decodeUnaryResponse(e,t=0,n=e.byteLength){const r=new DataView(e,t,n);let o=0,a=null,i=0;for(;o<r.byteLength;){const t=r.getUint8(o+0)>>7,n=r.getUint32(o+1),s=o+5;if(s+n>r.byteLength)throw new Error("(BUG) unexpected frame length past the boundary");const c=new Uint8Array(e,r.byteOffset+s,n);if(0===t){if(null!=a)throw new Error("(BUG) unexpectedly received more than one data frame");a=c}else{if(1!==t)throw new Error(`(BUG) unexpected frame type: ${t}`);{const e=decode(c),[t,n]=e.split(":");if("grpc-status"!==t)throw new Error(`(BUG) unhandled trailer, ${e}`);i=parseInt(n)}}o+=n+5}if(0!==i)throw new Error(`(BUG) unhandled grpc-status: ${i}`);if(null==a)throw new Error("(BUG) unexpectedly received no response");return a}class WebChannel extends Channel{constructor(e,t){super(t),this._address=e,this._isReady=!1,this._healthCheckPromise=null}_shouldUseHttps(e){return!(e.includes("localhost")||e.includes("127.0.0.1")||e.includes(".cluster.local"))}_buildUrl(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;return this._shouldUseHttps(e)?`https://${e}`:`http://${e}`}async _waitForReady(e){if(!this._isReady){if(this._healthCheckPromise)return this._healthCheckPromise;this._healthCheckPromise=this._performHealthCheck(e);try{await this._healthCheckPromise}finally{this._healthCheckPromise=null}}}async _performHealthCheck(e){const t=this._buildUrl(this._address),n=e.getTime()-Date.now();if(n<=0)throw new GrpcServiceError(GrpcStatus.Timeout,ALL_WEB_NETWORK_NODES?.[this._address]?.toString());const r=new AbortController,o=setTimeout(()=>r.abort(),n);try{const e=await fetch(t,{method:"POST",headers:{"content-type":"application/grpc-web+proto","x-user-agent":`${SDK_NAME}/${SDK_VERSION}`,"x-grpc-web":"1"},body:new Uint8Array(0),signal:r.signal});if(clearTimeout(o),e.ok||e.status>=300&&e.status<400){const t=e.headers.get("grpc-status"),n=e.headers.get("grpc-message");if(null!=t||null!=n)return void(this._isReady=!0)}throw new GrpcServiceError(GrpcStatus.Unavailable,ALL_WEB_NETWORK_NODES?.[this._address]?.toString())}catch(e){if(clearTimeout(o),e instanceof Error&&"AbortError"===e.name)throw new GrpcServiceError(GrpcStatus.Timeout,ALL_WEB_NETWORK_NODES?.[this._address]?.toString());if(e instanceof GrpcServiceError)throw e;throw new GrpcServiceError(GrpcStatus.Unavailable,ALL_WEB_NETWORK_NODES?.[this._address]?.toString())}}close(){}_createUnaryClient(e){return async(t,n,r)=>{const o=new Date,a=this._grpcDeadline;o.setMilliseconds(o.getMilliseconds()+a);try{await this._waitForReady(o);const a=this._buildUrl(this._address),i=await fetch(`${a}/proto.${e}/${t.name}`,{method:"POST",headers:{"content-type":"application/grpc-web+proto","x-user-agent":`${SDK_NAME}/${SDK_VERSION}`,"x-grpc-web":"1"},body:encodeRequest(n)});if(!i.ok){return void r(new HttpError(HttpStatus._fromValue(i.status)),null)}const s=i.headers.get("grpc-status"),c=i.headers.get("grpc-message");if(null!=s&&null!=c){const e=new GrpcServiceError(GrpcStatus._fromValue(parseInt(s)),ALL_WEB_NETWORK_NODES?.[this._address]?.toString());return e.message=c,void r(e,null)}const u=await i.arrayBuffer();r(null,decodeUnaryResponse(u))}catch(e){if(e instanceof GrpcServiceError)return void r(e,null);r(new GrpcServiceError(GrpcStatus._fromValue(18),ALL_WEB_NETWORK_NODES?.[this._address]?.toString()),null)}}}}class WebClient extends Client{constructor(e){if(super(e),null!=e){if("string"==typeof e.network)this._setNetworkFromName(e.network);else if(null!=e.network){Client._validateNetworkConsistency(e.network);const{shard:t,realm:n}=Client._extractShardRealm(e.network);this._shard=t,this._realm=n,this.setNetwork(e.network)}if("string"==typeof e.mirrorNetwork)switch(e.mirrorNetwork){case"mainnet":this.setMirrorNetwork(WebMirrorNetwork.MAINNET);break;case"testnet":this.setMirrorNetwork(WebMirrorNetwork.TESTNET);break;case"previewnet":this.setMirrorNetwork(WebMirrorNetwork.PREVIEWNET);break;default:this.setMirrorNetwork([e.mirrorNetwork])}else null!=e.mirrorNetwork&&this.setMirrorNetwork(e.mirrorNetwork)}}static fromConfig(e){return new WebClient("string"==typeof e?JSON.parse(e):e)}static forNetwork(e){return new WebClient({network:e})}static forName(e){return new WebClient({network:e})}static forMainnet(){return new WebClient({network:"mainnet"})}static forTestnet(){return new WebClient({network:"testnet"})}static forPreviewnet(){return new WebClient({network:"previewnet"})}static forLocalNode(e={scheduleNetworkUpdate:!1}){return new WebClient({network:"local-node",...e})}static async forMainnetAsync(){return new WebClient({network:"mainnet"}).updateNetwork()}static async forTestnetAsync(){return new WebClient({network:"testnet"}).updateNetwork()}static async forPreviewnetAsync(){return new WebClient({network:"previewnet"}).updateNetwork()}static async forNameAsync(e){const t=new WebClient({network:e});return"local-node"!==e&&await t.updateNetwork(),t}static async forMirrorNetwork(e){const t=new WebClient({mirrorNetwork:e});return await t.updateNetwork(),t}setNetwork(e){if("string"==typeof e)switch(e){case"previewnet":this._network.setNetwork(WebNetwork.PREVIEWNET);break;case"testnet":this._network.setNetwork(WebNetwork.TESTNET);break;case"mainnet":this._network.setNetwork(WebNetwork.MAINNET);break;case"local-node":this._network.setNetwork(WebNetwork.LOCAL_NODE)}else{for(const[t]of Object.entries(e))(t.startsWith("https://")||t.startsWith("http://"))&&console.warn('[Deprecation Notice] Hiero SDK: Network endpoint "'+t+'" includes a URL scheme (e.g. "https://"). This format was accepted in earlier versions but is now deprecated. Please remove the scheme and use "host:port" instead (e.g. "node00.swirldslabs.com:443"). Support for scheme-prefixed endpoints will be removed in a future major release.');this._network.setNetwork(e)}}setMirrorNetwork(e){if("string"==typeof e)switch(e){case"local-node":this._mirrorNetwork.setNetwork(WebMirrorNetwork.LOCAL_NODE);break;case"previewnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.PREVIEWNET);break;case"testnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.TESTNET);break;case"mainnet":this._mirrorNetwork.setNetwork(WebMirrorNetwork.MAINNET);break;default:this._mirrorNetwork.setNetwork([e])}else this._mirrorNetwork.setNetwork(e);return this}_setNetworkFromName(e){switch(e){case"mainnet":this.setNetwork(WebNetwork.MAINNET),this.setMirrorNetwork(WebMirrorNetwork.MAINNET),this.setLedgerId(LedgerId.MAINNET);break;case"testnet":this.setNetwork(WebNetwork.TESTNET),this.setMirrorNetwork(WebMirrorNetwork.TESTNET),this.setLedgerId(LedgerId.TESTNET);break;case"previewnet":this.setNetwork(WebNetwork.PREVIEWNET),this.setMirrorNetwork(WebMirrorNetwork.PREVIEWNET),this.setLedgerId(LedgerId.PREVIEWNET);break;case"local-node":this.setNetwork(WebNetwork.LOCAL_NODE),this.setMirrorNetwork(WebMirrorNetwork.LOCAL_NODE),this.setLedgerId(LedgerId.LOCAL_NODE);break;default:throw new Error(`unknown network: ${e}`)}return this}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const e=await(new AddressBookQueryWeb).setFileId(FileId.getAddressBookFileIdFor(this.shard,this.realm)).execute(this),t={};for(const n of e.nodeAddresses)for(const e of n.addresses)null!=n.accountId&&(t[e.toString()]=n.accountId);this.setNetwork(t)}catch(e){if(this._logger){const t=e instanceof Error?e.message:String(e);this._logger.trace(`failed to update client address book: ${t}`)}}finally{this._isUpdatingNetwork=!1}return this}_createNetworkChannel(){return e=>new WebChannel(e,this.grpcDeadline)}_createMirrorNetworkChannel(){return()=>{throw new Error("mirror support is not supported in browsers")}}}const NetworkName={Mainnet:"mainnet",Testnet:"testnet",Previewnet:"previewnet"};class LocalProviderWeb{constructor(e={}){null==e||null==e.client?this._client=WebClient.forName(e.networkName||"local-node"):this._client=e.client}static fromClient(e){return new LocalProviderWeb({client:e})}getLedgerId(){return this._client.ledgerId}getNetwork(){return this._client.network}getMirrorNetwork(){return this._client.mirrorNetwork}getAccountBalance(e){return(new AccountBalanceQuery).setAccountId(e).execute(this._client)}getAccountInfo(e){return(new AccountInfoQuery).setAccountId(e).execute(this._client)}getAccountRecords(e){return(new AccountRecordsQuery).setAccountId(e).execute(this._client)}getTransactionReceipt(e){return(new TransactionReceiptQuery).setTransactionId(e).execute(this._client)}async sendTransaction(e){return await e.execute(this._client)}async sendQuery(e){return await e.execute(this._client)}async waitForReceipt(e){return await e.getReceipt(this._client)}async call(e){return await e.execute(this._client)}close(){this._client.close()}}exports.AccountAllowanceAdjustTransaction=AccountAllowanceAdjustTransaction,exports.AccountAllowanceApproveTransaction=AccountAllowanceApproveTransaction,exports.AccountAllowanceDeleteTransaction=AccountAllowanceDeleteTransaction,exports.AccountBalance=AccountBalance,exports.AccountBalanceQuery=AccountBalanceQuery,exports.AccountCreateTransaction=AccountCreateTransaction,exports.AccountDeleteTransaction=AccountDeleteTransaction,exports.AccountId=AccountId,exports.AccountInfo=AccountInfo,exports.AccountInfoFlow=AccountInfoFlow,exports.AccountInfoQuery=AccountInfoQuery,exports.AccountRecordsQuery=AccountRecordsQuery,exports.AccountUpdateTransaction=AccountUpdateTransaction,exports.AddressBookQuery=AddressBookQueryWeb,exports.AssessedCustomFee=AssessedCustomFee,exports.BadKeyError=BadKeyError,exports.BadMnemonicError=BadMnemonicError,exports.BadMnemonicReason=BadMnemonicReason,exports.BatchTransaction=BatchTransaction,exports.Cache=CACHE,exports.Client=WebClient,exports.ContractByteCodeQuery=ContractByteCodeQuery,exports.ContractCallQuery=ContractCallQuery,exports.ContractCreateFlow=ContractCreateFlow,exports.ContractCreateTransaction=ContractCreateTransaction,exports.ContractDeleteTransaction=ContractDeleteTransaction,exports.ContractExecuteTransaction=ContractExecuteTransaction,exports.ContractFunctionParameters=ContractFunctionParameters,exports.ContractFunctionResult=ContractFunctionResult,exports.ContractFunctionSelector=ContractFunctionSelector,exports.ContractId=ContractId,exports.ContractInfo=ContractInfo,exports.ContractInfoQuery=ContractInfoQuery,exports.ContractLogInfo=ContractLogInfo,exports.ContractNonceInfo=ContractNonceInfo,exports.ContractUpdateTransaction=ContractUpdateTransaction,exports.CustomFee=CustomFee,exports.CustomFeeLimit=CustomFeeLimit,exports.CustomFixedFee=CustomFixedFee,exports.CustomFractionalFee=CustomFractionalFee,exports.CustomRoyaltyFee=CustomRoyalyFee,exports.DelegateContractId=DelegateContractId,exports.EntityIdHelper=EntityIdHelper,exports.EthereumFlow=EthereumFlow,exports.EthereumTransaction=EthereumTransaction,exports.EthereumTransactionData=EthereumTransactionData,exports.EthereumTransactionDataEip1559=EthereumTransactionDataEip1559,exports.EthereumTransactionDataEip2930=EthereumTransactionDataEip2930,exports.EthereumTransactionDataEip7702=EthereumTransactionDataEip7702,exports.EthereumTransactionDataLegacy=EthereumTransactionDataLegacy,exports.EvmAddress=EvmAddress,exports.EvmHook=EvmHook,exports.EvmHookCall=EvmHookCall,exports.EvmHookMappingEntries=EvmHookMappingEntries,exports.EvmHookMappingEntry=EvmHookMappingEntry,exports.EvmHookStorageSlot=EvmHookStorageSlot,exports.EvmHookStorageUpdate=EvmHookStorageUpdate,exports.ExchangeRate=ExchangeRate,exports.ExchangeRates=ExchangeRates,exports.Executable=Executable,exports.FeeAssessmentMethod=FeeAssessmentMethod,exports.FeeComponents=FeeComponents,exports.FeeData=FeeData,exports.FeeDataType=FeeDataType,exports.FeeSchedule=FeeSchedule,exports.FeeSchedules=FeeSchedules,exports.FileAppendTransaction=FileAppendTransaction,exports.FileContentsQuery=FileContentsQuery,exports.FileCreateTransaction=FileCreateTransaction,exports.FileDeleteTransaction=FileDeleteTransaction,exports.FileId=FileId,exports.FileInfo=FileInfo,exports.FileInfoQuery=FileInfoQuery,exports.FileUpdateTransaction=FileUpdateTransaction,exports.FreezeTransaction=FreezeTransaction,exports.FreezeType=FreezeType,exports.FungibleHookCall=FungibleHookCall,exports.FungibleHookType=FungibleHookType,exports.HEDERA_PATH=HEDERA_PATH,exports.Hbar=Hbar,exports.HbarAllowance=HbarAllowance,exports.HbarUnit=HbarUnit,exports.HookCreationDetails=HookCreationDetails,exports.HookEntityId=HookEntityId,exports.HookExtensionPoint=HookExtensionPoint,exports.HookId=HookId,exports.HookStoreTransaction=HookStoreTransaction,exports.Key=Key,exports.KeyList=KeyList,exports.LedgerId=LedgerId,exports.LiveHash=LiveHash,exports.LiveHashAddTransaction=LiveHashAddTransaction,exports.LiveHashDeleteTransaction=LiveHashDeleteTransaction,exports.LiveHashQuery=LiveHashQuery,exports.LocalProvider=LocalProviderWeb,exports.LogLevel=LogLevel,exports.Logger=Logger,exports.Long=Long,exports.MaxAttemptsOrTimeoutError=MaxAttemptsOrTimeoutError,exports.MaxQueryPaymentExceeded=MaxQueryPaymentExceeded,exports.MirrorNodeContractCallQuery=MirrorNodeContractCallQuery,exports.MirrorNodeContractEstimateQuery=MirrorNodeContractEstimateQuery,exports.Mnemonic=Mnemonic,exports.NetworkName=NetworkName,exports.NetworkVersionInfo=NetworkVersionInfo,exports.NetworkVersionInfoQuery=NetworkVersionInfoQuery,exports.NftHookCall=NftHookCall,exports.NftHookType=NftHookType,exports.NftId=NftId,exports.NodeAddressBook=NodeAddressBook,exports.NodeCreateTransaction=NodeCreateTransaction,exports.NodeDeleteTransaction=NodeDeleteTransaction,exports.NodeUpdateTransaction=NodeUpdateTransaction,exports.PendingAirdropId=PendingAirdropId,exports.PrecheckStatusError=PrecheckStatusError,exports.PrivateKey=PrivateKey,exports.PrngTransaction=PrngTransaction,exports.Provider=Provider,exports.ProxyStaker=ProxyStaker,exports.PublicKey=PublicKey,exports.Query=Query,exports.ReceiptStatusError=ReceiptStatusError,exports.RequestType=RequestType,exports.SLIP44_ECDSA_ETH_PATH=SLIP44_ECDSA_ETH_PATH,exports.SLIP44_ECDSA_HEDERA_PATH=SLIP44_ECDSA_HEDERA_PATH,exports.ScheduleCreateTransaction=ScheduleCreateTransaction,exports.ScheduleDeleteTransaction=ScheduleDeleteTransaction,exports.ScheduleId=ScheduleId,exports.ScheduleInfo=ScheduleInfo,exports.ScheduleInfoQuery=ScheduleInfoQuery,exports.ScheduleSignTransaction=ScheduleSignTransaction,exports.SemanticVersion=SemanticVersion,exports.ServiceEndpoint=ServiceEndpoint,exports.SignatureMap=SignatureMap$1,exports.Signer=Signer,exports.SignerSignature=SignerSignature,exports.Status=Status,exports.StatusError=StatusError,exports.SubscriptionHandle=SubscriptionHandle,exports.SystemDeleteTransaction=SystemDeleteTransaction,exports.SystemUndeleteTransaction=SystemUndeleteTransaction,exports.Timestamp=Timestamp,exports.TokenAirdropTransaction=TokenAirdropTransaction,exports.TokenAllowance=TokenAllowance,exports.TokenAssociateTransaction=TokenAssociateTransaction,exports.TokenBurnTransaction=TokenBurnTransaction,exports.TokenCancelAirdropTransaction=TokenCancelAirdropTransaction,exports.TokenClaimAirdropTransaction=TokenClaimAirdropTransaction,exports.TokenCreateTransaction=TokenCreateTransaction,exports.TokenDeleteTransaction=TokenDeleteTransaction,exports.TokenDissociateTransaction=TokenDissociateTransaction,exports.TokenFeeScheduleUpdateTransaction=TokenFeeScheduleUpdateTransaction,exports.TokenFreezeTransaction=TokenFreezeTransaction,exports.TokenGrantKycTransaction=TokenGrantKycTransaction,exports.TokenId=TokenId,exports.TokenInfo=TokenInfo,exports.TokenInfoQuery=TokenInfoQuery,exports.TokenKeyValidation=TokenKeyValidation,exports.TokenMintTransaction=TokenMintTransaction,exports.TokenNftAllowance=TokenNftAllowance,exports.TokenNftInfo=TokenNftInfo,exports.TokenNftInfoQuery=TokenNftInfoQuery,exports.TokenPauseTransaction=TokenPauseTransaction,exports.TokenRejectFlow=TokenRejectFlow,exports.TokenRejectTransaction=TokenRejectTransaction,exports.TokenRevokeKycTransaction=TokenRevokeKycTransaction,exports.TokenSupplyType=TokenSupplyType,exports.TokenType=TokenType,exports.TokenUnfreezeTransaction=TokenUnfreezeTransaction,exports.TokenUnpauseTransaction=TokenUnpauseTransaction,exports.TokenUpdateNftsTransaction=TokenUpdateNftsTransaction,exports.TokenUpdateTransaction=TokenUpdateTransaction,exports.TokenWipeTransaction=TokenWipeTransaction,exports.TopicCreateTransaction=TopicCreateTransaction,exports.TopicDeleteTransaction=TopicDeleteTransaction,exports.TopicId=TopicId,exports.TopicInfo=TopicInfo,exports.TopicInfoQuery=TopicInfoQuery,exports.TopicMessage=TopicMessage,exports.TopicMessageChunk=TopicMessageChunk,exports.TopicMessageQuery=TopicMessageQuery,exports.TopicMessageSubmitTransaction=TopicMessageSubmitTransaction,exports.TopicUpdateTransaction=TopicUpdateTransaction,exports.Transaction=Transaction,exports.TransactionFeeSchedule=TransactionFeeSchedule,exports.TransactionId=TransactionId,exports.TransactionReceipt=TransactionReceipt,exports.TransactionReceiptQuery=TransactionReceiptQuery,exports.TransactionRecord=TransactionRecord,exports.TransactionRecordQuery=TransactionRecordQuery,exports.TransactionResponse=TransactionResponse,exports.Transfer=Transfer,exports.TransferTransaction=TransferTransaction,exports.Wallet=Wallet,exports.WebClient=WebClient});
|
|
117
117
|
//# sourceMappingURL=umd.min.js.map
|