Skip to content

Commit 2d94ebc

Browse files
authored
Merge pull request #82 from WalletConnect/fetchIdentity-update
Update fetch identity request
2 parents d35349c + e39c2a2 commit 2d94ebc

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Sources/Web3Modal/Core/BlockchainAPIInteractor.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Foundation
2+
import WalletConnectNetworking
23

34
class BlockchainAPIInteractor: ObservableObject {
45
let store: Store
@@ -15,15 +16,18 @@ class BlockchainAPIInteractor: ObservableObject {
1516

1617
let address = account.address
1718
let chainId = account.chain.absoluteString
18-
19+
let clientId = try? Relay.instance.getClientId()
20+
21+
1922
let httpClient = HTTPNetworkClient(host: "rpc.walletconnect.com")
2023
let response = try await httpClient.request(
2124
Identity.self,
2225
at: BlockchainAPI.getIdentity(
2326
params: .init(
2427
address: address,
2528
chainId: chainId,
26-
projectId: Web3Modal.config.projectId
29+
projectId: Web3Modal.config.projectId,
30+
clientId: clientId
2731
)
2832
)
2933
)

Sources/Web3Modal/Networking/BlockchainAPI.swift

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ enum BlockchainAPI: HTTPService {
55
let address: String
66
let chainId: String
77
let projectId: String
8+
let clientId: String?
89
}
910

1011
case getIdentity(params: GetIdentityParams)
@@ -28,10 +29,14 @@ enum BlockchainAPI: HTTPService {
2829
var queryParameters: [String: String]? {
2930
switch self {
3031
case let .getIdentity(params):
31-
return [
32+
var parameters: [String: String] = [
3233
"projectId": params.projectId,
33-
"chainId": params.chainId,
34+
"chainId": params.chainId
3435
]
36+
if let clientId = params.clientId {
37+
parameters["clientId"] = clientId
38+
}
39+
return parameters
3540
}
3641
}
3742

0 commit comments

Comments
 (0)