Skip to content

Commit

Permalink
chore: removed rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Feb 19, 2025
1 parent 073204a commit 7049d52
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
6 changes: 6 additions & 0 deletions src/helpers/permit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ export async function generatePermitUrlPayload(
const spenderWallet = new ethers.Wallet(privateKey);
const { data: userData } = await context.octokit.rest.users.getByUsername({ username: userName });

context.logger.info("Generating permit.", {
userName,
amount,
chainId,
});

if (!userData) {
throw new Error(`GitHub user was not found for id ${userName}`);
}
Expand Down
58 changes: 31 additions & 27 deletions src/helpers/web3.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RPCHandler, HandlerConstructorConfig, NetworkId } from "@ubiquity-dao/rpc-handler";
import { ethers } from "ethers";
// import { RPCHandler, HandlerConstructorConfig, NetworkId } from "@ubiquity-dao/rpc-handler";
// import { ethers } from "ethers";

/**
* Returns ERC20 token symbol
Expand All @@ -8,29 +8,33 @@ import { ethers } from "ethers";
* @returns ERC20 token symbol
*/
export async function getErc20TokenSymbol(networkId: number, tokenAddress: string) {
const abi = ["function symbol() view returns (string)"];

// get fastest RPC
const config: HandlerConstructorConfig = {
networkName: null,
networkRpcs: null,
proxySettings: {
retryCount: 5,
retryDelay: 500,
logTier: null,
logger: null,
strictLogs: false,
},
runtimeRpcs: null,
networkId: String(networkId) as NetworkId,
rpcTimeout: 1500,
autoStorage: false,
cacheRefreshCycles: 10,
};
const handler = new RPCHandler(config);
const provider = await handler.getFastestRpcProvider();

// fetch token symbol
const contract = new ethers.Contract(tokenAddress, abi, provider);
return await contract.symbol();
if (networkId === 100) {
return "WXDAI";
}
return "UUSD";
// const abi = ["function symbol() view returns (string)"];
//
// // get fastest RPC
// const config: HandlerConstructorConfig = {
// networkName: null,
// networkRpcs: null,
// proxySettings: {
// retryCount: 5,
// retryDelay: 500,
// logTier: null,
// logger: null,
// strictLogs: false,
// },
// runtimeRpcs: null,
// networkId: String(networkId) as NetworkId,
// rpcTimeout: 1500,
// autoStorage: false,
// cacheRefreshCycles: 10,
// };
// const handler = new RPCHandler(config);
// const provider = await handler.getFastestRpcProvider();
//
// // fetch token symbol
// const contract = new ethers.Contract(tokenAddress, abi, provider);
// return await contract.symbol();
}

0 comments on commit 7049d52

Please sign in to comment.