Skip to content

Commit

Permalink
chore(vechain): enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
D4mph1r committed Dec 19, 2024
1 parent b769c60 commit 145aaaf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
24 changes: 12 additions & 12 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const bridgeTestChains = [
{
chain: "VECHAIN",
rpcURL: "https://sync-testnet.veblocks.net",
nativeCoinSymbol: "VET",
nativeCoinSymbol: "VTHO",
intialFund: "50000000000000000",
contractAddress: "0x7111eb5f8d9dA472e9608f2ab3De275C040D60B2",
chainType: "vechain",
Expand Down Expand Up @@ -406,17 +406,17 @@ export const prodBridgeConfig: IBridgeConfig = {
nativeCoinSymbol: "SCRT",
rpcURL: "https://rpc.ankr.com/http/scrt_cosmos",
},
// {
// chain: "VECHAIN",
// rpcURL: "https://mainnet.veblocks.net",
// nativeCoinSymbol: "VET",
// intialFund: "50000000000000000",
// contractAddress: "0x4c14CF6Eb11978F0A90B369107Aa7F5A08994428",
// chainType: "vechain",
// lastBlock: 20407625,
// decimals: 18,
// blockChunks: 1000,
// },
{
chain: "VECHAIN",
rpcURL: "https://mainnet.veblocks.net",
nativeCoinSymbol: "VTHO",
intialFund: "50000000000000000000",
contractAddress: "0x4c14CF6Eb11978F0A90B369107Aa7F5A08994428",
chainType: "vechain",
lastBlock: 20407625,
decimals: 18,
blockChunks: 1000,
},
],
storageConfig: {
chain: "OP",
Expand Down
14 changes: 13 additions & 1 deletion src/handler/chains/evm/utils/getBalance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Signer } from "ethers";
import { Driver, SimpleNet } from "@vechain/connex-driver";
import { BrowserProvider, type Signer } from "ethers";
import { useMutexAndRelease } from "../../../utils";
import type { EVMProviderFetch } from "../types";

Expand All @@ -7,6 +8,17 @@ export default async function getBalance(
fetchProvider: EVMProviderFetch,
) {
return useMutexAndRelease(fetchProvider, async (provider) => {
if (provider instanceof BrowserProvider) {
const net = new SimpleNet(
process.env.NETWORK === "testnet"
? "https://sync-testnet.veblocks.net"
: "https://mainnet.vecha.in",
);
const driver = await Driver.connect(net);
return BigInt(
(await driver.getAccount(await signer.getAddress(), "")).energy,
);
}
return provider.getBalance(await signer.getAddress());
});
}

0 comments on commit 145aaaf

Please sign in to comment.