fix connection

This commit is contained in:
Adrian Brzeziński 2024-04-07 15:37:38 +02:00
parent ad49d89f33
commit eb3d1a08c5
1 changed files with 6 additions and 5 deletions

View File

@ -83,6 +83,7 @@ const MANGO_BOOST_ID = new PublicKey(
) )
export const LITE_RPC_URL = 'https://api.mngo.cloud/lite-rpc/v1/' export const LITE_RPC_URL = 'https://api.mngo.cloud/lite-rpc/v1/'
const backupConnections = [new Connection(LITE_RPC_URL, 'recent')]
const GROUP_JLP = new PublicKey('AKeMSYiJekyKfwCc3CUfVNDVAiqk9FfbQVMY3G7RUZUf') const GROUP_JLP = new PublicKey('AKeMSYiJekyKfwCc3CUfVNDVAiqk9FfbQVMY3G7RUZUf')
const GROUP_V1 = new PublicKey('78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX') const GROUP_V1 = new PublicKey('78b8f4cGCwmZ9ysPFMWLaLTkkaYnUjwMJYStWe5RTSSX')
@ -116,7 +117,7 @@ const initMangoClient = (
opts = { opts = {
prioritizationFee: DEFAULT_PRIORITY_FEE, prioritizationFee: DEFAULT_PRIORITY_FEE,
fallbackOracleConfig: FALLBACK_ORACLES, fallbackOracleConfig: FALLBACK_ORACLES,
multipleConnections: [new Connection(LITE_RPC_URL)], multipleConnections: backupConnections,
}, },
): { lst: MangoClient; jlp: MangoClient } => { ): { lst: MangoClient; jlp: MangoClient } => {
return { return {
@ -335,7 +336,7 @@ const mangoStore = create<MangoStore>()(
const client = initMangoClient(provider, { const client = initMangoClient(provider, {
prioritizationFee: priorityFee, prioritizationFee: priorityFee,
fallbackOracleConfig: FALLBACK_ORACLES, fallbackOracleConfig: FALLBACK_ORACLES,
multipleConnections: [new Connection(LITE_RPC_URL)], multipleConnections: backupConnections,
}) })
return { return {
@ -774,7 +775,7 @@ const mangoStore = create<MangoStore>()(
const client = initMangoClient(provider, { const client = initMangoClient(provider, {
prioritizationFee: priorityFee, prioritizationFee: priorityFee,
fallbackOracleConfig: FALLBACK_ORACLES, fallbackOracleConfig: FALLBACK_ORACLES,
multipleConnections: [new Connection(LITE_RPC_URL)], multipleConnections: backupConnections,
}) })
set((s) => { set((s) => {
@ -829,7 +830,7 @@ const mangoStore = create<MangoStore>()(
const newClient = initMangoClient(newProvider, { const newClient = initMangoClient(newProvider, {
prioritizationFee: priorityFee, prioritizationFee: priorityFee,
fallbackOracleConfig: FALLBACK_ORACLES, fallbackOracleConfig: FALLBACK_ORACLES,
multipleConnections: [new Connection(LITE_RPC_URL)], multipleConnections: backupConnections,
}) })
set((state) => { set((state) => {
state.connection = newConnection state.connection = newConnection
@ -889,7 +890,7 @@ const mangoStore = create<MangoStore>()(
const newClient = initMangoClient(provider, { const newClient = initMangoClient(provider, {
prioritizationFee: priorityFee, prioritizationFee: priorityFee,
fallbackOracleConfig: FALLBACK_ORACLES, fallbackOracleConfig: FALLBACK_ORACLES,
multipleConnections: [new Connection(LITE_RPC_URL)], multipleConnections: backupConnections,
}) })
set((state) => { set((state) => {
state.priorityFee = feeEstimate state.priorityFee = feeEstimate