jcc_wallet 3.0.2 → 3.0.3
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/jcc-wallet.min.js +1 -1
- package/lib/hd/plugins.js +2 -1
- package/lib/hd/plugins.js.map +1 -1
- package/package.json +1 -1
package/dist/jcc-wallet.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jcc_wallet=t():e.jcc_wallet=t()}(self,(()=>(()=>{var __webpack_modules__={97371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WALLET_IS_EMPTY=t.SECRET_IS_INVALID=t.PASSWORD_IS_WRONG=t.PASSWORD_IS_REQUIRED=t.KEYSTORE_IS_INVALID=t.ETH_PASSWORD_IS_WRONG=t.ADDRESS_IS_EXISTENT=void 0;t.PASSWORD_IS_REQUIRED="password is required";t.WALLET_IS_EMPTY="wallet is empty";var r="password is wrong";t.PASSWORD_IS_WRONG=r;t.KEYSTORE_IS_INVALID="keystore is invalid";var n="ethereum ".concat(r);t.ETH_PASSWORD_IS_WRONG=n;t.SECRET_IS_INVALID="secret is invalid";t.ADDRESS_IS_EXISTENT="address is existent"},50132:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createWallet=t.decryptKeystore=t.getAddress=t.isValidAddress=t.isValidSecret=void 0;var i=o(r(39999)),a=r(68692),s=r(39933),u=r(87754),c=o(r(7314)),l=o(r(34851)),f=r(97371),d=function(e){e=(0,u.filterOx)(e);try{return(0,a.isValidPrivate)(n.from(e,"hex"))}catch(e){return!1}};t.isValidSecret=d;t.isValidAddress=function(e){return(0,a.isValidAddress)(e)};t.getAddress=function(e){return e=(0,u.filterOx)(e),d(e)?s.Wallet.fromPrivateKey(n.from(e,"hex")).getAddressString():null};t.decryptKeystore=function(e,t){if(r=t,"[object Object]"!==Object.prototype.toString.call(r))throw new Error(f.KEYSTORE_IS_INVALID);var r,o=t.Crypto||t.crypto;if((0,u.isEmptyObject)(o)||(0,u.isEmptyObject)(o.cipherparams)||(0,u.isEmptyObject)(o.kdfparams))throw new Error(f.KEYSTORE_IS_INVALID);var a=n.from(o.cipherparams.iv,"hex"),s=o.kdfparams,d=(0,l.default)(n.from(e),n.from(s.salt,"hex"),s.n,s.r,s.p,s.dklen),h=n.from(o.ciphertext,"hex");if((0,c.default)("keccak256").update(n.concat([d.slice(16,32),h])).digest().toString("hex")!==o.mac)throw new Error(f.ETH_PASSWORD_IS_WRONG);var p=i.default.createDecipheriv("aes-128-ctr",d.slice(0,16),a);return n.concat([p.update(h),p.final()]).toString("hex")};t.createWallet=function(){var e=s.Wallet.generate();return{address:e.getAddressString(),secret:e.getPrivateKeyString()}}},22246:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getBIP44Chain=t.BIP44ChainMap=t.BIP44Chain=void 0;var o,i=n(r(86686));!function(e){e[e.BITCOIN=2147483648]="BITCOIN",e[e.BSC=2147492654]="BSC",e[e.EOS=2147483842]="EOS",e[e.TRON=2147483843]="TRON",e[e.ETC=2147483709]="ETC",e[e.ETH=2147483708]="ETH",e[e.HECO=2147484658]="HECO",e[e.MOAC=2147483962]="MOAC",e[e.POLYGON=2147484614]="POLYGON",e[e.RIPPLE=2147483792]="RIPPLE",e[e.SWTC=2147483963]="SWTC",e[e.CALL=2147484281]="CALL",e[e.BVCADT=2399141888]="BVCADT",e[e.STREAM=2399141889]="STREAM",e[e.BIZAIN=2399141890]="BIZAIN"}(o||(t.BIP44Chain=o={}));t.getBIP44Chain=function(e){return i.default.filter((function(t){return t[0]===e}))};var a=new Map([[o.BITCOIN,"bitcoin"],[o.BSC,"bsc"],[o.EOS,"eos"],[o.TRON,"tron"],[o.ETC,"etc"],[o.ETH,"ethereum"],[o.HECO,"heco"],[o.MOAC,"moac"],[o.POLYGON,"polygon"],[o.RIPPLE,"ripple"],[o.SWTC,"jingtum"],[o.CALL,"call"],[o.BVCADT,"bvcadt"],[o.STREAM,"stream"],[o.BIZAIN,"bizain"]]);t.BIP44ChainMap=a},47773:(e,t,r)=>{"use strict";var n=r(65851).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.plugin=void 0;var o=r(67678),i=r(70504),a=r(41452),s=r(39688),u=r(87754);t.plugin={checkPrivateKey:function(e){return 66===e.length?e.substring(2):e},address:function(e){if(e.privateKey){var t=this.checkPrivateKey(e.privateKey),r=n.from(t,"hex"),o=n.from(s.publicKeyCreate(r,!0));return i.PublicKey(o).toString()}if(e.publicKey){o=n.from(e.publicKey,"hex");return i.PublicKey(o).toString()}return null},isValidAddress:function(e){return i.isValidPublic(e)},isValidSecret:function(e){try{var t=this.checkPrivateKey((0,u.filterOx)(e)),r=n.from(t,"hex"),o=a.encode(128,r,!1);return i.isValidPrivate(o)}catch(e){return!1}},hash:function(e){return i.sha256(e)},sign:function(e,t){var r=n.from(this.checkPrivateKey((0,u.filterOx)(t)),"hex"),o=a.encode(128,r,!1);return i.sign(e,o,"utf8")},verify:function(e,t,r){return this.recover(e,t)===r},recover:function(e,t){return i.recover(t,e,"utf8")},proxy:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return o[e].apply(o,t)}}},27290:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.plugin=void 0;var s=r(39933),u=a(r(68692)),c=r(27648),l=r(87754);t.plugin={checkPrivateKey:function(e){return 66===e.length?e.substring(2):e},address:function(e){if(e.privateKey){var t=this.checkPrivateKey(e.privateKey),r=n.from(t,"hex");return s.Wallet.fromPrivateKey(r).getAddressString()}return e.publicKey?s.Wallet.fromPublicKey(n.from(e.publicKey,"hex")).getAddressString():null},isValidAddress:function(e){return u.isValidAddress(e)},isValidSecret:function(e){try{return u.isValidPrivate(n.from((0,l.filterOx)(e),"hex"))}catch(e){return!1}},hash:function(e){var t=u.bytesToHex((0,c.keccak256)(n.from(e,"utf-8")));return u.stripHexPrefix(t)},sign:function(e,t){var r=this.checkPrivateKey(t).toLowerCase(),o=(0,c.keccak256)(n.from(e,"utf-8")),i=u.ecsign(o,n.from(r,"hex"));return u.stripHexPrefix(u.bytesToHex(i.r))+u.stripHexPrefix(u.bytesToHex(i.s))+i.v.toString(16)},verify:function(e,t,r){return this.recover(e,t)===r},recover:function(e,t){var r=(0,c.keccak256)(n.from(e,"utf-8")),o=n.from(n.from(t.substring(0,64),"hex")),i=n.from(n.from(t.substring(64,128),"hex")),a=u.hexToBytes("0x"+t.substring(128,130)),l=u.ecrecover(r,u.bytesToBigInt(a),o,i);return s.Wallet.fromPublicKey(l).getAddressString()},proxy:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return u[e].apply(u,t)}}},83602:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HDWallet=t.getBIP44Chain=t.BIP44ChainMap=t.BIP44Chain=void 0;var u=r(55050),c=a(r(49485)),l=s(r(4806)),f=a(r(65735)),d=r(22246);Object.defineProperty(t,"BIP44Chain",{enumerable:!0,get:function(){return d.BIP44Chain}}),Object.defineProperty(t,"BIP44ChainMap",{enumerable:!0,get:function(){return d.BIP44ChainMap}}),Object.defineProperty(t,"getBIP44Chain",{enumerable:!0,get:function(){return d.getBIP44Chain}});var h=r(541),p=u.KeyPair.addressCodec,y=function(){function e(t){var r=this;if(this.isRoot=function(){return r._path.chain+r._path.account+r._path.change+r._path.index===0},this.deriveWallet=function(t){if(isNaN(t.chain)||isNaN(t.account)||isNaN(t.index))return null;var n=e.getHDKeypair(r._secret,t.chain,t.account,t.index);return new e({keypair:n,path:{chain:t.chain,account:t.account,change:0,index:t.index}})},this.secret=function(){return r._secret},this.mnemonic=function(){return r._mnemonic},this.chain=function(){return r.isRoot()?d.BIP44ChainMap.get(d.BIP44Chain.SWTC):d.BIP44ChainMap.get(r._path.chain)},this.address=function(){if(!r._address){var e=r.chain();r._address=(0,h.getPluginByType)(e).address(r._secret?r._secret:r._keypair,e)}return r._address},this.isValidAddress=function(e){return(0,h.getPluginByType)(r.chain()).isValidAddress(e)},this.isValidSecret=function(e){return(0,h.getPluginByType)(r.chain()).isValidSecret(e)},this.hash=function(e){return(0,h.getPluginByType)(r.chain()).hash(e)},this.sign=function(e){return(0,h.getPluginByType)(r.chain()).sign(e,r._keypair.privateKey)},this.verify=function(e,t,n,o){return n||(n=r.address()),o||(o=r._keypair),(0,h.getPluginByType)(r.chain()).verify(e,t,n,o)},this.recover=function(e,t){return(0,h.getPluginByType)(r.chain()).recover(e,t)},this.getWalletApi=function(){return(0,h.getPluginByType)(r.chain())},this.keypair=function(){return r._keypair},this.path=function(){return r._path},this.setKeypair=function(e){r._keypair=e},!t)throw new Error("undefined parameters: "+t);if(this._path={chain:0,account:0,change:0,index:0},t.mnemonic)return this._secret=e.getSecretFromMnemonic(t.mnemonic,t.language),this._keypair=e.getKeypairFromSecret(this._secret),this._mnemonic={mnemonic:t.mnemonic,language:t.language},this;if(t.secret)return this._secret=t.secret,this._keypair=e.getKeypairFromSecret(this._secret),this._mnemonic={mnemonic:e.getMnemonicFromSecret(this._secret,t.language),language:t.language},this;if(t.keypair)return t.path?(this._keypair=t.keypair,this._mnemonic=null,this._secret=null,this._path=t.path):(this._keypair=t.keypair,this._mnemonic=null,this._secret=null),this;throw new Error("invalid parameters: "+t)}return e.generateMnemonic=function(e,t){return void 0===e&&(e=128),void 0===t&&(t="english"),c.setDefaultWordlist(t),c.generateMnemonic(e)},e.getSecretFromMnemonic=function(e,t){void 0===t&&(t="english"),c.setDefaultWordlist(t);var r=c.mnemonicToEntropy(e);return p.encodeSeed(n.from(r,"hex"))},e.getMnemonicFromSecret=function(e,t){void 0===t&&(t="english"),c.setDefaultWordlist(t);var r=p.decodeSeed(e).bytes;return c.entropyToMnemonic(r)},e.getKeypairFromSecret=function(e){return u.KeyPair.deriveKeypair(e)},e.getHDKeypair=function(t,r,n,o){void 0===n&&(n=0);var i=(0,d.getBIP44Chain)(r);if(0===i.length)return null;var a=i[0][0]<<1>>1,s=e.getMnemonicFromSecret(t),h=c.mnemonicToSeedSync(s),p=(0,l.default)(f).fromSeed(h).derivePath("m/44'/".concat(a,"'/").concat(n,"'/0/").concat(o)).privateKey;return u.KeyPair.deriveKeypair(p.toString("hex"))},e.generate=function(t){t||(t={});var r=e.generateMnemonic(t.len,t.language);return new e({mnemonic:r,language:t.language})},e.fromSecret=function(t){return new e({secret:t})},e.fromMnemonic=function(t){return new e({mnemonic:t.mnemonic,language:t.language})},e.fromKeypair=function(t){return new e({keypair:t})},e}();t.HDWallet=y},541:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPluginByType=void 0;var n=r(27290),o=r(27290),i=r(27290),a=r(27290),s=r(84918),u=r(47773),c=r(1047),l={ethereum:n.plugin,bsc:o.plugin,heco:i.plugin,polygon:a.plugin,tron:s.plugin,eos:u.plugin,bvcadt:(0,c.XWallet)("bvcadt"),call:(0,c.XWallet)("call"),ripple:(0,c.XWallet)("ripple"),stream:(0,c.XWallet)("stream"),bizain:(0,c.XWallet)("bizain"),jingtum:(0,c.XWallet)("jingtum")};t.getPluginByType=function(e){return l[e]}},1047:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XWallet=void 0;var n=r(55050),o=r(76998);t.XWallet=function(e){return{wallet:(0,n.Factory)(e),address:function(e){try{if("string"==typeof e)return this.wallet.fromSecret(e).address;var t=this.wallet.KeyPair;return e.privateKey?t.deriveAddress(t.deriveKeyPair(e.privateKey).publicKey):e.publicKey?t.deriveAddress(e.publicKey):null}catch(e){return null}},isValidAddress:function(e){return this.wallet.isValidAddress(e)},isValidSecret:function(e){return this.wallet.isValidSecret(e)},hash:function(e){return(0,o.funcBytesToHex)(this.wallet.hash(e))},sign:function(e,t){return this.wallet.KeyPair.sign(e,t)},verify:function(e,t,r,n){return r===this.address(n)&&(n.publicKey||(n=this.wallet.KeyPair.deriveKeyPair(n.privateKey)),this.wallet.KeyPair.verify(e,t,n.publicKey))},recover:function(){return"swtclib does not support."},proxy:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return(t=this.wallet)[e].apply(t,r)}}}},84918:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.plugin=void 0;var n=r(81898);t.plugin={checkPrivateKey:function(e){return 66===e.length?e.substring(2):e},address:function(e){if(e.privateKey){var t=this.checkPrivateKey(e.privateKey);return n.address.fromPrivateKey(t)}if(e.publicKey){var r=n.utils.code.hexStr2byteArray(e.publicKey),o=n.utils.crypto.computeAddress(r);return n.utils.crypto.getBase58CheckAddress(o)}return null},isValidAddress:function(e){return n.utils.crypto.isAddressValid(e)},isValidSecret:function(e){try{var t=n.utils.code.hexStr2byteArray(this.checkPrivateKey(e)),r=n.utils.crypto.getPubKeyFromPriKey(t),o=n.utils.crypto.computeAddress(r),i=n.utils.crypto.getBase58CheckAddress(o);return this.isValidAddress(i)}catch(e){return!1}},hash:function(e){return n.utils.message.hashMessage(e)},sign:function(e,t){var r=this.checkPrivateKey(t).toLowerCase();return n.Trx.signMessageV2(e,r)},verify:function(e,t,r){return this.recover(e,t)===r},recover:function(e,t){return n.Trx.verifyMessageV2(e,t)},proxy:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return n[e].apply(n,t)}}},34989:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hdWallet=t.moacWallet=t.JingchangWallet=t.ethWallet=void 0;var u=i(r(50132));t.ethWallet=u;var c=s(r(63410));t.JingchangWallet=c.default;var l=i(r(11760));t.moacWallet=l;var f=i(r(83602));t.hdWallet=f,a(r(1339),t)},63410:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=a(r(28562)),u=a(r(58390)),c=a(r(39999)),l=a(r(75755)),f=r(87754),d=a(r(75261)),h=r(77311),p=r(97371),y=r(1339),b=r(22836);d.default.prefix="jingchang_";var g=function(){function e(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!0),this._multiple=t,this._jingchangWallet=e,this._samePassword=r}return e.isValid=function(e){try{"string"==typeof e&&(e=JSON.parse(e));var t=!(0,f.isEmptyObject)(e)&&Array.isArray(e.wallets)&&e.wallets.length>0;return Boolean(t&&e.contact&&e.id&&e.version)}catch(e){return!1}},e.generate=function(t,r,n){return new Promise((function(o,i){var a={};if(void 0===r){var s=y.jtWallet.createWallet();r=s.secret,a.address=s.address}else{if(!y.jtWallet.isValidSecret(r))return i(new Error(p.SECRET_IS_INVALID));a.address=y.jtWallet.getAddress(r)}a.secret=r,a.type="swt",a.default=!0,a.alias=n||"swt wallet";var u={},c=(0,b.encryptWallet)(t,a);return u.version=e.version,u.id=e._walletID,u.contact={},u.wallets=[],u.wallets.push(c),o(u)}))},e.get=function(){var t=d.default.get(e._walletID);return e.isValid(t)?t:null},e.clear=function(){d.default.set(e._walletID,{})},e.save=function(t){d.default.set(e._walletID,t)},e.deriveKeyPair=function(e,t){void 0===t&&(t="swt");var r=(0,h.Factory)(t).deriveKeyPair(e);return{privateKey:r.privateKey.substring(2),publicKey:r.publicKey}},e.encryptWithPublicKey=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,l.default.encrypt(n.from(t,"hex"),n.from(e))];case 1:return[2,{ciphertext:(r=o.sent()).ciphertext.toString("hex"),ephemPublicKey:r.ephemPublicKey.toString("hex"),iv:r.iv.toString("hex"),mac:r.mac.toString("hex")}]}}))}))},e.decryptWithPrivateKey=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return r={ciphertext:n.from(e.ciphertext,"hex"),ephemPublicKey:n.from(e.ephemPublicKey,"hex"),iv:n.from(e.iv,"hex"),mac:n.from(e.mac,"hex")},[4,l.default.decrypt(n.from(t,"hex"),r)];case 1:return[2,o.sent().toString()]}}))}))},e.getWallets=function(t){return e.isValid(t)?t.wallets:[]},e.prototype.setJingchangWallet=function(e){this._jingchangWallet=e},e.prototype.getAddress=function(e){return void 0===e&&(e="swt"),o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getWalletWithType(e)];case 1:return[2,t.sent().address]}}))}))},e.prototype.getWalletWithType=function(e){return void 0===e&&(e="swt"),o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.findWallet((function(t){return t.type.toLowerCase()===e.toLowerCase()&&t.default}))]}))}))},e.prototype.getWalletWithAddress=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.findWallet((function(t){return t.address===e}))];case 1:return[2,t.sent()]}}))}))},e.prototype.hasDefault=function(e){void 0===e&&(e="swt");try{var t=this.findWallet((function(t){return t.type===e&&t.default}));return!(0,f.isEmptyObject)(t)}catch(e){return!1}},e.prototype.getSecretWithType=function(e,t){return void 0===t&&(t="swt"),o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.findWallet((function(e){return e.type===t&&e.default}))];case 1:return r=n.sent(),[2,(0,b.decrypt)(e,r)]}}))}))},e.prototype.getSecretWithAddress=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.findWallet((function(e){return e.address===t}))];case 1:return r=n.sent(),[2,(0,b.decrypt)(e,r)]}}))}))},e.prototype.changeWholePassword=function(t,r){return o(this,void 0,void 0,(function(){var n,o,a,c,l,f,d,h,p,y;return i(this,(function(i){switch(i.label){case 0:if(!this._samePassword)throw new Error("the property of _samePassword is false, so please don't call this function!");n=(0,u.default)(this._jingchangWallet),s.default.notEqual(n,this._jingchangWallet),o=e.getWallets(n),a=[],c=0,l=o,i.label=1;case 1:return c<l.length?(f=l[c],d=f.address,[4,this.getSecretWithAddress(t,d)]):[3,4];case 2:h=i.sent(),p={address:f.address,alias:f.alias,default:f.default,secret:h,type:f.type},y=this.getEncryptData(r,p),a.push(y),i.label=3;case 3:return c++,[3,1];case 4:return n.wallets=a,this.setJingchangWallet(n),[2,n]}}))}))},e.prototype.changePasswordWithAddress=function(e,t,r){return o(this,void 0,void 0,(function(){var n,o,a,s;return i(this,(function(i){switch(i.label){case 0:if(this._samePassword)throw new Error("the property of _samePassword is true, so please don't call this function!");return n=this.findWallet((function(t){return t.address===e})),[4,this.getSecretWithAddress(t,e)];case 1:return o=i.sent(),a={address:n.address,alias:n.alias,default:n.default,secret:o,type:n.type},s=this.getEncryptData(r,a),n.ciphertext=s.ciphertext,n.crypto=s.crypto,n.mac=s.mac,[2,this._jingchangWallet]}}))}))},e.prototype.replaceKeystore=function(e,t,r){return o(this,void 0,void 0,(function(){var n,o,a,s;return i(this,(function(i){return n=r(e),o=this.findWallet((function(e){return e.address===n})),a={address:o.address,alias:o.alias,default:o.default,secret:e,type:o.type},s=this.getEncryptData(t,a),o.ciphertext=s.ciphertext,o.crypto=s.crypto,o.mac=s.mac,[2,this._jingchangWallet]}))}))},e.prototype.removeWalletWithType=function(e){return void 0===e&&(e="swt"),o(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.getAddress(e)];case 1:return t=r.sent(),[4,this.removeWalletWithAddress(t)];case 2:return[2,r.sent()]}}))}))},e.prototype.removeWalletWithAddress=function(t){return o(this,void 0,void 0,(function(){var r,n,o,a,c;return i(this,(function(i){return r=(0,u.default)(this._jingchangWallet),s.default.notEqual(this._jingchangWallet,r),n=e.getWallets(r),o=this.findWallet((function(e){return e.address===t})),a=n.findIndex((function(e){return e.address===o.address})),n.splice(a,1),(c=n.find((function(e){return e.type===o.type})))&&(c.default=!0),this.setJingchangWallet(r),[2,r]}))}))},e.prototype.setDefaultWallet=function(e){return o(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.getWalletWithAddress(e)];case 1:return(t=r.sent()).default?[2,this._jingchangWallet]:[4,this.getWalletWithType(t.type)];case 2:return r.sent().default=!1,t.default=!0,[2,this._jingchangWallet]}}))}))},e.prototype.importSecret=function(t,r,n,a,s){return o(this,void 0,void 0,(function(){var o,u,c,l;return i(this,(function(i){switch(i.label){case 0:return this._samePassword?[4,this.getSecretWithType(r)]:[3,2];case 1:i.sent(),i.label=2;case 2:if(!(o=a(t)))throw new Error(p.SECRET_IS_INVALID);if(u=e.getWallets(this._jingchangWallet),c=u.find((function(e){return e.address===o&&e.type===n})),c)throw new Error(p.ADDRESS_IS_EXISTENT);return l={address:o,alias:s||"".concat(n," wallet"),secret:t,type:n},[4,this.saveWallet(r,l)];case 3:return[2,i.sent()]}}))}))},e.prototype.findWallet=function(t){var r=this._jingchangWallet;if(!e.isValid(r))throw new Error(p.KEYSTORE_IS_INVALID);var n=r.wallets.find(t);if((0,f.isEmptyObject)(n))throw new Error(p.WALLET_IS_EMPTY);return n},e.prototype.getEncryptData=function(e,t){return(0,b.encryptWallet)(e,t,{})},e.prototype.saveWallet=function(e,t){return o(this,void 0,void 0,(function(){var r,n,o,a;return i(this,(function(i){return t.default=!this._multiple||!this.hasDefault(t.type),r=this.getEncryptData(e,t),n=(0,u.default)(this._jingchangWallet),s.default.notEqual(this._jingchangWallet,n),o=n.wallets,a=o.findIndex((function(e){return e.type.toLowerCase()===t.type.toLowerCase()})),this._multiple||a>=0&&o.splice(a,1),o.push(r),this.setJingchangWallet(n),[2,n]}))}))},e.version="1.0",e._name="wallets",e._walletID=c.default.createHash("sha256").update(e._name.toLowerCase()).digest("hex"),e}();t.default=g},11760:(e,t,r)=>{"use strict";var n=r(65851).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.createWallet=t.getAddress=t.isValidAddress=t.isValidSecret=void 0;var o=r(68692),i=r(39933),a=r(87754),s=function(e){e=(0,a.filterOx)(e);try{return(0,o.isValidPrivate)(n.from(e,"hex"))}catch(e){return!1}};t.isValidSecret=s;t.isValidAddress=function(e){return/^(0x)?[0-9a-fA-F]{40}$/.test((0,a.filterOx)(e))};t.getAddress=function(e){return e=(0,a.filterOx)(e),s(e)?i.Wallet.fromPrivateKey(n.from(e,"hex")).getAddressString():null};t.createWallet=function(){var e=i.Wallet.generate();return{address:e.getAddressString(),secret:e.getPrivateKeyString()}}},22836:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.encryptWallet=t.encryptContact=t.encrypt=t.decrypt=void 0;var i=o(r(39999)),a=r(87754),s=o(r(7314)),u=o(r(30518)),c=o(r(34851)),l=r(97371);t.decrypt=function(e,t){if((0,a.isEmptyObject)(t)||(0,a.isEmptyObject)(t.crypto)||(0,a.isEmptyObject)(t.crypto.kdfparams))throw new Error(l.KEYSTORE_IS_INVALID);var r=n.from(t.crypto.iv,"hex"),o=t.crypto.kdfparams,u=(0,c.default)(n.from(e),n.from(o.salt,"hex"),o.n,o.r,o.p,o.dklen),f=n.from(t.ciphertext,"hex");if((0,s.default)("keccak256").update(n.concat([u.slice(16,32),f])).digest().toString("hex")!==t.mac)throw new Error(l.PASSWORD_IS_WRONG);var d=i.default.createDecipheriv("aes-128-ctr",u.slice(0,16),r);return n.concat([d.update(f),d.final()]).toString()};var f=function(e,t,r){var o=r.iv||(0,u.default)(16).toString("hex"),a={dklen:r.dklen||32,n:r.n||4096,p:r.p||1,r:r.r||8,salt:r.salt||(0,u.default)(32).toString("hex")},l=(0,c.default)(n.from(e),n.from(a.salt,"hex"),a.n,a.r,a.p,a.dklen),f=i.default.createCipheriv(r.cipher||"aes-128-ctr",l.slice(0,16),n.from(o,"hex")),d=n.concat([f.update(n.from(t)),f.final()]),h=(0,s.default)("keccak256").update(n.concat([l.slice(16,32),d])).digest();return{ciphertext:d.toString("hex"),crypto:{cipher:r.cipher||"aes-128-ctr",iv:o,kdf:"scrypt",kdfparams:a},mac:h.toString("hex")}};t.encrypt=f;t.encryptContact=function(e,t,r){return void 0===r&&(r={}),f(e,JSON.stringify(t),r)};t.encryptWallet=function(e,t,r){void 0===r&&(r={});var n=f(e,t.secret,r);return n.type=t.type||"swt",n.address=t.address,n.default="boolean"!=typeof t.default||t.default,n.alias=t.alias||"",n}},1339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rippleWallet=t.stmWallet=t.jtWallet=t.callWallet=t.bvcadtWallet=t.XWallet=void 0;var n,o=r(55050);!function(e){e.BVCADT="bvcadt",e.CALL="call",e.JINGTUM="jingtum",e.RIPPLE="ripple",e.STREAM="stream",e.BIZAIN="bizain"}(n||(n={}));t.XWallet=function(e){var t=(0,o.Factory)(e);return{isValidAddress:function(e){return t.isValidAddress(e)},isValidSecret:function(e){return t.isValidSecret(e)},getAddress:function(e){try{return t.fromSecret(e).address}catch(e){return null}},createWallet:function(e){var r;void 0===e&&(e={});try{r=t.generate(e)}catch(e){r=null}return r}}};var i=(0,t.XWallet)(n.BVCADT);t.bvcadtWallet=i;var a=(0,t.XWallet)(n.CALL);t.callWallet=a;var s=(0,t.XWallet)(n.JINGTUM);t.jtWallet=s;var u=(0,t.XWallet)(n.RIPPLE);t.rippleWallet=u;var c=(0,t.XWallet)(n.STREAM);t.stmWallet=c},28828:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AbiCoder:()=>Or,ConstructorFragment:()=>_e,ErrorFragment:()=>Pe,EventFragment:()=>me,FormatTypes:()=>pe,Fragment:()=>ve,FunctionFragment:()=>Ee,Indexed:()=>Gr,Interface:()=>Kr,LogDescription:()=>Ur,ParamType:()=>be,TransactionDescription:()=>zr,checkResultErrors:()=>Ne,defaultAbiCoder:()=>xr});var n=r(79919),o=r.n(n),i=r(1283);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==a(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===a(i)?i:String(i)),n)}var o,i}var u=!1,c=!1,l={debug:1,default:2,info:2,warning:3,error:4,off:5},f=l.default,d=null;var h,p,y=function(){try{var e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((function(t){try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(h||(h={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(p||(p={}));var b="0123456789abcdef",g=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}var t,r,n;return t=e,r=[{key:"_log",value:function(e,t){var r=e.toLowerCase();null==l[r]&&this.throwArgumentError("invalid log level name","logLevel",e),f>l[r]||i.log.apply(i,t)}},{key:"debug",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this._log(e.levels.DEBUG,r)}},{key:"info",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this._log(e.levels.INFO,r)}},{key:"warn",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this._log(e.levels.WARNING,r)}},{key:"makeError",value:function(t,r,n){if(c)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});var o=[];Object.keys(n).forEach((function(e){var t=n[e];try{if(t instanceof Uint8Array){for(var r="",i=0;i<t.length;i++)r+=b[t[i]>>4],r+=b[15&t[i]];o.push(e+"=Uint8Array(0x"+r+")")}else o.push(e+"="+JSON.stringify(t))}catch(t){o.push(e+"="+JSON.stringify(n[e].toString()))}})),o.push("code=".concat(r)),o.push("version=".concat(this.version));var i=t,a="";switch(r){case p.NUMERIC_FAULT:a="NUMERIC_FAULT";var s=t;switch(s){case"overflow":case"underflow":case"division-by-zero":a+="-"+s;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break;case p.CALL_EXCEPTION:case p.INSUFFICIENT_FUNDS:case p.MISSING_NEW:case p.NONCE_EXPIRED:case p.REPLACEMENT_UNDERPRICED:case p.TRANSACTION_REPLACED:case p.UNPREDICTABLE_GAS_LIMIT:a=r}a&&(t+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),o.length&&(t+=" ("+o.join(", ")+")");var u=new Error(t);return u.reason=i,u.code=r,Object.keys(n).forEach((function(e){u[e]=n[e]})),u}},{key:"throwError",value:function(e,t,r){throw this.makeError(e,t,r)}},{key:"throwArgumentError",value:function(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}},{key:"assert",value:function(e,t,r,n){e||this.throwError(t,r,n)}},{key:"assertArgument",value:function(e,t,r,n){e||this.throwArgumentError(t,r,n)}},{key:"checkNormalize",value:function(t){null==t&&(t="platform missing String.prototype.normalize"),y&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:y})}},{key:"checkSafeUint53",value:function(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}},{key:"checkArgumentCount",value:function(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}},{key:"checkNew",value:function(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}},{key:"checkAbstract",value:function(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}}],n=[{key:"globalLogger",value:function(){return d||(d=new e("logger/5.7.0")),d}},{key:"setCensorship",value:function(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),u){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}c=!!t,u=!!r}},{key:"setLogLevel",value:function(t){var r=l[t.toLowerCase()];null!=r?f=r:e.globalLogger().warn("invalid log level - "+t)}},{key:"from",value:function(t){return new e(t)}}],r&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();g.errors=p,g.levels=h;var v=new g("bytes/5.7.0");function m(e){return!!e.toHexString}function w(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return w(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function T(e){return"number"==typeof e&&e==e&&e%1==0}function A(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!T(e.length)||e.length<0)return!1;for(var t=0;t<e.length;t++){var r=e[t];if(!T(r)||r<0||r>=256)return!1}return!0}function _(e,t){if(t||(t={}),"number"==typeof e){v.checkSafeUint53(e,"invalid arrayify value");for(var r=[];e;)r.unshift(255&e),e=parseInt(String(e/256));return 0===r.length&&r.push(0),w(new Uint8Array(r))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),m(e)&&(e=e.toHexString()),S(e)){var n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":v.throwArgumentError("hex data is odd-length","value",e));for(var o=[],i=0;i<n.length;i+=2)o.push(parseInt(n.substring(i,i+2),16));return w(new Uint8Array(o))}return A(e)?w(new Uint8Array(e)):v.throwArgumentError("invalid arrayify value","value",e)}function E(e){var t=e.map((function(e){return _(e)})),r=t.reduce((function(e,t){return e+t.length}),0),n=new Uint8Array(r);return t.reduce((function(e,t){return n.set(t,e),e+t.length}),0),w(n)}function S(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}var P="0123456789abcdef";function k(e,t){if(t||(t={}),"number"==typeof e){v.checkSafeUint53(e,"invalid hexlify value");for(var r="";e;)r=P[15&e]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),m(e))return e.toHexString();if(S(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":v.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(A(e)){for(var n="0x",o=0;o<e.length;o++){var i=e[o];n+=P[(240&i)>>4]+P[15&i]}return n}return v.throwArgumentError("invalid hexlify value","value",e)}function B(e,t){for("string"!=typeof e?e=k(e):S(e)||v.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&v.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}function x(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==O(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===O(i)?i:String(i)),n)}var o,i}var C=o().BN,I=new g("bignumber/5.7.0"),R={},M=9007199254740991;var L=!1,N=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t!==R&&I.throwError("cannot call constructor directly; use BigNumber.from",g.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}var t,r,n;return t=e,r=[{key:"fromTwos",value:function(e){return W(j(this).fromTwos(e))}},{key:"toTwos",value:function(e){return W(j(this).toTwos(e))}},{key:"abs",value:function(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}},{key:"add",value:function(e){return W(j(this).add(j(e)))}},{key:"sub",value:function(e){return W(j(this).sub(j(e)))}},{key:"div",value:function(t){return e.from(t).isZero()&&D("division-by-zero","div"),W(j(this).div(j(t)))}},{key:"mul",value:function(e){return W(j(this).mul(j(e)))}},{key:"mod",value:function(e){var t=j(e);return t.isNeg()&&D("division-by-zero","mod"),W(j(this).umod(t))}},{key:"pow",value:function(e){var t=j(e);return t.isNeg()&&D("negative-power","pow"),W(j(this).pow(t))}},{key:"and",value:function(e){var t=j(e);return(this.isNegative()||t.isNeg())&&D("unbound-bitwise-result","and"),W(j(this).and(t))}},{key:"or",value:function(e){var t=j(e);return(this.isNegative()||t.isNeg())&&D("unbound-bitwise-result","or"),W(j(this).or(t))}},{key:"xor",value:function(e){var t=j(e);return(this.isNegative()||t.isNeg())&&D("unbound-bitwise-result","xor"),W(j(this).xor(t))}},{key:"mask",value:function(e){return(this.isNegative()||e<0)&&D("negative-width","mask"),W(j(this).maskn(e))}},{key:"shl",value:function(e){return(this.isNegative()||e<0)&&D("negative-width","shl"),W(j(this).shln(e))}},{key:"shr",value:function(e){return(this.isNegative()||e<0)&&D("negative-width","shr"),W(j(this).shrn(e))}},{key:"eq",value:function(e){return j(this).eq(j(e))}},{key:"lt",value:function(e){return j(this).lt(j(e))}},{key:"lte",value:function(e){return j(this).lte(j(e))}},{key:"gt",value:function(e){return j(this).gt(j(e))}},{key:"gte",value:function(e){return j(this).gte(j(e))}},{key:"isNegative",value:function(){return"-"===this._hex[0]}},{key:"isZero",value:function(){return j(this).isZero()}},{key:"toNumber",value:function(){try{return j(this).toNumber()}catch(e){D("overflow","toNumber",this.toString())}return null}},{key:"toBigInt",value:function(){try{return BigInt(this.toString())}catch(e){}return I.throwError("this platform does not support BigInt",g.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}},{key:"toString",value:function(){return arguments.length>0&&(10===arguments[0]?L||(L=!0,I.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?I.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",g.errors.UNEXPECTED_ARGUMENT,{}):I.throwError("BigNumber.toString does not accept parameters",g.errors.UNEXPECTED_ARGUMENT,{})),j(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(e){return{type:"BigNumber",hex:this.toHexString()}}}],n=[{key:"from",value:function(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(R,F(t)):t.match(/^-?[0-9]+$/)?new e(R,F(new C(t))):I.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&D("underflow","BigNumber.from",t),(t>=M||t<=-M)&&D("overflow","BigNumber.from",t),e.from(String(t));var r=t;if("bigint"==typeof r)return e.from(r.toString());if(A(r))return e.from(k(r));if(r)if(r.toHexString){var n=r.toHexString();if("string"==typeof n)return e.from(n)}else{var o=r._hex;if(null==o&&"BigNumber"===r.type&&(o=r.hex),"string"==typeof o&&(S(o)||"-"===o[0]&&S(o.substring(1))))return e.from(o)}return I.throwArgumentError("invalid BigNumber value","value",t)}},{key:"isBigNumber",value:function(e){return!(!e||!e._isBigNumber)}}],r&&x(t.prototype,r),n&&x(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function F(e){if("string"!=typeof e)return F(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&I.throwArgumentError("invalid hex","value",e),"0x00"===(e=F(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function W(e){return N.from(F(e))}function j(e){var t=N.from(e).toHexString();return"-"===t[0]?new C("-"+t.substring(3),16):new C(t.substring(2),16)}function D(e,t,r){var n={fault:e,operation:t};return null!=r&&(n.value=r),I.throwError(e,g.errors.NUMERIC_FAULT,n)}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==H(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===H(i)?i:String(i)),n)}var o,i}function z(e,t,r){return t&&U(e.prototype,t),r&&U(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}var G=new g("properties/5.7.0");function J(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function V(e,t){for(var r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!==H(e.prototype))break;e=Object.getPrototypeOf(e.prototype).constructor}return null}var K={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function X(e){if(null==e||K[H(e)])return!0;if(Array.isArray(e)||"object"===H(e)){if(!Object.isFrozen(e))return!1;for(var t=Object.keys(e),r=0;r<t.length;r++){var n=null;try{n=e[t[r]]}catch(e){continue}if(!X(n))return!1}return!0}return G.throwArgumentError("Cannot deepCopy ".concat(H(e)),"object",e)}function $(e){if(X(e))return e;if(Array.isArray(e))return Object.freeze(e.map((function(e){return Z(e)})));if("object"===H(e)){var t={};for(var r in e){var n=e[r];void 0!==n&&J(t,r,Z(n))}return t}return G.throwArgumentError("Cannot deepCopy ".concat(H(e)),"object",e)}function Z(e){return $(e)}var q=z((function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t)this[r]=Z(t[r])})),Y="abi/5.7.0",Q=r(1283);function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}function te(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&re(e,t)}function re(e,t){return re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},re(e,t)}function ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=oe(e);if(t){var o=oe(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===ee(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function oe(e){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oe(e)}function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==ee(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===ee(i)?i:String(i)),n)}var o,i}function se(e,t,r){return t&&ae(e.prototype,t),r&&ae(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var ue=new g(Y),ce={},le={calldata:!0,memory:!0,storage:!0},fe={calldata:!0,memory:!0};function de(e,t){if("bytes"===e||"string"===e){if(le[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&fe[t])return!0;return(le[t]||"payable"===t)&&ue.throwArgumentError("invalid modifier","name",t),!1}function he(e,t){for(var r in t)J(e,r,t[r])}var pe=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),ye=new RegExp(/^(.*)\[([0-9]*)\]$/),be=function(){function e(t,r){ie(this,e),t!==ce&&ue.throwError("use fromString",g.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),he(this,r);var n=this.type.match(ye);he(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}return se(e,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json){var t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((function(t){return JSON.parse(t.format(e))}))),JSON.stringify(t)}var r="";return"array"===this.baseType?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==pe.sighash&&(r+=this.type),r+="("+this.components.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+")"):r+=this.type,e!==pe.sighash&&(!0===this.indexed&&(r+=" indexed"),e===pe.full&&this.name&&(r+=" "+this.name)),r}}],[{key:"from",value:function(t,r){return"string"==typeof t?e.fromString(t,r):e.fromObject(t)}},{key:"fromObject",value:function(t){return e.isParamType(t)?t:new e(ce,{name:t.name||null,type:ke(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}},{key:"fromString",value:function(t,r){return n=function(e,t){var r=e;function n(t){ue.throwArgumentError("unexpected character at position ".concat(t),"param",e)}function o(e){var r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},a=i,s=0;s<e.length;s++){var u=e[s];switch(u){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||n(s),a.state.allowType=!1,a.type=ke(a.type),a.components=[o(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(t||n(s),a.indexed=!0,a.name=""),de(a.type,a.name)&&(a.name=""),a.type=ke(a.type);var c=a;(a=a.parent)||n(s),delete c.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(t||n(s),a.indexed=!0,a.name=""),de(a.type,a.name)&&(a.name=""),a.type=ke(a.type);var l=o(a.parent);a.parent.components.push(l),delete a.parent,a=l;break;case" ":a.state.allowType&&""!==a.type&&(a.type=ke(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(t||n(s),a.indexed&&n(s),a.indexed=!0,a.name=""):de(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||n(s),a.type+=u,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||n(s),a.type+=u,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=u,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=u,delete a.state.allowArray):a.state.readArray?a.type+=u:n(s)}}return a.parent&&ue.throwArgumentError("unexpected eof","param",e),delete i.state,"indexed"===a.name?(t||n(r.length-7),a.indexed&&n(r.length-7),a.indexed=!0,a.name=""):de(a.type,a.name)&&(a.name=""),i.type=ke(i.type),i}(t,!!r),e.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}},{key:"isParamType",value:function(e){return!(null==e||!e._isParamType)}}]),e}();function ge(e,t){return function(e){e=e.trim();for(var t=[],r="",n=0,o=0;o<e.length;o++){var i=e[o];","===i&&0===n?(t.push(r),r=""):(r+=i,"("===i?n++:")"===i&&-1===--n&&ue.throwArgumentError("unbalanced parenthesis","value",e))}r&&t.push(r);return t}(e).map((function(e){return be.fromString(e,t)}))}var ve=function(){function e(t,r){ie(this,e),t!==ce&&ue.throwError("use a static from method",g.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),he(this,r),this._isFragment=!0,Object.freeze(this)}return se(e,null,[{key:"from",value:function(t){return e.isFragment(t)?t:"string"==typeof t?e.fromString(t):e.fromObject(t)}},{key:"fromObject",value:function(t){if(e.isFragment(t))return t;switch(t.type){case"function":return Ee.fromObject(t);case"event":return me.fromObject(t);case"constructor":return _e.fromObject(t);case"error":return Pe.fromObject(t);case"fallback":case"receive":return null}return ue.throwArgumentError("invalid fragment object","value",t)}},{key:"fromString",value:function(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?me.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Ee.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?_e.fromString(e.trim()):"error"===e.split(" ")[0]?Pe.fromString(e.substring(5).trim()):ue.throwArgumentError("unsupported fragment","value",e)}},{key:"isFragment",value:function(e){return!(!e||!e._isFragment)}}]),e}(),me=function(e){te(r,e);var t=ne(r);function r(){return ie(this,r),t.apply(this,arguments)}return se(r,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==pe.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+") ",e!==pe.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isEventFragment(e))return e;"event"!==e.type&&ue.throwArgumentError("invalid event object","value",e);var t={name:Oe(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(be.fromObject):[],type:"event"};return new r(ce,t)}},{key:"fromString",value:function(e){var t=e.match(xe);t||ue.throwArgumentError("invalid event string","value",e);var n=!1;return t[3].split(" ").forEach((function(e){switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:ue.warn("unknown modifier: "+e)}})),r.fromObject({name:t[1].trim(),anonymous:n,inputs:ge(t[2],!0),type:"event"})}},{key:"isEventFragment",value:function(e){return e&&e._isFragment&&"event"===e.type}}]),r}(ve);function we(e,t){t.gas=null;var r=e.split("@");return 1!==r.length?(r.length>2&&ue.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||ue.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=N.from(r[1]),r[0]):e}function Te(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((function(e){switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:Q.log("unknown modifier: "+e)}}))}function Ae(e){var t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&ue.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&ue.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||ue.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&ue.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&ue.throwArgumentError("unable to determine stateMutability","value",e),t}var _e=function(e){te(r,e);var t=ne(r);function r(){return ie(this,r),t.apply(this,arguments)}return se(r,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});e===pe.sighash&&ue.throwError("cannot format a constructor for sighash",g.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});var t="constructor("+this.inputs.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isConstructorFragment(e))return e;"constructor"!==e.type&&ue.throwArgumentError("invalid constructor object","value",e);var t=Ae(e);t.constant&&ue.throwArgumentError("constructor cannot be constant","value",e);var n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(be.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?N.from(e.gas):null};return new r(ce,n)}},{key:"fromString",value:function(e){var t={type:"constructor"},n=(e=we(e,t)).match(xe);return n&&"constructor"===n[1].trim()||ue.throwArgumentError("invalid constructor string","value",e),t.inputs=ge(n[2].trim(),!1),Te(n[3].trim(),t),r.fromObject(t)}},{key:"isConstructorFragment",value:function(e){return e&&e._isFragment&&"constructor"===e.type}}]),r}(ve),Ee=function(e){te(r,e);var t=ne(r);function r(){return ie(this,r),t.apply(this,arguments)}return se(r,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))})),outputs:this.outputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==pe.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+") ",e!==pe.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((function(t){return t.format(e)})).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isFunctionFragment(e))return e;"function"!==e.type&&ue.throwArgumentError("invalid function object","value",e);var t=Ae(e),n={type:e.type,name:Oe(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(be.fromObject):[],outputs:e.outputs?e.outputs.map(be.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?N.from(e.gas):null};return new r(ce,n)}},{key:"fromString",value:function(e){var t={type:"function"},n=(e=we(e,t)).split(" returns ");n.length>2&&ue.throwArgumentError("invalid function string","value",e);var o=n[0].match(xe);if(o||ue.throwArgumentError("invalid function signature","value",e),t.name=o[1].trim(),t.name&&Oe(t.name),t.inputs=ge(o[2],!1),Te(o[3].trim(),t),n.length>1){var i=n[1].match(xe);""==i[1].trim()&&""==i[3].trim()||ue.throwArgumentError("unexpected tokens","value",e),t.outputs=ge(i[2],!1)}else t.outputs=[];return r.fromObject(t)}},{key:"isFunctionFragment",value:function(e){return e&&e._isFragment&&"function"===e.type}}]),r}(_e);function Se(e){var t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||ue.throwArgumentError("cannot specify user defined ".concat(t," error"),"fragment",e),e}var Pe=function(e){te(r,e);var t=ne(r);function r(){return ie(this,r),t.apply(this,arguments)}return se(r,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==pe.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+") ").trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isErrorFragment(e))return e;"error"!==e.type&&ue.throwArgumentError("invalid error object","value",e);var t={type:e.type,name:Oe(e.name),inputs:e.inputs?e.inputs.map(be.fromObject):[]};return Se(new r(ce,t))}},{key:"fromString",value:function(e){var t={type:"error"},n=e.match(xe);return n||ue.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&Oe(t.name),t.inputs=ge(n[2],!1),Se(r.fromObject(t))}},{key:"isErrorFragment",value:function(e){return e&&e._isFragment&&"error"===e.type}}]),r}(ve);function ke(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var Be=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Oe(e){return e&&e.match(Be)||ue.throwArgumentError('invalid identifier "'.concat(e,'"'),"value",e),e}var xe=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Ce(e){return Ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ce(e)}function Ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Ce(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Ce(i)?i:String(i)),n)}var o,i}function Me(e,t,r){return t&&Re(e.prototype,t),r&&Re(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var Le=new g(Y);function Ne(e){var t=[];return function e(r,n){if(Array.isArray(n))for(var o in n){var i=r.slice();i.push(o);try{e(i,n[o])}catch(e){t.push({path:i,error:e})}}}([],e),t}var Fe=function(){function e(t,r,n,o){Ie(this,e),this.name=t,this.type=r,this.localName=n,this.dynamic=o}return Me(e,[{key:"_throwError",value:function(e,t){Le.throwArgumentError(e,this.localName,t)}}]),e}(),We=function(){function e(t){Ie(this,e),J(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}return Me(e,[{key:"data",get:function(){return e=this._data,t="0x",e.forEach((function(e){t+=k(e).substring(2)})),t;var e,t}},{key:"length",get:function(){return this._dataLength}},{key:"_writeData",value:function(e){return this._data.push(e),this._dataLength+=e.length,e.length}},{key:"appendWriter",value:function(e){return this._writeData(E(e._data))}},{key:"writeBytes",value:function(e){var t=_(e),r=t.length%this.wordSize;return r&&(t=E([t,this._padding.slice(r)])),this._writeData(t)}},{key:"_getValue",value:function(e){var t=_(N.from(e));return t.length>this.wordSize&&Le.throwError("value out-of-bounds",g.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=E([this._padding.slice(t.length%this.wordSize),t])),t}},{key:"writeValue",value:function(e){return this._writeData(this._getValue(e))}},{key:"writeUpdatableValue",value:function(){var e=this,t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,function(r){e._data[t]=e._getValue(r)}}}]),e}(),je=function(){function e(t,r,n,o){Ie(this,e),J(this,"_data",_(t)),J(this,"wordSize",r||32),J(this,"_coerceFunc",n),J(this,"allowLoose",o),this._offset=0}return Me(e,[{key:"data",get:function(){return k(this._data)}},{key:"consumed",get:function(){return this._offset}},{key:"coerce",value:function(t,r){return this._coerceFunc?this._coerceFunc(t,r):e.coerce(t,r)}},{key:"_peekBytes",value:function(e,t,r){var n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:Le.throwError("data out-of-bounds",g.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}},{key:"subReader",value:function(t){return new e(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}},{key:"readBytes",value:function(e,t){var r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}},{key:"readValue",value:function(){return N.from(this.readBytes(this.wordSize))}}],[{key:"coerce",value:function(e,t){var r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}}]),e}(),De=r(28086),Ue=r.n(De);function ze(e){return"0x"+Ue().keccak_256(_(e))}var He=new g("address/5.7.0");function Ge(e){S(e,20)||He.throwArgumentError("invalid address","address",e);for(var t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=t[n].charCodeAt(0);for(var o=_(ze(r)),i=0;i<40;i+=2)o[i>>1]>>4>=8&&(t[i]=t[i].toUpperCase()),(15&o[i>>1])>=8&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}for(var Je={},Ve=0;Ve<10;Ve++)Je[String(Ve)]=String(Ve);for(var Ke=0;Ke<26;Ke++)Je[String.fromCharCode(65+Ke)]=String(10+Ke);var Xe=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function $e(e){for(var t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((function(e){return Je[e]})).join("");t.length>=Xe;){var r=t.substring(0,Xe);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function Ze(e){var t,r=null;if("string"!=typeof e&&He.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),r=Ge(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&r!==e&&He.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==$e(e)&&He.throwArgumentError("bad icap checksum","address",e),t=e.substring(4),r=new C(t,36).toString(16);r.length<40;)r="0"+r;r=Ge("0x"+r)}else He.throwArgumentError("invalid address","address",e);return r}function qe(e){return qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qe(e)}function Ye(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==qe(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===qe(i)?i:String(i)),n)}var o,i}function Qe(e,t){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qe(e,t)}function et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=tt(e);if(t){var o=tt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===qe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function tt(e){return tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tt(e)}var rt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qe(e,t)}(i,e);var t,r,n,o=et(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,"address","address",e,!1)}return t=i,(r=[{key:"defaultValue",value:function(){return"0x0000000000000000000000000000000000000000"}},{key:"encode",value:function(e,t){try{t=Ze(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}},{key:"decode",value:function(e){return Ze(B(e.readValue().toHexString(),20))}}])&&Ye(t.prototype,r),n&&Ye(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function nt(e){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nt(e)}function ot(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==nt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===nt(i)?i:String(i)),n)}var o,i}function it(e,t){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},it(e,t)}function at(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=st(e);if(t){var o=st(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===nt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function st(e){return st=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},st(e)}var ut=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&it(e,t)}(i,e);var t,r,n,o=at(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e.name,e.type,void 0,e.dynamic)).coder=e,t}return t=i,(r=[{key:"defaultValue",value:function(){return this.coder.defaultValue()}},{key:"encode",value:function(e,t){return this.coder.encode(e,t)}},{key:"decode",value:function(e){return this.coder.decode(e)}}])&&ot(t.prototype,r),n&&ot(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function ct(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==ht(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===ht(i)?i:String(i)),n)}var o,i}function lt(e,t){return lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},lt(e,t)}function ft(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=dt(e);if(t){var o=dt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===ht(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function dt(e){return dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dt(e)}function ht(e){return ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ht(e)}var pt=new g(Y);function yt(e,t,r){var n=null;if(Array.isArray(r))n=r;else if(r&&"object"===ht(r)){var o={};n=t.map((function(e){var t=e.localName;return t||pt.throwError("cannot encode object for signature with missing names",g.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),o[t]&&pt.throwError("cannot encode object for signature with duplicate names",g.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),o[t]=!0,r[t]}))}else pt.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&pt.throwArgumentError("types/value length mismatch","tuple",r);var i=new We(e.wordSize),a=new We(e.wordSize),s=[];t.forEach((function(e,t){var r=n[t];if(e.dynamic){var o=a.length;e.encode(a,r);var u=i.writeUpdatableValue();s.push((function(e){u(e+o)}))}else e.encode(i,r)})),s.forEach((function(e){e(i.length)}));var u=e.appendWriter(i);return u+=e.appendWriter(a)}function bt(e,t){var r=[],n=e.subReader(0);t.forEach((function(t){var o=null;if(t.dynamic){var i=e.readValue(),a=n.subReader(i.toNumber());try{o=t.decode(a)}catch(e){if(e.code===g.errors.BUFFER_OVERRUN)throw e;(o=e).baseType=t.name,o.name=t.localName,o.type=t.type}}else try{o=t.decode(e)}catch(e){if(e.code===g.errors.BUFFER_OVERRUN)throw e;(o=e).baseType=t.name,o.name=t.localName,o.type=t.type}null!=o&&r.push(o)}));var o=t.reduce((function(e,t){var r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach((function(e,t){var n=e.localName;if(n&&1===o[n]&&("length"===n&&(n="_length"),null==r[n])){var i=r[t];i instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:function(){throw i}}):r[n]=i}}));for(var i=function(){var e=r[a];e instanceof Error&&Object.defineProperty(r,a,{enumerable:!0,get:function(){throw e}})},a=0;a<r.length;a++)i();return Object.freeze(r)}var gt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&<(e,t)}(i,e);var t,r,n,o=ft(i);function i(e,t,r){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var a=e.type+"["+(t>=0?t:"")+"]",s=-1===t||e.dynamic;return(n=o.call(this,"array",a,r,s)).coder=e,n.length=t,n}return t=i,r=[{key:"defaultValue",value:function(){for(var e=this.coder.defaultValue(),t=[],r=0;r<this.length;r++)t.push(e);return t}},{key:"encode",value:function(e,t){Array.isArray(t)||this._throwError("expected array value",t);var r=this.length;-1===r&&(r=t.length,e.writeValue(t.length)),pt.checkArgumentCount(t.length,r,"coder array"+(this.localName?" "+this.localName:""));for(var n=[],o=0;o<t.length;o++)n.push(this.coder);return yt(e,n,t)}},{key:"decode",value:function(e){var t=this.length;-1===t&&32*(t=e.readValue().toNumber())>e._data.length&&pt.throwError("insufficient data length",g.errors.BUFFER_OVERRUN,{length:e._data.length,count:t});for(var r=[],n=0;n<t;n++)r.push(new ut(this.coder));return e.coerce(this.name,bt(e,r))}}],r&&ct(t.prototype,r),n&&ct(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function vt(e){return vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vt(e)}function mt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==vt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==vt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===vt(i)?i:String(i)),n)}var o,i}function wt(e,t){return wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wt(e,t)}function Tt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=At(e);if(t){var o=At(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===vt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},At(e)}var _t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wt(e,t)}(i,e);var t,r,n,o=Tt(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,"bool","bool",e,!1)}return t=i,(r=[{key:"defaultValue",value:function(){return!1}},{key:"encode",value:function(e,t){return e.writeValue(t?1:0)}},{key:"decode",value:function(e){return e.coerce(this.type,!e.readValue().isZero())}}])&&mt(t.prototype,r),n&&mt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function Et(e){return Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Et(e)}function St(){return St="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=It(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},St.apply(this,arguments)}function Pt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Et(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Et(i)?i:String(i)),n)}var o,i}function Bt(e,t,r){return t&&kt(e.prototype,t),r&&kt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ot(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xt(e,t)}function xt(e,t){return xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xt(e,t)}function Ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=It(e);if(t){var o=It(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Et(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function It(e){return It=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},It(e)}var Rt=function(e){Ot(r,e);var t=Ct(r);function r(e,n){return Pt(this,r),t.call(this,e,e,n,!0)}return Bt(r,[{key:"defaultValue",value:function(){return"0x"}},{key:"encode",value:function(e,t){t=_(t);var r=e.writeValue(t.length);return r+=e.writeBytes(t)}},{key:"decode",value:function(e){return e.readBytes(e.readValue().toNumber(),!0)}}]),r}(Fe),Mt=function(e){Ot(r,e);var t=Ct(r);function r(e){return Pt(this,r),t.call(this,"bytes",e)}return Bt(r,[{key:"decode",value:function(e){return e.coerce(this.name,k(St(It(r.prototype),"decode",this).call(this,e)))}}]),r}(Rt);function Lt(e){return Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lt(e)}function Nt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Lt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Lt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Lt(i)?i:String(i)),n)}var o,i}function Ft(e,t){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ft(e,t)}function Wt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=jt(e);if(t){var o=jt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Lt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function jt(e){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jt(e)}var Dt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ft(e,t)}(i,e);var t,r,n,o=Wt(i);function i(e,t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var n="bytes"+String(e);return(r=o.call(this,n,n,t,!1)).size=e,r}return t=i,(r=[{key:"defaultValue",value:function(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}},{key:"encode",value:function(e,t){var r=_(t);return r.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(r)}},{key:"decode",value:function(e){return e.coerce(this.name,k(e.readBytes(this.size)))}}])&&Nt(t.prototype,r),n&&Nt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function Ut(e){return Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ut(e)}function zt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Ut(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Ut(i)?i:String(i)),n)}var o,i}function Ht(e,t){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ht(e,t)}function Gt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Jt(e);if(t){var o=Jt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Ut(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function Jt(e){return Jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Jt(e)}var Vt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ht(e,t)}(i,e);var t,r,n,o=Gt(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,"null","",e,!1)}return t=i,(r=[{key:"defaultValue",value:function(){return null}},{key:"encode",value:function(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}},{key:"decode",value:function(e){return e.readBytes(0),e.coerce(this.name,null)}}])&&zt(t.prototype,r),n&&zt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe),Kt=N.from(-1),Xt=N.from(0),$t=N.from(1),Zt=N.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function qt(e){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qt(e)}function Yt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==qt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==qt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===qt(i)?i:String(i)),n)}var o,i}function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qt(e,t)}function er(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=tr(e);if(t){var o=tr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===qt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function tr(e){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tr(e)}var rr,nr,or=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qt(e,t)}(i,e);var t,r,n,o=er(i);function i(e,t,r){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var a=(t?"int":"uint")+8*e;return(n=o.call(this,a,a,r,!1)).size=e,n.signed=t,n}return t=i,(r=[{key:"defaultValue",value:function(){return 0}},{key:"encode",value:function(e,t){var r=N.from(t),n=Zt.mask(8*e.wordSize);if(this.signed){var o=n.mask(8*this.size-1);(r.gt(o)||r.lt(o.add($t).mul(Kt)))&&this._throwError("value out-of-bounds",t)}else(r.lt(Xt)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(r)}},{key:"decode",value:function(e){var t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}])&&Yt(t.prototype,r),n&&Yt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe),ir=new g("strings/5.7.0");function ar(e,t,r,n,o){if(e===nr.BAD_PREFIX||e===nr.UNEXPECTED_CONTINUE){for(var i=0,a=t+1;a<r.length&&r[a]>>6==2;a++)i++;return i}return e===nr.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(rr||(rr={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(nr||(nr={}));var sr=Object.freeze({error:function(e,t,r,n,o){return ir.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",r)},ignore:ar,replace:function(e,t,r,n,o){return e===nr.OVERLONG?(n.push(o),0):(n.push(65533),ar(e,t,r))}});function ur(e,t){null==t&&(t=sr.error),e=_(e);for(var r=[],n=0;n<e.length;){var o=e[n++];if(o>>7!=0){var i=null,a=null;if(192==(224&o))i=1,a=127;else if(224==(240&o))i=2,a=2047;else{if(240!=(248&o)){n+=t(128==(192&o)?nr.UNEXPECTED_CONTINUE:nr.BAD_PREFIX,n-1,e,r);continue}i=3,a=65535}if(n-1+i>=e.length)n+=t(nr.OVERRUN,n-1,e,r);else{for(var s=o&(1<<8-i-1)-1,u=0;u<i;u++){var c=e[n];if(128!=(192&c)){n+=t(nr.MISSING_CONTINUE,n,e,r),s=null;break}s=s<<6|63&c,n++}null!==s&&(s>1114111?n+=t(nr.OUT_OF_RANGE,n-1-i,e,r,s):s>=55296&&s<=57343?n+=t(nr.UTF16_SURROGATE,n-1-i,e,r,s):s<=a?n+=t(nr.OVERLONG,n-1-i,e,r,s):r.push(s))}}else r.push(o)}return r}function cr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rr.current;t!=rr.current&&(ir.checkNormalize(),e=e.normalize(t));for(var r=[],n=0;n<e.length;n++){var o=e.charCodeAt(n);if(o<128)r.push(o);else if(o<2048)r.push(o>>6|192),r.push(63&o|128);else if(55296==(64512&o)){n++;var i=e.charCodeAt(n);if(n>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");var a=65536+((1023&o)<<10)+(1023&i);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(o>>12|224),r.push(o>>6&63|128),r.push(63&o|128)}return _(r)}function lr(e,t){return ur(e,t).map((function(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))})).join("")}function fr(e){return fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fr(e)}function dr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==fr(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===fr(i)?i:String(i)),n)}var o,i}function hr(){return hr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=br(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},hr.apply(this,arguments)}function pr(e,t){return pr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pr(e,t)}function yr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=br(e);if(t){var o=br(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===fr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function br(e){return br=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},br(e)}var gr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pr(e,t)}(i,e);var t,r,n,o=yr(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,"string",e)}return t=i,(r=[{key:"defaultValue",value:function(){return""}},{key:"encode",value:function(e,t){return hr(br(i.prototype),"encode",this).call(this,e,cr(t))}},{key:"decode",value:function(e){return lr(hr(br(i.prototype),"decode",this).call(this,e))}}])&&dr(t.prototype,r),n&&dr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Rt);function vr(e){return vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vr(e)}function mr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==vr(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===vr(i)?i:String(i)),n)}var o,i}function wr(e,t){return wr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wr(e,t)}function Tr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ar(e);if(t){var o=Ar(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===vr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function Ar(e){return Ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ar(e)}var _r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wr(e,t)}(i,e);var t,r,n,o=Tr(i);function i(e,t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var n=!1,a=[];e.forEach((function(e){e.dynamic&&(n=!0),a.push(e.type)}));var s="tuple("+a.join(",")+")";return(r=o.call(this,"tuple",s,t,n)).coders=e,r}return t=i,(r=[{key:"defaultValue",value:function(){var e=[];this.coders.forEach((function(t){e.push(t.defaultValue())}));var t=this.coders.reduce((function(e,t){var r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});return this.coders.forEach((function(r,n){var o=r.localName;o&&1===t[o]&&("length"===o&&(o="_length"),null==e[o]&&(e[o]=e[n]))})),Object.freeze(e)}},{key:"encode",value:function(e,t){return yt(e,this.coders,t)}},{key:"decode",value:function(e){return e.coerce(this.name,bt(e,this.coders))}}])&&mr(t.prototype,r),n&&mr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function Er(e){return Er="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Er(e)}function Sr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Er(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Er(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Er(i)?i:String(i)),n)}var o,i}var Pr=new g(Y),kr=new RegExp(/^bytes([0-9]*)$/),Br=new RegExp(/^(u?int)([0-9]*)$/),Or=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),J(this,"coerceFunc",t||null)}var t,r,n;return t=e,(r=[{key:"_getCoder",value:function(e){var t=this;switch(e.baseType){case"address":return new rt(e.name);case"bool":return new _t(e.name);case"string":return new gr(e.name);case"bytes":return new Mt(e.name);case"array":return new gt(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new _r((e.components||[]).map((function(e){return t._getCoder(e)})),e.name);case"":return new Vt(e.name)}var r=e.type.match(Br);if(r){var n=parseInt(r[2]||"256");return(0===n||n>256||n%8!=0)&&Pr.throwArgumentError("invalid "+r[1]+" bit length","param",e),new or(n/8,"int"===r[1],e.name)}if(r=e.type.match(kr)){var o=parseInt(r[1]);return(0===o||o>32)&&Pr.throwArgumentError("invalid bytes length","param",e),new Dt(o,e.name)}return Pr.throwArgumentError("invalid type","type",e.type)}},{key:"_getWordSize",value:function(){return 32}},{key:"_getReader",value:function(e,t){return new je(e,this._getWordSize(),this.coerceFunc,t)}},{key:"_getWriter",value:function(){return new We(this._getWordSize())}},{key:"getDefaultValue",value:function(e){var t=this,r=e.map((function(e){return t._getCoder(be.from(e))}));return new _r(r,"_").defaultValue()}},{key:"encode",value:function(e,t){var r=this;e.length!==t.length&&Pr.throwError("types/values length mismatch",g.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var n=e.map((function(e){return r._getCoder(be.from(e))})),o=new _r(n,"_"),i=this._getWriter();return o.encode(i,t),i.data}},{key:"decode",value:function(e,t,r){var n=this,o=e.map((function(e){return n._getCoder(be.from(e))}));return new _r(o,"_").decode(this._getReader(_(t),r))}}])&&Sr(t.prototype,r),n&&Sr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),xr=new Or;function Cr(e){return ze(cr(e))}function Ir(e){return Ir="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ir(e)}function Rr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Ir(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ir(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Ir(i)?i:String(i)),n)}var o,i}function Mr(e,t,r){return t&&Rr(e.prototype,t),r&&Rr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fr(e,t)}function Fr(e,t){return Fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fr(e,t)}function Wr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=jr(e);if(t){var o=jr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Ir(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function jr(e){return jr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jr(e)}var Dr=new g(Y),Ur=function(e){Nr(r,e);var t=Wr(r);function r(){return Lr(this,r),t.apply(this,arguments)}return Mr(r)}(q),zr=function(e){Nr(r,e);var t=Wr(r);function r(){return Lr(this,r),t.apply(this,arguments)}return Mr(r)}(q),Hr=function(e){Nr(r,e);var t=Wr(r);function r(){return Lr(this,r),t.apply(this,arguments)}return Mr(r)}(q),Gr=function(e){Nr(r,e);var t=Wr(r);function r(){return Lr(this,r),t.apply(this,arguments)}return Mr(r,null,[{key:"isIndexed",value:function(e){return!(!e||!e._isIndexed)}}]),r}(q),Jr={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Vr(e,t){var r=new Error("deferred error during ABI decoding triggered accessing ".concat(e));return r.error=t,r}var Kr=function(){function e(t){var r=this;Lr(this,e);J(this,"fragments",("string"==typeof t?JSON.parse(t):t).map((function(e){return ve.from(e)})).filter((function(e){return null!=e}))),J(this,"_abiCoder",V(this instanceof e?this.constructor:void 0,"getAbiCoder")()),J(this,"functions",{}),J(this,"errors",{}),J(this,"events",{}),J(this,"structs",{}),this.fragments.forEach((function(e){var t=null;switch(e.type){case"constructor":return r.deploy?void Dr.warn("duplicate definition - constructor"):void J(r,"deploy",e);case"function":t=r.functions;break;case"event":t=r.events;break;case"error":t=r.errors;break;default:return}var n=e.format();t[n]?Dr.warn("duplicate definition - "+n):t[n]=e})),this.deploy||J(this,"deploy",_e.from({payable:!1,type:"constructor"})),J(this,"_isInterface",!0)}return Mr(e,[{key:"format",value:function(e){e||(e=pe.full),e===pe.sighash&&Dr.throwArgumentError("interface does not support formatting sighash","format",e);var t=this.fragments.map((function(t){return t.format(e)}));return e===pe.json?JSON.stringify(t.map((function(e){return JSON.parse(e)}))):t}},{key:"getFunction",value:function(e){if(S(e)){for(var t in this.functions)if(e===this.getSighash(t))return this.functions[t];Dr.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){var r=e.trim(),n=Object.keys(this.functions).filter((function(e){return e.split("(")[0]===r}));return 0===n.length?Dr.throwArgumentError("no matching function","name",r):n.length>1&&Dr.throwArgumentError("multiple matching functions","name",r),this.functions[n[0]]}var o=this.functions[Ee.fromString(e).format()];return o||Dr.throwArgumentError("no matching function","signature",e),o}},{key:"getEvent",value:function(e){if(S(e)){var t=e.toLowerCase();for(var r in this.events)if(t===this.getEventTopic(r))return this.events[r];Dr.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){var n=e.trim(),o=Object.keys(this.events).filter((function(e){return e.split("(")[0]===n}));return 0===o.length?Dr.throwArgumentError("no matching event","name",n):o.length>1&&Dr.throwArgumentError("multiple matching events","name",n),this.events[o[0]]}var i=this.events[me.fromString(e).format()];return i||Dr.throwArgumentError("no matching event","signature",e),i}},{key:"getError",value:function(e){if(S(e)){var t=V(this.constructor,"getSighash");for(var r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Dr.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){var n=e.trim(),o=Object.keys(this.errors).filter((function(e){return e.split("(")[0]===n}));return 0===o.length?Dr.throwArgumentError("no matching error","name",n):o.length>1&&Dr.throwArgumentError("multiple matching errors","name",n),this.errors[o[0]]}var i=this.errors[Ee.fromString(e).format()];return i||Dr.throwArgumentError("no matching error","signature",e),i}},{key:"getSighash",value:function(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return V(this.constructor,"getSighash")(e)}},{key:"getEventTopic",value:function(e){return"string"==typeof e&&(e=this.getEvent(e)),V(this.constructor,"getEventTopic")(e)}},{key:"_decodeParams",value:function(e,t){return this._abiCoder.decode(e,t)}},{key:"_encodeParams",value:function(e,t){return this._abiCoder.encode(e,t)}},{key:"encodeDeploy",value:function(e){return this._encodeParams(this.deploy.inputs,e||[])}},{key:"decodeErrorResult",value:function(e,t){"string"==typeof e&&(e=this.getError(e));var r=_(t);return k(r.slice(0,4))!==this.getSighash(e)&&Dr.throwArgumentError("data signature does not match error ".concat(e.name,"."),"data",k(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeErrorResult",value:function(e,t){return"string"==typeof e&&(e=this.getError(e)),k(E([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionData",value:function(e,t){"string"==typeof e&&(e=this.getFunction(e));var r=_(t);return k(r.slice(0,4))!==this.getSighash(e)&&Dr.throwArgumentError("data signature does not match function ".concat(e.name,"."),"data",k(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeFunctionData",value:function(e,t){return"string"==typeof e&&(e=this.getFunction(e)),k(E([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionResult",value:function(e,t){"string"==typeof e&&(e=this.getFunction(e));var r=_(t),n=null,o="",i=null,a=null,s=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(l){}break;case 4:var u=k(r.slice(0,4)),c=Jr[u];if(c)i=this._abiCoder.decode(c.inputs,r.slice(4)),a=c.name,s=c.signature,c.reason&&(n=i[0]),"Error"===a?o="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(i[0])):"Panic"===a&&(o="; VM Exception while processing transaction: reverted with panic code ".concat(i[0]));else try{var l=this.getError(u);i=this._abiCoder.decode(l.inputs,r.slice(4)),a=l.name,s=l.format()}catch(l){}}return Dr.throwError("call revert exception"+o,g.errors.CALL_EXCEPTION,{method:e.format(),data:k(t),errorArgs:i,errorName:a,errorSignature:s,reason:n})}},{key:"encodeFunctionResult",value:function(e,t){return"string"==typeof e&&(e=this.getFunction(e)),k(this._abiCoder.encode(e.outputs,t||[]))}},{key:"encodeFilterTopics",value:function(e,t){var r=this;"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Dr.throwError("too many arguments for "+e.format(),g.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});var n=[];e.anonymous||n.push(this.getEventTopic(e));var o=function(e,t){return"string"===e.type?Cr(t):"bytes"===e.type?ze(k(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=N.from(t).toHexString()),"address"===e.type&&r._abiCoder.encode(["address"],[t]),B(k(t),32))};for(t.forEach((function(t,r){var i=e.inputs[r];i.indexed?null==t?n.push(null):"array"===i.baseType||"tuple"===i.baseType?Dr.throwArgumentError("filtering with tuples or arrays not supported","contract."+i.name,t):Array.isArray(t)?n.push(t.map((function(e){return o(i,e)}))):n.push(o(i,t)):null!=t&&Dr.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+i.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}},{key:"encodeEventLog",value:function(e,t){var r=this;"string"==typeof e&&(e=this.getEvent(e));var n=[],o=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Dr.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((function(e,a){var s=t[a];if(e.indexed)if("string"===e.type)n.push(Cr(s));else if("bytes"===e.type)n.push(ze(s));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(r._abiCoder.encode([e.type],[s]))}else o.push(e),i.push(s)})),{data:this._abiCoder.encode(o,i),topics:n}}},{key:"decodeEventLog",value:function(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){var n=this.getEventTopic(e);S(r[0],32)&&r[0].toLowerCase()===n||Dr.throwError("fragment/topic mismatch",g.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var o=[],i=[],a=[];e.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(o.push(be.fromObject({type:"bytes32",name:e.name})),a.push(!0)):(o.push(e),a.push(!1)):(i.push(e),a.push(!1))}));var s=null!=r?this._abiCoder.decode(o,E(r)):null,u=this._abiCoder.decode(i,t,!0),c=[],l=0,f=0;e.inputs.forEach((function(e,t){if(e.indexed)if(null==s)c[t]=new Gr({_isIndexed:!0,hash:null});else if(a[t])c[t]=new Gr({_isIndexed:!0,hash:s[f++]});else try{c[t]=s[f++]}catch(e){c[t]=e}else try{c[t]=u[l++]}catch(e){c[t]=e}if(e.name&&null==c[e.name]){var r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:function(){throw Vr("property ".concat(JSON.stringify(e.name)),r)}}):c[e.name]=r}}));for(var d=function(e){var t=c[e];t instanceof Error&&Object.defineProperty(c,e,{enumerable:!0,get:function(){throw Vr("index ".concat(e),t)}})},h=0;h<c.length;h++)d(h);return Object.freeze(c)}},{key:"parseTransaction",value:function(e){var t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new zr({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:N.from(e.value||"0")}):null}},{key:"parseLog",value:function(e){var t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Ur({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}},{key:"parseError",value:function(e){var t=k(e),r=this.getError(t.substring(0,10).toLowerCase());return r?new Hr({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}}],[{key:"getAbiCoder",value:function(){return xr}},{key:"getAddress",value:function(e){return Ze(e)}},{key:"getSighash",value:function(e){return t=Cr(e.format()),r=0,n=4,"string"!=typeof t?t=k(t):(!S(t)||t.length%2)&&v.throwArgumentError("invalid hexData","value",t),r=2+2*r,null!=n?"0x"+t.substring(r,2+2*n):"0x"+t.substring(r);var t,r,n}},{key:"getEventTopic",value:function(e){return Cr(e.format())}},{key:"isInterface",value:function(e){return!(!e||!e._isInterface)}}]),e}()},82585:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.createCurve=t.getHash=void 0;
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.jcc_wallet=t():e.jcc_wallet=t()}(self,(()=>(()=>{var __webpack_modules__={97371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WALLET_IS_EMPTY=t.SECRET_IS_INVALID=t.PASSWORD_IS_WRONG=t.PASSWORD_IS_REQUIRED=t.KEYSTORE_IS_INVALID=t.ETH_PASSWORD_IS_WRONG=t.ADDRESS_IS_EXISTENT=void 0;t.PASSWORD_IS_REQUIRED="password is required";t.WALLET_IS_EMPTY="wallet is empty";var r="password is wrong";t.PASSWORD_IS_WRONG=r;t.KEYSTORE_IS_INVALID="keystore is invalid";var n="ethereum ".concat(r);t.ETH_PASSWORD_IS_WRONG=n;t.SECRET_IS_INVALID="secret is invalid";t.ADDRESS_IS_EXISTENT="address is existent"},50132:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createWallet=t.decryptKeystore=t.getAddress=t.isValidAddress=t.isValidSecret=void 0;var i=o(r(39999)),a=r(68692),s=r(39933),u=r(87754),c=o(r(7314)),l=o(r(34851)),f=r(97371),d=function(e){e=(0,u.filterOx)(e);try{return(0,a.isValidPrivate)(n.from(e,"hex"))}catch(e){return!1}};t.isValidSecret=d;t.isValidAddress=function(e){return(0,a.isValidAddress)(e)};t.getAddress=function(e){return e=(0,u.filterOx)(e),d(e)?s.Wallet.fromPrivateKey(n.from(e,"hex")).getAddressString():null};t.decryptKeystore=function(e,t){if(r=t,"[object Object]"!==Object.prototype.toString.call(r))throw new Error(f.KEYSTORE_IS_INVALID);var r,o=t.Crypto||t.crypto;if((0,u.isEmptyObject)(o)||(0,u.isEmptyObject)(o.cipherparams)||(0,u.isEmptyObject)(o.kdfparams))throw new Error(f.KEYSTORE_IS_INVALID);var a=n.from(o.cipherparams.iv,"hex"),s=o.kdfparams,d=(0,l.default)(n.from(e),n.from(s.salt,"hex"),s.n,s.r,s.p,s.dklen),h=n.from(o.ciphertext,"hex");if((0,c.default)("keccak256").update(n.concat([d.slice(16,32),h])).digest().toString("hex")!==o.mac)throw new Error(f.ETH_PASSWORD_IS_WRONG);var p=i.default.createDecipheriv("aes-128-ctr",d.slice(0,16),a);return n.concat([p.update(h),p.final()]).toString("hex")};t.createWallet=function(){var e=s.Wallet.generate();return{address:e.getAddressString(),secret:e.getPrivateKeyString()}}},22246:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getBIP44Chain=t.BIP44ChainMap=t.BIP44Chain=void 0;var o,i=n(r(86686));!function(e){e[e.BITCOIN=2147483648]="BITCOIN",e[e.BSC=2147492654]="BSC",e[e.EOS=2147483842]="EOS",e[e.TRON=2147483843]="TRON",e[e.ETC=2147483709]="ETC",e[e.ETH=2147483708]="ETH",e[e.HECO=2147484658]="HECO",e[e.MOAC=2147483962]="MOAC",e[e.POLYGON=2147484614]="POLYGON",e[e.RIPPLE=2147483792]="RIPPLE",e[e.SWTC=2147483963]="SWTC",e[e.CALL=2147484281]="CALL",e[e.BVCADT=2399141888]="BVCADT",e[e.STREAM=2399141889]="STREAM",e[e.BIZAIN=2399141890]="BIZAIN"}(o||(t.BIP44Chain=o={}));t.getBIP44Chain=function(e){return i.default.filter((function(t){return t[0]===e}))};var a=new Map([[o.BITCOIN,"bitcoin"],[o.BSC,"bsc"],[o.EOS,"eos"],[o.TRON,"tron"],[o.ETC,"etc"],[o.ETH,"ethereum"],[o.HECO,"heco"],[o.MOAC,"moac"],[o.POLYGON,"polygon"],[o.RIPPLE,"ripple"],[o.SWTC,"jingtum"],[o.CALL,"call"],[o.BVCADT,"bvcadt"],[o.STREAM,"stream"],[o.BIZAIN,"bizain"]]);t.BIP44ChainMap=a},47773:(e,t,r)=>{"use strict";var n=r(65851).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.plugin=void 0;var o=r(67678),i=r(70504),a=r(41452),s=r(39688),u=r(87754);t.plugin={checkPrivateKey:function(e){return 66===e.length?e.substring(2):e},address:function(e){if(e.privateKey){var t=this.checkPrivateKey(e.privateKey),r=n.from(t,"hex"),o=n.from(s.publicKeyCreate(r,!0));return i.PublicKey(o).toString()}if(e.publicKey){o=n.from(e.publicKey,"hex");return i.PublicKey(o).toString()}return null},isValidAddress:function(e){return i.isValidPublic(e)},isValidSecret:function(e){try{var t=this.checkPrivateKey((0,u.filterOx)(e)),r=n.from(t,"hex"),o=a.encode(128,r,!1);return i.isValidPrivate(o)}catch(e){return!1}},hash:function(e){return i.sha256(e)},sign:function(e,t){var r=n.from(this.checkPrivateKey((0,u.filterOx)(t)),"hex"),o=a.encode(128,r,!1);return i.sign(e,o,"utf8")},verify:function(e,t,r){return this.recover(e,t)===r},recover:function(e,t){return i.recover(t,e,"utf8")},proxy:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return o[e].apply(o,t)}}},27290:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.plugin=void 0;var s=r(39933),u=a(r(68692)),c=r(27648),l=r(87754);t.plugin={checkPrivateKey:function(e){return 66===e.length?e.substring(2):e},address:function(e){if(e.privateKey){var t=this.checkPrivateKey(e.privateKey),r=n.from(t,"hex");return s.Wallet.fromPrivateKey(r).getAddressString()}return e.publicKey?s.Wallet.fromPublicKey(n.from(e.publicKey,"hex")).getAddressString():null},isValidAddress:function(e){return u.isValidAddress(e)},isValidSecret:function(e){try{return u.isValidPrivate(n.from((0,l.filterOx)(e),"hex"))}catch(e){return!1}},hash:function(e){var t=u.bytesToHex((0,c.keccak256)(n.from(e,"utf-8")));return u.stripHexPrefix(t)},sign:function(e,t){var r=this.checkPrivateKey(t).toLowerCase(),o=(0,c.keccak256)(n.from(e,"utf-8")),i=u.ecsign(o,n.from(r,"hex"));return u.stripHexPrefix(u.bytesToHex(i.r))+u.stripHexPrefix(u.bytesToHex(i.s))+i.v.toString(16)},verify:function(e,t,r){return this.recover(e,t)===r},recover:function(e,t){var r=(0,c.keccak256)(n.from(e,"utf-8")),o=n.from(n.from(t.substring(0,64),"hex")),i=n.from(n.from(t.substring(64,128),"hex")),a=u.hexToBytes("0x"+t.substring(128,130)),l=u.ecrecover(r,u.bytesToBigInt(a),o,i);return s.Wallet.fromPublicKey(l).getAddressString()},proxy:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return u[e].apply(u,t)}}},83602:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HDWallet=t.getBIP44Chain=t.BIP44ChainMap=t.BIP44Chain=void 0;var u=r(55050),c=a(r(49485)),l=s(r(4806)),f=a(r(65735)),d=r(22246);Object.defineProperty(t,"BIP44Chain",{enumerable:!0,get:function(){return d.BIP44Chain}}),Object.defineProperty(t,"BIP44ChainMap",{enumerable:!0,get:function(){return d.BIP44ChainMap}}),Object.defineProperty(t,"getBIP44Chain",{enumerable:!0,get:function(){return d.getBIP44Chain}});var h=r(541),p=u.KeyPair.addressCodec,y=function(){function e(t){var r=this;if(this.isRoot=function(){return r._path.chain+r._path.account+r._path.change+r._path.index===0},this.deriveWallet=function(t){if(isNaN(t.chain)||isNaN(t.account)||isNaN(t.index))return null;var n=e.getHDKeypair(r._secret,t.chain,t.account,t.index);return new e({keypair:n,path:{chain:t.chain,account:t.account,change:0,index:t.index}})},this.secret=function(){return r._secret},this.mnemonic=function(){return r._mnemonic},this.chain=function(){return r.isRoot()?d.BIP44ChainMap.get(d.BIP44Chain.SWTC):d.BIP44ChainMap.get(r._path.chain)},this.address=function(){if(!r._address){var e=r.chain();r._address=(0,h.getPluginByType)(e).address(r._secret?r._secret:r._keypair,e)}return r._address},this.isValidAddress=function(e){return(0,h.getPluginByType)(r.chain()).isValidAddress(e)},this.isValidSecret=function(e){return(0,h.getPluginByType)(r.chain()).isValidSecret(e)},this.hash=function(e){return(0,h.getPluginByType)(r.chain()).hash(e)},this.sign=function(e){return(0,h.getPluginByType)(r.chain()).sign(e,r._keypair.privateKey)},this.verify=function(e,t,n,o){return n||(n=r.address()),o||(o=r._keypair),(0,h.getPluginByType)(r.chain()).verify(e,t,n,o)},this.recover=function(e,t){return(0,h.getPluginByType)(r.chain()).recover(e,t)},this.getWalletApi=function(){return(0,h.getPluginByType)(r.chain())},this.keypair=function(){return r._keypair},this.path=function(){return r._path},this.setKeypair=function(e){r._keypair=e},!t)throw new Error("undefined parameters: "+t);if(this._path={chain:0,account:0,change:0,index:0},t.mnemonic)return this._secret=e.getSecretFromMnemonic(t.mnemonic,t.language),this._keypair=e.getKeypairFromSecret(this._secret),this._mnemonic={mnemonic:t.mnemonic,language:t.language},this;if(t.secret)return this._secret=t.secret,this._keypair=e.getKeypairFromSecret(this._secret),this._mnemonic={mnemonic:e.getMnemonicFromSecret(this._secret,t.language),language:t.language},this;if(t.keypair)return t.path?(this._keypair=t.keypair,this._mnemonic=null,this._secret=null,this._path=t.path):(this._keypair=t.keypair,this._mnemonic=null,this._secret=null),this;throw new Error("invalid parameters: "+t)}return e.generateMnemonic=function(e,t){return void 0===e&&(e=128),void 0===t&&(t="english"),c.setDefaultWordlist(t),c.generateMnemonic(e)},e.getSecretFromMnemonic=function(e,t){void 0===t&&(t="english"),c.setDefaultWordlist(t);var r=c.mnemonicToEntropy(e);return p.encodeSeed(n.from(r,"hex"))},e.getMnemonicFromSecret=function(e,t){void 0===t&&(t="english"),c.setDefaultWordlist(t);var r=p.decodeSeed(e).bytes;return c.entropyToMnemonic(r)},e.getKeypairFromSecret=function(e){return u.KeyPair.deriveKeypair(e)},e.getHDKeypair=function(t,r,n,o){void 0===n&&(n=0);var i=(0,d.getBIP44Chain)(r);if(0===i.length)return null;var a=i[0][0]<<1>>1,s=e.getMnemonicFromSecret(t),h=c.mnemonicToSeedSync(s),p=(0,l.default)(f).fromSeed(h).derivePath("m/44'/".concat(a,"'/").concat(n,"'/0/").concat(o)).privateKey;return u.KeyPair.deriveKeypair(p.toString("hex"))},e.generate=function(t){t||(t={});var r=e.generateMnemonic(t.len,t.language);return new e({mnemonic:r,language:t.language})},e.fromSecret=function(t){return new e({secret:t})},e.fromMnemonic=function(t){return new e({mnemonic:t.mnemonic,language:t.language})},e.fromKeypair=function(t){return new e({keypair:t})},e}();t.HDWallet=y},541:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPluginByType=void 0;var n=r(27290),o=r(27290),i=r(27290),a=r(27290),s=r(84918),u=r(47773),c=r(1047),l={ethereum:n.plugin,bsc:o.plugin,heco:i.plugin,polygon:a.plugin,tron:s.plugin,eos:u.plugin,bvcadt:(0,c.XWallet)("bvcadt"),call:(0,c.XWallet)("call"),ripple:(0,c.XWallet)("ripple"),stream:(0,c.XWallet)("stream"),bizain:(0,c.XWallet)("bizain"),jingtum:(0,c.XWallet)("jingtum"),moac:n.plugin};t.getPluginByType=function(e){return l[e]}},1047:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XWallet=void 0;var n=r(55050),o=r(76998);t.XWallet=function(e){return{wallet:(0,n.Factory)(e),address:function(e){try{if("string"==typeof e)return this.wallet.fromSecret(e).address;var t=this.wallet.KeyPair;return e.privateKey?t.deriveAddress(t.deriveKeyPair(e.privateKey).publicKey):e.publicKey?t.deriveAddress(e.publicKey):null}catch(e){return null}},isValidAddress:function(e){return this.wallet.isValidAddress(e)},isValidSecret:function(e){return this.wallet.isValidSecret(e)},hash:function(e){return(0,o.funcBytesToHex)(this.wallet.hash(e))},sign:function(e,t){return this.wallet.KeyPair.sign(e,t)},verify:function(e,t,r,n){return r===this.address(n)&&(n.publicKey||(n=this.wallet.KeyPair.deriveKeyPair(n.privateKey)),this.wallet.KeyPair.verify(e,t,n.publicKey))},recover:function(){return"swtclib does not support."},proxy:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return(t=this.wallet)[e].apply(t,r)}}}},84918:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.plugin=void 0;var n=r(81898);t.plugin={checkPrivateKey:function(e){return 66===e.length?e.substring(2):e},address:function(e){if(e.privateKey){var t=this.checkPrivateKey(e.privateKey);return n.address.fromPrivateKey(t)}if(e.publicKey){var r=n.utils.code.hexStr2byteArray(e.publicKey),o=n.utils.crypto.computeAddress(r);return n.utils.crypto.getBase58CheckAddress(o)}return null},isValidAddress:function(e){return n.utils.crypto.isAddressValid(e)},isValidSecret:function(e){try{var t=n.utils.code.hexStr2byteArray(this.checkPrivateKey(e)),r=n.utils.crypto.getPubKeyFromPriKey(t),o=n.utils.crypto.computeAddress(r),i=n.utils.crypto.getBase58CheckAddress(o);return this.isValidAddress(i)}catch(e){return!1}},hash:function(e){return n.utils.message.hashMessage(e)},sign:function(e,t){var r=this.checkPrivateKey(t).toLowerCase();return n.Trx.signMessageV2(e,r)},verify:function(e,t,r){return this.recover(e,t)===r},recover:function(e,t){return n.Trx.verifyMessageV2(e,t)},proxy:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return n[e].apply(n,t)}}},34989:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.hdWallet=t.moacWallet=t.JingchangWallet=t.ethWallet=void 0;var u=i(r(50132));t.ethWallet=u;var c=s(r(63410));t.JingchangWallet=c.default;var l=i(r(11760));t.moacWallet=l;var f=i(r(83602));t.hdWallet=f,a(r(1339),t)},63410:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=a(r(28562)),u=a(r(58390)),c=a(r(39999)),l=a(r(75755)),f=r(87754),d=a(r(75261)),h=r(77311),p=r(97371),y=r(1339),b=r(22836);d.default.prefix="jingchang_";var g=function(){function e(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=!0),this._multiple=t,this._jingchangWallet=e,this._samePassword=r}return e.isValid=function(e){try{"string"==typeof e&&(e=JSON.parse(e));var t=!(0,f.isEmptyObject)(e)&&Array.isArray(e.wallets)&&e.wallets.length>0;return Boolean(t&&e.contact&&e.id&&e.version)}catch(e){return!1}},e.generate=function(t,r,n){return new Promise((function(o,i){var a={};if(void 0===r){var s=y.jtWallet.createWallet();r=s.secret,a.address=s.address}else{if(!y.jtWallet.isValidSecret(r))return i(new Error(p.SECRET_IS_INVALID));a.address=y.jtWallet.getAddress(r)}a.secret=r,a.type="swt",a.default=!0,a.alias=n||"swt wallet";var u={},c=(0,b.encryptWallet)(t,a);return u.version=e.version,u.id=e._walletID,u.contact={},u.wallets=[],u.wallets.push(c),o(u)}))},e.get=function(){var t=d.default.get(e._walletID);return e.isValid(t)?t:null},e.clear=function(){d.default.set(e._walletID,{})},e.save=function(t){d.default.set(e._walletID,t)},e.deriveKeyPair=function(e,t){void 0===t&&(t="swt");var r=(0,h.Factory)(t).deriveKeyPair(e);return{privateKey:r.privateKey.substring(2),publicKey:r.publicKey}},e.encryptWithPublicKey=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,l.default.encrypt(n.from(t,"hex"),n.from(e))];case 1:return[2,{ciphertext:(r=o.sent()).ciphertext.toString("hex"),ephemPublicKey:r.ephemPublicKey.toString("hex"),iv:r.iv.toString("hex"),mac:r.mac.toString("hex")}]}}))}))},e.decryptWithPrivateKey=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return r={ciphertext:n.from(e.ciphertext,"hex"),ephemPublicKey:n.from(e.ephemPublicKey,"hex"),iv:n.from(e.iv,"hex"),mac:n.from(e.mac,"hex")},[4,l.default.decrypt(n.from(t,"hex"),r)];case 1:return[2,o.sent().toString()]}}))}))},e.getWallets=function(t){return e.isValid(t)?t.wallets:[]},e.prototype.setJingchangWallet=function(e){this._jingchangWallet=e},e.prototype.getAddress=function(e){return void 0===e&&(e="swt"),o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.getWalletWithType(e)];case 1:return[2,t.sent().address]}}))}))},e.prototype.getWalletWithType=function(e){return void 0===e&&(e="swt"),o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.findWallet((function(t){return t.type.toLowerCase()===e.toLowerCase()&&t.default}))]}))}))},e.prototype.getWalletWithAddress=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,this.findWallet((function(t){return t.address===e}))];case 1:return[2,t.sent()]}}))}))},e.prototype.hasDefault=function(e){void 0===e&&(e="swt");try{var t=this.findWallet((function(t){return t.type===e&&t.default}));return!(0,f.isEmptyObject)(t)}catch(e){return!1}},e.prototype.getSecretWithType=function(e,t){return void 0===t&&(t="swt"),o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.findWallet((function(e){return e.type===t&&e.default}))];case 1:return r=n.sent(),[2,(0,b.decrypt)(e,r)]}}))}))},e.prototype.getSecretWithAddress=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.findWallet((function(e){return e.address===t}))];case 1:return r=n.sent(),[2,(0,b.decrypt)(e,r)]}}))}))},e.prototype.changeWholePassword=function(t,r){return o(this,void 0,void 0,(function(){var n,o,a,c,l,f,d,h,p,y;return i(this,(function(i){switch(i.label){case 0:if(!this._samePassword)throw new Error("the property of _samePassword is false, so please don't call this function!");n=(0,u.default)(this._jingchangWallet),s.default.notEqual(n,this._jingchangWallet),o=e.getWallets(n),a=[],c=0,l=o,i.label=1;case 1:return c<l.length?(f=l[c],d=f.address,[4,this.getSecretWithAddress(t,d)]):[3,4];case 2:h=i.sent(),p={address:f.address,alias:f.alias,default:f.default,secret:h,type:f.type},y=this.getEncryptData(r,p),a.push(y),i.label=3;case 3:return c++,[3,1];case 4:return n.wallets=a,this.setJingchangWallet(n),[2,n]}}))}))},e.prototype.changePasswordWithAddress=function(e,t,r){return o(this,void 0,void 0,(function(){var n,o,a,s;return i(this,(function(i){switch(i.label){case 0:if(this._samePassword)throw new Error("the property of _samePassword is true, so please don't call this function!");return n=this.findWallet((function(t){return t.address===e})),[4,this.getSecretWithAddress(t,e)];case 1:return o=i.sent(),a={address:n.address,alias:n.alias,default:n.default,secret:o,type:n.type},s=this.getEncryptData(r,a),n.ciphertext=s.ciphertext,n.crypto=s.crypto,n.mac=s.mac,[2,this._jingchangWallet]}}))}))},e.prototype.replaceKeystore=function(e,t,r){return o(this,void 0,void 0,(function(){var n,o,a,s;return i(this,(function(i){return n=r(e),o=this.findWallet((function(e){return e.address===n})),a={address:o.address,alias:o.alias,default:o.default,secret:e,type:o.type},s=this.getEncryptData(t,a),o.ciphertext=s.ciphertext,o.crypto=s.crypto,o.mac=s.mac,[2,this._jingchangWallet]}))}))},e.prototype.removeWalletWithType=function(e){return void 0===e&&(e="swt"),o(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.getAddress(e)];case 1:return t=r.sent(),[4,this.removeWalletWithAddress(t)];case 2:return[2,r.sent()]}}))}))},e.prototype.removeWalletWithAddress=function(t){return o(this,void 0,void 0,(function(){var r,n,o,a,c;return i(this,(function(i){return r=(0,u.default)(this._jingchangWallet),s.default.notEqual(this._jingchangWallet,r),n=e.getWallets(r),o=this.findWallet((function(e){return e.address===t})),a=n.findIndex((function(e){return e.address===o.address})),n.splice(a,1),(c=n.find((function(e){return e.type===o.type})))&&(c.default=!0),this.setJingchangWallet(r),[2,r]}))}))},e.prototype.setDefaultWallet=function(e){return o(this,void 0,void 0,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.getWalletWithAddress(e)];case 1:return(t=r.sent()).default?[2,this._jingchangWallet]:[4,this.getWalletWithType(t.type)];case 2:return r.sent().default=!1,t.default=!0,[2,this._jingchangWallet]}}))}))},e.prototype.importSecret=function(t,r,n,a,s){return o(this,void 0,void 0,(function(){var o,u,c,l;return i(this,(function(i){switch(i.label){case 0:return this._samePassword?[4,this.getSecretWithType(r)]:[3,2];case 1:i.sent(),i.label=2;case 2:if(!(o=a(t)))throw new Error(p.SECRET_IS_INVALID);if(u=e.getWallets(this._jingchangWallet),c=u.find((function(e){return e.address===o&&e.type===n})),c)throw new Error(p.ADDRESS_IS_EXISTENT);return l={address:o,alias:s||"".concat(n," wallet"),secret:t,type:n},[4,this.saveWallet(r,l)];case 3:return[2,i.sent()]}}))}))},e.prototype.findWallet=function(t){var r=this._jingchangWallet;if(!e.isValid(r))throw new Error(p.KEYSTORE_IS_INVALID);var n=r.wallets.find(t);if((0,f.isEmptyObject)(n))throw new Error(p.WALLET_IS_EMPTY);return n},e.prototype.getEncryptData=function(e,t){return(0,b.encryptWallet)(e,t,{})},e.prototype.saveWallet=function(e,t){return o(this,void 0,void 0,(function(){var r,n,o,a;return i(this,(function(i){return t.default=!this._multiple||!this.hasDefault(t.type),r=this.getEncryptData(e,t),n=(0,u.default)(this._jingchangWallet),s.default.notEqual(this._jingchangWallet,n),o=n.wallets,a=o.findIndex((function(e){return e.type.toLowerCase()===t.type.toLowerCase()})),this._multiple||a>=0&&o.splice(a,1),o.push(r),this.setJingchangWallet(n),[2,n]}))}))},e.version="1.0",e._name="wallets",e._walletID=c.default.createHash("sha256").update(e._name.toLowerCase()).digest("hex"),e}();t.default=g},11760:(e,t,r)=>{"use strict";var n=r(65851).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.createWallet=t.getAddress=t.isValidAddress=t.isValidSecret=void 0;var o=r(68692),i=r(39933),a=r(87754),s=function(e){e=(0,a.filterOx)(e);try{return(0,o.isValidPrivate)(n.from(e,"hex"))}catch(e){return!1}};t.isValidSecret=s;t.isValidAddress=function(e){return/^(0x)?[0-9a-fA-F]{40}$/.test((0,a.filterOx)(e))};t.getAddress=function(e){return e=(0,a.filterOx)(e),s(e)?i.Wallet.fromPrivateKey(n.from(e,"hex")).getAddressString():null};t.createWallet=function(){var e=i.Wallet.generate();return{address:e.getAddressString(),secret:e.getPrivateKeyString()}}},22836:function(e,t,r){"use strict";var n=r(65851).Buffer,o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.encryptWallet=t.encryptContact=t.encrypt=t.decrypt=void 0;var i=o(r(39999)),a=r(87754),s=o(r(7314)),u=o(r(30518)),c=o(r(34851)),l=r(97371);t.decrypt=function(e,t){if((0,a.isEmptyObject)(t)||(0,a.isEmptyObject)(t.crypto)||(0,a.isEmptyObject)(t.crypto.kdfparams))throw new Error(l.KEYSTORE_IS_INVALID);var r=n.from(t.crypto.iv,"hex"),o=t.crypto.kdfparams,u=(0,c.default)(n.from(e),n.from(o.salt,"hex"),o.n,o.r,o.p,o.dklen),f=n.from(t.ciphertext,"hex");if((0,s.default)("keccak256").update(n.concat([u.slice(16,32),f])).digest().toString("hex")!==t.mac)throw new Error(l.PASSWORD_IS_WRONG);var d=i.default.createDecipheriv("aes-128-ctr",u.slice(0,16),r);return n.concat([d.update(f),d.final()]).toString()};var f=function(e,t,r){var o=r.iv||(0,u.default)(16).toString("hex"),a={dklen:r.dklen||32,n:r.n||4096,p:r.p||1,r:r.r||8,salt:r.salt||(0,u.default)(32).toString("hex")},l=(0,c.default)(n.from(e),n.from(a.salt,"hex"),a.n,a.r,a.p,a.dklen),f=i.default.createCipheriv(r.cipher||"aes-128-ctr",l.slice(0,16),n.from(o,"hex")),d=n.concat([f.update(n.from(t)),f.final()]),h=(0,s.default)("keccak256").update(n.concat([l.slice(16,32),d])).digest();return{ciphertext:d.toString("hex"),crypto:{cipher:r.cipher||"aes-128-ctr",iv:o,kdf:"scrypt",kdfparams:a},mac:h.toString("hex")}};t.encrypt=f;t.encryptContact=function(e,t,r){return void 0===r&&(r={}),f(e,JSON.stringify(t),r)};t.encryptWallet=function(e,t,r){void 0===r&&(r={});var n=f(e,t.secret,r);return n.type=t.type||"swt",n.address=t.address,n.default="boolean"!=typeof t.default||t.default,n.alias=t.alias||"",n}},1339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rippleWallet=t.stmWallet=t.jtWallet=t.callWallet=t.bvcadtWallet=t.XWallet=void 0;var n,o=r(55050);!function(e){e.BVCADT="bvcadt",e.CALL="call",e.JINGTUM="jingtum",e.RIPPLE="ripple",e.STREAM="stream",e.BIZAIN="bizain"}(n||(n={}));t.XWallet=function(e){var t=(0,o.Factory)(e);return{isValidAddress:function(e){return t.isValidAddress(e)},isValidSecret:function(e){return t.isValidSecret(e)},getAddress:function(e){try{return t.fromSecret(e).address}catch(e){return null}},createWallet:function(e){var r;void 0===e&&(e={});try{r=t.generate(e)}catch(e){r=null}return r}}};var i=(0,t.XWallet)(n.BVCADT);t.bvcadtWallet=i;var a=(0,t.XWallet)(n.CALL);t.callWallet=a;var s=(0,t.XWallet)(n.JINGTUM);t.jtWallet=s;var u=(0,t.XWallet)(n.RIPPLE);t.rippleWallet=u;var c=(0,t.XWallet)(n.STREAM);t.stmWallet=c},28828:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AbiCoder:()=>Or,ConstructorFragment:()=>_e,ErrorFragment:()=>Pe,EventFragment:()=>me,FormatTypes:()=>pe,Fragment:()=>ve,FunctionFragment:()=>Ee,Indexed:()=>Gr,Interface:()=>Kr,LogDescription:()=>Ur,ParamType:()=>be,TransactionDescription:()=>zr,checkResultErrors:()=>Ne,defaultAbiCoder:()=>xr});var n=r(79919),o=r.n(n),i=r(1283);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==a(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===a(i)?i:String(i)),n)}var o,i}var u=!1,c=!1,l={debug:1,default:2,info:2,warning:3,error:4,off:5},f=l.default,d=null;var h,p,y=function(){try{var e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((function(t){try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(h||(h={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(p||(p={}));var b="0123456789abcdef",g=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}var t,r,n;return t=e,r=[{key:"_log",value:function(e,t){var r=e.toLowerCase();null==l[r]&&this.throwArgumentError("invalid log level name","logLevel",e),f>l[r]||i.log.apply(i,t)}},{key:"debug",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this._log(e.levels.DEBUG,r)}},{key:"info",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this._log(e.levels.INFO,r)}},{key:"warn",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this._log(e.levels.WARNING,r)}},{key:"makeError",value:function(t,r,n){if(c)return this.makeError("censored error",r,{});r||(r=e.errors.UNKNOWN_ERROR),n||(n={});var o=[];Object.keys(n).forEach((function(e){var t=n[e];try{if(t instanceof Uint8Array){for(var r="",i=0;i<t.length;i++)r+=b[t[i]>>4],r+=b[15&t[i]];o.push(e+"=Uint8Array(0x"+r+")")}else o.push(e+"="+JSON.stringify(t))}catch(t){o.push(e+"="+JSON.stringify(n[e].toString()))}})),o.push("code=".concat(r)),o.push("version=".concat(this.version));var i=t,a="";switch(r){case p.NUMERIC_FAULT:a="NUMERIC_FAULT";var s=t;switch(s){case"overflow":case"underflow":case"division-by-zero":a+="-"+s;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break;case p.CALL_EXCEPTION:case p.INSUFFICIENT_FUNDS:case p.MISSING_NEW:case p.NONCE_EXPIRED:case p.REPLACEMENT_UNDERPRICED:case p.TRANSACTION_REPLACED:case p.UNPREDICTABLE_GAS_LIMIT:a=r}a&&(t+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),o.length&&(t+=" ("+o.join(", ")+")");var u=new Error(t);return u.reason=i,u.code=r,Object.keys(n).forEach((function(e){u[e]=n[e]})),u}},{key:"throwError",value:function(e,t,r){throw this.makeError(e,t,r)}},{key:"throwArgumentError",value:function(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}},{key:"assert",value:function(e,t,r,n){e||this.throwError(t,r,n)}},{key:"assertArgument",value:function(e,t,r,n){e||this.throwArgumentError(t,r,n)}},{key:"checkNormalize",value:function(t){null==t&&(t="platform missing String.prototype.normalize"),y&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:y})}},{key:"checkSafeUint53",value:function(t,r){"number"==typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}},{key:"checkArgumentCount",value:function(t,r,n){n=n?": "+n:"",t<r&&this.throwError("missing argument"+n,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:r}),t>r&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}},{key:"checkNew",value:function(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}},{key:"checkAbstract",value:function(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}}],n=[{key:"globalLogger",value:function(){return d||(d=new e("logger/5.7.0")),d}},{key:"setCensorship",value:function(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),u){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}c=!!t,u=!!r}},{key:"setLogLevel",value:function(t){var r=l[t.toLowerCase()];null!=r?f=r:e.globalLogger().warn("invalid log level - "+t)}},{key:"from",value:function(t){return new e(t)}}],r&&s(t.prototype,r),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();g.errors=p,g.levels=h;var v=new g("bytes/5.7.0");function m(e){return!!e.toHexString}function w(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return w(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function T(e){return"number"==typeof e&&e==e&&e%1==0}function A(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!T(e.length)||e.length<0)return!1;for(var t=0;t<e.length;t++){var r=e[t];if(!T(r)||r<0||r>=256)return!1}return!0}function _(e,t){if(t||(t={}),"number"==typeof e){v.checkSafeUint53(e,"invalid arrayify value");for(var r=[];e;)r.unshift(255&e),e=parseInt(String(e/256));return 0===r.length&&r.push(0),w(new Uint8Array(r))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),m(e)&&(e=e.toHexString()),S(e)){var n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":v.throwArgumentError("hex data is odd-length","value",e));for(var o=[],i=0;i<n.length;i+=2)o.push(parseInt(n.substring(i,i+2),16));return w(new Uint8Array(o))}return A(e)?w(new Uint8Array(e)):v.throwArgumentError("invalid arrayify value","value",e)}function E(e){var t=e.map((function(e){return _(e)})),r=t.reduce((function(e,t){return e+t.length}),0),n=new Uint8Array(r);return t.reduce((function(e,t){return n.set(t,e),e+t.length}),0),w(n)}function S(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}var P="0123456789abcdef";function k(e,t){if(t||(t={}),"number"==typeof e){v.checkSafeUint53(e,"invalid hexlify value");for(var r="";e;)r=P[15&e]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),m(e))return e.toHexString();if(S(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":v.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(A(e)){for(var n="0x",o=0;o<e.length;o++){var i=e[o];n+=P[(240&i)>>4]+P[15&i]}return n}return v.throwArgumentError("invalid hexlify value","value",e)}function B(e,t){for("string"!=typeof e?e=k(e):S(e)||v.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&v.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}function x(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==O(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===O(i)?i:String(i)),n)}var o,i}var C=o().BN,I=new g("bignumber/5.7.0"),R={},M=9007199254740991;var L=!1,N=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t!==R&&I.throwError("cannot call constructor directly; use BigNumber.from",g.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}var t,r,n;return t=e,r=[{key:"fromTwos",value:function(e){return W(j(this).fromTwos(e))}},{key:"toTwos",value:function(e){return W(j(this).toTwos(e))}},{key:"abs",value:function(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}},{key:"add",value:function(e){return W(j(this).add(j(e)))}},{key:"sub",value:function(e){return W(j(this).sub(j(e)))}},{key:"div",value:function(t){return e.from(t).isZero()&&D("division-by-zero","div"),W(j(this).div(j(t)))}},{key:"mul",value:function(e){return W(j(this).mul(j(e)))}},{key:"mod",value:function(e){var t=j(e);return t.isNeg()&&D("division-by-zero","mod"),W(j(this).umod(t))}},{key:"pow",value:function(e){var t=j(e);return t.isNeg()&&D("negative-power","pow"),W(j(this).pow(t))}},{key:"and",value:function(e){var t=j(e);return(this.isNegative()||t.isNeg())&&D("unbound-bitwise-result","and"),W(j(this).and(t))}},{key:"or",value:function(e){var t=j(e);return(this.isNegative()||t.isNeg())&&D("unbound-bitwise-result","or"),W(j(this).or(t))}},{key:"xor",value:function(e){var t=j(e);return(this.isNegative()||t.isNeg())&&D("unbound-bitwise-result","xor"),W(j(this).xor(t))}},{key:"mask",value:function(e){return(this.isNegative()||e<0)&&D("negative-width","mask"),W(j(this).maskn(e))}},{key:"shl",value:function(e){return(this.isNegative()||e<0)&&D("negative-width","shl"),W(j(this).shln(e))}},{key:"shr",value:function(e){return(this.isNegative()||e<0)&&D("negative-width","shr"),W(j(this).shrn(e))}},{key:"eq",value:function(e){return j(this).eq(j(e))}},{key:"lt",value:function(e){return j(this).lt(j(e))}},{key:"lte",value:function(e){return j(this).lte(j(e))}},{key:"gt",value:function(e){return j(this).gt(j(e))}},{key:"gte",value:function(e){return j(this).gte(j(e))}},{key:"isNegative",value:function(){return"-"===this._hex[0]}},{key:"isZero",value:function(){return j(this).isZero()}},{key:"toNumber",value:function(){try{return j(this).toNumber()}catch(e){D("overflow","toNumber",this.toString())}return null}},{key:"toBigInt",value:function(){try{return BigInt(this.toString())}catch(e){}return I.throwError("this platform does not support BigInt",g.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}},{key:"toString",value:function(){return arguments.length>0&&(10===arguments[0]?L||(L=!0,I.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?I.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",g.errors.UNEXPECTED_ARGUMENT,{}):I.throwError("BigNumber.toString does not accept parameters",g.errors.UNEXPECTED_ARGUMENT,{})),j(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(e){return{type:"BigNumber",hex:this.toHexString()}}}],n=[{key:"from",value:function(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(R,F(t)):t.match(/^-?[0-9]+$/)?new e(R,F(new C(t))):I.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&D("underflow","BigNumber.from",t),(t>=M||t<=-M)&&D("overflow","BigNumber.from",t),e.from(String(t));var r=t;if("bigint"==typeof r)return e.from(r.toString());if(A(r))return e.from(k(r));if(r)if(r.toHexString){var n=r.toHexString();if("string"==typeof n)return e.from(n)}else{var o=r._hex;if(null==o&&"BigNumber"===r.type&&(o=r.hex),"string"==typeof o&&(S(o)||"-"===o[0]&&S(o.substring(1))))return e.from(o)}return I.throwArgumentError("invalid BigNumber value","value",t)}},{key:"isBigNumber",value:function(e){return!(!e||!e._isBigNumber)}}],r&&x(t.prototype,r),n&&x(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function F(e){if("string"!=typeof e)return F(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&I.throwArgumentError("invalid hex","value",e),"0x00"===(e=F(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function W(e){return N.from(F(e))}function j(e){var t=N.from(e).toHexString();return"-"===t[0]?new C("-"+t.substring(3),16):new C(t.substring(2),16)}function D(e,t,r){var n={fault:e,operation:t};return null!=r&&(n.value=r),I.throwError(e,g.errors.NUMERIC_FAULT,n)}function U(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==H(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===H(i)?i:String(i)),n)}var o,i}function z(e,t,r){return t&&U(e.prototype,t),r&&U(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function H(e){return H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H(e)}var G=new g("properties/5.7.0");function J(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function V(e,t){for(var r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!==H(e.prototype))break;e=Object.getPrototypeOf(e.prototype).constructor}return null}var K={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function X(e){if(null==e||K[H(e)])return!0;if(Array.isArray(e)||"object"===H(e)){if(!Object.isFrozen(e))return!1;for(var t=Object.keys(e),r=0;r<t.length;r++){var n=null;try{n=e[t[r]]}catch(e){continue}if(!X(n))return!1}return!0}return G.throwArgumentError("Cannot deepCopy ".concat(H(e)),"object",e)}function $(e){if(X(e))return e;if(Array.isArray(e))return Object.freeze(e.map((function(e){return Z(e)})));if("object"===H(e)){var t={};for(var r in e){var n=e[r];void 0!==n&&J(t,r,Z(n))}return t}return G.throwArgumentError("Cannot deepCopy ".concat(H(e)),"object",e)}function Z(e){return $(e)}var q=z((function e(t){for(var r in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t)this[r]=Z(t[r])})),Y="abi/5.7.0",Q=r(1283);function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}function te(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&re(e,t)}function re(e,t){return re=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},re(e,t)}function ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=oe(e);if(t){var o=oe(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===ee(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function oe(e){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oe(e)}function ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ae(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==ee(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===ee(i)?i:String(i)),n)}var o,i}function se(e,t,r){return t&&ae(e.prototype,t),r&&ae(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var ue=new g(Y),ce={},le={calldata:!0,memory:!0,storage:!0},fe={calldata:!0,memory:!0};function de(e,t){if("bytes"===e||"string"===e){if(le[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&fe[t])return!0;return(le[t]||"payable"===t)&&ue.throwArgumentError("invalid modifier","name",t),!1}function he(e,t){for(var r in t)J(e,r,t[r])}var pe=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),ye=new RegExp(/^(.*)\[([0-9]*)\]$/),be=function(){function e(t,r){ie(this,e),t!==ce&&ue.throwError("use fromString",g.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),he(this,r);var n=this.type.match(ye);he(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}return se(e,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json){var t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((function(t){return JSON.parse(t.format(e))}))),JSON.stringify(t)}var r="";return"array"===this.baseType?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==pe.sighash&&(r+=this.type),r+="("+this.components.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+")"):r+=this.type,e!==pe.sighash&&(!0===this.indexed&&(r+=" indexed"),e===pe.full&&this.name&&(r+=" "+this.name)),r}}],[{key:"from",value:function(t,r){return"string"==typeof t?e.fromString(t,r):e.fromObject(t)}},{key:"fromObject",value:function(t){return e.isParamType(t)?t:new e(ce,{name:t.name||null,type:ke(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}},{key:"fromString",value:function(t,r){return n=function(e,t){var r=e;function n(t){ue.throwArgumentError("unexpected character at position ".concat(t),"param",e)}function o(e){var r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},a=i,s=0;s<e.length;s++){var u=e[s];switch(u){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||n(s),a.state.allowType=!1,a.type=ke(a.type),a.components=[o(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(t||n(s),a.indexed=!0,a.name=""),de(a.type,a.name)&&(a.name=""),a.type=ke(a.type);var c=a;(a=a.parent)||n(s),delete c.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(t||n(s),a.indexed=!0,a.name=""),de(a.type,a.name)&&(a.name=""),a.type=ke(a.type);var l=o(a.parent);a.parent.components.push(l),delete a.parent,a=l;break;case" ":a.state.allowType&&""!==a.type&&(a.type=ke(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(t||n(s),a.indexed&&n(s),a.indexed=!0,a.name=""):de(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||n(s),a.type+=u,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||n(s),a.type+=u,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=u,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=u,delete a.state.allowArray):a.state.readArray?a.type+=u:n(s)}}return a.parent&&ue.throwArgumentError("unexpected eof","param",e),delete i.state,"indexed"===a.name?(t||n(r.length-7),a.indexed&&n(r.length-7),a.indexed=!0,a.name=""):de(a.type,a.name)&&(a.name=""),i.type=ke(i.type),i}(t,!!r),e.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}},{key:"isParamType",value:function(e){return!(null==e||!e._isParamType)}}]),e}();function ge(e,t){return function(e){e=e.trim();for(var t=[],r="",n=0,o=0;o<e.length;o++){var i=e[o];","===i&&0===n?(t.push(r),r=""):(r+=i,"("===i?n++:")"===i&&-1===--n&&ue.throwArgumentError("unbalanced parenthesis","value",e))}r&&t.push(r);return t}(e).map((function(e){return be.fromString(e,t)}))}var ve=function(){function e(t,r){ie(this,e),t!==ce&&ue.throwError("use a static from method",g.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),he(this,r),this._isFragment=!0,Object.freeze(this)}return se(e,null,[{key:"from",value:function(t){return e.isFragment(t)?t:"string"==typeof t?e.fromString(t):e.fromObject(t)}},{key:"fromObject",value:function(t){if(e.isFragment(t))return t;switch(t.type){case"function":return Ee.fromObject(t);case"event":return me.fromObject(t);case"constructor":return _e.fromObject(t);case"error":return Pe.fromObject(t);case"fallback":case"receive":return null}return ue.throwArgumentError("invalid fragment object","value",t)}},{key:"fromString",value:function(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?me.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Ee.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?_e.fromString(e.trim()):"error"===e.split(" ")[0]?Pe.fromString(e.substring(5).trim()):ue.throwArgumentError("unsupported fragment","value",e)}},{key:"isFragment",value:function(e){return!(!e||!e._isFragment)}}]),e}(),me=function(e){te(r,e);var t=ne(r);function r(){return ie(this,r),t.apply(this,arguments)}return se(r,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==pe.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+") ",e!==pe.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isEventFragment(e))return e;"event"!==e.type&&ue.throwArgumentError("invalid event object","value",e);var t={name:Oe(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(be.fromObject):[],type:"event"};return new r(ce,t)}},{key:"fromString",value:function(e){var t=e.match(xe);t||ue.throwArgumentError("invalid event string","value",e);var n=!1;return t[3].split(" ").forEach((function(e){switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:ue.warn("unknown modifier: "+e)}})),r.fromObject({name:t[1].trim(),anonymous:n,inputs:ge(t[2],!0),type:"event"})}},{key:"isEventFragment",value:function(e){return e&&e._isFragment&&"event"===e.type}}]),r}(ve);function we(e,t){t.gas=null;var r=e.split("@");return 1!==r.length?(r.length>2&&ue.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||ue.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=N.from(r[1]),r[0]):e}function Te(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((function(e){switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:Q.log("unknown modifier: "+e)}}))}function Ae(e){var t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&ue.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&ue.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||ue.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&ue.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&ue.throwArgumentError("unable to determine stateMutability","value",e),t}var _e=function(e){te(r,e);var t=ne(r);function r(){return ie(this,r),t.apply(this,arguments)}return se(r,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});e===pe.sighash&&ue.throwError("cannot format a constructor for sighash",g.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});var t="constructor("+this.inputs.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isConstructorFragment(e))return e;"constructor"!==e.type&&ue.throwArgumentError("invalid constructor object","value",e);var t=Ae(e);t.constant&&ue.throwArgumentError("constructor cannot be constant","value",e);var n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(be.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?N.from(e.gas):null};return new r(ce,n)}},{key:"fromString",value:function(e){var t={type:"constructor"},n=(e=we(e,t)).match(xe);return n&&"constructor"===n[1].trim()||ue.throwArgumentError("invalid constructor string","value",e),t.inputs=ge(n[2].trim(),!1),Te(n[3].trim(),t),r.fromObject(t)}},{key:"isConstructorFragment",value:function(e){return e&&e._isFragment&&"constructor"===e.type}}]),r}(ve),Ee=function(e){te(r,e);var t=ne(r);function r(){return ie(this,r),t.apply(this,arguments)}return se(r,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))})),outputs:this.outputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==pe.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+") ",e!==pe.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((function(t){return t.format(e)})).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isFunctionFragment(e))return e;"function"!==e.type&&ue.throwArgumentError("invalid function object","value",e);var t=Ae(e),n={type:e.type,name:Oe(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(be.fromObject):[],outputs:e.outputs?e.outputs.map(be.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?N.from(e.gas):null};return new r(ce,n)}},{key:"fromString",value:function(e){var t={type:"function"},n=(e=we(e,t)).split(" returns ");n.length>2&&ue.throwArgumentError("invalid function string","value",e);var o=n[0].match(xe);if(o||ue.throwArgumentError("invalid function signature","value",e),t.name=o[1].trim(),t.name&&Oe(t.name),t.inputs=ge(o[2],!1),Te(o[3].trim(),t),n.length>1){var i=n[1].match(xe);""==i[1].trim()&&""==i[3].trim()||ue.throwArgumentError("unexpected tokens","value",e),t.outputs=ge(i[2],!1)}else t.outputs=[];return r.fromObject(t)}},{key:"isFunctionFragment",value:function(e){return e&&e._isFragment&&"function"===e.type}}]),r}(_e);function Se(e){var t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||ue.throwArgumentError("cannot specify user defined ".concat(t," error"),"fragment",e),e}var Pe=function(e){te(r,e);var t=ne(r);function r(){return ie(this,r),t.apply(this,arguments)}return se(r,[{key:"format",value:function(e){if(e||(e=pe.sighash),pe[e]||ue.throwArgumentError("invalid format type","format",e),e===pe.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==pe.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===pe.full?", ":",")+") ").trim()}}],[{key:"from",value:function(e){return"string"==typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isErrorFragment(e))return e;"error"!==e.type&&ue.throwArgumentError("invalid error object","value",e);var t={type:e.type,name:Oe(e.name),inputs:e.inputs?e.inputs.map(be.fromObject):[]};return Se(new r(ce,t))}},{key:"fromString",value:function(e){var t={type:"error"},n=e.match(xe);return n||ue.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&Oe(t.name),t.inputs=ge(n[2],!1),Se(r.fromObject(t))}},{key:"isErrorFragment",value:function(e){return e&&e._isFragment&&"error"===e.type}}]),r}(ve);function ke(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var Be=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Oe(e){return e&&e.match(Be)||ue.throwArgumentError('invalid identifier "'.concat(e,'"'),"value",e),e}var xe=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Ce(e){return Ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ce(e)}function Ie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Ce(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Ce(i)?i:String(i)),n)}var o,i}function Me(e,t,r){return t&&Re(e.prototype,t),r&&Re(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var Le=new g(Y);function Ne(e){var t=[];return function e(r,n){if(Array.isArray(n))for(var o in n){var i=r.slice();i.push(o);try{e(i,n[o])}catch(e){t.push({path:i,error:e})}}}([],e),t}var Fe=function(){function e(t,r,n,o){Ie(this,e),this.name=t,this.type=r,this.localName=n,this.dynamic=o}return Me(e,[{key:"_throwError",value:function(e,t){Le.throwArgumentError(e,this.localName,t)}}]),e}(),We=function(){function e(t){Ie(this,e),J(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}return Me(e,[{key:"data",get:function(){return e=this._data,t="0x",e.forEach((function(e){t+=k(e).substring(2)})),t;var e,t}},{key:"length",get:function(){return this._dataLength}},{key:"_writeData",value:function(e){return this._data.push(e),this._dataLength+=e.length,e.length}},{key:"appendWriter",value:function(e){return this._writeData(E(e._data))}},{key:"writeBytes",value:function(e){var t=_(e),r=t.length%this.wordSize;return r&&(t=E([t,this._padding.slice(r)])),this._writeData(t)}},{key:"_getValue",value:function(e){var t=_(N.from(e));return t.length>this.wordSize&&Le.throwError("value out-of-bounds",g.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=E([this._padding.slice(t.length%this.wordSize),t])),t}},{key:"writeValue",value:function(e){return this._writeData(this._getValue(e))}},{key:"writeUpdatableValue",value:function(){var e=this,t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,function(r){e._data[t]=e._getValue(r)}}}]),e}(),je=function(){function e(t,r,n,o){Ie(this,e),J(this,"_data",_(t)),J(this,"wordSize",r||32),J(this,"_coerceFunc",n),J(this,"allowLoose",o),this._offset=0}return Me(e,[{key:"data",get:function(){return k(this._data)}},{key:"consumed",get:function(){return this._offset}},{key:"coerce",value:function(t,r){return this._coerceFunc?this._coerceFunc(t,r):e.coerce(t,r)}},{key:"_peekBytes",value:function(e,t,r){var n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:Le.throwError("data out-of-bounds",g.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}},{key:"subReader",value:function(t){return new e(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}},{key:"readBytes",value:function(e,t){var r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}},{key:"readValue",value:function(){return N.from(this.readBytes(this.wordSize))}}],[{key:"coerce",value:function(e,t){var r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}}]),e}(),De=r(28086),Ue=r.n(De);function ze(e){return"0x"+Ue().keccak_256(_(e))}var He=new g("address/5.7.0");function Ge(e){S(e,20)||He.throwArgumentError("invalid address","address",e);for(var t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=t[n].charCodeAt(0);for(var o=_(ze(r)),i=0;i<40;i+=2)o[i>>1]>>4>=8&&(t[i]=t[i].toUpperCase()),(15&o[i>>1])>=8&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}for(var Je={},Ve=0;Ve<10;Ve++)Je[String(Ve)]=String(Ve);for(var Ke=0;Ke<26;Ke++)Je[String.fromCharCode(65+Ke)]=String(10+Ke);var Xe=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function $e(e){for(var t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((function(e){return Je[e]})).join("");t.length>=Xe;){var r=t.substring(0,Xe);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function Ze(e){var t,r=null;if("string"!=typeof e&&He.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),r=Ge(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&r!==e&&He.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==$e(e)&&He.throwArgumentError("bad icap checksum","address",e),t=e.substring(4),r=new C(t,36).toString(16);r.length<40;)r="0"+r;r=Ge("0x"+r)}else He.throwArgumentError("invalid address","address",e);return r}function qe(e){return qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qe(e)}function Ye(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==qe(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===qe(i)?i:String(i)),n)}var o,i}function Qe(e,t){return Qe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qe(e,t)}function et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=tt(e);if(t){var o=tt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===qe(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function tt(e){return tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tt(e)}var rt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qe(e,t)}(i,e);var t,r,n,o=et(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,"address","address",e,!1)}return t=i,(r=[{key:"defaultValue",value:function(){return"0x0000000000000000000000000000000000000000"}},{key:"encode",value:function(e,t){try{t=Ze(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}},{key:"decode",value:function(e){return Ze(B(e.readValue().toHexString(),20))}}])&&Ye(t.prototype,r),n&&Ye(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function nt(e){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nt(e)}function ot(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==nt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===nt(i)?i:String(i)),n)}var o,i}function it(e,t){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},it(e,t)}function at(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=st(e);if(t){var o=st(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===nt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function st(e){return st=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},st(e)}var ut=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&it(e,t)}(i,e);var t,r,n,o=at(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=o.call(this,e.name,e.type,void 0,e.dynamic)).coder=e,t}return t=i,(r=[{key:"defaultValue",value:function(){return this.coder.defaultValue()}},{key:"encode",value:function(e,t){return this.coder.encode(e,t)}},{key:"decode",value:function(e){return this.coder.decode(e)}}])&&ot(t.prototype,r),n&&ot(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function ct(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==ht(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===ht(i)?i:String(i)),n)}var o,i}function lt(e,t){return lt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},lt(e,t)}function ft(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=dt(e);if(t){var o=dt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===ht(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function dt(e){return dt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dt(e)}function ht(e){return ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ht(e)}var pt=new g(Y);function yt(e,t,r){var n=null;if(Array.isArray(r))n=r;else if(r&&"object"===ht(r)){var o={};n=t.map((function(e){var t=e.localName;return t||pt.throwError("cannot encode object for signature with missing names",g.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),o[t]&&pt.throwError("cannot encode object for signature with duplicate names",g.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),o[t]=!0,r[t]}))}else pt.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&pt.throwArgumentError("types/value length mismatch","tuple",r);var i=new We(e.wordSize),a=new We(e.wordSize),s=[];t.forEach((function(e,t){var r=n[t];if(e.dynamic){var o=a.length;e.encode(a,r);var u=i.writeUpdatableValue();s.push((function(e){u(e+o)}))}else e.encode(i,r)})),s.forEach((function(e){e(i.length)}));var u=e.appendWriter(i);return u+=e.appendWriter(a)}function bt(e,t){var r=[],n=e.subReader(0);t.forEach((function(t){var o=null;if(t.dynamic){var i=e.readValue(),a=n.subReader(i.toNumber());try{o=t.decode(a)}catch(e){if(e.code===g.errors.BUFFER_OVERRUN)throw e;(o=e).baseType=t.name,o.name=t.localName,o.type=t.type}}else try{o=t.decode(e)}catch(e){if(e.code===g.errors.BUFFER_OVERRUN)throw e;(o=e).baseType=t.name,o.name=t.localName,o.type=t.type}null!=o&&r.push(o)}));var o=t.reduce((function(e,t){var r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach((function(e,t){var n=e.localName;if(n&&1===o[n]&&("length"===n&&(n="_length"),null==r[n])){var i=r[t];i instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:function(){throw i}}):r[n]=i}}));for(var i=function(){var e=r[a];e instanceof Error&&Object.defineProperty(r,a,{enumerable:!0,get:function(){throw e}})},a=0;a<r.length;a++)i();return Object.freeze(r)}var gt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&<(e,t)}(i,e);var t,r,n,o=ft(i);function i(e,t,r){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var a=e.type+"["+(t>=0?t:"")+"]",s=-1===t||e.dynamic;return(n=o.call(this,"array",a,r,s)).coder=e,n.length=t,n}return t=i,r=[{key:"defaultValue",value:function(){for(var e=this.coder.defaultValue(),t=[],r=0;r<this.length;r++)t.push(e);return t}},{key:"encode",value:function(e,t){Array.isArray(t)||this._throwError("expected array value",t);var r=this.length;-1===r&&(r=t.length,e.writeValue(t.length)),pt.checkArgumentCount(t.length,r,"coder array"+(this.localName?" "+this.localName:""));for(var n=[],o=0;o<t.length;o++)n.push(this.coder);return yt(e,n,t)}},{key:"decode",value:function(e){var t=this.length;-1===t&&32*(t=e.readValue().toNumber())>e._data.length&&pt.throwError("insufficient data length",g.errors.BUFFER_OVERRUN,{length:e._data.length,count:t});for(var r=[],n=0;n<t;n++)r.push(new ut(this.coder));return e.coerce(this.name,bt(e,r))}}],r&&ct(t.prototype,r),n&&ct(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function vt(e){return vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vt(e)}function mt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==vt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==vt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===vt(i)?i:String(i)),n)}var o,i}function wt(e,t){return wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wt(e,t)}function Tt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=At(e);if(t){var o=At(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===vt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function At(e){return At=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},At(e)}var _t=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wt(e,t)}(i,e);var t,r,n,o=Tt(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,"bool","bool",e,!1)}return t=i,(r=[{key:"defaultValue",value:function(){return!1}},{key:"encode",value:function(e,t){return e.writeValue(t?1:0)}},{key:"decode",value:function(e){return e.coerce(this.type,!e.readValue().isZero())}}])&&mt(t.prototype,r),n&&mt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function Et(e){return Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Et(e)}function St(){return St="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=It(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},St.apply(this,arguments)}function Pt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Et(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Et(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Et(i)?i:String(i)),n)}var o,i}function Bt(e,t,r){return t&&kt(e.prototype,t),r&&kt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ot(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xt(e,t)}function xt(e,t){return xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xt(e,t)}function Ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=It(e);if(t){var o=It(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Et(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function It(e){return It=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},It(e)}var Rt=function(e){Ot(r,e);var t=Ct(r);function r(e,n){return Pt(this,r),t.call(this,e,e,n,!0)}return Bt(r,[{key:"defaultValue",value:function(){return"0x"}},{key:"encode",value:function(e,t){t=_(t);var r=e.writeValue(t.length);return r+=e.writeBytes(t)}},{key:"decode",value:function(e){return e.readBytes(e.readValue().toNumber(),!0)}}]),r}(Fe),Mt=function(e){Ot(r,e);var t=Ct(r);function r(e){return Pt(this,r),t.call(this,"bytes",e)}return Bt(r,[{key:"decode",value:function(e){return e.coerce(this.name,k(St(It(r.prototype),"decode",this).call(this,e)))}}]),r}(Rt);function Lt(e){return Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lt(e)}function Nt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Lt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Lt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Lt(i)?i:String(i)),n)}var o,i}function Ft(e,t){return Ft=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ft(e,t)}function Wt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=jt(e);if(t){var o=jt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Lt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function jt(e){return jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jt(e)}var Dt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ft(e,t)}(i,e);var t,r,n,o=Wt(i);function i(e,t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var n="bytes"+String(e);return(r=o.call(this,n,n,t,!1)).size=e,r}return t=i,(r=[{key:"defaultValue",value:function(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}},{key:"encode",value:function(e,t){var r=_(t);return r.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(r)}},{key:"decode",value:function(e){return e.coerce(this.name,k(e.readBytes(this.size)))}}])&&Nt(t.prototype,r),n&&Nt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function Ut(e){return Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ut(e)}function zt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Ut(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ut(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Ut(i)?i:String(i)),n)}var o,i}function Ht(e,t){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ht(e,t)}function Gt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Jt(e);if(t){var o=Jt(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Ut(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function Jt(e){return Jt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Jt(e)}var Vt=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ht(e,t)}(i,e);var t,r,n,o=Gt(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,"null","",e,!1)}return t=i,(r=[{key:"defaultValue",value:function(){return null}},{key:"encode",value:function(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}},{key:"decode",value:function(e){return e.readBytes(0),e.coerce(this.name,null)}}])&&zt(t.prototype,r),n&&zt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe),Kt=N.from(-1),Xt=N.from(0),$t=N.from(1),Zt=N.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function qt(e){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qt(e)}function Yt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==qt(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==qt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===qt(i)?i:String(i)),n)}var o,i}function Qt(e,t){return Qt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qt(e,t)}function er(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=tr(e);if(t){var o=tr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===qt(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function tr(e){return tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tr(e)}var rr,nr,or=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qt(e,t)}(i,e);var t,r,n,o=er(i);function i(e,t,r){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var a=(t?"int":"uint")+8*e;return(n=o.call(this,a,a,r,!1)).size=e,n.signed=t,n}return t=i,(r=[{key:"defaultValue",value:function(){return 0}},{key:"encode",value:function(e,t){var r=N.from(t),n=Zt.mask(8*e.wordSize);if(this.signed){var o=n.mask(8*this.size-1);(r.gt(o)||r.lt(o.add($t).mul(Kt)))&&this._throwError("value out-of-bounds",t)}else(r.lt(Xt)||r.gt(n.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return r=r.toTwos(8*this.size).mask(8*this.size),this.signed&&(r=r.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(r)}},{key:"decode",value:function(e){var t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}])&&Yt(t.prototype,r),n&&Yt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe),ir=new g("strings/5.7.0");function ar(e,t,r,n,o){if(e===nr.BAD_PREFIX||e===nr.UNEXPECTED_CONTINUE){for(var i=0,a=t+1;a<r.length&&r[a]>>6==2;a++)i++;return i}return e===nr.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(rr||(rr={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(nr||(nr={}));var sr=Object.freeze({error:function(e,t,r,n,o){return ir.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",r)},ignore:ar,replace:function(e,t,r,n,o){return e===nr.OVERLONG?(n.push(o),0):(n.push(65533),ar(e,t,r))}});function ur(e,t){null==t&&(t=sr.error),e=_(e);for(var r=[],n=0;n<e.length;){var o=e[n++];if(o>>7!=0){var i=null,a=null;if(192==(224&o))i=1,a=127;else if(224==(240&o))i=2,a=2047;else{if(240!=(248&o)){n+=t(128==(192&o)?nr.UNEXPECTED_CONTINUE:nr.BAD_PREFIX,n-1,e,r);continue}i=3,a=65535}if(n-1+i>=e.length)n+=t(nr.OVERRUN,n-1,e,r);else{for(var s=o&(1<<8-i-1)-1,u=0;u<i;u++){var c=e[n];if(128!=(192&c)){n+=t(nr.MISSING_CONTINUE,n,e,r),s=null;break}s=s<<6|63&c,n++}null!==s&&(s>1114111?n+=t(nr.OUT_OF_RANGE,n-1-i,e,r,s):s>=55296&&s<=57343?n+=t(nr.UTF16_SURROGATE,n-1-i,e,r,s):s<=a?n+=t(nr.OVERLONG,n-1-i,e,r,s):r.push(s))}}else r.push(o)}return r}function cr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rr.current;t!=rr.current&&(ir.checkNormalize(),e=e.normalize(t));for(var r=[],n=0;n<e.length;n++){var o=e.charCodeAt(n);if(o<128)r.push(o);else if(o<2048)r.push(o>>6|192),r.push(63&o|128);else if(55296==(64512&o)){n++;var i=e.charCodeAt(n);if(n>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");var a=65536+((1023&o)<<10)+(1023&i);r.push(a>>18|240),r.push(a>>12&63|128),r.push(a>>6&63|128),r.push(63&a|128)}else r.push(o>>12|224),r.push(o>>6&63|128),r.push(63&o|128)}return _(r)}function lr(e,t){return ur(e,t).map((function(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))})).join("")}function fr(e){return fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fr(e)}function dr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==fr(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===fr(i)?i:String(i)),n)}var o,i}function hr(){return hr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=br(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:r):o.value}},hr.apply(this,arguments)}function pr(e,t){return pr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},pr(e,t)}function yr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=br(e);if(t){var o=br(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===fr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function br(e){return br=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},br(e)}var gr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&pr(e,t)}(i,e);var t,r,n,o=yr(i);function i(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),o.call(this,"string",e)}return t=i,(r=[{key:"defaultValue",value:function(){return""}},{key:"encode",value:function(e,t){return hr(br(i.prototype),"encode",this).call(this,e,cr(t))}},{key:"decode",value:function(e){return lr(hr(br(i.prototype),"decode",this).call(this,e))}}])&&dr(t.prototype,r),n&&dr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Rt);function vr(e){return vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vr(e)}function mr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==vr(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===vr(i)?i:String(i)),n)}var o,i}function wr(e,t){return wr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wr(e,t)}function Tr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ar(e);if(t){var o=Ar(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===vr(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function Ar(e){return Ar=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ar(e)}var _r=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wr(e,t)}(i,e);var t,r,n,o=Tr(i);function i(e,t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var n=!1,a=[];e.forEach((function(e){e.dynamic&&(n=!0),a.push(e.type)}));var s="tuple("+a.join(",")+")";return(r=o.call(this,"tuple",s,t,n)).coders=e,r}return t=i,(r=[{key:"defaultValue",value:function(){var e=[];this.coders.forEach((function(t){e.push(t.defaultValue())}));var t=this.coders.reduce((function(e,t){var r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});return this.coders.forEach((function(r,n){var o=r.localName;o&&1===t[o]&&("length"===o&&(o="_length"),null==e[o]&&(e[o]=e[n]))})),Object.freeze(e)}},{key:"encode",value:function(e,t){return yt(e,this.coders,t)}},{key:"decode",value:function(e){return e.coerce(this.name,bt(e,this.coders))}}])&&mr(t.prototype,r),n&&mr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),i}(Fe);function Er(e){return Er="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Er(e)}function Sr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Er(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Er(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Er(i)?i:String(i)),n)}var o,i}var Pr=new g(Y),kr=new RegExp(/^bytes([0-9]*)$/),Br=new RegExp(/^(u?int)([0-9]*)$/),Or=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),J(this,"coerceFunc",t||null)}var t,r,n;return t=e,(r=[{key:"_getCoder",value:function(e){var t=this;switch(e.baseType){case"address":return new rt(e.name);case"bool":return new _t(e.name);case"string":return new gr(e.name);case"bytes":return new Mt(e.name);case"array":return new gt(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new _r((e.components||[]).map((function(e){return t._getCoder(e)})),e.name);case"":return new Vt(e.name)}var r=e.type.match(Br);if(r){var n=parseInt(r[2]||"256");return(0===n||n>256||n%8!=0)&&Pr.throwArgumentError("invalid "+r[1]+" bit length","param",e),new or(n/8,"int"===r[1],e.name)}if(r=e.type.match(kr)){var o=parseInt(r[1]);return(0===o||o>32)&&Pr.throwArgumentError("invalid bytes length","param",e),new Dt(o,e.name)}return Pr.throwArgumentError("invalid type","type",e.type)}},{key:"_getWordSize",value:function(){return 32}},{key:"_getReader",value:function(e,t){return new je(e,this._getWordSize(),this.coerceFunc,t)}},{key:"_getWriter",value:function(){return new We(this._getWordSize())}},{key:"getDefaultValue",value:function(e){var t=this,r=e.map((function(e){return t._getCoder(be.from(e))}));return new _r(r,"_").defaultValue()}},{key:"encode",value:function(e,t){var r=this;e.length!==t.length&&Pr.throwError("types/values length mismatch",g.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var n=e.map((function(e){return r._getCoder(be.from(e))})),o=new _r(n,"_"),i=this._getWriter();return o.encode(i,t),i.data}},{key:"decode",value:function(e,t,r){var n=this,o=e.map((function(e){return n._getCoder(be.from(e))}));return new _r(o,"_").decode(this._getReader(_(t),r))}}])&&Sr(t.prototype,r),n&&Sr(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),xr=new Or;function Cr(e){return ze(cr(e))}function Ir(e){return Ir="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ir(e)}function Rr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(o=n.key,i=void 0,i=function(e,t){if("object"!==Ir(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==Ir(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(o,"string"),"symbol"===Ir(i)?i:String(i)),n)}var o,i}function Mr(e,t,r){return t&&Rr(e.prototype,t),r&&Rr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Lr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Fr(e,t)}function Fr(e,t){return Fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fr(e,t)}function Wr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=jr(e);if(t){var o=jr(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===Ir(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,r)}}function jr(e){return jr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},jr(e)}var Dr=new g(Y),Ur=function(e){Nr(r,e);var t=Wr(r);function r(){return Lr(this,r),t.apply(this,arguments)}return Mr(r)}(q),zr=function(e){Nr(r,e);var t=Wr(r);function r(){return Lr(this,r),t.apply(this,arguments)}return Mr(r)}(q),Hr=function(e){Nr(r,e);var t=Wr(r);function r(){return Lr(this,r),t.apply(this,arguments)}return Mr(r)}(q),Gr=function(e){Nr(r,e);var t=Wr(r);function r(){return Lr(this,r),t.apply(this,arguments)}return Mr(r,null,[{key:"isIndexed",value:function(e){return!(!e||!e._isIndexed)}}]),r}(q),Jr={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Vr(e,t){var r=new Error("deferred error during ABI decoding triggered accessing ".concat(e));return r.error=t,r}var Kr=function(){function e(t){var r=this;Lr(this,e);J(this,"fragments",("string"==typeof t?JSON.parse(t):t).map((function(e){return ve.from(e)})).filter((function(e){return null!=e}))),J(this,"_abiCoder",V(this instanceof e?this.constructor:void 0,"getAbiCoder")()),J(this,"functions",{}),J(this,"errors",{}),J(this,"events",{}),J(this,"structs",{}),this.fragments.forEach((function(e){var t=null;switch(e.type){case"constructor":return r.deploy?void Dr.warn("duplicate definition - constructor"):void J(r,"deploy",e);case"function":t=r.functions;break;case"event":t=r.events;break;case"error":t=r.errors;break;default:return}var n=e.format();t[n]?Dr.warn("duplicate definition - "+n):t[n]=e})),this.deploy||J(this,"deploy",_e.from({payable:!1,type:"constructor"})),J(this,"_isInterface",!0)}return Mr(e,[{key:"format",value:function(e){e||(e=pe.full),e===pe.sighash&&Dr.throwArgumentError("interface does not support formatting sighash","format",e);var t=this.fragments.map((function(t){return t.format(e)}));return e===pe.json?JSON.stringify(t.map((function(e){return JSON.parse(e)}))):t}},{key:"getFunction",value:function(e){if(S(e)){for(var t in this.functions)if(e===this.getSighash(t))return this.functions[t];Dr.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){var r=e.trim(),n=Object.keys(this.functions).filter((function(e){return e.split("(")[0]===r}));return 0===n.length?Dr.throwArgumentError("no matching function","name",r):n.length>1&&Dr.throwArgumentError("multiple matching functions","name",r),this.functions[n[0]]}var o=this.functions[Ee.fromString(e).format()];return o||Dr.throwArgumentError("no matching function","signature",e),o}},{key:"getEvent",value:function(e){if(S(e)){var t=e.toLowerCase();for(var r in this.events)if(t===this.getEventTopic(r))return this.events[r];Dr.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){var n=e.trim(),o=Object.keys(this.events).filter((function(e){return e.split("(")[0]===n}));return 0===o.length?Dr.throwArgumentError("no matching event","name",n):o.length>1&&Dr.throwArgumentError("multiple matching events","name",n),this.events[o[0]]}var i=this.events[me.fromString(e).format()];return i||Dr.throwArgumentError("no matching event","signature",e),i}},{key:"getError",value:function(e){if(S(e)){var t=V(this.constructor,"getSighash");for(var r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Dr.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){var n=e.trim(),o=Object.keys(this.errors).filter((function(e){return e.split("(")[0]===n}));return 0===o.length?Dr.throwArgumentError("no matching error","name",n):o.length>1&&Dr.throwArgumentError("multiple matching errors","name",n),this.errors[o[0]]}var i=this.errors[Ee.fromString(e).format()];return i||Dr.throwArgumentError("no matching error","signature",e),i}},{key:"getSighash",value:function(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return V(this.constructor,"getSighash")(e)}},{key:"getEventTopic",value:function(e){return"string"==typeof e&&(e=this.getEvent(e)),V(this.constructor,"getEventTopic")(e)}},{key:"_decodeParams",value:function(e,t){return this._abiCoder.decode(e,t)}},{key:"_encodeParams",value:function(e,t){return this._abiCoder.encode(e,t)}},{key:"encodeDeploy",value:function(e){return this._encodeParams(this.deploy.inputs,e||[])}},{key:"decodeErrorResult",value:function(e,t){"string"==typeof e&&(e=this.getError(e));var r=_(t);return k(r.slice(0,4))!==this.getSighash(e)&&Dr.throwArgumentError("data signature does not match error ".concat(e.name,"."),"data",k(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeErrorResult",value:function(e,t){return"string"==typeof e&&(e=this.getError(e)),k(E([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionData",value:function(e,t){"string"==typeof e&&(e=this.getFunction(e));var r=_(t);return k(r.slice(0,4))!==this.getSighash(e)&&Dr.throwArgumentError("data signature does not match function ".concat(e.name,"."),"data",k(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeFunctionData",value:function(e,t){return"string"==typeof e&&(e=this.getFunction(e)),k(E([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionResult",value:function(e,t){"string"==typeof e&&(e=this.getFunction(e));var r=_(t),n=null,o="",i=null,a=null,s=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(l){}break;case 4:var u=k(r.slice(0,4)),c=Jr[u];if(c)i=this._abiCoder.decode(c.inputs,r.slice(4)),a=c.name,s=c.signature,c.reason&&(n=i[0]),"Error"===a?o="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(i[0])):"Panic"===a&&(o="; VM Exception while processing transaction: reverted with panic code ".concat(i[0]));else try{var l=this.getError(u);i=this._abiCoder.decode(l.inputs,r.slice(4)),a=l.name,s=l.format()}catch(l){}}return Dr.throwError("call revert exception"+o,g.errors.CALL_EXCEPTION,{method:e.format(),data:k(t),errorArgs:i,errorName:a,errorSignature:s,reason:n})}},{key:"encodeFunctionResult",value:function(e,t){return"string"==typeof e&&(e=this.getFunction(e)),k(this._abiCoder.encode(e.outputs,t||[]))}},{key:"encodeFilterTopics",value:function(e,t){var r=this;"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Dr.throwError("too many arguments for "+e.format(),g.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});var n=[];e.anonymous||n.push(this.getEventTopic(e));var o=function(e,t){return"string"===e.type?Cr(t):"bytes"===e.type?ze(k(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=N.from(t).toHexString()),"address"===e.type&&r._abiCoder.encode(["address"],[t]),B(k(t),32))};for(t.forEach((function(t,r){var i=e.inputs[r];i.indexed?null==t?n.push(null):"array"===i.baseType||"tuple"===i.baseType?Dr.throwArgumentError("filtering with tuples or arrays not supported","contract."+i.name,t):Array.isArray(t)?n.push(t.map((function(e){return o(i,e)}))):n.push(o(i,t)):null!=t&&Dr.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+i.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}},{key:"encodeEventLog",value:function(e,t){var r=this;"string"==typeof e&&(e=this.getEvent(e));var n=[],o=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Dr.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((function(e,a){var s=t[a];if(e.indexed)if("string"===e.type)n.push(Cr(s));else if("bytes"===e.type)n.push(ze(s));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(r._abiCoder.encode([e.type],[s]))}else o.push(e),i.push(s)})),{data:this._abiCoder.encode(o,i),topics:n}}},{key:"decodeEventLog",value:function(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){var n=this.getEventTopic(e);S(r[0],32)&&r[0].toLowerCase()===n||Dr.throwError("fragment/topic mismatch",g.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var o=[],i=[],a=[];e.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(o.push(be.fromObject({type:"bytes32",name:e.name})),a.push(!0)):(o.push(e),a.push(!1)):(i.push(e),a.push(!1))}));var s=null!=r?this._abiCoder.decode(o,E(r)):null,u=this._abiCoder.decode(i,t,!0),c=[],l=0,f=0;e.inputs.forEach((function(e,t){if(e.indexed)if(null==s)c[t]=new Gr({_isIndexed:!0,hash:null});else if(a[t])c[t]=new Gr({_isIndexed:!0,hash:s[f++]});else try{c[t]=s[f++]}catch(e){c[t]=e}else try{c[t]=u[l++]}catch(e){c[t]=e}if(e.name&&null==c[e.name]){var r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:function(){throw Vr("property ".concat(JSON.stringify(e.name)),r)}}):c[e.name]=r}}));for(var d=function(e){var t=c[e];t instanceof Error&&Object.defineProperty(c,e,{enumerable:!0,get:function(){throw Vr("index ".concat(e),t)}})},h=0;h<c.length;h++)d(h);return Object.freeze(c)}},{key:"parseTransaction",value:function(e){var t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new zr({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:N.from(e.value||"0")}):null}},{key:"parseLog",value:function(e){var t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Ur({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}},{key:"parseError",value:function(e){var t=k(e),r=this.getError(t.substring(0,10).toLowerCase());return r?new Hr({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}}],[{key:"getAbiCoder",value:function(){return xr}},{key:"getAddress",value:function(e){return Ze(e)}},{key:"getSighash",value:function(e){return t=Cr(e.format()),r=0,n=4,"string"!=typeof t?t=k(t):(!S(t)||t.length%2)&&v.throwArgumentError("invalid hexData","value",t),r=2+2*r,null!=n?"0x"+t.substring(r,2+2*n):"0x"+t.substring(r);var t,r,n}},{key:"getEventTopic",value:function(e){return Cr(e.format())}},{key:"isInterface",value:function(e){return!(!e||!e._isInterface)}}]),e}()},82585:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.createCurve=t.getHash=void 0;
|
|
2
2
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
3
|
var s=r(39333),u=r(28670),c=r(88938);function l(e){return{hash:e,hmac:function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return(0,s.hmac)(e,t,u.concatBytes.apply(void 0,n))},randomBytes:u.randomBytes}}t.getHash=l,t.createCurve=function(e,t){var r=function(t){return(0,c.weierstrass)(i(i({},e),l(t)))};return Object.freeze(i(i({},r(t)),{},{create:r}))}},68013:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.validateBasic=t.wNAF=void 0;
|
|
4
4
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
package/lib/hd/plugins.js
CHANGED
|
@@ -26,7 +26,8 @@ var pluginMap = {
|
|
|
26
26
|
ripple: (0, swtc_plugin_1.XWallet)("ripple"),
|
|
27
27
|
stream: (0, swtc_plugin_1.XWallet)("stream"),
|
|
28
28
|
bizain: (0, swtc_plugin_1.XWallet)("bizain"),
|
|
29
|
-
jingtum: (0, swtc_plugin_1.XWallet)("jingtum")
|
|
29
|
+
jingtum: (0, swtc_plugin_1.XWallet)("jingtum"),
|
|
30
|
+
moac: ethereum_plugin_1.plugin
|
|
30
31
|
};
|
|
31
32
|
function getPluginByType(type) {
|
|
32
33
|
return pluginMap[type];
|
package/lib/hd/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/hd/plugins.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAC7D,qDAAwD;AACxD,qDAAyD;AACzD,qDAA4D;AAC5D,6CAAqD;AACrD,2CAAmD;AAEnD,wDAAwD;AACxD,0DAA0D;AAC1D,wDAAwD;AACxD,4DAA4D;AAC5D,0DAA0D;AAC1D,0DAA0D;AAC1D,6CAAwC;AAMxC,IAAM,SAAS,GAAe;IAC5B,QAAQ,EAAE,wBAAc;IACxB,GAAG,EAAE,wBAAS;IACd,IAAI,EAAE,wBAAU;IAChB,OAAO,EAAE,wBAAa;IACtB,IAAI,EAAE,oBAAU;IAChB,GAAG,EAAE,mBAAS;IACd,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,IAAI,EAAE,IAAA,qBAAO,EAAC,MAAM,CAAC;IACrB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,OAAO,EAAE,IAAA,qBAAO,EAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/hd/plugins.ts"],"names":[],"mappings":";;;AAAA,qDAA6D;AAC7D,qDAAwD;AACxD,qDAAyD;AACzD,qDAA4D;AAC5D,6CAAqD;AACrD,2CAAmD;AAEnD,wDAAwD;AACxD,0DAA0D;AAC1D,wDAAwD;AACxD,4DAA4D;AAC5D,0DAA0D;AAC1D,0DAA0D;AAC1D,6CAAwC;AAMxC,IAAM,SAAS,GAAe;IAC5B,QAAQ,EAAE,wBAAc;IACxB,GAAG,EAAE,wBAAS;IACd,IAAI,EAAE,wBAAU;IAChB,OAAO,EAAE,wBAAa;IACtB,IAAI,EAAE,oBAAU;IAChB,GAAG,EAAE,mBAAS;IACd,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,IAAI,EAAE,IAAA,qBAAO,EAAC,MAAM,CAAC;IACrB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,MAAM,EAAE,IAAA,qBAAO,EAAC,QAAQ,CAAC;IACzB,OAAO,EAAE,IAAA,qBAAO,EAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,wBAAc;CACrB,CAAC;AAEF,SAAgB,eAAe,CAAsB,IAAY;IAC/D,OAAO,SAAS,CAAC,IAAI,CAAM,CAAC;AAC9B,CAAC;AAFD,0CAEC"}
|