All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
SetOpSourceAccountnow returns anerrorinstead of silently ignoring invalid source account addresses. AllBuildXDR()methods propagate this error. (#5912)- Liquidity pool asset pairs are validated strictly (#5974):
LiquidityPoolParameters.ToXDR,NewLiquidityPoolId,NewLiquidityPoolDeposit, andNewLiquidityPoolWithdrawnow requireAssetA < AssetBin the protocol's order (raw issuer key, not strkey text). Reversed or identical pairs — which previously could build operations that stellar-core rejects withCHANGE_TRUST_MALFORMED— now error at build time, with the message changed fromAssetA must be <= AssetBtoAssetA must be < AssetB.- Asset sort order via
Assets/LessThanchanges accordingly, andNativeAsset.LessThanno longer reports a native asset as less than another native asset. NewLiquidityPoolId,NewLiquidityPoolDeposit, andNewLiquidityPoolWithdrawvalidate ordering after XDR conversion, so a malformed asset now returns the conversion error rather than an ordering error (#5978).
11.0.0 - 2023-03-29
- Muxed accounts and ID memos can be used in the
BuildChallengeTx()andReadChallengeTx()SEP-10 utilitiy functions to identify users of shared Stellar accounts. (#4746)BuildChallengeTx():- Muxed account addresses can be passed as the
clientAccountID. - Adds an additional parameter of type
*txnbuild.MemoID. Memos cannot be specified if theclientAccoutIDid a muxed account address.
- Muxed account addresses can be passed as the
ReadChallengeTx():- Muxed account addresses may be returned as the
clientAccountID. - Adds an additional return value of type
*txnbuild.MemoID.
- Muxed account addresses may be returned as the
10.0.0 - 2022-04-18
- Adds support for Protocol 19 transaction preconditions (CAP-21).
- There are many new ways for a transaction to be (in)valid (see the new
Preconditionsstructure), and the corresponding breaking change is in how transactions are built:
tx, err := NewTransaction(TransactionParams{
SourceAccount: someAccount,
// ... other parameters ...
- Timebounds: NewTimeout(5),
+ Preconditions: Preconditions{TimeBounds: NewTimeout(5)},
})-
Timeboundshas been renamed toTimeBounds, though a type alias remains. -
A
*TimeBoundsstructure is no longer considered valid (viaValidate()) if it'snil. This further reinforces the fact that transactions need timebounds.
9.0.0 - 2022-01-10
- Enable Muxed Accounts (SEP-23) by default (#4169):
- Remove
TransactionParams.EnableMuxedAccounts - Remove
TransactionFromXDROptionEnableMuxedAccounts - Remove
FeeBumpTransactionParams.EnableMuxedAccounts - Remove parameter
withMuxedAccounts boolfrom all methods/functions. - Remove
options ...TransactionFromXDROptionparameter fromTransactionFromXDR() - Rename
SetOpSourceMuxedAccount()to (pre-existing)SetOpSourceAccount()which now accepts bothGandM(muxed) account strkeys.
- Remove
- Use xdr.Price to represent prices in txnbuild instead of strings (#4167).
8.0.0-beta.0 - 2021-10-04
This release adds support for Protocol 18.
GenericTransaction,Transaction, andFeeBumpTransactionnow implementencoding.TextMarshalerandencoding.TextUnmarshaler.- New asset structures that conform to the new ChangeTrust and New assets:
- Support for the core liquidity pool XDR types:
LiquidityPoolId,LiquidityPoolParameters,LiquidityPoolDeposit, andLiquidityPoolWithdraw. - Support for the new asset structures:
ChangeTrustAssetandTrustLineAsset.
- There's now a 5-minute grace period to
transaction.ReadChallengeTx's minimum time bound constraint (#3824). - Assets can now be liquidity pool shares (
AssetTypePoolShare). - All asset objects can now be converted to the new
ChangeTrustAssetandTrustLineAssetobjects. - Assets can now be compared in accordance with the protocol, see their respective
LessThan()implementations.
ChangeTrustrequires aChangeTrustAsset.RevokeSponsorshiprequires aTrustLineAssetwhen revoking trustlines.RemoveTrustlineOphelper now requires aChangeTrustAssetvalidate*Assethelpers now require more-specific asset types.
v7.1.1 - 2021-06-25
- Claimable balance IDs are now precomputed correctly (
Transaction.ClaimableBalanceID(int)) even when the transaction's source account is a fully-muxed account (#3678). - Fix muxed account address parsing for account merge operation (#3722).
v7.1.0 - 2021-06-01
-
Add
Transaction.SequenceNumber()helper function to make retrieving the underlying sequence number easier (#3616). -
Add
Transaction.AddSignatureDecorated()helper function to make attaching decorated signatures to existing transactions easier (#3640).
BaseFeeinTransactionParamswhen callingNewTransactionis allowed to be zero because the fee can be paid by wrapping aTransactionin aFeeBumpTransaction(#3622).
v7.0.0 - 2021-05-15
AllowTrustOpAssetwas renamed toAssetCode,{Must}NewAllowTrustAssetwas renamed to{Must}NewAssetCodeFromString.- Some methods from the
Operationinterface (BuildXDR(),FromXDR()andValidate()) now take an additionalboolparameter (withMuxedAccounts) to indicate whether SEP23 M-strkeys should be enabled.
- Add support for Stellar Protocol 17 (CAP35):
Clawback,ClawbackClaimableBalanceandSetTrustlineFlagsoperations. - Add opt-in support for SEP23 M-strkeys for
MuxedAccounts:- Some methods from the
Operationinterface (BuildXDR(),FromXDR()andValidate()) now take an additionalboolparameter (withMuxedAccounts) - The parameters from
NewFeeBumpTransaction()andNewTransaction()now include a new field (EnableMuxedAccounts) to enable M-strekeys. TransactionFromXDR()now allows passing aTransactionFromXDROptionEnableMuxedAccountsoption, to enable M-strkey parsing.
- Some methods from the
v6.0.0 - 2021-02-22
- Updates the SEP-10 helper function parameters to support SEP-10 v3.1.
- The following functions added the
webAuthDomainparameter:BuildChallengeTx()ReadChallengeTx()VerifyChallengeTxThreshold()VerifyChallengeTxSigners()
- The webAuthDomain parameter is verified in the
Read*andVerify*functions if it is contained in the challenge transaction, and is ignored if the challenge transaction was generated by an older implementation that does not support the webAuthDomain. - The webAuthDomain parameter is included in challenge transactions generated in the
Build*function, and the resulting challenge transaction is compatible with SEP-10 v2.1 or greater.
- The following functions added the
- Use strings to represent source accounts in Operation structs (#3393) see example below:
bumpSequenceOp := txnbuild.BumpSequence{BumpTo: 100, SourceAccount: "GB56OJGSA6VHEUFZDX6AL2YDVG2TS5JDZYQJHDYHBDH7PCD5NIQKLSDO"}
- Remove
TxEnvelope()functions fromTransactionandFeeBumpTransactionto simplify the API.ToXDR()should be used instead ofTxEnvelope()(#3377)
v5.0.1 - 2021-02-16
- Fix a bug in
ClaimableBalanceID()where the wrong account was used to derive the claimable balance id (#3406)
v5.0.0 - 2020-11-12
- Updates the SEP-10 helper function parameters and return values to support SEP-10 v3.0
- The following functions replaced the
homeDomainparameter withhomeDomains(note: plural):ReadChallengeTx()VerifyChallengeTxThreshold()VerifyChallengeTxSigners()
ReadChallengeTx()now returns a third non-error value:matchedHomeDomain
- The following functions replaced the
v4.2.0 - 2020-11-11
- Add
HashHex(),SignWithKeyString(),SignHashX(), andAddSignatureBase64()functions back toFeeBumpTransaction(#3199).
v4.1.0 - 2020-10-16
-
Add helper function
ParseAssetString(), making it easier to build anAssetstructure from a string in canonical form and check its various properties (#3105). -
Add helper function
Transaction.ClaimableBalanceID(), making it easier to calculate balance IDs for claimable balances without actually submitting the transaction (#3122). -
Add support for SEP-10 v2.1.0.
- Remove verification of home domain. (Will be reintroduced and changed in a future release.)
- Allow additional manage data operations that have source account as the server key.
v4.0.1 - 2020-10-02
- Fixed bug in
TransactionFromXDR()which occurs when parsing transaction XDR envelopes which contain Protocol 14 operations.
v4.0.0 - 2020-09-29
Added support for the new operations in Protocol 14. Now it is possible to:
- Create and claim claimable balance operations (see CAP-23) with the
[Create|Claim]ClaimableBalancestructures and their associated helpers - Begin/end sponsoring future reserves for other accounts (see CAP-33) with the
[Begin|End]SponsoringFutureReservesoperations - Revoke sponsorships of various objects with the
RevokeSponsorshipoperation (see CAP-33).
Also:
- Added support for Go 1.15.
- Dropped support for Go 1.13.
- Add support for SEP-10 v2.0.0.
- Replace
BuildChallengeTx'sanchorNameparameter withhomeDomain. - Add
homeDomainparameter toReadChallengeTx,VerifyChallengeTxThreshold, andVerifyChallengeTxSigners.
- Replace
v3.2.0 - 2020-06-18
txnbuildnow generates V1 transaction envelopes which are only supported by Protocol 13 (#2640)- Add
ToXDR()functions forTransactionandFeeBumpTransactioninstances which return xdr transaction envelopes without errors (#2651)
v3.1.0 - 2020-05-14
- Fix bug which occurs when parsing xdr offers with prices that require more than 7 decimals of precision (#2588)
- Add
AddSignatureBase64function to bothTransactionandFeeBumpTransactionobjects for adding a base64-encoded signature. #2586
v3.0.1 - 2020-05-11
- Fix bug which occurs when parsing transactions with manage data operations containing nil values (#2573)
v3.0.0 - 2020-04-28
- The
Accountinterface has been extended to includeGetSequenceNumber() (int64, error). Also,IncrementSequenceNumber()now returns an(int64, error)pair instead of a(xdr.SequenceNumber, error)pair. - Refactor workflow for creating and signing transactions. Previously, you could create a transaction envelope by populating a
Transactioninstance and calling theBuild()function on theTransactioninstance.
Transaction is now an opaque type which has accessor functions like SourceAccount() SimpleAccount, Memo() Memo, etc. The motivation behind this change is to make Transaction more immutable. Here is an example of how to use the new transaction type:
kp := keypair.MustParse("SBPQUZ6G4FZNWFHKUWC5BEYWF6R52E3SEP7R3GWYSM2XTKGF5LNTWW4R")
client := horizonclient.DefaultTestNetClient
ar := horizonclient.AccountRequest{AccountID: kp.Address()}
sourceAccount, err := client.AccountDetail(ar)
check(err)
op := txnbuild.Payment{
Destination: "GCCOBXW2XQNUSL467IEILE6MMCNRR66SSVL4YQADUNYYNUVREF3FIV2Z",
Amount: "10",
Asset: NativeAsset{},
}
tx, err := txnbuild.NewTransaction(
txnbuild.TransactionParams{
SourceAccount: &sourceAccount,
// If IncrementSequenceNum is true, NewTransaction() will call `sourceAccount.IncrementSequenceNumber()`
// to obtain the sequence number for the transaction.
// If IncrementSequenceNum is false, NewTransaction() will call `sourceAccount.GetSequenceNumber()`
// to obtain the sequence number for the transaction.
IncrementSequenceNum: true,
Operations: []Operation{&op},
BaseFee: MinBaseFee,
Timebounds: NewInfiniteTimeout(),
},
)
check(err)
tx, err = tx.Sign(network.TestNetworkPassphrase, kp.(*keypair.Full))TransactionFromXDRnow has the following signatureTransactionFromXDR(txeB64 string) (*GenericTransaction, error). AGenericTransactionis a container which can be unpacked into either aTransactionor aFeeBumpTransaction.BuildChallengeTxnow returns aTransactioninstance instead of the base 64 string encoding of the SEP 10 challenge transaction.VerifyChallengeTxhas been removed. UseVerifyChallengeTxThresholdorVerifyChallengeTxSignersinstead.
- Add
NewFeeBumpTransaction(params FeeBumpTransactionParams) (*FeeBumpTransaction, error)function for creating fee bump transactions. Note that fee bump transactions will only be accepted by Stellar Core once Protocol 13 is enabled.
AllowTrustsupports CAP0018 Fine-Grained Control of Authorization by exposing aAuthorizeToMaintainLiabilitiesboolean field.ReadChallengeTxwill reject any challenge transactions which are fee bump transactions.ReadChallengeTxwill reject any challenge transactions which contain a MuxedAccount with a memo ID.
- Dropped support for Go 1.12.
v1.5.0 - 2019-10-09
- Dropped support for Go 1.10, 1.11.
- Add support for stellar-core protocol 12, which implements CAP-0024 ("Make PathPayment Symmetrical"). (#1737).
- Deprecated: Following CAP-0024, the operation
txnbuild.PathPaymentis now deprecated in favour oftxnbuild.PathPaymentStrictReceive, and will be removed in a future release. This is a rename - the new operation behaves identically to the old one. Client code should be updated to use the new operation. - Add: New operation
txnbuild.PathPaymentStrictSendallows a path payment to be made where the amount sent is specified, and the amount received can vary.
v1.4.0 - 2019-08-09
- Add
BuildChallengeTxfunction for building SEP-10 challenge transaction(#1466). - Add
VerifyChallengeTxmethod for verifying SEP-10 challenge transaction(#1530). - Add
TransactionFromXDRfunction for buildingtxnbuild.Transactionstruct from a base64 XDR transaction envelope#1329. - Fix bug that allowed multiple calls to
Transaction.Buildincrement the number of operations in a transaction #1448. - Add
Transaction.SignWithKeyStringhelper method for signing transactions using secret keys as strings.(#1564)
v1.3.0 - 2019-07-08
- Add support for getting the hex-encoded transaction hash with
Transaction.HashHexmethod. TransactionEnvelopeis now available after building a transaction(Transaction.Build). Previously, this was only available after signing a transaction. (#1376)- Add support for getting the
TransactionEnvelopestruct withTransaction.TxEnvelopemethod (#1415). AllowTrustoperations no longer requires the asset issuer, only asset code is required (#1330).Transaction.SetDefaultFeemethod is deprecated and will be removed in the next major release (#1221).Transaction.TransactionFeemethod has been added to get the fee that will be paid for a transaction.Transaction.SignHashXmethod adds support for signing transactions with hash(x) signature types.
v1.2.0 - 2019-05-16
- In addition to account responses from horizon, transactions and operations can now be built with txnbuild.SimpleAccount structs constructed locally (#1266).
- Added
MaxTrustlineLimitwhich represents the maximum value for a trustline limit (#1265). - ChangeTrust operation with no
Limitfield set now defaults toMaxTrustlineLimit(#1265). - Add support for building
ManageBuyOfferoperation (#1165). - Fix bug in ChangeTrust operation builder (1296).
v1.1.0 - 2019-02-02
- Support for multiple signatures (#1198)
v1.0.0 - 2019-04-26
- Initial release