-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get rid of the json blobs hanging out in this library and simply down…
…load them from github when needed
- Loading branch information
1 parent
b08014c
commit 1165d94
Showing
8 changed files
with
106 additions
and
35,068 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
artifacts | ||
broadcast | ||
cache | ||
cache_hardhat | ||
deployments | ||
dist | ||
lib | ||
out | ||
types | ||
|
||
package.json | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import axios from 'axios'; | ||
|
||
import { ContractsBlob } from '../types'; | ||
|
||
interface StringMap { | ||
[key: string]: string; | ||
} | ||
|
||
const CONTRACTS_STORE: StringMap = { | ||
'5': 'https://raw.githubusercontent.com/pooltogether/v5-testnet/main/deployments/ethGoerli/contracts.json', | ||
'80001': 'https://github.com/pooltogether/v5-testnet/blob/main/deployments/mumbai/contracts.json', | ||
'11155111': | ||
'https://raw.githubusercontent.com/pooltogether/v5-testnet/main/deployments/ethSepolia/contracts.json', | ||
}; | ||
|
||
/** | ||
* Downloads the latest contracts blob from the raw data source on GitHub | ||
* @param {number} chainId | ||
* @returns {ContractsBlob} contracts | ||
*/ | ||
export const downloadContractsBlob = async (chainId: number): Promise<ContractsBlob> => { | ||
let contracts; | ||
|
||
try { | ||
const { data } = await axios.get(CONTRACTS_STORE[chainId.toString()]); | ||
contracts = data; | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
|
||
return contracts; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export { testnetContractsBlobSepolia } from "./testnetContractsBlobSepolia"; | ||
export { testnetContractsBlobMumbai } from "./testnetContractsBlobMumbai"; | ||
export { downloadContractsBlob } from "./downloadContractsBlob"; |
Oops, something went wrong.