@stellar/stellar-base 14.0.4 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md DELETED
@@ -1,1497 +0,0 @@
1
- # Changelog
2
-
3
- ## Unreleased
4
-
5
-
6
- ## [`v14.0.4`](https://github.com/stellar/js-stellar-base/compare/v14.0.3...v14.0.4):
7
-
8
- ### Fixed
9
- * Fixes a bug in `Address` which prevented it from decoding claimable balances ([#825](https://github.com/stellar/js-stellar-base/pull/825)).
10
- * Fixes a bug in `Soroban.formatTokenAmount` that would cause a lack of leading or trailing zeroes at the decimal point in some cases ([#821](https://github.com/stellar/js-stellar-base/pull/821), [#823](https://github.com/stellar/js-stellar-base/pull/823)).
11
-
12
-
13
- ## [`v14.0.3`](https://github.com/stellar/js-stellar-base/compare/v14.0.2...v14.0.3):
14
-
15
- ### Fixed
16
-
17
- - Add conversions for timepoint and duration scval types ([#819](https://github.com/stellar/js-stellar-base/pull/819))
18
-
19
- ## [`v14.0.2`](https://github.com/stellar/js-stellar-base/compare/v14.0.1...v14.0.2):
20
-
21
- ### Fixed
22
-
23
- - Lowered the maximum bid for fee-bumped Soroban transactions by not doubling the resource fee ([#817](https://github.com/stellar/js-stellar-sdk/pull/817)).
24
-
25
- ## [`v14.0.1`](https://github.com/stellar/js-stellar-base/compare/v14.0.0...v14.0.1):
26
-
27
- ### Fixed
28
-
29
- - Added missing `Asset.toString()` TypeScript definition ([#1218](https://github.com/stellar/js-stellar-sdk/pull/1218)).
30
-
31
- ## [`v14.0.0`](https://github.com/stellar/js-stellar-base/compare/v13.1.0...v14.0.0): Protocol 23
32
-
33
- ### Breaking Changes
34
-
35
- - This package now requires **>= Node 20**.
36
- - XDR definitions have been updated to align with Protocol 23 ([#800](https://github.com/stellar/js-stellar-base/pull/800)).
37
-
38
- ### Added
39
-
40
- - The `sodium-native` and `tweetnacl` dependencies have been replaced with `@noble/curves` ([#802](https://github.com/stellar/js-stellar-base/pull/802)).
41
- - Support for claimable balances and liquidity pools in `StrKey` ([#799](https://github.com/stellar/js-stellar-base/pull/799)).
42
- - Support for claimable balances, liquidity pools, and muxed accounts in `Address` ([#801](https://github.com/stellar/js-stellar-base/pull/801)).
43
- - Added the ability for `nativeToScVal` to convert arrays with differing types to smart contract values, e.g., `nativeToScVal([1, "x", "y"], { type: [ "i128", "symbol" ]})` will give you a `Vec<i128, symbol, string>` ([#803](https://github.com/stellar/js-stellar-base/pull/803)).
44
-
45
- ### Fixed
46
-
47
- - Removed the custom `Buffer.subarray` polyfill introduced in [#733](https://github.com/stellar/js-stellar-base/pull/733) in [v11.0.1](https://github.com/stellar/js-stellar-sdk/releases/tag/v11.0.1) as a workaround for React Native's Hermes engine. Please use [`@exodus/patch-broken-hermes-typed-arrays`](https://github.com/ExodusMovement/patch-broken-hermes-typed-arrays) as an alternative, if needed ([#795](https://github.com/stellar/js-stellar-base/pull/795)).
48
- - Fix browser compatibility with proper module resolution and UMD configuration ([#798](https://github.com/stellar/js-stellar-base/pull/798)).
49
- - Remove `MuxedAccount.parseBaseAddress` from TypeScript definitions ([#797](https://github.com/stellar/js-stellar-base/pull/797)).
50
-
51
- ## [`v14.0.0-rc.2`](https://github.com/stellar/js-stellar-base/compare/v13.1.0...v14.0.0-rc.2)
52
-
53
- ### Fixed
54
-
55
- - Fixes a bug in `Address.toScAddress()` that would prevent claimable balances and muxed accounts from being encoded correctly.
56
-
57
- ## [`v14.0.0-rc.1`](https://github.com/stellar/js-stellar-base/compare/v13.1.0...v14.0.0-rc.1): Protocol 23
58
-
59
- ### Breaking Changes
60
-
61
- - This package now requires **>= Node 20**.
62
- - XDR definitions have been updated to align with Protocol 23 ([#800](https://github.com/stellar/js-stellar-base/pull/800)).
63
-
64
- ### Added
65
-
66
- - The `sodium-native` and `tweetnacl` dependencies have been replaced with `@noble/curves` ([#802](https://github.com/stellar/js-stellar-base/pull/802)).
67
- - Support for claimable balances and liquidity pools in `StrKey` ([#799](https://github.com/stellar/js-stellar-base/pull/799)).
68
- - Support for claimable balances, liquidity pools, and muxed accounts in `Address` ([#801](https://github.com/stellar/js-stellar-base/pull/801)).
69
- - Added the ability for `nativeToScVal` to convert arrays with differing types to smart contract values, e.g., `nativeToScVal([1, "x", "y"], { type: [ "i128", "symbol" ]})` will give you a `Vec<i128, symbol, string>` ([#803](https://github.com/stellar/js-stellar-base/pull/803)).
70
-
71
- ### Fixed
72
-
73
- - Removed the custom `Buffer.subarray` polyfill introduced in [#733](https://github.com/stellar/js-stellar-base/pull/733) in [v11.0.1](https://github.com/stellar/js-stellar-sdk/releases/tag/v11.0.1) as a workaround for React Native's Hermes engine. Please use [`@exodus/patch-broken-hermes-typed-arrays`](https://github.com/ExodusMovement/patch-broken-hermes-typed-arrays) as an alternative, if needed ([#795](https://github.com/stellar/js-stellar-base/pull/795)).
74
- - Fix browser compatibility with proper module resolution and UMD configuration ([#798](https://github.com/stellar/js-stellar-base/pull/798)).
75
- - Remove `MuxedAccount.parseBaseAddress` from TypeScript definitions ([#797](https://github.com/stellar/js-stellar-base/pull/797)).
76
-
77
- ## [`v13.1.0`](https://github.com/stellar/js-stellar-base/compare/v13.0.1...v13.1.0)
78
-
79
- ### Added
80
-
81
- - `nativeToScVal` now supports encoding `Keypair`s as addresses ([#794](https://github.com/stellar/js-stellar-base/pull/794)).
82
- - Within `authorizeEntry`, the `SigningCallback` callback function should now return an object containing both the signature and the identity of the signer. In multi-signature situations, it isn't necessarily the case that the address within the authorization entry is the one that actually signs that entry. Thus, the callback now takes the following form, where the original `Promise<BufferLike>` option is preserved for backwards compatibility and should be considered deprecated ([#783](https://github.com/stellar/js-stellar-base/pull/783)):
83
-
84
- ```typescript
85
- export type SigningCallback = (
86
- preimage: xdr.HashIdPreimage
87
- ) => Promise<BufferLike | { signature: BufferLike; publicKey: string }>;
88
- ```
89
-
90
- ### Fixed
91
-
92
- - `scValToNative` will decode addresses more efficiently and reliably ([#794](https://github.com/stellar/js-stellar-base/pull/794)).
93
-
94
- ## [`v13.0.1`](https://github.com/stellar/js-stellar-base/compare/v13.0.0...v13.0.1)
95
-
96
- ### Fixed
97
-
98
- - `buildInvocationTree` will now successfully walk creation invocations with constructor arguments ([#784](https://github.com/stellar/js-stellar-base/pull/784)).
99
-
100
- ## [`v13.0.0`](https://github.com/stellar/js-stellar-base/compare/v12.1.1...v13.0.0)
101
-
102
- **This release supports Protocol 22.** While the network has not upgraded yet, you can start integrating the new features into your codebase if you want a head start. Keep in mind that while the binary XDR is backwards-compatible, the naming and layout of structures is not. In other words, this build will continue to work on Protocol 21, but you may have to update code that references XDR directly.
103
-
104
- This version is unchanged from [`beta.1`](#v13.0.0-beta.1).
105
-
106
- ## [`v13.0.0-beta.1`](https://github.com/stellar/js-stellar-base/compare/v12.1.1...v13.0.0-beta.1)
107
-
108
- **This is the first release that supports Protocol 22.** While the network has not upgraded yet, you can start integrating the new features into your codebase if you want a head start. Keep in mind that while the binary XDR is backwards-compatible, the naming and layout of structures is not. In other words, this build will continue to work on Protocol 21, but you may have to update code that references XDR directly.
109
-
110
- ### Breaking Changes
111
-
112
- - XDR definitions have been upgraded to Protocol 22 ([#777](https://github.com/stellar/js-stellar-base/pull/777)).
113
-
114
- ### Added
115
-
116
- - You can create contracts with constructors a new, optional parameter of `Operation.createCustomContract`, `constructorArgs: xdr.ScVal[]` ([#770](https://github.com/stellar/js-stellar-base/pull/770)).
117
-
118
- ## [`v12.1.1`](https://github.com/stellar/js-stellar-base/compare/v12.1.0...v12.1.1)
119
-
120
- ### Fixed
121
-
122
- - Add missing methods to TypeScript definitions ([#766](https://github.com/stellar/js-stellar-base/pull/766)).
123
- - Fix the TypeScript definition of `walkInvocationTree` to allow void returns on the callback function as intended rather than forcing a `return null` ([#765](https://github.com/stellar/js-stellar-base/pull/765)).
124
- - Fix `authorizeEntry` to use the correct public key when passing `Keypair`s ([#772](https://github.com/stellar/js-stellar-base/pull/772)).
125
- - Upgrade misc. dependencies ([#771](https://github.com/stellar/js-stellar-base/pull/771), [#773](https://github.com/stellar/js-stellar-base/pull/773)).
126
-
127
- ## [`v12.1.0`](https://github.com/stellar/js-stellar-base/compare/v12.0.1...v12.1.0)
128
-
129
- ### Added
130
-
131
- - `TransactionBuilder` now has `addOperationAt` and `clearOperationAt` methods to allow manipulation of individual operations ([#757](https://github.com/stellar/js-stellar-base/pull/757)).
132
-
133
- ### Fixed
134
-
135
- - Improve the efficiency and portability of asset type retrieval ([#758](https://github.com/stellar/js-stellar-base/pull/758)).
136
- - `nativeToScVal` now correctly sorts maps lexicographically based on the keys to match what the Soroban environment expects ([#759](https://github.com/stellar/js-stellar-base/pull/759)).
137
- - `nativeToScVal` now allows all integer types to come from strings ([#763](https://github.com/stellar/js-stellar-base/pull/763)).
138
- - `humanizeEvents` now handles events without a `contractId` set more reliably ([#764](https://github.com/stellar/js-stellar-base/pull/764)).
139
-
140
- ## [`v12.0.1`](https://github.com/stellar/js-stellar-base/compare/v12.0.0...v12.0.1)
141
-
142
- ### Fixed
143
-
144
- - Export TypeScript definition for `StrKey.isValidContract` ([#751](https://github.com/stellar/js-stellar-base/pull/751)).
145
- - `scValToNative` would fail when the values contained error codes because the parsing routine hadn't been updated to the new error schemas. Errors are now converted to the following format ([#753](https://github.com/stellar/js-stellar-base/pull/753)):
146
-
147
- ```typescript
148
- interface Error {
149
- type: "contract" | "system";
150
- code: number;
151
- value?: string; // only present for type === 'system'
152
- }
153
- ```
154
-
155
- You can refer to the [XDR documentation](https://github.com/stellar/stellar-xdr/blob/70180d5e8d9caee9e8645ed8a38c36a8cf403cd9/Stellar-contract.x#L76-L115) for additional explanations for each error code.
156
-
157
- ## [`v12.0.0`](https://github.com/stellar/js-stellar-base/compare/v11.0.1...v12.0.0)
158
-
159
- This is a re-tag of v12.0.0-rc.1 with only developer dependency updates in-between.
160
-
161
- ## [`v12.0.0-rc.1`](https://github.com/stellar/js-stellar-base/compare/v11.0.1...v12.0.0-rc.1)
162
-
163
- ### Breaking Changes
164
-
165
- - The generated XDR has been upgraded to match the upcoming Protocol 21, namely [stellar/stellar-xdr@`1a04392`](https://github.com/stellar/stellar-xdr/commit/1a04392432dacc0092caaeae22a600ea1af3c6a5) ([#738](https://github.com/stellar/js-stellar-base/pull/738)).
166
-
167
- ### Added
168
-
169
- - To facilitate serialization and deserialization for downstream systems, this package now exports `cereal.XdrWriter` and `cereal.XdrReader` which come directly from `@stellar/js-xdr` ([#744](https://github.com/stellar/js-stellar-base/pull/744)).
170
-
171
- ### Fixed
172
-
173
- - Updated various dependencies ([#737](https://github.com/stellar/js-stellar-base/pull/737), [#739](https://github.com/stellar/js-stellar-base/pull/739)).
174
- - `Buffer` and `Uint8Array` compatibility has improved in `StrKey` ([#746](https://github.com/stellar/js-stellar-base/pull/746)).
175
-
176
- ## [`v11.0.1`](https://github.com/stellar/js-stellar-base/compare/v11.0.0...v11.0.1)
177
-
178
- ### Fixed
179
-
180
- - Add compatibility with pre-ES2016 environments (like some React Native JS compilers) by adding a custom `Buffer.subarray` polyfill ([#733](https://github.com/stellar/js-stellar-base/pull/733)).
181
- - Upgrade underlying dependencies, including `@stellar/js-xdr` which should broaden compatibility to pre-ES2016 environments ([#734](https://github.com/stellar/js-stellar-base/pull/734), [#735](https://github.com/stellar/js-stellar-base/pull/735)).
182
-
183
- ## [`v11.0.0`](https://github.com/stellar/js-stellar-base/compare/v10.0.2...v11.0.0)
184
-
185
- **Note:** This version is (still) compatible with Protocol 20. Most people should be unaffected by the technically-breaking changes below and can treat this more like a v10.0.3 patch release.
186
-
187
- ### Breaking Changes
188
-
189
- - Starting from **v10.0.0-beta.0**, we set [`BigNumber.DEBUG`](https://mikemcl.github.io/bignumber.js/#debug) in `bignumber.js` to `true` internally, which affects all code using `BigNumber`. This behavior has been fixed and only affects this library: globally, `BigNumber.DEBUG` now remains at its default setting (i.e. disabled). This is technically a breaking behavior change and is released as such ([#729](https://github.com/stellar/js-stellar-base/pull/729)).
190
-
191
- ### Fixed
192
-
193
- - Dependencies have been updated to their latest compatible versions ([#726](https://github.com/stellar/js-stellar-base/pull/729), [#730](https://github.com/stellar/js-stellar-base/pull/730)).
194
-
195
- ## [`v10.0.2`](https://github.com/stellar/js-stellar-base/compare/v10.0.1...v10.0.2)
196
-
197
- ### Fixed
198
-
199
- - The `contractId` field is correctly omitted from humanized events when it wasn't present in the structure ([#721](https://github.com/stellar/js-stellar-base/pull/721)).
200
- - Misc. outdated or incorrect documentation has been updated ([#723](https://github.com/stellar/js-stellar-base/pull/723), [#720](https://github.com/stellar/js-stellar-base/pull/720)).
201
- - Dependencies have been updated ([#724](https://github.com/stellar/js-stellar-base/pull/724)).
202
-
203
- ## [`v10.0.1`](https://github.com/stellar/js-stellar-base/compare/v10.0.0...v10.0.1)
204
-
205
- ### Fixed
206
-
207
- - The TypeScript definition for `Asset.contractId()` now includes a missing parameter (the `networkPassphrase` changes the ID for a contract; [#718](https://github.com/stellar/js-stellar-base/pull/#718)).
208
-
209
- ## [`v10.0.0`](https://github.com/stellar/js-stellar-base/compare/v9.0.0...v10.0.0): Protocol 20 Stable Release
210
-
211
- ### Breaking Changes
212
-
213
- - The new minimum supported Node version is Node 18.
214
- - XDR has been upgraded to the latest stable version ([stellar-xdr@`6a620d1`](https://github.com/stellar/stellar-xdr/tree/6a620d160aab22609c982d54578ff6a63bfcdc01)). This is mostly renames, but it includes the following relevant breaking changes ([#704](https://github.com/stellar/js-stellar-base/pull/704)):
215
- - `Operation.bumpFootprintExpiration` is now `extendFootprintTtl` and its `ledgersToExpire` field is now named `extendTo`, but it serves the same purpose.
216
- - In TypeScript, the `Operation.BumpFootprintExpiration` is now `Operation.ExtendFootprintTTL`
217
- - `xdr.ContractExecutable.contractExecutableToken` is now `contractExecutableStellarAsset`
218
- - `xdr.SorobanTransactionData.refundableFee` is now `resourceFee`
219
- - In turn, `SorobanDataBuilder.setRefundableFee` is now `setResourceFee`
220
- - This new fee encompasses the entirety of the Soroban-related resource fees. Note that this is distinct from the "network-inclusion" fee that you would set on your transaction (i.e. `TransactionBuilder(..., { fee: ... })`).
221
-
222
- * `Contract.getFootprint()` now only returns a single result: the ledger key of the deployed instance for the given ID, because the key for the code entry was incorrect (it should not be the ID but rather the WASM hash, which is not calculatable w/o network access) ([#709](https://github.com/stellar/js-stellar-base/pull/709)).
223
-
224
- ## [`v10.0.0-beta.4`](https://github.com/stellar/js-stellar-base/compare/v10.0.0-beta.3...v10.0.0-beta.4)
225
-
226
- ### Fixed
227
-
228
- - You can now correctly clone transactions (`TransactionBuilder.cloneFrom`) with large sequence numbers ([#711](https://github.com/stellar/js-stellar-base/pull/711)).
229
-
230
- ## [`v10.0.0-beta.3`](https://github.com/stellar/js-stellar-base/compare/v10.0.0-beta.2...v10.0.0-beta.3)
231
-
232
- ### Fixed
233
-
234
- - Fixes a bug where `authorizeEntry` might perform a no-op when it shouldn't ([#701](https://github.com/stellar/js-stellar-base/pull/701)).
235
- - Fixes a TypeScript bug where `Memo.hash` did not accept a `Buffer` ([#698](https://github.com/stellar/js-stellar-base/pull/698)).
236
- - Upgrades a transient dependency for security ([#296](https://github.com/stellar/js-stellar-base/pull/696)).
237
-
238
- ## [`v10.0.0-beta.2`](https://github.com/stellar/js-stellar-base/compare/v10.0.0-beta.1...v10.0.0-beta.2)
239
-
240
- ### Breaking Changes
241
-
242
- - The wrappers around multi-party authorization have changed ([#678](https://github.com/stellar/js-stellar-base/pull/678)):
243
-
244
- * `authorizeEntry` has been added to help sign auth entries in-place
245
- * the signature for `authorizeInvocation` has changed: it now offers a callback approach by default and requires slightly different parameters
246
- * `buildAuthEntry`, `buildAuthEnvelope`, and `authorizeInvocationCallback` have been removed
247
-
248
- ### Fixed
249
-
250
- - The TypeScript definitions for XDR schemas now point to the current protocol rather than vNext ([#694](https://github.com/stellar/js-stellar-base/pull/694)).
251
- - Misc. dependencies have been updated to their latest versions ([#694](https://github.com/stellar/js-stellar-base/pull/694)).
252
-
253
- ## [`v10.0.0-beta.1`](https://github.com/stellar/js-stellar-base/compare/v10.0.0-beta.0...v10.0.0-beta.1)
254
-
255
- ### Fixed
256
-
257
- - `nativeToScVal` now allows anything to be passed to the `opts.type` specifier. Previously, it was only integer types ([#691](https://github.com/stellar/js-stellar-base/pull/691)).
258
- - `Contract.call()` now produces valid `Operation` XDR ([#692](https://github.com/stellar/js-stellar-base/pull/692)).
259
-
260
- ## [`v10.0.0-beta.0`](https://github.com/stellar/js-stellar-base/compare/v9.0.0...v10.0.0-beta.0): Protocol 20
261
-
262
- ### Breaking Changes
263
-
264
- - **Node 16 is the new minimum version** to use the SDKs.
265
- - The XDR has been massively overhauled to support [Soroban in Protocol 20](https://soroban.stellar.org/docs/category/fundamentals-and-concepts), which means new operations, data structures, and a transaction format as well as new overlay features ([#538](https://github.com/stellar/js-stellar-base/pull/538)).
266
-
267
- The core data structure of Soroban is a generic type called an `ScVal` (**s**mart **c**ontract **val**ue, which is a union of types that can basically represent anything [numbers, strings, arrays, maps, contract bytecode, etc.]). You can refer to the XDR for details, and you can utilize new APIs to make dealing with these complex values easier:
268
-
269
- - `nativeToScVal` helps convert native types to their closest Soroban equivalent
270
- - `scValToNative` helps find the closest native JavaScript type(s) corresponding to a smart contract value
271
- - `scValToBigInt` helps convert numeric `ScVal`s into native `bigint`s
272
- - `ScInt` and `XdrLargeInt` help convert to and from `bigint`s to other types and form sized integer types for smart contract usage
273
-
274
- ### Added
275
-
276
- The following are new APIs to deal with new Soroban constructs:
277
-
278
- - **`Address`, which helps manage "smart" addresses in the Soroban context.** Addresses there (used for auth and identity purposes) can either be contracts (strkey `C...`) or accounts (strkey `G...`). This abstraction helps manage them and distinguish between them easily.
279
- - **`Contract`, which helps manage contract identifiers.** The primary purpose is to build invocations of its methods via the generic `call(...)`, but it also provides utilities for converting to an `Address` or calculating its minimum footprint for state expiration.
280
- - **Three new operations** have been added related to Soroban transactions:
281
- - `invokeHostFunction` for calling contract code
282
- - `bumpFootprintExpiration` for extending the state lifetime of Soroban data
283
- - `restoreFootprint` for restoring expired, off-chain state back onto the ledger
284
- - The `TransactionBuilder` now takes a `sorobanData` parameter (and has a corresponding `.setSorobanData()` builder method) which primarily describes the storage footprint of a Soroban (that is, which parts of the ledger state [in the form of `xdr.LedgerKey`s] it plans to read and write as part of the transaction).
285
- - To facilitate building this out, there's a new `SorobanDataBuilder` factory to set fields individually
286
- - The `TransactionBuilder` now has a `cloneFrom(tx, opts)` constructor method to create an instance from an existing transaction, also allowing parameter overrides via `opts`.
287
- - The following are convenience methods for building out certain types of smart contract-related structures:
288
- - `buildInvocationTree` and `walkInvocationTree` are both ways to visualize invocation calling trees better
289
- - `authorizeInvocation` helps multiple parties sign invocation calling trees
290
- - `humanizeEvents` helps make diagnostic events more readable
291
- - We've added a GHA to track bundle size changes as PRs are made. This protocol upgrade adds +18% to the final, minified bundle size which is significant but acceptable given the size of the upgrade.
292
-
293
- ### Fixes
294
-
295
- - Improves the error messages when passing invalid amounts to deposit and withdraw operations ([#679](https://github.com/stellar/js-stellar-base/pull/679)).
296
-
297
- ## [v9.0.0](https://github.com/stellar/js-stellar-base/compare/v8.2.2..v9.0.0)
298
-
299
- This is a large update and the following changelog incorporates ALL changes across the `beta.N` versions of this upgrade.
300
-
301
- This version is marked by a major version bump because of the significant upgrades to underlying dependencies. While there should be no noticeable API changes from a downstream perspective, there may be breaking changes in the way that this library is bundled.
302
-
303
- The browser bundle size has decreased **significantly**:
304
-
305
- - `stellar-base.min.js` is **340 KiB**, down from **1.2 MiB** previously.
306
- - the new, unminified `stellar-base.js` is **895 KiB**.
307
-
308
- ### Breaking Changes
309
-
310
- - The build system has been completely overhauled to support Webpack 5 ([#584](https://github.com/stellar/js-stellar-base/pull/584), [#585](https://github.com/stellar/js-stellar-base/pull/585)).
311
-
312
- Though we have tried to maintain compatibility with older JavaScript implementations, this still means you may need to update your build pipeline to transpile to certain targets.
313
-
314
- ### Fixes
315
-
316
- - Fixes a bug when sorting mixed-case assets for liquidity pools ([#606](https://github.com/stellar/js-stellar-base/pull/606)).
317
- - Documentation is fixed and should generate correctly on https://stellar.github.io/js-stellar-base/ ([#609](https://github.com/stellar/js-stellar-base/pull/609)).
318
-
319
- ### Updates
320
-
321
- - XDR has been updated to its latest version (both `curr` and `next` versions, [#587](https://github.com/stellar/js-stellar-base/pull/587)).
322
- - Drop the `lodash` dependency entirely ([#624](https://github.com/stellar/js-stellar-base/issues/624)).
323
- - Drop the `crc` dependency and inline it to lower bundle size ([#621](https://github.com/stellar/js-stellar-base/pull/621)).
324
- - Upgrade all dependencies to their latest versions ([#608](https://github.com/stellar/js-stellar-base/pull/608)).
325
-
326
- ## [v9.0.0-beta.3](https://github.com/stellar/js-stellar-base/compare/v9.0.0-beta.1..v9.0.0-beta.2)
327
-
328
- ### Fix
329
-
330
- - Fixes a bug when sorting mixed-case assets for liquidity pools ([#606](https://github.com/stellar/js-stellar-base/pull/606)).
331
-
332
- ### Update
333
-
334
- - Upgrade all dependencies to their latest versions ([#608](https://github.com/stellar/js-stellar-base/pull/608)).
335
- - Drop the `crc` dependency and inline it to lower bundle size ([#621](https://github.com/stellar/js-stellar-base/pull/621)).
336
-
337
- ## [v9.0.0-beta.2](https://github.com/stellar/js-stellar-base/compare/v9.0.0-beta.1..v9.0.0-beta.2)
338
-
339
- ### Update
340
-
341
- - Upgrades the `js-xdr` dependency (major performance improvements, see [`js-xdr@v2.0.0`](https://github.com/stellar/js-xdr/releases/tag/v2.0.0)) and other dependencies to their latest versions ([#592](https://github.com/stellar/js-stellar-base/pull/592)).
342
-
343
- ## [v9.0.0-beta.1](https://github.com/stellar/js-stellar-base/compare/v9.0.0-beta.0..v9.0.0-beta.1)
344
-
345
- ### Fix
346
-
347
- - Correct XDR type definition for raw `xdr.Operation`s ([#591](https://github.com/stellar/js-stellar-base/pull/591)).
348
-
349
- ## [v9.0.0-beta.0](https://github.com/stellar/js-stellar-base/compare/v8.2.2..v9.0.0-beta.0)
350
-
351
- This version is marked by a major version bump because of the significant upgrades to underlying dependencies. While there should be no noticeable API changes from a downstream perspective, there may be breaking changes in the way that this library is bundled.
352
-
353
- ### Fix
354
-
355
- - Build system has been overhauled to support Webpack 5 ([#585](https://github.com/stellar/js-stellar-base/pull/585)).
356
-
357
- - Current and vNext XDR updated to latest versions ([#587](https://github.com/stellar/js-stellar-base/pull/587)).
358
-
359
- ## [v8.2.2](https://github.com/stellar/js-stellar-base/compare/v8.2.1..v8.2.2)
360
-
361
- ### Fix
362
-
363
- - Enable signing in service workers using FastSigning ([#567](https://github.com/stellar/js-stellar-base/pull/567)).
364
-
365
- ## [v8.2.1](https://github.com/stellar/js-stellar-base/compare/v8.2.0..v8.2.1)
366
-
367
- ### Fix
368
-
369
- - Turn all XLM-like (i.e. casing agnostic) asset codes into the native asset with code `XLM` ([#546](https://github.com/stellar/js-stellar-base/pull/546)).
370
-
371
- ## [v8.2.0](https://github.com/stellar/js-stellar-base/compare/v8.1.0..v8.2.0)
372
-
373
- ### Add
374
-
375
- - `Operation.setOptions` now supports the new [CAP-40](https://stellar.org/protocol/cap-40) signed payload signer (`ed25519SignedPayload`) thanks to @orbitlens ([#542](https://github.com/stellar/js-stellar-base/pull/542)).
376
-
377
- ## [v8.1.0](https://github.com/stellar/js-stellar-base/compare/v8.0.1..v8.1.0)
378
-
379
- ### Add
380
-
381
- - `TransactionBase.addDecoratedSignature` is a clearer way to add signatures directly to a built transaction without fiddling with the underlying `signatures` array ([#535](https://github.com/stellar/js-stellar-base/pull/535)).
382
-
383
- - Update the XDR definitions (and the way in which they're generated) to contain both the latest current XDR (which introduces [CAP-42](https://stellar.org/protocol/cap-42)) and the "v-next" XDR (which contains XDR related to Soroban and should be considered unstable) ([#537](https://github.com/stellar/js-stellar-base/pull/537)).
384
-
385
- ### Fix
386
-
387
- - Correctly set `minAccountSequence` in `TransactionBuilder` for large values ([#539](https://github.com/stellar/js-stellar-base/pull/539), thank you @overcat!).
388
-
389
- ## [v8.0.1](https://github.com/stellar/js-stellar-base/compare/v8.0.0..v8.0.1)
390
-
391
- ### Fix
392
-
393
- - Correctly predict claimable balance IDs with large sequence numbers ([#530](https://github.com/stellar/js-stellar-base/pull/530), thank you @overcat!).
394
-
395
- ## [v8.0.0](https://github.com/stellar/js-stellar-base/compare/v7.0.0..v8.0.0)
396
-
397
- This is a promotion from the beta version without changes, now that the CAP-21 and CAP-40 implementations have made it into [stellar/stellar-core#master](https://github.com/stellar/stellar-core/tree/master/).
398
-
399
- ## [v8.0.0-beta.0](https://github.com/stellar/js-stellar-base/compare/v7.0.0..v8.0.0-beta.0)
400
-
401
- **This release adds support for Protocol 19**, which includes [CAP-21](https://stellar.org/protocol/cap-21) (new transaction preconditions) and [CAP-40](https://stellar.org/protocol/cap-40) (signed payload signers).
402
-
403
- This is considered a beta release until the XDR for the Stellar protocol stabilizes and is officially released.
404
-
405
- ### Breaking
406
-
407
- As of this release, the minimum supported version of NodeJS is **14.x**.
408
-
409
- - Two XDR types have been renamed:
410
- - `xdr.OperationId` is now `xdr.HashIdPreimage`
411
- - `xdr.OperationIdId` is now `xdr.HashIdPreimageOperationId`
412
-
413
- ### Add
414
-
415
- - Support for converting signed payloads ([CAP-40](https://stellar.org/protocol/cap-40)) to and from their StrKey (`P...`) representation ([#511](https://github.com/stellar/js-stellar-base/pull/511)):
416
- - `Keypair.signPayloadDecorated(data)`
417
- - `StrKey.encodeSignedPayload(buf)`
418
- - `StrKey.decodeSignedPayload(str)`
419
- - `StrKey.isValidSignedPayload(str)`
420
-
421
- - Support for creating transactions with the new preconditions ([CAP-21](https://stellar.org/protocol/cap-21)) via `TransactionBuilder` ([#513](https://github.com/stellar/js-stellar-base/pull/513)).
422
-
423
- - A way to convert between addresses (like `G...` and `P...`, i.e. the `StrKey` class) and their respective signer keys (i.e. `xdr.SignerKey`s), particularly for use in the new transaction preconditions ([#520](https://github.com/stellar/js-stellar-base/pull/520)):
424
- - `SignerKey.decodeAddress(address)`
425
- - `SignerKey.encodeSignerKey(address)`
426
- - `TransactionBuilder.setTimebounds(min, max)`
427
- - `TransactionBuilder.setLedgerbounds(min, max)`
428
- - `TransactionBuilder.setMinAccountSequence(seq)`
429
- - `TransactionBuilder.setMinAccountSequenceAge(age)`
430
- - `TransactionBuilder.setMinAccountSequenceLedgerGap(gap)`
431
- - `TransactionBuilder.setExtraSigners([signers])`
432
-
433
- ### Fix
434
-
435
- - Correct a TypeScript definition on the `RevokeLiquidityPoolSponsorship` operation ([#522](https://github.com/stellar/js-stellar-base/pull/522)).
436
-
437
- - Resolves a bug that incorrectly sorted `Asset`s with mixed-case asset codes (it preferred lowercase codes incorrectly) ([#516](https://github.com/stellar/js-stellar-base/pull/516)).
438
-
439
- - Update developer dependencies:
440
- - `isparta`, `jsdoc`, and `underscore` ([#500](https://github.com/stellar/js-stellar-base/pull/500))
441
- - `ajv` ([#503](https://github.com/stellar/js-stellar-base/pull/503))
442
- - `karma` ([#505](https://github.com/stellar/js-stellar-base/pull/505))
443
- - `minimist` ([#514](https://github.com/stellar/js-stellar-base/pull/514))
444
-
445
- ## [v7.0.0](https://github.com/stellar/js-stellar-base/compare/v6.0.6..v7.0.0)
446
-
447
- This release introduces **unconditional support for muxed accounts** ([#485](https://github.com/stellar/js-stellar-base/pull/485)).
448
-
449
- ### Breaking Changes
450
-
451
- In [v5.2.0](https://github.com/stellar/js-stellar-base/releases/tag/v5.2.0), we introduced _opt-in_ support for muxed accounts, where you would need to explicitly pass a `true` flag if you wanted to interpret muxed account objects as muxed addresses (in the form `M...`, see [SEP-23](https://stellar.org/protocol/sep-23)). We stated that this would become the default in the future. That is now the case.
452
-
453
- The following fields will now always support muxed properties:
454
-
455
- - `FeeBumpTransaction.feeSource`
456
- - `Transaction.sourceAccount`
457
- - `Operation.sourceAccount`
458
- - `Payment.destination`
459
- - `PathPaymentStrictReceive.destination`
460
- - `PathPaymentStrictSend.destination`
461
- - `AccountMerge.destination`
462
- - `Clawback.from`
463
-
464
- The following functions had a `withMuxing` parameter removed:
465
-
466
- - `Operation.fromXDRObject`
467
- - `Transaction.constructor`
468
- - `FeeBumpTransaction.constructor`
469
- - `TransactionBuilder.fromXDR`
470
- - `TransactionBuilder.buildFeeBumpTransaction`
471
-
472
- The following functions will no longer check the `opts` object for a `withMuxing` field:
473
-
474
- - `TransactionBuilder.constructor`
475
- - `Operation.setSourceAccount`
476
-
477
- There are several other breaking changes:
478
-
479
- - `TransactionBuilder.enableMuxedAccounts()` is removed
480
- - `decodeAddressToMuxedAccount()` and `encodeMuxedAccountToAddress()` no longer accept a second boolean parameter
481
- - `Account.createSubaccount()` and `MuxedAccount.createSubaccount()` are removed ([#487](https://github.com/stellar/js-stellar-base/pull/487)). You should prefer to create them manually:
482
-
483
- ```js
484
- let mux1 = new MuxedAccount(someAccount, "1");
485
-
486
- // before:
487
- let mux2 = mux1.createSubaccount("2");
488
-
489
- // now:
490
- let mux2 = new MuxedAccount(mux1.baseAccount(), "2");
491
- ```
492
-
493
- - Introduced a new helper method to help convert from muxed account addresses to their underlying Stellar addresses ([#485](https://github.com/stellar/js-stellar-base/pull/485)):
494
-
495
- ```ts
496
- function extractBaseAddess(address: string): string;
497
- ```
498
-
499
- - The following muxed account validation functions are now available from Typescript ([#483](https://github.com/stellar/js-stellar-base/pull/483/files)):
500
-
501
- ```typescript
502
- namespace StrKey {
503
- function encodeMed25519PublicKey(data: Buffer): string;
504
- function decodeMed25519PublicKey(data: string): Buffer;
505
- function isValidMed25519PublicKey(publicKey: string): boolean;
506
- }
507
-
508
- function decodeAddressToMuxedAccount(
509
- address: string,
510
- supportMuxing: boolean
511
- ): xdr.MuxedAccount;
512
- function encodeMuxedAccountToAddress(
513
- account: xdr.MuxedAccount,
514
- supportMuxing: boolean
515
- ): string;
516
- function encodeMuxedAccount(gAddress: string, id: string): xdr.MuxedAccount;
517
- ```
518
-
519
- - Added a helper function `Transaction.getClaimableBalanceId(int)` which lets you pre-determine the hex claimable balance ID of a `createClaimableBalance` operation prior to submission to the network ([#482](https://github.com/stellar/js-stellar-base/pull/482)).
520
-
521
- ### Fix
522
-
523
- - Add `Buffer` as a parameter type option for the `Keypair` constructor in Typescript ([#484](https://github.com/stellar/js-stellar-base/pull/484)).
524
-
525
- ## [v6.0.6](https://github.com/stellar/js-stellar-base/compare/v6.0.5..v6.0.6)
526
-
527
- ### Fix
528
-
529
- - Upgrades dependencies: `path-parse` (1.0.6 --> 1.0.7) and `jszip` (3.4.0 to 3.7.1) ([#450](https://github.com/stellar/js-stellar-base/pull/450), [#458](https://github.com/stellar/js-stellar-base/pull/458)).
530
-
531
- ## [v6.0.5](https://github.com/stellar/js-stellar-base/compare/v6.0.4..v6.0.5)
532
-
533
- This version bump fixes a security vulnerability in a _developer_ dependency; **please upgrade as soon as possible!** You may be affected if you are working on this package in a developer capacity (i.e. you've cloned this repository) and have run `yarn` or `yarn install` any time on Oct 22nd, 2021.
534
-
535
- Please refer to the [security advisory](https://github.com/advisories/GHSA-pjwm-rvh2-c87w) for details.
536
-
537
- ### Security Fix
538
-
539
- - Pin `ua-parser-js` to a known safe version ([#477](https://github.com/stellar/js-stellar-base/pull/477)).
540
-
541
- ## [v6.0.4](https://github.com/stellar/js-stellar-base/compare/v6.0.3..v6.0.4)
542
-
543
- ### Fix
544
-
545
- - Allow muxed accounts when decoding transactions via `TransactionBuilder.fromXDR()` ([#470](https://github.com/stellar/js-stellar-base/pull/470)).
546
-
547
- ## [v6.0.3](https://github.com/stellar/js-stellar-base/compare/v6.0.2..v6.0.3)
548
-
549
- ### Fix
550
-
551
- - When creating a `Transaction`, forward the optional `withMuxing` flag along to its operations so that their properties are also decoded with the appropriate muxing state ([#469](https://github.com/stellar/js-stellar-base/pull/469)).
552
-
553
- ## [v6.0.2](https://github.com/stellar/js-stellar-base/compare/v6.0.1..v6.0.2)
554
-
555
- ### Fix
556
-
557
- - Fix Typescript signatures for operations to universally allow setting the `withMuxing` flag ([#466](https://github.com/stellar/js-stellar-base/pull/466)).
558
-
559
- ## [v6.0.1](https://github.com/stellar/js-stellar-base/compare/v5.3.2..v6.0.1)
560
-
561
- ### Add
562
-
563
- - Introduced new CAP-38 operations `LiquidityPoolDepositOp` and `LiquidityPoolWithdrawOp`.
564
- - Introduced two new types of assets, `LiquidityPoolId` and `LiquidityPoolAsset`.
565
-
566
- ### Update
567
-
568
- - The XDR definitions have been updated to support CAP-38.
569
- - Extended `Operation` class with the `Operation.revokeLiquidityPoolSponsorship` helper that allows revoking a liquidity pool sponsorship.
570
- - Asset types now include `AssetType.liquidityPoolShares`.
571
- - `Operation.changeTrust` and `ChangeTrustOp` can now use `LiquidityPoolAsset` in addition to `Asset`.
572
- - `Operation.revokeTrustlineSponsorship` can now use `LiquidityPoolId` in addition to `Asset`.
573
-
574
- ## [v5.3.2](https://github.com/stellar/js-stellar-base/compare/v5.3.1..v5.3.2)
575
-
576
- ### Fix
577
-
578
- - Update various dependencies to secure versions. Most are developer dependencies which means no or minimal downstream effects ([#446](https://github.com/stellar/js-stellar-base/pull/446), [#447](https://github.com/stellar/js-stellar-base/pull/447), [#392](https://github.com/stellar/js-stellar-base/pull/392), [#428](https://github.com/stellar/js-stellar-base/pull/428)); the only non-developer dependency upgrade is a patch version bump to `lodash` ([#449](https://github.com/stellar/js-stellar-base/pull/449)).
579
-
580
- ## [v5.3.1](https://github.com/stellar/js-stellar-base/compare/v5.3.0..v5.3.1)
581
-
582
- ### Fix
583
-
584
- - Creating operations with both muxed and unmuxed properties resulted in unintuitive XDR. Specifically, the unmuxed property would be transformed into the equivalent property with an ID of 0 ([#441](https://github.com/stellar/js-stellar-base/pull/441)).
585
-
586
- ## [v5.3.0](https://github.com/stellar/js-stellar-base/compare/v5.2.1..v5.3.0)
587
-
588
- ### Add
589
-
590
- - **Opt-in support for muxed accounts.** In addition to the support introduced in [v5.2.0](https://github.com/stellar/js-stellar-base/releases/v5.2.0), this completes support for muxed accounts by enabling them for fee-bump transactions. Pass a muxed account address (in the `M...` form) as the first parameter (and explicitly opt-in to muxing by passing `true` as the last parameter) to `TransactionBuilder.buildFeeBumpTransaction` to make the `feeSource` a fully-muxed account instance ([#434](https://github.com/stellar/js-stellar-base/pull/434)).
591
-
592
- ## [v5.2.1](https://github.com/stellar/js-stellar-base/compare/v5.2.0..v5.2.1)
593
-
594
- ### Fix
595
-
596
- - Fix regression where raw public keys were [sometimes](https://github.com/stellar/js-stellar-sdk/issues/645) being parsed incorrectly ([#429](https://github.com/stellar/js-stellar-base/pull/429)).
597
-
598
- ## [v5.2.0](https://github.com/stellar/js-stellar-base/compare/v5.1.0..v5.2.0)
599
-
600
- ### Add
601
-
602
- - **Opt-in support for muxed accounts.** This introduces `M...` addresses from [SEP-23](https://stellar.org/protocol/sep-23), which multiplex a Stellar `G...` address across IDs to eliminate the need for ad-hoc multiplexing via the Transaction.memo field (see the relevant [SEP-29](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0029.md) and [blog post](https://www.stellar.org/developers-blog/fixing-memo-less-payments) on the topic). The following operations now support muxed accounts ([#416](https://github.com/stellar/js-stellar-base/pull/416)):
603
- - `Payment.destination`
604
- - `PathPaymentStrictReceive.destination`
605
- - `PathPaymentStrictSend.destination`
606
- - `Operation.sourceAccount`
607
- - `AccountMerge.destination`
608
- - `Transaction.sourceAccount`
609
-
610
- - The above changeset also introduces a new high-level object, `MuxedAccount` (not to be confused with `xdr.MuxedAccount`, which is the underlying raw representation) to make working with muxed accounts easier. You can use it to easily create and manage muxed accounts and their underlying shared `Account`, passing them along to the supported operations and `TransactionBuilder` ([#416](https://github.com/stellar/js-stellar-base/pull/416)):
611
-
612
- ```js
613
- const PUBKEY = "GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ";
614
- const ACC = new StellarBase.Account(PUBKEY, "1");
615
-
616
- const mux1 = new StellarBase.MuxedAccount(ACC, "1000");
617
- console.log(mux1.accountId(), mux1.id());
618
- // MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAD5DTGC 1000
619
-
620
- const mux2 = ACC.createSubaccount("2000");
621
- console.log(
622
- "Parent relationship preserved:",
623
- mux2.baseAccount().accountId() === mux1.baseAccount().accountId()
624
- );
625
- console.log(mux2.accountId(), mux2.id());
626
- // MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAH2B4RU 2000
627
-
628
- mux1.setID("3000");
629
- console.log(
630
- "Underlying account unchanged:",
631
- ACC.accountId() === mux1.baseAccount().accountId()
632
- );
633
- console.log(mux1.accountId(), mux1.id());
634
- // MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAALXC5LE 3000
635
- ```
636
-
637
- - You can refer to the [documentation](https://stellar.github.io/js-stellar-sdk/MuxedAccount.html) or the [test suite](../test/unit/muxed_account_test.js) for more uses of the API.
638
-
639
- ### Update
640
-
641
- - Modernize the minimum-supported browser versions for the library ([#419](https://github.com/stellar/js-stellar-base/pull/419)).
642
-
643
- ### Fix
644
-
645
- - Update Typescript test for `SetOptions` to use authorization flags (e.g. `AuthRequiredFlag`) correctly ([#418](https://github.com/stellar/js-stellar-base/pull/418)).
646
-
647
- ## [v5.1.0](https://github.com/stellar/js-stellar-base/compare/v5.0.0..v5.1.0)
648
-
649
- ### Update
650
-
651
- - The Typescript definitions have been updated to support CAP-35 ([#407](https://github.com/stellar/js-stellar-base/pull/407)).
652
-
653
- ## [v5.0.0](https://github.com/stellar/js-stellar-base/compare/v4.0.3..v5.0.0)
654
-
655
- ### Add
656
-
657
- - Introduced new CAP-35 operations, `ClawbackOp`, `ClawbackClaimableBalanceOp`, and `SetTrustLineFlagsOp` ([#397](https://github.com/stellar/js-stellar-base/pull/397/)).
658
-
659
- ### Update
660
-
661
- - Add an additional parameter check to `claimClaimableBalance` to fail faster ([#390](https://github.com/stellar/js-stellar-base/pull/390)).
662
-
663
- - The XDR definitions have been updated to support CAP-35 ([#394](https://github.com/stellar/js-stellar-base/pull/394)).
664
-
665
- ### Breaking
666
-
667
- - `AllowTrustOpAsset` has been renamed to `AssetCode` ([#394](https://github.com/stellar/js-stellar-base/pull/394))
668
-
669
- ### Deprecated
670
-
671
- - `AllowTrustOp` is now a deprecated operation.
672
-
673
- ## [v4.0.3](https://github.com/stellar/js-stellar-base/compare/v4.0.2..v4.0.3)
674
-
675
- ## Update
676
-
677
- - Update TS definitions for XDRs ([#381](https://github.com/stellar/js-stellar-base/pull/381))
678
- - Fix typing for ManageData.value ([#379](https://github.com/stellar/js-stellar-base/pull/379))
679
-
680
- ## [v4.0.2](https://github.com/stellar/js-stellar-base/compare/v4.0.1..v4.0.2)
681
-
682
- ## Update
683
-
684
- - Fix deployment script.
685
-
686
- ## [v4.0.1](https://github.com/stellar/js-stellar-base/compare/v4.0.0..v4.0.1)
687
-
688
- ## Update
689
-
690
- - Update `createAccount` operation to accept `0` as the starting balance ([#375](https://github.com/stellar/js-stellar-base/pull/375)).
691
-
692
- ## [v4.0.0](https://github.com/stellar/js-stellar-base/compare/v3.0.4..v4.0.0)
693
-
694
- ## Add
695
-
696
- - Add the `Claimant` class which helps the creation of claimable balances. ([#367](https://github.com/stellar/js-stellar-base/pull/367)).
697
- The default behavior of this class it to create claimants with an unconditional predicate if none is passed:
698
-
699
- ```
700
- const claimant = new StellarBase.Claimant(
701
- 'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ'
702
- );
703
- ```
704
-
705
- However, you can use any of the following helpers to create a predicate:
706
-
707
- ```
708
- StellarBase.Claimant.predicateUnconditional();
709
- StellarBase.Claimant.predicateAnd(left, right);
710
- StellarBase.Claimant.predicateOr(left, right);
711
- StellarBase.Claimant.predicateNot(predicate);
712
- StellarBase.Claimant.predicateBeforeAbsoluteTime(unixEpoch);
713
- StellarBase.Claimant.predicateBeforeRelativeTime(seconds);
714
- ```
715
-
716
- And then pass the predicate in the constructor:
717
-
718
- ```
719
- const left = StellarBase.Claimant.predicateBeforeRelativeTime('800');
720
- const right = StellarBase.Claimant.predicateBeforeRelativeTime(
721
- '1200'
722
- );
723
- const predicate = StellarBase.Claimant.predicateOr(left, right);
724
- const claimant = new StellarBase.Claimant(
725
- 'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ',
726
- predicate
727
- );
728
- ```
729
-
730
- - Add `Operation.createClaimableBalance` ([#368](https://github.com/stellar/js-stellar-base/pull/368))
731
- Extend the operation class with a new helper to create claimable balance operations.
732
-
733
- ```js
734
- const asset = new Asset(
735
- "USD",
736
- "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
737
- );
738
- const amount = "100.0000000";
739
- const claimants = [
740
- new Claimant(
741
- "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ",
742
- Claimant.predicateBeforeAbsoluteTime("4102444800000")
743
- ),
744
- ];
745
-
746
- const op = Operation.createClaimableBalance({
747
- asset,
748
- amount,
749
- claimants,
750
- });
751
- ```
752
-
753
- - Add `Operation.claimClaimableBalance` ([#368](https://github.com/stellar/js-stellar-base/pull/368))
754
- Extend the operation class with a new helper to create claim claimable balance operations. It receives the `balanceId` as exposed by Horizon in the `/claimable_balances` end-point.
755
-
756
- ```js
757
- const op = Operation.createClaimableBalance({
758
- balanceId:
759
- "00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
760
- });
761
- ```
762
-
763
- - Add support for Sponsored Reserves (CAP33)([#369](https://github.com/stellar/js-stellar-base/pull/369/))
764
-
765
- Extend the operation class with helpers that allow sponsoring reserves and also revoke sponsorships.
766
-
767
- To start sponsoring reserves for an account use:
768
-
769
- - `Operation.beginSponsoringFutureReserves`
770
- - `Operation.endSponsoringFutureReserves`
771
-
772
- To revoke a sponsorship after it has been created use any of the following helpers:
773
-
774
- - `Operation.revokeAccountSponsorship`
775
- - `Operation.revokeTrustlineSponsorship`
776
- - `Operation.revokeOfferSponsorship`
777
- - `Operation.revokeDataSponsorship`
778
- - `Operation.revokeClaimableBalanceSponsorship`
779
- - `Operation.revokeSignerSponsorship`
780
-
781
- The following example contains a transaction which sponsors operations for an account and then revoke some sponsorships.
782
-
783
- ```
784
- const transaction = new StellarSdk.TransactionBuilder(account, {
785
- fee: "100",
786
- networkPassphrase: StellarSdk.Networks.TESTNET
787
- })
788
- .addOperation(
789
- StellarSdk.Operation.beginSponsoringFutureReserves({
790
- sponsoredId: account.accountId(),
791
- source: masterKey.publicKey()
792
- })
793
- )
794
- .addOperation(
795
- StellarSdk.Operation.accountMerge({ destination: destKey.publicKey() }),
796
- ).addOperation(
797
- StellarSdk.Operation.createClaimableBalance({
798
- amount: "10",
799
- asset: StellarSdk.Asset.native(),
800
- claimants: [
801
- new StellarSdk.Claimant(account.accountId())
802
- ]
803
- }),
804
- ).addOperation(
805
- StellarSdk.Operation.claimClaimableBalance({
806
- balanceId: "00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
807
- }),
808
- ).addOperation(
809
- StellarSdk.Operation.endSponsoringFutureReserves({
810
- })
811
- ).addOperation(
812
- StellarSdk.Operation.revokeAccountSponsorship({
813
- account: account.accountId(),
814
- })
815
- ).addOperation(
816
- StellarSdk.Operation.revokeTrustlineSponsorship({
817
- account: account.accountId(),
818
- asset: usd,
819
- })
820
- ).addOperation(
821
- StellarSdk.Operation.revokeOfferSponsorship({
822
- seller: account.accountId(),
823
- offerId: '12345'
824
- })
825
- ).addOperation(
826
- StellarSdk.Operation.revokeDataSponsorship({
827
- account: account.accountId(),
828
- name: 'foo'
829
- })
830
- ).addOperation(
831
- StellarSdk.Operation.revokeClaimableBalanceSponsorship({
832
- balanceId: "00000000da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be",
833
- })
834
- ).addOperation(
835
- StellarSdk.Operation.revokeSignerSponsorship({
836
- account: account.accountId(),
837
- signer: {
838
- ed25519PublicKey: sourceKey.publicKey()
839
- }
840
- })
841
- ).addOperation(
842
- StellarSdk.Operation.revokeSignerSponsorship({
843
- account: account.accountId(),
844
- signer: {
845
- sha256Hash: "da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be"
846
- }
847
- })
848
- ).addOperation(
849
- StellarSdk.Operation.revokeSignerSponsorship({
850
- account: account.accountId(),
851
- signer: {
852
- preAuthTx: "da0d57da7d4850e7fc10d2a9d0ebc731f7afb40574c03395b17d49149b91f5be"
853
- }
854
- })
855
- ).build();
856
- ```
857
-
858
- ### Breaking
859
-
860
- - The XDR generated in this code includes breaking changes on the internal XDR library since a bug was fixed which was causing incorrect code to be generated (see https://github.com/stellar/xdrgen/pull/52).
861
-
862
- The following functions were renamed:
863
-
864
- - `xdr.OperationBody.setOption()` -> `xdr.OperationBody.setOptions()`
865
- - `xdr.OperationBody.manageDatum()` -> `xdr.OperationBody.manageData()`
866
- - `xdr.OperationType.setOption()` -> `xdr.OperationType.setOptions()`
867
- - `xdr.OperationType.manageDatum()` -> `xdr.OperationType.manageData()`
868
-
869
- The following enum values were rename in `OperationType`:
870
-
871
- - `setOption` -> `setOptions`
872
- - `manageDatum` -> `manageData`
873
-
874
- ## [v3.0.4](https://github.com/stellar/js-stellar-base/compare/v3.0.3..v3.0.4)
875
-
876
- ### Update
877
-
878
- - Generate V1 transactions by default and allow V0 transactions to be fee bumped ([#355](https://github.com/stellar/js-stellar-base/pull/355)).
879
-
880
- ## [v3.0.3](https://github.com/stellar/js-stellar-base/compare/v3.0.2..v3.0.3)
881
-
882
- ### Remove
883
-
884
- - Rollback support for SEP23 (Muxed Account StrKey) ([#349](https://github.com/stellar/js-stellar-base/pull/349)).
885
-
886
- ## [v3.0.2](https://github.com/stellar/js-stellar-base/compare/v3.0.1..v3.0.2)
887
-
888
- ### Fix
889
-
890
- - Extend `files` in npm package to include XDR type definitions ([#345](https://github.com/stellar/js-stellar-base/pull/345)).
891
-
892
- ## [v3.0.1](https://github.com/stellar/js-stellar-base/compare/v3.0.0..v3.0.1)
893
-
894
- ### Add
895
-
896
- - Add TypeScript definitions for auto-generated XDR code ([#342](https://github.com/stellar/js-stellar-base/pull/342)).
897
-
898
- ## [v3.0.0](https://github.com/stellar/js-stellar-base/compare/v2.1.9..v3.0.0)
899
-
900
- This version brings protocol 13 support with backwards compatibility support for protocol 12.
901
-
902
- ### Add
903
-
904
- - Add `TransactionBuilder.buildFeeBumpTransaction` which makes it easy to create `FeeBumpTransaction` ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
905
- - Adds a feature flag which allow consumers of this library to create V1 (protocol 13) transactions using the `TransactionBuilder` ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
906
- - Add support for [CAP0027](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0027.md): First-class multiplexed accounts ([#325](https://github.com/stellar/js-stellar-base/pull/325)).
907
- - ~Add `Keypair.xdrMuxedAccount` which creates a new `xdr.MuxedAccount`([#325](https://github.com/stellar/js-stellar-base/pull/325)).~
908
- - Add `FeeBumpTransaction` which makes it easy to work with fee bump transactions ([#328](https://github.com/stellar/js-stellar-base/pull/328)).
909
- - Add `TransactionBuilder.fromXDR` which receives an xdr envelope and return a `Transaction` or `FeeBumpTransaction` ([#328](https://github.com/stellar/js-stellar-base/pull/328)).
910
-
911
- ### Update
912
-
913
- - Update XDR definitions with protocol 13 ([#317](https://github.com/stellar/js-stellar-base/pull/317)).
914
- - Extend `Transaction` to work with `TransactionV1Envelope` and `TransactionV0Envelope` ([#317](https://github.com/stellar/js-stellar-base/pull/317)).
915
- - Add backward compatibility support for [CAP0018](https://github.com/stellar/stellar-protocol/blob/f01c9354aaab1e8ca97a25cf888829749cadf36a/core/cap-0018.md) ([#317](https://github.com/stellar/js-stellar-base/pull/317)).
916
- CAP0018 provides issuers with a new level of authorization between unauthorized and fully authorized, called "authorized to maintain liabilities". The changes in this release allow you to use the new authorization level and provides backward compatible support for Protocol 12.
917
-
918
- Before Protocol 13, the argument `authorize` in the `AllowTrust` operation was of type `boolean` where `true` was authorize and `false` deauthorize. Starting in Protocol 13, this value is now a `number` where `0` is deauthorize, `1` is authorize, and `2` is authorize to maintain liabilities.
919
-
920
- The syntax for authorizing a trustline is still the same, but the authorize parameter is now a `number`.
921
-
922
- ```js
923
- Operation.allowTrust({
924
- trustor: trustor.publicKey(),
925
- assetCode: "COP",
926
- authorize: 1,
927
- });
928
- ```
929
-
930
- You can use still use a `boolean`; however, we recommend you update your code to pass a `number` instead. Finally, using the value `2` for authorize to maintain liabilities will only be valid if Stellar Core is running on Protocol 13; otherwise, you'll get an error.
931
-
932
- - ~Update operations builder to support multiplexed accounts ([#337](https://github.com/stellar/js-stellar-base/pull/337)).~
933
-
934
- ### Breaking changes
935
-
936
- - `Transaction.toEnvelope()` returns a protocol 13 `xdr.TransactionEnvelope` which is an `xdr.Union` ([#317](https://github.com/stellar/js-stellar-base/pull/317)).
937
- If you have code that looks like this - `transaction.toEnvelope().tx` - you have two options:
938
- - You can grab the value wrapped by the union, calling `value()` like `transaction.toEnvelope().value().tx`.
939
- - You can check which is the discriminant by using `switch()` and then call `v0()`, `v1()`, or `feeBump()`.
940
- - The return value from `Transaction.fee` changed from `number` to `string`. This brings support for `Int64` values ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
941
- - The const `BASE_FEE` changed from `number` to `string` ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
942
- - The option `fee` passed to `new TransactionBuilder({fee: ..})` changed from `number` to `string` ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
943
- - The following fields, which were previously an `xdr.AccountID` are now a `xdr.MuxedAccount` ([#325](https://github.com/stellar/js-stellar-base/pull/325)):
944
- - `PaymentOp.destination`
945
- - `PathPaymentStrictReceiveOp.destination`
946
- - `PathPaymentStrictSendOp.destination`
947
- - `Operation.sourceAccount`
948
- - `Operation.destination` (for `ACCOUNT_MERGE`)
949
- - `Transaction.sourceAccount`
950
- - `FeeBumpTransaction.feeSource`
951
-
952
- You can get the string representation by calling `StrKey.encodeMuxedAccount` which will return a `G..` or `M..` account.
953
-
954
- - Remove the following deprecated functions ([#331](https://github.com/stellar/js-stellar-base/pull/331)):
955
- - `Operation.manageOffer`
956
- - `Operation.createPassiveOffer`
957
- - `Operation.pathPayment`
958
- - `Keypair.fromBase58Seed`
959
- - Remove the `Network` class ([#331](https://github.com/stellar/js-stellar-base/pull/331)).
960
- - Remove `vendor/base58.js` ([#331](https://github.com/stellar/js-stellar-base/pull/331)).
961
-
962
- ## [v3.0.0-alpha.1](https://github.com/stellar/js-stellar-base/compare/v3.0.0-alpha.0..v3.0.0-alpha.1)
963
-
964
- ### Update
965
-
966
- - Update operations builder to support multiplexed accounts ([#337](https://github.com/stellar/js-stellar-base/pull/337)).
967
-
968
- This allows you to specify an `M` account as the destination or source:
969
-
970
- ```
971
- var destination = 'MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6';
972
- var amount = '1000.0000000';
973
- var asset = new StellarBase.Asset(
974
- 'USDUSD',
975
- 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7'
976
- );
977
- var source =
978
- 'MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6';
979
- StellarBase.Operation.payment({
980
- destination,
981
- asset,
982
- amount,
983
- source
984
- });
985
- ```
986
-
987
- **To use multiplexed accounts you need an instance of Stellar running on Protocol 13 or higher**
988
-
989
- ## [v3.0.0-alpha.0](https://github.com/stellar/js-stellar-base/compare/v2.1.9..v3.0.0-alpha.0)
990
-
991
- This version brings protocol 13 support with backwards compatibility support for protocol 12.
992
-
993
- ### Add
994
-
995
- - Add `TransactionBuilder.buildFeeBumpTransaction` which makes it easy to create `FeeBumpTransaction` ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
996
- - Adds a feature flag which allow consumers of this library to create V1 (protocol 13) transactions using the `TransactionBuilder` ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
997
- - Add support for [CAP0027](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0027.md): First-class multiplexed accounts ([#325](https://github.com/stellar/js-stellar-base/pull/325)).
998
- - Add `Keypair.xdrMuxedAccount` which creates a new `xdr.MuxedAccount`([#325](https://github.com/stellar/js-stellar-base/pull/325)).
999
- - Add `FeeBumpTransaction` which makes it easy to work with fee bump transactions ([#328](https://github.com/stellar/js-stellar-base/pull/328)).
1000
- - Add `TransactionBuilder.fromXDR` which receives an xdr envelope and return a `Transaction` or `FeeBumpTransaction` ([#328](https://github.com/stellar/js-stellar-base/pull/328)).
1001
-
1002
- ### Update
1003
-
1004
- - Update XDR definitions with protocol 13 ([#317](https://github.com/stellar/js-stellar-base/pull/317)).
1005
- - Extend `Transaction` to work with `TransactionV1Envelope` and `TransactionV0Envelope` ([#317](https://github.com/stellar/js-stellar-base/pull/317)).
1006
- - Add backward compatibility support for [CAP0018](https://github.com/stellar/stellar-protocol/blob/f01c9354aaab1e8ca97a25cf888829749cadf36a/core/cap-0018.md) ([#317](https://github.com/stellar/js-stellar-base/pull/317)).
1007
-
1008
- ### Breaking changes
1009
-
1010
- - `Transaction.toEnvelope()` returns a protocol 13 `xdr.TransactionEnvelope` which is an `xdr.Union` ([#317](https://github.com/stellar/js-stellar-base/pull/317)).
1011
- If you have code that looks like this `transaction.toEnvelope().tx` you have two options:
1012
- - You can grab the value wrapped by the union, calling `value()` like `transaction.toEnvelope().value().tx`.
1013
- - You can check which is the discriminant by using `switch()` and then call `v0()`, `v1()`, or `feeBump()`.
1014
- - The return value from `Transaction.fee` changed from `number` to `string`. This brings support for `Int64` values ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
1015
- - The const `BASE_FEE` changed from `number` to `string` ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
1016
- - The option `fee` passed to `new TransactionBuilder({fee: ..})` changed from `number` to `string` ([#321](https://github.com/stellar/js-stellar-base/pull/321)).
1017
- - The following fields, which were previously an `xdr.AccountID` are now a `xdr.MuxedAccount` ([#325](https://github.com/stellar/js-stellar-base/pull/325)):
1018
- - `PaymentOp.destination`
1019
- - `PathPaymentStrictReceiveOp.destination`
1020
- - `PathPaymentStrictSendOp.destination`
1021
- - `Operation.sourceAccount`
1022
- - `Operation.destination` (for `ACCOUNT_MERGE`)
1023
- - `Transaction.sourceAccount`
1024
- - `FeeBumpTransaction.feeSource`
1025
-
1026
- You can get the string representation by calling `StrKey.encodeMuxedAccount` which will return a `G..` or `M..` account.
1027
-
1028
- - Remove the following deprecated functions ([#331](https://github.com/stellar/js-stellar-base/pull/331)):
1029
- - `Operation.manageOffer`
1030
- - `Operation.createPassiveOffer`
1031
- - `Operation.pathPayment`
1032
- - `Keypair.fromBase58Seed`
1033
- - Remove the `Network` class ([#331](https://github.com/stellar/js-stellar-base/pull/331)).
1034
- - Remove `vendor/base58.js` ([#331](https://github.com/stellar/js-stellar-base/pull/331)).
1035
-
1036
- ## [v2.1.9](https://github.com/stellar/js-stellar-base/compare/v2.1.8..v2.1.9)
1037
-
1038
- ### Fix
1039
-
1040
- - Update dependencies which depend on minimist. ([#332](https://github.com/stellar/js-stellar-base/pull/332))
1041
-
1042
- ## [v2.1.8](https://github.com/stellar/js-stellar-base/compare/v2.1.7..v2.1.8)
1043
-
1044
- ### Fix
1045
-
1046
- - Fix `setTimeout(0)` and partially defined timebounds ([#315](https://github.com/stellar/js-stellar-base/pull/315)).
1047
-
1048
- ## [v2.1.7](https://github.com/stellar/js-stellar-base/compare/v2.1.6..v2.1.7)
1049
-
1050
- ### Fix
1051
-
1052
- - Fix TypeScript options for `ManageData` operation to allow setting value to `null` ([#310](https://github.com/stellar/js-stellar-base/issues/310))
1053
- - Fix crash on partially defined time bounds ([#303](https://github.com/stellar/js-stellar-base/issues/303))
1054
-
1055
- ## [v2.1.6](https://github.com/stellar/js-stellar-base/compare/v2.1.5..v2.1.6)
1056
-
1057
- ### Fix
1058
-
1059
- - Fix npm deployment.
1060
-
1061
- ## [v2.1.5](https://github.com/stellar/js-stellar-base/compare/v2.1.4..v2.1.5)
1062
-
1063
- ### Add
1064
-
1065
- - Add `toXDR` type to Transaction class ([#296](https://github.com/stellar/js-stellar-base/issues/296))
1066
-
1067
- ### Fix
1068
-
1069
- - Fix doc link ([#298](https://github.com/stellar/js-stellar-base/issues/298))
1070
-
1071
- ### Remove
1072
-
1073
- - Remove node engine restriction ([#294](https://github.com/stellar/js-stellar-base/issues/294))
1074
-
1075
- ### Update
1076
-
1077
- - Update creating an account example ([#299](https://github.com/stellar/js-stellar-base/issues/299))
1078
- - Use `console.trace` to get line num in `Networks.use` ([#300](https://github.com/stellar/js-stellar-base/issues/300))
1079
-
1080
- ## [v2.1.4](https://github.com/stellar/js-stellar-base/compare/v2.1.3..v2.1.4)
1081
-
1082
- ## Update
1083
-
1084
- - Regenerate the XDR definitions to include MetaV2 ([#288](https://github.com/stellar/js-stellar-base/issues/288))
1085
-
1086
- ## [v2.1.3](https://github.com/stellar/js-stellar-base/compare/v2.1.2...v2.1.3)
1087
-
1088
- ## Update 📣
1089
-
1090
- - Throw errors when obviously invalid network passphrases are used in
1091
- `new Transaction()`.
1092
- ([284](https://github.com/stellar/js-stellar-base/pull/284))
1093
-
1094
- ## [v2.1.2](https://github.com/stellar/js-stellar-base/compare/v2.1.1...v2.1.2)
1095
-
1096
- ## Update 📣
1097
-
1098
- - Update documentation for `Operation` to show `pathPaymentStrictSend` and `pathPaymentStrictReceive`. ([279](https://github.com/stellar/js-stellar-base/pull/279))
1099
-
1100
- ## [v2.1.1](https://github.com/stellar/js-stellar-base/compare/v2.1.0...v2.1.1)
1101
-
1102
- ## Update 📣
1103
-
1104
- - Update `asset.toString()` to return canonical representation for asset. ([277](https://github.com/stellar/js-stellar-base/pull/277)).
1105
-
1106
- Calling `asset.toString()` will return `native` for `XLM` or `AssetCode:AssetIssuer` for issued assets. See [this PR](https://github.com/stellar/stellar-protocol/pull/313) for more information.
1107
-
1108
- ## [v2.1.0](https://github.com/stellar/js-stellar-base/compare/v2.0.2...v2.1.0)
1109
-
1110
- This release adds support for [stellar-core protocol 12 release](https://github.com/stellar/stellar-core/projects/11) and [CAP 24](https://github.com/stellar/stellar-protocol/blob/master/core/cap-0024.md) ("Make PathPayment Symmetrical").
1111
-
1112
- ### Add ➕
1113
-
1114
- - `Operation.pathPaymentStrictSend`: Sends a path payments, debiting from the source account exactly a specified amount of one asset, crediting at least a given amount of another asset. ([#274](https://github.com/stellar/js-stellar-base/pull/274)).
1115
-
1116
- The following operation will debit exactly 10 USD from the source account, crediting at least 9.2 EUR in the destination account 💸:
1117
-
1118
- ```js
1119
- var sendAsset = new StellarBase.Asset(
1120
- "USD",
1121
- "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
1122
- );
1123
- var sendAmount = "10";
1124
- var destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ";
1125
- var destAsset = new StellarBase.Asset(
1126
- "USD",
1127
- "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
1128
- );
1129
- var destMin = "9.2";
1130
- var path = [
1131
- new StellarBase.Asset(
1132
- "USD",
1133
- "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"
1134
- ),
1135
- new StellarBase.Asset(
1136
- "EUR",
1137
- "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"
1138
- ),
1139
- ];
1140
- let op = StellarBase.Operation.pathPaymentStrictSend({
1141
- sendAsset,
1142
- sendAmount,
1143
- destination,
1144
- destAsset,
1145
- destMin,
1146
- path,
1147
- });
1148
- ```
1149
-
1150
- - `Operation.pathPaymentStrictReceive`: This behaves the same as the former `pathPayments` operation. ([#274](https://github.com/stellar/js-stellar-base/pull/274)).
1151
-
1152
- The following operation will debit maximum 10 USD from the source account, crediting exactly 9.2 EUR in the destination account 💸:
1153
-
1154
- ```js
1155
- var sendAsset = new StellarBase.Asset(
1156
- "USD",
1157
- "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
1158
- );
1159
- var sendMax = "10";
1160
- var destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ";
1161
- var destAsset = new StellarBase.Asset(
1162
- "USD",
1163
- "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
1164
- );
1165
- var destAmount = "9.2";
1166
- var path = [
1167
- new StellarBase.Asset(
1168
- "USD",
1169
- "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"
1170
- ),
1171
- new StellarBase.Asset(
1172
- "EUR",
1173
- "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"
1174
- ),
1175
- ];
1176
- let op = StellarBase.Operation.pathPaymentStrictReceive({
1177
- sendAsset,
1178
- sendMax,
1179
- destination,
1180
- destAsset,
1181
- destAmount,
1182
- path,
1183
- });
1184
- ```
1185
-
1186
- ## Deprecated ❗️
1187
-
1188
- - `Operation.pathPayment` is being deprecated in favor of `Operation.pathPaymentStrictReceive`. Both functions take the same arguments and behave the same. ([#274](https://github.com/stellar/js-stellar-base/pull/274)).
1189
-
1190
- ## [v2.0.2](https://github.com/stellar/js-stellar-base/compare/v2.0.1...v2.0.2)
1191
-
1192
- ### Fix
1193
-
1194
- - Fix issue [#269](https://github.com/stellar/js-stellar-base/issues/269). ManageBuyOffer should extend BaseOptions and inherited property "source". ([#270](https://github.com/stellar/js-stellar-base/pull/270)).
1195
-
1196
- ## [v2.0.1](https://github.com/stellar/js-stellar-base/compare/v2.0.0...v2.0.1)
1197
-
1198
- No changes. Fixes deploy script and includes changes from [v2.0.0](https://github.com/stellar/js-stellar-base/compare/v1.1.2...v2.0.0).
1199
-
1200
- ## [v2.0.0](https://github.com/stellar/js-stellar-base/compare/v1.1.2...v2.0.0)
1201
-
1202
- ### BREAKING CHANGES
1203
-
1204
- - Drop Support for Node 6 since it has been end-of-lifed and no longer in LTS. We now require Node 10 which is the current LTS until April 1st, 2021. ([#255](https://github.com/stellar/js-stellar-base/pull/255))
1205
-
1206
- ## [v1.1.2](https://github.com/stellar/js-stellar-base/compare/v1.1.1...v1.1.2)
1207
-
1208
- ### Fix
1209
-
1210
- - Fix no-network warnings ([#248](https://github.com/stellar/js-stellar-base/issues/248))
1211
-
1212
- ## [v1.1.1](https://github.com/stellar/js-stellar-base/compare/v1.1.0...v1.1.1)
1213
-
1214
- ### Fix
1215
-
1216
- - Add types for new networkPassphrase argument. Fix [#237](https://github.com/stellar/js-stellar-base/issues/237). ([#238](https://github.com/stellar/js-stellar-base/issues/238))
1217
-
1218
- ## [v1.1.0](https://github.com/stellar/js-stellar-base/compare/v1.0.3...v1.1.0)
1219
-
1220
- ### Deprecated
1221
-
1222
- Deprecate global singleton for `Network`. The following classes and
1223
- methods take an optional network passphrase, and issue a warning if it
1224
- is not passed:
1225
-
1226
- #### `Keypair.master`
1227
-
1228
- ```js
1229
- Keypair.master(Networks.TESTNET);
1230
- ```
1231
-
1232
- #### constructor for `Transaction`
1233
-
1234
- ```js
1235
- const xenv = new xdr.TransactionEnvelope({ tx: xtx });
1236
- new Transaction(xenv, Networks.TESTNET);
1237
- ```
1238
-
1239
- #### constructor for `TransactionBuilder` and method `TransactionBuilder.setNetworkPassphrase`
1240
-
1241
- ```js
1242
- const transaction = new StellarSdk.TransactionBuilder(account, {
1243
- fee: StellarSdk.BASE_FEE,
1244
- networkPassphrase: Networks.TESTNET,
1245
- });
1246
- ```
1247
-
1248
- See [#207](https://github.com/stellar/js-stellar-base/issues/207) and [#112](https://github.com/stellar/js-stellar-base/issues/112) for more information.
1249
-
1250
- The `Network` class will be removed on the `2.0` release.
1251
-
1252
- ### Add
1253
-
1254
- - Add docs for BASE_FEE const. ([#211](https://github.com/stellar/js-stellar-base/issues/211))
1255
-
1256
- ### Fix
1257
-
1258
- - Fix typo. ([#213](https://github.com/stellar/js-stellar-base/issues/213))
1259
-
1260
- ## [v1.0.3](https://github.com/stellar/js-stellar-base/compare/v1.0.2...v1.0.3)
1261
-
1262
- ### Add
1263
-
1264
- - Add `toString()` to Asset ([#172](https://github.com/stellar/js-stellar-base/issues/172))
1265
- - Add types for missing Network functions ([#208](https://github.com/stellar/js-stellar-base/issues/208))
1266
- - Add BASE_FEE to TS types ([#209](https://github.com/stellar/js-stellar-base/issues/209))
1267
-
1268
- ### Fix
1269
-
1270
- - Fix typo in types ([#194](https://github.com/stellar/js-stellar-base/issues/194))
1271
- - Fix types: Fee is no longer optional ([#195](https://github.com/stellar/js-stellar-base/issues/195))
1272
- - Fix typings for Account Sequence Number ([#203](https://github.com/stellar/js-stellar-base/issues/203))
1273
- - Fix typings for Transaction Sequence Number ([#205](https://github.com/stellar/js-stellar-base/issues/205))
1274
-
1275
- ## [v1.0.2](https://github.com/stellar/js-stellar-base/compare/v1.0.1...v1.0.2)
1276
-
1277
- - Fix a bug where `sodium-native` was making it into the browser bundle, which
1278
- is supposed to use `tweetnacl`.
1279
-
1280
- ## [v1.0.1](https://github.com/stellar/js-stellar-base/compare/v1.0.0...v1.0.1)
1281
-
1282
- - Restore `Operation.manageOffer` and `Operation.createPassiveOffer`, and issue
1283
- a warning if they're called.
1284
- - Add type definitions for the timeBounds property of transactions.
1285
-
1286
- ## [v1.0.0](https://github.com/stellar/js-stellar-base/compare/v0.13.2...v1.0.0)
1287
-
1288
- - **Breaking change** Stellar Protocol 11 compatibility
1289
- - Rename `Operation.manageOffer` to `Operation.manageSellOffer`.
1290
- - Rename `Operation.createPassiveOffer` to `Operation.createPassiveSellOffer`.
1291
- - Add `Operation.manageBuyOffer`.
1292
- - **Breaking change** The `fee` parameter to `TransactionBuilder` is now
1293
- required. Failing to provide a fee will throw an error.
1294
-
1295
- ## [v0.13.2](https://github.com/stellar/js-stellar-base/compare/v0.13.1...v0.13.2)
1296
-
1297
- - Bring DefinitelyTyped definitions into the repo for faster updating.
1298
- - Add missing Typescript type definitions.
1299
- - Add code to verify signatures when added to transactions.
1300
- - Replace ed25519 with sodium-native.
1301
- - Fix the xdr for SCP_MESSAGE.
1302
- - Update the README for the latest info.
1303
-
1304
- ## [v0.13.1](https://github.com/stellar/js-stellar-base/compare/v0.13.0...v0.13.1)
1305
-
1306
- - Travis: Deploy NPM with an environment variable instead of an encrypted API
1307
- key.
1308
- - Instruct Travis to cache node_modules
1309
-
1310
- ## [v0.13.0](https://github.com/stellar/js-stellar-base/compare/v0.12.0...v0.13.0)
1311
-
1312
- - Remove the `crypto` library. This reduces the number of Node built-ins we have
1313
- to shim into the production bundle, and incidentally fixes a bug with
1314
- Angular 6.
1315
-
1316
- ## [v0.12.0](https://github.com/stellar/js-stellar-base/compare/v0.11.0...v0.12.0)
1317
-
1318
- - _Warning_ Calling TransactionBuilder without a `fee` param is now deprecated
1319
- and will issue a warning. In a later release, it will throw an error. Please
1320
- update your transaction builders as soon as you can!
1321
- - Add a `toXDR` function for transactions that lets you get the transaction as a
1322
- base64-encoded string (so you may enter it into the Stellar Laboratory XDR
1323
- viewer, for one)
1324
- - Fix TransactionBuilder example syntax errors
1325
- - Use more thorough "create account" documentation
1326
- - Add `Date` support for `TransactionBuilder` `timebounds`
1327
- - Add two functions to `Transaction` that support pre-generated transactions:
1328
- - `getKeypairSignature` helps users sign pre-generated transaction XDRs
1329
- - `addSignature` lets you add pre-generated signatures to a built transaction
1330
-
1331
- ## 0.11.0
1332
-
1333
- - Added ESLint and Prettier to enforce code style
1334
- - Upgraded dependencies, including Babel to 6
1335
- - Bump local node version to 6.14.0
1336
- - Change Operations.\_fromXDRAmount to not use scientific notation (1e-7) for
1337
- small amounts like 0.0000001.
1338
-
1339
- ## 0.10.0
1340
-
1341
- - **Breaking change** Added
1342
- [`TransactionBuilder.setTimeout`](https://stellar.github.io/js-stellar-base/TransactionBuilder.html#setTimeout)
1343
- method that sets `timebounds.max_time` on a transaction. Because of the
1344
- distributed nature of the Stellar network it is possible that the status of
1345
- your transaction will be determined after a long time if the network is highly
1346
- congested. If you want to be sure to receive the status of the transaction
1347
- within a given period you should set the TimeBounds with `maxTime` on the
1348
- transaction (this is what `setTimeout` does internally; if there's `minTime`
1349
- set but no `maxTime` it will be added). Call to
1350
- `TransactionBuilder.setTimeout` is required if Transaction does not have
1351
- `max_time` set. If you don't want to set timeout, use `TimeoutInfinite`. In
1352
- general you should set `TimeoutInfinite` only in smart contracts. Please check
1353
- [`TransactionBuilder.setTimeout`](https://stellar.github.io/js-stellar-base/TransactionBuilder.html#setTimeout)
1354
- docs for more information.
1355
- - Fixed decoding empty `homeDomain`.
1356
-
1357
- ## 0.9.0
1358
-
1359
- - Update `js-xdr` to support unmarshaling non-utf8 strings.
1360
- - String fields returned by `Operation.fromXDRObject()` are of type `Buffer` now
1361
- (except `SetOptions.home_domain` and `ManageData.name` - both required to be
1362
- ASCII by stellar-core).
1363
-
1364
- ## 0.8.3
1365
-
1366
- - Update `xdr` files to V10.
1367
-
1368
- ## 0.8.2
1369
-
1370
- - Upgrade `js-xdr`.
1371
-
1372
- ## 0.8.1
1373
-
1374
- - Removed `src` from `.npmignore`.
1375
-
1376
- ## 0.8.0
1377
-
1378
- - Added support for `bump_sequence` operation.
1379
- - Fixed many code style issues.
1380
- - Updated docs.
1381
-
1382
- ## 0.7.8
1383
-
1384
- - Updated dependencies.
1385
-
1386
- ## 0.7.7
1387
-
1388
- - Updated docs.
1389
-
1390
- ## 0.7.6
1391
-
1392
- - Updated docs.
1393
-
1394
- ## 0.7.5
1395
-
1396
- - `Keypair.constructor` now requires `type` field to define public-key signature
1397
- system used in this instance (so `Keypair` can support other systems in a
1398
- future). It also checks if public key and secret key match if both are passed
1399
- (to prevent nasty bugs).
1400
- - `Keypair.fromRawSeed` has been renamed to `Keypair.fromRawEd25519Seed` to make
1401
- it clear that the seed must be Ed25519 seed.
1402
- - It's now possible to instantiate `Memo` class so it's easier to check it's
1403
- type and value (without dealing with low level `xdr.Memo` objects).
1404
- - Changed `Asset.toXdrObject` to `Asset.toXDRObject` and
1405
- `Operation.operationToObject` to `Operation.toXDRObject` for consistency.
1406
- - Time bounds support for numeric input values.
1407
- - Added `browser` prop to package.json.
1408
-
1409
- ## 0.7.4
1410
-
1411
- - Update dependencies.
1412
- - Remove unused methods.
1413
-
1414
- ## 0.7.3
1415
-
1416
- - Allow hex string in setOptions signers
1417
-
1418
- ## 0.7.2
1419
-
1420
- - Updated XDR files
1421
-
1422
- ## 0.7.1
1423
-
1424
- - Checking hash preimage length
1425
-
1426
- ## 0.7.0
1427
-
1428
- - Support for new signer types: `sha256Hash`, `preAuthTx`.
1429
- - `StrKey` helper class with `strkey` encoding related methods.
1430
- - Removed deprecated methods: `Keypair.isValidPublicKey` (use `StrKey`),
1431
- `Keypair.isValidSecretKey` (use `StrKey`), `Keypair.fromSeed`, `Keypair.seed`,
1432
- `Keypair.rawSeed`.
1433
- - **Breaking changes**:
1434
- - `Network` must be explicitly selected. Previously testnet was a default
1435
- network.
1436
- - `Operation.setOptions()` method `signer` param changed.
1437
- - `Keypair.fromAccountId()` renamed to `Keypair.fromPublicKey()`.
1438
- - `Keypair.accountId()` renamed to `Keypair.publicKey()`.
1439
- - Dropping support for `End-of-Life` node versions.
1440
-
1441
- ## 0.6.0
1442
-
1443
- - **Breaking change** `ed25519` package is now optional dependency.
1444
- - Export account flags constants.
1445
-
1446
- ## 0.5.7
1447
-
1448
- - Fixes XDR decoding issue when using firefox
1449
-
1450
- ## 0.5.6
1451
-
1452
- - UTF-8 support in `Memo.text()`.
1453
-
1454
- ## 0.5.5
1455
-
1456
- - Make 0 a valid number for transaction fee,
1457
- - Fix signer in Operation.operationToObject() - close #82
1458
-
1459
- ## 0.5.4
1460
-
1461
- - Fixed Lodash registering itself to global scope.
1462
-
1463
- ## 0.5.3
1464
-
1465
- - Add support for ManageData operation.
1466
-
1467
- ## 0.5.2
1468
-
1469
- - Moved `Account.isValidAccountId` to `Keypair.isValidPublicKey`. It's still
1470
- possible to use `Account.isValidAccountId` but it will be removed in the next
1471
- minor release (breaking change). (af10f2a)
1472
- - `signer.address` option in `Operation.setOptions` was changed to
1473
- `signer.pubKey`. It's still possible to use `signer.address` but it will be
1474
- removed in the next minor release (breaking change). (07f43fb)
1475
- - `Operation.setOptions` now accepts strings for `clearFlags`, `setFlags`,
1476
- `masterWeight`, `lowThreshold`, `medThreshold`, `highThreshold`,
1477
- `signer.weight` options. (665e018)
1478
- - Fixed TransactionBuilder timebounds option. (854f275)
1479
- - Added `CHANGELOG.md` file.
1480
-
1481
- ## 0.5.1
1482
-
1483
- - Now it's possible to pass `price` params as `{n: numerator, d: denominator}`
1484
- object. Thanks @FredericHeem. (#73)
1485
-
1486
- ## 0.5.0
1487
-
1488
- - **Breaking change** `sequence` in `Account` constructor must be a string.
1489
- (4da5dfc)
1490
- - **Breaking change** Removed deprecated methods (180a5b8):
1491
- - `Account.isValidAddress` (replaced by `Account.isValidAccountId`)
1492
- - `Account.getSequenceNumber` (replaced by `Account.sequenceNumber`)
1493
- - `Keypair.address` (replaced by `Keypair.accountId`)
1494
- - `Network.usePublicNet` (replaced by `Network.usePublicNetwork`)
1495
- - `Network.useTestNet` (replaced by `Network.useTestNetwork`)
1496
- - `TransactionBuilder.addSigner` (call `Transaction.sign` on build
1497
- `Transaction` object)