@@ -64,6 +64,7 @@ import { clientsDev } from '@devprotocol/dev-kit/agent'
6464import { whenDefined } from ' @devprotocol/util-ts'
6565import { onMountClient } from ' ../events'
6666import HSButton from ' ./Primitives/Hashi/HSButton.vue'
67+ import { combineLatest } from ' rxjs'
6768
6869type 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
0 commit comments