File tree Expand file tree Collapse file tree 4 files changed +28
-15
lines changed Expand file tree Collapse file tree 4 files changed +28
-15
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export const WalletSwitchEthereumChain = ({
19
19
if ( import . meta. env . PROD )
20
20
return < RequestDisabled
21
21
headline = { headline }
22
- description = "The Happy Wallet is an HappyChain exclusive 🤠"
22
+ description = "The Happy Wallet is a HappyChain exclusive 🤠"
23
23
reject = { reject }
24
24
/>
25
25
Original file line number Diff line number Diff line change @@ -224,13 +224,23 @@ export async function dispatchInjectedRequest(request: ProviderMsgsFromApp[Msgs.
224
224
225
225
case "wallet_getCapabilities" : {
226
226
checkAuthenticated ( )
227
- if ( ! request . payload ?. params ?. [ 0 ] ) {
228
- throw new EIP1474InvalidInput ( "Missing payload" )
227
+ if ( ! request . payload ?. params ?. [ 0 ] || ! request . payload ?. params ?. [ 1 ] ) {
228
+ throw new EIP1474InvalidInput ( "Missing payload parameters " )
229
229
}
230
-
231
230
checkAndChecksumAddress ( request . payload . params [ 0 ] )
232
231
233
232
const currentChainId = getCurrentChain ( ) . chainId
233
+ if ( request . payload . params [ 1 ] . length > 1 ) {
234
+ const requestedChainIds = request . payload . params [ 1 ]
235
+ for ( const chainId of requestedChainIds ) {
236
+ if ( chainId !== currentChainId ) {
237
+ console . warn (
238
+ `Unsupported chain ID requested: ${ chainId } . The Happy Wallet is a HappyChain exclusive 🤠!` ,
239
+ )
240
+ }
241
+ }
242
+ }
243
+
234
244
const capabilities : Capabilities = {
235
245
[ currentChainId ] : Object . fromEntries (
236
246
Object . values ( HappyWalletCapability ) . map ( ( capability ) => [ capability , { supported : true } ] ) ,
Original file line number Diff line number Diff line change @@ -102,13 +102,23 @@ export async function dispatchedPermissionlessRequest(request: ProviderMsgsFromA
102
102
103
103
case "wallet_getCapabilities" : {
104
104
checkAuthenticated ( )
105
- if ( ! request . payload ?. params ?. [ 0 ] ) {
106
- throw new EIP1474InvalidInput ( "Missing payload" )
105
+ if ( ! request . payload ?. params ?. [ 0 ] || ! request . payload ?. params ?. [ 1 ] ) {
106
+ throw new EIP1474InvalidInput ( "Missing payload parameters " )
107
107
}
108
-
109
108
checkAndChecksumAddress ( request . payload . params [ 0 ] )
110
109
111
110
const currentChainId = getCurrentChain ( ) . chainId
111
+ if ( request . payload . params [ 1 ] . length > 1 ) {
112
+ const requestedChainIds = request . payload . params [ 1 ]
113
+ for ( const chainId of requestedChainIds ) {
114
+ if ( chainId !== currentChainId ) {
115
+ console . warn (
116
+ `Unsupported chain ID requested: ${ chainId } . The Happy Wallet is a HappyChain exclusive 🤠!` ,
117
+ )
118
+ }
119
+ }
120
+ }
121
+
112
122
const capabilities : Capabilities = {
113
123
[ currentChainId ] : Object . fromEntries (
114
124
Object . values ( HappyWalletCapability ) . map ( ( capability ) => [ capability , { supported : true } ] ) ,
Original file line number Diff line number Diff line change 1
- import {
2
- BoopClient ,
3
- CreateAccount ,
4
- type ExecuteSuccess ,
5
- GetNonce ,
6
- Onchain ,
7
- computeBoopHash ,
8
- } from "@happy.tech/boop-sdk"
1
+ import { BoopClient , CreateAccount , computeBoopHash } from "@happy.tech/boop-sdk"
9
2
import { delayed , stringify } from "@happy.tech/common"
10
3
import { type PrivateKeyAccount , generatePrivateKey , privateKeyToAccount } from "viem/accounts"
11
4
import { createAndSignMintBoop } from "#lib/utils/test/helpers"
You can’t perform that action at this time.
0 commit comments