File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change 1
1
import { sha256HexSync } from "@thirdweb-dev/crypto" ;
2
- import { createThirdwebClient } from "thirdweb" ;
2
+ import { createThirdwebClient , hexToNumber , isHex } from "thirdweb" ;
3
3
import type { TransactionReceipt } from "thirdweb/transaction" ;
4
4
import { env } from "./env" ;
5
5
@@ -27,14 +27,6 @@ export const fromTransactionType = (type: TransactionReceipt["type"]) => {
27
27
if ( type === "eip2930" ) return 2 ;
28
28
if ( type === "eip4844" ) return 3 ;
29
29
if ( type === "eip7702" ) return 4 ;
30
+ if ( isHex ( type ) ) return hexToNumber ( type ) ;
30
31
throw new Error ( `Unexpected transaction type ${ type } ` ) ;
31
32
} ;
32
-
33
- export const toTransactionType = ( value : number ) => {
34
- if ( value === 0 ) return "legacy" ;
35
- if ( value === 1 ) return "eip1559" ;
36
- if ( value === 2 ) return "eip2930" ;
37
- if ( value === 3 ) return "eip4844" ;
38
- if ( value === 4 ) return "eip7702" ;
39
- throw new Error ( `Unexpected transaction type number ${ value } ` ) ;
40
- } ;
You can’t perform that action at this time.
0 commit comments