Skip to content

Commit eedcb74

Browse files
committed
improvements
1 parent a5b182e commit eedcb74

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
"js-base64": "^3.7.2",
126126
"lit": "^2.3.1",
127127
"ramda": "^0.29.0",
128+
"rxjs": "^7.8.1",
128129
"web3modal": "^1.9.9",
129130
"yaml": "2.3.1"
130131
},
@@ -166,7 +167,6 @@
166167
"rimraf": "5.0.1",
167168
"rollup": "3.26.2",
168169
"rollup-plugin-dts": "5.3.0",
169-
"rxjs": "^7.8.1",
170170
"sass": "1.63.6",
171171
"svelte": "4.0.5",
172172
"tailwindcss": "3.3.3",

src/components/ConnectButton.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ import { clientsDev } from '@devprotocol/dev-kit/agent'
6464
import { whenDefined } from '@devprotocol/util-ts'
6565
import { onMountClient } from '../events'
6666
import HSButton from './Primitives/Hashi/HSButton.vue'
67+
import { combineLatest } from 'rxjs'
6768
6869
type Data = {
6970
modalProvider?: Web3Modal
@@ -78,6 +79,9 @@ export default defineComponent({
7879
components: {
7980
HSButton,
8081
},
82+
props: {
83+
chainId: Number,
84+
},
8185
data(): Data {
8286
return {
8387
modalProvider: undefined,
@@ -96,9 +100,12 @@ export default defineComponent({
96100
])
97101
this.connection = connection
98102
this.modalProvider = GetModalProvider()
99-
connection().account.subscribe((acc?: string) => {
100-
this.truncateWalletAddress = acc ? this.truncateEthAddress(acc) : ''
101-
})
103+
combineLatest([connection().chain, connection().account]).subscribe(
104+
([chainId, acc]) => {
105+
this.supportedNetwork = chainId === this.chainId
106+
this.truncateWalletAddress = acc ? this.truncateEthAddress(acc) : ''
107+
}
108+
)
102109
const { currentAddress, connectedProvider, provider } =
103110
await ReConnectWallet(this.modalProvider as Web3Modal)
104111
if (currentAddress) {
@@ -114,7 +121,7 @@ export default defineComponent({
114121
},
115122
methods: {
116123
setSigner(provider: Eip1193Provider) {
117-
this.connection!().setEip1193Provider(provider)
124+
this.connection!().setEip1193Provider(provider, BrowserProvider)
118125
},
119126
async connect() {
120127
const connectedProvider = await this.modalProvider!.connect()
@@ -124,7 +131,7 @@ export default defineComponent({
124131
},
125132
async fetchUserBalance(currentAddress: string, provider: ContractRunner) {
126133
const [l1, l2] = await clientsDev(provider)
127-
this.supportedNetwork = l1 || l2 ? true : false
134+
// this.supportedNetwork = l1 || l2 ? true : false
128135
const balance = await (l1 || l2)?.balanceOf(currentAddress)
129136
const formatted = formatUnits(balance ?? 0)
130137
const rounded = Math.round((+formatted + Number.EPSILON) * 100) / 100

src/layouts/Aside.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
id="clubs_connect_button"
55
v-if="showConnectButton"
66
class="w-full"
7+
:chainId="config.chainId"
78
/>
89
<div class="relative">
910
<ActionButton

0 commit comments

Comments
 (0)