This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Withdraw the lamports from the nonce accounts and close them. | |
* @param nonceAccountPublicKeys List of nonce account public keys | |
* @param nonceAccountAuthorisedPubkey Authorised public key for the nonce accounts | |
* @param nonceAccountToPubkey Public key to withdraw the lamports to | |
* @param txPayerAndSigner Transaction payer and signer | |
*/ | |
const withdrawNonceAccount = async ( | |
nonceAccountPublicKeys: PublicKey[], | |
nonceAccountAuthorisedPubkey: PublicKey, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { QuoteResponse, RoutePlanStep, SwapMode } from "@jup-ag/api"; | |
class RoutePlanStepBuilder { | |
step: RoutePlanStep | |
routePlanBuilder: RoutePlanBuilder; | |
constructor(routePlanBuilder: RoutePlanBuilder) { | |
this.routePlanBuilder = routePlanBuilder; | |
this.step = { | |
percent: 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires AutoHotkey v2.0 | |
CoordMode "Pixel", "Window" | |
CoordMode "Mouse", "Window" | |
HWNDs := WinGetList("ahk_exe RobloxPlayerBeta.exe") | |
wantsMimics := true | |
wantsSecretAgents := false | |
wantsStarGazers := false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ConfirmTransactionFailureError extends Error { | |
constructor(signature: string) { | |
super("Failed to confirm transaction:" + signature); | |
this.name = "ConfirmTransactionFailure"; | |
} | |
} | |
export class TransactionConfirmer { | |
private subscriptionId: number; | |
private signatures = new Map<string, Logs>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { open } from "lmdb"; | |
type lmdb = ReturnType<typeof open> | |
/** | |
* For databases where there are different types stored under different keys in the same DB, this function | |
* allows iteration over the values of that relation. Otherwise, you might return the wrong type. | |
* It can't be used in DBs that do not have a fixed first key for each type stored. | |
* @param db opened lmdb database | |
* @param relation the key that uniquely identifies the type of the object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define a couple of fetchers, one for /quote and one for everything else | |
// if the endpoint url is a QN endpoint, use the custom fetcher that appends the param useQNMarketCache=true | |
export const quoteFetcher = createJupiterApiClient({ | |
basePath: config.jupiter.endpoint, | |
fetchApi: config.jupiter.endpoint.search(/https:\/\/jupiter-swap-api.quiknode.pro\/[A-Z0-9]*/) !== -1 | |
? QuicknodeQuoteFetcherWithCustomAgent(agent) | |
: FetcherWithCustomAgent(agent), | |
}) | |
export const swapInstructionFetcher = createJupiterApiClient({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2024-05-23T03:05:03.015Z] [Main]: Ledger Error [program: Jupiter] [ | |
"Program 11111111111111111111111111111111 invoke [1]", | |
"Program 11111111111111111111111111111111 success", | |
"Program ComputeBudget111111111111111111111111111111 invoke [1]", | |
"Program ComputeBudget111111111111111111111111111111 success", | |
"Program ComputeBudget111111111111111111111111111111 invoke [1]", | |
"Program ComputeBudget111111111111111111111111111111 success", | |
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]", | |
"Program log: CreateIdempotent", | |
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 4338 of 899550 compute units", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getAddressLookupTableAccounts_Uncached = async ( | |
addressLookupTableAddresses: string[] | |
): Promise<AddressLookupTableAccount[]> => { | |
const keys = Array.from([...new Set(addressLookupTableAddresses)]); | |
const addressLookupTableAccountInfos = await getAccountInfos(await Promise.all(keys.map(async key => Promise.resolve(new PublicKey(key))))); | |
return await Promise.all( | |
addressLookupTableAccountInfos.map( | |
async (account, index) => { | |
const addressLookupTableAddress = keys[index]; | |
if (addressLookupTableAddress) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
async fetch(request, env) { | |
const url = new URL(request.url); | |
if (url.pathname.startsWith("/api")) { | |
url.pathname = url.pathname.replace("/api", `/${env.API_KEY}`); | |
const upgradeHeader = request.headers.get('Upgrade'); | |
const newUrl = `https://api.sexonsol.com${url.pathname}`; | |
if (upgradeHeader === 'websocket') { | |
const resp = await fetch(newUrl, { | |
headers: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const decodedA = await decodeSwapInstructionData<Route["Arguments"]>(swapinstA.swapInstruction.data); | |
const decodedB = await decodeSwapInstructionData<Route["Arguments"]>(swapinstB.swapInstruction.data); | |
// do whatever you want | |
const Route_AccountsStrict: Route["AccountsStrict"] = { | |
tokenProgram: TOKEN_PROGRAM_ID, | |
userTransferAuthority: keypair.publicKey, | |
userSourceTokenAccount: inputMintATA, | |
userDestinationTokenAccount: inputMintATA, |
NewerOlder