refactor: solana mainnet rpc url (#193)
Co-authored-by: Gancho Radkov <ganchoradkov@gmail.com>
This commit is contained in:
parent
e2fec8cbfe
commit
3c8ebfe96a
@ -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
|
||||
|
@ -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}`;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user