From a12ba079888d335b4138b0b476f6fd26e431b055 Mon Sep 17 00:00:00 2001 From: Mpendulo Ndlovu Date: Thu, 22 Aug 2024 11:44:39 +0200 Subject: [PATCH] chore: send transaction updates (#180) * chore: send transaction updates * bump build number --- Example/Tests/EthereumConvenienceMethodsTests.swift | 2 +- Example/metamask-ios-sdk/TransactionView.swift | 8 ++++---- Sources/metamask-ios-sdk/Classes/Ethereum/Ethereum.swift | 4 ++-- Sources/metamask-ios-sdk/Classes/SDK/MetaMaskSDK.swift | 4 ++-- metamask-ios-sdk.podspec | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Example/Tests/EthereumConvenienceMethodsTests.swift b/Example/Tests/EthereumConvenienceMethodsTests.swift index c53f232..10d8092 100644 --- a/Example/Tests/EthereumConvenienceMethodsTests.swift +++ b/Example/Tests/EthereumConvenienceMethodsTests.swift @@ -176,7 +176,7 @@ class EthereumConvenienceMethodsTests: XCTestCase { let expectation = self.expectation(description: "Request should return transaction hash result") performSuccessfulTask({ - await self.ethereum.sendTransaction(from: "0x1234", to: "0x5678", amount: "0x10") + await self.ethereum.sendTransaction(from: "0x1234", to: "0x5678", value: "0x10") }, expectedValue: transactionHash, expectation: expectation) sendResultAndAwait(transactionHash, method: .ethSendTransaction) await fulfillment(of: [expectation], timeout: 2.0) diff --git a/Example/metamask-ios-sdk/TransactionView.swift b/Example/metamask-ios-sdk/TransactionView.swift index c541e98..3fca987 100644 --- a/Example/metamask-ios-sdk/TransactionView.swift +++ b/Example/metamask-ios-sdk/TransactionView.swift @@ -11,7 +11,7 @@ import metamask_ios_sdk struct TransactionView: View { @EnvironmentObject var metamaskSDK: MetaMaskSDK - @State private var amount = "0x000000000000000001" + @State private var value = "0x8ac7230489e80000" @State var result: String = "" @State private var errorMessage = "" @State private var showError = false @@ -43,9 +43,9 @@ struct TransactionView: View { } Section { - Text("Amount") + Text("Value") .modifier(TextCallout()) - TextField("Amount", text: $amount) + TextField("Value", text: $amount) .modifier(TextCaption()) .frame(minHeight: 32) .modifier(TextCurvature()) @@ -108,7 +108,7 @@ struct TransactionView: View { let transactionResult = isConnectWith ? await metamaskSDK.connectWith(transactionRequest) - : await metamaskSDK.sendTransaction(from: metamaskSDK.account, to: to, amount: amount) + : await metamaskSDK.sendTransaction(from: metamaskSDK.account, to: to, value: value) showProgressView = false diff --git a/Sources/metamask-ios-sdk/Classes/Ethereum/Ethereum.swift b/Sources/metamask-ios-sdk/Classes/Ethereum/Ethereum.swift index 588acef..ea098e5 100644 --- a/Sources/metamask-ios-sdk/Classes/Ethereum/Ethereum.swift +++ b/Sources/metamask-ios-sdk/Classes/Ethereum/Ethereum.swift @@ -343,12 +343,12 @@ public class Ethereum { await ethereumRequest(method: .ethSignTypedDataV4, params: [address, typedData]) } - func sendTransaction(from: String, to: String, amount: String) async -> Result { + func sendTransaction(from: String, to: String, value: String) async -> Result { await ethereumRequest(method: .ethSendTransaction, params: [ [ "from": from, "to": to, - "amount": amount + "value": value ] ]) } diff --git a/Sources/metamask-ios-sdk/Classes/SDK/MetaMaskSDK.swift b/Sources/metamask-ios-sdk/Classes/SDK/MetaMaskSDK.swift index 857e359..fab0081 100644 --- a/Sources/metamask-ios-sdk/Classes/SDK/MetaMaskSDK.swift +++ b/Sources/metamask-ios-sdk/Classes/SDK/MetaMaskSDK.swift @@ -170,8 +170,8 @@ public extension MetaMaskSDK { await ethereum.signTypedDataV4(typedData: typedData, address: address) } - func sendTransaction(from: String, to: String, amount: String) async -> Result { - await ethereum.sendTransaction(from: from, to: to, amount: amount) + func sendTransaction(from: String, to: String, value: String) async -> Result { + await ethereum.sendTransaction(from: from, to: to, value: value) } func sendRawTransaction(signedTransaction: String) async -> Result { diff --git a/metamask-ios-sdk.podspec b/metamask-ios-sdk.podspec index 837d901..4bb7986 100644 --- a/metamask-ios-sdk.podspec +++ b/metamask-ios-sdk.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'metamask-ios-sdk' - s.version = '0.8.2' + s.version = '0.8.3' s.summary = 'Enable users to easily connect with their MetaMask Mobile wallet.' s.swift_version = '5.5'