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]="4a648866-8d9b-ef93-387a-3526a8ed14dd")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,820857,e=>{"use strict";e.s(["defineChain",0,function(e){let t={formatters:void 0,fees:void 0,serializers:void 0,...e};return Object.assign(t,{extend:function e(t){return r=>{let n="function"==typeof r?r(t):r,i={...t,...n};return Object.assign(i,{extend:e(i)})}}(t)})},"extendSchema",0,function(){return{}}])},463976,e=>{"use strict";e.s(["serializeAuthorizationList",()=>n]);var t=e.i(544316),r=e.i(492344);function n(e){if(!e||0===e.length)return[];let n=[];for(let i of e){let{chainId:e,nonce:a,...o}=i,s=i.address;n.push([e?(0,t.toHex)(e):"0x",s,a?(0,t.toHex)(a):"0x",...(0,r.toYParitySignatureArray)({},o)])}return n}},457688,e=>{"use strict";var t=e.i(928183),r=e.i(389959),n=e.i(7411),i=e.i(224704),a=e.i(638902),o=e.i(39444),s=e.i(843005),u=e.i(443392),f=e.i(738840),c=e.i(28106),l=e.i(977824);function d(e){let{chainId:t,maxPriorityFeePerGas:i,maxFeePerGas:a,to:f}=e;if(t<=0)throw new o.InvalidChainIdError({chainId:t});if(f&&!(0,u.isAddress)(f))throw new n.InvalidAddressError({address:f});if(a&&a>r.maxUint256)throw new s.FeeCapTooHighError({maxFeePerGas:a});if(i&&a&&i>a)throw new s.TipAboveFeeCapError({maxFeePerGas:a,maxPriorityFeePerGas:i})}e.s(["assertTransactionEIP1559",0,d,"assertTransactionEIP2930",0,function(e){let{chainId:t,maxPriorityFeePerGas:a,gasPrice:f,maxFeePerGas:c,to:l}=e;if(t<=0)throw new o.InvalidChainIdError({chainId:t});if(l&&!(0,u.isAddress)(l))throw new n.InvalidAddressError({address:l});if(a||c)throw new i.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(f&&f>r.maxUint256)throw new s.FeeCapTooHighError({maxFeePerGas:f})},"assertTransactionEIP4844",0,function(e){let{blobVersionedHashes:r}=e;if(r){if(0===r.length)throw new a.EmptyBlobError;for(let e of r){let r=(0,f.size)(e),n=(0,l.hexToNumber)((0,c.slice)(e,0,1));if(32!==r)throw new a.InvalidVersionedHashSizeError({hash:e,size:r});if(n!==t.versionedHashVersionKzg)throw new a.InvalidVersionedHashVersionError({hash:e,version:n})}}d(e)},"assertTransactionEIP7702",0,function(e){let{authorizationList:t}=e;if(t)for(let e of t){let{chainId:t}=e,r=e.address;if(!(0,u.isAddress)(r))throw new n.InvalidAddressError({address:r});if(t<0)throw new o.InvalidChainIdError({chainId:t})}d(e)},"assertTransactionLegacy",0,function(e){let{chainId:t,maxPriorityFeePerGas:a,gasPrice:f,maxFeePerGas:c,to:l}=e;if(l&&!(0,u.isAddress)(l))throw new n.InvalidAddressError({address:l});if(void 0!==t&&t<=0)throw new o.InvalidChainIdError({chainId:t});if(a||c)throw new i.BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(f&&f>r.maxUint256)throw new s.FeeCapTooHighError({maxFeePerGas:f})}])},492344,507006,e=>{"use strict";e.s(["serializeTransaction",()=>b,"toYParitySignatureArray",()=>g],492344);var t=e.i(803116),r=e.i(463976),n=e.i(902206),i=e.i(658945),a=e.i(544676),o=e.i(320908),s=e.i(351674),u=e.i(696748),f=e.i(544316),c=e.i(621525),l=e.i(457688),d=e.i(987982),p=e.i(7411),y=e.i(443392);function m(e){if(!e||0===e.length)return[];let r=[];for(let n=0;n<e.length;n++){let{address:i,storageKeys:a}=e[n];for(let e=0;e<a.length;e++)if(a[e].length-2!=64)throw new t.InvalidStorageKeySizeError({storageKey:a[e]});if(!(0,y.isAddress)(i,{strict:!1}))throw new p.InvalidAddressError({address:i});r.push([i,a])}return r}function b(e,p){let y=(0,d.getTransactionType)(e);return"eip1559"===y?function(e,t){let{chainId:r,gas:n,nonce:i,to:a,value:o,maxFeePerGas:u,maxPriorityFeePerGas:d,accessList:p,data:y}=e;(0,l.assertTransactionEIP1559)(e);let b=m(p),h=[(0,f.numberToHex)(r),i?(0,f.numberToHex)(i):"0x",d?(0,f.numberToHex)(d):"0x",u?(0,f.numberToHex)(u):"0x",n?(0,f.numberToHex)(n):"0x",a??"0x",o?(0,f.numberToHex)(o):"0x",y??"0x",b,...g(e,t)];return(0,s.concatHex)(["0x02",(0,c.toRlp)(h)])}(e,p):"eip2930"===y?function(e,t){let{chainId:r,gas:n,data:i,nonce:a,to:o,value:u,accessList:d,gasPrice:p}=e;(0,l.assertTransactionEIP2930)(e);let y=m(d),b=[(0,f.numberToHex)(r),a?(0,f.numberToHex)(a):"0x",p?(0,f.numberToHex)(p):"0x",n?(0,f.numberToHex)(n):"0x",o??"0x",u?(0,f.numberToHex)(u):"0x",i??"0x",y,...g(e,t)];return(0,s.concatHex)(["0x01",(0,c.toRlp)(b)])}(e,p):"eip4844"===y?function(e,t){let{chainId:r,gas:u,nonce:d,to:p,value:y,maxFeePerBlobGas:b,maxFeePerGas:h,maxPriorityFeePerGas:v,accessList:x,data:w}=e;(0,l.assertTransactionEIP4844)(e);let P=e.blobVersionedHashes,k=e.sidecars;if(e.blobs&&(void 0===P||void 0===k)){let t="string"==typeof e.blobs[0]?e.blobs:e.blobs.map(e=>(0,f.bytesToHex)(e)),r=e.kzg,s=(0,n.blobsToCommitments)({blobs:t,kzg:r});if(void 0===P&&(P=(0,a.commitmentsToVersionedHashes)({commitments:s})),void 0===k){let e=(0,i.blobsToProofs)({blobs:t,commitments:s,kzg:r});k=(0,o.toBlobSidecars)({blobs:t,commitments:s,proofs:e})}}let I=m(x),B=[(0,f.numberToHex)(r),d?(0,f.numberToHex)(d):"0x",v?(0,f.numberToHex)(v):"0x",h?(0,f.numberToHex)(h):"0x",u?(0,f.numberToHex)(u):"0x",p??"0x",y?(0,f.numberToHex)(y):"0x",w??"0x",I,b?(0,f.numberToHex)(b):"0x",P??[],...g(e,t)],A=[],T=[],E=[];if(k)for(let e=0;e<k.length;e++){let{blob:t,commitment:r,proof:n}=k[e];A.push(t),T.push(r),E.push(n)}return(0,s.concatHex)(["0x03",k?(0,c.toRlp)([B,A,T,E]):(0,c.toRlp)(B)])}(e,p):"eip7702"===y?function(e,t){let{authorizationList:n,chainId:i,gas:a,nonce:o,to:u,value:d,maxFeePerGas:p,maxPriorityFeePerGas:y,accessList:b,data:h}=e;(0,l.assertTransactionEIP7702)(e);let v=m(b),x=(0,r.serializeAuthorizationList)(n);return(0,s.concatHex)(["0x04",(0,c.toRlp)([(0,f.numberToHex)(i),o?(0,f.numberToHex)(o):"0x",y?(0,f.numberToHex)(y):"0x",p?(0,f.numberToHex)(p):"0x",a?(0,f.numberToHex)(a):"0x",u??"0x",d?(0,f.numberToHex)(d):"0x",h??"0x",v,x,...g(e,t)])])}(e,p):function(e,r){let{chainId:n=0,gas:i,data:a,nonce:o,to:s,value:d,gasPrice:p}=e;(0,l.assertTransactionLegacy)(e);let y=[o?(0,f.numberToHex)(o):"0x",p?(0,f.numberToHex)(p):"0x",i?(0,f.numberToHex)(i):"0x",s??"0x",d?(0,f.numberToHex)(d):"0x",a??"0x"];if(r){let e=(()=>
2{if(r.v>=35n)return(r.v-35n)/2n>0?r.v:27n+(35n===r.v?0n:1n);if(n>0)return BigInt(2*n)+BigInt(35n+r.v-27n);let e=27n+(27n===r.v?0n:1n);if(r.v!==e)throw new t.InvalidLegacyVError({v:r.v});return e})(),i=(0,u.trim)(r.r),a=(0,u.trim)(r.s);y=[...y,(0,f.numberToHex)(e),"0x00"===i?"0x":i,"0x00"===a?"0x":a]}else n>0&&(y=[...y,(0,f.numberToHex)(n),"0x","0x"]);return(0,c.toRlp)(y)}(e,p)}function g(e,t){let r=t??e,{v:n,yParity:i}=r;if(void 0===r.r||void 0===r.s||void 0===n&&void 0===i)return[];let a=(0,u.trim)(r.r),o=(0,u.trim)(r.s);return["number"==typeof i?i?(0,f.numberToHex)(1):"0x":0n===n?"0x":1n===n?(0,f.numberToHex)(1):27n===n?"0x":(0,f.numberToHex)(1),"0x00"===a?"0x":a,"0x00"===o?"0x":o]}e.s(["serializeAccessList",0,m],507006)},176842,829378,e=>{"use strict";var t,r,n,i=e.i(692138),a=e.i(190964),o=e.i(440898),s=e.i(950436),u=e.i(44314),f=e.i(554031),c=e.i(22815),l=e.i(698367),d=e.i(240718);let p=(0,l.Field)(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),y=p.create(BigInt("-3")),m=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),b=(0,f.createCurve)({a:y,b:m,Fp:p,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},u.sha256),g=(0,d.mapToCurveSimpleSWU)(p,{A:y,B:m,Z:p.create(BigInt("-10"))});(0,c.createHasher)(b.ProjectivePoint,e=>g(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:u.sha256});let h=(0,l.Field)(BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff")),v=h.create(BigInt("-3")),x=BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef");(0,f.createCurve)({a:v,b:x,Fp:h,n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),h:BigInt(1),lowS:!1},u.sha384),(0,d.mapToCurveSimpleSWU)(h,{A:v,B:x,Z:h.create(BigInt("-12"))});let w=(0,l.Field)(BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")),P=w.create(BigInt("-3")),k=BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00");(0,f.createCurve)({a:P,b:k,Fp:w,n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650"),h:BigInt(1),lowS:!1,allowedPrivateKeyLengths:[130,131,132]},u.sha512),(0,d.mapToCurveSimpleSWU)(w,{A:P,B:k,Z:w.create(BigInt("-4"))});var I=e.i(758883),B=e.i(250624);function A(e){let{hash:t,payload:r,publicKey:n,signature:i}=e;return b.verify(i,r instanceof Uint8Array?r:I.fromHex(r),B.toHex(n).substring(2),{lowS:!0,...t?{prehash:!0}:{}})}var T=e.i(422438),E=e.i(516030);let z=new TextEncoder;Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[t,e.charCodeAt(0)]);let S={...Object.fromEntries(Array.from("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").map((e,t)=>[e.charCodeAt(0),t])),61:0,45:62,95:63};var N=e.i(671495);Uint8Array.from([105,171,180,181,160,222,75,198,42,42,32,31,141,37,186,233]),o.BaseError,o.BaseError;var K=o;e.i(473796);class U extends K.BaseError{constructor({majorType:e}){super(`Invalid CBOR major type: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.InvalidMajorTypeError"})}}class L extends K.BaseError{constructor({additionalInfo:e}){super(`Invalid CBOR additional info: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.InvalidAdditionalInfoError"})}}class F extends K.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 H extends K.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 C extends K.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 R extends K.BaseError{constructor({value:e}){super(`Invalid CBOR simple value: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.InvalidSimpleValueError"})}}class G extends K.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 O extends K.BaseError{constructor({token:e}){super(`Unexpected token: ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cbor.UnexpectedTokenError"})}}class j extends K.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 $ extends K.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 M extends K.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 W extends K.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 D extends K.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 V(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 V.number(e);if("bigint"==typeof e)throw new G;if("string"==typeof e)return V.string(e);if(Array.isArray(e))return V.array(e);if(e instanceof Uint8Array)return V.byteString(e);if(e instanceof ArrayBuffer)return V.byteString(new Uint8Array(e));if(ArrayBuffer.isView(e))return V.byteString(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));if(e instanceof Map)return V.map(e);if("object"==typeof e)return V.object(e);throw new O({token:String(e)})}function q(e){let t=e.readUint8(),r=t>>5,n=31&t;switch(r){case 0:return q.readUnsignedInteger(e,n);case 1:return q.readNegativeInteger(e,n);case 2:return q.readByteString(e,n);case 3:return q.readTextString(e,n);case 4:return q.readArray(e,n);case 5:return q.readMap(e,n);case 6:throw new H({tag:n});case 7:return q.readSimpleOrFloat(e,n);default:throw new U({majorType:r})}}(t=V||(V={})).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 j({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 j({number:e.toString(10)})},t.string=function(e){let t=I.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 $({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 M({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 D({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 W({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 W({size:i})};var J=q||(q={});function _(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 F;throw new L({additionalInfo:t})}J.readUnsignedInteger=function(e,t){return _(e,t)},J.readNegativeInteger=function(e,t){return -1-_(e,t)},J.readByteString=function(e,t){if(31===t){let t=[],r=0;for(;;){if(255===e.inspectUint8()){e.readUint8();break}let n=J(e);if(!(n instanceof Uint8Array))throw new C({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=_(e,t);return e.readBytes(r)},J.readTextString=function(e,t){if(31===t){let t=[];for(;;){if(255===e.inspectUint8()){e.readUint8();break}let r=J(e);if("string"!=typeof r)throw new C({type:"text string"});t.push(r)}return t.join("")}let r=_(e,t),n=e.readBytes(r);return I.toString(n)},J.readArray=function(e,t){if(31===t){let t=[];for(;;){if(255===e.inspectUint8()){e.readUint8();break}t.push(J(e))}return t}let r=_(e,t),n=[];for(let t=0;t<r;t++)n.push(J(e));return n},J.readMap=function(e,t){if(31===t){let t={};for(;;){if(255===e.inspectUint8()){e.readUint8();break}let r=J(e),n="string"==typeof r?r:String(r),i=J(e);t[n]=i}return t}let r=_(e,t),n={};for(let t=0;t<r;t++){let t=J(e),r="string"==typeof t?t:String(t),i=J(e);n[r]=i}return n},J.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 R({value:t});return}throw new L({additionalInfo:t})}};o.BaseError,o.BaseError;let X="0x01",Y="0x02",Z="0x03",Q="0x04",ee="0x7777777777777777777777777777777777777777777777777777777777777777";function et(e){let t=es(e);if("secp256k1"===t)return void E.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 el({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 el({envelope:e,missing:t,type:"webAuthn"});return}if("keychain"===t)return void et(e.inner)}function er(e){let{signature:t,root:r}=e;return"keychain"===t.type?r?t.userAddress:er({...e,signature:t.inner}):a.fromPublicKey(en(e))}function en(e){let{payload:t,signature:r}=e;switch(r.type){case"secp256k1":return T.recoverPublicKey({payload:t,signature:r.signature});case"p256":case"webAuthn":return r.publicKey;case"keychain":return en({payload:t,signature:r.inner})}}function ei(e){let t=e.endsWith(ee.slice(2))?i.slice(e,0,-i.size(ee)):e;if(65===i.size(t)){let e=E.fromHex(t);return E.assert(e),{signature:e,type:"secp256k1"}}let r=i.slice(t,0,1),n=i.slice(t,1),a=i.size(n);if(r===X){if(129!==a)throw new ed({reason:`Invalid P256 signature envelope size: expected 129 bytes, got ${a} bytes`,serialized:t});return{publicKey:{prefix:4,x:i.toBigInt(i.slice(n,64,96)),y:i.toBigInt(i.slice(n,96,128))},prehash:0!==i.toNumber(i.slice(n,128,129)),signature:{r:i.toBigInt(i.slice(n,0,32)),s:i.toBigInt(i.slice(n,32,64))},type:"p256"}}if(r===Y){let e,r;if(a<128)throw new ed({reason:`Invalid WebAuthn signature envelope size: expected at least 128 bytes, got ${a} bytes`,serialized:t});let o=a-128,s=i.slice(n,0,o);for(let t=37;t<o;t++){let n=i.toString(i.slice(s,t));if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n),e=i.slice(s,0,t),r=n;break}catch{}}if(!e||!r)throw new ed({reason:"Unable to parse WebAuthn metadata: could not extract valid authenticatorData and clientDataJSON",serialized:t});return{publicKey:{prefix:4,x:i.toBigInt(i.slice(n,o+64,o+96)),y:i.toBigInt(i.slice(n,o+96,o+128))},metadata:{authenticatorData:e,clientDataJSON:r},signature:{r:i.toBigInt(i.slice(n,o,o+32)),s:i.toBigInt(i.slice(n,o+32,o+64))},type:"webAuthn"}}if(r===Z||r===Q)return{userAddress:i.slice(n,0,20),inner:ei(i.slice(n,20)),type:"keychain",version:r===Q?"v2":"v1"};throw new ed({reason:`Unknown signature type identifier: ${r}. Expected ${X} (P256), ${Y} (WebAuthn), ${Z} (Keychain V1), or ${Q} (Keychain V2)`,serialized:t})}function ea(e,t){let r;if("string"==typeof e)return ei(e);if("object"==typeof e&&null!==e&&"r"in e&&"s"in e&&"yParity"in e)return{signature:e,type:"secp256k1"};let n=es(e);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(T.recoverPublicKey({payload:t.payload,signature:r.signature}))}:{}:{}}:{},type:n}}function eo(e){if("secp256k1"===e.type)return{signature:E.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 ed({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:eo(e.signature),...e.keyId?{keyId:e.keyId}:{},...e.version?{version:e.version}:{}};
2throw new ec({envelope:e})}function es(e){if("object"!=typeof e||null===e)throw new ec({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";throw new ec({envelope:e})}function eu(e,t={}){let r=es(e);if("secp256k1"===r)return i.concat(E.toHex(e.signature),t.magic?ee:"0x");if("p256"===r)return i.concat(X,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?ee:"0x");if("webAuthn"===r){let r=i.concat(e.metadata.authenticatorData,i.fromString(e.metadata.clientDataJSON));return i.concat(Y,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?ee:"0x")}if("keychain"===r){let r="v1"===e.version?Z:Q;return i.concat(r,e.userAddress,eu(e.inner),t.magic?ee:"0x")}throw new ec({envelope:e})}function ef(e){let t=es(e);if("secp256k1"===t)return{...E.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:ef(e.inner),...e.keyId?{keyId:e.keyId}:{},...e.version?{version:e.version}:{}};throw new ec({envelope:e})}class ec extends o.BaseError{constructor({envelope:e}){super(`Unable to coerce value (\`${s.stringify(e)}\`) to a valid signature envelope.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.CoercionError"})}}class el extends o.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: ${s.stringify(e)}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.MissingPropertiesError"})}}class ed extends o.BaseError{constructor({reason:e,serialized:t}){super(`Unable to deserialize signature envelope: ${e}`,{metaMessages:[`Serialized: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.InvalidSerializedError"})}}class ep extends o.BaseError{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureEnvelope.VerificationError"})}}e.s(["CoercionError",0,ec,"InvalidSerializedError",0,ed,"MissingPropertiesError",0,el,"VerificationError",0,ep,"assert",0,et,"deserialize",0,ei,"extractAddress",0,er,"extractPublicKey",0,en,"from",0,ea,"fromRpc",0,eo,"getType",0,es,"magicBytes",0,ee,"serialize",0,eu,"toRpc",0,ef,"types",0,["secp256k1","p256","webAuthn"],"validate",0,function(e){try{return et(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=ea(e);if("secp256k1"===o.type)return!!n&&T.verify({address:n,payload:r,signature:o.signature});if("p256"===o.type){let e=a.fromPublicKey(o.publicKey);return!!a.isEqual(e,n)&&A({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:s}=e,{authenticatorData:u,clientDataJSON:f,userVerificationRequired:c}=r,l=I.fromHex(u);if(l.length<37)return!1;if(void 0!==o){let e=l.slice(0,32),t=N.sha256(i.fromString(o),{as:"Bytes"});if(!I.isEqual(e,t))return!1}let d=l[32];if((1&d)!=1||c&&(4&d)!=4||(8&d)!=8&&(16&d)==16)return!1;let p=JSON.parse(f);if("webauthn.get"!==p.type||!p.challenge||i.fromBytes(function(e){let t=e.replace(/=+$/,""),r=t.length,n=new Uint8Array(r+3);z.encodeInto(t+"===",n);for(let e=0,r=0;e<t.length;e+=4,r+=3){let t=(S[n[e]]<<18)+(S[n[e+1]]<<12)+(S[n[e+2]]<<6)+S[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))}(p.challenge))!==t||void 0!==n&&!(Array.isArray(n)?n:[n]).includes(p.origin))return!1;let y=N.sha256(I.fromString(f),{as:"Bytes"});
4return A({hash:!0,payload:I.concat(l,y),publicKey:a,signature:s})}({challenge:i.from(r),metadata:o.metadata,publicKey:o.publicKey,signature:o.signature})}throw new ep(`Unable to verify signature envelope of type "${o.type}".`)}],916447);var ey=e.i(916447),ey=ey,em=e.i(611770),eb=e.i(571624),eg=e.i(389959),eh=e.i(198480),ev=e.i(820857),ex=e.i(719068),ew=e.i(486144),eP=e.i(710826),ek=e.i(377092),eI=e.i(702669),eB=e.i(138981),eA=e.i(547762),eT=e.i(21701),eE=e.i(293585),ez=e.i(817115);let eS=[{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:"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:"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:"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:"InvalidKeyAuthorizationWitness",type:"error",inputs:[]},{name:"KeyAuthorizationWitnessAlreadyBurned",type:"error",inputs:[]},{name:"LegacyAuthorizeKeySelectorChanged",type:"error",inputs:[{type:"bytes4",name:"newSelector"}]}];[...eS];var eN=e.i(474183),eK=e.i(134153),eU=o;function eL(e){return e.startsWith("tempo")?function(e){if(!e.startsWith("tempox"))throw new eF({address:e});let t=e.slice(6);return i.assert(t,{strict:!0}),{address:a.checksum(t)}}(e).address:e}class eF extends eU.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 eH(e,t={}){if("keyId"in e)return eC(e);let r={...e,address:eL(e.address),...e.limits?{limits:e.limits.map(e=>({...e,token:eL(e.token)}))}:{},...e.scopes?{scopes:e.scopes.map(e=>({...e,address:eL(e.address),selector:eD(e.selector),...e.recipients?{recipients:e.recipients.map(e=>eL(e))}:{}}))}:{}};return t.signature?{...r,signature:ea(t.signature)}:r}function eC(e){let{allowedCalls:t,chainId:r,keyId:n,expiry:a,limits:o,keyType:s}=e,u=eo(e.signature),f=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&&eW(e.period)>0?{period:eW(e.period)}:{}})),...f?{scopes:f}:{},signature:u,type:s}}function eR(e){let[t,r]=e,[n,a,o,s,u,f]=t,c=(()=>{switch(a){case"0x":case"0x00":return"secp256k1";case"0x01":return"p256";case"0x02":return"webAuthn";default:throw Error(`Invalid key type: ${a}`)}})(),l={address:o,expiry:void 0!==s&&eW(s)||void 0,type:c,chainId:"0x"===n?0n:i.toBigInt(n),...void 0!==s?{expiry:eW(s)||void 0}:{},...void 0!==u&&Array.isArray(u)&&u.length>0?{limits:u.map(e=>{var t;let[r,n,i]=e;return{token:r,limit:"0x"===(t=n)?0n:BigInt(t),...void 0!==i?{period:eW(i)}:{}}})}:{},...void 0!==f&&Array.isArray(f)?{scopes:f.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}]})}:{}};return r&&(l.signature=ei(r)),eH(l)}function eG(e){let[t]=ej(e),r=eK.fromHex(t);return N.keccak256(r)}function eO(e){let{address:t,scopes:r,chainId:n,expiry:a,limits:o,type:s,signature:u}=e,f=(()=>{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:eD(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:eL(t),keyType:s,limits:o?.map(({token:e,limit:t,period:r})=>({token:e,limit:i.fromNumber(t),...r?{period:eM(r)}:{}})),signature:ef(u),...f?{allowedCalls:f}:{}}}function ej(e){let{address:t,chainId:r,scopes:n,expiry:i,limits:a}=e,o=e.signature?eu(e.signature):void 0,s=(()=>{switch(e.type){case"secp256k1":return"0x";case"p256":return"0x01";case"webAuthn":return"0x02";default:throw Error(`Invalid key type: ${e.type}`)}})(),u=a?.map(e=>{let t=[e.token,e$(e.limit)];return e.period&&e.period>0&&t.push(eM(e.period)),t}),f=(()=>{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([eD(t.selector),t.recipients??[]])}return[...e.entries()].map(([e,t])=>[e,t.map(([e,t])=>[e,t])])})();return[[e$(r),s,t,null!=i&&0!==i||u||f?eM(i??0):void 0,u||f?u??[]:void 0,f].filter(e=>void 0!==e),...o?[o]:[]]}function e$(e){return 0n===e?"0x":i.fromNumber(e)}function eM(e){return 0===e?"0x":i.fromNumber(e)}function eW(e){return"0x"===e?0:i.toNumber(e)}function eD(e){if(e)return e.startsWith("0x")?e:eN.getSelector(e)}e.s(["deserialize",0,function(e){return eR(eK.toHex(e))},"from",0,eH,"fromRpc",0,eC,"fromTuple",0,eR,"getSignPayload",0,function(e){return eG(e)},"hash",0,eG,"serialize",0,function(e){let t=ej(e);return eK.fromHex(t)},"toRpc",0,eO,"toTuple",0,ej],413974);var eV=e.i(413974),eV=eV,ey=ey;async function eq(e,t){var r;let{chainId:n,key:i,expiry:o,limits:s,scopes:u}=t,{accessKeyAddress:f,keyType:c}="accessKeyAddress"in(r=i)?{accessKeyAddress:r.accessKeyAddress,keyType:r.keyType}:"publicKey"in r&&r.publicKey?{accessKeyAddress:a.fromPublicKey(B.fromHex(r.publicKey)),keyType:r.type}:{accessKeyAddress:r.address,keyType:r.type},l=await e.sign({hash:eV.getSignPayload({address:f,chainId:n,expiry:o,limits:s,scopes:u,type:c})});return eV.from({address:f,chainId:n,expiry:o,limits:s,scopes:u,signature:ey.from(l),type:c})}let eJ="0xaAAAaaAA00000000000000000000000000000000",e_=["genesis","t0","t1","t1a","t1b","t1c","t2","t3"];var eX=e.i(586651);function eY(e){return{...e,data:(0,eX.encodeFunctionData)(e),to:e.address}}let eZ={0:"secp256k1",1:"p256",2:"webAuthn"}
4,eQ={true:"limited",false:"unlimited"};async function e0(e,t){return e0.inner(eT.sendTransaction,e,t)}async function e2(e,t){return e2.inner(eE.writeContract,e,t)}(r=e0||(e0={})).inner=async function(e,t,r){let{accessKey:n,chainId:i=t.chain?.id,expiry:a,limits:o,scopes:s,...u}=r,f=u.account??t.account;if(!f)throw Error("account is required.");if(!i)throw Error("chainId is required.");let c=(0,eB.parseAccount)(f),l=await eq(c,{chainId:BigInt(i),key:n,expiry:a,limits:o,scopes:s});return await e(t,{...u,keyAuthorization:l})},r.extractEvent=function(e){let[t]=(0,ez.parseEventLogs)({abi:eS,logs:e,eventName:"KeyAuthorized",strict:!0});if(!t)throw Error("`KeyAuthorized` event not found.");return t};var e1=e2||(e2={});async function e5(e,t,r){let{accessKey:n,...i}=r,a=e1.call({accessKey:n});return await e(t,{...i,...a})}async function e6(e,t){return e6.inner(eE.writeContract,e,t)}e1.inner=e5,e1.call=function(e){let{accessKey:t}=e;return eY({address:eJ,abi:eS,functionName:"revokeKey",args:[e9(t)]})},e1.extractEvent=function(e){let[t]=(0,ez.parseEventLogs)({abi:eS,logs:e,eventName:"KeyRevoked",strict:!0});if(!t)throw Error("`KeyRevoked` event not found.");return t};var e3=e6||(e6={});async function e8(e,t,r){let{accessKey:n,token:i,limit:a,...o}=r,s=e3.call({accessKey:n,token:i,limit:a});return await e(t,{...o,...s})}async function e4(e,t){let{account:r=e.account,accessKey:n,...i}=t;if(!r)throw Error("account is required.");let a=(0,eB.parseAccount)(r),o=await (0,eA.readContract)(e,{...i,...e4.call({account:a.address,accessKey:n})});return{address:o.keyId,keyType:eZ[o.signatureType]??"secp256k1",expiry:o.expiry,spendPolicy:eQ[`${o.enforceLimits}`],isRevoked:o.isRevoked}}async function e7(e,t){let{account:r=e.account,accessKey:n,token:i,...a}=t;if(!r)throw Error("account is required.");let o=(0,eB.parseAccount)(r),s=e.chain?.hardfork;if(s&&e_.indexOf(s)<e_.indexOf("t3"))return{remaining:await (0,eA.readContract)(e,{...a,...e7.call({account:o.address,accessKey:n,token:i})}),periodEnd:void 0};let[u,f]=await (0,eA.readContract)(e,{...a,...e7.callWithPeriod({account:o.address,accessKey:n,token:i})});return{remaining:u,periodEnd:f}}function e9(e){return"string"==typeof e?e:e.accessKeyAddress}e3.inner=e8,e3.call=function(e){let{accessKey:t,token:r,limit:n}=e;return eY({address:eJ,abi:eS,functionName:"updateSpendingLimit",args:[e9(t),r,n]})},e3.extractEvent=function(e){let[t]=(0,ez.parseEventLogs)({abi:eS,logs:e,eventName:"SpendingLimitUpdated",strict:!0});if(!t)throw Error("`SpendingLimitUpdated` event not found.");return t},(e4||(e4={})).call=function(e){let{account:t,accessKey:r}=e;return eY({address:eJ,abi:eS,functionName:"getKey",args:[t,e9(r)]})},(n=e7||(e7={})).call=function(e){let{account:t,accessKey:r,token:n}=e;return eY({address:eJ,abi:eS,functionName:"getRemainingLimit",args:[t,e9(r),n]})},n.callWithPeriod=function(e){let{account:t,accessKey:r,token:n}=e;return eY({address:eJ,abi:eS,functionName:"getRemainingLimitWithPeriod",args:[t,e9(r),n]})};var te=e.i(211285);let tt={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"},tr={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function tn(e){let{address:t,chainId:r,nonce:n}=e,i=eo(e.signature);return{address:t,chainId:Number(r),nonce:BigInt(n),signature:i}}function ti(e){return e.map(e=>tn(e))}function ta(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:ef(a)}})(e))}let to={...tt,tempo:"0x76"},ts={...tr,"0x76":"tempo"};e.s(["fromRpc",0,function(e,t={}){if(!e)return null;let r=function(e,t={}){if(!e)return null;let r=E.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=BigInt(e.value??0n),e.authorizationList&&(n.authorizationList=te.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=tr[e.type]??e.type),r&&(n.v=E.yParityToV(r.yParity)),n}(e);return r.type=ts[e.type],e.aaAuthorizationList&&(r.authorizationList=ti(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"}
4))),e.feeToken&&(r.feeToken=e.feeToken),e.nonceKey&&(r.nonceKey=BigInt(e.nonceKey)),e.signature&&(r.signature=eo(e.signature)),e.validAfter&&(r.validAfter=Number(e.validAfter)),e.validBefore&&(r.validBefore=Number(e.validBefore)),e.keyAuthorization&&(r.keyAuthorization=eC(e.keyAuthorization)),e.feePayerSignature&&(r.feePayerSignature=E.fromRpc(e.feePayerSignature),r.feePayerSignature.v=E.yParityToV(r.feePayerSignature.yParity)),r},"fromRpcType",0,ts,"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=tt[e.type]??e.type,r.value=i.fromNumber(e.value??0n),e.accessList&&(r.accessList=e.accessList),e.authorizationList&&(r.authorizationList=te.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=to[e.type],e.authorizationList&&(n.aaAuthorizationList=ta(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=eO(e.keyAuthorization)),e.feePayerSignature&&(n.feePayerSignature=E.toRpc(e.feePayerSignature),n.feePayerSignature.v=i.fromNumber(E.yParityToV(e.feePayerSignature?.yParity))),e.signature&&(n.signature=ef(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,to],424436);var tu=e.i(424436),tu=tu;function tf(e){if("string"==typeof e){let t=eL(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=te.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=tr[r.type]||r.type),void 0!==r.value&&(r.value=i.toBigInt(r.value)),r);return void 0!==e.type&&(n.type=ts[e.type]||n.type),e.authorizationList&&(n.authorizationList=ti(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})),void 0!==e.feeToken&&(n.feeToken=e.feeToken),e.keyAuthorization&&(n.keyAuthorization=eC(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=te.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
4=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=tt[t.type]||t.type),void 0!==t.value&&(r.value=i.fromNumber(t.value)),r);e.authorizationList&&(n.authorizationList=ta(e.authorizationList)),e.calls?n.calls=e.calls.map(e=>({to:e.to?eL(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?eL(e.to):void 0,value:e.value?i.fromNumber(e.value):"0x",data:e.data??"0x"}]),void 0!==e.feeToken&&(n.feeToken=tf(e.feeToken)),e.keyAuthorization&&(n.keyAuthorization=eO(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=to.tempo,delete n.data,delete n.input,delete n.to,delete n.value),n}],392870);var tc=e.i(392870),tc=tc,ey=ey,tl=o;class td extends tl.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 tp=o,ty=o;let tm={wei:0,gwei:9,szabo:12,finney:15,ether:18};function tb(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,tm.gwei-tm[t])}o.BaseError;class tg extends ty.BaseError{constructor({feeCap:e}={}){super(`The fee cap (\`maxFeePerGas\`/\`maxPriorityFeePerGas\`${e?` = ${tb(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"})}}ty.BaseError;class th extends ty.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 tv extends ty.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 tx extends ty.BaseError{constructor({maxPriorityFeePerGas:e,maxFeePerGas:t}={}){super(`The provided tip (\`maxPriorityFeePerGas\`${e?` = ${tb(e)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${t?` = ${tb(t)} gwei`:""}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.TipAboveFeeCapError"})}}let tw="0x78",tP="0x76",tk="tempo";function tI(e){let{calls:t,chainId:r,maxFeePerGas:n,maxPriorityFeePerGas:i,validBefore:o,validAfter:s}=e;if(!t||0===t.length)throw new tN;if("number"==typeof o&&"number"==typeof s&&o<=s)throw new tK({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 tg({feeCap:n});if(i&&n&&i>n)throw new tx({maxFeePerGas:n,maxPriorityFeePerGas:i})}function tB(e){let t=eK.toHex(i.slice(e,1)),[r,n,o,s,u,f,c,l,d,p,y,m,b,g,h]=t,v=Array.isArray(g)?g:void 0,x=v?h:g;if(13!==t.length&&14!==t.length&&15!==t.length)throw new tv({attributes:{authorizationList:b,chainId:r,maxPriorityFeePerGas:n,maxFeePerGas:o,gas:s,calls:u,accessList:f,keyAuthorization:v,nonceKey:c,nonce:l,validBefore:d,validAfter:p,feeToken:y,feePayerSignatureOrSender:m,...t.length>12?{signature:x}:{}},serialized:e,type:tk});let w={chainId:Number(r),type:tk};i.validate(s)&&"0x"!==s&&(w.gas=BigInt(s)),i.validate(l)&&(w.nonce="0x"===l?0n:BigInt(l)),i.validate(o)&&"0x"!==o&&(w.maxFeePerGas=BigInt(o)),i.validate(n)&&"0x"!==n&&(w.maxPriorityFeePerGas=BigInt(n)),i.validate(c)&&(w.nonceKey="0x"===c?0n:BigInt(c)),i.validate(d)&&"0x"!==d&&(w.validBefore=Number(d)),i.validate(p)&&"0x"!==p&&(w.validAfter=Number(p)),i.validate(y)&&"0x"!==y&&(w.feeToken=y),u&&"0x"!==u&&(w.calls=u.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})),f?.length!==0&&"0x"!==f&&(w.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=>N.validate(e)?e:i.trimLeft(e))})}return t}(f)),b?.length!==0&&"0x"!==b&&(w.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=ei(i)),function(e,t={}){if("string"==typeof e.chainId)return tn(e);let r={...e,address:eL(e.address)};return t.signature?{...r,signature:t.signature}:r}(a)}(r));return t}(b)),"0x"!==m&&void 0!==m&&("0x00"===m||a.validate(m)?(w.feePayerSignature=null,a.validate(m)&&(w.from=m)):w.feePayerSignature=E.fromTuple(m)),v&&(w.keyAuthorization=eR(v));let P=x?ei(x):void 0;if(P&&(w={...w,signature:P}),!w.from&&P)try{w.from=er({payload:tz(tA(w)),signature:P,root:!0})}catch{}return tI(w),w}function tA(e,t={}){let{feePayerSignature:r,signature:n}=t,i="string"==typeof e?tB(e):e;return i.from&&(i.from=eL(i.from)),i.calls&&(i.calls=i.calls.map(e=>({...e,...e.to?{to:eL(e.to)}:{}}))),tI(i),{...i,...n?{signature:ea(n)}:{},...r?{feePayerSignature:E.from(r)}:{},type:"tempo"}}function tT(e,t={}){let{accessList:r,authorizationList:n,calls:o,chainId:s,feeToken:u,gas:f,keyAuthorization:c,nonce:l,nonceKey:d,maxFeePerGas:p,maxPriorityFeePerGas:y,validBefore:m,validAfter:b}=e;tI(e);let g=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 td({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?eu(e.signature):void 0;return[r?i.fromNumber(r):"0x",t,n?i.fromNumber(n):"0x",...a?[a]:[]]}(r));return t}(n),x=o.map(e=>[e.to?eL(e.to):"0x",e.value?i.fromNumber(e.value):"0x",e.data??"0x"]),w=!1,P=(()=>
4{if(t.sender)return t.sender;if("feePayer"===t.format&&h){let t=ea(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 T.recoverAddress({payload:tz(tA(e)),signature:t.signature})}let r=void 0!==t.feePayerSignature?t.feePayerSignature:e.feePayerSignature;return null===r?(w=!0,"0x00"):r?E.toTuple(r):"0x"})(),k=[i.fromNumber(s),y?i.fromNumber(y):"0x",p?i.fromNumber(p):"0x",f?i.fromNumber(f):"0x",x,g,d?i.fromNumber(d):"0x",l?i.fromNumber(l):"0x","number"==typeof m?i.fromNumber(m):"0x","number"==typeof b?i.fromNumber(b):"0x",w||"bigint"!=typeof u&&"string"!=typeof u?"0x":tf(u),P,v,...c?[ej(c)]:[],...h?[eu(ea(h))]:[]];return i.concat("feePayer"===t.format?tw:tP,eK.fromHex(k))}function tE(e){return tT({...e,signature:void 0,...void 0!==e.feePayerSignature?{feePayerSignature:null}:{}})}function tz(e,t={}){let r=tS(e,{presign:!0});return t.from?N.keccak256(i.concat("0x04",r,eL(t.from))):r}function tS(e,t={}){let r=t.presign?tE(e):tT(e);return N.keccak256(r)}class tN extends tp.BaseError{constructor(){super("Calls list cannot be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TxEnvelopeTempo.CallsEmptyError"})}}class tK extends tp.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,tN,"InvalidValidityWindowError",0,tK,"assert",0,tI,"deserialize",0,tB,"encodeForSigning",0,tE,"feePayerMagic",0,tw,"from",0,tA,"getFeePayerSignPayload",0,function(e,t){let r=eL(t.sender),n=tT({...e,signature:void 0},{sender:r,format:"feePayer"});return N.keccak256(n)},"getSignPayload",0,tz,"hash",0,tS,"serialize",0,tT,"serializedType",0,tP,"type",0,tk,"validate",0,function(e){try{return tI(e),!0}catch{return!1}}],508285);var tU=e.i(508285),tU=tU,tL=e.i(987982),tF=e.i(492344);function tH(e){let t=e.account;return t?.keyType&&"secp256k1"!==t.keyType||t?.source==="accessKey"||void 0!==e.calls||void 0!==e.feePayer||void 0!==e.feeToken||void 0!==e.ke
4yAuthorization||void 0!==e.nonceKey||void 0!==e.signature||void 0!==e.validBefore||void 0!==e.validAfter?"tempo":e.type?e.type:(0,tL.getTransactionType)(e)}function tC(e){try{let t=tH(e);return"tempo"===t}catch{return!1}}async function tR(e,t){if(!tC(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,tF.serializeTransaction)(e,{r:i.fromNumber(r,{size:32}),s:i.fromNumber(n,{size:32}),yParity:a})}return(0,tF.serializeTransaction)(e,t)}if("tempo"===tH(e))return tG(e,t);throw Error("Unsupported transaction type")}async function tG(e,t){let r,n=e.signature?e.signature:t&&"type"in t?t:t?ey.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,c=!0===a&&(!n||!u)||!n&&f,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)}:{}};if(c&&delete l.feeToken,n&&"object"==typeof e.feePayer){let t=tU.from(l,{signature:n}),r=(()=>{if(e.from)return e.from;if("secp256k1"===n.type)return T.recoverAddress({payload:tU.getSignPayload(t),signature:n.signature});throw Error("Unable to extract sender from transaction or signature.")})(),i=tU.getFeePayerSignPayload(t,{sender:r}),a=await e.feePayer.sign({hash:i});return tU.serialize(t,{feePayerSignature:E.from(a)})}return!0===a||!n&&f?n&&u?tU.serialize(l,{signature:n}):n?tU.serialize(l,{format:"feePayer",sender:e.from,signature:n}):tU.serialize(l,{feePayerSignature:null}):tU.serialize({...l,...a&&!u?{feeToken:void 0}:{}},{feePayerSignature:void 0,signature:n})}function tO(e){if(!e)return e;let t=(e.length-2)/2;return t<=4?e:i.fromNumber(t,{size:2})}let tj=new Map;async function t$(e){tj.set(e,(tj.get(e)??0)+1),await Promise.resolve();let t=(tj.get(e)??0)>1;return queueMicrotask(()=>{let t=tj.get(e)??0;t<=1?tj.delete(e):tj.set(e,t-1)}),t}let tM={blockTime:1e3,extendSchema:(0,ev.extendSchema)(),formatters:{transaction:(0,ex.defineTransaction)({exclude:["aaAuthorizationList"],format:function(e){if(!tC(e))return(0,ex.formatTransaction)(e);let t=null==e.blockTimestamp?void 0:BigInt(e.blockTimestamp),{feePayerSignature:r,gasPrice:n,nonce:a,...o}=tu.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:tu.toRpcType[o.type],type:o.type}}}),transactionReceipt:(0,ew.defineTransactionReceipt)({format:function(e){return(0,ew.formatTransactionReceipt)(e)}}),transactionRequest:(0,eP.defineTransactionRequest)({format:function(e,t){let r,n=e.account?(0,eB.parseAccount)(e.account):void 0;if(!tC(e))return(0,eP.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 i=tc.toRpc({...e,type:"tempo"});"estimateGas"===t&&(i.maxFeePerGas=void 0,i.maxPriorityFeePerGas=void 0),i.to=void 0,i.data=void 0,i.value=void 0;let[a,o]=(r=n&&"keyType"in n?n.keyType:n?.source)?"webAuthn"===r?["webAuthn","0x0578"]:["p256","secp256k1"].includes(r)?[r,void 0]:[e.keyType,tO(e.keyData)]:[e.keyType,tO(e.keyData)],s=n&&"accessKeyAddress"in n?n.accessKeyAddress:e.keyId;return n&&(i.from=n.address),{...i,...e.capabilities?{capabilities:e.capabilities}:{},...o?{keyData:o}:{},...s?{keyId:s}:{},...a?{keyType:a}:{},...void 0!==e.feePayer?{feePayer:"object"==typeof e.feePayer?(0,eB.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;
4if(!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,ek.getAction)(t,e4,"getMetadata")({account:i,accessKey:a});(0,eh.isAddressEqual)(u.address,a)&&!u.isRevoked&&u.expiry>n?await r.remove(o):e.keyAuthorization=s}}}}}return await (async()=>{if("expiring"===e.nonceKey||e.feePayer&&void 0===e.nonceKey)return!0;let t=e.account?.address;return!!t&&void 0===e.nonceKey&&await t$(t)})()?(e.nonceKey=eg.maxUint256,e.nonce=0,void 0===e.validBefore&&(e.validBefore=Math.floor(Date.now()/1e3)+25)):void 0!==e.nonceKey&&(e.nonce="number"==typeof e.nonce?e.nonce:0),!e.feeToken&&e.chain?.feeToken&&(e.feeToken=e.chain.feeToken),e},{runAt:["beforeFillTransaction","afterFillParameters"]}],serializers:{transaction:(e,t)=>tR(e,t)},async verifyHash(e,t){let{address:r,hash:n,signature:a,mode:o}=t,s=(()=>{if("string"==typeof a)try{return ey.deserialize(a)}catch{return}})();if(s){if(s?.type==="keychain"&&"allowAccessKey"===o){let a="v2"===s.version?(0,eI.keccak256)(i.concat("0x04",n,r)):n,o=(()=>{try{return ey.extractAddress({payload:a,signature:s.inner})}catch{return}})();if(!o)return!1;let u=await e4(e,{account:r,accessKey:o,blockNumber:t.blockNumber,blockTag:t.blockTag});return!(u.isRevoked||u.expiry<=BigInt(Math.floor(Date.now()/1e3)))&&ey.verify(s.inner,{address:o,payload:a})}if("p256"===s.type||"webAuthn"===s.type){let i=await (0,em.getCode)(e,{address:r,blockNumber:t.blockNumber,blockTag:t.blockTag});if(!i||"0xef01007702c00000000000000000000000000000000000"===i)return ey.verify(s,{address:r,payload:n})}}return await (0,ek.getAction)(e,eb.verifyHash,"verifyHash")({...t,chain:null})}};e.s(["chainConfig",0,tM],829378);let tW=(0,ev.defineChain)({...tM,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,tW],176842)}]); 5 6//# debugId=4a648866-8d9b-ef93-387a-3526a8ed14dd
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.