Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
Merged
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
23 changes: 23 additions & 0 deletions Sources/MagicSDK/Modules/Web3/Web3Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ public extension Web3.Eth {
)
properties.provider.send(request: req, response: response)
}

func signTypedDataV4(
account: EthereumAddress,
data: EIP712TypedData,
response: @escaping Web3ResponseCompletion<EthereumData>
) {
let req = RPCRequest<SignTypedDataCallParams>(
id: properties.rpcId,
jsonrpc: Web3.jsonrpc,
method: "eth_signTypedData_v4",
params: SignTypedDataCallParams(
account: account, data: data
)
)
properties.provider.send(request: req, response: response)
}
}

// MARK: - web3 extension Promises
Expand Down Expand Up @@ -95,6 +111,13 @@ public extension Web3.Eth {
signTypedDataV3(account: account, data: data, response: promiseResolver(resolver))
}
}

func signTypedDataV4(
account: EthereumAddress, data: EIP712TypedData) -> Promise<EthereumData> {
return Promise { resolver in
signTypedDataV4(account: account, data: data, response: promiseResolver(resolver))
}
}
}

public extension RPCRequest {
Expand Down