@revibase/transaction-manager 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';var core=require('@revibase/core'),sha2_js=require('@noble/hashes/sha2.js'),server=require('@simplewebauthn/server'),jose=require('jose'),jsonCanonicalize=require('json-canonicalize');require('@noble/hashes/utils.js');var pn=1,hn=2,Ln=3,Mn=4,yn=5,Un=6,bn=7,vn=8,wn=9,Bn=10,Pn=-32700,Fn=-32603,xn=-32602,zn=-32601,kn=-32600,Vn=-32019,Wn=-32018,Gn=-32017,Hn=-32016,Kn=-32015,$n=-32014,Yn=-32013,Xn=-32012,jn=-32011,qn=-32010,Zn=-32009,Jn=-32008,Qn=-32007,er=-32006,tr=-32005,nr=-32004,rr=-32003,or=-32002,ar=-32001,ee=28e5,te=2800001,ir=2800002,qe=2800003,Ze=2800004,Je=2800005,Qe=2800006,et=2800007,tt=2800008,nt=2800009,rt=2800010,ot=2800011,at=323e4,ne=32300001,it=3230002,st=3230003,re=3230004,sr=361e4,cr=3610001,ur=3610002,dr=3610003,_r=3610004,Ar=3610005,lr=3610006,Ir=3610007,Er=3611e3,Rr=3704e3,gr=3704001,Tr=3704002,fr=3704003,Sr=3704004,Nr=4128e3,Dr=4128001,Or=4128002,mr=4615e3,Cr=4615001,pr=4615002,hr=4615003,Lr=4615004,Mr=4615005,yr=4615006,Ur=4615007,br=4615008,vr=4615009,wr=4615010,Br=4615011,Pr=4615012,Fr=4615013,xr=4615014,zr=4615015,kr=4615016,Vr=4615017,Wr=4615018,Gr=4615019,Hr=4615020,Kr=4615021,$r=4615022,Yr=4615023,Xr=4615024,jr=4615025,qr=4615026,Zr=4615027,Jr=4615028,Qr=4615029,eo=4615030,to=4615031,no=4615032,ro=4615033,oo=4615034,ao=4615035,io=4615036,so=4615037,co=4615038,uo=4615039,_o=4615040,Ao=4615041,lo=4615042,Io=4615043,Eo=4615044,Ro=4615045,go=4615046,To=4615047,fo=4615048,So=4615049,No=4615050,Do=4615051,Oo=4615052,mo=4615053,Co=4615054,po=5508e3,ho=5508001,Lo=5508002,Mo=5508003,yo=5508004,Uo=5508005,bo=5508006,vo=5508007,wo=5508008,Bo=5508009,Po=5508010,Fo=5508011,ct=5663e3,ut=5663001,oe=5663002,ae=5663003,dt=5663004,ie=5663005,se=5663006,ce=5663007,ue=5663008,_t=5663009,xo=5663010,zo=5663011,At=5663012,ko=5663013,Vo=5663014,lt=5663015,It=5663016,de=5663017,Wo=5663018,Go=5663019,Et=5663020,_e=5663021,Rt=5663022,Ho=705e4,Ko=7050001,$o=7050002,Yo=7050003,Xo=7050004,jo=7050005,qo=7050006,Zo=7050007,Jo=7050008,Qo=7050009,ea=7050010,ta=7050011,na=7050012,ra=7050013,oa=7050014,aa=7050015,ia=7050016,sa=7050017,ca=7050018,ua=7050019,da=7050020,_a=7050021,Aa=7050022,la=7050023,Ia=7050024,Ea=7050025,Ra=7050026,ga=7050027,Ta=7050028,fa=7050029,Sa=7050030,Na=7050031,Da=7050032,Oa=7050033,ma=7050034,Ca=7050035,pa=7050036,ha=7618e3,La=7618001,Ma=7618002,ya=7618003,Ae=8078e3,le=8078001,gt=8078002,Tt=8078003,ft=8078004,St=8078005,Nt=8078006,Ua=8078007,ba=8078008,va=8078009,wa=8078010,Ie=8078011,W=8078012,Ee=8078013,Re=8078014,Ba=8078015,Pa=8078016,Fa=8078017,xa=8078018,za=8078019,Dt=8078020,Ot=8078021,ka=8078022,mt=8078023,Va=81e5,Wa=8100001,Ga=8100002,Ha=8100003,Ka=819e4,$a=8190001,Ya=8190002,Xa=8190003,ja=8190004,qa=99e5,Za=9900001,Ja=9900002,Qa=9900003,ei=9900004,ti=9900005,ni=9900006;function Ct(e){return Array.isArray(e)?"%5B"+e.map(Ct).join("%2C%20")+"%5D":typeof e=="bigint"?`${e}n`:encodeURIComponent(String(e!=null&&Object.getPrototypeOf(e)===null?{...e}:e))}function ri([e,t]){return `${e}=${Ct(t)}`}function oi(e){let t=Object.entries(e).map(ri).join("&");return Buffer.from(t,"utf8").toString("base64")}var ai={[at]:"Account not found at address: $address",[re]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[st]:"Expected decoded account at address: $address",[it]:"Failed to decode account data at address: $address",[ne]:"Accounts not found at addresses: $addresses",[nt]:"Unable to find a viable program address bump seed.",[ir]:"$putativeAddress is not a base58-encoded address.",[ee]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[qe]:"The `CryptoKey` must be an `Ed25519` public key.",[ot]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[tt]:"Invalid seeds; point must fall off the Ed25519 curve.",[Ze]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[Qe]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[et]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[Je]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[rt]:"Program address cannot end with PDA marker.",[te]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[Mn]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[pn]:"The network has progressed past the last block for which this transaction could have been committed.",[Ae]:"Codec [$codecDescription] cannot decode empty byte arrays.",[ka]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[Dt]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[St]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[Nt]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[ft]:"Encoder and decoder must either both be fixed-size or variable-size.",[ba]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[gt]:"Expected a fixed-size codec, got a variable-size one.",[Ee]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[Tt]:"Expected a variable-size codec, got a fixed-size one.",[za]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[le]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[xa]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[va]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[wa]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[Ba]:"Invalid literal union variant. Expected one of [$variants], got $value.",[Ua]:"Expected [$codecDescription] to have $expected items, got $actual.",[W]:"Invalid value $value for base $base with alphabet $alphabet.",[Pa]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[Ie]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[Re]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[Ot]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[Fa]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[mt]:"This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",[Er]:"No random values implementation could be found.",[vr]:"instruction requires an uninitialized account",[Yr]:"instruction tries to borrow reference for an account which is already borrowed",[Xr]:"instruction left account with an outstanding borrowed reference",[Kr]:"program other than the account's owner changed the size of the account data",[Mr]:"account data too small for instruction",[$r]:"instruction expected an executable account",[go]:"An account does not have enough lamports to be rent-exempt",[fo]:"Program arithmetic overflowed",[Ro]:"Failed to serialize or deserialize account data: $encodedData",[Co]:"Builtin programs must consume compute units",[no]:"Cross-program invocation call depth too deep",[co]:"Computational budget exceeded",[qr]:"custom program error: #$code",[Vr]:"instruction contains duplicate accounts",[jr]:"instruction modifications of multiply-passed account differ",[eo]:"executable accounts must be rent exempt",[Jr]:"instruction changed executable accounts data",[Qr]:"instruction changed the balance of an executable account",[Wr]:"instruction changed executable bit of an account",[xr]:"instruction modified data of an account it does not own",[Fr]:"instruction spent from the balance of an account it does not own",[Cr]:"generic instruction error",[No]:"Provided owner is not allowed",[Io]:"Account is immutable",[Eo]:"Incorrect authority provided",[Ur]:"incorrect program id for instruction",[yr]:"insufficient funds for instruction",[Lr]:"invalid account data for instruction",[To]:"Invalid account owner",[pr]:"invalid program argument",[Zr]:"program returned invalid error code",[hr]:"invalid instruction data",[so]:"Failed to reallocate account data",[io]:"Provided seeds do not result in a valid address",[Do]:"Accounts data allocations exceeded the maximum allowed per transaction",[Oo]:"Max accounts exceeded",[mo]:"Max instruction trace length exceeded",[ao]:"Length of the seed is too long for address generation",[ro]:"An account required by the instruction is missing",[br]:"missing required signature for instruction",[Pr]:"instruction illegally modified the program id of an account",[Hr]:"insufficient account keys for instruction",[uo]:"Cross-program invocation with unauthorized signer or writable account",[_o]:"Failed to create program execution environment",[lo]:"Program failed to compile",[Ao]:"Program failed to complete",[kr]:"instruction modified data of a read-only account",[zr]:"instruction changed the balance of a read-only account",[oo]:"Cross-program invocation reentrancy not allowed for this instruction",[Gr]:"instruction modified rent epoch of an account",[Br]:"sum of account balances before and after instruction do not match",[wr]:"instruction requires an initialized account",[mr]:"",[to]:"Unsupported program id",[So]:"Unsupported sysvar",[ti]:"Invalid instruction plan kind: $kind.",[Ma]:"The provided instruction plan is empty.",[ya]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",[ha]:"The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",[ni]:"Invalid transaction plan kind: $kind.",[La]:"No more instructions to pack; the message packer has completed the instruction plan.",[Nr]:"The instruction does not have any accounts.",[Dr]:"The instruction does not have any data.",[Or]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[yn]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[hn]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[Ja]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[ei]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[Za]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[qa]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Qa]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Fn]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[xn]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[kn]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[zn]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[Pn]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[Xn]:"$__serverMessage",[ar]:"$__serverMessage",[nr]:"$__serverMessage",[$n]:"$__serverMessage",[Gn]:"Epoch rewards period still active at slot $slot",[qn]:"$__serverMessage",[Zn]:"$__serverMessage",[Vn]:"Failed to query long-term storage; please try again",[Hn]:"Minimum context slot has not been reached",[tr]:"Node is unhealthy; behind by $numSlotsBehind slots",[Jn]:"No snapshot",[or]:"Transaction simulation failed",[Wn]:"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",[Qn]:"$__serverMessage",[jn]:"Transaction history is not available from this node",[er]:"$__serverMessage",[Yn]:"Transaction signature length mismatch",[rr]:"Transaction signature verification failure",[Kn]:"$__serverMessage",[Rr]:"Key pair bytes must be of length 64, got $byteLength.",[gr]:"Expected private key bytes with length 32. Actual length: $actualLength.",[Tr]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[Sr]:"The provided private key does not match the provided public key.",[fr]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[Un]:"Lamports value must be in the range [0, 2e64-1]",[bn]:"`$value` cannot be parsed as a `BigInt`",[Bn]:"$message",[vn]:"`$value` cannot be parsed as a `Number`",[Ln]:"No nonce account could be found at address `$nonceAccountAddress`",[Ka]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[Ya]:"WebSocket was closed before payload could be added to the send buffer",[Xa]:"WebSocket connection closed",[ja]:"WebSocket failed to connect",[$a]:"Failed to obtain a subscription id from the server",[Ha]:"Could not find an API plan for RPC method: `$method`",[Va]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[Ga]:"HTTP error ($statusCode): $message",[Wa]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[po]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[ho]:"The provided value does not implement the `KeyPairSigner` interface",[Mo]:"The provided value does not implement the `MessageModifyingSigner` interface",[yo]:"The provided value does not implement the `MessagePartialSigner` interface",[Lo]:"The provided value does not implement any of the `MessageSigner` interfaces",[bo]:"The provided value does not implement the `TransactionModifyingSigner` interface",[vo]:"The provided value does not implement the `TransactionPartialSigner` interface",[wo]:"The provided value does not implement the `TransactionSendingSigner` interface",[Uo]:"The provided value does not implement any of the `TransactionSigner` interfaces",[Bo]:"More than one `TransactionSendingSigner` was identified.",[Po]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[Fo]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[Ir]:"Cannot export a non-extractable key.",[cr]:"No digest implementation could be found.",[sr]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[ur]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
1
|
+
'use strict';var core=require('@revibase/core'),sha2_js=require('@noble/hashes/sha2.js'),server=require('@simplewebauthn/server'),jose=require('jose');require('@noble/hashes/utils.js');var mn=1,Cn=2,pn=3,hn=4,Ln=5,Mn=6,yn=7,Un=8,bn=9,vn=10,wn=-32700,Pn=-32603,Bn=-32602,Fn=-32601,xn=-32600,zn=-32019,kn=-32018,Vn=-32017,Wn=-32016,Gn=-32015,Hn=-32014,Kn=-32013,$n=-32012,Yn=-32011,Xn=-32010,jn=-32009,qn=-32008,Zn=-32007,Jn=-32006,Qn=-32005,er=-32004,tr=-32003,nr=-32002,rr=-32001,ee=28e5,te=2800001,or=2800002,je=2800003,qe=2800004,Ze=2800005,Je=2800006,Qe=2800007,et=2800008,tt=2800009,nt=2800010,rt=2800011,ot=323e4,ne=32300001,at=3230002,it=3230003,re=3230004,ar=361e4,ir=3610001,sr=3610002,cr=3610003,ur=3610004,dr=3610005,_r=3610006,Ar=3610007,lr=3611e3,Ir=3704e3,Er=3704001,Rr=3704002,gr=3704003,Tr=3704004,fr=4128e3,Sr=4128001,Nr=4128002,Dr=4615e3,Or=4615001,mr=4615002,Cr=4615003,pr=4615004,hr=4615005,Lr=4615006,Mr=4615007,yr=4615008,Ur=4615009,br=4615010,vr=4615011,wr=4615012,Pr=4615013,Br=4615014,Fr=4615015,xr=4615016,zr=4615017,kr=4615018,Vr=4615019,Wr=4615020,Gr=4615021,Hr=4615022,Kr=4615023,$r=4615024,Yr=4615025,Xr=4615026,jr=4615027,qr=4615028,Zr=4615029,Jr=4615030,Qr=4615031,eo=4615032,to=4615033,no=4615034,ro=4615035,oo=4615036,ao=4615037,io=4615038,so=4615039,co=4615040,uo=4615041,_o=4615042,Ao=4615043,lo=4615044,Io=4615045,Eo=4615046,Ro=4615047,go=4615048,To=4615049,fo=4615050,So=4615051,No=4615052,Do=4615053,Oo=4615054,mo=5508e3,Co=5508001,po=5508002,ho=5508003,Lo=5508004,Mo=5508005,yo=5508006,Uo=5508007,bo=5508008,vo=5508009,wo=5508010,Po=5508011,st=5663e3,ct=5663001,oe=5663002,ae=5663003,ut=5663004,ie=5663005,se=5663006,ce=5663007,ue=5663008,dt=5663009,Bo=5663010,Fo=5663011,_t=5663012,xo=5663013,zo=5663014,At=5663015,lt=5663016,de=5663017,ko=5663018,Vo=5663019,It=5663020,_e=5663021,Et=5663022,Wo=705e4,Go=7050001,Ho=7050002,Ko=7050003,$o=7050004,Yo=7050005,Xo=7050006,jo=7050007,qo=7050008,Zo=7050009,Jo=7050010,Qo=7050011,ea=7050012,ta=7050013,na=7050014,ra=7050015,oa=7050016,aa=7050017,ia=7050018,sa=7050019,ca=7050020,ua=7050021,da=7050022,_a=7050023,Aa=7050024,la=7050025,Ia=7050026,Ea=7050027,Ra=7050028,ga=7050029,Ta=7050030,fa=7050031,Sa=7050032,Na=7050033,Da=7050034,Oa=7050035,ma=7050036,Ca=7618e3,pa=7618001,ha=7618002,La=7618003,Ae=8078e3,le=8078001,Rt=8078002,gt=8078003,Tt=8078004,ft=8078005,St=8078006,Ma=8078007,ya=8078008,Ua=8078009,ba=8078010,Ie=8078011,W=8078012,Ee=8078013,Re=8078014,va=8078015,wa=8078016,Pa=8078017,Ba=8078018,Fa=8078019,Nt=8078020,Dt=8078021,xa=8078022,Ot=8078023,za=81e5,ka=8100001,Va=8100002,Wa=8100003,Ga=819e4,Ha=8190001,Ka=8190002,$a=8190003,Ya=8190004,Xa=99e5,ja=9900001,qa=9900002,Za=9900003,Ja=9900004,Qa=9900005,ei=9900006;function mt(e){return Array.isArray(e)?"%5B"+e.map(mt).join("%2C%20")+"%5D":typeof e=="bigint"?`${e}n`:encodeURIComponent(String(e!=null&&Object.getPrototypeOf(e)===null?{...e}:e))}function ti([e,t]){return `${e}=${mt(t)}`}function ni(e){let t=Object.entries(e).map(ti).join("&");return Buffer.from(t,"utf8").toString("base64")}var ri={[ot]:"Account not found at address: $address",[re]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[it]:"Expected decoded account at address: $address",[at]:"Failed to decode account data at address: $address",[ne]:"Accounts not found at addresses: $addresses",[tt]:"Unable to find a viable program address bump seed.",[or]:"$putativeAddress is not a base58-encoded address.",[ee]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[je]:"The `CryptoKey` must be an `Ed25519` public key.",[rt]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[et]:"Invalid seeds; point must fall off the Ed25519 curve.",[qe]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[Je]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[Qe]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[Ze]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[nt]:"Program address cannot end with PDA marker.",[te]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[hn]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[mn]:"The network has progressed past the last block for which this transaction could have been committed.",[Ae]:"Codec [$codecDescription] cannot decode empty byte arrays.",[xa]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[Nt]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[ft]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[St]:"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].",[Tt]:"Encoder and decoder must either both be fixed-size or variable-size.",[ya]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[Rt]:"Expected a fixed-size codec, got a variable-size one.",[Ee]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[gt]:"Expected a variable-size codec, got a fixed-size one.",[Fa]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[le]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[Ba]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[Ua]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[ba]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[va]:"Invalid literal union variant. Expected one of [$variants], got $value.",[Ma]:"Expected [$codecDescription] to have $expected items, got $actual.",[W]:"Invalid value $value for base $base with alphabet $alphabet.",[wa]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[Ie]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[Re]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[Dt]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[Pa]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[Ot]:"This decoder expected a byte array of exactly $expectedLength bytes, but $numExcessBytes unexpected excess bytes remained after decoding. Are you sure that you have chosen the correct decoder for this data?",[lr]:"No random values implementation could be found.",[Ur]:"instruction requires an uninitialized account",[Kr]:"instruction tries to borrow reference for an account which is already borrowed",[$r]:"instruction left account with an outstanding borrowed reference",[Gr]:"program other than the account's owner changed the size of the account data",[hr]:"account data too small for instruction",[Hr]:"instruction expected an executable account",[Eo]:"An account does not have enough lamports to be rent-exempt",[go]:"Program arithmetic overflowed",[Io]:"Failed to serialize or deserialize account data: $encodedData",[Oo]:"Builtin programs must consume compute units",[eo]:"Cross-program invocation call depth too deep",[io]:"Computational budget exceeded",[Xr]:"custom program error: #$code",[zr]:"instruction contains duplicate accounts",[Yr]:"instruction modifications of multiply-passed account differ",[Jr]:"executable accounts must be rent exempt",[qr]:"instruction changed executable accounts data",[Zr]:"instruction changed the balance of an executable account",[kr]:"instruction changed executable bit of an account",[Br]:"instruction modified data of an account it does not own",[Pr]:"instruction spent from the balance of an account it does not own",[Or]:"generic instruction error",[fo]:"Provided owner is not allowed",[Ao]:"Account is immutable",[lo]:"Incorrect authority provided",[Mr]:"incorrect program id for instruction",[Lr]:"insufficient funds for instruction",[pr]:"invalid account data for instruction",[Ro]:"Invalid account owner",[mr]:"invalid program argument",[jr]:"program returned invalid error code",[Cr]:"invalid instruction data",[ao]:"Failed to reallocate account data",[oo]:"Provided seeds do not result in a valid address",[So]:"Accounts data allocations exceeded the maximum allowed per transaction",[No]:"Max accounts exceeded",[Do]:"Max instruction trace length exceeded",[ro]:"Length of the seed is too long for address generation",[to]:"An account required by the instruction is missing",[yr]:"missing required signature for instruction",[wr]:"instruction illegally modified the program id of an account",[Wr]:"insufficient account keys for instruction",[so]:"Cross-program invocation with unauthorized signer or writable account",[co]:"Failed to create program execution environment",[_o]:"Program failed to compile",[uo]:"Program failed to complete",[xr]:"instruction modified data of a read-only account",[Fr]:"instruction changed the balance of a read-only account",[no]:"Cross-program invocation reentrancy not allowed for this instruction",[Vr]:"instruction modified rent epoch of an account",[vr]:"sum of account balances before and after instruction do not match",[br]:"instruction requires an initialized account",[Dr]:"",[Qr]:"Unsupported program id",[To]:"Unsupported sysvar",[Qa]:"Invalid instruction plan kind: $kind.",[ha]:"The provided instruction plan is empty.",[La]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",[Ca]:"The provided message has insufficient capacity to accommodate the next instruction(s) in this plan. Expected at least $numBytesRequired free byte(s), got $numFreeBytes byte(s).",[ei]:"Invalid transaction plan kind: $kind.",[pa]:"No more instructions to pack; the message packer has completed the instruction plan.",[fr]:"The instruction does not have any accounts.",[Sr]:"The instruction does not have any data.",[Nr]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[Ln]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[Cn]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[qa]:"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Ja]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[ja]:"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Xa]:"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Za]:"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant",[Pn]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[Bn]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[xn]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[Fn]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[wn]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[$n]:"$__serverMessage",[rr]:"$__serverMessage",[er]:"$__serverMessage",[Hn]:"$__serverMessage",[Vn]:"Epoch rewards period still active at slot $slot",[Xn]:"$__serverMessage",[jn]:"$__serverMessage",[zn]:"Failed to query long-term storage; please try again",[Wn]:"Minimum context slot has not been reached",[Qn]:"Node is unhealthy; behind by $numSlotsBehind slots",[qn]:"No snapshot",[nr]:"Transaction simulation failed",[kn]:"Rewards cannot be found because slot $slot is not the epoch boundary. This may be due to gap in the queried node's local ledger or long-term storage",[Zn]:"$__serverMessage",[Yn]:"Transaction history is not available from this node",[Jn]:"$__serverMessage",[Kn]:"Transaction signature length mismatch",[tr]:"Transaction signature verification failure",[Gn]:"$__serverMessage",[Ir]:"Key pair bytes must be of length 64, got $byteLength.",[Er]:"Expected private key bytes with length 32. Actual length: $actualLength.",[Rr]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[Tr]:"The provided private key does not match the provided public key.",[gr]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[Mn]:"Lamports value must be in the range [0, 2e64-1]",[yn]:"`$value` cannot be parsed as a `BigInt`",[vn]:"$message",[Un]:"`$value` cannot be parsed as a `Number`",[pn]:"No nonce account could be found at address `$nonceAccountAddress`",[Ga]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[Ka]:"WebSocket was closed before payload could be added to the send buffer",[$a]:"WebSocket connection closed",[Ya]:"WebSocket failed to connect",[Ha]:"Failed to obtain a subscription id from the server",[Wa]:"Could not find an API plan for RPC method: `$method`",[za]:"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.",[Va]:"HTTP error ($statusCode): $message",[ka]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[mo]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[Co]:"The provided value does not implement the `KeyPairSigner` interface",[ho]:"The provided value does not implement the `MessageModifyingSigner` interface",[Lo]:"The provided value does not implement the `MessagePartialSigner` interface",[po]:"The provided value does not implement any of the `MessageSigner` interfaces",[yo]:"The provided value does not implement the `TransactionModifyingSigner` interface",[Uo]:"The provided value does not implement the `TransactionPartialSigner` interface",[bo]:"The provided value does not implement the `TransactionSendingSigner` interface",[Mo]:"The provided value does not implement any of the `TransactionSigner` interfaces",[vo]:"More than one `TransactionSendingSigner` was identified.",[wo]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[Po]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[Ar]:"Cannot export a non-extractable key.",[ir]:"No digest implementation could be found.",[ar]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[sr]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
2
2
|
|
|
3
3
|
Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
|
|
4
4
|
|
|
5
|
-
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[dr]:"No signature verification implementation could be found.",[_r]:"No key generation implementation could be found.",[Ar]:"No signing implementation could be found.",[lr]:"No key export implementation could be found.",[wn]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[ia]:"Transaction processing left an account with an outstanding borrowed reference",[Ko]:"Account in use",[$o]:"Account loaded twice",[Yo]:"Attempt to debit an account but found no record of a prior credit.",[la]:"Transaction loads an address table account that doesn't exist",[Zo]:"This transaction has already been processed",[Jo]:"Blockhash not found",[Qo]:"Loader call chain is too deep",[aa]:"Transactions are currently disabled due to cluster maintenance",[Sa]:"Transaction contains a duplicate instruction ($index) that is not allowed",[jo]:"Insufficient funds for fee",[Na]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[qo]:"This account may not be used to pay transaction fees",[ta]:"Transaction contains an invalid account reference",[Ea]:"Transaction loads an address table account with invalid data",[Ra]:"Transaction address table lookup uses an invalid index",[Ia]:"Transaction loads an address table account with an invalid owner",[Oa]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[ra]:"This program may not be used for executing instructions",[ga]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[ua]:"Transaction loads a writable account that cannot be written",[Da]:"Transaction exceeded max loaded accounts data size cap",[ea]:"Transaction requires a fee but has no signature present",[Xo]:"Attempt to load a program that does not exist",[Ca]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[ma]:"ResanitizationNeeded",[oa]:"Transaction failed to sanitize accounts offsets correctly",[na]:"Transaction did not pass signature verification",[Aa]:"Transaction locked too many accounts",[pa]:"Sum of account balances before and after transaction do not match",[Ho]:"The transaction failed with the error `$errorName`",[ca]:"Transaction version is unsupported",[_a]:"Transaction would exceed account data limit within the block",[fa]:"Transaction would exceed total account data limit",[da]:"Transaction would exceed max account limit within the block",[sa]:"Transaction would exceed max Block Cost Limit",[Ta]:"Transaction would exceed max Vote Cost Limit",[lt]:"Attempted to sign a transaction with an address that is not a signer for it",[xo]:"Transaction is missing an address at index: $index.",[It]:"Transaction has no expected signers therefore it cannot be encoded",[Et]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[oe]:"Transaction does not have a blockhash lifetime",[ae]:"Transaction is not a durable nonce transaction",[ie]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[se]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[ue]:"No fee payer set in CompiledTransaction",[ce]:"Could not find program address at index $index",[Wo]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[Go]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[zo]:"Transaction is missing a fee payer.",[At]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[Vo]:"Transaction first instruction is not advance nonce account instruction.",[ko]:"Transaction with no instructions cannot be durable nonce transaction.",[ct]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[ut]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[de]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[_t]:"Transaction is missing signatures for addresses: $addresses.",[dt]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[_e]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[Rt]:"The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction."},D="i",S="t";function ii(e,t={}){let n=ai[e];if(n.length===0)return "";let r;function o(a){if(r[S]===2){let s=n.slice(r[D]+1,a);i.push(s in t?`${t[s]}`:`$${s}`);}else r[S]===1&&i.push(n.slice(r[D],a));}let i=[];return n.split("").forEach((a,s)=>{if(s===0){r={[D]:0,[S]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let c;switch(r[S]){case 0:c={[D]:s,[S]:1};break;case 1:a==="\\"?c={[D]:s,[S]:0}:a==="$"&&(c={[D]:s,[S]:2});break;case 2:a==="\\"?c={[D]:s,[S]:0}:a==="$"?c={[D]:s,[S]:2}:a.match(/\w/)||(c={[D]:s,[S]:1});break}c&&(r!==c&&o(s),r=c);}),o(),i.join("")}function si(e,t={}){if(process.env.NODE_ENV!=="production")return ii(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${oi(t)}'`),`${n}\``}}var l=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([i,a])=>{i==="cause"?r={cause:a.value}:(n===void 0&&(n={}),Object.defineProperty(n,i,a));});let o=si(e,n);super(o,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function ci(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var ui=(e,t)=>ci(e.length<=t?e:e.slice(0,t),t);function g(e,t,n){let r=e.length===t.length?e:e.slice(n,n+t.length);return r.length!==t.length?false:t.every((o,i)=>o===r[i])}function ht(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function p(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(ht(t,e));return e.write(t,n,0),n}})}function I(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function O(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function Lt(e,t,n=0){if(t.length-n<=0)throw new l(Ae,{codecDescription:e})}function F(e,t,n,r=0){let o=n.length-r;if(o<t)throw new l(le,{bytesLength:o,codecDescription:e,expected:t})}function pt(e,t,n){if(t<0||t>n)throw new l(Re,{bytesLength:n,codecDescription:e,offset:t})}function ge(e,t){let n=(a,s)=>{let[c,u]=t.read(a,s),_=Number(c);return s=u,(s>0||a.length>_)&&(a=a.slice(s,s+_)),F("addDecoderSizePrefix",_,a),[e.decode(a),s+_]};if(O(t)&&O(e))return I({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});let r=O(t)?t.fixedSize:t.maxSize??null,o=O(e)?e.fixedSize:e.maxSize??null,i=r!==null&&o!==null?r+o:null;return I({...e,...i!==null?{maxSize:i}:{},read:n})}function y(e,t){return I({fixedSize:t,read:(n,r)=>{F("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),O(e)&&(n=ui(n,e.fixedSize));let[o]=e.read(n,0);return [o,r+t]}})}function di(e,t){return I({...e,read:(n,r)=>{let o=u=>_i(u,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;pt("offsetDecoder",i,n.length);let[a,s]=e.read(n,i),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:i,postOffset:s,preOffset:r,wrapBytes:o}):s;return pt("offsetDecoder",c,n.length),[a,c]}})}function _i(e,t){return t===0?0:(e%t+t)%t}function Ai(e,t){if(O(e)){let n=t(e.fixedSize);if(n<0)throw new l(Ee,{bytesLength:n,codecDescription:"resizeDecoder"});return I({...e,fixedSize:n})}return e}function Mt(e,t){return di(Ai(e,n=>n+t),{postOffset:({postOffset:n})=>n+t})}function b(e,t){return I({...e,read:(n,r)=>{let[o,i]=e.read(n,r);return [t(o,n,r),i]}})}function vt(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new l(W,{alphabet:e,base:e.length,value:n})}var li=e=>p({getSizeFromValue:t=>{let[n,r]=yt(t,e[0]);if(!r)return t.length;let o=Ut(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(vt(e,t),t==="")return r;let[o,i]=yt(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=Ut(i,e),s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;let c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),Ii=e=>I({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let i=e[0].repeat(o);if(o===r.length)return [i,t.length];let a=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=Ei(a,e);return [i+s,t.length]}});function yt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Ut(e,t){let n=BigInt(t.length),r=0n;for(let o of e)r*=n,r+=BigInt(t.indexOf(o));return r}function Ei(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var wt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Te=()=>li(wt),Bt=()=>Ii(wt);var Ri="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=()=>p({getSizeFromValue:e=>Buffer.from(e,"base64").length,write(e,t,n){vt(Ri,e.replace(/=/g,""));let r=Buffer.from(e,"base64");return t.set(r,n),r.length+n}});var gi=e=>e.replace(/\u0000/g,"");var Ti=globalThis.TextDecoder,bt=globalThis.TextEncoder,fe=()=>{let e;return p({getSizeFromValue:t=>(e||=new bt).encode(t).length,write:(t,n,r)=>{let o=(e||=new bt).encode(t);return n.set(o,r),r+o.length}})},Se=()=>{let e;return I({read(t,n){let r=(e||=new Ti).decode(t.slice(n));return [gi(r),t.length]}})};function fi(e){return !("exists"in e)||"exists"in e&&e.exists}function Pt(e){let t=e.filter(n=>fi(n)&&n.data instanceof Uint8Array);if(t.length>0){let n=t.map(r=>r.address);throw new l(re,{addresses:n})}}function Si(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=w().encode(t.data[0]);return Object.freeze({...Ft(t),address:e,data:n,exists:true})}function Ni(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=t.data.parsed.info;return Object.freeze({...Ft(t),address:e,data:n,exists:true})}function Ft(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function xt(e,t,n={}){let{abortSignal:r,...o}=n;return (await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map((a,s)=>a&&typeof a=="object"&&"parsed"in a.data?Ni(t[s],a):Si(t[s],a))}function Ne(e){let t=e.filter(n=>!n.exists);if(t.length>0){let n=t.map(r=>r.address);throw new l(ne,{addresses:n})}}var De,Oe;function Di(){return De||(De=Te()),De}function Oi(){return Oe||(Oe=Bt()),Oe}function H(e){if(e.length<32||e.length>44)throw new l(te,{actualLength:e.length});let r=Di().encode(e).byteLength;if(r!==32)throw new l(ee,{actualLength:r})}function B(e){return H(e),e}function P(){return y(Oi(),32)}function mi(e,t,n,r){if(r<t||r>n)throw new l(Ie,{codecDescription:e,max:n,min:t,value:r})}function zt(e){return e?.endian!==1}function Ci(e){return p({fixedSize:e.size,write(t,n,r){e.range&&mi(e.name,e.range[0],e.range[1],t);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,zt(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function kt(e){return I({fixedSize:e.size,read(t,n=0){Lt(e.name,t,n),F(e.name,e.size,t,n);let r=new DataView(pi(t,n,e.size));return [e.get(r,zt(e.config)),n+e.size]}})}function pi(e,t,n){let r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}var N=()=>I({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){let o=r-1,i=e[t+o],a=127&i;if(n|=a<<o*7,(i&128)===0)break}return [n,t+r]}});var T=(e={})=>Ci({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4}),Ce=(e={})=>kt({config:e,get:(t,n)=>t.getUint32(0,n),name:"u32",size:4});var h=()=>kt({get:e=>e.getUint8(0),name:"u8",size:1});function K(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function pe(e){return O(e)?e.fixedSize:null}function he(e){return O(e)?e.fixedSize:e.maxSize??null}function m(e,t={}){let n=t.size??Ce(),r=pe(e),o=Vt(n,r),i=Vt(n,he(e))??void 0;return I({...o!==null?{fixedSize:o}:{maxSize:i},read:(a,s)=>{let c=[];if(typeof n=="object"&&a.slice(s).length===0)return [c,s];if(n==="remainder"){for(;s<a.length;){let[d,E]=e.read(a,s);s=E,c.push(d);}return [c,s]}let[u,_]=typeof n=="number"?[n,s]:n.read(a,s);s=_;for(let d=0;d<u;d+=1){let[E,A]=e.read(a,s);s=A,c.push(E);}return [c,s]}})}function Vt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function x(){return I({read:(e,t)=>{let n=e.slice(t);return [n,t+n.length]}})}function Wt(e){let t=K(e.map(pe)),n=K(e.map(he))??void 0;return I({...t===null?{maxSize:n}:{fixedSize:t},read:(r,o)=>{let i=[];return e.forEach(a=>{let[s,c]=a.read(r,o);i.push(s),o=c;}),[i,o]}})}function L(e){let t=e.map(([,o])=>o),n=K(t.map(pe)),r=K(t.map(he))??void 0;return I({...n===null?{maxSize:r}:{fixedSize:n},read:(o,i)=>{let a={};return e.forEach(([s,c])=>{let[u,_]=c.read(o,i);i=_,a[s]=u;}),[a,i]}})}function Gt(e,...t){return t.reduce((n,r)=>r(n),e)}var R=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(R||{});function Ht(e){return e>=2}function vi(e,t){return "lifetimeConstraint"in t&&t.lifetimeConstraint&&"blockhash"in t.lifetimeConstraint&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight?t:Object.freeze({...t,lifetimeConstraint:Object.freeze(e)})}var wi=e=>I({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let i=e[0].repeat(o);if(o===r.length)return [i,t.length];let a=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=Bi(a,e);return [i+s,t.length]}});function Bi(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var Pi="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var Fi=()=>wi(Pi);var Le;function xi(){if(!Le){let e=m(h(),{size:N()});Le=L([["lookupTableAddress",P()],["writableIndexes",e],["readonlyIndexes",e]]);}return Le}var Me;function ye(){return Me||(Me=h()),Me}function zi(){return L([["numSignerAccounts",ye()],["numReadonlySignerAccounts",ye()],["numReadonlyNonSignerAccounts",ye()]])}var Ue;function ki(){return Ue||(Ue=b(L([["programAddressIndex",h()],["accountIndices",m(h(),{size:N()})],["data",ge(x(),N())]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:t,data:n,...r}=e;return {...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}})),Ue}var Vi=0,Kt=128;function be(){return I({maxSize:1,read:(e,t)=>{let n=e[t];if((n&Kt)===0)return ["legacy",t];{let r=n^Kt;if(r>Vi)throw new l(_e,{unsupportedVersion:r});return [r,t+1]}}})}function Wi(){return [["version",be()],["header",zi()],["staticAccounts",m(P(),{size:N()})],["lifetimeToken",y(Fi(),32)],["instructions",m(ki(),{size:N()})],["addressTableLookups",Gi()]]}function Gi(){return m(xi(),{size:N()})}function Xt(){return b(L(Wi()),({addressTableLookups:e,...t})=>t.version==="legacy"||!e?.length?t:{...t,addressTableLookups:e})}function Hi(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var jt="SysvarRecentB1ockHashes11111111111111111111",qt="11111111111111111111111111111111";function $t(e,t){return {accounts:[{address:e,role:R.WRITABLE},{address:jt,role:R.READONLY},{address:t,role:R.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:qt}}function ve(e){return e.programAddress===qt&&e.data!=null&&Ki(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===R.WRITABLE&&e.accounts[1].address===jt&&e.accounts[1].role===R.READONLY&&e.accounts[2].address!=null&&Ht(e.accounts[2].role)}function Ki(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function Zt(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&ve(e.instructions[0])}function $i(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}function Yi({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o,i=r.instructions[0];if(i&&ve(i))if($i(i,t,n)){if(Zt(r)&&r.lifetimeConstraint.nonce===e)return r;o=[i,...r.instructions.slice(1)];}else o=[Object.freeze($t(t,n)),...r.instructions.slice(1)];else o=[Object.freeze($t(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}function Xi(e,t){if("feePayer"in t&&e===t.feePayer?.address&&ji(t.feePayer))return t;let n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function ji(e){return !!e&&"address"in e&&typeof e.address=="string"&&Object.keys(e).length===1}function qi(e,t){return Zi([e],t)}function Zi(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function Ji(e){let{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[],i=0;for(let a=0;a<n;a++)o.push({address:e.staticAccounts[i],role:R.WRITABLE_SIGNER}),i++;for(let a=0;a<t.numReadonlySignerAccounts;a++)o.push({address:e.staticAccounts[i],role:R.READONLY_SIGNER}),i++;for(let a=0;a<r;a++)o.push({address:e.staticAccounts[i],role:R.WRITABLE}),i++;for(let a=0;a<t.numReadonlyNonSignerAccounts;a++)o.push({address:e.staticAccounts[i],role:R.READONLY}),i++;return o}function Qi(e,t){let r=e.map(a=>a.lookupTableAddress).filter(a=>t[a]===void 0);if(r.length>0)throw new l(ie,{lookupTableAddresses:r});let o=[],i=[];for(let a of e){let s=t[a.lookupTableAddress],c=a.readonlyIndexes,u=a.writableIndexes,_=Math.max(...c,...u);if(_>=s.length)throw new l(se,{highestKnownIndex:s.length-1,highestRequestedIndex:_,lookupTableAddress:a.lookupTableAddress});let d=c.map(A=>({address:s[A],addressIndex:A,lookupTableAddress:a.lookupTableAddress,role:R.READONLY}));o.push(...d);let E=u.map(A=>({address:s[A],addressIndex:A,lookupTableAddress:a.lookupTableAddress,role:R.WRITABLE}));i.push(...E);}return [...i,...o]}function es(e,t){let n=t[e.programAddressIndex]?.address;if(!n)throw new l(ce,{index:e.programAddressIndex});let r=e.accountIndices?.map(i=>t[i]),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}function ts(e,t,n){if(!t||!ve(t))return {blockhash:e,lastValidBlockHeight:n??2n**64n-1n};{let r=t.accounts[0].address;H(r);let o=t.accounts[2].address;return H(o),{nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:o}}}function Jt(e,t){let n=e.staticAccounts[0];if(!n)throw new l(ue);let r=Ji(e),o="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?Qi(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[],i=[...r,...o],a=e.instructions.map(u=>es(u,i)),s=a[0],c=ts(e.lifetimeToken,s,t?.lastValidBlockHeight);return Gt(Hi({version:e.version}),u=>Xi(n,u),u=>a.reduce((_,d)=>qi(d,_),u),u=>"blockhash"in c?vi(c,u):Yi(c,u))}function Qt(){return b(L([["signatures",m(y(x(),64),{size:N()})],["messageBytes",x()]]),ns)}function ns(e){let{messageBytes:t,signatures:n}=e,r=Wt([be(),Mt(h(),2),m(P(),{size:N()})]),[o,i,a]=r.decode(t),s=a.slice(0,i);if(s.length!==n.length)throw new l(de,{numRequiredSignatures:i,signaturesLength:n.length,signerAddresses:s});let c={};return s.forEach((u,_)=>{let d=n[_];d.every(E=>E===0)?c[u]=null:c[u]=d;}),{messageBytes:t,signatures:Object.freeze(c)}}async function we(e,t,n){if(e.length===0)return {};let r=await xt(t,e,n);return Pt(r),Ne(r),r.reduce((o,i)=>({...o,[i.address]:i.data.addresses}),{})}var $="ComputeBudget111111111111111111111111111111";var en=new Map;async function tn(e){let t=Date.now(),n=en.get(e);if(n&&t-n.cachedAt<3e5)return n;let r=`${e}/.well-known/revibase.json`,o=await fetch(r);if(!o.ok)throw new Error(`Failed to fetch .well-known/revibase.json for ${e}`);let i=await o.json();if(!i?.clientJwk)throw new Error(`Invalid .well-known response from ${e}`);let a={...i,cachedAt:t};return en.set(e,a),a}function z(e,t){if(e.length!==t.length)return false;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}async function Y(e,t){if(e.jwk!==e.deviceProfile.devicePublicKey)throw new Error("Device publickey mismatch");try{let n=await jose.importJWK(core.convertBase64StringToJWK(e.jwk)),r=await jose.compactVerify(e.jws,n);if(!z(r.payload,new Uint8Array([...t,...fe().encode(jsonCanonicalize.canonicalize(e.deviceProfile))])))throw new Error("Invalid Payload")}catch{throw new Error("Device signature verification failed")}}async function X(e,t,n){let r=await n?.(e.clientOrigin)??await tn(e.clientOrigin);try{let o=await jose.importJWK(core.convertBase64StringToJWK(r.clientJwk)),i=await jose.compactVerify(e.jws,o);if(!z(i.payload,t))throw new Error("Invalid Payload")}catch{throw new Error("Client signature verification failed ")}return r}async function sn(e,t){let{authResponse:n,startRequest:r,slotHash:o,slotNumber:i,device:a,client:s,estimatedSlotHashExpiry:c}=e;if(r.data.type!=="transaction")throw new Error("Invalid request type.");if(s.clientOrigin!==r.clientOrigin)throw new Error("Client mismatch");let{response:u}=n,_=core.base64URLStringToBuffer(u.clientDataJSON),d=JSON.parse(Se().decode(_)),{challenge:E}=await core.createTransactionChallenge(r.data.payload,r.clientOrigin,a.jwk,r.rid,o,i,c),A=core.base64URLStringToBuffer(d.challenge);if(!z(A,E))throw new Error("Invalid challenge");let Q=core.getSecp256r1MessageHash(n);if(!z(Q,t))throw new Error("Invalid message hash")}async function Be(e,t){let n=sha2_js.sha256(t);return z(e.finalBufferHash,n)}async function cn(e){let{startRequest:t}=e.data.payload,n=core.createMessageChallenge(t.data.payload,t.clientOrigin,e.data.payload.device.jwk,t.rid),{verified:r}=await server.verifyAuthenticationResponse({response:e.data.payload.authResponse,expectedChallenge:core.bufferToBase64URLString(n),expectedRPID:t.rpId,expectedOrigin:t.providerOrigin,requireUserVerification:false,credential:{counter:0,id:e.data.payload.authResponse.id,publicKey:core.convertPubkeyCompressedToCose(e.data.payload.signer)}});if(!r)throw new Error("Invalid user siganture")}async function Ic(e,t,n){let{startRequest:r,authResponse:o}=t.data.payload;if(r.data.type!=="message")throw new Error("Invalid request type.");if(Date.now()>r.validTill)throw new Error("Request expired.");let[i]=await Promise.all([X(t.data.payload.client,core.createClientAuthorizationStartRequestChallenge(r),n),Y(t.data.payload.device,core.getSecp256r1MessageHash(t.data.payload.authResponse)),cn(t)]),a=await core.fetchUserAccountByFilters(await core.getDomainConfigAddress({rpId:r.rpId}),{credentialId:o.id});if(!a)throw new Error("No user found.");let s=a?.wallets.find(d=>d.isDelegate);if(!s)throw new Error("User does not have a delegated wallet");let u=(await core.fetchSettingsAccountData(await core.getSettingsFromIndex(s.index))).members.find(d=>d.role===core.UserRole.TransactionManager);if(!u)throw new Error("No transaction manager found.");if(e!==core.convertMemberKeyToString(u.pubkey))throw new Error("Transaction manager mismatch.");return {messageBytes:core.createMessageChallenge(t.data.payload.startRequest.data.payload,t.data.payload.startRequest.clientOrigin,t.data.payload.device.jwk,t.data.payload.startRequest.rid),verificationResults:{payload:t,signer:{client:{origin:t.data.payload.startRequest.clientOrigin,...i},device:t.data.payload.device.deviceProfile,estimatedValidTill:t.data.payload.startRequest.validTill,signer:new core.Secp256r1Key(core.convertMemberKeyToString(a.member)),startRequest:t.data.payload.startRequest,walletAddress:await core.getWalletAddressFromIndex(s.index)}}}}var k="11111111111111111111111111111111";var j=(e=>(e[e.CreateAccount=0]="CreateAccount",e[e.Assign=1]="Assign",e[e.TransferSol=2]="TransferSol",e[e.CreateAccountWithSeed=3]="CreateAccountWithSeed",e[e.AdvanceNonceAccount=4]="AdvanceNonceAccount",e[e.WithdrawNonceAccount=5]="WithdrawNonceAccount",e[e.InitializeNonceAccount=6]="InitializeNonceAccount",e[e.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",e[e.Allocate=8]="Allocate",e[e.AllocateWithSeed=9]="AllocateWithSeed",e[e.AssignWithSeed=10]="AssignWithSeed",e[e.TransferSolWithSeed=11]="TransferSolWithSeed",e[e.UpgradeNonceAccount=12]="UpgradeNonceAccount",e))(j||{});function Pe(e){let t="data"in e?e.data:e;if(g(t,T().encode(0),0))return 0;if(g(t,T().encode(1),0))return 1;if(g(t,T().encode(2),0))return 2;if(g(t,T().encode(3),0))return 3;if(g(t,T().encode(4),0))return 4;if(g(t,T().encode(5),0))return 5;if(g(t,T().encode(6),0))return 6;if(g(t,T().encode(7),0))return 7;if(g(t,T().encode(8),0))return 8;if(g(t,T().encode(9),0))return 9;if(g(t,T().encode(10),0))return 10;if(g(t,T().encode(11),0))return 11;if(g(t,T().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")}var dn=0,_n=1,An=2,ln=3,In=4,En=5,Rn=6,gn=7,Tn=8;process.env.NODE_ENV!=="production"&&({[dn]:"an account with the same address already exists",[En]:"provided address does not match addressed derived from seed",[ln]:"cannot allocate account data of this length",[An]:"cannot assign account to this program id",[In]:"length of requested seed is too long",[gn]:"stored nonce is still in recent_blockhashes",[Rn]:"advancing stored nonce requires a populated RecentBlockhashes sysvar",[Tn]:"specified nonce does not match stored nonce",[_n]:"account does not have enough SOL to perform the operation"});var fn="MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";function Sn(e,t){if(e.length!==t.length)return false;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}var Fe="Secp256r1SigVerify1111111111111111111111111",Nn=new Set([$,k,core.MULTI_WALLET_PROGRAM_ADDRESS,Fe,fn]),q="2c1LgZfCun82niPCgfg2cTMZmAiahraTjY4KNb1BSU4Z";function Dn(){return {[B(q)]:["ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL","11111111111111111111111111111111","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb","metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s","Sysvar1nstructions1111111111111111111111111","auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg","SysvarS1otHashes111111111111111111111111111","3C6AdJiD9qxMqZTmB53b5HC5Yfq2Bb57XAzYDzu4YDcj","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY","noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV","cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK","GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy","SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7","35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh","HwXnGK3tPkkVY6P439H2p68AxpeuWXd5PcrAxFpbmfbA","compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq","bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU","oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto","cpi15BoVPKgEPw5o8wc2T816GE7b378nMXnhH3Xbq4y","bmt2UxoBxB9xWev4BkLvkGdapsz6sZGkzViPNph7VFi","oq2UkeMsJLfXt2QHzim242SUi3nvjJs8Pn7Eac9H9vg","cpi2yGapXUR3As5SjnHBAVvmApNiLsbeZpF3euWnW6B","bmt3ccLd4bqSVZVeCJnH1F6C8jNygAhaDfxDwePyyGb","oq3AxjekBWgo64gpauB6QtuZNesuv19xrhaC1ZM1THQ","cpi3mbwMpSX8FAGMZVP85AwxqCaQMfEk9Em1v8QK9Rf","bmt4d3p1a4YQgk9PeZv5s4DBUmbF5NxqYpk9HGjQsd8","oq4ypwvVGzCUMoiKKHWh4S1SgZJ9vCvKpcz6RT6A8dq","cpi4yyPDc4bCgHAnsenunGA8Y77j3XEDyjgfyCKgcoc","bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2","oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P","cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6","amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx","ACXg8a7VaqecBWrSbdu73W4Pg9gsqXJ3EXAqkHyhvVXg","r18WwUxfG8kQ69bQPAB2jV6zGNKy3GosFGctjQoV4ti","cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m","2cLqZJrYMuCzKdSZBoWxZ3tXoeCMmMyDiuy6UBaKnbmK","5tgzUZaVtfnnSEBgmBDtJj6PdgYCnA1uaEGEUi3y5Njg","2yaSthpW4U4VZvBhwPfGA7HwC9v9Rfq3SNRZvJkKcrNe"].map(B)}}async function C(e,t,n){if(!e)return [];let r=e.find(i=>i.instructionIndex===t-1)?.data;if(!r)return [];let{payload:o}=core.getSecp256r1VerifyInstructionDataDecoder().decode(r);return Promise.all(n.map(async i=>{let a=o[i.verifyArgs.signedMessageIndex],s=sha2_js.sha256(a.message);return {signer:new core.Secp256r1Key(a.publicKey),messageHash:s}}))}function xe(e){return e.map(t=>{if(t.memberKey.keyType===core.KeyType.Secp256r1){if(t.messageHash.__option==="None")throw new Error("Message hash cannot be found.");return {signer:new core.Secp256r1Key(core.convertMemberKeyToString(t.memberKey)),messageHash:t.messageHash.value}}else return {signer:B(core.convertMemberKeyToString(t.memberKey))}})}async function M(e,t,n,r,o,i){if(!o)throw new Error("Transaction Auth Response is missing");if(n.filter(c=>c.signer instanceof core.Secp256r1Key).length!==o.length)throw new Error(`Signer count mismatch. Expected ${n.length} auth responses, got ${o.length}`);if(n.filter(c=>!(c.signer instanceof core.Secp256r1Key)).every(c=>c.signer.toString()!==r.publicKey))throw new Error("Transaction manager not found in instructions.");let a=await core.getWalletAddressFromSettings(B(t)),s=await Promise.all(n.map(async({signer:c,messageHash:u})=>{if(c instanceof core.Secp256r1Key){if(!u)throw new Error("Hash not found.");let _=o.find(Cn=>Sn(core.getSecp256r1MessageHash(Cn.authResponse),u));if(!_)throw new Error("Hash mismatch");let{client:d,device:E,startRequest:A,estimatedSlotHashExpiry:Q}=_;if(A.data.type!=="transaction")throw new Error("Invalid request type.");let je=Math.min(Q,A.validTill);if(je<Date.now())throw new Error("Request has expired.");let[mn]=await Promise.all([X(d,u,i),sn(_,u),Y(E,u)]);return {signer:c,walletAddress:a,client:{origin:d.clientOrigin,...mn},device:E.deviceProfile,startRequest:A,estimatedValidTill:je}}return {signer:c,walletAddress:a}}));return {instructions:e,signers:s}}async function U(e,t){let n=e?.data?.data;if(!n||n.__option==="None")throw new Error(t);return core.getSettingsFromIndex(n.value.index)}async function ze(e){let t=core.vaultTransactionMessageDeserialize(e);return (await Ve(t,core.getSolanaRpc())).instructions}function ke(e,t){if(!e)throw new Error("Invalid instruction accounts.");let n=3+(t.addressTableLookups?.length??0),r=e.slice(n);return t.instructions.map(o=>({accounts:[...o.accountIndices].map(i=>r[i]),data:o.data,programAddress:r[o.programAddressIndex].address}))}async function Ve(e,t){let r="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?e.addressTableLookups.map(i=>i.lookupTableAddress):[],o=r.length>0?await Cc(r,t):{};return Jt(e,{addressesByLookupTableAddress:o})}async function Cc(e,t){if(e.some(r=>r.toString()===q)){let r=e.filter(o=>o.toString()!==q);return {...Dn(),...await we(r,t)}}return we(e,t)}async function We(e,t,n,r,o,i){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts");let a=core.getChangeConfigCompressedInstructionDataDecoder().decode(e.data),s=await U(a.settingsMutArgs,"Invalid instruction data. Settings not found."),c=await C(t,n,a.signers.filter(d=>d.__kind==="Secp256r1").map(d=>d.fields[0])),u=3,_=a.signers.filter(d=>d.__kind==="Ed25519").map(d=>({signer:e.accounts[u+d.fields[0]].address}));return M([e],s,c.concat(_),o,r,i)}async function Ge(e,t,n,r,o,i){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts.");let a=core.getChangeConfigInstructionDataDecoder().decode(e.data),s=e.accounts[0].address.toString(),c=await C(t,n,a.signers.filter(d=>d.__kind==="Secp256r1").map(d=>d.fields[0])),u=5,_=a.signers.filter(d=>d.__kind==="Ed25519").map(d=>({signer:e.accounts[u+d.fields[0]].address}));return M([e],s,c.concat(_),o,r,i)}async function He(e,t,n,r,o,i,a){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let c=(e===core.MultiWalletInstruction.NativeTransferIntentCompressed?core.getNativeTransferIntentCompressedInstructionDataDecoder():core.getTokenTransferIntentCompressedInstructionDataDecoder()).decode(t.data),u=await U(c.settingsMutArgs,"Invalid instruction data. Settings not found."),_=await C(n,r,c.signers.filter(A=>A.__kind==="Secp256r1").map(A=>A.fields[0])),d=e===core.MultiWalletInstruction.NativeTransferIntentCompressed?6:17,E=c.signers.filter(A=>A.__kind==="Ed25519").map(A=>({signer:t.accounts[d+A.fields[0]].address}));return M([t],u,_.concat(E),i,o,a)}async function Ke(e,t,n,r,o,i,a){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let c=(e===core.MultiWalletInstruction.NativeTransferIntent?core.getNativeTransferIntentInstructionDataDecoder():core.getTokenTransferIntentInstructionDataDecoder()).decode(t.data),u=t.accounts[0].address.toString(),_=await C(n,r,c.signers.filter(A=>A.__kind==="Secp256r1").map(A=>A.fields[0])),d=e===core.MultiWalletInstruction.NativeTransferIntent?6:18,E=c.signers.filter(A=>A.__kind==="Ed25519").map(A=>({signer:t.accounts[d+A.fields[0]].address}));return M([t],u,_.concat(E),i,o,a)}function $e(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=core.getCreateUserAccountsInstructionDataDecoder().decode(e.data);for(let r of n.createUserArgs){if(r.member.toString()!==t.publicKey)throw new Error(`Member public key mismatch. Expected: ${t.publicKey}, got: ${r.member.toString()}`);if(r.transactionManagerUrl?.__option==="None")throw new Error("Transaction manager URL cannot be empty when creating user accounts");if(r.transactionManagerUrl?.value!==t.url)throw new Error(`Transaction manager URL mismatch. Expected: ${t.url}, got: ${r.transactionManagerUrl?.value}`)}return null}function Ye(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=core.getEditTransactionManagerUrlInstructionDataDecoder().decode(e.data),r=core.convertMemberKeyToString(n.userMutArgs.data.member);if(r!==t.publicKey)throw new Error(`Member public key mismatch. Expected: ${t.publicKey}, got: ${r}`);if(n.transactionManagerUrl!==t.url)throw new Error(`Transaction manager URL mismatch. Expected: ${t.url}, got: ${n.transactionManagerUrl}`);return null}async function Xe(e,t,n,r,o,i,a,s){if(!e.accounts)throw new Error("Invalid instruction accounts");if(!e.data)throw new Error("Invalid instruction data");zc(e,n);let c=t===core.MultiWalletInstruction.TransactionBufferCreate||t===core.MultiWalletInstruction.TransactionBufferCreateCompressed,u=t===core.MultiWalletInstruction.TransactionBufferCreateCompressed||t===core.MultiWalletInstruction.TransactionExecuteSyncCompressed,_;return c?_=await kc(e,u,a):_=await Gc(e,u,i,r),M(_.instructionsToVerify,_.settingsAddress,_.signers,n,o,s)}function zc(e,t){let n=e.accounts?.find(r=>r.address.toString()===t.publicKey);if(n&&n.role!==R.READONLY_SIGNER)throw new Error("Transaction Manager should be readonly signer.")}async function kc(e,t,n){if(!n)throw new Error("Missing transaction message bytes");if(!e.data||!e.accounts)throw new Error("Invalid instruction");let r=w().encode(n);return t?Vc(e,r):Wc(e,r)}async function Vc(e,t){let n=core.getTransactionBufferCreateCompressedInstructionDataDecoder().decode(e.data),r=await U(n.settingsReadonlyArgs,"Settings account is required for compressed transaction buffer create"),o=xe(n.args.expectedSigners);if(!await Be(n.args,t))throw new Error("Hash mismatch.");let a=await ze(t);return {settingsAddress:r,signers:o,instructionsToVerify:a}}async function Wc(e,t){let n=core.getTransactionBufferCreateInstructionDataDecoder().decode(e.data),r=e.accounts[0].address.toString(),o=xe(n.args.expectedSigners);if(!await Be(n.args,t))throw new Error("Hash mismatch.");let a=await ze(t);return {settingsAddress:r,signers:o,instructionsToVerify:a}}async function Gc(e,t,n,r){if(!e.data||!e.accounts)throw new Error("Invalid instruction");return t?Hc(e,n,r):Kc(e,n,r)}async function Hc(e,t,n){if(!e.accounts)throw new Error("Invalid instruction accounts.");let r=core.getTransactionExecuteSyncCompressedInstructionDataDecoder().decode(e.data),o=await U(r.settingsMutArgs,"Settings account is required for compressed transaction execute"),i=await C(t,n,r.signers.filter(u=>u.__kind==="Secp256r1").map(u=>u.fields[0])),a=3,s=r.signers.filter(u=>u.__kind==="Ed25519").map(u=>({signer:e.accounts[a+u.fields[0]].address})),c=ke(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:i.concat(s),instructionsToVerify:c}}async function Kc(e,t,n){if(!e.accounts)throw new Error("Invalid instruction accounts.");let r=core.getTransactionExecuteSyncInstructionDataDecoder().decode(e.data),o=e.accounts[0].address.toString(),i=await C(t,n,r.signers.filter(u=>u.__kind==="Secp256r1").map(u=>u.fields[0])),a=3,s=r.signers.filter(u=>u.__kind==="Ed25519").map(u=>({signer:e.accounts[a+u.fields[0]].address})),c=ke(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:i.concat(s),instructionsToVerify:c}}async function jc(e,t,n){let{transaction:r,transactionMessageBytes:o,authResponses:i}=t,{messageBytes:a}=Qt().decode(w().encode(r)),s=Xt().decode(a),{instructions:c}=await Ve(s,core.getSolanaRpc()),u=qc(c),_=(await Promise.all(c.map((d,E)=>Zc(d,e,E,i,u,o,n)))).filter(d=>d!==null);return {messageBytes:new Uint8Array(a),verificationResults:_}}function qc(e){return e.map((t,n)=>({instruction:t,instructionIndex:n})).filter(({instruction:t})=>t.programAddress.toString()===Fe).map(({instructionIndex:t,instruction:n})=>({instructionIndex:t,data:n.data}))}async function Zc(e,t,n,r,o,i,a){let s=e.programAddress.toString();if(!Nn.has(s))throw new Error("Instruction rejected by Transaction Manager.");if(!e.data)throw new Error("Invalid instruction data.");if(s===k.toString()){if(Pe({data:e.data})!==j.AdvanceNonceAccount)throw new Error("Instruction rejected by Transaction Manager.");return null}if(s!==core.MULTI_WALLET_PROGRAM_ADDRESS.toString())return null;let c=core.identifyMultiWalletInstruction({data:e.data});return Jc(e,c,t,n,r,o,i,a)}async function Jc(e,t,n,r,o,i,a,s){switch(t){case core.MultiWalletInstruction.DecompressSettingsAccount:case core.MultiWalletInstruction.TransactionBufferClose:case core.MultiWalletInstruction.TransactionBufferCloseCompressed:return null;case core.MultiWalletInstruction.ChangeConfig:return Ge(e,i,r,o,n,s);case core.MultiWalletInstruction.ChangeConfigCompressed:return We(e,i,r,o,n,s);case core.MultiWalletInstruction.CreateUserAccounts:return $e(e,n);case core.MultiWalletInstruction.EditTransactionManagerUrl:return Ye(e,n);case core.MultiWalletInstruction.NativeTransferIntent:case core.MultiWalletInstruction.TokenTransferIntent:return Ke(t,e,i,r,o,n,s);case core.MultiWalletInstruction.NativeTransferIntentCompressed:case core.MultiWalletInstruction.TokenTransferIntentCompressed:return He(t,e,i,r,o,n,s);case core.MultiWalletInstruction.TransactionBufferCreate:case core.MultiWalletInstruction.TransactionBufferCreateCompressed:case core.MultiWalletInstruction.TransactionExecuteSync:case core.MultiWalletInstruction.TransactionExecuteSyncCompressed:return Xe(e,t,n,r,o,i,a,s);default:throw new Error("Instruction rejected by transaction manager.")}}/*! Bundled license information:
|
|
5
|
+
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[cr]:"No signature verification implementation could be found.",[ur]:"No key generation implementation could be found.",[dr]:"No signing implementation could be found.",[_r]:"No key export implementation could be found.",[bn]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[oa]:"Transaction processing left an account with an outstanding borrowed reference",[Go]:"Account in use",[Ho]:"Account loaded twice",[Ko]:"Attempt to debit an account but found no record of a prior credit.",[_a]:"Transaction loads an address table account that doesn't exist",[jo]:"This transaction has already been processed",[qo]:"Blockhash not found",[Zo]:"Loader call chain is too deep",[ra]:"Transactions are currently disabled due to cluster maintenance",[Ta]:"Transaction contains a duplicate instruction ($index) that is not allowed",[Yo]:"Insufficient funds for fee",[fa]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[Xo]:"This account may not be used to pay transaction fees",[Qo]:"Transaction contains an invalid account reference",[la]:"Transaction loads an address table account with invalid data",[Ia]:"Transaction address table lookup uses an invalid index",[Aa]:"Transaction loads an address table account with an invalid owner",[Na]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[ta]:"This program may not be used for executing instructions",[Ea]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[sa]:"Transaction loads a writable account that cannot be written",[Sa]:"Transaction exceeded max loaded accounts data size cap",[Jo]:"Transaction requires a fee but has no signature present",[$o]:"Attempt to load a program that does not exist",[Oa]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[Da]:"ResanitizationNeeded",[na]:"Transaction failed to sanitize accounts offsets correctly",[ea]:"Transaction did not pass signature verification",[da]:"Transaction locked too many accounts",[ma]:"Sum of account balances before and after transaction do not match",[Wo]:"The transaction failed with the error `$errorName`",[ia]:"Transaction version is unsupported",[ua]:"Transaction would exceed account data limit within the block",[ga]:"Transaction would exceed total account data limit",[ca]:"Transaction would exceed max account limit within the block",[aa]:"Transaction would exceed max Block Cost Limit",[Ra]:"Transaction would exceed max Vote Cost Limit",[At]:"Attempted to sign a transaction with an address that is not a signer for it",[Bo]:"Transaction is missing an address at index: $index.",[lt]:"Transaction has no expected signers therefore it cannot be encoded",[It]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[oe]:"Transaction does not have a blockhash lifetime",[ae]:"Transaction is not a durable nonce transaction",[ie]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[se]:"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved",[ue]:"No fee payer set in CompiledTransaction",[ce]:"Could not find program address at index $index",[ko]:"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more",[Vo]:"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more",[Fo]:"Transaction is missing a fee payer.",[_t]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[zo]:"Transaction first instruction is not advance nonce account instruction.",[xo]:"Transaction with no instructions cannot be durable nonce transaction.",[st]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[ct]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[de]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[dt]:"Transaction is missing signatures for addresses: $addresses.",[ut]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[_e]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[Et]:"The transaction has a durable nonce lifetime (with nonce `$nonce`), but the nonce account address is in a lookup table. The lifetime constraint cannot be constructed without fetching the lookup tables for the transaction."},D="i",S="t";function oi(e,t={}){let n=ri[e];if(n.length===0)return "";let r;function o(a){if(r[S]===2){let s=n.slice(r[D]+1,a);i.push(s in t?`${t[s]}`:`$${s}`);}else r[S]===1&&i.push(n.slice(r[D],a));}let i=[];return n.split("").forEach((a,s)=>{if(s===0){r={[D]:0,[S]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let c;switch(r[S]){case 0:c={[D]:s,[S]:1};break;case 1:a==="\\"?c={[D]:s,[S]:0}:a==="$"&&(c={[D]:s,[S]:2});break;case 2:a==="\\"?c={[D]:s,[S]:0}:a==="$"?c={[D]:s,[S]:2}:a.match(/\w/)||(c={[D]:s,[S]:1});break}c&&(r!==c&&o(s),r=c);}),o(),i.join("")}function ai(e,t={}){if(process.env.NODE_ENV!=="production")return oi(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${ni(t)}'`),`${n}\``}}var l=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([i,a])=>{i==="cause"?r={cause:a.value}:(n===void 0&&(n={}),Object.defineProperty(n,i,a));});let o=ai(e,n);super(o,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function ii(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var si=(e,t)=>ii(e.length<=t?e:e.slice(0,t),t);function g(e,t,n){let r=e.length===t.length?e:e.slice(n,n+t.length);return r.length!==t.length?false:t.every((o,i)=>o===r[i])}function pt(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function M(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(pt(t,e));return e.write(t,n,0),n}})}function I(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function O(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function ht(e,t,n=0){if(t.length-n<=0)throw new l(Ae,{codecDescription:e})}function F(e,t,n,r=0){let o=n.length-r;if(o<t)throw new l(le,{bytesLength:o,codecDescription:e,expected:t})}function Ct(e,t,n){if(t<0||t>n)throw new l(Re,{bytesLength:n,codecDescription:e,offset:t})}function ge(e,t){let n=(a,s)=>{let[c,u]=t.read(a,s),_=Number(c);return s=u,(s>0||a.length>_)&&(a=a.slice(s,s+_)),F("addDecoderSizePrefix",_,a),[e.decode(a),s+_]};if(O(t)&&O(e))return I({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});let r=O(t)?t.fixedSize:t.maxSize??null,o=O(e)?e.fixedSize:e.maxSize??null,i=r!==null&&o!==null?r+o:null;return I({...e,...i!==null?{maxSize:i}:{},read:n})}function y(e,t){return I({fixedSize:t,read:(n,r)=>{F("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),O(e)&&(n=si(n,e.fixedSize));let[o]=e.read(n,0);return [o,r+t]}})}function ci(e,t){return I({...e,read:(n,r)=>{let o=u=>ui(u,n.length),i=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;Ct("offsetDecoder",i,n.length);let[a,s]=e.read(n,i),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:i,postOffset:s,preOffset:r,wrapBytes:o}):s;return Ct("offsetDecoder",c,n.length),[a,c]}})}function ui(e,t){return t===0?0:(e%t+t)%t}function di(e,t){if(O(e)){let n=t(e.fixedSize);if(n<0)throw new l(Ee,{bytesLength:n,codecDescription:"resizeDecoder"});return I({...e,fixedSize:n})}return e}function Lt(e,t){return ci(di(e,n=>n+t),{postOffset:({postOffset:n})=>n+t})}function b(e,t){return I({...e,read:(n,r)=>{let[o,i]=e.read(n,r);return [t(o,n,r),i]}})}function Ut(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new l(W,{alphabet:e,base:e.length,value:n})}var _i=e=>M({getSizeFromValue:t=>{let[n,r]=Mt(t,e[0]);if(!r)return t.length;let o=yt(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(Ut(e,t),t==="")return r;let[o,i]=Mt(t,e[0]);if(!i)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let a=yt(i,e),s=[];for(;a>0n;)s.unshift(Number(a%256n)),a/=256n;let c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),Ai=e=>I({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let i=e[0].repeat(o);if(o===r.length)return [i,t.length];let a=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=li(a,e);return [i+s,t.length]}});function Mt(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function yt(e,t){let n=BigInt(t.length),r=0n;for(let o of e)r*=n,r+=BigInt(t.indexOf(o));return r}function li(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var bt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Te=()=>_i(bt),vt=()=>Ai(bt);var Ii="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=()=>M({getSizeFromValue:e=>Buffer.from(e,"base64").length,write(e,t,n){Ut(Ii,e.replace(/=/g,""));let r=Buffer.from(e,"base64");return t.set(r,n),r.length+n}});var Ei=e=>e.replace(/\u0000/g,"");var Ri=globalThis.TextDecoder;var fe=()=>{let e;return I({read(t,n){let r=(e||=new Ri).decode(t.slice(n));return [Ei(r),t.length]}})};function gi(e){return !("exists"in e)||"exists"in e&&e.exists}function wt(e){let t=e.filter(n=>gi(n)&&n.data instanceof Uint8Array);if(t.length>0){let n=t.map(r=>r.address);throw new l(re,{addresses:n})}}function Ti(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=w().encode(t.data[0]);return Object.freeze({...Pt(t),address:e,data:n,exists:true})}function fi(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=t.data.parsed.info;return Object.freeze({...Pt(t),address:e,data:n,exists:true})}function Pt(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function Bt(e,t,n={}){let{abortSignal:r,...o}=n;return (await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map((a,s)=>a&&typeof a=="object"&&"parsed"in a.data?fi(t[s],a):Ti(t[s],a))}function Se(e){let t=e.filter(n=>!n.exists);if(t.length>0){let n=t.map(r=>r.address);throw new l(ne,{addresses:n})}}var Ne,De;function Si(){return Ne||(Ne=Te()),Ne}function Ni(){return De||(De=vt()),De}function H(e){if(e.length<32||e.length>44)throw new l(te,{actualLength:e.length});let r=Si().encode(e).byteLength;if(r!==32)throw new l(ee,{actualLength:r})}function P(e){return H(e),e}function B(){return y(Ni(),32)}function Di(e,t,n,r){if(r<t||r>n)throw new l(Ie,{codecDescription:e,max:n,min:t,value:r})}function Ft(e){return e?.endian!==1}function Oi(e){return M({fixedSize:e.size,write(t,n,r){e.range&&Di(e.name,e.range[0],e.range[1],t);let o=new ArrayBuffer(e.size);return e.set(new DataView(o),t,Ft(e.config)),n.set(new Uint8Array(o),r),r+e.size}})}function xt(e){return I({fixedSize:e.size,read(t,n=0){ht(e.name,t,n),F(e.name,e.size,t,n);let r=new DataView(mi(t,n,e.size));return [e.get(r,Ft(e.config)),n+e.size]}})}function mi(e,t,n){let r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}var N=()=>I({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){let o=r-1,i=e[t+o],a=127&i;if(n|=a<<o*7,(i&128)===0)break}return [n,t+r]}});var T=(e={})=>Oi({config:e,name:"u32",range:[0,4294967295],set:(t,n,r)=>t.setUint32(0,Number(n),r),size:4}),me=(e={})=>xt({config:e,get:(t,n)=>t.getUint32(0,n),name:"u32",size:4});var p=()=>xt({get:e=>e.getUint8(0),name:"u8",size:1});function K(e){return e.reduce((t,n)=>t===null||n===null?null:t+n,0)}function Ce(e){return O(e)?e.fixedSize:null}function pe(e){return O(e)?e.fixedSize:e.maxSize??null}function m(e,t={}){let n=t.size??me(),r=Ce(e),o=zt(n,r),i=zt(n,pe(e))??void 0;return I({...o!==null?{fixedSize:o}:{maxSize:i},read:(a,s)=>{let c=[];if(typeof n=="object"&&a.slice(s).length===0)return [c,s];if(n==="remainder"){for(;s<a.length;){let[d,E]=e.read(a,s);s=E,c.push(d);}return [c,s]}let[u,_]=typeof n=="number"?[n,s]:n.read(a,s);s=_;for(let d=0;d<u;d+=1){let[E,A]=e.read(a,s);s=A,c.push(E);}return [c,s]}})}function zt(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function x(){return I({read:(e,t)=>{let n=e.slice(t);return [n,t+n.length]}})}function kt(e){let t=K(e.map(Ce)),n=K(e.map(pe))??void 0;return I({...t===null?{maxSize:n}:{fixedSize:t},read:(r,o)=>{let i=[];return e.forEach(a=>{let[s,c]=a.read(r,o);i.push(s),o=c;}),[i,o]}})}function h(e){let t=e.map(([,o])=>o),n=K(t.map(Ce)),r=K(t.map(pe))??void 0;return I({...n===null?{maxSize:r}:{fixedSize:n},read:(o,i)=>{let a={};return e.forEach(([s,c])=>{let[u,_]=c.read(o,i);i=_,a[s]=u;}),[a,i]}})}function Vt(e,...t){return t.reduce((n,r)=>r(n),e)}var R=(e=>(e[e.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",e[e.READONLY_SIGNER=2]="READONLY_SIGNER",e[e.WRITABLE=1]="WRITABLE",e[e.READONLY=0]="READONLY",e))(R||{});function Wt(e){return e>=2}function Ui(e,t){return "lifetimeConstraint"in t&&t.lifetimeConstraint&&"blockhash"in t.lifetimeConstraint&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight?t:Object.freeze({...t,lifetimeConstraint:Object.freeze(e)})}var bi=e=>I({read(t,n){let r=n===0?t:t.slice(n);if(r.length===0)return ["",0];let o=r.findIndex(c=>c!==0);o=o===-1?r.length:o;let i=e[0].repeat(o);if(o===r.length)return [i,t.length];let a=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=vi(a,e);return [i+s,t.length]}});function vi(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var wi="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var Pi=()=>bi(wi);var he;function Bi(){if(!he){let e=m(p(),{size:N()});he=h([["lookupTableAddress",B()],["writableIndexes",e],["readonlyIndexes",e]]);}return he}var Le;function Me(){return Le||(Le=p()),Le}function Fi(){return h([["numSignerAccounts",Me()],["numReadonlySignerAccounts",Me()],["numReadonlyNonSignerAccounts",Me()]])}var ye;function xi(){return ye||(ye=b(h([["programAddressIndex",p()],["accountIndices",m(p(),{size:N()})],["data",ge(x(),N())]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:t,data:n,...r}=e;return {...r,...t.length?{accountIndices:t}:null,...n.byteLength?{data:n}:null}})),ye}var zi=0,Gt=128;function Ue(){return I({maxSize:1,read:(e,t)=>{let n=e[t];if((n&Gt)===0)return ["legacy",t];{let r=n^Gt;if(r>zi)throw new l(_e,{unsupportedVersion:r});return [r,t+1]}}})}function ki(){return [["version",Ue()],["header",Fi()],["staticAccounts",m(B(),{size:N()})],["lifetimeToken",y(Pi(),32)],["instructions",m(xi(),{size:N()})],["addressTableLookups",Vi()]]}function Vi(){return m(Bi(),{size:N()})}function $t(){return b(h(ki()),({addressTableLookups:e,...t})=>t.version==="legacy"||!e?.length?t:{...t,addressTableLookups:e})}function Wi(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var Yt="SysvarRecentB1ockHashes11111111111111111111",Xt="11111111111111111111111111111111";function Ht(e,t){return {accounts:[{address:e,role:R.WRITABLE},{address:Yt,role:R.READONLY},{address:t,role:R.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:Xt}}function be(e){return e.programAddress===Xt&&e.data!=null&&Gi(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===R.WRITABLE&&e.accounts[1].address===Yt&&e.accounts[1].role===R.READONLY&&e.accounts[2].address!=null&&Wt(e.accounts[2].role)}function Gi(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function jt(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&be(e.instructions[0])}function Hi(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}function Ki({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o,i=r.instructions[0];if(i&&be(i))if(Hi(i,t,n)){if(jt(r)&&r.lifetimeConstraint.nonce===e)return r;o=[i,...r.instructions.slice(1)];}else o=[Object.freeze(Ht(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(Ht(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}function $i(e,t){if("feePayer"in t&&e===t.feePayer?.address&&Yi(t.feePayer))return t;let n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function Yi(e){return !!e&&"address"in e&&typeof e.address=="string"&&Object.keys(e).length===1}function Xi(e,t){return ji([e],t)}function ji(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function qi(e){let{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[],i=0;for(let a=0;a<n;a++)o.push({address:e.staticAccounts[i],role:R.WRITABLE_SIGNER}),i++;for(let a=0;a<t.numReadonlySignerAccounts;a++)o.push({address:e.staticAccounts[i],role:R.READONLY_SIGNER}),i++;for(let a=0;a<r;a++)o.push({address:e.staticAccounts[i],role:R.WRITABLE}),i++;for(let a=0;a<t.numReadonlyNonSignerAccounts;a++)o.push({address:e.staticAccounts[i],role:R.READONLY}),i++;return o}function Zi(e,t){let r=e.map(a=>a.lookupTableAddress).filter(a=>t[a]===void 0);if(r.length>0)throw new l(ie,{lookupTableAddresses:r});let o=[],i=[];for(let a of e){let s=t[a.lookupTableAddress],c=a.readonlyIndexes,u=a.writableIndexes,_=Math.max(...c,...u);if(_>=s.length)throw new l(se,{highestKnownIndex:s.length-1,highestRequestedIndex:_,lookupTableAddress:a.lookupTableAddress});let d=c.map(A=>({address:s[A],addressIndex:A,lookupTableAddress:a.lookupTableAddress,role:R.READONLY}));o.push(...d);let E=u.map(A=>({address:s[A],addressIndex:A,lookupTableAddress:a.lookupTableAddress,role:R.WRITABLE}));i.push(...E);}return [...i,...o]}function Ji(e,t){let n=t[e.programAddressIndex]?.address;if(!n)throw new l(ce,{index:e.programAddressIndex});let r=e.accountIndices?.map(i=>t[i]),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}function Qi(e,t,n){if(!t||!be(t))return {blockhash:e,lastValidBlockHeight:n??2n**64n-1n};{let r=t.accounts[0].address;H(r);let o=t.accounts[2].address;return H(o),{nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:o}}}function qt(e,t){let n=e.staticAccounts[0];if(!n)throw new l(ue);let r=qi(e),o="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?Zi(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[],i=[...r,...o],a=e.instructions.map(u=>Ji(u,i)),s=a[0],c=Qi(e.lifetimeToken,s,t?.lastValidBlockHeight);return Vt(Wi({version:e.version}),u=>$i(n,u),u=>a.reduce((_,d)=>Xi(d,_),u),u=>"blockhash"in c?Ui(c,u):Ki(c,u))}function Zt(){return b(h([["signatures",m(y(x(),64),{size:N()})],["messageBytes",x()]]),es)}function es(e){let{messageBytes:t,signatures:n}=e,r=kt([Ue(),Lt(p(),2),m(B(),{size:N()})]),[o,i,a]=r.decode(t),s=a.slice(0,i);if(s.length!==n.length)throw new l(de,{numRequiredSignatures:i,signaturesLength:n.length,signerAddresses:s});let c={};return s.forEach((u,_)=>{let d=n[_];d.every(E=>E===0)?c[u]=null:c[u]=d;}),{messageBytes:t,signatures:Object.freeze(c)}}async function ve(e,t,n){if(e.length===0)return {};let r=await Bt(t,e,n);return wt(r),Se(r),r.reduce((o,i)=>({...o,[i.address]:i.data.addresses}),{})}var $="ComputeBudget111111111111111111111111111111";var Jt=new Map;async function Qt(e){let t=Date.now(),n=Jt.get(e);if(n&&t-n.cachedAt<3e5)return n;let r=`${e}/.well-known/revibase.json`,o=await fetch(r);if(!o.ok)throw new Error(`Failed to fetch .well-known/revibase.json for ${e}`);let i=await o.json();if(!i?.clientJwk)throw new Error(`Invalid .well-known response from ${e}`);let a={...i,cachedAt:t};return Jt.set(e,a),a}function z(e,t){if(e.length!==t.length)return false;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}async function Y(e,t){if(e.jwk!==e.deviceProfile.devicePublicKey)throw new Error("Device publickey mismatch");try{let n=await jose.importJWK(core.convertBase64StringToJWK(e.jwk)),r=await jose.compactVerify(e.jws,n);if(!z(r.payload,core.getDeviceMessageHash(t,e.deviceProfile)))throw new Error("Invalid Payload")}catch{throw new Error("Device signature verification failed")}}async function X(e,t,n){let r=await n?.(e.clientOrigin)??await Qt(e.clientOrigin);try{let o=await jose.importJWK(core.convertBase64StringToJWK(r.clientJwk)),i=await jose.compactVerify(e.jws,o);if(!z(i.payload,t))throw new Error("Invalid Payload")}catch{throw new Error("Client signature verification failed ")}return r}async function on(e,t){let{authResponse:n,startRequest:r,slotHash:o,slotNumber:i,device:a,client:s,estimatedSlotHashExpiry:c}=e;if(r.data.type!=="transaction")throw new Error("Invalid request type.");if(s.clientOrigin!==r.clientOrigin)throw new Error("Client mismatch");let{response:u}=n,_=core.base64URLStringToBuffer(u.clientDataJSON),d=JSON.parse(fe().decode(_)),{challenge:E}=await core.createTransactionChallenge(r.data.payload,r.clientOrigin,a.jwk,r.rid,o,i,c),A=core.base64URLStringToBuffer(d.challenge);if(!z(A,E))throw new Error("Invalid challenge");let Q=core.getSecp256r1MessageHash(n);if(!z(Q,t))throw new Error("Invalid message hash")}async function we(e,t){let n=sha2_js.sha256(t);return z(e.finalBufferHash,n)}async function an(e){let{startRequest:t}=e.data.payload,n=core.createMessageChallenge(t.data.payload,t.clientOrigin,e.data.payload.device.jwk,t.rid),{verified:r}=await server.verifyAuthenticationResponse({response:e.data.payload.authResponse,expectedChallenge:core.bufferToBase64URLString(n),expectedRPID:t.rpId,expectedOrigin:t.providerOrigin,requireUserVerification:false,credential:{counter:0,id:e.data.payload.authResponse.id,publicKey:core.convertPubkeyCompressedToCose(e.data.payload.signer)}});if(!r)throw new Error("Invalid user siganture")}async function _c(e,t,n){let{startRequest:r,authResponse:o}=t.data.payload;if(r.data.type!=="message")throw new Error("Invalid request type.");if(Date.now()>r.validTill)throw new Error("Request expired.");let[i]=await Promise.all([X(t.data.payload.client,core.createClientAuthorizationStartRequestChallenge(r),n),Y(t.data.payload.device,t.data.payload.authResponse),an(t)]),a=await core.fetchUserAccountByFilters(await core.getDomainConfigAddress({rpId:r.rpId}),{credentialId:o.id});if(!a)throw new Error("No user found.");let s=a?.wallets.find(d=>d.isDelegate);if(!s)throw new Error("User does not have a delegated wallet");let u=(await core.fetchSettingsAccountData(await core.getSettingsFromIndex(s.index))).members.find(d=>d.role===core.UserRole.TransactionManager);if(!u)throw new Error("No transaction manager found.");if(e!==core.convertMemberKeyToString(u.pubkey))throw new Error("Transaction manager mismatch.");return {messageBytes:core.createMessageChallenge(t.data.payload.startRequest.data.payload,t.data.payload.startRequest.clientOrigin,t.data.payload.device.jwk,t.data.payload.startRequest.rid),verificationResults:{payload:t,signer:{client:{origin:t.data.payload.startRequest.clientOrigin,...i},device:t.data.payload.device.deviceProfile,estimatedValidTill:t.data.payload.startRequest.validTill,signer:new core.Secp256r1Key(core.convertMemberKeyToString(a.member)),startRequest:t.data.payload.startRequest,walletAddress:await core.getWalletAddressFromIndex(s.index)}}}}var k="11111111111111111111111111111111";var j=(e=>(e[e.CreateAccount=0]="CreateAccount",e[e.Assign=1]="Assign",e[e.TransferSol=2]="TransferSol",e[e.CreateAccountWithSeed=3]="CreateAccountWithSeed",e[e.AdvanceNonceAccount=4]="AdvanceNonceAccount",e[e.WithdrawNonceAccount=5]="WithdrawNonceAccount",e[e.InitializeNonceAccount=6]="InitializeNonceAccount",e[e.AuthorizeNonceAccount=7]="AuthorizeNonceAccount",e[e.Allocate=8]="Allocate",e[e.AllocateWithSeed=9]="AllocateWithSeed",e[e.AssignWithSeed=10]="AssignWithSeed",e[e.TransferSolWithSeed=11]="TransferSolWithSeed",e[e.UpgradeNonceAccount=12]="UpgradeNonceAccount",e))(j||{});function Pe(e){let t="data"in e?e.data:e;if(g(t,T().encode(0),0))return 0;if(g(t,T().encode(1),0))return 1;if(g(t,T().encode(2),0))return 2;if(g(t,T().encode(3),0))return 3;if(g(t,T().encode(4),0))return 4;if(g(t,T().encode(5),0))return 5;if(g(t,T().encode(6),0))return 6;if(g(t,T().encode(7),0))return 7;if(g(t,T().encode(8),0))return 8;if(g(t,T().encode(9),0))return 9;if(g(t,T().encode(10),0))return 10;if(g(t,T().encode(11),0))return 11;if(g(t,T().encode(12),0))return 12;throw new Error("The provided instruction could not be identified as a system instruction.")}var cn=0,un=1,dn=2,_n=3,An=4,ln=5,In=6,En=7,Rn=8;process.env.NODE_ENV!=="production"&&({[cn]:"an account with the same address already exists",[ln]:"provided address does not match addressed derived from seed",[_n]:"cannot allocate account data of this length",[dn]:"cannot assign account to this program id",[An]:"length of requested seed is too long",[En]:"stored nonce is still in recent_blockhashes",[In]:"advancing stored nonce requires a populated RecentBlockhashes sysvar",[Rn]:"specified nonce does not match stored nonce",[un]:"account does not have enough SOL to perform the operation"});var gn="MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";function Tn(e,t){if(e.length!==t.length)return false;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}var Be="Secp256r1SigVerify1111111111111111111111111",fn=new Set([$,k,core.MULTI_WALLET_PROGRAM_ADDRESS,Be,gn]),q="2c1LgZfCun82niPCgfg2cTMZmAiahraTjY4KNb1BSU4Z";function Sn(){return {[P(q)]:["ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL","11111111111111111111111111111111","TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb","metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s","Sysvar1nstructions1111111111111111111111111","auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg","SysvarS1otHashes111111111111111111111111111","3C6AdJiD9qxMqZTmB53b5HC5Yfq2Bb57XAzYDzu4YDcj","BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY","noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV","cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK","GXtd2izAiMJPwMEjfgTRH3d7k9mjn4Jq3JrWFv9gySYy","SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7","35hkDgaAKwMCaxRz2ocSZ6NaUrtKkyNqU6c4RV3tYJRh","HwXnGK3tPkkVY6P439H2p68AxpeuWXd5PcrAxFpbmfbA","compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq","bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU","oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto","cpi15BoVPKgEPw5o8wc2T816GE7b378nMXnhH3Xbq4y","bmt2UxoBxB9xWev4BkLvkGdapsz6sZGkzViPNph7VFi","oq2UkeMsJLfXt2QHzim242SUi3nvjJs8Pn7Eac9H9vg","cpi2yGapXUR3As5SjnHBAVvmApNiLsbeZpF3euWnW6B","bmt3ccLd4bqSVZVeCJnH1F6C8jNygAhaDfxDwePyyGb","oq3AxjekBWgo64gpauB6QtuZNesuv19xrhaC1ZM1THQ","cpi3mbwMpSX8FAGMZVP85AwxqCaQMfEk9Em1v8QK9Rf","bmt4d3p1a4YQgk9PeZv5s4DBUmbF5NxqYpk9HGjQsd8","oq4ypwvVGzCUMoiKKHWh4S1SgZJ9vCvKpcz6RT6A8dq","cpi4yyPDc4bCgHAnsenunGA8Y77j3XEDyjgfyCKgcoc","bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2","oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P","cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6","amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx","ACXg8a7VaqecBWrSbdu73W4Pg9gsqXJ3EXAqkHyhvVXg","r18WwUxfG8kQ69bQPAB2jV6zGNKy3GosFGctjQoV4ti","cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m","2cLqZJrYMuCzKdSZBoWxZ3tXoeCMmMyDiuy6UBaKnbmK","5tgzUZaVtfnnSEBgmBDtJj6PdgYCnA1uaEGEUi3y5Njg","2yaSthpW4U4VZvBhwPfGA7HwC9v9Rfq3SNRZvJkKcrNe"].map(P)}}async function C(e,t,n){if(!e)return [];let r=e.find(i=>i.instructionIndex===t-1)?.data;if(!r)return [];let{payload:o}=core.getSecp256r1VerifyInstructionDataDecoder().decode(r);return Promise.all(n.map(async i=>{let a=o[i.verifyArgs.signedMessageIndex],s=sha2_js.sha256(a.message);return {signer:new core.Secp256r1Key(a.publicKey),messageHash:s}}))}function Fe(e){return e.map(t=>{if(t.memberKey.keyType===core.KeyType.Secp256r1){if(t.messageHash.__option==="None")throw new Error("Message hash cannot be found.");return {signer:new core.Secp256r1Key(core.convertMemberKeyToString(t.memberKey)),messageHash:t.messageHash.value}}else return {signer:P(core.convertMemberKeyToString(t.memberKey))}})}async function L(e,t,n,r,o,i){if(!o)throw new Error("Transaction Auth Response is missing");if(n.filter(c=>c.signer instanceof core.Secp256r1Key).length!==o.length)throw new Error(`Signer count mismatch. Expected ${n.length} auth responses, got ${o.length}`);if(n.filter(c=>!(c.signer instanceof core.Secp256r1Key)).every(c=>c.signer.toString()!==r.publicKey))throw new Error("Transaction manager not found in instructions.");let a=await core.getWalletAddressFromSettings(P(t)),s=await Promise.all(n.map(async({signer:c,messageHash:u})=>{if(c instanceof core.Secp256r1Key){if(!u)throw new Error("Hash not found.");let _=o.find(On=>Tn(core.getSecp256r1MessageHash(On.authResponse),u));if(!_)throw new Error("Hash mismatch");let{client:d,device:E,startRequest:A,estimatedSlotHashExpiry:Q}=_;if(A.data.type!=="transaction")throw new Error("Invalid request type.");let Xe=Math.min(Q,A.validTill);if(Xe<Date.now())throw new Error("Request has expired.");let[Dn]=await Promise.all([X(d,u,i),on(_,u),Y(E,_.authResponse)]);return {signer:c,walletAddress:a,client:{origin:d.clientOrigin,...Dn},device:E.deviceProfile,startRequest:A,estimatedValidTill:Xe}}return {signer:c,walletAddress:a}}));return {instructions:e,signers:s}}async function U(e,t){let n=e?.data?.data;if(!n||n.__option==="None")throw new Error(t);return core.getSettingsFromIndex(n.value.index)}async function xe(e){let t=core.vaultTransactionMessageDeserialize(e);return (await ke(t,core.getSolanaRpc())).instructions}function ze(e,t){if(!e)throw new Error("Invalid instruction accounts.");let n=3+(t.addressTableLookups?.length??0),r=e.slice(n);return t.instructions.map(o=>({accounts:[...o.accountIndices].map(i=>r[i]),data:o.data,programAddress:r[o.programAddressIndex].address}))}async function ke(e,t){let r="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?e.addressTableLookups.map(i=>i.lookupTableAddress):[],o=r.length>0?await Dc(r,t):{};return qt(e,{addressesByLookupTableAddress:o})}async function Dc(e,t){if(e.some(r=>r.toString()===q)){let r=e.filter(o=>o.toString()!==q);return {...Sn(),...await ve(r,t)}}return ve(e,t)}async function Ve(e,t,n,r,o,i){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts");let a=core.getChangeConfigCompressedInstructionDataDecoder().decode(e.data),s=await U(a.settingsMutArgs,"Invalid instruction data. Settings not found."),c=await C(t,n,a.signers.filter(d=>d.__kind==="Secp256r1").map(d=>d.fields[0])),u=3,_=a.signers.filter(d=>d.__kind==="Ed25519").map(d=>({signer:e.accounts[u+d.fields[0]].address}));return L([e],s,c.concat(_),o,r,i)}async function We(e,t,n,r,o,i){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts.");let a=core.getChangeConfigInstructionDataDecoder().decode(e.data),s=e.accounts[0].address.toString(),c=await C(t,n,a.signers.filter(d=>d.__kind==="Secp256r1").map(d=>d.fields[0])),u=5,_=a.signers.filter(d=>d.__kind==="Ed25519").map(d=>({signer:e.accounts[u+d.fields[0]].address}));return L([e],s,c.concat(_),o,r,i)}async function Ge(e,t,n,r,o,i,a){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let c=(e===core.MultiWalletInstruction.NativeTransferIntentCompressed?core.getNativeTransferIntentCompressedInstructionDataDecoder():core.getTokenTransferIntentCompressedInstructionDataDecoder()).decode(t.data),u=await U(c.settingsMutArgs,"Invalid instruction data. Settings not found."),_=await C(n,r,c.signers.filter(A=>A.__kind==="Secp256r1").map(A=>A.fields[0])),d=e===core.MultiWalletInstruction.NativeTransferIntentCompressed?6:17,E=c.signers.filter(A=>A.__kind==="Ed25519").map(A=>({signer:t.accounts[d+A.fields[0]].address}));return L([t],u,_.concat(E),i,o,a)}async function He(e,t,n,r,o,i,a){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let c=(e===core.MultiWalletInstruction.NativeTransferIntent?core.getNativeTransferIntentInstructionDataDecoder():core.getTokenTransferIntentInstructionDataDecoder()).decode(t.data),u=t.accounts[0].address.toString(),_=await C(n,r,c.signers.filter(A=>A.__kind==="Secp256r1").map(A=>A.fields[0])),d=e===core.MultiWalletInstruction.NativeTransferIntent?6:18,E=c.signers.filter(A=>A.__kind==="Ed25519").map(A=>({signer:t.accounts[d+A.fields[0]].address}));return L([t],u,_.concat(E),i,o,a)}function Ke(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=core.getCreateUserAccountsInstructionDataDecoder().decode(e.data);for(let r of n.createUserArgs){if(r.member.toString()!==t.publicKey)throw new Error(`Member public key mismatch. Expected: ${t.publicKey}, got: ${r.member.toString()}`);if(r.transactionManagerUrl?.__option==="None")throw new Error("Transaction manager URL cannot be empty when creating user accounts");if(r.transactionManagerUrl?.value!==t.url)throw new Error(`Transaction manager URL mismatch. Expected: ${t.url}, got: ${r.transactionManagerUrl?.value}`)}return null}function $e(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=core.getEditTransactionManagerUrlInstructionDataDecoder().decode(e.data),r=core.convertMemberKeyToString(n.userMutArgs.data.member);if(r!==t.publicKey)throw new Error(`Member public key mismatch. Expected: ${t.publicKey}, got: ${r}`);if(n.transactionManagerUrl!==t.url)throw new Error(`Transaction manager URL mismatch. Expected: ${t.url}, got: ${n.transactionManagerUrl}`);return null}async function Ye(e,t,n,r,o,i,a,s){if(!e.accounts)throw new Error("Invalid instruction accounts");if(!e.data)throw new Error("Invalid instruction data");Bc(e,n);let c=t===core.MultiWalletInstruction.TransactionBufferCreate||t===core.MultiWalletInstruction.TransactionBufferCreateCompressed,u=t===core.MultiWalletInstruction.TransactionBufferCreateCompressed||t===core.MultiWalletInstruction.TransactionExecuteSyncCompressed,_;return c?_=await Fc(e,u,a):_=await kc(e,u,i,r),L(_.instructionsToVerify,_.settingsAddress,_.signers,n,o,s)}function Bc(e,t){let n=e.accounts?.find(r=>r.address.toString()===t.publicKey);if(n&&n.role!==R.READONLY_SIGNER)throw new Error("Transaction Manager should be readonly signer.")}async function Fc(e,t,n){if(!n)throw new Error("Missing transaction message bytes");if(!e.data||!e.accounts)throw new Error("Invalid instruction");let r=w().encode(n);return t?xc(e,r):zc(e,r)}async function xc(e,t){let n=core.getTransactionBufferCreateCompressedInstructionDataDecoder().decode(e.data),r=await U(n.settingsReadonlyArgs,"Settings account is required for compressed transaction buffer create"),o=Fe(n.args.expectedSigners);if(!await we(n.args,t))throw new Error("Hash mismatch.");let a=await xe(t);return {settingsAddress:r,signers:o,instructionsToVerify:a}}async function zc(e,t){let n=core.getTransactionBufferCreateInstructionDataDecoder().decode(e.data),r=e.accounts[0].address.toString(),o=Fe(n.args.expectedSigners);if(!await we(n.args,t))throw new Error("Hash mismatch.");let a=await xe(t);return {settingsAddress:r,signers:o,instructionsToVerify:a}}async function kc(e,t,n,r){if(!e.data||!e.accounts)throw new Error("Invalid instruction");return t?Vc(e,n,r):Wc(e,n,r)}async function Vc(e,t,n){if(!e.accounts)throw new Error("Invalid instruction accounts.");let r=core.getTransactionExecuteSyncCompressedInstructionDataDecoder().decode(e.data),o=await U(r.settingsMutArgs,"Settings account is required for compressed transaction execute"),i=await C(t,n,r.signers.filter(u=>u.__kind==="Secp256r1").map(u=>u.fields[0])),a=3,s=r.signers.filter(u=>u.__kind==="Ed25519").map(u=>({signer:e.accounts[a+u.fields[0]].address})),c=ze(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:i.concat(s),instructionsToVerify:c}}async function Wc(e,t,n){if(!e.accounts)throw new Error("Invalid instruction accounts.");let r=core.getTransactionExecuteSyncInstructionDataDecoder().decode(e.data),o=e.accounts[0].address.toString(),i=await C(t,n,r.signers.filter(u=>u.__kind==="Secp256r1").map(u=>u.fields[0])),a=3,s=r.signers.filter(u=>u.__kind==="Ed25519").map(u=>({signer:e.accounts[a+u.fields[0]].address})),c=ze(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:i.concat(s),instructionsToVerify:c}}async function $c(e,t,n){let{transaction:r,transactionMessageBytes:o,authResponses:i}=t,{messageBytes:a}=Zt().decode(w().encode(r)),s=$t().decode(a),{instructions:c}=await ke(s,core.getSolanaRpc()),u=Yc(c),_=(await Promise.all(c.map((d,E)=>Xc(d,e,E,i,u,o,n)))).filter(d=>d!==null);return {messageBytes:new Uint8Array(a),verificationResults:_}}function Yc(e){return e.map((t,n)=>({instruction:t,instructionIndex:n})).filter(({instruction:t})=>t.programAddress.toString()===Be).map(({instructionIndex:t,instruction:n})=>({instructionIndex:t,data:n.data}))}async function Xc(e,t,n,r,o,i,a){let s=e.programAddress.toString();if(!fn.has(s))throw new Error("Instruction rejected by Transaction Manager.");if(!e.data)throw new Error("Invalid instruction data.");if(s===k.toString()){if(Pe({data:e.data})!==j.AdvanceNonceAccount)throw new Error("Instruction rejected by Transaction Manager.");return null}if(s!==core.MULTI_WALLET_PROGRAM_ADDRESS.toString())return null;let c=core.identifyMultiWalletInstruction({data:e.data});return jc(e,c,t,n,r,o,i,a)}async function jc(e,t,n,r,o,i,a,s){switch(t){case core.MultiWalletInstruction.DecompressSettingsAccount:case core.MultiWalletInstruction.TransactionBufferClose:case core.MultiWalletInstruction.TransactionBufferCloseCompressed:return null;case core.MultiWalletInstruction.ChangeConfig:return We(e,i,r,o,n,s);case core.MultiWalletInstruction.ChangeConfigCompressed:return Ve(e,i,r,o,n,s);case core.MultiWalletInstruction.CreateUserAccounts:return Ke(e,n);case core.MultiWalletInstruction.EditTransactionManagerUrl:return $e(e,n);case core.MultiWalletInstruction.NativeTransferIntent:case core.MultiWalletInstruction.TokenTransferIntent:return He(t,e,i,r,o,n,s);case core.MultiWalletInstruction.NativeTransferIntentCompressed:case core.MultiWalletInstruction.TokenTransferIntentCompressed:return Ge(t,e,i,r,o,n,s);case core.MultiWalletInstruction.TransactionBufferCreate:case core.MultiWalletInstruction.TransactionBufferCreateCompressed:case core.MultiWalletInstruction.TransactionExecuteSync:case core.MultiWalletInstruction.TransactionExecuteSyncCompressed:return Ye(e,t,n,r,o,i,a,s);default:throw new Error("Instruction rejected by transaction manager.")}}/*! Bundled license information:
|
|
6
6
|
|
|
7
7
|
@noble/curves/utils.js:
|
|
8
8
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
9
|
-
*/Object.defineProperty(exports,"initialize",{enumerable:true,get:function(){return core.initialize}});exports.verifyMessage=
|
|
9
|
+
*/Object.defineProperty(exports,"initialize",{enumerable:true,get:function(){return core.initialize}});exports.verifyMessage=_c;exports.verifyTransaction=$c;//# sourceMappingURL=index.cjs.map
|
|
10
10
|
//# sourceMappingURL=index.cjs.map
|