Skip to content

Commit 3f82e7e

Browse files
authored
Release Protocol 23 (#805)
* Add strkey support for liquidity pools and claimable balances (#799) * Regenerate XDR with latest Protocol 23 version (#800) * Migrate cryptographic libraries to use modern @noble/curves. (#802) * Add support for encoding `Address` to/from new `StrKey`s (#801) * Allow specifying mixed types for vectors in `nativeToScVal` (#803) * Prepare v14.0.0-rc.1, Protocol 23 for release (#804)
1 parent 01da49a commit 3f82e7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+4870
-4070
lines changed

.github/workflows/bundle_size.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ jobs:
77
build:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111

12-
- name: Install Node.js 18
13-
uses: actions/setup-node@v3
12+
- name: Install Node.js 20
13+
uses: actions/setup-node@v4
1414
with:
15-
node-version: '18.x'
15+
node-version: '20.x'
1616

1717
# Workaround for some `yarn` nonsense, see:
1818
# https://github.com/yarnpkg/yarn/issues/6312#issuecomment-429685210

.github/workflows/format.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414

1515
- name: Use Node.js 20
16-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@v4
1717
with:
18-
node-version: 20
18+
node-version: '20.x'
1919

2020
# Workaround for some `yarn` nonsense, see:
2121
# https://github.com/yarnpkg/yarn/issues/6312#issuecomment-429685210

.github/workflows/gh_pages.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
1414

15-
- name: Install Node (18.x)
16-
uses: actions/setup-node@v3
15+
- name: Install Node (20.x)
16+
uses: actions/setup-node@v4
1717
with:
18-
node-version: 18
18+
node-version: 20
1919

2020
- name: Install Dependencies
2121
run: yarn install
@@ -24,7 +24,7 @@ jobs:
2424
run: yarn preversion
2525

2626
- name: Checkout GH pages
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828
with:
2929
repository: stellar/js-stellar-base
3030
ref: gh-pages

.github/workflows/npm_publish.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4
1212

1313
- name: Install Node
14-
uses: actions/setup-node@v3
14+
uses: actions/setup-node@v4
1515
with:
16-
node-version: '18.x'
16+
node-version: '20.x'
1717
registry-url: 'https://registry.npmjs.org'
1818

1919
- name: Install Depencencies
@@ -24,16 +24,6 @@ jobs:
2424

2525
- name: Publish npm package to both places
2626
run: |
27-
yarn publish --access public
28-
sed -i -e 's#"@stellar/stellar-base"#"stellar-base"#' package.json
29-
yarn publish
30-
env:
31-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32-
33-
- name: Deprecate the old package
34-
run: |
35-
V=$(cat package.json | jq '.version' | sed -e 's/\"//g')
36-
echo "Deprecating stellar-base@$V"
37-
npm deprecate stellar-base@"<= $V" "⚠️ This package has moved to @stellar/stellar-base! 🚚"
27+
yarn publish --access public --tag protocol-23-beta
3828
env:
3929
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
max-parallel: 4
1515
matrix:
16-
node-version: [18, 20, 22]
16+
node-version: [20, 22]
1717

1818
steps:
1919
- name: Checkout

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22

33
## Unreleased
44

5+
6+
## [`v14.0.0-rc.1`](https://github.com/stellar/js-stellar-base/compare/v13.1.0...v14.0.0-rc.1): Protocol 23
7+
8+
### Breaking Changes
9+
* This package now requires **>= Node 20**.
10+
* XDR definitions have been updated to align with Protocol 23 ([#800](https://github.com/stellar/js-stellar-base/pull/800)).
11+
12+
### Added
13+
* The `sodium-native` and `tweetnacl` dependencies have been replaced with `@noble/curves` ([#802](https://github.com/stellar/js-stellar-base/pull/802)).
14+
* Support for claimable balances and liquidity pools in `StrKey` ([#799](https://github.com/stellar/js-stellar-base/pull/799)).
15+
* Support for claimable balances, liquidity pools, and muxed accounts in `Address` ([#801](https://github.com/stellar/js-stellar-base/pull/801)).
16+
* 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)).
17+
518
### Fixed
6-
* Removed [the custom `Buffer.subarray` polyfill](https://github.com/stellar/js-stellar-base/pull/733) introduced in v11.0.1 to address the issue of it not being usable in the React Native Hermes engine. We recommend using [`@exodus/patch-broken-hermes-typed-arrays`](https://github.com/ExodusMovement/patch-broken-hermes-typed-arrays) as an alternative. If needed, please review and consider manually adding it to your project ([#795](https://github.com/stellar/js-stellar-base/pull/795)).
7-
* Remove `MuxedAccount.parseBaseAddress` from TypeScript definitions ([#797](https://github.com/stellar/js-stellar-base/pull/797)).
19+
* 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)).
820
* Fix browser compatibility with proper module resolution and UMD configuration ([#798](https://github.com/stellar/js-stellar-base/pull/798)).
21+
* Remove `MuxedAccount.parseBaseAddress` from TypeScript definitions ([#797](https://github.com/stellar/js-stellar-base/pull/797)).
22+
923

1024
## [`v13.1.0`](https://github.com/stellar/js-stellar-base/compare/v13.0.1...v13.1.0)
1125

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/529d5176f24c73eeccfa5eba481d4e89c19b1181
1+
XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/4b7a2ef7931ab2ca2499be68d849f38190b443ca
22
XDR_BASE_LOCAL_CURR=xdr/curr
33
XDR_FILES_CURR= \
44
Stellar-SCP.x \
@@ -11,10 +11,11 @@ XDR_FILES_CURR= \
1111
Stellar-contract-env-meta.x \
1212
Stellar-contract-meta.x \
1313
Stellar-contract-spec.x \
14-
Stellar-contract-config-setting.x
14+
Stellar-contract-config-setting.x \
15+
Stellar-exporter.x
1516
XDR_FILES_LOCAL_CURR=$(addprefix xdr/curr/,$(XDR_FILES_CURR))
1617

17-
XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/8c88608d0a20b01873056a5ec13be245e1f2aa27
18+
XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/4b7a2ef7931ab2ca2499be68d849f38190b443ca
1819
XDR_BASE_LOCAL_NEXT=xdr/next
1920
XDR_FILES_NEXT= \
2021
Stellar-SCP.x \
@@ -27,7 +28,8 @@ XDR_FILES_NEXT= \
2728
Stellar-contract-env-meta.x \
2829
Stellar-contract-meta.x \
2930
Stellar-contract-spec.x \
30-
Stellar-contract-config-setting.x
31+
Stellar-contract-config-setting.x \
32+
Stellar-exporter.x
3133
XDR_FILES_LOCAL_NEXT=$(addprefix xdr/next/,$(XDR_FILES_NEXT))
3234

3335
XDRGEN_COMMIT=master

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,22 @@ earlier versions of Node, so the tests need to run on those versions.)
146146

147147
#### Updating XDR definitions
148148

149+
XDR updates are complicated due to the fact that you need workarounds for bugs
150+
in the generator, formatter, or a namespace adjustment.
151+
149152
1. Make sure you have [Docker](https://www.docker.com/) installed and running.
150-
2. `make reset-xdr`
153+
2. Change the commit hash to the right version of [stellar-xdr](https://github.com/stellar/stellar-xdr) and add any filenames that might've been introduced.
154+
3. Run `make reset-xdr`
155+
4. Run `sed -ie s/\"/\'/g types/{curr,next}.d.ts` to minimize the diff (the generator's formatter uses `"` but the repo uses `'`).
156+
5. Move `xdr.Operation` into a hidden namespace to avoid conflicts with the SDK's `Operation`.
157+
6. Add generator workarounds:
158+
* `type Hash = Opaque[]` is a necessary alias that doesn't get generated
159+
* `Hyper`, `UnsignedHyper`, and `ScSpecEventV0` need their signatures
160+
fixed because linting wants an `Array` instead of a naked `[]`.
161+
* Some constants aren't generated correctly (e.g, Ctrl+F `SCSYMBOL_LIMIT` in `src/curr_generated.js`)
162+
7. Finally, make code adjustments related to the XDR (these are usually revealed by running the tests).
163+
164+
As an example PR to follow, [stellar-base#800](https://github.com/stellar/js-stellar-base/pull/800) has detailed steps for each part of the process.
151165

152166
## Usage
153167

config/webpack.config.browser.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ const config = {
6262
new ESLintPlugin({
6363
overrideConfigFile: path.resolve(__dirname, './.eslintrc.js')
6464
}),
65-
// Ignore native modules (sodium-native)
66-
new webpack.IgnorePlugin({ resourceRegExp: /sodium-native/ }),
6765
new NodePolyfillPlugin(),
6866
new webpack.ProvidePlugin({
6967
Buffer: ['buffer', 'Buffer']

docs/reference/base-examples.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ title: Transaction Examples
1010

1111
## Creating an account
1212

13-
In the example below a new account is created by the source account with secret
14-
`SA3W53XXG64ITFFIYQSBIJDG26LMXYRIMEVMNQMFAQJOYCZACCYBA34L`. The source account
13+
In the example below a new account is created by the source account with secret
14+
`SA3W53XXG64ITFFIYQSBIJDG26LMXYRIMEVMNQMFAQJOYCZACCYBA34L`. The source account
1515
is giving the new account 25 XLM as its initial balance.
1616

1717

@@ -126,7 +126,7 @@ In each example, we'll use the root account.
126126

127127

128128
```js
129-
var rootKeypair = StellarSdk.Keypair.fromSecret("SBQWY3DNPFWGSZTFNV4WQZLBOJ2GQYLTMJSWK3TTMVQXEY3INFXGO52X")
129+
var rootKeypair = StellarSdk.Keypair.fromSecret("SBQW...")
130130
var account = new StellarSdk.Account(rootkeypair.publicKey(), "46316927324160");
131131

132132
var secondaryAddress = "GC6HHHS7SH7KNUAOBKVGT2QZIQLRB5UA7QAGLA3IROWPH4TN65UKNJPK";
@@ -166,11 +166,9 @@ var transaction = new StellarSdk.TransactionBuilder(account, {
166166
.setTimeout(30)
167167
.build();
168168

169-
var secondKeypair = StellarSdk.Keypair.fromSecret("SAMZUAAPLRUH62HH3XE7NVD6ZSMTWPWGM6DS4X47HLVRHEBKP4U2H5E7");
169+
var secondKeypair = StellarSdk.Keypair.fromSecret("SAMZ...");
170170

171171
// now we need to sign the transaction with both the root and the secondaryAddress
172172
transaction.sign(rootKeypair);
173173
transaction.sign(secondKeypair);
174174
```
175-
176-

0 commit comments

Comments
 (0)