File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
docs/src/lib/components/gas Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 22 import anime from ' animejs'
33 import GasCard from ' ./GasCard.svelte'
44 import gasModule from ' @web3-onboard/gas'
5- import { onMount } from ' svelte'
5+ import { onDestroy , onMount } from ' svelte'
66 import { ethers } from ' ethers'
77 import type { GasPrice , RPCGasPrice , GasData } from ' ./types'
88
1919 })
2020 }
2121 let ethMainnetGasBlockPrices
22+ let gasSub
2223 let rpcGasData: RPCGasPrice
2324 onMount (() => {
2425 ethMainnetGasBlockPrices = gasModule .stream ({
2526 chains: [' 0x1' ],
2627 apiKey: ' da1b962d-314d-4903-bfe1-426821d14a35' ,
2728 endpoint: ' blockPrices'
2829 })
29- ethMainnetGasBlockPrices .subscribe (() => {
30+ gasSub = ethMainnetGasBlockPrices .subscribe (() => {
3031 async function getEtherGasFromRPC() {
3132 const INFURA_ID = ' 8b60d52405694345a99bcb82e722e0af'
3233 const infuraRPC = ` https://mainnet.infura.io/v3/${INFURA_ID } `
6263 estimatedTransactionCount: null ,
6364 seconds: null
6465 }
66+
67+ onDestroy (() => {
68+ gasSub && gasSub .unsubscribe ()
69+ })
6570 </script >
6671
6772<div class =" Gas px-6 p-4" >
You can’t perform that action at this time.
0 commit comments