Skip to content

Commit

Permalink
feat(blockchain-link): add user agent to Solana requests from desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasklim committed Oct 1, 2024
1 parent 8ec6f00 commit 2109d00
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/blockchain-link/src/workers/solana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -514,7 +515,13 @@ class SolanaWorker extends BaseWorker<SolanaAPI> {
private lazyTokens = createLazy(() => solanaUtils.getTokenMetadata());

async tryConnect(url: string): Promise<SolanaAPI> {
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 });

Expand Down

0 comments on commit 2109d00

Please sign in to comment.