File tree Expand file tree Collapse file tree 12 files changed +987
-235
lines changed
app/debug/_components/contract
components/scaffold-stark Expand file tree Collapse file tree 12 files changed +987
-235
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " ss-2" ,
3- "version" : " 0.3.13 " ,
3+ "version" : " 0.3.15 " ,
44 "author" : " Q3 Labs" ,
55 "license" : " MIT" ,
66 "private" : true ,
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export const TxReceipt = (
2727 aria-hidden = "true"
2828 />
2929 ) : (
30- //@ts -ignore coponent works but some typing issue came up, ts-expect-error does not work
30+ //@ts -ignore component works but some typing issue came up, ts-expect-error does not work
3131 < CopyToClipboard
3232 text = {
3333 decodeContractResponse ( {
Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ export const Address = ({
5252
5353 const checkSumAddress = useMemo ( ( ) => {
5454 if ( ! address ) return undefined ;
55+
56+ if ( address . toLowerCase ( ) === "0x" ) {
57+ return "0x0" ;
58+ }
59+
5560 return getChecksumAddress ( address ) ;
5661 } , [ address ] ) ;
5762
@@ -60,6 +65,19 @@ export const Address = ({
6065 checkSumAddress || address || "" ,
6166 ) ;
6267
68+ const isValidHexAddress = ( value : string ) : boolean => {
69+ if ( value . toLowerCase ( ) === "0x" ) {
70+ value = "0x0" ;
71+ }
72+
73+ if ( value . toLowerCase ( ) === "0x0x0" ) {
74+ return false ;
75+ }
76+
77+ const hexAddressRegex = / ^ 0 x [ 0 - 9 a - f A - F ] + $ / ;
78+ return hexAddressRegex . test ( value ) ;
79+ } ;
80+
6381 const [ displayAddress , setDisplayAddress ] = useState (
6482 checkSumAddress ?. slice ( 0 , 6 ) + "..." + checkSumAddress ?. slice ( - 4 ) ,
6583 ) ;
@@ -96,8 +114,8 @@ export const Address = ({
96114 ) ;
97115 }
98116
99- if ( ! validateChecksumAddress ( checkSumAddress ) ) {
100- return < span className = "text-error" > Wrong address</ span > ;
117+ if ( ! checkSumAddress ) {
118+ return < span className = "text-error" > Invalid address format </ span > ;
101119 }
102120
103121 return (
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ export const CustomConnectButton = () => {
4545 } , [ account ] ) ;
4646
4747 if ( status === "disconnected" ) return < ConnectModal /> ;
48- // Skip wrong network check if using a fork
49- if ( ! scaffoldConfig . isFork && accountChainId !== targetNetwork . id ) {
48+
49+ if ( accountChainId !== targetNetwork . id ) {
5050 return < WrongNetworkDropdown /> ;
5151 }
5252
Original file line number Diff line number Diff line change @@ -21,7 +21,24 @@ export const AddressInput = ({
2121
2222 const handleChange = useCallback (
2323 ( newValue : Address ) => {
24- //setEnteredEnsName(undefined);
24+ const sanitizedValue = newValue . toLowerCase ( ) ;
25+
26+ if ( sanitizedValue === "0x" ) {
27+ onChange ( "0x0" as Address ) ;
28+ return ;
29+ }
30+
31+ const isValid =
32+ / ^ ( 0 x ) ( [ a - f A - F 0 - 9 ] { 40 } ) $ / . test ( sanitizedValue ) &&
33+ ! / 0 x .* 0 x / . test ( sanitizedValue ) ;
34+ if ( ! isValid ) {
35+ return ;
36+ }
37+
38+ if ( sanitizedValue . length !== 42 ) {
39+ return ;
40+ }
41+
2542 onChange ( newValue ) ;
2643 } ,
2744 [ onChange ] ,
Original file line number Diff line number Diff line change 11/** @type {import('next').NextConfig } */
2+ import webpack from "webpack" ;
3+
24const nextConfig = {
35 reactStrictMode : true ,
46 images : {
@@ -62,6 +64,11 @@ const nextConfig = {
6264 } ) ;
6365 }
6466 config . externals . push ( "pino-pretty" , "lokijs" , "encoding" ) ;
67+ config . plugins . push (
68+ new webpack . NormalModuleReplacementPlugin ( / ^ n o d e : ( .* ) $ / , ( resource ) => {
69+ resource . request = resource . request . replace ( / ^ n o d e : / , "" ) ;
70+ } ) ,
71+ ) ;
6572 return config ;
6673 } ,
6774} ;
Original file line number Diff line number Diff line change 8181 "typescript" : " ^5" ,
8282 "url" : " ^0.11.4" ,
8383 "vercel" : " ^33.7.1" ,
84- "vitest" : " ^2.1.1"
84+ "vitest" : " ^2.1.1" ,
85+ "webpack" : " ^5.97.1" ,
86+ "webpack-cli" : " ^6.0.1"
8587 }
8688}
Original file line number Diff line number Diff line change @@ -8,12 +8,6 @@ export type ScaffoldConfig = {
88 rpcProviderUrl : string ;
99 walletAutoConnect : boolean ;
1010 autoConnectTTL : number ;
11- /**
12- * Flag to indicate if the network is a fork of another network
13- * This is used to handle network validation differently for forked networks
14- * since they share the same chain ID as their parent network
15- */
16- isFork ?: boolean ;
1711} ;
1812
1913const scaffoldConfig = {
@@ -31,12 +25,6 @@ const scaffoldConfig = {
3125 */
3226 autoConnectTTL : 60000 ,
3327 walletAutoConnect : true ,
34- /**
35- * Set to true when using a fork of a network
36- * This will prevent showing the wrong network dropdown when the chainId matches
37- * but the RPC URL is different (e.g., when using a local fork of mainnet)
38- */
39- isFork : false ,
4028} as const satisfies ScaffoldConfig ;
4129
4230export default scaffoldConfig ;
Original file line number Diff line number Diff line change 77import * as chains from "@starknet-react/chains" ;
88
99const containsDevnet = ( networks : readonly chains . Chain [ ] ) => {
10- return networks . filter ( ( it ) => it . id == chains . devnet . id ) . length > 0 ;
10+ return (
11+ networks . filter ( ( it ) => it . network == chains . devnet . network ) . length > 0
12+ ) ;
1113} ;
1214
1315const provider =
Original file line number Diff line number Diff line change 11import * as chains from "@starknet-react/chains" ;
22
3+ // devnet with mainnet network ID
34const mainnetFork = {
45 id : BigInt ( "0x534e5f4d41494e" ) ,
56 network : "devnet" ,
You can’t perform that action at this time.
0 commit comments