Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major Version 1.0.0 #115

Merged
merged 215 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
215 commits
Select commit Hold shift + click to select a range
2b8352c
adjust getKeys
callebtc Nov 29, 2023
a5affdc
mint works
callebtc Nov 29, 2023
f790539
add some tests
callebtc Nov 29, 2023
35a7455
try docker-compose
callebtc Nov 29, 2023
d071952
remove node version
callebtc Nov 29, 2023
00f1c0d
try again
callebtc Nov 29, 2023
aaf7842
remove newkeys
callebtc Nov 29, 2023
6d04486
slowly fixing tests
callebtc Nov 29, 2023
7630d74
generate only hex secrets
callebtc Nov 29, 2023
a94e42c
mostly working but something is wrong with crypto
callebtc Nov 29, 2023
83b1693
load keys before receive
callebtc Nov 29, 2023
a84cc18
generate 64 character hex string
callebtc Nov 29, 2023
100ae41
renamed requestTokens->mintTokens and payLnInvoice->meltTokens
callebtc Nov 29, 2023
f3a998a
remove unused imports
callebtc Nov 29, 2023
0f46b99
check docker
callebtc Nov 29, 2023
dc507b6
start mint?
callebtc Nov 29, 2023
6b7887b
fix
callebtc Nov 29, 2023
a109881
fix
callebtc Nov 29, 2023
5945e3e
add curl
callebtc Nov 29, 2023
042c8d0
trigger CI
callebtc Nov 29, 2023
8215328
trigger CI
callebtc Nov 29, 2023
6e6fdf0
trigger CI
callebtc Nov 29, 2023
d0b28d4
gotta try it
callebtc Nov 29, 2023
a891cc5
gotta try it
callebtc Nov 29, 2023
a5615d6
trigger CI
callebtc Nov 29, 2023
077697d
trigger CI
callebtc Nov 29, 2023
11b32d5
trigger CI
callebtc Nov 29, 2023
36b326c
trigger CI
callebtc Nov 29, 2023
0e2c951
trigger CI
callebtc Nov 29, 2023
0d16b3f
trigger CI
callebtc Nov 29, 2023
fbb8395
trigger CI
callebtc Nov 29, 2023
0093db0
trigger CI
callebtc Nov 29, 2023
5f34392
trigger CI
callebtc Nov 29, 2023
fc38b0f
trigger CI
callebtc Nov 29, 2023
3508bbf
trigger CI
callebtc Nov 29, 2023
90c7a31
trigger CI
callebtc Nov 29, 2023
f1685ed
trigger CI
callebtc Nov 29, 2023
22242bc
trigger CI
callebtc Nov 29, 2023
84d6cfa
try macos
callebtc Nov 29, 2023
3f2e8a0
try macos
callebtc Nov 29, 2023
66be50b
disable docker pipeline
callebtc Nov 29, 2023
848a0f5
tests on push
callebtc Nov 30, 2023
5ccf8ba
fix h2c
gandlafbtc Feb 16, 2024
e4b6691
add hashes dep and upgrade other deps
gandlafbtc Feb 19, 2024
b275740
format
gandlafbtc Feb 19, 2024
cb1bfa2
switch to hex secrets
gandlafbtc Feb 19, 2024
0ae8726
fix variables as per review
gandlafbtc Feb 20, 2024
f7ffde4
Merge pull request #102 from cashubtc/fix-h2c
gandlafbtc Feb 20, 2024
87934b1
Merge pull request #104 from cashubtc/add-noble-hashes
gandlafbtc Feb 20, 2024
f8c9fe5
pipeline for npm release
gandlafbtc Feb 20, 2024
c8385d8
Merge pull request #107 from cashubtc/cd-pipeline
gandlafbtc Feb 20, 2024
8501953
Merge branch 'development' into remove-b64-secrets
gandlafbtc Feb 20, 2024
d95438c
Merge pull request #105 from cashubtc/remove-b64-secrets
gandlafbtc Feb 20, 2024
b76e01e
update test vector
gandlafbtc Feb 21, 2024
2fce7d7
Merge branch 'main' into v1_api
callebtc Feb 23, 2024
a1f3e31
add output dirs to prettierignore
gandlafbtc Feb 24, 2024
e13a9ab
add provenance to workflow
gandlafbtc Feb 24, 2024
6008309
fix version workflow
gandlafbtc Feb 24, 2024
e53a248
Merge branch 'staging' into v1_api
callebtc Feb 24, 2024
91a66cb
merge staging
callebtc Feb 24, 2024
f9f56e2
Merge branch 'development' into v1_api
callebtc Feb 24, 2024
43fea05
reenable integration test
callebtc Feb 24, 2024
77702da
Node JS CI for all pushes
callebtc Feb 24, 2024
0a7a546
try integration test without docker compose
callebtc Feb 24, 2024
a39c058
try system docker
callebtc Feb 24, 2024
fa6b149
add sleep
callebtc Feb 24, 2024
40b5f81
CI
callebtc Feb 24, 2024
2f4d58c
fix all API changes
callebtc Feb 24, 2024
f57757f
format
gandlafbtc Feb 27, 2024
6bee3b3
fix custom requests
gandlafbtc Feb 27, 2024
60ddb73
add keyset test and type
gandlafbtc Feb 27, 2024
77c8b5f
change param to keysetId for consistencey
gandlafbtc Feb 27, 2024
598ec08
Token state check with Y, https://github.com/cashubtc/nuts/pull/93
callebtc Mar 7, 2024
a2c3954
rename integration test
callebtc Mar 7, 2024
31c1af3
Merge branch 'v1_api' of https://github.com/cashubtc/cashu-ts into v1…
callebtc Mar 7, 2024
f46001b
fix Y response
callebtc Mar 7, 2024
086f896
use nutshell 0.15.1
callebtc Mar 17, 2024
c8054c3
Added unit field to CashuWallet
starbackr-dev Mar 20, 2024
6a2544b
fixes for keyset
gandlafbtc Mar 21, 2024
b2fe1d2
remove some unused imports
gandlafbtc Mar 21, 2024
8d92c51
fix info response type
gandlafbtc Mar 23, 2024
322a7f0
add doc to new type
gandlafbtc Mar 23, 2024
152ade8
format
gandlafbtc Mar 23, 2024
ef13d93
Merge pull request #110 from cashubtc/v1_api
gandlafbtc Mar 25, 2024
c69d358
get keys from mint if getKeys is called with different keyset id
gandlafbtc Mar 25, 2024
9334ab4
Merge pull request #108 from cashubtc/development
gandlafbtc Mar 25, 2024
559365f
update readme
gandlafbtc Mar 25, 2024
499c449
remove decode lnInvoice lib
gandlafbtc Mar 25, 2024
d11117d
migration guide
gandlafbtc Mar 25, 2024
7e311ed
1.0.0-rc.0
gandlafbtc Mar 25, 2024
05175ad
1.0.0-rc.1
gandlafbtc Mar 25, 2024
1b9a10f
fix unused restore payload
gandlafbtc Mar 27, 2024
aa03235
update mint image in int test pipeline
gandlafbtc Mar 27, 2024
c8f711c
fix pay external invoice integration test
gandlafbtc Mar 27, 2024
9d24112
Merge branch 'v1_api' into v1_api
starbackr-dev Mar 27, 2024
03464ec
remove duplicate test ci runs, remove deprecated node version run
gandlafbtc Mar 27, 2024
3cb236d
only run tests once
gandlafbtc Mar 27, 2024
b07e864
fix keyset derivation
gandlafbtc Mar 28, 2024
c36dd01
fixed issue with merge
starbackr-dev Mar 28, 2024
4531830
format
gandlafbtc Mar 30, 2024
e9a679e
pay to pubkey
gandlafbtc Mar 29, 2024
428b776
update deps
gandlafbtc Mar 30, 2024
31248c9
format
gandlafbtc Mar 30, 2024
871d977
edit migrations guide
gandlafbtc Mar 30, 2024
18a1e17
add p2pk integration test
gandlafbtc Mar 31, 2024
4b0056d
format
gandlafbtc Apr 3, 2024
3847d24
Merge pull request #117 from cashubtc/pay-to-pubkey
gandlafbtc Apr 3, 2024
e7aafe1
1.0.0-rc.2
gandlafbtc Apr 3, 2024
fb2d112
move use lib from @cashu namespace
gandlafbtc Apr 3, 2024
220bd72
update lockfile
gandlafbtc Apr 3, 2024
b810839
fix param typo
gandlafbtc Apr 3, 2024
5eed1a1
Update migration-1.0.0.md
gandlafbtc Apr 4, 2024
149d52c
1.0.0-rc.2
gandlafbtc Apr 3, 2024
e3de7f0
Merge tag 'v1.0.0-rc.2' into staging
gandlafbtc Apr 6, 2024
2b334ea
clarify comment
callebtc Apr 5, 2024
f479247
Merge pull request #118 from cashubtc/getKeys-comment-fix
gandlafbtc Apr 6, 2024
44dced3
Merge remote-tracking branch 'upstream/development' into v1_api
starbackr-dev Apr 6, 2024
856d40b
Merge branch 'staging' into v1_api
starbackr-dev Apr 6, 2024
f52f541
Merge branch 'v1_api' of https://github.com/starbackr-dev/cashu-ts in…
starbackr-dev Apr 6, 2024
fa903c9
updated test scripts to fix fail
starbackr-dev Apr 6, 2024
3012d26
fixed wallet.test that got changed when merging.
starbackr-dev Apr 6, 2024
da910e1
changed the unit field default to 'sat' instead of 'sats'
starbackr-dev Apr 6, 2024
b816dd3
Update node.js.yml - missing 'run'
starbackr-dev Apr 6, 2024
c6588ba
Update node.js.yml - match to main branch
starbackr-dev Apr 6, 2024
a8b069d
Update node.js.yml - switching node.js to 18.x
starbackr-dev Apr 6, 2024
04ae129
Merge pull request #113 from starbackr-dev/v1_api
gandlafbtc Apr 9, 2024
cc3f59d
equalize mint and melt payload and request object names
callebtc Apr 5, 2024
641e27e
npm run format
callebtc Apr 5, 2024
2b1a99f
fix replace with capitalized objects
callebtc Apr 5, 2024
33bac22
import and typo fixes
gandlafbtc Apr 6, 2024
c4ecba4
format
gandlafbtc Apr 9, 2024
8ac0251
Merge pull request #119 from cashubtc/fix-object-names-equalize
gandlafbtc Apr 9, 2024
3c1ff1c
constructor options and set unit from keyset
gandlafbtc Apr 9, 2024
227444d
update migration guide
gandlafbtc Apr 9, 2024
565badd
unit getter
gandlafbtc Apr 9, 2024
4064fb6
Merge pull request #120 from cashubtc/get-unit-method
gandlafbtc Apr 9, 2024
3d708fd
1.0.0-rc.3
gandlafbtc Apr 9, 2024
e462896
add set unit to set keys
gandlafbtc Apr 9, 2024
eeb5708
Update CashuWallet.ts
Kelbie Apr 9, 2024
78099d0
Update CashuWallet.ts
Kelbie Apr 9, 2024
a2c2332
add unit to Token
callebtc Apr 17, 2024
8ecf32b
Merge pull request #122 from cashubtc/token-add-unit
gandlafbtc Apr 18, 2024
935272c
pass keysetId to `CashuWallet.send` + getKeys bug
gudnuf Apr 19, 2024
90d692b
`meltQuote` optional in `CashuWallet.payLnInvoice`
gudnuf Apr 19, 2024
7af1724
fix: handle trailing slash for mint url in CashuMint class
Dayvvo Apr 25, 2024
d5dd172
rename amountPreference to preference
callebtc May 2, 2024
0d59735
1.0.0-rc.4
gandlafbtc May 18, 2024
39cbb8f
Merge pull request #121 from Kelbie/Allow-specifying-the-keyset-in-se…
gandlafbtc May 20, 2024
b60254e
format
gandlafbtc May 20, 2024
8653951
Merge pull request #123 from gudnuf/bug/send_keysetId
gandlafbtc May 20, 2024
0fd4266
format and sanitize url in constructor
gandlafbtc May 20, 2024
ebd4c18
Merge pull request #125 from Dayvvo/trailing-slash-handle-fix
gandlafbtc May 20, 2024
c127cf7
Merge branch 'staging' into development
gandlafbtc May 20, 2024
d8ba195
Merge pull request #133 from cashubtc/development
gandlafbtc May 20, 2024
bdeb88c
Merge pull request #128 from cashubtc/fix-amount-preference
gandlafbtc May 20, 2024
eadbaf2
type and remove duplicate variable
gandlafbtc May 20, 2024
3d8343e
add type ref for complex proofs
gandlafbtc May 20, 2024
078341f
Remove DHKE module and test file
capitalist42 May 20, 2024
c5dae61
remove crypto scheme test
capitalist42 May 20, 2024
bf976a0
remove console.log from test
capitalist42 May 20, 2024
39ded46
import and use @cash/crypto library; remove dhke import; add private …
capitalist42 May 20, 2024
00c2b08
import functions from "@cashu/crypto"; remove secrets module and test;
capitalist42 May 20, 2024
4535e0f
fix no match request mock
capitalist42 May 20, 2024
3e20f45
Merge pull request #134 from capitalist42/use-cashu-crypto-library
gandlafbtc May 21, 2024
cbbf29d
Mint api to get existing quotes + rename split to swap
callebtc May 12, 2024
fd6a03d
split to swap
callebtc May 12, 2024
5bac6a2
test get methods for quotes and rename all test functions from getMel…
callebtc May 12, 2024
492cc20
fix tests
gandlafbtc Jun 5, 2024
b37120c
fix integration tests
gandlafbtc Jun 6, 2024
d6b108e
add workflows for staging
gandlafbtc Jun 6, 2024
bc9fdc5
Merge pull request #131 from cashubtc/get-quotes
gandlafbtc Jun 6, 2024
7a57ba9
fix version
gandlafbtc Jun 6, 2024
3de7f1b
1.0.0-rc.6
gandlafbtc Jun 6, 2024
6c4c189
remove multimint receive
gandlafbtc Jun 6, 2024
acb91f4
remove unused stuff
gandlafbtc Jun 6, 2024
29de140
format
gandlafbtc Jun 6, 2024
31991a6
remove more unneded stuff
gandlafbtc Jun 6, 2024
2694086
Merge pull request #136 from cashubtc/remove-multi-mint
gandlafbtc Jun 8, 2024
a5475a8
migration
gandlafbtc Jun 8, 2024
4c78513
1.0.0-rc.7
gandlafbtc Jun 8, 2024
dbd3c0c
fix import
gandlafbtc Jun 24, 2024
1602181
1.0.0-rc.8
gandlafbtc Jun 24, 2024
c251e26
fix borked base64 url-save
gandlafbtc Jul 4, 2024
243a4a7
1.0.0-rc.9
gandlafbtc Jul 4, 2024
53f015a
NUT-06: new info endpoint with monkeypatch for old format, see https:…
callebtc Jul 15, 2024
042bf2b
npm run format
callebtc Jul 16, 2024
ff1f316
contact field explicit type
callebtc Jul 16, 2024
00d3bc6
add state enum changes of NUT-04 and NUT-05
callebtc Jul 16, 2024
a247b7f
console log instead of warnings
callebtc Jul 16, 2024
ef8111f
fix errors in test
callebtc Jul 16, 2024
15411d1
Merge pull request #148 from cashubtc/nut-05-add-state
callebtc Jul 16, 2024
de011a1
Merge branch 'nut-05-add-state' into nut-06-fix-contact
callebtc Jul 16, 2024
18855eb
refactor depercated contact handler
callebtc Jul 16, 2024
a752c0d
typo
callebtc Jul 16, 2024
f90eead
erge branch 'development' into nut-06-fix-contact
callebtc Jul 16, 2024
70e93f4
npm run format
callebtc Jul 16, 2024
559080d
Format checker in gihtub pipeline
callebtc Jul 16, 2024
0952172
test format mismatch, should fail
callebtc Jul 16, 2024
097f7ec
install dep[s
callebtc Jul 16, 2024
f34276c
fix format, should succeed
callebtc Jul 16, 2024
5b0f667
Merge pull request #149 from cashubtc/ci-add-prettier-check
callebtc Jul 16, 2024
6c6cf0d
Merge pull request #147 from cashubtc/nut-06-fix-contact
callebtc Jul 16, 2024
53c1af3
updated naming on mint / melt
Egge21M Jul 5, 2024
c5b509a
updated tests / all green
Egge21M Jul 5, 2024
13c115f
updated migration doc
Egge21M Jul 15, 2024
4ce0716
mint and wallet same naming
Egge21M Jul 16, 2024
4909e39
1.0.0-rc.10
Egge21M Jul 16, 2024
142d671
remove unused import
callebtc Jul 16, 2024
55dc4fa
Merge pull request #145 from Egge21M/naming
callebtc Jul 16, 2024
16954c7
Merge branch 'main' into development
callebtc Jul 16, 2024
b99ad29
Merge pull request #150 from cashubtc/dev-sync-main-readme
callebtc Jul 16, 2024
3bd7cea
Merge branch 'development' into staging
Egge21M Jul 16, 2024
ce81a59
1.0.0-rc.11
Egge21M Jul 16, 2024
4e3869b
audit fix deps
gandlafbtc Jul 17, 2024
7c95ca4
1.0.0-rc.12
gandlafbtc Jul 17, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
push:
branches:
- main
- staging

jobs:
build:
Expand All @@ -29,5 +30,5 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: coverage
destination_dir: coverage/${{ github.head_ref || github.ref_name }}
publish_dir: ./coverage/lcov-report
24 changes: 24 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Format Check

on: [push]

jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Check format
run: npm run check-format
10 changes: 3 additions & 7 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@

name: Node.js CI

on:
pull_request:
types:
- ready_for_review
- opened
on: [push]

jobs:
build:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x, 16.x, 18.x]
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/nutshell-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Nutshell integration

