Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/bundle_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install Node.js 18
uses: actions/setup-node@v3
- name: Install Node.js 20
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'

# Workaround for some `yarn` nonsense, see:
# https://github.com/yarnpkg/yarn/issues/6312#issuecomment-429685210
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
node-version: '20.x'

# Workaround for some `yarn` nonsense, see:
# https://github.com/yarnpkg/yarn/issues/6312#issuecomment-429685210
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/gh_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Install Dependencies
run: yarn install
Expand All @@ -24,7 +24,7 @@ jobs:
run: yarn preversion

- name: Checkout GH pages
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: stellar/js-stellar-base
ref: gh-pages
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/npm_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install Depencencies
Expand All @@ -24,16 +24,6 @@ jobs:

- name: Publish npm package to both places
run: |
yarn publish --access public
sed -i -e 's#"@stellar/stellar-base"#"stellar-base"#' package.json
yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Deprecate the old package
run: |
V=$(cat package.json | jq '.version' | sed -e 's/\"//g')
echo "Deprecating stellar-base@$V"
npm deprecate stellar-base@"<= $V" "⚠️ This package has moved to @stellar/stellar-base! 🚚"
yarn publish --access public --tag protocol-23-beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
node-version: [18, 20, 22]
node-version: [20, 22]

steps:
- name: Checkout
Expand Down
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@

## Unreleased


## [`v14.0.0-rc.1`](https://github.com/stellar/js-stellar-base/compare/v13.1.0...v14.0.0-rc.1): Protocol 23

