Skip to content

Commit

Permalink
fix fee
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshka committed Oct 12, 2023
1 parent b6df713 commit 947ed46
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/sdk-viem/src/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import keccak256 from 'keccak256'
import { isHex, type Hex } from 'viem'
import { InvalidHexError } from '../errors'
import keccak256 from 'keccak256'

export function isHexList(list: string[]): list is Hex[] {
return list.every((value) => isHex(value))
export function assertIsHex(value: string): asserts value is Hex {
if (!isHex(value, { strict: false })) throw new InvalidHexError({ value })
}

export function getSaltAsBytes32(salt: string | number) {
Expand Down Expand Up @@ -67,6 +68,16 @@ export async function retry<T>(
return fn()
}

export function isHexList(list: string[]): list is Hex[] {
return list.every((value) => isHex(value, { strict: false }))
}

export function assertIsHexList(list: string[]): asserts list is Hex[] {
for (const value of list) {
assertIsHex(value)
}
}

type NonEmptyArray<T> = [T, ...T[]]

export function BigIntMin(...[firstValue, ...values]: NonEmptyArray<bigint>): bigint {
Expand Down

0 comments on commit 947ed46

Please sign in to comment.