@@ -109,6 +109,7 @@ import {
109109 getNamespacesChains ,
110110 getNamespacesMethods ,
111111 getNamespacesEvents ,
112+ unique ,
112113} from "@walletconnect/utils" ;
113114import EventEmmiter from "events" ;
114115import {
@@ -1015,7 +1016,7 @@ export class Engine extends IEngine {
10151016 eip155 : {
10161017 chains,
10171018 // request `personal_sign` method by default to allow for fallback siwe
1018- methods : [ ...new Set ( [ "personal_sign" , ...methods ] ) ] ,
1019+ methods : [ ...unique ( [ "personal_sign" , ...methods ] ) ] ,
10191020 events : [ "chainChanged" , "accountsChanged" ] ,
10201021 } ,
10211022 } ;
@@ -1128,8 +1129,8 @@ export class Engine extends IEngine {
11281129 relay : { protocol : "irn" } ,
11291130 pairingTopic,
11301131 namespaces : buildNamespacesFromAuth (
1131- [ ...new Set ( approvedMethods ) ] ,
1132- [ ...new Set ( approvedAccounts ) ] ,
1132+ [ ...unique ( approvedMethods ) ] ,
1133+ [ ...unique ( approvedAccounts ) ] ,
11331134 ) ,
11341135 transportType,
11351136 } ;
@@ -1337,8 +1338,8 @@ export class Engine extends IEngine {
13371338 relay : { protocol : "irn" } ,
13381339 pairingTopic : pendingRequest . pairingTopic ,
13391340 namespaces : buildNamespacesFromAuth (
1340- [ ...new Set ( approvedMethods ) ] ,
1341- [ ...new Set ( approvedAccounts ) ] ,
1341+ [ ...unique ( approvedMethods ) ] ,
1342+ [ ...unique ( approvedAccounts ) ] ,
13421343 ) ,
13431344 transportType,
13441345 } ;
@@ -3184,7 +3185,7 @@ export class Engine extends IEngine {
31843185 }
31853186
31863187 // ----- reject multi namespaces ----- //
3187- const uniqueNamespaces = [ ...new Set ( chains . map ( ( chain ) => parseChainId ( chain ) . namespace ) ) ] ;
3188+ const uniqueNamespaces = [ ...unique ( chains . map ( ( chain ) => parseChainId ( chain ) . namespace ) ) ] ;
31883189 if ( uniqueNamespaces . length > 1 ) {
31893190 throw new Error (
31903191 "Multi-namespace requests are not supported. Please request single namespace only." ,
0 commit comments