Skip to content

Commit 032b45f

Browse files
authored
eth gas station API key (#6)
1 parent 73ad0cc commit 032b45f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/pay/.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
PORT=3001
1+
PORT=3001
2+
REACT_APP_EGS_API_KEY=af6959ab38f9819a2e1d1cd496617953f08e031543a242bd65106325bf85

packages/pay/src/contexts/PaymentContext.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,16 @@ export const PaymentProvider: React.FC = ({ children }) => {
192192
}, [library, request, setPending]);
193193

194194
useEffect(() => {
195+
const params = process.env.REACT_APP_EGS_API_KEY
196+
? {
197+
"api-key": process.env.REACT_APP_EGS_API_KEY,
198+
}
199+
: {};
200+
195201
axios
196-
.get("https://ethgasstation.info/json/ethgasAPI.json")
202+
.get("https://ethgasstation.info/json/ethgasAPI.json", {
203+
params,
204+
})
197205
.then(res => setGasPrice(res.data.average / 10 + 1));
198206
}, []);
199207

0 commit comments

Comments
 (0)