@lifi/sdk 3.14.0-alpha.0 → 3.14.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.
Files changed (89) hide show
  1. package/LICENSE +201 -165
  2. package/package.json +7 -7
  3. package/src/_cjs/core/EVM/EVMStepExecutor.js +14 -11
  4. package/src/_cjs/core/EVM/EVMStepExecutor.js.map +1 -1
  5. package/src/_cjs/core/Solana/SolanaStepExecutor.js +13 -12
  6. package/src/_cjs/core/Solana/SolanaStepExecutor.js.map +1 -1
  7. package/src/_cjs/core/Solana/connection.js +4 -15
  8. package/src/_cjs/core/Solana/connection.js.map +1 -1
  9. package/src/_cjs/core/Solana/jito/JitoConnection.js +51 -21
  10. package/src/_cjs/core/Solana/jito/JitoConnection.js.map +1 -1
  11. package/src/_cjs/core/Solana/jito/constants.js +10 -23
  12. package/src/_cjs/core/Solana/jito/constants.js.map +1 -1
  13. package/src/_cjs/core/Solana/jito/sendAndConfirmBundle.js +36 -84
  14. package/src/_cjs/core/Solana/jito/sendAndConfirmBundle.js.map +1 -1
  15. package/src/_cjs/core/utils.js +0 -5
  16. package/src/_cjs/core/utils.js.map +1 -1
  17. package/src/_cjs/index.js +2 -4
  18. package/src/_cjs/index.js.map +1 -1
  19. package/src/_cjs/request.js +7 -3
  20. package/src/_cjs/request.js.map +1 -1
  21. package/src/_cjs/services/api.js +1 -2
  22. package/src/_cjs/services/api.js.map +1 -1
  23. package/src/_cjs/version.js +1 -1
  24. package/src/_cjs/version.js.map +1 -1
  25. package/src/_esm/core/EVM/EVMStepExecutor.js +11 -8
  26. package/src/_esm/core/EVM/EVMStepExecutor.js.map +1 -1
  27. package/src/_esm/core/Solana/SolanaStepExecutor.js +13 -12
  28. package/src/_esm/core/Solana/SolanaStepExecutor.js.map +1 -1
  29. package/src/_esm/core/Solana/connection.js +7 -20
  30. package/src/_esm/core/Solana/connection.js.map +1 -1
  31. package/src/_esm/core/Solana/jito/JitoConnection.js +72 -23
  32. package/src/_esm/core/Solana/jito/JitoConnection.js.map +1 -1
  33. package/src/_esm/core/Solana/jito/constants.js +10 -23
  34. package/src/_esm/core/Solana/jito/constants.js.map +1 -1
  35. package/src/_esm/core/Solana/jito/sendAndConfirmBundle.js +45 -104
  36. package/src/_esm/core/Solana/jito/sendAndConfirmBundle.js.map +1 -1
  37. package/src/_esm/core/utils.js +0 -11
  38. package/src/_esm/core/utils.js.map +1 -1
  39. package/src/_esm/index.js +0 -1
  40. package/src/_esm/index.js.map +1 -1
  41. package/src/_esm/request.js +7 -3
  42. package/src/_esm/request.js.map +1 -1
  43. package/src/_esm/services/api.js +3 -4
  44. package/src/_esm/services/api.js.map +1 -1
  45. package/src/_esm/version.js +1 -1
  46. package/src/_esm/version.js.map +1 -1
  47. package/src/_types/core/EVM/EVMStepExecutor.d.ts.map +1 -1
  48. package/src/_types/core/Solana/SolanaStepExecutor.d.ts.map +1 -1
  49. package/src/_types/core/Solana/connection.d.ts +4 -3
  50. package/src/_types/core/Solana/connection.d.ts.map +1 -1
  51. package/src/_types/core/Solana/jito/JitoConnection.d.ts +35 -5
  52. package/src/_types/core/Solana/jito/JitoConnection.d.ts.map +1 -1
  53. package/src/_types/core/Solana/jito/constants.d.ts +1 -2
  54. package/src/_types/core/Solana/jito/constants.d.ts.map +1 -1
  55. package/src/_types/core/Solana/jito/sendAndConfirmBundle.d.ts +2 -2
  56. package/src/_types/core/Solana/jito/sendAndConfirmBundle.d.ts.map +1 -1
  57. package/src/_types/core/utils.d.ts +1 -10
  58. package/src/_types/core/utils.d.ts.map +1 -1
  59. package/src/_types/index.d.ts +2 -3
  60. package/src/_types/index.d.ts.map +1 -1
  61. package/src/_types/request.d.ts.map +1 -1
  62. package/src/_types/services/api.d.ts +1 -1
  63. package/src/_types/services/api.d.ts.map +1 -1
  64. package/src/_types/services/types.d.ts +0 -3
  65. package/src/_types/services/types.d.ts.map +1 -1
  66. package/src/_types/types/internal.d.ts +3 -0
  67. package/src/_types/types/internal.d.ts.map +1 -1
  68. package/src/_types/version.d.ts +1 -1
  69. package/src/_types/version.d.ts.map +1 -1
  70. package/src/core/EVM/EVMStepExecutor.ts +12 -7
  71. package/src/core/Solana/SolanaStepExecutor.ts +13 -12
  72. package/src/core/Solana/connection.ts +12 -25
  73. package/src/core/Solana/jito/JitoConnection.ts +97 -29
  74. package/src/core/Solana/jito/constants.ts +10 -25
  75. package/src/core/Solana/jito/sendAndConfirmBundle.ts +50 -135
  76. package/src/core/utils.ts +1 -13
  77. package/src/index.ts +6 -3
  78. package/src/request.ts +9 -3
  79. package/src/services/api.ts +4 -6
  80. package/src/services/types.ts +0 -4
  81. package/src/types/internal.ts +6 -0
  82. package/src/version.ts +1 -1
  83. package/src/_cjs/core/Solana/jito/isJitoRpc.js +0 -23
  84. package/src/_cjs/core/Solana/jito/isJitoRpc.js.map +0 -1
  85. package/src/_esm/core/Solana/jito/isJitoRpc.js +0 -21
  86. package/src/_esm/core/Solana/jito/isJitoRpc.js.map +0 -1
  87. package/src/_types/core/Solana/jito/isJitoRpc.d.ts +0 -2
  88. package/src/_types/core/Solana/jito/isJitoRpc.d.ts.map +0 -1
  89. package/src/core/Solana/jito/isJitoRpc.ts +0 -21
