From 2109d004e2730f3c921135262a58d2aeb859dfb3 Mon Sep 17 00:00:00 2001 From: tomasklim Date: Tue, 24 Sep 2024 10:16:51 +0200 Subject: [PATCH] feat(blockchain-link): add user agent to Solana requests from desktop --- packages/blockchain-link/src/workers/solana/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/blockchain-link/src/workers/solana/index.ts b/packages/blockchain-link/src/workers/solana/index.ts index 74d6477d7fa..1753f1af26c 100644 --- a/packages/blockchain-link/src/workers/solana/index.ts +++ b/packages/blockchain-link/src/workers/solana/index.ts @@ -26,6 +26,7 @@ import { import { TOKEN_ACCOUNT_LAYOUT } from './tokenUtils'; import { getBaseFee, getPriorityFee } from './fee'; import { confirmTransactionWithResubmit } from './transactionConfirmation'; +import { getSuiteVersion } from '@trezor/env-utils'; export type SolanaAPI = Connection; @@ -514,7 +515,13 @@ class SolanaWorker extends BaseWorker { private lazyTokens = createLazy(() => solanaUtils.getTokenMetadata()); async tryConnect(url: string): Promise { - const api = new Connection(url, { wsEndpoint: url.replace('https', 'wss') }); + const api = new Connection(url, { + wsEndpoint: url.replace('https', 'wss'), + httpHeaders: { + Origin: 'https://node.trezor.io', + 'User-Agent': `Trezor Suite ${getSuiteVersion()}`, + }, + }); await api.getLatestBlockhash('finalized'); this.post({ id: -1, type: RESPONSES.CONNECTED });