Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 3e619c8

Browse files
authored
Merge pull request #12 from magiclabs/jerryliu-sc-64075-add-signtypeddata-v4-in-ios-sdk
Jerryliu sc 64075 add signtypeddata v4 in ios sdk
2 parents 90fa270 + 716c3e8 commit 3e619c8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Sources/MagicSDK/Modules/Web3/Web3Extension.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ public extension Web3.Eth {
6464
)
6565
properties.provider.send(request: req, response: response)
6666
}
67+
68+
func signTypedDataV4(
69+
account: EthereumAddress,
70+
data: EIP712TypedData,
71+
response: @escaping Web3ResponseCompletion<EthereumData>
72+
) {
73+
let req = RPCRequest<SignTypedDataCallParams>(
74+
id: properties.rpcId,
75+
jsonrpc: Web3.jsonrpc,
76+
method: "eth_signTypedData_v4",
77+
params: SignTypedDataCallParams(
78+
account: account, data: data
79+
)
80+
)
81+
properties.provider.send(request: req, response: response)
82+
}
6783
}
6884

6985
// MARK: - web3 extension Promises
@@ -95,6 +111,13 @@ public extension Web3.Eth {
95111
signTypedDataV3(account: account, data: data, response: promiseResolver(resolver))
96112
}
97113
}
114+
115+
func signTypedDataV4(
116+
account: EthereumAddress, data: EIP712TypedData) -> Promise<EthereumData> {
117+
return Promise { resolver in
118+
signTypedDataV4(account: account, data: data, response: promiseResolver(resolver))
119+
}
120+
}
98121
}
99122

100123
public extension RPCRequest {

0 commit comments

Comments
 (0)