@@ -1,5 +1,4 @@
1
1
  import type { SignatureResult, VersionedTransaction } from '@solana/web3.js'
2
- import bs58 from 'bs58'
3
2
  import { sleep } from '../../../utils/sleep.js'
4
3
  import { getJitoConnections } from '../connection.js'
5
4
 
@@ -13,8 +12,8 @@ export type BundleResult = {
13
12
  * Send and confirm a bundle of transactions using Jito
14
13
  * Automatically selects a Jito-enabled RPC connection and polls for confirmation
15
14
  * across multiple Jito RPCs in parallel
16
- * @param signedTransactions - Array of signed transactions
17
- * @returns Bundle ID, transaction signatures, and confirmation results
15
+ * @param signedTransactions - an Array of signed transactions
16
+ * @returns - {@link BundleResult} object containing Bundle ID, transaction signatures, and confirmation results
18
17
  */
19
18
  export async function sendAndConfirmBundle(
20
19
  signedTransactions: VersionedTransaction[]
@@ -27,147 +26,67 @@ export async function sendAndConfirmBundle(
27
26
  )
28
27
  }
29
28
 
30
- // Validate bundle requirements
31
- if (signedTransactions.length === 0) {
32
- throw new Error('Bundle must contain at least one transaction')
33
- }
34
-
35
- // Check that all transactions have the same blockhash (required for bundles)
36
- const firstBlockhash = signedTransactions[0].message.recentBlockhash
37
- const allSameBlockhash = signedTransactions.every(
38
- (tx) => tx.message.recentBlockhash === firstBlockhash
39
- )
40
-
41
- if (!allSameBlockhash) {
42
- console.warn(
43
- 'Bundle transactions have different blockhashes:',
44
- signedTransactions.map((tx) => tx.message.recentBlockhash)
45
- )
46
- }
47
-
48
- // Extract transaction signatures
49
- const txSignatures = signedTransactions.map((tx, index) => {
50
- if (!tx.signatures[0]) {
51
- throw new Error(
52
- `Transaction signature is missing for transaction at index ${index}.`
53
- )
54
- }
55
- const signature = bs58.encode(tx.signatures[0])
56
- return signature
57
- })
58
-
59
29
  const abortController = new AbortController()
60
- let bundleId: string | null = null
61
30
 
62
- // Try to simulate and send bundle with the first connection
63
- for (const jitoConnection of jitoConnections) {
31
+ const confirmPromises = jitoConnections.map(async (jitoConnection) => {
64
32
  try {
65
- // Simulate bundle first
66
- const simulationResult =
67
- await jitoConnection.simulateBundle(signedTransactions)
68
-
69
- if (simulationResult.value.summary !== 'succeeded') {
70
- const summary = simulationResult.value.summary as {
71
- failed: { error: any; tx_signature: string }
72
- }
73
-
74
- // Extract readable error message from TransactionFailure
75
- const errorMsg =
76
- summary.failed?.error?.TransactionFailure?.[1] ||
77
- JSON.stringify(summary.failed?.error) ||
78
- 'Unknown simulation error'
79
-
80
- throw new Error(`Bundle simulation failed: ${errorMsg}`)
81
- }
82
-
83
- // Send bundle using JitoConnection method
84
- bundleId = await jitoConnection.sendBundle(signedTransactions)
85
- break
86
- } catch (error) {
87
- // Try next connection if this one fails
88
- if (jitoConnection === jitoConnections[jitoConnections.length - 1]) {
89
- throw error
33
+ // Send initial bundle for this connection
34
+ let bundleId: string
35
+ try {
36
+ bundleId = await jitoConnection.sendBundle(signedTransactions)
37
+ } catch (_) {
38
+ return null
90
39
  }
91
- }
92
- }
93
40
 
94
- if (!bundleId) {
95
- throw new Error('Failed to send bundle to any Jito connection')
96
- }
97
-
98
- // Now confirm the bundle across all Jito connections in parallel
99
- const confirmPromises = jitoConnections.map(async (jitoConnection) => {
100
- try {
101
- // Get initial blockhash and block height
102
41
  const [blockhashResult, initialBlockHeight] = await Promise.all([
103
42
  jitoConnection.getLatestBlockhash('confirmed'),
104
43
  jitoConnection.getBlockHeight('confirmed'),
105
44
  ])
106
- let signatureResults: (SignatureResult | null)[] = txSignatures.map(
107
- () => null
108
- )
109
-
110
- const pollingPromise = (async () => {
111
- let pollingBlockHeight = initialBlockHeight
112
- while (
113
- pollingBlockHeight < blockhashResult.lastValidBlockHeight &&
114
- !abortController.signal.aborted
45
+ let currentBlockHeight = initialBlockHeight
46
+
47
+ while (
48
+ currentBlockHeight < blockhashResult.lastValidBlockHeight &&
49
+ !abortController.signal.aborted
50
+ ) {
51
+ const statusResponse = await jitoConnection.getBundleStatuses([
52
+ bundleId,
53
+ ])
54
+
55
+ const bundleStatus = statusResponse.value[0]
56
+
57
+ // Check if bundle is confirmed or finalized
58
+ if (
59
+ bundleStatus &&
60
+ (bundleStatus.confirmation_status === 'confirmed' ||
61
+ bundleStatus.confirmation_status === 'finalized')
115
62
  ) {
116
- const statusResponse =
63
+ // Bundle confirmed! Extract transaction signatures from bundle status
64
+ const txSignatures = bundleStatus.transactions
65
+ // Fetch individual signature results
66
+ const sigResponse =
117
67
  await jitoConnection.getSignatureStatuses(txSignatures)
118
68
 
119
- const allConfirmed = statusResponse.value.every(
120
- (status) =>
121
- status &&
122
- (status.confirmationStatus === 'confirmed' ||
123
- status.confirmationStatus === 'finalized')
124
- )
125
-
126
- if (allConfirmed) {
127
- signatureResults = statusResponse.value
128
- // Immediately abort all other connections when we find results
129
- abortController.abort()
130
- return signatureResults
69
+ if (!sigResponse?.value || !Array.isArray(sigResponse.value)) {
70
+ // Keep polling, if can't find signature results.
71
+ continue
131
72
  }
132
73
 
133
- await sleep(400)
134
- // Update block height independently to avoid stale reads
135
- if (!abortController.signal.aborted) {
136
- pollingBlockHeight =
137
- await jitoConnection.getBlockHeight('confirmed')
74
+ // Immediately abort all other connections when we find a result
75
+ abortController.abort()
76
+ return {
77
+ bundleId,
78
+ txSignatures,
79
+ signatureResults: sigResponse.value,
138
80
  }
139
81
  }
140
- return null
141
- })()
142
-
143
- const sendingPromise = (async (): Promise<
144
- (SignatureResult | null)[] | null
145
- > => {
146
- let sendingBlockHeight = initialBlockHeight
147
- while (
148
- sendingBlockHeight < blockhashResult.lastValidBlockHeight &&
149
- !abortController.signal.aborted &&
150
- signatureResults.every((r) => r === null)
151
- ) {
152
- try {
153
- // Re-send bundle periodically
154
- await jitoConnection.sendBundle(signedTransactions)
155
- } catch (_) {
156
- // Silently retry on send failures - polling will detect success
157
- }
158
82
 
159
- await sleep(1000)
160
- if (!abortController.signal.aborted) {
161
- sendingBlockHeight =
162
- await jitoConnection.getBlockHeight('confirmed')
163
- }
83
+ await sleep(400)
84
+ if (!abortController.signal.aborted) {
85
+ currentBlockHeight = await jitoConnection.getBlockHeight('confirmed')
164
86
  }
165
- return null
166
- })()
87
+ }
167
88
 
168
- // Wait for polling to find the results
169
- const result = await Promise.race([pollingPromise, sendingPromise])
170
- return result
89
+ return null
171
90
  } catch (error) {
172
91
  if (abortController.signal.aborted) {
173
92
  return null // Don't treat abortion as an error
@@ -176,20 +95,16 @@ export async function sendAndConfirmBundle(
176
95
  }
177
96
  })
178
97
 
179
- // Wait for the first connection to return (either success or timeout)
180
- // If a connection finds confirmation, it aborts all others via abortController
181
- // If all connections reject (throw errors), catch and return null array
182
- const signatureResults =
183
- (await Promise.any(confirmPromises).catch(() => null)) ??
184
- txSignatures.map(() => null)
98
+ // Wait for first successful confirmation
99
+ const result = await Promise.any(confirmPromises).catch(() => null)
185
100
 
186
101
  if (!abortController.signal.aborted) {
187
102
  abortController.abort()
188
103
  }
189
104
 
190
- return {
191
- bundleId,
192
- txSignatures,
193
- signatureResults,
105
+ if (!result) {
106
+ throw new Error('Failed to send and confirm bundle')
194
107
  }
108
+
109
+ return result
195
110
  }
package/src/core/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { LiFiStep, Token } from '@lifi/types'
1
+ import type { LiFiStep } from '@lifi/types'
2
2
 
3
3
  // Standard threshold for destination amount difference (0.5%)
4
4
  const standardThreshold = 0.005
@@ -28,15 +28,3 @@ export function checkStepSlippageThreshold(
28
28
  }
29
29
  return actualSlippage <= setSlippage
30
30
  }
31
-
32
- /**
33
- * Checks whether a given token is eligible for message signing.
34
- * Tokens with '₮' symbol in their name are disallowed,
35
- * since such tokens may have non-standard signing requirements or compatibility issues with hardware wallets.
36
- *
37
- * @param token - The token object to check.
38
- * @returns true if the token is allowed for message signing, false otherwise.
39
- */
40
- export const isTokenMessageSigningAllowed = (token: Token): boolean => {
41
- return !token.name?.includes('₮') && !token.symbol?.includes('₮')
42
- }
package/src/index.ts CHANGED
@@ -83,7 +83,6 @@ export type {
83
83
  export type { UTXOProvider, UTXOProviderOptions } from './core/UTXO/types.js'
84
84
  export { isUTXO } from './core/UTXO/types.js'
85
85
  export { UTXO } from './core/UTXO/UTXO.js'
86
- export { isTokenMessageSigningAllowed } from './core/utils.js'
87
86
  export { createConfig } from './createConfig.js'
88
87
  export { BaseError } from './errors/baseError.js'
89
88
  export type { ErrorCode } from './errors/constants.js'
@@ -125,12 +124,16 @@ export {
125
124
  export { getNameServiceAddress } from './services/getNameServiceAddress.js'
126
125
  export type {
127
126
  GetStatusRequestExtended,
128
- GetStepTransactionRequest,
129
127
  QuoteRequest,
130
128
  QuoteRequestFromAmount,
131
129
  QuoteRequestToAmount,
132
130
  } from './services/types.js'
133
- export type { RPCUrls, SDKBaseConfig, SDKConfig } from './types/internal.js'
131
+ export type {
132
+ RequestInterceptor,
133
+ RPCUrls,
134
+ SDKBaseConfig,
135
+ SDKConfig,
136
+ } from './types/internal.js'
134
137
  export { checkPackageUpdates } from './utils/checkPackageUpdates.js'
135
138
  export { convertQuoteToRoute } from './utils/convertQuoteToRoute.js'
136
139
  export { fetchTxErrorDetails } from './utils/fetchTxErrorDetails.js'
package/src/request.ts CHANGED
@@ -23,7 +23,8 @@ export const request = async <T = Response>(
23
23
  retries: requestSettings.retries,
24
24
  }
25
25
  ): Promise<T> => {
26
- const { userId, integrator, widgetVersion, apiKey } = config.get()
26
+ const { userId, integrator, widgetVersion, apiKey, requestInterceptor } =
27
+ config.get()
27
28
 
28
29
  if (!integrator) {
29
30
  throw new SDKError(
@@ -70,6 +71,10 @@ export const request = async <T = Response>(
70
71
  'x-lifi-integrator': integrator,
71
72
  }
72
73
 
74
+ if (requestInterceptor) {
75
+ options = await requestInterceptor(options)
76
+ }
77
+
73
78
  const response: Response = await fetch(
74
79
  url,
75
80
  stripExtendRequestInitProperties(options)
@@ -81,9 +86,10 @@ export const request = async <T = Response>(
81
86
 
82
87
  return await response.json()
83
88
  } catch (error) {
84
- if (options.retries > 0 && (error as HTTPError).status === 500) {
89
+ const retries = options.retries ?? 0
90
+ if (retries > 0 && (error as HTTPError).status === 500) {
85
91
  await sleep(500)
86
- return request<T>(url, { ...options, retries: options.retries - 1 })
92
+ return request<T>(url, { ...options, retries: retries - 1 })
87
93
  }
88
94
 
89
95
  await (error as HTTPError).buildAdditionalDetails?.()
@@ -1,9 +1,8 @@
1
1
  import {
2
- type ChainId,
2
+ ChainId,
3
3
  type ChainKey,
4
4
  type ChainsRequest,
5
5
  type ChainsResponse,
6
- ChainType,
7
6
  type ConnectionsRequest,
8
7
  type ConnectionsResponse,
9
8
  type ContractCallsQuoteRequest,
@@ -250,11 +249,10 @@ export const getStepTransaction = async (
250
249
 
251
250
  const _config = config.get()
252
251
  let requestUrl = `${_config.apiUrl}/advanced/stepTransaction`
253
- const fromChain = await config.getChainById(step.action.fromChainId)
254
-
255
252
  const isJitoBundleEnabled = Boolean(_config.routeOptions?.jitoBundle)
256
- // add jitoBundle param to url if from chain is SVM and jitoBundle is enabled in config
257
- if (fromChain.chainType === ChainType.SVM && isJitoBundleEnabled) {
253
+
254
+ if (isJitoBundleEnabled && step.action.fromChainId === ChainId.SOL) {
255
+ // add jitoBundle param to url if from chain is SVM and jitoBundle is enabled in config
258
256
  const queryParams = new URLSearchParams({ jitoBundle: 'true' })
259
257
  requestUrl = `${requestUrl}?${queryParams}`
260
258
  }
@@ -7,10 +7,6 @@ export type GetStatusRequestExtended = GetStatusRequest & {
7
7
  fromAddress?: string
8
8
  }
9
9
 
10
- export type GetStepTransactionRequest = {
11
- jitoBundle?: boolean
12
- }
13
-
14
10
  export type QuoteRequestFromAmount = QuoteRequestBase
15
11
 
16
12
  export type QuoteRequestToAmount = Omit<QuoteRequestBase, 'fromAmount'> & {
@@ -1,5 +1,10 @@
1
1
  import type { ChainId, ExtendedChain, RouteOptions } from '@lifi/types'
2
2
  import type { SDKProvider } from '../core/types.js'
3
+ import type { ExtendedRequestInit } from './request.js'
4
+
5
+ export type RequestInterceptor = (
6
+ request: ExtendedRequestInit
7
+ ) => ExtendedRequestInit | Promise<ExtendedRequestInit>
3
8
 
4
9
  export interface SDKBaseConfig {
5
10
  apiKey?: string
@@ -14,6 +19,7 @@ export interface SDKBaseConfig {
14
19
  widgetVersion?: string
15
20
  preloadChains: boolean
16
21
  debug: boolean
22
+ requestInterceptor?: RequestInterceptor
17
23
  }
18
24
 
19
25
  export interface SDKConfig extends Partial<Omit<SDKBaseConfig, 'integrator'>> {
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/sdk'
2
- export const version = '3.14.0-alpha.0'
2
+ export const version = '3.14.1'
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isJitoRpc = isJitoRpc;
4
- async function isJitoRpc(rpcUrl) {
5
- try {
6
- const response = await fetch(rpcUrl, {
7
- method: 'POST',
8
- headers: { 'Content-Type': 'application/json' },
9
- body: JSON.stringify({
10
- jsonrpc: '2.0',
11
- id: 1,
12
- method: 'getTipAccounts',
13
- params: [],
14
- }),
15
- });
16
- const data = await response.json();
17
- return !!data.result && !data.error;
18
- }
19
- catch {
20
- return false;
21
- }
22
- }
23
- //# sourceMappingURL=isJitoRpc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isJitoRpc.js","sourceRoot":"","sources":["../../../../core/Solana/jito/isJitoRpc.ts"],"names":[],"mappings":";;AAAA,8BAoBC;AApBM,KAAK,UAAU,SAAS,CAAC,MAAc;IAC5C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,EAAE,EAAE,CAAC;gBACL,MAAM,EAAE,gBAAgB;gBACxB,MAAM,EAAE,EAAE;aACX,CAAC;SACH,CAAC,CAAA;QAEF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAGlC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAA;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
@@ -1,21 +0,0 @@
1
- export async function isJitoRpc(rpcUrl) {
2
- try {
3
- const response = await fetch(rpcUrl, {
4
- method: 'POST',
5
- headers: { 'Content-Type': 'application/json' },
6
- body: JSON.stringify({
7
- jsonrpc: '2.0',
8
- id: 1,
9
- method: 'getTipAccounts',
10
- params: [],
11
- }),
12
- });
13
- const data = await response.json();
14
- // If we get a result (not a "method not found" error), it supports Jito
15
- return !!data.result && !data.error;
16
- }
17
- catch {
18
- return false;
19
- }
20
- }
21
- //# sourceMappingURL=isJitoRpc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isJitoRpc.js","sourceRoot":"","sources":["../../../../core/Solana/jito/isJitoRpc.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAc;IAC5C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,EAAE;YACnC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,OAAO,EAAE,KAAK;gBACd,EAAE,EAAE,CAAC;gBACL,MAAM,EAAE,gBAAgB;gBACxB,MAAM,EAAE,EAAE;aACX,CAAC;SACH,CAAC,CAAA;QAEF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAElC,wEAAwE;QACxE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAA;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function isJitoRpc(rpcUrl: string): Promise<boolean>;
2
- //# sourceMappingURL=isJitoRpc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isJitoRpc.d.ts","sourceRoot":"","sources":["../../../../core/Solana/jito/isJitoRpc.ts"],"names":[],"mappings":"AAAA,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBhE"}
@@ -1,21 +0,0 @@
1
- export async function isJitoRpc(rpcUrl: string): Promise<boolean> {
2
- try {
3
- const response = await fetch(rpcUrl, {
4
- method: 'POST',
5
- headers: { 'Content-Type': 'application/json' },
6
- body: JSON.stringify({
7
- jsonrpc: '2.0',
8
- id: 1,
9
- method: 'getTipAccounts',
10
- params: [],
11
- }),
12
- })
13
-
14
- const data = await response.json()
15
-
16
- // If we get a result (not a "method not found" error), it supports Jito
17
- return !!data.result && !data.error
18
- } catch {
19
- return false
20
- }
21
- }