Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fetch identity request #82

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading