Skip to content

Commit

Permalink
Rename addMemo -> setMemo (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ifropc authored Aug 15, 2023
1 parent 6438f49 commit ac2a0f1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.stellar.walletsdk.horizon.transaction

import org.stellar.sdk.*
import org.stellar.sdk.TransactionBuilder as SdkBuilder
import org.stellar.sdk.responses.AccountResponse
import org.stellar.walletsdk.*
import org.stellar.walletsdk.anchor.MemoType
Expand All @@ -14,6 +13,7 @@ import org.stellar.walletsdk.extension.*
import org.stellar.walletsdk.horizon.AccountKeyPair
import org.stellar.walletsdk.horizon.Stellar
import org.stellar.walletsdk.util.*
import org.stellar.sdk.TransactionBuilder as SdkBuilder

/** Class that allows to construct Stellar transactions, containing one or more operations */
@Suppress("TooManyFunctions")
Expand Down Expand Up @@ -43,11 +43,11 @@ internal constructor(
}

/**
* Add memo to this builder
* Set memo to this builder
*
* @param memo memo to add
*/
fun addMemo(memo: Pair<MemoType, String>): TransactionBuilder {
fun setMemo(memo: Pair<MemoType, String>): TransactionBuilder {
builder.addMemo(memo.first.mapper(memo.second))
return this
}
Expand Down Expand Up @@ -171,7 +171,7 @@ suspend fun TransactionBuilder.transferWithdrawalTransaction(
): TransactionBuilder {
transaction.requireStatus(TransactionStatus.PENDING_USER_TRANSFER_START)

return this.addMemo(
return this.setMemo(
transaction.withdrawalMemo?.let { transaction.withdrawalMemoType to it }
?: throw ValidationException("Missing withdrawal_memo in the transaction")
)
Expand Down

0 comments on commit ac2a0f1

Please sign in to comment.