on: [push, pull_request]

jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- name: Pull and start mint
run: |
docker run -d -p 3338:3338 --name nutshell -e MINT_LIGHTNING_BACKEND=FakeWallet -e MINT_LISTEN_HOST=0.0.0.0 -e MINT_LISTEN_PORT=3338 -e MINT_PRIVATE_KEY=TEST_PRIVATE_KEY cashubtc/nutshell:0.15.2 poetry run mint

- name: Check running containers
run: docker ps

# - name: Sleep 5 seconds and curl on localhost:3338/v1/info
# run: |
# sleep 5
# curl localhost:3338/v1/info

- name: Checkout cashu-ts repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
cache: 'npm'

- run: npm ci
- run: npm run compile
- run: npm run test-integration
3 changes: 2 additions & 1 deletion .github/workflows/typedoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- staging

jobs:
build:
Expand All @@ -28,5 +29,5 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: docs
destination_dir: docs/${{ github.head_ref || github.ref_name }}
publish_dir: ./docs
21 changes: 21 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Publish Package to npmjs
permissions:
contents: read
id-token: write
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- run: npm i
- run: npm run compile
- run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist
node_modules
package-lock.json
package-lock.json
coverage
docs
36 changes: 13 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Implemented [NUTs](https://github.com/cashubtc/nuts/):
- [x] [NUT-07](https://github.com/cashubtc/nuts/blob/main/07.md)
- [x] [NUT-08](https://github.com/cashubtc/nuts/blob/main/08.md)
- [x] [NUT-09](https://github.com/cashubtc/nuts/blob/main/09.md)
- [x] [NUT-11](https://github.com/cashubtc/nuts/blob/main/11.md)

Supported token formats:

Expand All @@ -44,42 +45,31 @@ Supported token formats:

## Usage

Go to the [docs](https://cashubtc.github.io/cashu-ts/docs) for detailed usage.
Go to the [docs](https://cashubtc.github.io/cashu-ts/docs) for detailed usage, or have a look at the [integration tests](./test/integration.test.ts) for examples on how to implement a wallet.

### Install

```shell
npm i @cashu/cashu-ts
```

### Import
### Example

```typescript
import { CashuMint, CashuWallet, getEncodedToken } from '@cashu/cashu-ts';

const wallet = new CashuWallet(new CashuMint('{MINT_URL}'));

const { pr, hash } = await wallet.requestMint(200);

//pay this LN invoice
console.log({ pr }, { hash });

async function invoiceHasBeenPaid() {
const { proofs } = await wallet.requestTokens(200, hash);
//Encoded proofs can be spent at the mint
const encoded = getEncodedToken({
token: [{ mint: '{MINT_URL}', proofs }]
});
console.log(encoded);
}
const mint = new CashuMint(mintUrl);
const wallet = new CashuWallet(mint);
const mintQuote = await wallet.mintQuote(64);
const tokens = await wallet.mintTokens(64, mintQuote.quote);
```

## Contribute

Contributions are very welcome.

If you want to contribute, please open an Issue or a PR.
If you open a PR, please do so from the `development` branch as the base branch.
If you want to contribute, please open an Issue or a PR.
If you open a PR, please do so from the `development` branch as the base branch.

### Version

Expand All @@ -90,17 +80,17 @@ If you open a PR, please do so from the `development` branch as the base branch.
| | * `hotfix`
| |
| * `staging`
| |\
| |\
| |\ \
| | | * `bugfix`
| | |
| | * `development`
| | |\
| | * `development`
| | |\
| | | * `feature1`
| | | |
| | |/
| | *
| | |\
| | |\
| | | * `feature2`
| | |/
| |/
Expand Down
114 changes: 114 additions & 0 deletions migration-1.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Version 1.0.0 Migration guide

⚠️ Upgrading to version 1.0.0 will come with breaking changes! Please follow the migration guide for a smooth transition to the new version.

## Context

In Version 1.0.0 the api version of mints has been upgraded to `v1`. Please read the `v1` [v1 cleanup PR](https://github.com/cashubtc/nuts/pull/55) to understand more about how the API has changed.

## Breaking changes

### ⚠️ Important! When upgrading to this version, the `hash2curve` function and the `default secret format` have changed. This means deterministic secret derivation will produce NOT THE SAME SECRETS as before. When upgrading to this version, wallets that have been using deterministic secrets (seed phrase) must reset counters and then `self spend`/`refresh` all proofs, so that the backups continue working.

---

### Decoding LN invoices

**Removed LN invoice decode:**
Decoding LN invoices is no longer used inside the lib.

**How to fix:** If you need to decode LN invoices, you can use

> npm i [@gandlaf21/bolt11-decode](https://www.npmjs.com/package/@gandlaf21/bolt11-decode)

---

### `CashuWallet` interface changes

**`receive()` does no longer support multi-token tokens**

To reduce complexity, simplify error handling and to prepare for token V4, this feature has been removed. only the first token inside a token will be processed

**optional function AND constructor parameters are now in an onpional `options?` Object**

Utility functions now have an `options` object for optional parameters, instead of passing them directly

**`requestMint(amount: number)` --> `createMintQuote(amount: number)`**
Now returns the following:

```typescript
type MintQuoteResponse = {
request: string;
quote: string;
paid: boolean;
expiry: number;
};
```

where `request` is the invoice to be paid, and `quote` is the identifier used to pass to `mintTokens()`.

**`requestTokens()` --> `mintTokens()`**

---

**`createMeltQuote(invoice: string)`** is now used to get fee estimation and conversion quotes instead of `getFee()` and returns:

```typescript
type MeltQuoteResponse = {
quote: string;
amount: number;
fee_reserve: number;
paid: boolean;
expiry: number;
};
```

where `quote` is the identifier to pass to `meltTokens()`

---

### Model changes

**`MintKeys`--> `Keys`**:
`MintKeys` now include the `keys`, `id` and `unit`

```typescript
type MintKeys = {
id: string;
unit: string;
keys: Keys;
};

type Keys = { [amount: number]: string };
```

---

**`MintKeyset`**:
Used to be a string array, but now contains the additional fields `active` and `unit`

```typescript
type MintKeyset = {
id: string;
unit: string;
active: boolean;
};
```

---

**`BlindedMessages`:** now include the field `id`, corresponding with the mints `keysetId`

```typescript
type BlindedMessage {
amount: number;
B_: ProjPointType<bigint>;
id: string;
}
```

---

### Pattern changes

**removed `newKeys` from returns**: Functions no longer return `newKeys`. Wallets now specify the keyset they use in the BlindedMessage via the `id` field.
Loading
Loading