Skip to content

Commit

Permalink
Merge pull request #82 from WalletConnect/fetchIdentity-update
Browse files Browse the repository at this point in the history
Update fetch identity request
  • Loading branch information
llbartekll authored Jul 26, 2024
2 parents d35349c + e39c2a2 commit 2d94ebc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions Sources/Web3Modal/Core/BlockchainAPIInteractor.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import WalletConnectNetworking

class BlockchainAPIInteractor: ObservableObject {
let store: Store
Expand All @@ -15,15 +16,18 @@ class BlockchainAPIInteractor: ObservableObject {

let address = account.address
let chainId = account.chain.absoluteString

let clientId = try? Relay.instance.getClientId()


let httpClient = HTTPNetworkClient(host: "rpc.walletconnect.com")
let response = try await httpClient.request(
Identity.self,
at: BlockchainAPI.getIdentity(
params: .init(
address: address,
chainId: chainId,
projectId: Web3Modal.config.projectId
projectId: Web3Modal.config.projectId,
clientId: clientId
)
)
)
Expand Down
9 changes: 7 additions & 2 deletions Sources/Web3Modal/Networking/BlockchainAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ enum BlockchainAPI: HTTPService {
let address: String
let chainId: String
let projectId: String
let clientId: String?
}

case getIdentity(params: GetIdentityParams)
Expand All @@ -28,10 +29,14 @@ enum BlockchainAPI: HTTPService {
var queryParameters: [String: String]? {
switch self {
case let .getIdentity(params):
return [
var parameters: [String: String] = [
"projectId": params.projectId,
"chainId": params.chainId,
"chainId": params.chainId
]
if let clientId = params.clientId {
parameters["clientId"] = clientId
}
return parameters
}
}

Expand Down

0 comments on commit 2d94ebc

Please sign in to comment.