From 2b707e81c2d12931887c4ad70a1fee893e238172 Mon Sep 17 00:00:00 2001 From: hueso Date: Fri, 18 Jul 2025 14:56:10 -0300 Subject: [PATCH] rootstock testnet fix --- src/blockchain/addresses.ts | 4 ++-- src/blockchain/provider.ts | 6 +++--- src/blockchain/sellerMethods.ts | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/blockchain/addresses.ts b/src/blockchain/addresses.ts index dcd1833..dc121cd 100644 --- a/src/blockchain/addresses.ts +++ b/src/blockchain/addresses.ts @@ -1,7 +1,7 @@ import { useUser } from "@/composables/useUser"; import { NetworkEnum, TokenEnum } from "@/model/NetworkEnum"; import { createPublicClient, http, type Address } from "viem"; -import { sepolia, rootstock } from "viem/chains"; +import { sepolia, rootstockTestnet } from "viem/chains"; const Tokens: { [key in NetworkEnum]: { [key in TokenEnum]: Address } } = { [NetworkEnum.sepolia]: { @@ -58,7 +58,7 @@ export const getProviderUrl = (network?: NetworkEnum): string => { }; export const getProviderByNetwork = (network: NetworkEnum) => { - const chain = network === NetworkEnum.sepolia ? sepolia : rootstock; + const chain = network === NetworkEnum.sepolia ? sepolia : rootstockTestnet; return createPublicClient({ chain, transport: http(getProviderUrl(network)), diff --git a/src/blockchain/provider.ts b/src/blockchain/provider.ts index 24ec20c..f1d06d0 100644 --- a/src/blockchain/provider.ts +++ b/src/blockchain/provider.ts @@ -9,7 +9,7 @@ import { PublicClient, WalletClient, } from "viem"; -import { sepolia, rootstock } from "viem/chains"; +import { sepolia, rootstockTestnet } from "viem/chains"; import { useUser } from "@/composables/useUser"; let walletClient: WalletClient | null = null; @@ -19,7 +19,7 @@ const getPublicClient = (): PublicClient => { const rpcUrl = getProviderUrl(); return createPublicClient({ chain: - Number(user.networkName.value) === sepolia.id ? sepolia : rootstock, + Number(user.networkName.value) === sepolia.id ? sepolia : rootstockTestnet, transport: http(rpcUrl), }); }; @@ -46,7 +46,7 @@ const getContract = async (onlyRpcProvider = false) => { const connectProvider = async (p: any): Promise => { const user = useUser(); const chain = - Number(user.networkName.value) === sepolia.id ? sepolia : rootstock; + Number(user.networkName.value) === sepolia.id ? sepolia : rootstockTestnet; const [account] = await p!.request({ method: "eth_requestAccounts" }); diff --git a/src/blockchain/sellerMethods.ts b/src/blockchain/sellerMethods.ts index eac17a3..6a06991 100644 --- a/src/blockchain/sellerMethods.ts +++ b/src/blockchain/sellerMethods.ts @@ -1,7 +1,7 @@ import { getContract, getPublicClient, getWalletClient } from "./provider"; import { getTokenAddress, getP2PixAddress } from "./addresses"; import { parseEther, toHex } from "viem"; -import { sepolia, rootstock } from "viem/chains"; +import { sepolia, rootstockTestnet } from "viem/chains"; import { mockTokenAbi } from "./abi"; import { useUser } from "@/composables/useUser"; @@ -33,7 +33,7 @@ const approveTokens = async (participant: Participant): Promise => { if ( allowance < parseEther(participant.offer.toString()) ) { // Approve tokens - const chain = user.networkId.value === sepolia.id ? sepolia : rootstock; + const chain = user.networkId.value === sepolia.id ? sepolia : rootstockTestnet; const hash = await walletClient.writeContract({ address: tokenAddress, abi: mockTokenAbi, @@ -65,7 +65,7 @@ const addDeposit = async (): Promise => { if (!sellerId.id) { throw new Error("Failed to create participant"); } - const chain = user.networkId.value === sepolia.id ? sepolia : rootstock; + const chain = user.networkId.value === sepolia.id ? sepolia : rootstockTestnet; const hash = await walletClient.writeContract({ address, abi,