Repository navigation
v17.1.0
v17.1.0
Added
getClaimableBalanceIdFromResult(result, opIndex): reads the claimable balance ID created by aCreateClaimableBalanceoperation out of a submitted transaction'sxdr.TransactionResult, unwrapping a fee bump when there is one. It returns the same 72-character hex form asTransaction.getClaimableBalanceId(opIndex), which derives the ID before submission; use this one when you only have the result. Horizon'sresult_xdris base64, so decode it first withxdr.TransactionResult.fromXdr(result_xdr, "base64"), whilerpc.Server.getTransactionalready returns a parsedresultXdr. It throws aRangeErrorfor an out-of-rangeopIndex, and aTypeErrorwhenresultis not a transaction result, when the transaction failed, or when the operation atopIndexis not a successfulCreateClaimableBalance(#1719).
Fixed
- Generated TypeScript bindings keep the raw spec name for a function parameter or struct field that is a reserved word or not a valid identifier, instead of renaming it: since #1345 a parameter
newwas typed asnew_while the runtime readnew, so the typed call threwMissing field new, and a typed struct read of a renamed field wasundefined. Methods anddeploynow take a singleargsobject,set(args: { new: number }, options?); call sites are unchanged, callers who used a renamed key switch to the raw name (new_tonew,_1sttoargs["1st"]), method names still get the trailing_, and a__constructorwith no inputs now generatesdeploy(null, options)instead ofdeploy(options)(#1733). - Horizon call builders now confine a resource identifier to one URL path segment, so a
/in it no longer opens a new segment. An identifier that is empty,.,.., or not astring/number/bigintthrows aTypeErrorinstead of re-pointing the request at a different endpoint —accountId("")previously reached the collection endpoint and returned a page of records, andaccountId([".."])resolved to the server root. AffectsaccountId(),transaction(),operation(),offer(),claimableBalance(),ledger(),liquidityPoolId(),loadAccount()and thefor*()neighbor filters;liquidityPoolId()was reachable the same way because its hex check is unanchored, which is tracked separately in #1703. A decimalnumberorbigintidentifier still works, and well-formed identifiers are unaffected, since no valid Stellar identifier contains/,.,?or#(#1702). - These
TypeErrors are thrown synchronously fromcall()andstream()rather than as a rejected promise, which matches the existingToo many filters specifiederror, so a caller that only attaches.catch()needs atry/catch. Three cases sit outside that, all unchanged by this release:loadAccount()isasync, so it rejects and.catch()does work;liquidityPools().liquidityPoolId()throws from the builder method; andledgers().ledger()with theforLedger()filters coerce the sequence withtoString()first, so a nullish sequence throws there rather than reaching this guard (#1702). - Templated Horizon
_linksfunctions now apply the call builders' path-segment guard to a path variable. One that is empty,.,.., or not astring/number/bigintthrows aTypeErrorinstead of re-pointing the request at a different endpoint:account.data({ key: ".." })previously requested the account endpoint, not the data endpoint. Query values are unaffected.AccountResponse.data()and theserver.root()links both take the path variable through an option TypeScript does not declare, so no call that compiles today changes behavior (#1718). StellarToml.Resolver.resolve()now validates the domain and throwsInvalid domainbefore making a request (#1720). It previously put the string straight into the URL, so some inputs reached a different host, or a different path, than the caller named. A domain must be a plain host name with an optional port: credentials and an embedded/,?,#or\are rejected, as is an empty domain. Surrounding whitespace and a trailing/are stripped rather than rejected, so input that worked before keeps working. Host names, IP literals, IPv6 literals, and ports still work, but the request URL is normalized, soACME.comis requested asacme.com.Asset.fromOperationpreserves theassetTypeCreditAlphanum12union arm even when the decoded code is four characters or shorter, instead of re-deriving the arm from code length. Such an asset now re-encodes to the same XDR bytes it was decoded from, and itsgetAssetType(),contractId(),equals(), andAsset.compare()results reflect the alphanum12 arm.equals()now also compares the asset type, so a decoded short-code alphanum12 asset is no longer equal to the alphanum4 asset with the same code and issuer. User-constructed assets are unaffected:new Asset(code, issuer)still derives the type from code length (#1584).rpc.Server.getContractDatano longer reports a transport failure as a missing entry. It previously caught every error from the ledger lookup and rethrew{ code: 404 }, so a 429, a 5xx, or a network error looked the same as an absent entry. Those errors now propagate untouched, and only a lookup that returns no entry throws the404-shaped error, whose shape is unchanged (#1679).
Changed
HorizonApi.Predicategains theunconditionalandabs_before_epochfields it previously omitted, so the type now describes every predicate Horizon serves (#1701). It stays aninterface, so declaration merging still works. One case does break at compile time: a consumer who already augmented the namespace to declareunconditionalorabs_before_epochwith a different type than the SDK now uses getsTS2717and must drop that part of their augmentation.- Updated the production
axiosdependency from1.18.0to1.20.0(#1712).
New Contributors
- @leocagli made their first contribution in #1679
- @yigitcangokmen made their first contribution in #1670
Full Changelog: v17.0.1...v17.1.0