Skip to content

Commit

Permalink
feat: add support for a fallback Ethereum provider
Browse files Browse the repository at this point in the history
build: upgrade package version
  • Loading branch information
scorpion9979 committed Aug 16, 2022
1 parent f8186ed commit fb717ba
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
secretKeyRef:
name: hifi-liquidator-js-secret
key: wallet-seed
image: hififinance/hifi-liquidator-js:1.0.1
image: hififinance/hifi-liquidator-js:1.0.2
name: hifi-liquidator-js
resources:
limits:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hifi/liquidator-js",
"description": "Utility for automatically liquidating underwater accounts in Hifi",
"version": "1.0.1",
"version": "1.0.2",
"author": {
"name": "Hifi",
"email": "[email protected]",
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function batchQueryFilter(
eventFilter: EventFilter,
fromBlock: number = 0,
toBlock: number,
span: number = 10000,
span: number = 3500,
) {
let events: Event[] = [];
for (let currBlock = fromBlock; currBlock < toBlock + 1; currBlock += span) {
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ import { Wallet, providers, utils } from "ethers";

require("dotenv").config();

const { ALCHEMY_KEY, PERSISTENCE, SELECTED_ACCOUNT, WALLET_SEED } = process.env as {
const { ALCHEMY_KEY, INFURA_KEY, PERSISTENCE, SELECTED_ACCOUNT, WALLET_SEED } = process.env as {
[key: string]: string;
};

const { NETWORK_NAME } = process.env as { NETWORK_NAME: NetworkName };

const account = utils.HDNode.fromMnemonic(WALLET_SEED as string).derivePath(`m/44'/60'/0'/0/${SELECTED_ACCOUNT}`);

const provider = new providers.AlchemyProvider(NETWORK_NAME, ALCHEMY_KEY);
const provider = new providers.FallbackProvider([
new providers.AlchemyProvider(NETWORK_NAME, ALCHEMY_KEY),
new providers.InfuraProvider(NETWORK_NAME, INFURA_KEY),
]);

const signer = new Wallet(account, provider);

Expand Down

0 comments on commit fb717ba

Please sign in to comment.