Skip to content

Commit

Permalink
chore: test rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jun 25, 2024
1 parent 5b04deb commit 33e9d3f
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/handlers/query-wallet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-expect-error err
import { HandlerConstructorConfig, RPCHandler } from "@ubiquity-dao/rpc-handler";
import { ethers } from "ethers";
import { Context } from "../types";

Expand Down Expand Up @@ -74,26 +72,11 @@ function registerWalletWithVerification(context: Context, body: string, address:
}
}

function useHandler(networkId: number) {
const config: HandlerConstructorConfig = {
networkId,
rpcTimeout: 1500,
autoStorage: false,
cacheRefreshCycles: 10,
networkName: null,
networkRpcs: null,
runtimeRpcs: null,
};
return new RPCHandler(config);
}

export async function resolveAddress(ensName: string) {
// Gets the Ethereum address associated with an ENS (Ethereum Name Service) name
// Explicitly set provider to Ethereum mainnet
const handler = useHandler(1);
const provider = await handler.getFastestRpcProvider();
console.log("trying to resolve address from ENS address", ensName);
return await provider.resolveName(ensName).catch((err: object) => {
const provider = new ethers.JsonRpcProvider(`https://eth.drpc.org`);
return await provider.resolveName(ensName).catch((err) => {
console.trace({ err });
return null;
});
Expand Down

0 comments on commit 33e9d3f

Please sign in to comment.