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