Skip to content

Commit 4f51bf2

Browse files
Merge branch '0xsequence-v3-SDK' into dargon789
2 parents d6bfecf + cfe53fb commit 4f51bf2

21 files changed

Lines changed: 114 additions & 6384 deletions

File tree

.codesandbox/src/App.tsx

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,15 @@ const App = () => {
109109
const [isOpen, toggleModal] = useState(false)
110110
const [warning, setWarning] = useState(false)
111111

112-
useMemo(() => {
113-
wallet.on('chainChanged', (chainId: string) => {
112+
useEffect(() => {
113+
const listener = (chainId: string) => {
114114
setShowChainId(Number(BigInt(chainId)))
115-
})
116-
}, [])
115+
}
116+
wallet.on('chainChanged', listener)
117+
return () => {
118+
wallet.removeListener('chainChanged', listener)
119+
}
120+
}, [wallet])
117121

118122
useEffect(() => {
119123
setIsWalletConnected(wallet.isConnected())
@@ -125,14 +129,20 @@ const App = () => {
125129
}, [isWalletConnected])
126130

127131
useEffect(() => {
128-
// Wallet events
129-
wallet.client.onOpen(() => {
132+
const onOpen = () => {
130133
console.log('wallet window opened')
131-
})
132-
133-
wallet.client.onClose(() => {
134+
}
135+
const onClose = () => {
134136
console.log('wallet window closed')
135-
})
137+
}
138+
139+
wallet.client.onOpen(onOpen)
140+
wallet.client.onClose(onClose)
141+
142+
return () => {
143+
wallet.client.removeListener('open', onOpen)
144+
wallet.client.removeListener('close', onClose)
145+
}
136146
}, [wallet])
137147

138148
const defaultConnectOptions: ConnectOptions = {
@@ -281,7 +291,7 @@ const App = () => {
281291
const topChainId = wallet.getChainId()
282292
appendConsoleLine(`top chainId: ${topChainId}`)
283293

284-
const provider = wallet.getProvider()
294+
const provider = wallet
285295
const providerChainId = provider!.getChainId()
286296
appendConsoleLine(`provider.getChainId(): ${providerChainId}`)
287297

@@ -958,18 +968,9 @@ And that has made all the difference.
958968
}
959969
}, [email, isOpen])
960970

961-
const sanitizeEmail = (email: string) => {
962-
// Trim unnecessary spaces
963-
email = email.trim()
964-
965-
// Check if the email matches the pattern of a typical email
966-
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/
967-
if (emailRegex.test(email)) {
968-
return true
969-
}
970-
971-
return false
972-
}
971+
const sanitizeEmail = (email: string | null) => {
972+
if (!email) return false
973+
const trimmedEmail = email.trim()
973974

974975
return (
975976
<Box marginY="0" marginX="auto" paddingX="6" style={{ maxWidth: '720px', marginTop: '80px', marginBottom: '80px' }}>
@@ -1088,7 +1089,7 @@ And that has made all the difference.
10881089
name="chainId"
10891090
label={'Network'}
10901091
labelLocation="top"
1091-
onValueChange={value => wallet.setDefaultChainId(Number(value))}
1092+
onValueChange={value => sequence.getWallet().setDefaultChainId(Number(value))}
10921093
value={String(showChainId)}
10931094
options={[
10941095
...Object.values(networks).map(network => ({

.github/workflows/Publish-Dists.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
branches:
77
- master
88

9+
permissions:
10+
contents: write
11+
912
jobs:
1013
build-and-push:
1114
runs-on: ubuntu-latest

packages/services/relayer/src/relayer/relayer.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)