PageSourceSearch

https://app.hotstuff.trade/_next/static/chunks/09b3ugp5kex6f.js?dpl=dpl_2UkkgYJtZRL8qYawe9FfkxiApWHv

js hotstuff.trade collected 2026-10-07 04:33:44 UTC 72,694 bytes, 7 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="f4905084-bd97-ceef-9153-b00b26cae6d7")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,479083,116084,129669,e=>{"use strict";var t,r,n,i=e.i(234814),a=e.i(718484),o=e.i(48084),s=e.i(322580);let u=`0x${"00".repeat(32)}`;function f(e){let t,{salt:r,threshold:n,owners:o}=e;if(void 0!==r&&32!==i.size(r))throw new m({reason:"salt must be 32 bytes"});if(0===o.length)throw new m({reason:"owners cannot be empty"});if(o.length>255)throw new m({reason:"too many owners"});if(!Number.isInteger(Number(n)))throw new m({reason:"threshold must be an integer"});if(1>Number(n))throw new m({reason:"threshold cannot be zero"});if(Number(n)>8)throw new m({reason:"threshold exceeds max threshold"});let s=0;for(let e of o){if(!a.validate(e.owner)||0n===i.toBigInt(e.owner))throw new m({reason:"owner cannot be zero"});if(!Number.isInteger(Number(e.weight)))throw new m({reason:"owner weight must be an integer"});if(1>Number(e.weight))throw new m({reason:"owner weight cannot be zero"});let r=i.toBigInt(e.owner);if(void 0!==t&&t>=r)throw new m({reason:"owners must be strictly ascending"});t=r,s+=Number(e.weight)}if(s>255)throw new m({reason:"total owner weight exceeds u8 max"});if(Number(n)>s)throw new m({reason:"threshold exceeds total owner weight"})}function l(e){let t=[...e.owners].sort((e,t)=>i.toBigInt(e.owner)<i.toBigInt(t.owner)?-1:1),r={salt:e.salt?i.padLeft(e.salt,32):u,threshold:e.threshold,owners:t};return f(r),r}function c(e){let[t,r,n]=e;return{salt:t&&"0x"!==t?i.padLeft(t,32):u,threshold:"0x"===r?0:i.toNumber(r),owners:n.map(e=>{let[t,r]=e;return{owner:t,weight:r&&"0x"!==r?i.toNumber(r):0}})}}function d(e){f(e);let t=s.keccak256(i.concat(i.fromString("tempo:multisig:account"),i.padLeft(e.salt??u,32),i.fromNumber(e.threshold,{size:1}),i.fromNumber(e.owners.length,{size:1}),...e.owners.flatMap(e=>[e.owner,i.fromNumber(e.weight,{size:1})]))),r=a.from(i.slice(t,12,32));if(0n===i.toBigInt(r))throw new m({reason:"derived account cannot be zero"});return r}function p(e){let{payload:t}=e,r="account"in e&&e.account?e.account:d(e.genesisConfig);return s.keccak256(i.concat(i.fromString("tempo:multisig:signature"),i.from(t),r))}function y(e){f(e);let t=e.owners.map(e=>[e.owner,i.fromNumber(e.weight)]);return[e.salt?i.padLeft(e.salt,32):u,i.fromNumber(e.threshold),t]}class m extends o.BaseError{constructor({reason:e}){super(`Invalid native multisig config: ${e}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MultisigConfig.InvalidConfigError"})}}e.s(["InvalidConfigError",0,m,"assert",0,f,"from",0,l,"fromTuple",0,c,"getAddress",0,d,"getSignPayload",0,p,"maxNestingDepth",0,2,"maxOwnerSignatureBytes",0,2049,"maxOwners",0,255,"maxSignatures",0,8,"maxThreshold",0,8,"signatureTypeByte",0,"0x05","toTuple",0,y,"validate",0,function(e){try{return f(e),!0}catch{return!1}},"zeroSalt",0,u],953101);var g=e.i(953101),g=g,b=o,h=e.i(844328),v=e.i(781979),w=e.i(747663),x=e.i(241826),k=e.i(492204),A=e.i(573230);let P=(0,k.Field)(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),I=P.create(BigInt("-3")),B=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),N=(0,w.createCurve)({a:I,b:B,Fp:P,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},v.sha256),z=(0,A.mapToCurveSimpleSWU)(P,{A:I,B:B,Z:P.create(BigInt("-10"))});(0,x.createHasher)(N.ProjectivePoint,e=>z(e[0]),{DST:"P256_XMD:SHA-256_SSWU_RO_",encodeDST:"P256_XMD:SHA-256_SSWU_NU_",p:P.ORDER,m:1,k:128,expand:"xmd",hash:v.sha256});let K=(0,k.Field)(BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff")),S=K.create(BigInt("-3")),E=BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef");(0,w.createCurve)({a:S,b:E,Fp:K,n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),h:BigInt(1),lowS:!1},v.sha384),(0,A.mapToCurveSimpleSWU)(K,{A:S,B:E,Z:K.create(BigInt("-12"))});let T=(0,k.Field)(BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),U=T.create(BigInt("-3")),C=BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00");(0,w.createCurve)({a:U,b:C,Fp:T,n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650"),h:BigInt(1),lowS:!1,allowedPrivateKeyLengths:[130,131,132]},v.sha512),(0,A.mapToCurveSimpleSWU)(T,{A:U,B:C,Z:T.create(BigInt("-4"))});var L=e.i(334019),F=e.i(733132);function O(e){let{hash:t,payload:r,publicKey:n,signature:i}=e;return N.verify(i,r instanceof Uint8Array?r:L.fromHex(r),F.toHex(n).substring(2),{lowS:!0,...t?{prehash:!0}:{}})}var R=e.i(521920),M=e.i(108121),$=e.i(4369);let G=new TextEncoder;Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
2+/").map((e,t)=>[t,e.charCodeAt(0)]);let j={...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[e.charCodeAt(0),t])),61:0,45:62,95:63};Uint8Array.from([105,171,180,181,160,222,75,198,42,42,32,31,141,37,186,233]),o.BaseError,o.BaseError;var W=o;e.i(714118);class H extends W.BaseError{constructor({majorType:e}){super(`Invalid CBOR major type: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.InvalidMajorTypeError"})}}class D extends W.BaseError{constructor({additionalInfo:e}){super(`Invalid CBOR additional info: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.InvalidAdditionalInfoError"})}}class q extends W.BaseError{constructor(){super("64-bit integers are not supported in CBOR decoding."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.Unsupported64BitIntegerError"})}}class V extends W.BaseError{constructor({tag:e}){super(`CBOR tagged data (tag ${e}) is not yet supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.UnsupportedTagError"})}}class J extends W.BaseError{constructor({type:e}){super(`Invalid chunk type in indefinite-length ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.InvalidIndefiniteLengthChunkError"})}}class _ extends W.BaseError{constructor({value:e}){super(`Invalid CBOR simple value: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.InvalidSimpleValueError"})}}class X extends W.BaseError{constructor(){super("BigInt values are not supported in CBOR encoding."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.UnsupportedBigIntError"})}}class Y extends W.BaseError{constructor({token:e}){super(`Unexpected token: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.UnexpectedTokenError"})}}class Z extends W.BaseError{constructor({number:e}){super(`Number exceeds maximum safe integer (${Number.MAX_SAFE_INTEGER}): ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.NumberTooLargeError"})}}class Q extends W.BaseError{constructor({size:e}){super(`String length exceeds maximum (4294967295): ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.StringTooLargeError"})}}class ee extends W.BaseError{constructor({size:e}){super(`Array length exceeds maximum (4294967295): ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.ArrayTooLargeError"})}}class et extends W.BaseError{constructor({size:e}){super(`Object size exceeds maximum (4294967295): ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.ObjectTooLargeError"})}}class er extends W.BaseError{constructor({size:e}){super(`Byte string length exceeds maximum (4294967295): ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.ByteStringTooLargeError"})}}function en(e){if(void 0===e)return{length:1,encode:e=>e.pushUint8(247)};if(null===e)return{length:1,encode:e=>e.pushUint8(246)};if("boolean"==typeof e)return{length:1,encode:t=>t.pushUint8(e?245:244)};if("number"==typeof e)return en.number(e);if("bigint"==typeof e)throw new X;if("string"==typeof e)return en.string(e);if(Array.isArray(e))return en.array(e);if(e instanceof Uint8Array)return en.byteString(e);if(e instanceof ArrayBuffer)return en.byteString(new Uint8Array(e));if(ArrayBuffer.isView(e))return en.byteString(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e instanceof Map)return en.map(e);if("object"==typeof e)return en.object(e);throw new Y({token:String(e)})}function ei(e){let t=e.readUint8(),r=t>>5,n=31&t;switch(r){case 0:return ei.readUnsignedInteger(e,n);case 1:return ei.readNegativeInteger(e,n);case 2:return ei.readByteString(e,n);case 3:return ei.readTextString(e,n);case 4:return ei.readArray(e,n);case 5:return ei.readMap(e,n);case 6:throw new V({tag:n});case 7:return ei.readSimpleOrFloat(e,n);default:throw new H({majorType:r})}}(t=en||(en={})).number=function(e){if(!Number.isSafeInteger(e)){let t=Math.fround(e);return Number.isNaN(e)||e===t?{length:5,encode(t){t.pushUint8(250),t.dataView.setFloat32(t.position,e,!1),t.position+=4}}:{length:9,encode(t){t.pushUint8(251),t.dataView.setFloat64(t.position,e,!1),t.position+=8}}}if(e>=0){if(e<=23)return{length:1,encode:t=>t.pushUint8(e)};if(e<=255)return{length:2,encode:t=>{t.pushUint8(24),t.pushUint8(e)}};if(e<=65535)return{length:3,encode:t=>{t.pushUint8(25),t.pushUint16(e)}};if(e<=0xffffffff)return{length:5,encode:t=>{t.pushUint8(26),t.pushUint32(e)}};throw new Z({number:e.toString(10)})}let t=-1-e;if(e>=-24)return{length:1,encode:e=>e.pushUint8(32+t)};if(t<=255)return{length:2,encode:e=>{e.pushUint8(56),e.pushUint8(t)}};if(t<=65535)return{length:3,encode:e=>{e.pushUint8(57),e.pushUint16(t)}};if(t<=0xffffffff)return{length:5,encode:e=>{e.pushUint8(58),e.pushUint32(t)}};throw new Z({number:e.toString(10)})},t.string=function(e){let t=L.fromString(e),r=t.length;if(r<=23)return{length:1+r,encode(e){e.pushUint8(96+r),r>0&&e.pushBytes(t)}};if(r<=255)return{length:2+r,encode(e){e.pushUint8(120),e.pushUint8(r),e.pushBytes(t)}};if(r<=65535)return{length:3+r,encode(e){e.pushUint8(121),e.pushUint16(r),e.pushBytes(t)}};if(r<=0xffffffff)return{length:5+r,encode(e){e.pushUint8(122),e.pushUint32(r),e.pushBytes(t)}};throw new Q({size:r})},t.array=function(e){let r=e.map(e=>t(e)),n=r.reduce((e,t)=>
2e+t.length,0),i=e.length;if(i<=23)return{length:1+n,encode(e){for(let t of(e.pushUint8(128+i),r))t.encode(e)}};if(i<=255)return{length:2+n,encode(e){for(let t of(e.pushUint8(152),e.pushUint8(i),r))t.encode(e)}};if(i<=65535)return{length:3+n,encode(e){for(let t of(e.pushUint8(153),e.pushUint16(i),r))t.encode(e)}};if(i<=0xffffffff)return{length:5+n,encode(e){for(let t of(e.pushUint8(154),e.pushUint32(i),r))t.encode(e)}};throw new ee({size:i})},t.byteString=function(e){let t=e.byteLength;if(t<=23)return{length:1+t,encode(r){r.pushUint8(64+t),r.pushBytes(e)}};if(t<=255)return{length:2+t,encode(r){r.pushUint8(88),r.pushUint8(t),r.pushBytes(e)}};if(t<=65535)return{length:3+t,encode(r){r.pushUint8(89),r.pushUint16(t),r.pushBytes(e)}};if(t<=0xffffffff)return{length:5+t,encode(r){r.pushUint8(90),r.pushUint32(t),r.pushBytes(e)}};throw new er({size:t})},t.object=function(e){let r=Object.keys(e),n=r.map(r=>({key:t(r),value:t(e[r])})),i=n.reduce((e,t)=>e+t.key.length+t.value.length,0),a=r.length;if(a<=23)return{length:1+i,encode(e){for(let t of(e.pushUint8(160+a),n))t.key.encode(e),t.value.encode(e)}};if(a<=255)return{length:2+i,encode(e){for(let t of(e.pushUint8(184),e.pushUint8(a),n))t.key.encode(e),t.value.encode(e)}};if(a<=65535)return{length:3+i,encode(e){for(let t of(e.pushUint8(185),e.pushUint16(a),n))t.key.encode(e),t.value.encode(e)}};if(a<=0xffffffff)return{length:5+i,encode(e){for(let t of(e.pushUint8(186),e.pushUint32(a),n))t.key.encode(e),t.value.encode(e)}};throw new et({size:a})},t.map=function(e){let r=[];for(let[n,i]of e)r.push({key:t(n),value:t(i)});let n=r.reduce((e,t)=>e+t.key.length+t.value.length,0),i=e.size;if(i<=23)return{length:1+n,encode(e){for(let t of(e.pushUint8(160+i),r))t.key.encode(e),t.value.encode(e)}};if(i<=255)return{length:2+n,encode(e){for(let t of(e.pushUint8(184),e.pushUint8(i),r))t.key.encode(e),t.value.encode(e)}};if(i<=65535)return{length:3+n,encode(e){for(let t of(e.pushUint8(185),e.pushUint16(i),r))t.key.encode(e),t.value.encode(e)}};if(i<=0xffffffff)return{length:5+n,encode(e){for(let t of(e.pushUint8(186),e.pushUint32(i),r))t.key.encode(e),t.value.encode(e)}};throw new et({size:i})};var ea=ei||(ei={});function eo(e,t){if(t<24)return t;if(24===t)return e.readUint8();if(25===t)return e.readUint16();if(26===t)return e.readUint32();if(27===t)throw new q;throw new D({additionalInfo:t})}ea.readUnsignedInteger=function(e,t){return eo(e,t)},ea.readNegativeInteger=function(e,t){return -1-eo(e,t)},ea.readByteString=function(e,t){if(31===t){let t=[],r=0;for(;;){if(255===e.inspectUint8()){e.readUint8();break}let n=ea(e);if(!(n instanceof Uint8Array))throw new J({type:"byte string"});t.push(n),r+=n.length}let n=new Uint8Array(r),i=0;for(let e of t)n.set(e,i),i+=e.length;return n}let r=eo(e,t);return e.readBytes(r)},ea.readTextString=function(e,t){if(31===t){let t=[];for(;;){if(255===e.inspectUint8()){e.readUint8();break}let r=ea(e);if("string"!=typeof r)throw new J({type:"text string"});t.push(r)}return t.join("")}let r=eo(e,t),n=e.readBytes(r);return L.toString(n)},ea.readArray=function(e,t){if(31===t){let t=[];for(;;){if(255===e.inspectUint8()){e.readUint8();break}t.push(ea(e))}return t}let r=eo(e,t),n=[];for(let t=0;t<r;t++)n.push(ea(e));return n},ea.readMap=function(e,t){if(31===t){let t={};for(;;){if(255===e.inspectUint8()){e.readUint8();break}let r=ea(e),n="string"==typeof r?r:String(r),i=ea(e);t[n]=i}return t}let r=eo(e,t),n={};for(let t=0;t<r;t++){let t=ea(e),r="string"==typeof t?t:String(t),i=ea(e);n[r]=i}return n},ea.readSimpleOrFloat=function(e,t){if(20===t)return!1;if(21===t)return!0;if(22===t)return null;if(23!==t){if(25===t)return function(e){let t=e>>15&1,r=e>>10&31,n=1023&e;if(0===r){if(0===n)return t?-0:0;let e=n/1024*6103515625e-14;return t?-e:e}if(31===r)return 0===n?t?-1/0:1/0:NaN;let i=2**(r-15)*(1+n/1024);return t?-i:i}(e.readUint16());if(26===t){let t=e.dataView.getFloat32(e.position,!1);return e.position+=4,t}if(27===t){let t=e.dataView.getFloat64(e.position,!1);return e.position+=8,t}if(24===t){let t=e.readUint8();if(t<32)throw new _({value:t});return}throw new D({additionalInfo:t})}};o.BaseError,o.BaseError;let es="0x01",eu="0x02",ef="0x03",el="0x04",ec="0x05",ed="0x7777777777777777777777777777777777777777777777777777777777777777";function ep(e){let t=ew(e);if("secp256k1"===t)return void $.assert(e.signature);if("p256"===t){let t=[];if("bigint"!=typeof e.signature?.r&&t.push("signature.r"),"bigint"!=typeof e.signature?.s&&t.pu
2sh("signature.s"),"boolean"!=typeof e.prehash&&t.push("prehash"),e.publicKey?("bigint"!=typeof e.publicKey.x&&t.push("publicKey.x"),"bigint"!=typeof e.publicKey.y&&t.push("publicKey.y")):t.push("publicKey"),t.length>0)throw new eP({envelope:e,missing:t,type:"p256"});return}if("webAuthn"===t){let t=[];if("bigint"!=typeof e.signature?.r&&t.push("signature.r"),"bigint"!=typeof e.signature?.s&&t.push("signature.s"),e.metadata?(e.metadata.authenticatorData||t.push("metadata.authenticatorData"),e.metadata.clientDataJSON||t.push("metadata.clientDataJSON")):t.push("metadata"),e.publicKey?("bigint"!=typeof e.publicKey.x&&t.push("publicKey.x"),"bigint"!=typeof e.publicKey.y&&t.push("publicKey.y")):t.push("publicKey"),t.length>0)throw new eP({envelope:e,missing:t,type:"webAuthn"});return}"keychain"===t?ep(e.inner):"multisig"===t&&ey(e,1)}function ey(e,t){let r=[];if(e.account||r.push("account"),Array.isArray(e.signatures)||r.push("signatures"),r.length>0)throw new eP({envelope:e,missing:r,type:"multisig"});if(t>2)throw new eB({reason:"multisig nesting depth exceeds 2"});if(!a.validate(e.account))throw new eB({reason:"multisig account is invalid"});if(0n===i.toBigInt(e.account))throw new eB({reason:"multisig account cannot be zero"});if(0===e.signatures.length)throw new eB({reason:"multisig signatures cannot be empty"});if(e.signatures.length>8)throw new eB({reason:"multisig signatures exceed 8"});if(e.init&&(f(e.init),!a.isEqual(d(e.init),e.account)))throw new eB({reason:"multisig init does not derive account"});for(let r of e.signatures){let e=ew(r);if("keychain"===e)throw new eB({reason:"keychain owner approvals are not allowed"});if("multisig"===e){if(r.init)throw new eB({reason:"nested multisig owner approvals cannot carry `init`"});ey(r,t+1)}else ep(r);if(i.size(ex(r))>2049)throw new eB({reason:"multisig owner signature exceeds 2049 bytes"})}}function em(e){let{signature:t,root:r}=e;return"keychain"===t.type?r?t.userAddress:em({...e,signature:t.inner}):"multisig"===t.type?t.account:a.fromPublicKey(eg(e))}function eg(e){let{payload:t,signature:r}=e;switch(r.type){case"secp256k1":return M.recoverPublicKey({payload:t,signature:r.signature});case"p256":case"webAuthn":return r.publicKey;case"keychain":return eg({payload:t,signature:r.inner});case"multisig":throw new eA({envelope:r})}}function eb(e){return function e(t,r){let n=t.endsWith(ed.slice(2))?i.slice(t,0,-i.size(ed)):t;if(65===i.size(n)){let e=$.fromHex(n);return $.assert(e),{signature:e,type:"secp256k1"}}let o=i.slice(n,0,1),s=i.slice(n,1),u=i.size(s);if(o===es){if(129!==u)throw new eI({reason:`Invalid P256 signature envelope size: expected 129 bytes, got ${u} bytes`,serialized:n});return{publicKey:{prefix:4,x:i.toBigInt(i.slice(s,64,96)),y:i.toBigInt(i.slice(s,96,128))},prehash:0!==i.toNumber(i.slice(s,128,129)),signature:{r:i.toBigInt(i.slice(s,0,32)),s:i.toBigInt(i.slice(s,32,64))},type:"p256"}}if(o===eu){let e,t;if(u<128)throw new eI({reason:`Invalid WebAuthn signature envelope size: expected at least 128 bytes, got ${u} bytes`,serialized:n});let r=u-128,a=i.slice(s,0,r);for(let n=37;n<r;n++){let r=i.toString(i.slice(a,n));if(r.startsWith("{")&&r.endsWith("}"))try{JSON.parse(r),e=i.slice(a,0,n),t=r;break}catch{}}if(!e||!t)throw new eI({reason:"Unable to parse WebAuthn metadata: could not extract valid authenticatorData and clientDataJSON",serialized:n});return{publicKey:{prefix:4,x:i.toBigInt(i.slice(s,r+64,r+96)),y:i.toBigInt(i.slice(s,r+96,r+128))},metadata:{authenticatorData:e,clientDataJSON:t},signature:{r:i.toBigInt(i.slice(s,r,r+32)),s:i.toBigInt(i.slice(s,r+32,r+64))},type:"webAuthn"}}if(o===ef||o===el)return{userAddress:i.slice(s,0,20),inner:e(i.slice(s,20),r),type:"keychain",version:o===el?"v2":"v1"};if(o===ec){let t=r+1;if(t>2)throw new eI({reason:"multisig nesting depth exceeds 2",serialized:n});let o=R.toHex(s);if(!Array.isArray(o)||2!==o.length)throw new eI({reason:"invalid multisig wire shape: expected exactly two fields",serialized:n});let[u,f]=o;if(!Array.isArray(f)||f.some(Array.isArray))throw new eI({reason:"invalid multisig signatures list",serialized:n});if(0===f.length)throw new eI({reason:"multisig signatures cannot be empty",serialized:n});if(f.length>8)throw new eI({reason:"multisig signatures exceed 8",serialized:n});for(let e of f)if(i.size(e)>2049)throw new eI({reason:"multisig owner signature exceeds 2049 bytes",serialized:n});if(!Array.isArray(u)&&!a.validate(u))throw new eI({reason:"invalid multisig account",serialized:n});if(Array.isArray(u)){let[e,t,r]=u;if(3!==u.length||Array.isArray(e)||32!==i.size(e)||Array.isArray(t)||i.size(t)>1||!Array.isArray(r)||r.some(e=>!Array.isArray(e)||2!==e.length||e.some(Array.isArray)||i.size(e[1])>1))throw new eI({reason:"invalid multisig init config",serialized:n})}let l=Array.isArray(u)?c(u):void 0,p={type:"multisig",account:l?d(l):u,signatures:f.map(r=>e(r,t)),...l?{init:l}:{}};return ey(p,t),p}throw new eI({reason:`Unknown signature type identifier: ${o}. Expected ${es} (P256), ${eu} (WebAuthn), ${ef} (Keychain V1), ${el} (Keychain V2), or ${ec} (Multisig)`,serialized:n})}(e,0)}function eh(e,t){let r;if("string"==typeof e)return eb(e);if("object"==typeof e&&null!==e&&"r"in e&&"s"in e&&"yParity"in e)return{signature:e,type:"secp256k1"};let n=ew(e);if("multisig"===n){let{genesisConfig:t,init:r,...i}=e,a=i.account?i.account:t?d(t):i.account,o=!0===r?t:r||void 0;return{...i,account:a,signatures:i.signatures.map(e=>eh(e)),...o?{init:l(o)}:{},type:n}}return{...e,..."p256"===n?{prehash:e.prehash}:{},..."keychain"===n?{...!("object"==typeof e&&null!==e&&"version"in e&&e.version)?{version:"v2"}:{},...!("object"==typeof e&&"keyId"in e&&e.keyId)?"p256"===(r=e.inner).type||"webAuthn"===r.type?{keyId:a.fromPublicKey(r.publicKey)}:"secp256k1"===r.type&&t?.payload?{keyId:a.fromPublicKey(M.recoverPublicKey({payload:t.payload,signature:r.signature}))}:{}:{}}:{},type:n}}function ev(e){if("secp256k1"===e.type)return{signature:$.fromRpc(e),type:"secp256k1"};if("p256"===e.type)return{prehash:e.preHash,publicKey:{prefix:4,x:i.toBigInt(e.pubKeyX),y:i.toBigInt(e.pubKeyY)},signature:{r:i.toBigInt(e.r),s:i.toBigInt(e.s)},type:"p256"};if("webAuthn"===e.type){let t,r,n=e.webauthnData,a=i.size(n);for(let e=37;e<a;e++){let a=i.toString(i.slice(n,e));if(a.startsWith("{")&&a.endsWith("}"))try{JSON.parse(a),t=i.slice(n,0,e),r=a;break}catch{}}if(!t||!r)throw new eI({reason:"Unable to parse WebAuthn metadata: could not extract valid authenticatorData and clientDataJSON",serialized:n});return{metadata:{authenticatorData:t,clientDataJSON:r},publicKey:{prefix:4,x:i.toBigInt(e.pubKeyX),y:i.toBigInt(e.pubKeyY)},signature:{r:i.toBigInt(e.r),s:i.toBigInt(e.s)},type:"webAuthn"}}if("keychain"===e.type||"userAddress"in e&&"signature"in e)return{type:"keychain",userAddress:e.userAddress,inner:ev(e.signature),...e.keyId?{keyId:e.keyId}:{},...e.version?{version:e.version}:{}};if("multisig"===e.type||"signatures"in e&&("account"in e||"init"in e)){let t=void 0!==e.account,r=void 0!==e.init;if(t===r)throw new eB({reason:"RPC multisig must contain exactly one of `account` or `init`"});let n=r?l(e.init):void 0,i={type:"multisig",account:n?d(n):e.account,signatures:e.signatures.map(e=>ev(e)),...n?{init:n}:{}};return ep(i),i}throw new eA({envelope:e})}function ew(e){if("object"!=typeof e||null===e)throw new eA({envelope:e});if("type"in e&&e.type)return e.type;if("signature"in e&&!("publicKey"in e)&&"object"==typeof e.signature&&null!==e.signature&&"r"in e.signature&&"s"in e.signature&&"yParity"in e.signature||"r"in e&&"s"in e&&"yParity"in e)return"secp256k1";if("signature"in e&&"prehash"in e&&"publicKey"in e&&"boolean"==typeof e.prehash)return"p256";if("signature"in e&&"metadata"in e&&"publicKey"in e)return"webAuthn";if("userAddress"in e&&"inner"in e)return"keychain";if(("account"in e||"genesisConfig"in e||"init"in e)&&"signatures"in e)return"multisig";throw new eA({envelope:e})}function ex(e,t={}){let r=ew(e);if("secp256k1"===r)return i.concat($.toHex(e.signature),t.magic?ed:"0x");if("p256"===r)return i.concat(es,i.fromNumber(e.signature.r,{size:32}),i.fromNumber(e.signature.s,{size:32}),i.fromNumber(e.publicKey.x,{size:32}),i.fromNumber(e.publicKey.y,{size:32}),i.fromNumber(+!!e.prehash,{size:1}),t.magic?ed:"0x");if("webAuthn"===r){let r=i.concat(e.metadata.authenticatorData,i.fromString(e.metadata.clientDataJSON));return i.concat(eu,r,i.fromNumber(e.signature.r,{size:32}),i.fromNumber(e.signature.s,{size:32}),i.fromNumber(e.publicKey.x,{size:32}),i.fromNumber(e.publicKey.y,{size:32}),t.magic?ed:"0x")}if("keychain"===r){let r="v1"===e.version?ef:el;return i.concat(r,e.userAddress,ex(e.inner),t.magic?ed:"0x")}if("multisig"===r)return ep(e),i.concat(ec,R.fromHex([e.init?y(e.init):e.account,e.signatures.map(e=>ex(e))]),t.magic?ed:"0x");throw new eA({envelope:e})}function ek(e){let t=ew(e);if("secp256k1"===t)return{...$.toRpc(e.signature),type:"secp256k1"};if("p256"===t)return{preHash:e.prehash,pubKeyX:i.fromNumber(e.publicKey.x,{size:32}),pubKeyY:i.fromNumber(e.publicKey.y,{size:32}),r:i.fromNumber(e.signature.r,{size:32}),s:i.fromNumber(e.signature.s,{size:32}),type:"p256"};if("webAuthn"===t){let t=i.concat(e.metadata.authenticatorData,i.fromString(e.metadata.clientDataJSON));return{pubKeyX:i.fromNumber(e.publicKey.x,{size:32}),pubKeyY:i.fromNumber(e.publicKey.y,{size:32}),r:i.fromNumber(e.signature.r,{size:32}),s:i.fromNumber(e.signature.s,{size:32}),type:"webAuthn",webauthnData:t}}if("keychain"===t)return{type:"keychain",userAddress:e.userAddress,signature:ek(e.inner),...e.keyId?{keyId:e.keyId}:{},...e.version?{version:e.version}:{}};if("multisig"===t){ep(e);let t=e.signatures.map(e=>ek(e));return e.init?{init:{...e.init,salt:e.init.salt??u,threshold:Number(e.init.threshold),owners:e.init.owners.map(e=>({...e,weight:Number(e.weight)}))},signatures:t}:{account:e.account,signatures:t}}throw new eA({envelope:e})}class eA extends b.BaseError{constructor({envelope:e}){super(`Unable to coerce value (\`${h.stringify(e)}\`) to a valid signature envelope.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.CoercionError"})}}class eP extends b.BaseError{constructor({envelope:e,missing:t,type:r}){super(`Signature envelope of type "${r}" is missing required properties: ${t.map(e=>`\`${e}\``).join(", ")}.
3
4Provided: ${h.stringify(e)}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.MissingPropertiesError"})}}class eI extends b.BaseError{constructor({reason:e,serialized:t}
4){super(`Unable to deserialize signature envelope: ${e}`,{metaMessages:[`Serialized: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.InvalidSerializedError"})}}class eB extends b.BaseError{constructor({reason:e}){super(`Invalid native multisig owner approval: ${e}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.InvalidMultisigApprovalError"})}}class eN extends b.BaseError{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.VerificationError"})}}e.s(["CoercionError",0,eA,"InvalidMultisigApprovalError",0,eB,"InvalidSerializedError",0,eI,"MissingPropertiesError",0,eP,"VerificationError",0,eN,"assert",0,ep,"deserialize",0,eb,"extractAddress",0,em,"extractPublicKey",0,eg,"from",0,eh,"fromRpc",0,ev,"getType",0,ew,"magicBytes",0,ed,"serialize",0,ex,"sortMultisigApprovals",0,function(e){let{payload:t,signatures:r}=e,n=p("genesisConfig"in e&&e.genesisConfig?{payload:t,genesisConfig:e.genesisConfig}:{payload:t,account:e.account});return r.map(e=>({key:i.toBigInt(em({payload:n,signature:e})),signature:e})).sort((e,t)=>e.key<t.key?-1:+(e.key>t.key)).map(e=>e.signature)},"toRpc",0,ek,"types",0,["secp256k1","p256","webAuthn"],"validate",0,function(e){try{return ep(e),!0}catch{return!1}},"verify",0,function(e,t){let{payload:r}=t,n=t.address?t.address:t.publicKey?a.fromPublicKey(t.publicKey):void 0;if(!n)return!1;let o=eh(e);if("secp256k1"===o.type)return!!n&&M.verify({address:n,payload:r,signature:o.signature});if("p256"===o.type){let e=a.fromPublicKey(o.publicKey);return!!a.isEqual(e,n)&&O({hash:o.prehash,publicKey:o.publicKey,payload:r,signature:o.signature})}if("webAuthn"===o.type){let e=a.fromPublicKey(o.publicKey);return!!a.isEqual(e,n)&&function(e){let{challenge:t,metadata:r,origin:n,publicKey:a,rpId:o,signature:u}=e,{authenticatorData:f,clientDataJSON:l,userVerificationRequired:c}=r,d=L.fromHex(f);if(d.length<37)return!1;if(void 0!==o){let e=d.slice(0,32),t=s.sha256(i.fromString(o),{as:"Bytes"});if(!L.isEqual(e,t))return!1}let p=d[32];if((1&p)!=1||c&&(4&p)!=4||(8&p)!=8&&(16&p)==16)return!1;let y=JSON.parse(l);if("webauthn.get"!==y.type||!y.challenge||i.fromBytes(function(e){let t=e.replace(/=+$/,""),r=t.length,n=new Uint8Array(r+3);G.encodeInto(t+"===",n);for(let e=0,r=0;e<t.length;e+=4,r+=3){let t=(j[n[e]]<<18)+(j[n[e+1]]<<12)+(j[n[e+2]]<<6)+j[n[e+3]];n[r]=t>>16,n[r+1]=t>>8&255,n[r+2]=255&t}return new Uint8Array(n.buffer,0,(r>>2)*3+(r%4&&r%4-1))}(y.challenge))!==t||void 0!==n&&!(Array.isArray(n)?n:[n]).includes(y.origin))return!1;let m=s.sha256(L.fromString(l),{as:"Bytes"});return O({hash:!0,payload:L.concat(d,m),publicKey:a,signature:u})}({challenge:i.from(r),metadata:o.metadata,publicKey:o.publicKey,signature:o.signature})}throw new eN(`Unable to verify signature envelope of type "${o.type}".`)}],647680);var ez=e.i(647680),ez=ez,eK=e.i(528804),eS=e.i(493617),eE=e.i(674768),eT=e.i(806685),eU=e.i(538463),eC=e.i(982191),eL=e.i(839080),eF=e.i(190521),eO=e.i(467125),eR=e.i(831095),eM=e.i(189991),e$=e.i(388750),eG=e.i(888794),ej=e.i(938630),eW=e.i(897282);let eH=[{name:"authorizeKey",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"keyId"},{type:"uint8",name:"signatureType"},{type:"uint64",name:"expiry"},{type:"bool",name:"enforceLimits"},{type:"tuple[]",name:"limits",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"}]}],outputs:[]},{name:"authorizeKey",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"keyId"},{type:"uint8",name:"signatureType"},{type:"tuple",name:"config",components:[{type:"uint64",name:"expiry"},{type:"bool",name:"enforceLimits"},{type:"tuple[]",name:"limits",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"},{type:"uint64",name:"period"}]},{type:"bool",name:"allowAnyCalls"},{type:"tuple[]",name:"allowedCalls",components:[{type:"address",name:"target"},{type:"tuple[]",name:"selectorRules",components:[{type:"bytes4",name:"selector"},{type:"address[]",name:"recipients"}]}]}]}],outputs:[]},{name:"authorizeKey",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"keyId"},{type:"uint8",name:"signatureType"},{type:"tuple",name:"config",components:[{type:"uint64",name:"expiry"},{type:"bool",name:"enforceLimits"},{type:"tuple[]",name:"limits",components:[{type:"address",name:"token"},{type:"uint256",name:"amount"},{type:"uint64",name:"period"}]},{type:"bool",name:"allowAnyCalls"},{type:"tuple[]",name:"allowedCalls",components:[{type:"address",name:"target"},{type:"tuple[]",name:"selectorRules",components:[{type:"bytes4",name:"selector"},{type:"address[]",name:"recipients"}]}]}]},{type:"bytes32",name:"witness"}],outputs:[]},{name:"authorizeAdminKey",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"keyId"},{type:"uint8",name:"signatureType"},{type:"bytes32",name:"witness"}],outputs:[]},{name:"burnKeyAuthorizationWitness",type:"function",stateMutability:"nonpayable",inputs:[{type:"bytes32",name:"witness"}],outputs:[]},{name:"revokeKey",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"keyId"}],outputs:[]},{name:"updateSpendingLimit",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"keyId"},{type:"address",name:"token"},{type:"uint256",name:"newLimit"}],outputs:[]},{name:"setAllowedCalls",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"keyId"},{type:"tuple[]",name:"scopes",components:[{type:"address",name:"target"},{type:"tuple[]",name:"selectorRules",components:[{type:"bytes4",name:"selector"},{type:"address[]",name:"recipients"}]}]}],outputs:[]},{name:"removeAllowedCalls",type:"function",stateMutability:"nonpayable",inputs:[{type:"address",name:"keyId"},{type:"address",name:"target"}],outputs:[]},{name:"getKey",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"address",name:"keyId"}],outputs:[{type:"tuple",components:[{type:"uint8",name:"signatureType"},{type:"address",name:"keyId"},{type:"uint64",name:"expiry"},{type:"bool",name:"enforceLimits"},{type:"bool",name:"isRevoked"}]}]},{name:"getRemainingLimit",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"address",name:"keyId"},{type:"address",name:"token"}],outputs:[{type:"uint256",name:"remaining"}]},{name:"getRemainingLimitWithPeriod",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"address",name:"keyId"},{type:"address",name:"token"}],outputs:[{type:"uint256",name:"remaining"},{type:"uint64",name:"periodEnd"}]},{name:"getAllowedCalls",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"address",name:"keyId"}],outputs:[{type:"bool",name:"isScoped"},{type:"tuple[]",name:"scopes",components:[{type:"address",name:"target"},{type:"tuple[]",name:"selectorRules",components:[{type:"bytes4",name:"selector"},{type:"address[]",name:"recipients"}]}]}]},{name:"isKeyAuthorizationWitnessBurned",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"bytes32",name:"witness"}],outputs:[{type:"bool"}]},{name:"isAdminKey",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"address",name:"keyId"}],outputs:[{type:"bool"}]},{name:"getTransactionKey",type:"function",stateMutability:"view",inputs:[],outputs:[{type:"address"}]},{name:"KeyAuthorized",type:"event",inputs:[{type:"address",name:"account",indexed:!0},{type:"address",name:"publicKey",indexed:!0},{type:"uint8",name:"signatureType"},{type:"uint64",name:"expiry"}]},{name:"AdminKeyAuthorized",type:"event",inputs:[{type:"address",name:"account",indexed:!0},{type:"address",name:"publicKey",indexed:!0}]},{name:"KeyRevoked",type:"event",inputs:[{type:"address",name:"account",indexed:!0},{type:"address",name:"publicKey",indexed:!0}]},{name:"SpendingLimitUpdated",type:"event",inputs:[{type:"address",name:"account",indexed:!0},{type:"address",name:"publicKey",indexed:!0}
4,{type:"address",name:"token",indexed:!0},{type:"uint256",name:"newLimit"}]},{name:"AccessKeySpend",type:"event",inputs:[{type:"address",name:"account",indexed:!0},{type:"address",name:"publicKey",indexed:!0},{type:"address",name:"token",indexed:!0},{type:"uint256",name:"amount"},{type:"uint256",name:"remainingLimit"}]},{name:"KeyAuthorizationWitness",type:"event",inputs:[{type:"address",name:"account",indexed:!0},{type:"bytes32",name:"witness",indexed:!0}]},{name:"KeyAuthorizationWitnessBurned",type:"event",inputs:[{type:"address",name:"account",indexed:!0},{type:"bytes32",name:"witness",indexed:!0}]},{name:"UnauthorizedCaller",type:"error",inputs:[]},{name:"KeyAlreadyExists",type:"error",inputs:[]},{name:"KeyNotFound",type:"error",inputs:[]},{name:"KeyExpired",type:"error",inputs:[]},{name:"SpendingLimitExceeded",type:"error",inputs:[]},{name:"InvalidSpendingLimit",type:"error",inputs:[]},{name:"InvalidSignatureType",type:"error",inputs:[]},{name:"ZeroPublicKey",type:"error",inputs:[]},{name:"ExpiryInPast",type:"error",inputs:[]},{name:"KeyAlreadyRevoked",type:"error",inputs:[]},{name:"SignatureTypeMismatch",type:"error",inputs:[{type:"uint8",name:"expected"},{type:"uint8",name:"actual"}]},{name:"CallNotAllowed",type:"error",inputs:[]},{name:"InvalidCallScope",type:"error",inputs:[]},{name:"InvalidKeyId",type:"error",inputs:[]},{name:"InvalidKeyAuthorizationWitness",type:"error",inputs:[]},{name:"KeyAuthorizationWitnessAlreadyBurned",type:"error",inputs:[]},{name:"LegacyAuthorizeKeySelectorChanged",type:"error",inputs:[{type:"bytes4",name:"newSelector"}]}],eD=[{name:"recover",type:"function",stateMutability:"view",inputs:[{type:"bytes32",name:"hash"},{type:"bytes",name:"signature"}],outputs:[{type:"address",name:"signer"}]},{name:"verify",type:"function",stateMutability:"view",inputs:[{type:"address",name:"signer"},{type:"bytes32",name:"hash"},{type:"bytes",name:"signature"}],outputs:[{type:"bool"}]},{name:"verifyKeychain",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"bytes32",name:"hash"},{type:"bytes",name:"signature"}],outputs:[{type:"bool"}]},{name:"verifyKeychainAdmin",type:"function",stateMutability:"view",inputs:[{type:"address",name:"account"},{type:"bytes32",name:"hash"},{type:"bytes",name:"signature"}],outputs:[{type:"bool"}]},{name:"InvalidFormat",type:"error",inputs:[]},{name:"InvalidSignature",type:"error",inputs:[]}];[...eH,...eD];var eq=e.i(11674),eV=o;function eJ(e){return e.startsWith("tempo")?function(e){if(!e.startsWith("tempox"))throw new e_({address:e});let t=e.slice(6);return i.assert(t,{strict:!0}),{address:a.checksum(t)}}(e).address:e}class e_ extends eV.BaseError{constructor({address:e}){super(`Tempo address "${e}" has an invalid prefix. Expected "tempox".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TempoAddress.InvalidPrefixError"})}}function eX(e,t={}){if("keyId"in e)return eY(e);void 0!==e.witness&&e8(e.witness),e.signature&&e7(e.signature);let r={...e,address:eJ(e.address),...e.limits?{limits:e.limits.map(e=>({...e,token:eJ(e.token)}))}:{},...e.scopes?{scopes:e.scopes.map(e=>({...e,address:eJ(e.address),selector:e3(e.selector),...e.recipients?{recipients:e.recipients.map(e=>eJ(e))}:{}}))}:{}};if(t.signature){let e=eh(t.signature);return e7(e),{...r,signature:e}}return r}function eY(e){let{allowedCalls:t,chainId:r,keyId:n,expiry:a,limits:o,keyType:s}=e,u=e.witness??void 0,f=e.isAdmin??void 0,l=e.account??void 0,c=ev(e.signature);e7(c),void 0!==u&&e8(u);let d=t?t.flatMap(e=>e.selectorRules&&0!==e.selectorRules.length?e.selectorRules.map(t=>{var r;return{address:e.target,selector:"string"==typeof(r=t.selector)?r:Array.isArray(r)?i.fromBytes(new Uint8Array(r)):r,...t.recipients&&t.recipients.length>0?{recipients:t.recipients}:{}}
4}):[{address:e.target}]):void 0;return{address:n,chainId:"0x"===r?0n:i.toBigInt(r),...null!=a?{expiry:Number(a)}:{},limits:o?.map(e=>({token:e.token,limit:BigInt(e.limit),...e.period&&e6(e.period)>0?{period:e6(e.period)}:{}})),...d?{scopes:d}:{},signature:c,type:s,...void 0!==u?{witness:u}:{},...void 0!==l&&f?{account:l,isAdmin:!0}:{}}}function eZ(e){let[t,r]=e,[n,a,o,...s]=t,u=(()=>{switch(a){case"0x":case"0x00":return"secp256k1";case"0x01":return"p256";case"0x02":return"webAuthn";default:throw Error(`Invalid key type: ${a}`)}})(),[f,l,c,d,p,y]=s,m=e4(f)?void 0:e6(f)||void 0,g=Array.isArray(l)&&l.length>0?l.map(e=>{var t;let[r,n,i]=e;return{token:r,limit:"0x"===(t=n)?0n:BigInt(t),...void 0!==i?{period:e6(i)}:{}}}):void 0,b=Array.isArray(c)?c.flatMap(e=>{let[t,r]=e;return Array.isArray(r)&&0!==r.length?r.map(e=>{let[r,n]=e;return{address:t,selector:r,...Array.isArray(n)&&n.length>0?{recipients:n}:{}}}):[{address:t}]}):void 0,h=e4(d)?void 0:d;void 0!==h&&e8(h);let v=(()=>{if(!e4(p)){if("0x01"!==p)throw new te(p);return!0}})(),w=e4(y)?void 0:y,x={address:o,chainId:"0x"===n?0n:i.toBigInt(n),type:u,...void 0!==m?{expiry:m}:{},...void 0!==g?{limits:g}:{},...void 0!==b?{scopes:b}:{},...void 0!==h?{witness:h}:{},...void 0!==w&&v?{account:w,isAdmin:!0}:{}};if(r){let e=eb(r);e7(e),x.signature=e}return eX(x)}function eQ(e){let[t]=e2(e),r=R.fromHex(t);return s.keccak256(r)}function e0(e){let{address:t,scopes:r,chainId:n,expiry:a,limits:o,type:s,signature:u,witness:f,isAdmin:l,account:c}=e;e7(u),void 0!==f&&e8(f);let d=(()=>{if(!r)return;let e=new Map;for(let t of r){let r=t.address;e.has(r)||e.set(r,[]),t.selector&&e.get(r).push({selector:e3(t.selector),...t.recipients&&t.recipients.length>0?{recipients:t.recipients}:{}}
4)}return[...e.entries()].map(([e,t])=>({target:e,...t.length>0?{selectorRules:t}:{}}))})();return{chainId:0n===n?"0x":i.fromNumber(n),expiry:"number"==typeof a?i.fromNumber(a):null,keyId:eJ(t),keyType:s,limits:o?.map(({token:e,limit:t,period:r})=>({token:e,limit:i.fromNumber(t),...r?{period:e5(r)}:{}})),signature:ek(u),...d?{allowedCalls:d}:{},...void 0!==f?{witness:f}:{},...l?{isAdmin:!0}:{},...void 0!==c?{account:c}:{}}}function e2(e){let{address:t,chainId:r,scopes:n,expiry:i,limits:a,witness:o,isAdmin:s,account:u}=e;void 0!==o&&e8(o);let f=(()=>{if(e.signature)return e7(e.signature),ex(e.signature)})(),l=(()=>{switch(e.type){case"secp256k1":return"0x";case"p256":return"0x01";case"webAuthn":return"0x02";default:throw Error(`Invalid key type: ${e.type}`)}})(),c=a?.map(e=>{let t=[e.token,e1(e.limit)];return e.period&&e.period>0&&t.push(e5(e.period)),t}),d=(()=>{if(!n)return;let e=new Map;for(let t of n){let r=t.address;e.has(r)||e.set(r,[]),t.selector&&e.get(r).push([e3(t.selector),t.recipients??[]])}return[...e.entries()].map(([e,t])=>[e,t.map(([e,t])=>[e,t])])})(),p=void 0!==o||s||void 0!==u,y=[{value:null!=i&&0!==i?e5(i):void 0,placeholder:"0x"},{value:c,placeholder:p?"0x":[]},{value:d,placeholder:"0x"},{value:o,placeholder:"0x"},{value:s?"0x01":void 0,placeholder:"0x"},{value:u,placeholder:"0x"}],m=-1;for(let e=y.length-1;e>=0;e--)if(void 0!==y[e].value){m=e;break}let g=y.slice(0,m+1).map(({value:e,placeholder:t})=>e??t);return[[e1(r),l,t,...g],...f?[f]:[]]}function e1(e){return 0n===e?"0x":i.fromNumber(e)}function e5(e){return 0===e?"0x":i.fromNumber(e)}function e6(e){return"0x"===e?0:i.toNumber(e)}function e3(e){if(e)return e.startsWith("0x")?e:eq.getSelector(e)}function e8(e){if(32!==i.size(e))throw new e9(e)}function e7(e){if("keychain"===e.type||"multisig"===e.type)throw new tt(e.type)}function e4(e){return void 0===e||"0x"===e}class e9 extends Error{constructor(e){super(`Witness \`${e}\` must be exactly 32 bytes (got ${i.size(e)} bytes).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"KeyAuthorization.InvalidWitnessSizeError"})}}class te extends Error{constructor(e){super(`Admin marker \`${e}\` is invalid; expected \`0x01\` (TIP-1049).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"KeyAuthorization.InvalidAdminMarkerError"})}}class tt extends Error{constructor(e){super(`Signature type \`${e}\` is invalid for key authorizations; expected \`secp256k1\`, \`p256\`, or \`webAuthn\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"KeyAuthorization.InvalidSignatureTypeError"})}}e.s(["InvalidAdminMarkerError",0,te,"InvalidSignatureTypeError",0,tt,"InvalidWitnessSizeError",0,e9,"deserialize",0,function(e){return eZ(R.toHex(e))},"from",0,eX,"fromRpc",0,eY,"fromTuple",0,eZ,"getSignPayload",0,function(e){return eQ(e)},"hash",0,eQ,"serialize",0,function(e){let t=e2(e);return R.fromHex(t)},"toRpc",0,e0,"toTuple",0,e2],115351);var tr=e.i(115351),tr=tr,ez=ez;async function tn(e,t){var r;let{chainId:n,key:i,expiry:o,limits:s,scopes:u,witness:f,admin:l}=t,{accessKeyAddress:c,keyType:d}="accessKeyAddress"in(r=i)?{accessKeyAddress:r.accessKeyAddress,keyType:r.keyType}:"publicKey"in r&&r.publicKey?{accessKeyAddress:a.fromPublicKey(F.fromHex(r.publicKey)),keyType:r.type}:{accessKeyAddress:r.address,keyType:r.type},p="accessKey"===e.source&&"accessKeyAddress"in e,y=p?{account:e.address}:{},m=l?{}:{expiry:o,limits:s,scopes:u},g=tr.getSignPayload({address:c,chainId:n,type:d,witness:f,...l?{isAdmin:!0}:{},...y,...m}),b=p?await e.sign({hash:g,raw:!0}):await e.sign({hash:g});return tr.from({address:c,chainId:n,signature:ez.from(b),type:d,...f?{witness:f}:{},...l?{isAdmin:!0}:{},...y,...m})}let ti="0xaAAAaaAA00000000000000000000000000000000",ta=["genesis","t0","t1","t1a","t1b","t1c","t2","t3","t4","t5","t6"];var to=e.i(656679);function ts(e){return{...e,data:(0,to.encodeFunctionData)(e),to:e.address}}let tu={0:"secp256k1",1:"p256",2:"webAuthn"}
4,tf={true:"limited",false:"unlimited"};async function tl(e,t){return tl.inner(eG.sendTransaction,e,t)}async function tc(e,t){return tc.inner(ej.writeContract,e,t)}(r=tl||(tl={})).inner=async function(e,t,r){let{accessKey:n,admin:i,chainId:a=t.chain?.id,expiry:o,limits:s,scopes:u,witness:f,...l}=r,c=l.account??t.account;if(!c)throw Error("account is required.");if(!a)throw Error("chainId is required.");let d=(0,eM.parseAccount)(c),p=await tn(d,{chainId:BigInt(a),key:n,admin:i,expiry:o,limits:s,scopes:u,witness:f});return await e(t,{...l,keyAuthorization:p})},r.extractEvent=function(e){let[t]=(0,eW.parseEventLogs)({abi:eH,logs:e,eventName:"KeyAuthorized",strict:!0});if(!t)throw Error("`KeyAuthorized` event not found.");return t};var td=tc||(tc={});async function tp(e,t,r){let{witness:n,...i}=r,a=td.call({witness:n});return await e(t,{...i,...a})}async function ty(e,t){let{account:r=e.account,accessKey:n,...i}=t;if(!r)throw Error("account is required.");let a=(0,eM.parseAccount)(r),o=await (0,e$.readContract)(e,{...i,account:null,...ty.call({account:a.address,accessKey:n})});return{address:o.keyId,keyType:tu[o.signatureType]??"secp256k1",expiry:o.expiry,spendPolicy:tf[`${o.enforceLimits}`],isRevoked:o.isRevoked}}async function tm(e,t){let{account:r=e.account,accessKey:n,token:i,...a}=t;if(!r)throw Error("account is required.");let o=(0,eM.parseAccount)(r),s=e.chain?.hardfork;if(s&&ta.indexOf(s)<ta.indexOf("t3"))return{remaining:await (0,e$.readContract)(e,{...a,...tm.call({account:o.address,accessKey:n,token:i})}),periodEnd:void 0};let[u,f]=await (0,e$.readContract)(e,{...a,...tm.callWithPeriod({account:o.address,accessKey:n,token:i})});return{remaining:u,periodEnd:f}}async function tg(e,t){let{account:r=e.account,accessKey:n,...i}=t;if(!r)throw Error("account is required.");let a=(0,eM.parseAccount)(r);return(0,e$.readContract)(e,{...i,account:null,...tg.call({account:a.address,accessKey:n})})}async function tb(e,t){let{account:r=e.account,witness:n,...i}=t;if(!r)throw Error("account is required.");let a=(0,eM.parseAccount)(r);return(0,e$.readContract)(e,{...i,account:null,...tb.call({account:a.address,witness:n})})}async function th(e,t){return th.inner(ej.writeContract,e,t)}td.inner=tp,td.call=function(e){let{witness:t}=e;return ts({address:ti,abi:eH,functionName:"burnKeyAuthorizationWitness",args:[t]})},td.extractEvent=function(e){let[t]=(0,eW.parseEventLogs)({abi:eH,logs:e,eventName:"KeyAuthorizationWitnessBurned",strict:!0});if(!t)throw Error("`KeyAuthorizationWitnessBurned` event not found.");return t},(ty||(ty={})).call=function(e){let{account:t,accessKey:r}=e;return ts({address:ti,abi:eH,functionName:"getKey",args:[t,tI(r)]})},(n=tm||(tm={})).call=function(e){let{account:t,accessKey:r,token:n}=e;return ts({address:ti,abi:eH,functionName:"getRemainingLimit",args:[t,tI(r),n]})},n.callWithPeriod=function(e){let{account:t,accessKey:r,token:n}=e;return ts({address:ti,abi:eH,functionName:"getRemainingLimitWithPeriod",args:[t,tI(r),n]})},(tg||(tg={})).call=function(e){let{account:t,accessKey:r}=e;return ts({address:ti,abi:eH,functionName:"isAdminKey",args:[t,tI(r)]})},(tb||(tb={})).call=function(e){let{account:t,witness:r}=e;return ts({address:ti,abi:eH,functionName:"isKeyAuthorizationWitnessBurned",args:[t,r]})};var tv=th||(th={});async function tw(e,t,r){let{accessKey:n,...i}=r,a=tv.call({accessKey:n});return await e(t,{...i,...a})}async function tx(e,t){return tx.inner(ej.writeContract,e,t)}tv.inner=tw,tv.call=function(e){let{accessKey:t}=e;return ts({address:ti,abi:eH,functionName:"revokeKey",args:[tI(t)]})},tv.extractEvent=function(e){let[t]=(0,eW.parseEventLogs)({abi:eH,logs:e,eventName:"KeyRevoked",strict:!0});if(!t)throw Error("`KeyRevoked` event not found.");return t};var tk=tx||(tx={});async function tA(e,t,r){let{accessKey:n,token:i,limit:a,...o}=r,s=tk.call({accessKey:n,token:i,limit:a});return await e(t,{...o,...s})}async function tP(e,t){let{account:r,admin:n,hash:i,signature:a,...o}=t;return(0,e$.readContract)(e,{...o,...tP.call({account:r,admin:n,hash:i,signature:a})})}function tI(e){return"string"==typeof e?e:e.accessKeyAddress}tk.inner=tA,tk.call=function(e){let{accessKey:t,token:r,limit:n}=e;return ts({address:ti,abi:eH,functionName:"updateSpendingLimit",args:[tI(t),r,n]})},tk.extractEvent=function(e){let[t]=(0,eW.parseEventLogs)({abi:eH,logs:e,eventName:"SpendingLimitUpdated",strict:!0});if(!t)throw Error("`SpendingLimitUpdated` event not found.");return t},(tP||(tP={})).call=function(e){let{account:t,admin:r=!0,hash:n,signature:i}=e;return ts({address:"0x5165300000000000000000000000000000000000",abi:eD,functionName:r?"verifyKeychainAdmin":"verifyKeychain",args:[t,n,i]})};var tB=e.i(388766);let tN={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"},tz={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function tK(e){let{address:t,chainId:r,nonce:n}=e,i=ev(e.signature);return{address:t,chainId:Number(r),nonce:BigInt(n),signature:i}}function tS(e){return e.map(e=>tK(e))}function tE(e){return e.map(e=>(function(e){let{address:t,chainId:r,nonce:n,signature:a}=e;return{address:t,chainId:i.fromNumber(r),nonce:i.fromNumber(n),signature:ek(a)}})(e))}let tT={...tN,tempo:"0x76"},tU={...tz,"0x76":"tempo"};e.s(["fromRpc",0,function(e,t={}){if(!e)return null;let r=function(e,t={}){if(!e)return null;let r=$.extract(e),n={...e,...r};return n.blockNumber=e.blockNumber?BigInt(e.blockNumber):null,"blockTimestamp"in e&&(n.blockTimestamp=e.blockTimestamp?BigInt(e.blockTimestamp):null===e.blockTimestamp?null:void 0),n.data=e.input,n.gas=BigInt(e.gas??0n),n.nonce=BigInt(e.nonce??0n),n.transactionIndex=e.transactionIndex?Number(e.transactionIndex):null,n.value=
4BigInt(e.value??0n),e.authorizationList&&(n.authorizationList=tB.fromRpcList(e.authorizationList)),e.chainId&&(n.chainId=Number(e.chainId)),e.gasPrice&&(n.gasPrice=BigInt(e.gasPrice)),e.maxFeePerBlobGas&&(n.maxFeePerBlobGas=BigInt(e.maxFeePerBlobGas)),e.maxFeePerGas&&(n.maxFeePerGas=BigInt(e.maxFeePerGas)),e.maxPriorityFeePerGas&&(n.maxPriorityFeePerGas=BigInt(e.maxPriorityFeePerGas)),e.type&&(n.type=tz[e.type]??e.type),r&&(n.v=$.yParityToV(r.yParity)),n}(e);return r.type=tU[e.type],e.aaAuthorizationList&&(r.authorizationList=tS(e.aaAuthorizationList),delete r.aaAuthorizationList),e.calls&&(r.calls=e.calls.map(e=>({to:e.to,value:e.value&&"0x"!==e.value?BigInt(e.value):void 0,data:e.input||e.data||"0x"}))),e.feeToken&&(r.feeToken=e.feeToken),e.nonceKey&&(r.nonceKey=BigInt(e.nonceKey)),e.signature&&(r.signature=ev(e.signature)),e.validAfter&&(r.validAfter=Number(e.validAfter)),e.validBefore&&(r.validBefore=Number(e.validBefore)),e.keyAuthorization&&(r.keyAuthorization=eY(e.keyAuthorization)),e.feePayerSignature&&(r.feePayerSignature=$.fromRpc(e.feePayerSignature),r.feePayerSignature.v=$.yParityToV(r.feePayerSignature.yParity)),r},"fromRpcType",0,tU,"toRpc",0,function(e,t){let r,n=((r={}).blockHash=e.blockHash,r.blockNumber="bigint"==typeof e.blockNumber?i.fromNumber(e.blockNumber):null,"bigint"==typeof e.blockTimestamp?r.blockTimestamp=i.fromNumber(e.blockTimestamp):null===e.blockTimestamp&&(r.blockTimestamp=null),r.from=e.from,r.gas=i.fromNumber(e.gas??0n),r.hash=e.hash,r.input=e.input,r.nonce=i.fromNumber(e.nonce??0n),r.to=e.to,r.transactionIndex=e.transactionIndex?i.fromNumber(e.transactionIndex):null,r.type=tN[e.type]??e.type,r.value=i.fromNumber(e.value??0n),e.accessList&&(r.accessList=e.accessList),e.authorizationList&&(r.authorizationList=tB.toRpcList(e.authorizationList)),e.blobVersionedHashes&&(r.blobVersionedHashes=e.blobVersionedHashes),e.chainId&&(r.chainId=i.fromNumber(e.chainId)),"bigint"==typeof e.gasPrice&&(r.gasPrice=i.fromNumber(e.gasPrice)),"bigint"==typeof e.maxFeePerBlobGas&&(r.maxFeePerBlobGas=i.fromNumber(e.maxFeePerBlobGas)),"bigint"==typeof e.maxFeePerGas&&(r.maxFeePerGas=i.fromNumber(e.maxFeePerGas)),"bigint"==typeof e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=i.fromNumber(e.maxPriorityFeePerGas)),"bigint"==typeof e.r&&(r.r=i.fromNumber(e.r,{size:32})),"bigint"==typeof e.s&&(r.s=i.fromNumber(e.s,{size:32})),"number"==typeof e.v&&(r.v=i.fromNumber(e.v,{size:1})),"number"==typeof e.yParity&&(r.yParity=0===e.yParity?"0x0":"0x1"),r);return n.type=tT[e.type],e.authorizationList&&(n.aaAuthorizationList=tE(e.authorizationList)),e.calls&&(n.calls=e.calls.map(e=>({to:e.to,value:e.value?i.fromNumber(e.value):void 0,data:e.data}))),e.feeToken&&(n.feeToken=e.feeToken),e.keyAuthorization&&(n.keyAuthorization=e0(e.keyAuthorization)),e.feePayerSignature&&(n.feePayerSignature=$.toRpc(e.feePayerSignature),n.feePayerSignature.v=i.fromNumber($.yParityToV(e.feePayerSignature?.yParity))),e.signature&&(n.signature=ek(e.signature)),"number"==typeof e.validAfter&&(n.validAfter=i.fromNumber(e.validAfter)),"number"==typeof e.validBefore&&(n.validBefore=i.fromNumber(e.validBefore)),n},"toRpcType",0,tT],311191);var tC=e.i(311191),tC=tC;function tL(e){if("string"==typeof e){let t=eJ(e);return a.assert(t),t}let t=i.fromNumber(e,{size:18});return i.concat("0x20c0",t)}e.s(["fromRpc",0,function(e){let{authorizationList:t,...r}=e,n=(void 0!==r.authorizationList&&(r.authorizationList=tB.fromRpcList(r.authorizationList)),void 0!==r.chainId&&(r.chainId=i.toNumber(r.chainId)),void 0!==r.gas&&(r.gas=i.toBigInt(r.gas)),void 0!==r.gasPrice&&(r.gasPrice=i.toBigInt(r.gasPrice)),void 0!==r.maxFeePerBlobGas&&(r.maxFeePerBlobGas=i.toBigInt(r.maxFeePerBlobGas)),void 0!==r.maxFeePerGas&&(r.maxFeePerGas=i.toBigInt(r.maxFeePerGas)),void 0!==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=i.toBigInt(r.maxPriorityFeePerGas)),void 0!==r.nonce&&(r.nonce=i.toBigInt(r.nonce)),void 0!==r.type&&(r.type=tz[r.type]||r.type),void 0!==r.value&&(r.value=i.toBigInt(r.value)),r);return void 0!==e.type&&(n.type=tU[e.type]||n.type),e.authorizationList&&(n.authorizationList=tS(e.authorizationList)),e.calls&&(n.calls=e.calls.map(e=>{let t={to:e.to,data:e.data};return e.value&&"0x"!==e.value&&(t.value=i.toBigInt(e.value)),t}
4)),void 0!==e.feeToken&&(n.feeToken=e.feeToken),e.keyAuthorization&&(n.keyAuthorization=eY(e.keyAuthorization)),void 0!==e.validBefore&&(n.validBefore=i.toNumber(e.validBefore)),void 0!==e.validAfter&&(n.validAfter=i.toNumber(e.validAfter)),void 0!==e.nonceKey&&(n.nonceKey=i.toBigInt(e.nonceKey)),n},"toRpc",0,function(e){var t;let r,n=(t={...e,authorizationList:void 0},r={},void 0!==t.accessList&&(r.accessList=t.accessList),void 0!==t.authorizationList&&(r.authorizationList=tB.toRpcList(t.authorizationList)),void 0!==t.blobVersionedHashes&&(r.blobVersionedHashes=t.blobVersionedHashes),void 0!==t.blobs&&(r.blobs=t.blobs),void 0!==t.chainId&&(r.chainId=i.fromNumber(t.chainId)),void 0!==t.data?(r.data=t.data,r.input=t.data):void 0!==t.input&&(r.data=t.input,r.input=t.input),void 0!==t.from&&(r.from=t.from),void 0!==t.gas&&(r.gas=i.fromNumber(t.gas)),void 0!==t.gasPrice&&(r.gasPrice=i.fromNumber(t.gasPrice)),void 0!==t.maxFeePerBlobGas&&(r.maxFeePerBlobGas=i.fromNumber(t.maxFeePerBlobGas)),void 0!==t.maxFeePerGas&&(r.maxFeePerGas=i.fromNumber(t.maxFeePerGas)),void 0!==t.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=i.fromNumber(t.maxPriorityFeePerGas)),void 0!==t.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=i.fromNumber(t.maxPriorityFeePerGas)),void 0!==t.nonce&&(r.nonce=i.fromNumber(t.nonce)),void 0!==t.to&&(r.to=t.to),void 0!==t.type&&(r.type=tN[t.type]||t.type),void 0!==t.value&&(r.value=i.fromNumber(t.value)),r);e.authorizationList&&(n.authorizationList=tE(e.authorizationList)),e.calls?n.calls=e.calls.map(e=>({to:e.to?eJ(e.to):e.to,value:e.value?i.fromNumber(e.value):"0x",data:e.data??"0x"})):(e.to||e.data||e.value)&&(n.calls=[{to:e.to?eJ(e.to):void 0,value:e.value?i.fromNumber(e.value):"0x",data:e.data??"0x"}]),void 0!==e.feeToken&&(n.feeToken=tL(e.feeToken)),e.keyAuthorization&&(n.keyAuthorization=e0(e.keyAuthorization)),void 0!==e.validBefore&&(n.validBefore=i.fromNumber(e.validBefore)),void 0!==e.validAfter&&(n.validAfter=i.fromNumber(e.validAfter));let a="random"===e.nonceKey?i.random(6):"bigint"==typeof e.nonceKey?i.fromNumber(e.nonceKey):void 0;return a&&(n.nonceKey=a),(void 0!==e.calls||void 0!==e.feePayer||void 0!==e.feeToken||void 0!==e.ke
4yAuthorization||void 0!==e.nonceKey||void 0!==e.validBefore||void 0!==e.validAfter||"tempo"===e.type)&&(n.type=tT.tempo,delete n.data,delete n.input,delete n.to,delete n.value),n}],539688);var tF=e.i(539688),tF=tF,ez=ez,tO=o;class tR extends tO.BaseError{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${i.size(e)} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccessList.InvalidStorageKeySizeError"})}}var tM=o,t$=o;let tG={wei:0,gwei:9,szabo:12,finney:15,ether:18};function tj(e,t="wei"){return function(e,t=0){let r=e.toString(),n=r.startsWith("-");n&&(r=r.slice(1));let[i,a]=[(r=r.padStart(t,"0")).slice(0,r.length-t),r.slice(r.length-t)];return a=a.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${a?`.${a}`:""}`}(e,tG.gwei-tG[t])}o.BaseError;class tW extends t$.BaseError{constructor({feeCap:e}={}){super(`The fee cap (\`maxFeePerGas\`/\`maxPriorityFeePerGas\`${e?` = ${tj(e)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.FeeCapTooHighError"})}}t$.BaseError;class tH extends t$.BaseError{constructor({chainId:e}){super(void 0!==e?`Chain ID "${e}
4" is invalid.`:"Chain ID is invalid."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.InvalidChainIdError"})}}class tD extends t$.BaseError{constructor({attributes:e,serialized:t,type:r}){const n=Object.entries(e).map(([e,t])=>void 0===t?e:void 0).filter(Boolean);super(`Invalid serialized transaction of type "${r}" was provided.`,{metaMessages:[`Serialized Transaction: "${t}"`,n.length>0?`Missing Attributes: ${n.join(", ")}`:""].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.InvalidSerializedError"})}}class tq extends t$.BaseError{constructor({maxPriorityFeePerGas:e,maxFeePerGas:t}={}){super(`The provided tip (\`maxPriorityFeePerGas\`${e?` = ${tj(e)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${t?` = ${tj(t)} gwei`:""}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.TipAboveFeeCapError"})}}let tV="0x78",tJ="0x76",t_="tempo";function tX(e){let{calls:t,chainId:r,maxFeePerGas:n,maxPriorityFeePerGas:i,validBefore:o,validAfter:s}=e;if(!t||0===t.length)throw new t5;if("number"==typeof o&&"number"==typeof s&&o<=s)throw new t6({validBefore:o,validAfter:s});if(t)for(let e of t)e.to&&a.assert(e.to,{strict:!1});if(r<=0)throw new tH({chainId:r});if(n&&BigInt(n)>2n**256n-1n)throw new tW({feeCap:n});if(i&&n&&i>n)throw new tq({maxFeePerGas:n,maxPriorityFeePerGas:i})}function tY(e){let t=R.toHex(i.slice(e,1)),[r,n,o,u,f,l,c,d,p,y,m,g,b,h,v]=t,w=Array.isArray(h)?h:void 0,x=w?v:h;if(13!==t.length&&14!==t.length&&15!==t.length)throw new tD({attributes:{authorizationList:b,chainId:r,maxPriorityFeePerGas:n,maxFeePerGas:o,gas:u,calls:f,accessList:l,keyAuthorization:w,nonceKey:c,nonce:d,validBefore:p,validAfter:y,feeToken:m,feePayerSignatureOrSender:g,...t.length>12?{signature:x}:{}},serialized:e,type:t_});let k={chainId:Number(r),type:t_};i.validate(u)&&"0x"!==u&&(k.gas=BigInt(u)),i.validate(d)&&(k.nonce="0x"===d?0n:BigInt(d)),i.validate(o)&&"0x"!==o&&(k.maxFeePerGas=BigInt(o)),i.validate(n)&&"0x"!==n&&(k.maxPriorityFeePerGas=BigInt(n)),i.validate(c)&&(k.nonceKey="0x"===c?0n:BigInt(c)),i.validate(p)&&"0x"!==p&&(k.validBefore=Number(p)),i.validate(y)&&"0x"!==y&&(k.validAfter=Number(y)),i.validate(m)&&"0x"!==m&&(k.feeToken=m),f&&"0x"!==f&&(k.calls=f.map(e=>{let[t,r,n]=e,i={};return t&&"0x"!==t&&(i.to=t),r&&"0x"!==r&&(i.value=BigInt(r)),n&&"0x"!==n&&(i.data=n),i})),l?.length!==0&&"0x"!==l&&(k.accessList=function(e){let t=[];for(let r=0;r<e.length;r++){let[n,o]=e[r];n&&a.assert(n,{strict:!1}),t.push({address:n,storageKeys:o.map(e=>s.validate(e)?e:i.trimLeft(e))})}return t}(l)),b?.length!==0&&"0x"!==b&&(k.authorizationList=function(e){let t=[];for(let r of e)t.push(function(e){let[t,r,n,i]=e,a={address:r,chainId:"0x"===t?0:Number(t),nonce:"0x"===n?0n:BigInt(n)};return i&&(a.signature=eb(i)),function(e,t={}){if("string"==typeof e.chainId)return tK(e);let r={...e,address:eJ(e.address)};return t.signature?{...r,signature:t.signature}:r}(a)}(r));return t}(b)),"0x"!==g&&void 0!==g&&("0x00"===g||a.validate(g)?(k.feePayerSignature=null,a.validate(g)&&(k.from=g)):k.feePayerSignature=$.fromTuple(g)),w&&(k.keyAuthorization=eZ(w));let A=x?eb(x):void 0;if(A&&(k={...k,signature:A}),!k.from&&A)try{k.from=em({payload:t2(tZ(k)),signature:A,root:!0})}catch{}return tX(k),k}function tZ(e,t={}){let{feePayerSignature:r,signature:n}=t,i="string"==typeof e?tY(e):e;return i.from&&(i.from=eJ(i.from)),i.calls&&(i.calls=i.calls.map(e=>({...e,...e.to?{to:eJ(e.to)}:{}}))),tX(i),{...i,...n?{signature:eh(n)}:{},...r?{feePayerSignature:$.from(r)}:{},type:"tempo"}}function tQ(e,t={}){let{accessList:r,authorizationList:n,calls:o,chainId:s,feeToken:u,gas:f,keyAuthorization:l,nonce:c,nonceKey:d,maxFeePerGas:p,maxPriorityFeePerGas:y,validBefore:m,validAfter:g}=e;tX(e);let b=function(e){if(!e||0===e.length)return[];let t=[];for(let{address:r,storageKeys:n}of e){for(let e=0;e<n.length;e++)if(32!==i.size(n[e]))throw new tR({storageKey:n[e]});r&&a.assert(r,{strict:!1}),t.push([r,n])}return t}(r),h=t.signature||e.signature,v=function(e){if(!e||0===e.length)return[];let t=[];for(let r of e)t.push(function(e){let{address:t,chainId:r,nonce:n}=e,a=e.signature?ex(e.signature):void 0;return[r?i.fromNumber(r):"0x",t,n?i.fromNumber(n):"0x",...a?[a]:[]]}(r));return t}(n),w=o.map(e=>[e.to?eJ(e.to):"0x",e.value?i.fromNumber(e.value):"0x",e.data??"0x"]),x=!1,k=(()=>
4{if(t.sender)return t.sender;if("feePayer"===t.format&&h){let t=eh(h);if("keychain"===t.type)return t.userAddress;if("p256"===t.type||"webAuthn"===t.type)return a.fromPublicKey(t.publicKey);if("secp256k1"===t.type)return M.recoverAddress({payload:t2(tZ(e)),signature:t.signature})}let r=void 0!==t.feePayerSignature?t.feePayerSignature:e.feePayerSignature;return null===r?(x=!0,"0x00"):r?$.toTuple(r):"0x"})(),A=[i.fromNumber(s),y?i.fromNumber(y):"0x",p?i.fromNumber(p):"0x",f?i.fromNumber(f):"0x",w,b,d?i.fromNumber(d):"0x",c?i.fromNumber(c):"0x","number"==typeof m?i.fromNumber(m):"0x","number"==typeof g?i.fromNumber(g):"0x",x||"bigint"!=typeof u&&"string"!=typeof u?"0x":tL(u),k,v,...l?[e2(l)]:[],...h?[ex(eh(h))]:[]];return i.concat("feePayer"===t.format?tV:tJ,R.fromHex(A))}function t0(e){return tQ({...e,signature:void 0,...void 0!==e.feePayerSignature?{feePayerSignature:null}:{}})}function t2(e,t={}){let r=t1(e,{presign:!0});return t.from?s.keccak256(i.concat("0x04",r,eJ(t.from))):r}function t1(e,t={}){let r=t.presign?t0(e):tQ(e);return s.keccak256(r)}class t5 extends tM.BaseError{constructor(){super("Calls list cannot be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TxEnvelopeTempo.CallsEmptyError"})}}class t6 extends tM.BaseError{constructor({validBefore:e,validAfter:t}){super(`validBefore (${e}) must be greater than validAfter (${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TxEnvelopeTempo.InvalidValidityWindowError"})}}e.s(["CallsEmptyError",0,t5,"InvalidValidityWindowError",0,t6,"assert",0,tX,"deserialize",0,tY,"encodeForSigning",0,t0,"feePayerMagic",0,tV,"from",0,tZ,"getFeePayerSignPayload",0,function(e,t){let r=eJ(t.sender),n=tQ({...e,signature:void 0},{sender:r,format:"feePayer"});return s.keccak256(n)},"getSignPayload",0,t2,"hash",0,t1,"serialize",0,tQ,"serializedType",0,tJ,"type",0,t_,"validate",0,function(e){try{return tX(e),!0}catch{return!1}}],457285);var t3=e.i(457285),t3=t3,t8=e.i(576213),t7=e.i(766816);function t4(e){let t=e.account;return t?.keyType&&"secp256k1"!==t.keyType||t?.source==="accessKey"||t?.source==="multisig"||void 0!==e.calls||void 0!==e.feePayer||void 0!==e.feePayerSignature||void 0!==e.feeToken||void 0!==e.ke
4yAuthorization||void 0!==e.multisig||void 0!==e.nonceKey||void 0!==e.signature||void 0!==e.signatures||void 0!==e.validBefore||void 0!==e.validAfter?"tempo":e.type?e.type:(0,t8.getTransactionType)(e)}function t9(e){try{let t=t4(e);return"tempo"===t}catch{return!1}}async function re(e,t){if(!t9(e)){if(t&&"type"in t&&"secp256k1"!==t.type)throw Error("Unsupported signature type. Expected `secp256k1` but got `"+t.type+"`.");if(t&&"type"in t){let{r,s:n,yParity:a}=t?.signature;return(0,t7.serializeTransaction)(e,{r:i.fromNumber(r,{size:32}),s:i.fromNumber(n,{size:32}),yParity:a})}return(0,t7.serializeTransaction)(e,t)}if("tempo"===t4(e))return rt(e,t);throw Error("Unsupported transaction type")}async function rt(e,t){let r,n=e.signature?e.signature:t&&"type"in t?t:t?ez.from({r:BigInt(t.r),s:BigInt(t.s),yParity:Number(t.yParity)}):void 0,{chainId:i,feePayer:a,nonce:o,...s}=e,u=(r=e.feePayerSignature)?{r:BigInt(r.r),s:BigInt(r.s),yParity:Number(r.yParity)}:null===r||a?null:void 0,f=void 0!==e.feePayerSignature&&null!==e.feePayerSignature,l={...s,calls:s.calls?.length?s.calls:[{to:s.to||(s.data&&"0x"!==s.data?void 0:"0x0000000000000000000000000000000000000000"),value:s.value,data:s.data}],chainId:Number(i),feePayerSignature:u,type:"tempo",...o?{nonce:BigInt(o)}:{}},c={...l};(!0!==a||n&&u)&&("object"!=typeof a||n)&&(n||!f)||delete c.feeToken;let d=(()=>{if(n)return n;if(!e.multisig||!e.signatures)return;let t=t3.getSignPayload(t3.from(c)),r=e.signatures.map(e=>ez.from(e)),i=ez.sortMultisigApprovals({payload:t,signatures:r,genesisConfig:e.multisig});return ez.from({genesisConfig:e.multisig,signatures:i,...o||e.nonceKey?{}:{init:!0}})})();if(d&&"object"==typeof e.feePayer){let t=t3.from(l,{signature:d}),r=e.from??ez.extractAddress({payload:t3.getSignPayload(t),root:!0,signature:d}),n=t3.getFeePayerSignPayload(t,{sender:r}),i=await e.feePayer.sign({hash:n});return t3.serialize(t,{feePayerSignature:$.from(i)})}return!0===a||!d&&f?d&&u?t3.serialize(c,{signature:d}):d?t3.serialize(c,{format:"feePayer",sender:e.from,signature:d}):t3.serialize(c,{feePayerSignature:null}):t3.serialize(c,{feePayerSignature:void 0,signature:d})}function rr(e){if(!e)return e;let t=(e.length-2)/2;return t<=4?e:i.fromNumber(t,{size:2})}let rn=new Map;async function ri(e){rn.set(e,(rn.get(e)??0)+1),await Promise.resolve();let t=(rn.get(e)??0)>1;return queueMicrotask(()=>{let t=rn.get(e)??0;t<=1?rn.delete(e):rn.set(e,t-1)}),t}let ra={blockTime:1e3,extendSchema:(0,eU.extendSchema)(),formatters:{transaction:(0,eC.defineTransaction)({exclude:["aaAuthorizationList"],format:function(e){if(!t9(e))return(0,eC.formatTransaction)(e);let t=null==e.blockTimestamp?void 0:BigInt(e.blockTimestamp),{feePayerSignature:r,gasPrice:n,nonce:a,...o}=tC.fromRpc(e);return{...o,accessList:o.accessList,...void 0!==t&&{blockTimestamp:t},feePayerSignature:r?{r:i.fromNumber(r.r,{size:32}),s:i.fromNumber(r.s,{size:32}),v:BigInt(r.v??27),yParity:r.yParity}:void 0,nonce:Number(a),typeHex:tC.toRpcType[o.type],type:o.type}}}),transactionReceipt:(0,eL.defineTransactionReceipt)({format:function(e){return(0,eL.formatTransactionReceipt)(e)}}),transactionRequest:(0,eF.defineTransactionRequest)({format:function(e,t){let r,n=e.account?(0,eM.parseAccount)(e.account):void 0;if(!t9(e))return(0,eF.formatTransactionRequest)(e,t);t&&(e.calls=e.calls??[{to:e.to||(e.data&&"0x"!==e.data?void 0:"0x0000000000000000000000000000000000000000"),value:e.value,data:e.data}]),!0!==e.feePayer||e.feePayerSignature||delete e.feeToken;let{multisig:i,multisigInit:a,multisigSignatureCount:o,signatures:s,...u}=e,f=tF.toRpc({...u,type:"tempo"});"estimateGas"===t&&(f.maxFeePerGas=void 0,f.maxPriorityFeePerGas=void 0),f.to=void 0,f.data=void 0,f.value=void 0;let[l,c]=(r=n&&"keyType"in n?n.keyType:n?.source)?"webAuthn"===r?["webAuthn","0x0578"]:["p256","secp256k1"].includes(r)?[r,void 0]:[e.keyType,rr(e.keyData)]:[e.keyType,rr(e.keyData)],d=n&&"accessKeyAddress"in n?n.accessKeyAddress:e.keyId;return n&&(f.from=n.address),{...f,...a?{multisigInit:a}:{},...void 0!==o?{multisigSignatureCount:o}:{},...e.capabilities?{capabilities:e.capabilities}:{},...c?{keyData:c}:{},...d?{keyId:d}:{},...l?{keyType:l}:{},...void 0!==e.feePayer?{feePayer:"object"==typeof e.feePayer?(0,eM.parseAccount)(e.feePayer):e.feePayer}:{},..."feePayerSignature"in e&&void 0!==e.feePayerSignature?{feePayerSignature:e.feePayerSignature}:{}}}})},prepareTransactionRequest:[async(e,{client:t,phase:r})=>{if("afterFillParameters"===r)return e.feePayer&&(e.keyAuthorization?.signature.type==="webAuthn"?e.gas=(e.gas??0n)+20000n:e.account?.source==="accessKey"&&(e.gas=(e.gas??0n)+10000n)),e;let n=e.multisig??(e.account?.source==="multisig"?e.account.config:void 0);if(n){let t=g.from(n);e.multisig=t,e.from=g.getAddress(t),e.multisigInit={salt:t.salt??g.zeroSalt,threshold:Number(t.threshold),owners:t.owners.map(e=>({owner:e.owner,weight:Number(e.weight)}))},e.multisigSignatureCount??=function(e){let t=Number(e.threshold),r=e.owners.map(e=>Number(e.weight)).sort((e,t)=>
4t-e),n=0;for(let[e,i]of r.entries())if((n+=i)>=t)return e+1;return r.length}(t),e.account?.source!=="multisig"&&delete e.account}if(!e.keyAuthorization&&e.account?.source==="accessKey"){let r=e.account.keyAuthorizationManager;if(r){let n=e.chainId??e.chain?.id;if(void 0!==n){let i=e.account.address,a=e.account.accessKeyAddress,o={address:i,accessKey:a,chainId:n},s=await r.get(o);if(s){let n=BigInt(Math.floor(Date.now()/1e3));if(null!=s.expiry&&BigInt(s.expiry)<=n)await r.remove(o);else{let u=await (0,eO.getAction)(t,ty,"getMetadata")({account:i,accessKey:a});(0,eT.isAddressEqual)(u.address,a)&&!u.isRevoked&&u.expiry>n?await r.remove(o):e.keyAuthorization=s}}}}}if(await (async()=>{if("expiring"===e.nonceKey)return!0;if(n)return!1;if(e.feePayer&&void 0===e.nonceKey)return!0;let t=e.account?.address;return!!t&&void 0===e.nonceKey&&await ri(t)})()){let t;e.nonceKey=eE.maxUint256,e.nonce=0,void 0===e.validAfter&&(e.validAfter=(t=BigInt(Math.floor(Date.now()/1e3))-60n)<=0n?0:Number(BigInt(i.random(8))%t)),void 0===e.validBefore&&(e.validBefore=Math.floor(Date.now()/1e3)+25)}else void 0!==e.nonceKey&&(e.nonce="number"==typeof e.nonce?e.nonce:0);return!e.feeToken&&e.chain?.feeToken&&(e.feeToken=e.chain.feeToken),e},{runAt:["beforeFillTransaction","afterFillParameters"]}],serializers:{transaction:(e,t)=>re(e,t)},async verifyHash(e,t){let{address:r,hash:n,signature:a,mode:o}=t,s=(()=>{if("string"==typeof a)try{return ez.deserialize(a)}catch{return}})();if(s){if(s?.type==="keychain"&&"allowAccessKey"===o){let a="v2"===s.version?(0,eR.keccak256)(i.concat("0x04",n,r)):n,o=(()=>{try{return ez.extractAddress({payload:a,signature:s.inner})}catch{return}})();if(!o)return!1;let u=await ty(e,{account:r,accessKey:o,blockHash:t.blockHash,blockNumber:t.blockNumber,blockTag:t.blockTag,requireCanonical:t.requireCanonical});return!(u.isRevoked||u.expiry<=BigInt(Math.floor(Date.now()/1e3)))&&ez.verify(s.inner,{address:o,payload:a})}if("p256"===s.type||"webAuthn"===s.type){let i=await (0,eK.getCode)(e,{address:r,blockHash:t.blockHash,blockNumber:t.blockNumber,blockTag:t.blockTag,requireCanonical:t.requireCanonical});if(!i||"0xef01007702c00000000000000000000000000000000000"===i)return ez.verify(s,{address:r,payload:n})}}return await (0,eO.getAction)(e,eS.verifyHash,"verifyHash")({...t,chain:null})}};e.s(["chainConfig",0,ra],116084);let ro=(0,eU.defineChain)({...ra,id:4217,blockExplorers:{default:{name:"Tempo Explorer",url:"https://explore.tempo.xyz"}},name:"Tempo Mainnet",nativeCurrency:{name:"USD",symbol:"USD",decimals:6},rpcUrls:{default:{http:["https://rpc.tempo.xyz"],webSocket:["wss://rpc.tempo.xyz"]}}});e.s(["tempo",0,ro],479083);let rs=(0,eU.defineChain)({...ra,id:42431,hardfork:"t5",blockExplorers:{default:{name:"Tempo Explorer",url:"https://explore.testnet.tempo.xyz"}},name:"Tempo Testnet (Moderato)",nativeCurrency:{name:"USD",symbol:"USD",decimals:6},rpcUrls:{default:{http:["https://rpc.moderato.tempo.xyz"],webSocket:["wss://rpc.moderato.tempo.xyz"]}},testnet:!0});e.s(["tempoModerato",0,rs],129669)}]);
5
6//# debugId=f4905084-bd97-ceef-9153-b00b26cae6d7
7//# sourceMappingURL=0zi64ru~ex~e_.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.