Skip to content

Commit 8d9452c

Browse files
authored
Merge pull request #50 from AmbireTech/develop
Release v1.8.1
2 parents 1be99f4 + 97038dd commit 8d9452c

5 files changed

Lines changed: 48 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.8.0",
2+
"version": "0.8.1",
33
"name": "ambire-common",
44
"description": "Common ground for the Ambire apps",
55
"private": true,

src/constants/networks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const networks: NetworkType[] = [
101101
{
102102
id: NETWORKS.arbitrum,
103103
chainId: 42161,
104-
rpc: 'https://arb1.arbitrum.io/rpc',
104+
rpc: 'https://arb-mainnet.g.alchemy.com/v2/wBLFG9QR-n45keJvKjc4rrfp2F1sy1Cp',
105105
nativeAssetSymbol: 'AETH',
106106
name: 'Arbitrum',
107107
explorerUrl: 'https://arbiscan.io',

src/hooks/useGasTank/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import useGasTank from './useGasTank'
2+
3+
export default useGasTank
4+
export * from './types'

src/hooks/useGasTank/types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { UseStorageProps, UseStorageReturnType } from '../useStorage'
2+
3+
export type UseGasTankProps = {
4+
selectedAcc: string
5+
useStorage: (p: Omit<UseStorageProps, 'storage'>) => UseStorageReturnType
6+
}
7+
8+
export type GasTankEntryType = {
9+
account: string
10+
isEnabled: boolean
11+
}
12+
13+
export type UseGasTankReturnType = {
14+
gasTankState: GasTankEntryType[]
15+
setGasTankState: (newGasTankState: GasTankEntryType[]) => void
16+
}

src/hooks/useGasTank/useGasTank.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { useCallback } from 'react'
2+
3+
import { GasTankEntryType, UseGasTankProps, UseGasTankReturnType } from './types'
4+
5+
export default function useGasTank({
6+
selectedAcc,
7+
useStorage
8+
}: UseGasTankProps): UseGasTankReturnType {
9+
const defaultGasTankState: [GasTankEntryType] = [{ account: selectedAcc, isEnabled: false }]
10+
const [state, setState] = useStorage({
11+
key: 'gasTankState',
12+
defaultValue: defaultGasTankState
13+
})
14+
15+
const setGasTankState = useCallback(
16+
(newGasTankState: GasTankEntryType[]) => {
17+
setState(newGasTankState)
18+
},
19+
[setState]
20+
)
21+
22+
return {
23+
gasTankState: state,
24+
setGasTankState
25+
}
26+
}

0 commit comments

Comments
 (0)