@revibase/transaction-manager 0.0.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/LICENSE +21 -0
- package/README.md +61 -0
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Revibase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
## Installation
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npm install @revibase/wallet
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
This SDK requires a Helius RPC endpoint to connect to the Solana network.
|
|
10
|
+
You can get one from Helius or any other Solana RPC provider that supports Helius features. (DAS API & Photon RPC)
|
|
11
|
+
|
|
12
|
+
## Initialize the SDK
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
import { initializeMultiWallet } from "@revibase/wallet";
|
|
16
|
+
|
|
17
|
+
initializeMultiWallet({
|
|
18
|
+
rpcEndpoint: INSERT_YOUR_HELIUS_RPC_ENDPOINT_HERE
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Use with Solana Wallet Adapter
|
|
23
|
+
|
|
24
|
+
Once initialized, it is now compatible with the Solana Wallet Adapter.
|
|
25
|
+
Simply integrate it into your existing Solana wallet flow.
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
|
|
31
|
+
import { useEffect } from "react";
|
|
32
|
+
import { initializeMultiWallet } from "@revibase/wallet";
|
|
33
|
+
import { ConnectionProvider, WalletProvider } from "@solana/wallet-adapter-react";
|
|
34
|
+
import { WalletModalProvider, WalletMultiButton } from "@solana/wallet-adapter-react-ui";
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export default function App() {
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
initializeMultiWallet({
|
|
41
|
+
rpcEndpoint: INSERT_YOUR_HELIUS_RPC_ENDPOINT_HERE
|
|
42
|
+
});
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<ConnectionProvider endpoint={INSERT_YOUR_HELIUS_RPC_ENDPOINT_HERE}>
|
|
48
|
+
<WalletProvider wallets={[]} autoConnect>
|
|
49
|
+
<WalletModalProvider>
|
|
50
|
+
<div>
|
|
51
|
+
<WalletMultiButton />
|
|
52
|
+
{...}
|
|
53
|
+
</div>
|
|
54
|
+
</WalletModalProvider>
|
|
55
|
+
</WalletProvider>
|
|
56
|
+
</ConnectionProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';var core=require('@revibase/core');var Zt=1,qt=2,Jt=3,Qt=4,en=5,tn=6,nn=7,rn=8,on=9,an=10,sn=-32700,cn=-32603,un=-32602,dn=-32601,_n=-32600,An=-32019,In=-32018,Rn=-32017,En=-32016,ln=-32015,Tn=-32014,gn=-32013,Sn=-32012,fn=-32011,Nn=-32010,On=-32009,Dn=-32008,Cn=-32007,mn=-32006,pn=-32005,hn=-32004,Ln=-32003,Mn=-32002,yn=-32001,W=28e5,K=2800001,Un=2800002,be=2800003,ve=2800004,Pe=2800005,Be=2800006,we=2800007,Fe=2800008,ze=2800009,xe=2800010,ke=2800011,Ve=323e4,$=32300001,Ge=3230002,He=3230003,Y=3230004,bn=361e4,vn=3610001,Pn=3610002,Bn=3610003,wn=3610004,Fn=3610005,zn=3610006,xn=3610007,kn=3611e3,Vn=3704e3,Gn=3704001,Hn=3704002,Wn=3704003,Kn=3704004,$n=4128e3,Yn=4128001,Xn=4128002,jn=4615e3,Zn=4615001,qn=4615002,Jn=4615003,Qn=4615004,er=4615005,tr=4615006,nr=4615007,rr=4615008,or=4615009,ir=4615010,ar=4615011,sr=4615012,cr=4615013,ur=4615014,dr=4615015,_r=4615016,Ar=4615017,Ir=4615018,Rr=4615019,Er=4615020,lr=4615021,Tr=4615022,gr=4615023,Sr=4615024,fr=4615025,Nr=4615026,Or=4615027,Dr=4615028,Cr=4615029,mr=4615030,pr=4615031,hr=4615032,Lr=4615033,Mr=4615034,yr=4615035,Ur=4615036,br=4615037,vr=4615038,Pr=4615039,Br=4615040,wr=4615041,Fr=4615042,zr=4615043,xr=4615044,kr=4615045,Vr=4615046,Gr=4615047,Hr=4615048,Wr=4615049,Kr=4615050,$r=4615051,Yr=4615052,Xr=4615053,jr=4615054,Zr=5508e3,qr=5508001,Jr=5508002,Qr=5508003,eo=5508004,to=5508005,no=5508006,ro=5508007,oo=5508008,io=5508009,ao=5508010,so=5508011,We=5663e3,Ke=5663001,X=5663002,j=5663003,$e=5663004,Z=5663005,q=5663006,J=5663007,Q=5663008,Ye=5663009,co=5663010,uo=5663011,Xe=5663012,_o=5663013,Ao=5663014,je=5663015,Ze=5663016,ee=5663017,Io=5663018,Ro=5663019,qe=5663020,te=5663021,Je=5663022,Eo=705e4,lo=7050001,To=7050002,go=7050003,So=7050004,fo=7050005,No=7050006,Oo=7050007,Do=7050008,Co=7050009,mo=7050010,po=7050011,ho=7050012,Lo=7050013,Mo=7050014,yo=7050015,Uo=7050016,bo=7050017,vo=7050018,Po=7050019,Bo=7050020,wo=7050021,Fo=7050022,zo=7050023,xo=7050024,ko=7050025,Vo=7050026,Go=7050027,Ho=7050028,Wo=7050029,Ko=7050030,$o=7050031,Yo=7050032,Xo=7050033,jo=7050034,Zo=7050035,qo=7050036,Jo=7618e3,Qo=7618001,ei=7618002,ti=7618003,ne=8078e3,re=8078001,Qe=8078002,et=8078003,tt=8078004,nt=8078005,rt=8078006,ni=8078007,ri=8078008,oi=8078009,ii=8078010,ai=8078011,z=8078012,oe=8078013,ie=8078014,si=8078015,ci=8078016,ui=8078017,di=8078018,_i=8078019,ot=8078020,it=8078021,Ai=8078022,at=8078023,Ii=81e5,Ri=8100001,Ei=8100002,li=8100003,Ti=819e4,gi=8190001,Si=8190002,fi=8190003,Ni=8190004,Oi=99e5,Di=9900001,Ci=9900002,mi=9900003,pi=9900004,hi=9900005,Li=9900006;function st(e){return Array.isArray(e)?"%5B"+e.map(st).join("%2C%20")+"%5D":typeof e=="bigint"?`${e}n`:encodeURIComponent(String(e!=null&&Object.getPrototypeOf(e)===null?{...e}:e))}function Mi([e,t]){return `${e}=${st(t)}`}function yi(e){let t=Object.entries(e).map(Mi).join("&");return Buffer.from(t,"utf8").toString("base64")}var Ui={[Ve]:"Account not found at address: $address",[Y]:"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.",[He]:"Expected decoded account at address: $address",[Ge]:"Failed to decode account data at address: $address",[$]:"Accounts not found at addresses: $addresses",[ze]:"Unable to find a viable program address bump seed.",[Un]:"$putativeAddress is not a base58-encoded address.",[W]:"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.",[be]:"The `CryptoKey` must be an `Ed25519` public key.",[ke]:"$putativeOffCurveAddress is not a base58-encoded off-curve address.",[Fe]:"Invalid seeds; point must fall off the Ed25519 curve.",[ve]:"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].",[Be]:"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.",[we]:"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.",[Pe]:"Expected program derived address bump to be in the range [0, 255], got: $bump.",[xe]:"Program address cannot end with PDA marker.",[K]:"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.",[Qt]:"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.",[Zt]:"The network has progressed past the last block for which this transaction could have been committed.",[ne]:"Codec [$codecDescription] cannot decode empty byte arrays.",[Ai]:"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.",[ot]:"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].",[nt]:"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].",[rt]:"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.",[ri]:"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.",[Qe]:"Expected a fixed-size codec, got a variable-size one.",[oe]:"Codec [$codecDescription] expected a positive byte length, got $bytesLength.",[et]:"Expected a variable-size codec, got a fixed-size one.",[_i]:"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].",[re]:"Codec [$codecDescription] expected $expected bytes, got $bytesLength.",[di]:"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].",[oi]:"Invalid discriminated union variant. Expected one of [$variants], got $value.",[ii]:"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.",[si]:"Invalid literal union variant. Expected one of [$variants], got $value.",[ni]:"Expected [$codecDescription] to have $expected items, got $actual.",[z]:"Invalid value $value for base $base with alphabet $alphabet.",[ci]:"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.",[ai]:"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.",[ie]:"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.",[it]:"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].",[ui]:"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.",[at]:"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?",[kn]:"No random values implementation could be found.",[or]:"instruction requires an uninitialized account",[gr]:"instruction tries to borrow reference for an account which is already borrowed",[Sr]:"instruction left account with an outstanding borrowed reference",[lr]:"program other than the account's owner changed the size of the account data",[er]:"account data too small for instruction",[Tr]:"instruction expected an executable account",[Vr]:"An account does not have enough lamports to be rent-exempt",[Hr]:"Program arithmetic overflowed",[kr]:"Failed to serialize or deserialize account data: $encodedData",[jr]:"Builtin programs must consume compute units",[hr]:"Cross-program invocation call depth too deep",[vr]:"Computational budget exceeded",[Nr]:"custom program error: #$code",[Ar]:"instruction contains duplicate accounts",[fr]:"instruction modifications of multiply-passed account differ",[mr]:"executable accounts must be rent exempt",[Dr]:"instruction changed executable accounts data",[Cr]:"instruction changed the balance of an executable account",[Ir]:"instruction changed executable bit of an account",[ur]:"instruction modified data of an account it does not own",[cr]:"instruction spent from the balance of an account it does not own",[Zn]:"generic instruction error",[Kr]:"Provided owner is not allowed",[zr]:"Account is immutable",[xr]:"Incorrect authority provided",[nr]:"incorrect program id for instruction",[tr]:"insufficient funds for instruction",[Qn]:"invalid account data for instruction",[Gr]:"Invalid account owner",[qn]:"invalid program argument",[Or]:"program returned invalid error code",[Jn]:"invalid instruction data",[br]:"Failed to reallocate account data",[Ur]:"Provided seeds do not result in a valid address",[$r]:"Accounts data allocations exceeded the maximum allowed per transaction",[Yr]:"Max accounts exceeded",[Xr]:"Max instruction trace length exceeded",[yr]:"Length of the seed is too long for address generation",[Lr]:"An account required by the instruction is missing",[rr]:"missing required signature for instruction",[sr]:"instruction illegally modified the program id of an account",[Er]:"insufficient account keys for instruction",[Pr]:"Cross-program invocation with unauthorized signer or writable account",[Br]:"Failed to create program execution environment",[Fr]:"Program failed to compile",[wr]:"Program failed to complete",[_r]:"instruction modified data of a read-only account",[dr]:"instruction changed the balance of a read-only account",[Mr]:"Cross-program invocation reentrancy not allowed for this instruction",[Rr]:"instruction modified rent epoch of an account",[ar]:"sum of account balances before and after instruction do not match",[ir]:"instruction requires an initialized account",[jn]:"",[pr]:"Unsupported program id",[Wr]:"Unsupported sysvar",[hi]:"Invalid instruction plan kind: $kind.",[ei]:"The provided instruction plan is empty.",[ti]:"The provided transaction plan failed to execute. See the `transactionPlanResult` attribute and the `cause` error for more details.",[Jo]:"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).",[Li]:"Invalid transaction plan kind: $kind.",[Qo]:"No more instructions to pack; the message packer has completed the instruction plan.",[$n]:"The instruction does not have any accounts.",[Yn]:"The instruction does not have any data.",[Xn]:"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.",[en]:"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.",[qt]:"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`",[Ci]:"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",[pi]:"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.",[Di]:"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",[Oi]:"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",[mi]:"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",[cn]:"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)",[un]:"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)",[_n]:"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)",[dn]:"JSON-RPC error: The method does not exist / is not available ($__serverMessage)",[sn]:"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)",[Sn]:"$__serverMessage",[yn]:"$__serverMessage",[hn]:"$__serverMessage",[Tn]:"$__serverMessage",[Rn]:"Epoch rewards period still active at slot $slot",[Nn]:"$__serverMessage",[On]:"$__serverMessage",[An]:"Failed to query long-term storage; please try again",[En]:"Minimum context slot has not been reached",[pn]:"Node is unhealthy; behind by $numSlotsBehind slots",[Dn]:"No snapshot",[Mn]:"Transaction simulation failed",[In]:"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",[Cn]:"$__serverMessage",[fn]:"Transaction history is not available from this node",[mn]:"$__serverMessage",[gn]:"Transaction signature length mismatch",[Ln]:"Transaction signature verification failure",[ln]:"$__serverMessage",[Vn]:"Key pair bytes must be of length 64, got $byteLength.",[Gn]:"Expected private key bytes with length 32. Actual length: $actualLength.",[Hn]:"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.",[Kn]:"The provided private key does not match the provided public key.",[Wn]:"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.",[tn]:"Lamports value must be in the range [0, 2e64-1]",[nn]:"`$value` cannot be parsed as a `BigInt`",[an]:"$message",[rn]:"`$value` cannot be parsed as a `Number`",[Jt]:"No nonce account could be found at address `$nonceAccountAddress`",[Ti]:"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.",[Si]:"WebSocket was closed before payload could be added to the send buffer",[fi]:"WebSocket connection closed",[Ni]:"WebSocket failed to connect",[gi]:"Failed to obtain a subscription id from the server",[li]:"Could not find an API plan for RPC method: `$method`",[Ii]:"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`.",[Ei]:"HTTP error ($statusCode): $message",[Ri]:"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.",[Zr]:"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.",[qr]:"The provided value does not implement the `KeyPairSigner` interface",[Qr]:"The provided value does not implement the `MessageModifyingSigner` interface",[eo]:"The provided value does not implement the `MessagePartialSigner` interface",[Jr]:"The provided value does not implement any of the `MessageSigner` interfaces",[no]:"The provided value does not implement the `TransactionModifyingSigner` interface",[ro]:"The provided value does not implement the `TransactionPartialSigner` interface",[oo]:"The provided value does not implement the `TransactionSendingSigner` interface",[to]:"The provided value does not implement any of the `TransactionSigner` interfaces",[io]:"More than one `TransactionSendingSigner` was identified.",[ao]:"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.",[so]:"Wallet account signers do not support signing multiple messages/transactions in a single operation",[xn]:"Cannot export a non-extractable key.",[vn]:"No digest implementation could be found.",[bn]:"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.",[Pn]:`This runtime does not support the generation of Ed25519 key pairs.
|
|
2
|
+
|
|
3
|
+
Install @solana/webcrypto-ed25519-polyfill and call its \`install\` function before generating keys in environments that do not support Ed25519.
|
|
4
|
+
|
|
5
|
+
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.`,[Bn]:"No signature verification implementation could be found.",[wn]:"No key generation implementation could be found.",[Fn]:"No signing implementation could be found.",[zn]:"No key export implementation could be found.",[on]:"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given",[Uo]:"Transaction processing left an account with an outstanding borrowed reference",[lo]:"Account in use",[To]:"Account loaded twice",[go]:"Attempt to debit an account but found no record of a prior credit.",[zo]:"Transaction loads an address table account that doesn't exist",[Oo]:"This transaction has already been processed",[Do]:"Blockhash not found",[Co]:"Loader call chain is too deep",[yo]:"Transactions are currently disabled due to cluster maintenance",[Ko]:"Transaction contains a duplicate instruction ($index) that is not allowed",[fo]:"Insufficient funds for fee",[$o]:"Transaction results in an account ($accountIndex) with insufficient funds for rent",[No]:"This account may not be used to pay transaction fees",[po]:"Transaction contains an invalid account reference",[ko]:"Transaction loads an address table account with invalid data",[Vo]:"Transaction address table lookup uses an invalid index",[xo]:"Transaction loads an address table account with an invalid owner",[Xo]:"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.",[Lo]:"This program may not be used for executing instructions",[Go]:"Transaction leaves an account with a lower balance than rent-exempt minimum",[Po]:"Transaction loads a writable account that cannot be written",[Yo]:"Transaction exceeded max loaded accounts data size cap",[mo]:"Transaction requires a fee but has no signature present",[So]:"Attempt to load a program that does not exist",[Zo]:"Execution of the program referenced by account at index $accountIndex is temporarily restricted.",[jo]:"ResanitizationNeeded",[Mo]:"Transaction failed to sanitize accounts offsets correctly",[ho]:"Transaction did not pass signature verification",[Fo]:"Transaction locked too many accounts",[qo]:"Sum of account balances before and after transaction do not match",[Eo]:"The transaction failed with the error `$errorName`",[vo]:"Transaction version is unsupported",[wo]:"Transaction would exceed account data limit within the block",[Wo]:"Transaction would exceed total account data limit",[Bo]:"Transaction would exceed max account limit within the block",[bo]:"Transaction would exceed max Block Cost Limit",[Ho]:"Transaction would exceed max Vote Cost Limit",[je]:"Attempted to sign a transaction with an address that is not a signer for it",[co]:"Transaction is missing an address at index: $index.",[Ze]:"Transaction has no expected signers therefore it cannot be encoded",[qe]:"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes",[X]:"Transaction does not have a blockhash lifetime",[j]:"Transaction is not a durable nonce transaction",[Z]:"Contents of these address lookup tables unknown: $lookupTableAddresses",[q]:"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",[Q]:"No fee payer set in CompiledTransaction",[J]:"Could not find program address at index $index",[Io]:"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",[Ro]:"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",[uo]:"Transaction is missing a fee payer.",[Xe]:"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.",[Ao]:"Transaction first instruction is not advance nonce account instruction.",[_o]:"Transaction with no instructions cannot be durable nonce transaction.",[We]:"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees",[Ke]:"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable",[ee]:"The transaction message expected the transaction to have $numRequiredSignatures signatures, got $signaturesLength.",[Ye]:"Transaction is missing signatures for addresses: $addresses.",[$e]:"Transaction version must be in the range [0, 127]. `$actualVersion` given",[te]:"This version of Kit does not support decoding transactions with version $unsupportedVersion. The current max supported version is 0.",[Je]:"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."},f="i",T="t";function bi(e,t={}){let n=Ui[e];if(n.length===0)return "";let r;function o(i){if(r[T]===2){let s=n.slice(r[f]+1,i);a.push(s in t?`${t[s]}`:`$${s}`);}else r[T]===1&&a.push(n.slice(r[f],i));}let a=[];return n.split("").forEach((i,s)=>{if(s===0){r={[f]:0,[T]:n[0]==="\\"?0:n[0]==="$"?2:1};return}let c;switch(r[T]){case 0:c={[f]:s,[T]:1};break;case 1:i==="\\"?c={[f]:s,[T]:0}:i==="$"&&(c={[f]:s,[T]:2});break;case 2:i==="\\"?c={[f]:s,[T]:0}:i==="$"?c={[f]:s,[T]:2}:i.match(/\w/)||(c={[f]:s,[T]:1});break}c&&(r!==c&&o(s),r=c);}),o(),a.join("")}function vi(e,t={}){if(process.env.NODE_ENV!=="production")return bi(e,t);{let n=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(n+=` '${yi(t)}'`),`${n}\``}}var _=class extends Error{cause=this.cause;context;constructor(...[e,t]){let n,r;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([a,i])=>{a==="cause"?r={cause:i.value}:(n===void 0&&(n={}),Object.defineProperty(n,a,i));});let o=vi(e,n);super(o,r),this.context=n===void 0?{}:n,this.context.__code=e,this.name="SolanaError";}};function Pi(e,t){if(e.length>=t)return e;let n=new Uint8Array(t).fill(0);return n.set(e),n}var Bi=(e,t)=>Pi(e.length<=t?e:e.slice(0,t),t);function ut(e,t){return "fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function y(e){return Object.freeze({...e,encode:t=>{let n=new Uint8Array(ut(t,e));return e.write(t,n,0),n}})}function A(e){return Object.freeze({...e,decode:(t,n=0)=>e.read(t,n)[0]})}function N(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function dt(e,t,n=0){if(t.length-n<=0)throw new _(ne,{codecDescription:e})}function v(e,t,n,r=0){let o=n.length-r;if(o<t)throw new _(re,{bytesLength:o,codecDescription:e,expected:t})}function ct(e,t,n){if(t<0||t>n)throw new _(ie,{bytesLength:n,codecDescription:e,offset:t})}function _t(e,t){let n=(i,s)=>{let[c,u]=t.read(i,s),d=Number(c);return s=u,(s>0||i.length>d)&&(i=i.slice(s,s+d)),v("addDecoderSizePrefix",d,i),[e.decode(i),s+d]};if(N(t)&&N(e))return A({...e,fixedSize:t.fixedSize+e.fixedSize,read:n});let r=N(t)?t.fixedSize:t.maxSize??null,o=N(e)?e.fixedSize:e.maxSize??null,a=r!==null&&o!==null?r+o:null;return A({...e,...a!==null?{maxSize:a}:{},read:n})}function p(e,t){return A({fixedSize:t,read:(n,r)=>{v("fixCodecSize",t,n,r),(r>0||n.length>t)&&(n=n.slice(r,r+t)),N(e)&&(n=Bi(n,e.fixedSize));let[o]=e.read(n,0);return [o,r+t]}})}function wi(e,t){return A({...e,read:(n,r)=>{let o=u=>Fi(u,n.length),a=t.preOffset?t.preOffset({bytes:n,preOffset:r,wrapBytes:o}):r;ct("offsetDecoder",a,n.length);let[i,s]=e.read(n,a),c=t.postOffset?t.postOffset({bytes:n,newPreOffset:a,postOffset:s,preOffset:r,wrapBytes:o}):s;return ct("offsetDecoder",c,n.length),[i,c]}})}function Fi(e,t){return t===0?0:(e%t+t)%t}function zi(e,t){if(N(e)){let n=t(e.fixedSize);if(n<0)throw new _(oe,{bytesLength:n,codecDescription:"resizeDecoder"});return A({...e,fixedSize:n})}return e}function At(e,t){return wi(zi(e,n=>n+t),{postOffset:({postOffset:n})=>n+t})}function U(e,t){return A({...e,read:(n,r)=>{let[o,a]=e.read(n,r);return [t(o,n,r),a]}})}function Et(e,t,n=t){if(!t.match(new RegExp(`^[${e}]*$`)))throw new _(z,{alphabet:e,base:e.length,value:n})}var xi=e=>y({getSizeFromValue:t=>{let[n,r]=It(t,e[0]);if(!r)return t.length;let o=Rt(r,e);return n.length+Math.ceil(o.toString(16).length/2)},write(t,n,r){if(Et(e,t),t==="")return r;let[o,a]=It(t,e[0]);if(!a)return n.set(new Uint8Array(o.length).fill(0),r),r+o.length;let i=Rt(a,e),s=[];for(;i>0n;)s.unshift(Number(i%256n)),i/=256n;let c=[...Array(o.length).fill(0),...s];return n.set(c,r),r+c.length}}),ki=e=>A({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 a=e[0].repeat(o);if(o===r.length)return [a,t.length];let i=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=Vi(i,e);return [a+s,t.length]}});function It(e,t){let[n,r]=e.split(new RegExp(`((?!${t}).*)`));return [n,r]}function Rt(e,t){let n=BigInt(t.length),r=0n;for(let o of e)r*=n,r+=BigInt(t.indexOf(o));return r}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 lt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",h=()=>xi(lt),Tt=()=>ki(lt);var Gi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b=()=>y({getSizeFromValue:e=>Buffer.from(e,"base64").length,write(e,t,n){Et(Gi,e.replace(/=/g,""));let r=Buffer.from(e,"base64");return t.set(r,n),r.length+n}});function Hi(e){return !("exists"in e)||"exists"in e&&e.exists}function gt(e){let t=e.filter(n=>Hi(n)&&n.data instanceof Uint8Array);if(t.length>0){let n=t.map(r=>r.address);throw new _(Y,{addresses:n})}}function Wi(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=b().encode(t.data[0]);return Object.freeze({...St(t),address:e,data:n,exists:true})}function Ki(e,t){if(!t)return Object.freeze({address:e,exists:false});let n=t.data.parsed.info;return Object.freeze({...St(t),address:e,data:n,exists:true})}function St(e){return Object.freeze({executable:e.executable,lamports:e.lamports,programAddress:e.owner,space:e.space})}async function ft(e,t,n={}){let{abortSignal:r,...o}=n;return (await e.getMultipleAccounts(t,{...o,encoding:"jsonParsed"}).send({abortSignal:r})).value.map((i,s)=>i&&typeof i=="object"&&"parsed"in i.data?Ki(t[s],i):Wi(t[s],i))}function Nt(e){let t=e.filter(n=>!n.exists);if(t.length>0){let n=t.map(r=>r.address);throw new _($,{addresses:n})}}var ae,se;function $i(){return ae||(ae=h()),ae}function Yi(){return se||(se=Tt()),se}function x(e){if(e.length<32||e.length>44)throw new _(K,{actualLength:e.length});let r=$i().encode(e).byteLength;if(r!==32)throw new _(W,{actualLength:r})}function B(e){return x(e),e}function w(){return p(Yi(),32)}function Xi(e){return e?.endian!==1}function Ot(e){return A({fixedSize:e.size,read(t,n=0){dt(e.name,t,n),v(e.name,e.size,t,n);let r=new DataView(ji(t,n,e.size));return [e.get(r,Xi(e.config)),n+e.size]}})}function ji(e,t,n){let r=e.byteOffset+(t??0),o=n??e.byteLength;return e.buffer.slice(r,r+o)}var g=()=>A({maxSize:3,read:(e,t)=>{let n=0,r=0;for(;++r;){let o=r-1,a=e[t+o],i=127&a;if(n|=i<<o*7,(a&128)===0)break}return [n,t+r]}});var Dt=(e={})=>Ot({config:e,get:(t,n)=>t.getUint32(0,n),name:"u32",size:4});var C=()=>Ot({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 de(e){return N(e)?e.fixedSize:null}function _e(e){return N(e)?e.fixedSize:e.maxSize??null}function O(e,t={}){let n=t.size??Dt(),r=de(e),o=Ct(n,r),a=Ct(n,_e(e))??void 0;return A({...o!==null?{fixedSize:o}:{maxSize:a},read:(i,s)=>{let c=[];if(typeof n=="object"&&i.slice(s).length===0)return [c,s];if(n==="remainder"){for(;s<i.length;){let[I,l]=e.read(i,s);s=l,c.push(I);}return [c,s]}let[u,d]=typeof n=="number"?[n,s]:n.read(i,s);s=d;for(let I=0;I<u;I+=1){let[l,S]=e.read(i,s);s=S,c.push(l);}return [c,s]}})}function Ct(e,t){return typeof e!="number"?null:e===0?0:t===null?null:t*e}function F(){return A({read:(e,t)=>{let n=e.slice(t);return [n,t+n.length]}})}function mt(e){let t=k(e.map(de)),n=k(e.map(_e))??void 0;return A({...t===null?{maxSize:n}:{fixedSize:t},read:(r,o)=>{let a=[];return e.forEach(i=>{let[s,c]=i.read(r,o);a.push(s),o=c;}),[a,o]}})}function L(e){let t=e.map(([,o])=>o),n=k(t.map(de)),r=k(t.map(_e))??void 0;return A({...n===null?{maxSize:r}:{fixedSize:n},read:(o,a)=>{let i={};return e.forEach(([s,c])=>{let[u,d]=c.read(o,a);a=d,i[s]=u;}),[i,a]}})}function pt(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 ta(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 na=e=>A({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 a=e[0].repeat(o);if(o===r.length)return [a,t.length];let i=r.slice(o).reduce((c,u)=>c*256n+BigInt(u),0n),s=ra(i,e);return [a+s,t.length]}});function ra(e,t){let n=BigInt(t.length),r=[];for(;e>0n;)r.unshift(t[Number(e%n)]),e/=n;return r.join("")}var oa="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var ia=()=>na(oa);var Ae;function aa(){if(!Ae){let e=O(C(),{size:g()});Ae=L([["lookupTableAddress",w()],["writableIndexes",e],["readonlyIndexes",e]]);}return Ae}var Ie;function Re(){return Ie||(Ie=C()),Ie}function sa(){return L([["numSignerAccounts",Re()],["numReadonlySignerAccounts",Re()],["numReadonlyNonSignerAccounts",Re()]])}var Ee;function ca(){return Ee||(Ee=U(L([["programAddressIndex",C()],["accountIndices",O(C(),{size:g()})],["data",_t(F(),g())]]),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}})),Ee}var ua=0,Lt=128;function le(){return A({maxSize:1,read:(e,t)=>{let n=e[t];if((n&Lt)===0)return ["legacy",t];{let r=n^Lt;if(r>ua)throw new _(te,{unsupportedVersion:r});return [r,t+1]}}})}function da(){return [["version",le()],["header",sa()],["staticAccounts",O(w(),{size:g()})],["lifetimeToken",p(ia(),32)],["instructions",O(ca(),{size:g()})],["addressTableLookups",_a()]]}function _a(){return O(aa(),{size:g()})}function yt(){return U(L(da()),({addressTableLookups:e,...t})=>t.version==="legacy"||!e?.length?t:{...t,addressTableLookups:e})}function Aa(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var Ut="SysvarRecentB1ockHashes11111111111111111111",bt="11111111111111111111111111111111";function Mt(e,t){return {accounts:[{address:e,role:R.WRITABLE},{address:Ut,role:R.READONLY},{address:t,role:R.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:bt}}function Te(e){return e.programAddress===bt&&e.data!=null&&Ia(e.data)&&e.accounts?.length===3&&e.accounts[0].address!=null&&e.accounts[0].role===R.WRITABLE&&e.accounts[1].address===Ut&&e.accounts[1].role===R.READONLY&&e.accounts[2].address!=null&&ht(e.accounts[2].role)}function Ia(e){return e.byteLength===4&&e[0]===4&&e[1]===0&&e[2]===0&&e[3]===0}function vt(e){return "lifetimeConstraint"in e&&typeof e.lifetimeConstraint.nonce=="string"&&e.instructions[0]!=null&&Te(e.instructions[0])}function Ra(e,t,n){return e.accounts[0].address===t&&e.accounts[2].address===n}function Ea({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:n},r){let o,a=r.instructions[0];if(a&&Te(a))if(Ra(a,t,n)){if(vt(r)&&r.lifetimeConstraint.nonce===e)return r;o=[a,...r.instructions.slice(1)];}else o=[Object.freeze(Mt(t,n)),...r.instructions.slice(1)];else o=[Object.freeze(Mt(t,n)),...r.instructions];return Object.freeze({...r,instructions:Object.freeze(o),lifetimeConstraint:Object.freeze({nonce:e})})}function la(e,t){if("feePayer"in t&&e===t.feePayer?.address&&Ta(t.feePayer))return t;let n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function Ta(e){return !!e&&"address"in e&&typeof e.address=="string"&&Object.keys(e).length===1}function ga(e,t){return Sa([e],t)}function Sa(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function fa(e){let{header:t}=e,n=t.numSignerAccounts-t.numReadonlySignerAccounts,r=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,o=[],a=0;for(let i=0;i<n;i++)o.push({address:e.staticAccounts[a],role:R.WRITABLE_SIGNER}),a++;for(let i=0;i<t.numReadonlySignerAccounts;i++)o.push({address:e.staticAccounts[a],role:R.READONLY_SIGNER}),a++;for(let i=0;i<r;i++)o.push({address:e.staticAccounts[a],role:R.WRITABLE}),a++;for(let i=0;i<t.numReadonlyNonSignerAccounts;i++)o.push({address:e.staticAccounts[a],role:R.READONLY}),a++;return o}function Na(e,t){let r=e.map(i=>i.lookupTableAddress).filter(i=>t[i]===void 0);if(r.length>0)throw new _(Z,{lookupTableAddresses:r});let o=[],a=[];for(let i of e){let s=t[i.lookupTableAddress],c=i.readonlyIndexes,u=i.writableIndexes,d=Math.max(...c,...u);if(d>=s.length)throw new _(q,{highestKnownIndex:s.length-1,highestRequestedIndex:d,lookupTableAddress:i.lookupTableAddress});let I=c.map(S=>({address:s[S],addressIndex:S,lookupTableAddress:i.lookupTableAddress,role:R.READONLY}));o.push(...I);let l=u.map(S=>({address:s[S],addressIndex:S,lookupTableAddress:i.lookupTableAddress,role:R.WRITABLE}));a.push(...l);}return [...a,...o]}function Oa(e,t){let n=t[e.programAddressIndex]?.address;if(!n)throw new _(J,{index:e.programAddressIndex});let r=e.accountIndices?.map(a=>t[a]),{data:o}=e;return Object.freeze({programAddress:n,...r&&r.length?{accounts:Object.freeze(r)}:{},...o&&o.length?{data:o}:{}})}function Da(e,t,n){if(!t||!Te(t))return {blockhash:e,lastValidBlockHeight:n??2n**64n-1n};{let r=t.accounts[0].address;x(r);let o=t.accounts[2].address;return x(o),{nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:o}}}function Pt(e,t){let n=e.staticAccounts[0];if(!n)throw new _(Q);let r=fa(e),o="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?Na(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[],a=[...r,...o],i=e.instructions.map(u=>Oa(u,a)),s=i[0],c=Da(e.lifetimeToken,s,t?.lastValidBlockHeight);return pt(Aa({version:e.version}),u=>la(n,u),u=>i.reduce((d,I)=>ga(I,d),u),u=>"blockhash"in c?ta(c,u):Ea(c,u))}function Bt(){return U(L([["signatures",O(p(F(),64),{size:g()})],["messageBytes",F()]]),Ca)}function Ca(e){let{messageBytes:t,signatures:n}=e,r=mt([le(),At(C(),2),O(w(),{size:g()})]),[o,a,i]=r.decode(t),s=i.slice(0,a);if(s.length!==n.length)throw new _(ee,{numRequiredSignatures:a,signaturesLength:n.length,signerAddresses:s});let c={};return s.forEach((u,d)=>{let I=n[d];I.every(l=>l===0)?c[u]=null:c[u]=I;}),{messageBytes:t,signatures:Object.freeze(c)}}async function ge(e,t,n){if(e.length===0)return {};let r=await ft(t,e,n);return gt(r),Nt(r),r.reduce((o,a)=>({...o,[a.address]:a.data.addresses}),{})}var V="ComputeBudget111111111111111111111111111111";var wt="MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";var Se="Secp256r1SigVerify1111111111111111111111111",Ft=new Set([V,core.MULTI_WALLET_PROGRAM_ADDRESS,Se,wt]),G="2c1LgZfCun82niPCgfg2cTMZmAiahraTjY4KNb1BSU4Z";function zt(){return {[B(G)]:["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)}}var Ns=3e5,kt=new Map;function Vt(e,t){if(e.length!==t.length)return false;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return false;return true}async function Gt(e,t,n,r){let o=new Uint8Array(h().encode(e)),a=new Uint8Array(h().encode(n)),i=await crypto.subtle.importKey("raw",a,{name:"Ed25519"},false,["verify"]);if(!await crypto.subtle.verify({name:"Ed25519"},i,o,t))throw new Error(r)}async function Ht(e,t){e&&await Gt(e.signature,t,e.publicKey,`Auth Provider signature verification failed for auth provider id: "${e.publicKey}".`);}async function Wt(e,t){await Gt(e.signature,t,e.publicKey,`Device signature verification failed for device id: "${e.publicKey}".`);}async function Os(e){let t=Date.now(),n=kt.get(e);if(n&&t-n.timestamp<Ns)return {publicKey:n.publicKey};let r=await fetch(`${e}/.well-known/revibase.json`);if(!r.ok)throw new Error(`Failed to fetch well-known for ${e}`);let o=await r.json();if(!o?.publicKey)throw new Error(`Invalid well-known response from ${e}`);return kt.set(e,{publicKey:o.publicKey,timestamp:t}),o}async function Kt(e,t){let{publicKey:n}=await Os(e.clientOrigin),r=await crypto.subtle.importKey("jwk",n,{name:"Ed25519"},true,["verify"]),o=new Uint8Array(h().encode(e.signature));if(!await crypto.subtle.verify({name:"Ed25519"},r,o,new Uint8Array(t)))throw new Error(`Client signature verification failed for client: "${e.clientOrigin}".`)}async function $t(e,t){let{authResponse:n,transactionPayload:r,slotHash:o,slotNumber:a,deviceSignature:i,clientSignature:s,nonce:c}=e,{response:u}=n,d=core.base64URLStringToBuffer(u.clientDataJSON),I=JSON.parse(new TextDecoder().decode(d)),{challenge:l}=await core.createTransactionChallenge(r,s.clientOrigin,i.publicKey,c,o,a),S=new Uint8Array(core.base64URLStringToBuffer(I.challenge));if(!Vt(S,l))throw new Error("Invalid challenge");let jt=core.getSecp256r1MessageHash(n);if(!Vt(jt,t))throw new Error("Invalid message hash")}async function Yt(e){let t=await crypto.subtle.digest("SHA-256",e);return new Uint8Array(t)}function Ms(e,t){if(e.length!==t.length)return false;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return false;return true}async function D(e,t,n){if(!e)return [];let r=e.find(a=>a.instructionIndex===t-1)?.data;if(!r)return [];let{payload:o}=core.getSecp256r1VerifyInstructionDataDecoder().decode(r);return Promise.all(n.map(async a=>{let i=o[a.verifyArgs.signedMessageIndex],s=await Yt(new Uint8Array(i.message));return {signer:new core.Secp256r1Key(new Uint8Array(i.publicKey)).toString(),messageHash:s}}))}function fe(e){return e.map(t=>({signer:core.convertMemberKeyToString(t.memberKey),messageHash:new Uint8Array(t.messageHash)}))}async function m(e,t,n,r){if(!r)throw new Error("Transaction Auth Response is missing");if(n.length!==r.length)throw new Error("Signer and auth response length mismatch");let o=await core.getWalletAddressFromSettings(B(t)),a=await Promise.all(n.map(async({signer:i,messageHash:s},c)=>{let u=r[c],{clientSignature:d,deviceSignature:I,authProviderSignature:l}=u;return await Promise.all([$t(u,s),Ht(l,s),Kt(d,s),Wt(I,s)]),{signer:i,client:d.clientOrigin,device:I.publicKey,authProvider:l?.publicKey,walletAddress:o}}));return {instructions:e,verifiedSigners:a}}async function Ne(e,t){let n=await Yt(t);return Ms(new Uint8Array(e.finalBufferHash),n)}async function M(e,t){let n=e?.data?.data;if(!n||n.__option==="None")throw new Error(t);return core.getSettingsFromIndex(n.value.index)}async function Oe(e,t){let n=core.vaultTransactionMessageDeserialize(t);return (await Ce(n,e)).instructions}function De(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(a=>r[a]),data:o.data,programAddress:r[o.programAddressIndex].address}))}async function Ce(e,t){let r="addressTableLookups"in e&&e.addressTableLookups!==void 0&&e.addressTableLookups.length>0?e.addressTableLookups.map(a=>a.lookupTableAddress):[],o=r.length>0?await ys(r,t):{};return Pt(e,{addressesByLookupTableAddress:o})}async function ys(e,t){if(e.some(r=>r.toString()===G)){let r=e.filter(o=>o.toString()!==G);return {...zt(),...await ge(r,t)}}return ge(e,t)}async function me(e,t,n,r){if(!e.data)throw new Error("Invalid instruction data.");let o=core.getChangeConfigCompressedInstructionDataDecoder().decode(e.data),a=await M(o.settingsMutArgs,"Invalid instruction data. Settings not found."),i=await D(t,n,o.secp256r1VerifyArgs);return m([e],a,i,r)}async function pe(e,t,n,r){if(!e.data)throw new Error("Invalid instruction data.");if(!e.accounts)throw new Error("Invalid instruction accounts.");let o=core.getChangeConfigInstructionDataDecoder().decode(e.data),a=await D(t,n,o.secp256r1VerifyArgs);return m([e],e.accounts[0].address.toString(),a,r)}async function he(e,t,n,r,o){if(!t.data)throw new Error("Invalid instruction data.");let i=(e===core.MultiWalletInstruction.NativeTransferIntentCompressed?core.getNativeTransferIntentCompressedInstructionDataDecoder():core.getTokenTransferIntentCompressedInstructionDataDecoder()).decode(t.data),s=await M(i.settingsMutArgs,"Invalid instruction data. Settings not found."),c=await D(n,r,i.secp256r1VerifyArgs);return m([t],s,c,o)}async function Le(e,t,n,r,o){if(!t.data)throw new Error("Invalid instruction data.");if(!t.accounts)throw new Error("Invalid instruction accounts.");let i=(e===core.MultiWalletInstruction.NativeTransferIntent?core.getNativeTransferIntentInstructionDataDecoder():core.getTokenTransferIntentInstructionDataDecoder()).decode(t.data),s=await D(n,r,i.secp256r1VerifyArgs);return m([t],t.accounts[0].address.toString(),s,o)}function Me(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(`Public Key does not match ${t.publicKey}`);if(r.transactionManagerUrl?.__option==="None")throw new Error("Transaction endpoint cannot be empty");if(r.transactionManagerUrl?.value!==t.url)throw new Error(`Transaction endpoint not equal to ${t.url}`)}return null}function ye(e,t){if(!e.data)throw new Error("Invalid instruction data");let n=core.getEditTransactionManagerUrlInstructionDataDecoder().decode(e.data);if(core.convertMemberKeyToString(n.userMutArgs.data.member)!==t.publicKey)throw new Error(`Public Key does not match ${t.publicKey}`);if(n.transactionManagerUrl!==t.url)throw new Error(`Transaction endpoint not equal to ${t.url}`);return null}async function Ue(e,t,n,r,o,a,i,s){if(!t.accounts)throw new Error("Invalid instruction accounts");if(!t.data)throw new Error("Invalid instruction data");Ws(t,r);let c=n===core.MultiWalletInstruction.TransactionBufferCreate||n===core.MultiWalletInstruction.TransactionBufferCreateCompressed,u=n===core.MultiWalletInstruction.TransactionBufferCreateCompressed||n===core.MultiWalletInstruction.TransactionExecuteSyncCompressed,d;return c?d=await Ks(e,t,u,s):d=await Xs(t,u,i,o),m(d.instructionsToVerify,d.settingsAddress,d.signers,a)}function Ws(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 Ks(e,t,n,r){if(!r)throw new Error("Missing transaction message bytes");if(!t.data||!t.accounts)throw new Error("Invalid instruction");let o=new Uint8Array(b().encode(r));return n?$s(e,t,o):Ys(e,t,o)}async function $s(e,t,n){let r=core.getTransactionBufferCreateCompressedInstructionDataDecoder().decode(t.data),o=await M(r.settingsReadonlyArgs,"Settings account is required for compressed transaction buffer create"),a=fe(r.args.expectedSecp256r1Signers);if(!await Ne(r.args,n))throw new Error("Hash mismatch.");let s=await Oe(e,n);return {settingsAddress:o,signers:a,instructionsToVerify:s}}async function Ys(e,t,n){let r=core.getTransactionBufferCreateInstructionDataDecoder().decode(t.data),o=t.accounts[0].address.toString(),a=fe(r.args.expectedSecp256r1Signers);if(!await Ne(r.args,n))throw new Error("Hash mismatch.");let s=await Oe(e,n);return {settingsAddress:o,signers:a,instructionsToVerify:s}}async function Xs(e,t,n,r){if(!e.data||!e.accounts)throw new Error("Invalid instruction");return t?js(e,n,r):Zs(e,n,r)}async function js(e,t,n){let r=core.getTransactionExecuteSyncCompressedInstructionDataDecoder().decode(e.data),o=await M(r.settingsMutArgs,"Settings account is required for compressed transaction execute"),a=await D(t,n,r.secp256r1VerifyArgs),i=De(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:a,instructionsToVerify:i}}async function Zs(e,t,n){let r=core.getTransactionExecuteSyncInstructionDataDecoder().decode(e.data),o=e.accounts[0].address.toString(),a=await D(t,n,r.secp256r1VerifyArgs),i=De(e.accounts,r.transactionMessage);return {settingsAddress:o,signers:a,instructionsToVerify:i}}async function Qs(e,t,n,r,o){let{messageBytes:a}=Bt().decode(b().encode(n)),i=yt().decode(a),{instructions:s}=await Ce(i,e),c=ec(s);return (await Promise.all(s.map((d,I)=>tc(e,d,t,I,r,c,o)))).filter(d=>d!==null)}function ec(e){return e.map((t,n)=>({instruction:t,idx:n})).filter(({instruction:t})=>t.programAddress.toString()===Se).map(({idx:t,instruction:n})=>({instructionIndex:t,data:n.data}))}async function tc(e,t,n,r,o,a,i){let s=t.programAddress.toString();if(!Ft.has(s))throw new Error("Instruction rejected by Transaction Manager.");if(s!==core.MULTI_WALLET_PROGRAM_ADDRESS.toString())return null;if(!t.data)throw new Error("Invalid instruction data.");let c=core.identifyMultiWalletInstruction({data:t.data});return nc(e,t,c,n,r,o,a,i)}async function nc(e,t,n,r,o,a,i,s){switch(n){case core.MultiWalletInstruction.DecompressSettingsAccount:case core.MultiWalletInstruction.TransactionBufferClose:case core.MultiWalletInstruction.TransactionBufferCloseCompressed:return null;case core.MultiWalletInstruction.ChangeConfig:return pe(t,i,o,a);case core.MultiWalletInstruction.ChangeConfigCompressed:return me(t,i,o,a);case core.MultiWalletInstruction.CreateUserAccounts:return Me(t,r);case core.MultiWalletInstruction.EditTransactionManagerUrl:return ye(t,r);case core.MultiWalletInstruction.NativeTransferIntent:case core.MultiWalletInstruction.TokenTransferIntent:return Le(n,t,i,o,a);case core.MultiWalletInstruction.NativeTransferIntentCompressed:case core.MultiWalletInstruction.TokenTransferIntentCompressed:return he(n,t,i,o,a);case core.MultiWalletInstruction.TransactionBufferCreate:case core.MultiWalletInstruction.TransactionBufferCreateCompressed:case core.MultiWalletInstruction.TransactionExecuteSync:case core.MultiWalletInstruction.TransactionExecuteSyncCompressed:return Ue(e,t,n,r,o,a,i,s);default:throw new Error("Instruction rejected by transaction manager.")}}
|
|
6
|
+
exports.verifyTransaction=Qs;//# sourceMappingURL=index.cjs.map
|
|
7
|
+
//# sourceMappingURL=index.cjs.map
|