Skip to content

Commit

Permalink
chore: send transaction updates (#180)
Browse files Browse the repository at this point in the history
* chore: send transaction updates

* bump build number
  • Loading branch information
elefantel authored Aug 22, 2024
1 parent 28cb29a commit a12ba07
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Example/Tests/EthereumConvenienceMethodsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions Example/metamask-ios-sdk/TransactionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Sources/metamask-ios-sdk/Classes/Ethereum/Ethereum.swift
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,12 @@ public class Ethereum {
await ethereumRequest(method: .ethSignTypedDataV4, params: [address, typedData])
}

func sendTransaction(from: String, to: String, amount: String) async -> Result<String, RequestError> {
func sendTransaction(from: String, to: String, value: String) async -> Result<String, RequestError> {
await ethereumRequest(method: .ethSendTransaction, params: [
[
"from": from,
"to": to,
"amount": amount
"value": value
]
])
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/metamask-ios-sdk/Classes/SDK/MetaMaskSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ public extension MetaMaskSDK {
await ethereum.signTypedDataV4(typedData: typedData, address: address)
}

func sendTransaction(from: String, to: String, amount: String) async -> Result<String, RequestError> {
await ethereum.sendTransaction(from: from, to: to, amount: amount)
func sendTransaction(from: String, to: String, value: String) async -> Result<String, RequestError> {
await ethereum.sendTransaction(from: from, to: to, value: value)
}

func sendRawTransaction(signedTransaction: String) async -> Result<String, RequestError> {
Expand Down
2 changes: 1 addition & 1 deletion metamask-ios-sdk.podspec
Original file line number Diff line number Diff line change
@@ -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'

Expand Down

0 comments on commit a12ba07

Please sign in to comment.