### Breaking Changes
* This package now requires **>= Node 20**.
* XDR definitions have been updated to align with Protocol 23 ([#800](https://github.com/stellar/js-stellar-base/pull/800)).

### Added
* The `sodium-native` and `tweetnacl` dependencies have been replaced with `@noble/curves` ([#802](https://github.com/stellar/js-stellar-base/pull/802)).
* Support for claimable balances and liquidity pools in `StrKey` ([#799](https://github.com/stellar/js-stellar-base/pull/799)).
* Support for claimable balances, liquidity pools, and muxed accounts in `Address` ([#801](https://github.com/stellar/js-stellar-base/pull/801)).
* 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)).

### Fixed
* 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)).
* Remove `MuxedAccount.parseBaseAddress` from TypeScript definitions ([#797](https://github.com/stellar/js-stellar-base/pull/797)).
* 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)).
* Fix browser compatibility with proper module resolution and UMD configuration ([#798](https://github.com/stellar/js-stellar-base/pull/798)).
* Remove `MuxedAccount.parseBaseAddress` from TypeScript definitions ([#797](https://github.com/stellar/js-stellar-base/pull/797)).


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

Expand Down
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/529d5176f24c73eeccfa5eba481d4e89c19b1181
XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/4b7a2ef7931ab2ca2499be68d849f38190b443ca
XDR_BASE_LOCAL_CURR=xdr/curr
XDR_FILES_CURR= \
Stellar-SCP.x \
Expand All @@ -11,10 +11,11 @@ XDR_FILES_CURR= \
Stellar-contract-env-meta.x \
Stellar-contract-meta.x \
Stellar-contract-spec.x \
Stellar-contract-config-setting.x
Stellar-contract-config-setting.x \
Stellar-exporter.x
XDR_FILES_LOCAL_CURR=$(addprefix xdr/curr/,$(XDR_FILES_CURR))

XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/8c88608d0a20b01873056a5ec13be245e1f2aa27
XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/4b7a2ef7931ab2ca2499be68d849f38190b443ca
XDR_BASE_LOCAL_NEXT=xdr/next
XDR_FILES_NEXT= \
Stellar-SCP.x \
Expand All @@ -27,7 +28,8 @@ XDR_FILES_NEXT= \
Stellar-contract-env-meta.x \
Stellar-contract-meta.x \
Stellar-contract-spec.x \
Stellar-contract-config-setting.x
Stellar-contract-config-setting.x \
Stellar-exporter.x
XDR_FILES_LOCAL_NEXT=$(addprefix xdr/next/,$(XDR_FILES_NEXT))

XDRGEN_COMMIT=master
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,22 @@ earlier versions of Node, so the tests need to run on those versions.)

#### Updating XDR definitions

XDR updates are complicated due to the fact that you need workarounds for bugs
in the generator, formatter, or a namespace adjustment.

1. Make sure you have [Docker](https://www.docker.com/) installed and running.
2. `make reset-xdr`
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.
3. Run `make reset-xdr`
4. Run `sed -ie s/\"/\'/g types/{curr,next}.d.ts` to minimize the diff (the generator's formatter uses `"` but the repo uses `'`).
5. Move `xdr.Operation` into a hidden namespace to avoid conflicts with the SDK's `Operation`.
6. Add generator workarounds:
* `type Hash = Opaque[]` is a necessary alias that doesn't get generated
* `Hyper`, `UnsignedHyper`, and `ScSpecEventV0` need their signatures
fixed because linting wants an `Array` instead of a naked `[]`.
* Some constants aren't generated correctly (e.g, Ctrl+F `SCSYMBOL_LIMIT` in `src/curr_generated.js`)
7. Finally, make code adjustments related to the XDR (these are usually revealed by running the tests).

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.

## Usage

Expand Down
2 changes: 0 additions & 2 deletions config/webpack.config.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ const config = {
new ESLintPlugin({
overrideConfigFile: path.resolve(__dirname, './.eslintrc.js')
}),
// Ignore native modules (sodium-native)
new webpack.IgnorePlugin({ resourceRegExp: /sodium-native/ }),
new NodePolyfillPlugin(),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
Expand Down
10 changes: 4 additions & 6 deletions docs/reference/base-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ title: Transaction Examples

## Creating an account

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


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


```js
var rootKeypair = StellarSdk.Keypair.fromSecret("SBQWY3DNPFWGSZTFNV4WQZLBOJ2GQYLTMJSWK3TTMVQXEY3INFXGO52X")
var rootKeypair = StellarSdk.Keypair.fromSecret("SBQW...")
var account = new StellarSdk.Account(rootkeypair.publicKey(), "46316927324160");

var secondaryAddress = "GC6HHHS7SH7KNUAOBKVGT2QZIQLRB5UA7QAGLA3IROWPH4TN65UKNJPK";
Expand Down Expand Up @@ -166,11 +166,9 @@ var transaction = new StellarSdk.TransactionBuilder(account, {
.setTimeout(30)
.build();

var secondKeypair = StellarSdk.Keypair.fromSecret("SAMZUAAPLRUH62HH3XE7NVD6ZSMTWPWGM6DS4X47HLVRHEBKP4U2H5E7");
var secondKeypair = StellarSdk.Keypair.fromSecret("SAMZ...");

// now we need to sign the transaction with both the root and the secondaryAddress
transaction.sign(rootKeypair);
transaction.sign(secondKeypair);
```


6 changes: 2 additions & 4 deletions docs/reference/building-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ var keypair = Keypair.random();


```js
var key1 = Keypair.fromSecret('SBK2VIYYSVG76E7VC3QHYARNFLY2EAQXDHRC7BMXBBGIFG74ARPRMNQM');
var key2 = Keypair.fromSecret('SAMZUAAPLRUH62HH3XE7NVD6ZSMTWPWGM6DS4X47HLVRHEBKP4U2H5E7');
var key1 = Keypair.fromSecret('SBK2...');
var key2 = Keypair.fromSecret('SAMZ...');

// Create an Account object from an address and sequence number.
var account=new StellarBase.Account("GD6WU64OEP5C4LRBH6NK3MHYIA2ADN6K6II6EXPNVUR3ERBXT4AN4ACD","2319149195853854");
Expand All @@ -165,5 +165,3 @@ transaction.sign(key1);
transaction.sign(key2);
// submit tx to Horizon...
```


32 changes: 14 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "@stellar/stellar-base",
"version": "13.1.0",
"version": "14.0.0-rc.1",
"description": "Low-level support library for the Stellar network.",
"main": "./lib/index.js",
"browser": {
"./lib/index.js": "./dist/stellar-base.min.js",
"sodium-native": false
"./lib/index.js": "./dist/stellar-base.min.js"
},
"types": "./types/index.d.ts",
"scripts": {
Expand All @@ -27,7 +26,7 @@
"_nyc": "nyc --nycrc-path ./config/.nycrc"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"mocha": {
"require": [
Expand Down Expand Up @@ -73,12 +72,12 @@
},
"homepage": "https://github.com/stellar/js-stellar-base",
"devDependencies": {
"@babel/cli": "^7.27.0",
"@babel/core": "^7.26.10",
"@babel/eslint-parser": "^7.27.0",
"@babel/eslint-plugin": "^7.27.0",
"@babel/preset-env": "^7.26.9",
"@babel/register": "^7.25.9",
"@babel/cli": "^7.27.2",
"@babel/core": "^7.27.4",
"@babel/eslint-parser": "^7.27.5",
"@babel/eslint-plugin": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/register": "^7.27.1",
"@definitelytyped/dtslint": "^0.0.182",
"@istanbuljs/nyc-config-babel": "3.0.0",
"@types/node": "^20.14.11",
Expand All @@ -94,7 +93,7 @@
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-import": "^0.0.1",
"eslint-plugin-prettier": "^5.2.5",
"eslint-plugin-prettier": "^5.5.0",
"eslint-webpack-plugin": "^4.2.0",
"ghooks": "^2.0.4",
"husky": "^8.0.3",
Expand All @@ -119,18 +118,15 @@
"terser-webpack-plugin": "^5.3.14",
"ts-node": "^10.9.2",
"typescript": "5.6.3",
"webpack": "^5.98.0",
"webpack": "^5.99.9",
"webpack-cli": "^5.1.1"
},
"dependencies": {
"@noble/curves": "^1.9.2",
"@stellar/js-xdr": "^3.1.2",
"base32.js": "^0.1.0",
"bignumber.js": "^9.1.2",
"bignumber.js": "^9.3.0",
"buffer": "^6.0.3",
"sha.js": "^2.3.6",
"tweetnacl": "^1.0.3"
},
"optionalDependencies": {
"sodium-native": "^4.3.3"
"sha.js": "^2.3.6"
}
}
Loading