diff --git a/Example/Shared/Signer/ETHSigner.swift b/Example/Shared/Signer/ETHSigner.swift index 6ff523441..dfe84420b 100644 --- a/Example/Shared/Signer/ETHSigner.swift +++ b/Example/Shared/Signer/ETHSigner.swift @@ -32,12 +32,14 @@ struct ETHSigner { return AnyCodable(result) } - func sendTransaction(_ params: AnyCodable) -> AnyCodable { - let params = try! params.get([EthereumTransaction].self) + func sendTransaction(_ params: AnyCodable) throws -> AnyCodable { + let params = try params.get([EthereumTransaction].self) var transaction = params[0] transaction.gas = EthereumQuantity(quantity: BigUInt("1234")) + transaction.nonce = EthereumQuantity(quantity: BigUInt("0")) + transaction.gasPrice = EthereumQuantity(quantity: BigUInt(0)) print(transaction.description) - let signedTx = try! transaction.sign(with: self.privateKey, chainId: 4) + let signedTx = try transaction.sign(with: self.privateKey, chainId: 4) let (r, s, v) = (signedTx.r, signedTx.s, signedTx.v) let result = r.hex() + s.hex().dropFirst(2) + String(v.quantity, radix: 16) return AnyCodable(result) diff --git a/Example/Shared/Signer/Signer.swift b/Example/Shared/Signer/Signer.swift index 16e75775f..3091c6c98 100644 --- a/Example/Shared/Signer/Signer.swift +++ b/Example/Shared/Signer/Signer.swift @@ -20,7 +20,7 @@ final class Signer { return signer.signTypedData(request.params) case "eth_sendTransaction": - return signer.sendTransaction(request.params) + return try signer.sendTransaction(request.params) case "solana_signTransaction": return SOLSigner.signTransaction(request.params)