refactor: solana mainnet rpc url (#193)

Co-authored-by: Gancho Radkov <ganchoradkov@gmail.com>
This commit is contained in:
Gancho Radkov 2023-06-19 17:37:28 +03:00 committed by GitHub
parent e2fec8cbfe
commit 3c8ebfe96a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -12,11 +12,11 @@ import {
import bs58 from "bs58";
import { verifyMessageSignature } from "solana-wallet";
import {
clusterApiUrl,
Connection,
Keypair,
SystemProgram,
Transaction as SolanaTransaction,
clusterApiUrl,
} from "@solana/web3.js";
// @ts-expect-error
import TronWeb from "tronweb";
@ -24,6 +24,7 @@ import {
eip712,
formatTestTransaction,
getLocalStorageTestnetFlag,
getProviderUrl,
hashPersonalMessage,
hashTypedDataMessage,
verifySignature,
@ -562,8 +563,9 @@ export function JsonRpcContextProvider({
const senderPublicKey = solanaPublicKeys[address];
// rpc.walletconnect.com doesn't support solana testnet yet
const connection = new Connection(
clusterApiUrl(isTestnet ? "testnet" : "mainnet-beta")
isTestnet ? clusterApiUrl("testnet") : getProviderUrl(chainId)
);
// Using deprecated `getRecentBlockhash` over `getLatestBlockhash` here, since `mainnet-beta`
@ -1051,7 +1053,6 @@ export function JsonRpcContextProvider({
},
});
const valid = verifier.verify(
testMessage.serializeForSigning(),
result.signature

View File

@ -230,3 +230,7 @@ export const getAllChainNamespaces = () => {
});
return namespaces;
};
export const getProviderUrl = (chainId: string) => {
return `https://rpc.walletconnect.com/v1/?chainId=${chainId}&projectId=${process.env.NEXT_PUBLIC_PROJECT_ID}`;
};