Ethereum provider
Smart wallets in Openfort are your primary interface for blockchain interactions. Once an embedded wallet is set up, a smart wallet is automatically created and associated for your user.
Getting an EIP-1193 provider
All of Openfort's wallets can export a standard EIP-1193 provider object. Openfort Swift SDK returns OpenfortEIP1193Web3Provider object which allows you to use Web3 framework in your App. This allows your app to request signatures and transactions from the wallet, using familiar JSON-RPC requests like personal_sign or eth_sendTransaction.
OpenfortEIP1193Web3Provider implements method which required by Web3 framework to send transactions:
Usage
public func send<Params, Result>(
request: RPCRequest<Params>,
response: @escaping Web3ResponseCompletion<Result>To get a wallet's EIP-1193 provider, use the OFSDK getEthereumProvider method:
do {
guard let provider = try await openfort.getEthereumProvider(params: OFGetEthereumProviderParams()) else {
print("Provider not available")
return
}
// Use provider here
} catch {
print("Error getting ethereum provider: \(error.localizedDescription)")
}Parameters
struct OFGetEthereumProviderParams: OFCodableSendable {
public let policy: String?
public let chains: [Int: String]?
public let providerInfo: ProviderInfo?
public let announceProvider: Bool?
}
struct ProviderInfo: OFCodableSendable {
public let icon: String?
public let name: String?
public let rdns: String?
}Returns
OpenfortEIP1193Web3ProviderThrows
{
method: method,
success: false,
error: error
}