Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
68a95ab
add settlement IDL
kaze-cow Jul 28, 2026
55f0562
generate js client with codama and add a basic test to make sure it w…
kaze-cow Jul 16, 2026
7e63017
add validation of the idl
kaze-cow Jul 29, 2026
b6f6b97
Merge branch 'main' into idl
kaze-cow Jul 29, 2026
adf17c5
fix lint
kaze-cow Jul 29, 2026
aab1aba
Merge branch 'idl' of github.com:cowprotocol/solana-programs into idl
kaze-cow Jul 29, 2026
f398816
Merge branch 'main' into idl
kaze-cow Jul 31, 2026
d976a07
Merge branch 'main' into idl
kaze-cow Jul 31, 2026
44e827e
Merge branch 'main' into idl
kaze-cow Aug 5, 2026
6c63eae
Merge remote-tracking branch 'origin/main' into idl
kaze-cow Aug 12, 2026
eb45059
sync idl and add a couple more tests to cover everything
kaze-cow Aug 12, 2026
6c02f9b
Merge branch 'idl' into kaze/sc-255-write-idl-and-generate-correspond…
kaze-cow Aug 12, 2026
6c7149a
fix createorder test fialures
kaze-cow Aug 12, 2026
541bcee
Update programs/settlement/tests/idl.rs
kaze-cow Aug 20, 2026
4d04660
Update programs/settlement/tests/idl.rs
kaze-cow Aug 20, 2026
bae4326
various fixes from feedback
kaze-cow Aug 20, 2026
4b8e58a
Merge branch 'idl' of github.com:cowprotocol/solana-programs into idl
kaze-cow Aug 20, 2026
b5b0090
refactor idl tests into a folder with relevant code isolated
kaze-cow Aug 20, 2026
3190d0e
switch to an enum to make it more clear what a type is in the idl
kaze-cow Aug 20, 2026
7a78d05
Merge remote-tracking branch 'origin/main' into idl
kaze-cow Aug 20, 2026
7005093
update to the latest on the idl side
kaze-cow Aug 20, 2026
ba596f8
add test verifying the idl version matches cargo pkg
kaze-cow Aug 20, 2026
f4cf043
improve confirm_idl_match params naming
kaze-cow Aug 20, 2026
1f13365
Merge branch 'main' into idl
kaze-cow Aug 24, 2026
af8cfd3
add more idl checks, when it was easy enough
kaze-cow Aug 24, 2026
f733e64
Merge branch 'idl' of github.com:cowprotocol/solana-programs into idl
kaze-cow Aug 24, 2026
0ae07e2
rethink how the testing structure works
kaze-cow Aug 24, 2026
b924e85
remove unnecessary comments and add test to confirm link stripping
kaze-cow Aug 31, 2026
0e15786
Update programs/settlement/idl/cow_settlement.json
kaze-cow Aug 31, 2026
dfaba66
Update programs/settlement/idl/cow_settlement.json
kaze-cow Aug 31, 2026
fa8c4d2
add a test for targetless links
kaze-cow Aug 31, 2026
f746b8f
Merge branch 'idl' of github.com:cowprotocol/solana-programs into idl
kaze-cow Aug 31, 2026
f4f065e
remove unnecessary comment from IDL
kaze-cow Aug 31, 2026
7012d1f
Merge remote-tracking branch 'origin/main' into idl
kaze-cow Aug 31, 2026
4ba1d33
explain variants better
kaze-cow Aug 31, 2026
c1e993b
fix: merge conflicts
limitofzero Aug 31, 2026
3cb4b50
Merge branch 'idl' into kaze/sc-255-write-idl-and-generate-correspond…
kaze-cow Sep 1, 2026
efe5ef1
Merge remote-tracking branch 'origin/main' into kaze/sc-255-write-idl…
kaze-cow Sep 1, 2026
ef978a8
test(idl-client): build order intents from the current OrderIntent shape
kaze-cow Sep 1, 2026
3acbf98
refactor(idl): ship the IDL with the generated client
kaze-cow Sep 1, 2026
49a649e
ci(idl-client): run the JS client tests in CI
kaze-cow Sep 1, 2026
9736f86
simplifies and final manual review
kaze-cow Sep 1, 2026
f9f996b
fixes from pre-review
kaze-cow Sep 1, 2026
1208a2a
clean up lock file
kaze-cow Sep 2, 2026
85b4c2f
Update Justfile
kaze-cow Sep 2, 2026
be88336
misc fixes from review
kaze-cow Sep 2, 2026
fedde4e
Merge branch 'kaze/sc-255-write-idl-and-generate-corresponding-librar…
kaze-cow Sep 2, 2026
5434c20
update package manager and solana kit version
kaze-cow Sep 2, 2026
5855be9
final cleanups by removing unnecessary lines
kaze-cow Sep 2, 2026
5ca9842
Update programs/settlement/idl/package.json
kaze-cow Sep 2, 2026
c9d9cb6
add order pda test
kaze-cow Sep 2, 2026
1d5e00f
Merge branch 'kaze/sc-255-write-idl-and-generate-corresponding-librar…
kaze-cow Sep 2, 2026
2f2b719
Update .github/workflows/ci.yml
kaze-cow Sep 4, 2026
55d9ccc
fix simplification that should have been possible
kaze-cow Sep 4, 2026
9c835f8
cool trick for checking all the fields
kaze-cow Sep 4, 2026
10e46cc
fix peer dependency
kaze-cow Sep 4, 2026
a4f5346
Merge branch 'main' into kaze/sc-255-write-idl-and-generate-correspon…
kaze-cow Sep 4, 2026
7897962
add prettier formatting
kaze-cow Sep 7, 2026
59323fd
Merge branch 'kaze/sc-255-write-idl-and-generate-corresponding-librar…
kaze-cow Sep 7, 2026
80c5e07
lock only to major versions to improve compatibility
kaze-cow Sep 7, 2026
9aa35ba
re-add flags decoder check of reserved bits
kaze-cow Sep 7, 2026
df15909
fix compile time errors not resolving
kaze-cow Sep 7, 2026
4859601
Update programs/settlement/idl/client/js/package.json
kaze-cow Sep 7, 2026
fa77bee
apply working directory trick to the fmt jobs too
kaze-cow Sep 7, 2026
be3b072
Merge branch 'kaze/sc-255-write-idl-and-generate-corresponding-librar…
kaze-cow Sep 7, 2026
7d4812c
simplify package spec
kaze-cow Sep 7, 2026
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
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,29 @@ jobs:
exit 1
}

test-js-client:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false

# litesvm loads the built .so, so this job needs the Solana toolchain too.
- uses: ./.github/actions/setup-solana
- uses: ./.github/actions/setup-just
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1

- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"

- name: Test JS client
# Corepack otherwise asks for confirmation before fetching pnpm, which
# would hang the job.
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"
run: just test-js-client

fmt-check:
runs-on: ubuntu-latest
steps:
Expand All @@ -75,9 +98,18 @@ jobs:

- uses: ./.github/actions/setup-just

- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "24"

- name: Format check
run: just fmt-check

- name: Format check JS client
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"
run: just fmt-check-js-client

lint:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/target
proptest-regressions/
.cargo-root/
node_modules/
generated/

# Make sure no Solana key is uploaded by accident.
*.json
!bench-report.json
!programs/settlement/idl/**
!programs/settlement/idl/**/*.json
33 changes: 32 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,31 @@ build-test-programs:
build: build-program
cargo build

# Runs all the generated code jobs
generate: generate-js-client

# Builds the JS/TS client from IDL.
[working-directory: 'programs/settlement/idl']
Comment thread
kaze-cow marked this conversation as resolved.
@generate-js-client:
corepack pnpm install --frozen-lockfile
node generate.mjs

# Run the test suite (builds the program first so the .so exists).
test: build-program build-test-programs
cargo test

# Run tests from the generated clients from the IDL
test-idl-generated: test-js-client

# Run the JS client's tests
[working-directory: 'programs/settlement/idl/client/js']
@test-js-client: build-program generate-js-client
corepack pnpm install --frozen-lockfile
corepack pnpm exec vitest run

# Needed because some tests rely on typescript generating errors if a type changes
corepack pnpm run typecheck

# Each test outputs its consumption during test execution to a series of target/bench-report/*.jsonl files.
# Assembles into a single `bench-report.json`
bench: build-program build-test-programs
Expand Down Expand Up @@ -49,6 +70,16 @@ fmt:
fmt-check:
cargo fmt -- --check

# Format the JS client with prettier.
[working-directory: 'programs/settlement/idl/client/js']
fmt-js-client:
corepack pnpm install --frozen-lockfile && corepack pnpm exec prettier --write .

# Check that the JS client is formatted.
[working-directory: 'programs/settlement/idl/client/js']
fmt-check-js-client:
corepack pnpm install --frozen-lockfile && corepack pnpm exec prettier --check .

Comment thread
kaze-cow marked this conversation as resolved.
# Lint the source code with clippy.
lint:
cargo clippy --workspace --all-targets --all-features -- --deny=warnings
Expand Down Expand Up @@ -85,4 +116,4 @@ deploy programid keypair: build-verified
initialize \
|| echo "warning: \`initialize\` failed, the state PDA may already exist" >&2

all: build bench lint fmt-check doc-dev
all: build bench test-js-client lint fmt-check fmt-check-js-client doc-dev
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ It contains a high-level technical description of what the program does and poin

Install the Solana toolchain (Rust, Solana CLI, and friends) by following the [Solana quick setup](https://solana.com/docs/intro/installation).

A Node.JS runtime is also necessary for generating client libraries from the IDL.

Common dev tasks are exposed via [`just`](https://just.systems/) recipes (see `Justfile`).
Most package managers provide this package, see [list of available Just packages](https://just.systems/man/en/packages.html).
Run `just --list` to see what's available.
Expand All @@ -26,6 +28,8 @@ The repository is a Cargo workspace following the program / client / interface s

- [`interface/`](./interface): shared types and the `Instruction` builders. Depends only on the lightweight crates so it can be consumed from both on-chain and off-chain code.
- [`programs/settlement/`](./programs/settlement): the on-chain settlement program.
- [`programs/settlement/idl/`](./programs/settlement/idl): the IDL of the settlement program and its generated associated client libraries.
- [`programs/settlement/idl/client/js/`](./programs/settlement/idl/client/js/): A Typescript client generated from the IDL
- [`client/`](./client): off-chain client helpers that re-export the builders from `interface` and add small convenience wrappers.


Expand All @@ -37,18 +41,30 @@ Build the on-chain program (produces `target/deploy/settlement.so`):
just build-program
```

Build everything (workspace crates plus the on-chain program):
Build everything except IDL client libraries (workspace crates plus the on-chain program):

```sh
just build
```

The IDL client libraries can be generated with:

```sh
just generate
```

### How to test

```sh
just test
```

The IDL client libraries can be tested with:

```sh
just test-idl-generated
```

### Benchmarks

`just bench` runs the test suite and regenerates `bench-report.json`:
Expand Down
2 changes: 2 additions & 0 deletions programs/settlement/idl/client/js/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/generated/
pnpm-lock.yaml
2 changes: 2 additions & 0 deletions programs/settlement/idl/client/js/.prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Same as rustfmt
printWidth: 100
34 changes: 34 additions & 0 deletions programs/settlement/idl/client/js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "cow-solana-settlement-client",
"version": "0.3.0",
"type": "module",
"packageManager": "pnpm@11.25.0",
"description": "A library for interacting with CoW Protocol on Solana",
"license": "(MIT OR Apache-2.0)",
"main": "src/index.ts",
"files": [
"./dist/src",
"./dist/types",
"./src/"
],
Comment thread
kaze-cow marked this conversation as resolved.
"scripts": {
"typecheck": "tsc --noEmit",
"test": "vitest run",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"peerDependencies": {
"@solana/kit": "^8"
},
Comment on lines +20 to +22

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a peer dependency? Peer dependencies have been a huge pain in the past, and we'll be only noticing this once the linked versions start to drift; also indirectly, through people failing to install our package in their project. I suggest getting rid of this unless there's an extremely good reason for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past I used peer dependencies with Cannon to moderate success. It actually helps reduce problems with downloading multiple package versions and ultimately ending up with either type or compatibility errors because you are unknowingly using distinct/separate library versions, especially when working with web applications.

also the both of us are not maybe the best resources to decide on this. If it helps, I notice our own cow sdk uses multiple peer dependencies.

What I do think we should do is widen the list of available versions to maybe ^6.x which will prevent unnecessary compatibility issues? or expand it to accept any version, and then the dependency never becomes a bottleneck or resolution error ever?

For now I have expanded the scope of the peer dependency to accept all versions (*) be88336

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me explain the pitfalls with peer dependencies with an example. I created two packages (here) that try to import our package: consumer-kit-v8 and consumer-kit-v6, which differ on the version of @solana/kit that they use (resp. 6 and 8). The actual package code is extremely trivial, and this is the point.
If you try to use them (corepack pnpm install && corepack pnpm build):

  • v6 (the one we are requiring): install works; build fails because of mismatched types.
  • v8 (the one hinted at by our dev dependency): install warns you that the peer dependencies are broken; build succeeds.

Now, you could argue "this problem is just because peer and dev deps don't match, the fix is easy!".
My counterargument would be that it's easy to get things wrong.
In fact, your first commit made the peer generic * (which by the way has its own set of problems); this would have made v8 work, at least. However this was changed back in 5434c20 and I suspect this was an automated change.

Now, this is not really something special of this PR. The example in the Codama readme has the same peer dependency.

The expectations that Codana puts on us are clear: you must update often. You must stay in sync with @solana/kit and release a new version as soon as possible. People who use our package and don't run up the same update treadmill won't be able to use the same features. This update philosophy is why we suffer so much on updates like in #100.
A dependency makes this much softer (internal functions still work, the only possible mismatch should be the output type). This doesn't mean that mismatching versions will just work, but the breakage is limited to the external interface of our package, not the internal functions it uses.

The reason I feel so strongly is that I had we did the same for the contracts and so, so many people were struggling installing our package because they used Ethers v6 and we're still at Ethers v5. With a dependency they could have sorted out the issue much more easily compared to a peer dependency, where instead they need to understand both the problem as well as our internals.

Look at what error appears when building v6 from above! It's deep inside the imported package and there's no clue as to what's actually going wrong.
$ corepack pnpm build
$ tsc --noEmit
node_modules/.pnpm/cow-solana-settlement-client@file+..+programs+settlement+idl+client+js_@solana+kit@6.10_69cabcb7e9f65ac7453c39c1f587e61a/node_modules/cow-solana-settlement-client/src/generated/programs/cowSettlement.ts:406:47 - error TS2345: Argument of type 'T' is not assignable to parameter of type 'ClientWithRpc<GetAccountInfoApi & GetMultipleAccountsApi>'.
  Type 'CowSettlementPluginRequirements' is not assignable to type 'ClientWithRpc<GetAccountInfoApi & GetMultipleAccountsApi>'.
    The types of 'rpc.getAccountInfo' are incompatible between these types.
      Type '((address: import("/mnt/lima-solana/repos/solana-programs/solana-program-workbench/consumer-kit-v6/node_modules/.pnpm/@solana+addresses@6.10.0_typescript@5.9.3/node_modules/@solana/addresses/dist/types/address").Address, config: Readonly<...> & ... 1 more ... & Readonly<...>) => import("/mnt/lima-solana/repos/solana...' is not assignable to type '((address: import("/mnt/lima-solana/repos/solana-programs/solana-program-workbench/consumer-kit-v6/node_modules/.pnpm/@solana+addresses@8.2.0_typescript@5.9.3/node_modules/@solana/addresses/dist/types/address").Address, config: Readonly<...> & ... 1 more ... & Readonly<...>) => import("/mnt/lima-solana/repos/solana-...'.
        Type '((address: Address, config: Readonly<{ commitment?: Commitment | undefined; encoding: "base58" | "base64" | "base64+zstd" | "jsonParsed"; minContextSlot?: bigint | undefined; }> & Readonly<...> & Readonly<...>) => PendingRpcRequest<...>) & ... 29 more ... & ((address: Address, config?: Omit<...> | undefined) => Pend...' is not assignable to type '(address: Address, config: Readonly<{ commitment?: Commitment | undefined; encoding: "base58" | "base64" | "base64+zstd" | "jsonParsed"; minContextSlot?: bigint | undefined; }> & Readonly<...> & Readonly<...>) => PendingRpcRequest<...>'.
          Call signature return types 'PendingRpcRequest<Readonly<{ context: Readonly<{ slot: bigint; }>; value: GetAccountInfoApiResponse<Readonly<{ data: Base64EncodedDataResponse; }>>; }>>' and 'PendingRpcRequest<Readonly<{ context: Readonly<{ slot: bigint; }>; value: GetAccountInfoApiResponse<Readonly<{ data: Base64EncodedDataResponse; }>>; }>>' are incompatible.
            The types returned by 'reactiveStore()' are incompatible between these types.
              Property 'withSignal' is missing in type 'import("/mnt/lima-solana/repos/solana-programs/solana-program-workbench/consumer-kit-v6/node_modules/.pnpm/@solana+subscribable@6.10.0_typescript@5.9.3/node_modules/@solana/subscribable/dist/types/reactive-action-store").ReactiveActionStore<[], Readonly<{ context: Readonly<{ slot: bigint; }>; value: GetAccountInfoAp...' but required in type 'import("/mnt/lima-solana/repos/solana-programs/solana-program-workbench/consumer-kit-v6/node_modules/.pnpm/@solana+subscribable@8.2.0_typescript@5.9.3/node_modules/@solana/subscribable/dist/types/reactive-action-store").ReactiveActionStore<[], Readonly<{ context: Readonly<{ slot: bigint; }>; value: GetAccountInfoApi...'.

406           orderAccount: addSelfFetchFunctions(client, getOrderAccountCodec()),
                                                  ~~~~~~

  node_modules/.pnpm/@solana+subscribable@8.2.0_typescript@5.9.3/node_modules/@solana/subscribable/dist/types/reactive-action-store.d.ts:81:14
    81     readonly withSignal: (signal: AbortSignal) => {
                    ~~~~~~~~~~
    'withSignal' is declared here.

node_modules/.pnpm/cow-solana-settlement-client@file+..+programs+settlement+idl+client+js_@solana+kit@6.10_69cabcb7e9f65ac7453c39c1f587e61a/node_modules/cow-solana-settlement-client/src/generated/programs/cowSettlement.ts:408:13 - error TS2345: Argument of type 'T' is not assignable to parameter of type 'ClientWithRpc<GetAccountInfoApi & GetMultipleAccountsApi>'.
  Type 'CowSettlementPluginRequirements' is not assignable to type 'ClientWithRpc<GetAccountInfoApi & GetMultipleAccountsApi>'.
    The types of 'rpc.getAccountInfo' are incompatible between these types.
      Type '((address: import("/mnt/lima-solana/repos/solana-programs/solana-program-workbench/consumer-kit-v6/node_modules/.pnpm/@solana+addresses@6.10.0_typescript@5.9.3/node_modules/@solana/addresses/dist/types/address").Address, config: Readonly<...> & ... 1 more ... & Readonly<...>) => import("/mnt/lima-solana/repos/solana...' is not assignable to type '((address: import("/mnt/lima-solana/repos/solana-programs/solana-program-workbench/consumer-kit-v6/node_modules/.pnpm/@solana+addresses@8.2.0_typescript@5.9.3/node_modules/@solana/addresses/dist/types/address").Address, config: Readonly<...> & ... 1 more ... & Readonly<...>) => import("/mnt/lima-solana/repos/solana-...'.
        Type '((address: Address, config: Readonly<{ commitment?: Commitment | undefined; encoding: "base58" | "base64" | "base64+zstd" | "jsonParsed"; minContextSlot?: bigint | undefined; }> & Readonly<...> & Readonly<...>) => PendingRpcRequest<...>) & ... 29 more ... & ((address: Address, config?: Omit<...> | undefined) => Pend...' is not assignable to type '(address: Address, config: Readonly<{ commitment?: Commitment | undefined; encoding: "base58" | "base64" | "base64+zstd" | "jsonParsed"; minContextSlot?: bigint | undefined; }> & Readonly<...> & Readonly<...>) => PendingRpcRequest<...>'.
          Call signature return types 'PendingRpcRequest<Readonly<{ context: Readonly<{ slot: bigint; }>; value: GetAccountInfoApiResponse<Readonly<{ data: Base64EncodedDataResponse; }>>; }>>' and 'PendingRpcRequest<Readonly<{ context: Readonly<{ slot: bigint; }>; value: GetAccountInfoApiResponse<Readonly<{ data: Base64EncodedDataResponse; }>>; }>>' are incompatible.
            The types returned by 'reactiveStore()' are incompatible between these types.
              Property 'withSignal' is missing in type 'import("/mnt/lima-solana/repos/solana-programs/solana-program-workbench/consumer-kit-v6/node_modules/.pnpm/@solana+subscribable@6.10.0_typescript@5.9.3/node_modules/@solana/subscribable/dist/types/reactive-action-store").ReactiveActionStore<[], Readonly<{ context: Readonly<{ slot: bigint; }>; value: GetAccountInfoAp...' but required in type 'import("/mnt/lima-solana/repos/solana-programs/solana-program-workbench/consumer-kit-v6/node_modules/.pnpm/@solana+subscribable@8.2.0_typescript@5.9.3/node_modules/@solana/subscribable/dist/types/reactive-action-store").ReactiveActionStore<[], Readonly<{ context: Readonly<{ slot: bigint; }>; value: GetAccountInfoApi...'.

408             client,
                ~~~~~~

  node_modules/.pnpm/@solana+subscribable@8.2.0_typescript@5.9.3/node_modules/@solana/subscribable/dist/types/reactive-action-store.d.ts:81:14
    81     readonly withSignal: (signal: AbortSignal) => {
                    ~~~~~~~~~~
    'withSignal' is declared here.


Found 2 errors in the same file, starting at: node_modules/.pnpm/cow-solana-settlement-client@file+..+programs+settlement+idl+client+js_@solana+kit@6.10_69cabcb7e9f65ac7453c39c1f587e61a/node_modules/cow-solana-settlement-client/src/generated/programs/cowSettlement.ts:406

[ELIFECYCLE] Command failed with exit code 2.

our own cow sdk uses multiple peer dependencies.

Note they are all optional.

What I do think we should do is widen the list of available versions to maybe ^6.x which will prevent unnecessary compatibility issues

We absolutely should. And I don't think we can do better, we aren't compatible with other versions other than 8 (not 6). So ^8. Once we do that, people will come to us and nag us to update the package because they can't use this package with a future version 9 if we don't do something about it. This is the annoying part that wouldn't be as bad with a dependency.

It actually helps reduce problems with downloading multiple package versions and ultimately ending up with either type or compatibility errors because you are unknowingly using distinct/separate library versions, especially when working with web applications.

What I think it's happening here is that the package is too strict in package.json with the versioning (something like "mydep": "^1.42.1337" when "mydep": "^1" would be fine). The version of a dependency is honored; the version of a peer isn't, it just fires a warning (this is why v8 above builds). So automatic resolution ends up using different versions of the package than what the package technically requires, this adds an install warning that's ignored, and this still works because the original specs are too strict.

That said, I'm not a web dev, this is just my frustration with using peer deps in JS. There's certainly another side of the coin, the dependency problem are a thing as well.

That said, what next? Two options, I let you pick:

  • We use peer dependencies. This is actually what Codama suggests, which is why I don't push only for using normal dependencies. We use the latest version for now, strict in the dev deps (^8.2), loose in the peers (^8). In terms of maintenance, we stick to whatever the frontend uses. If other people want different version, we don't support that.
  • We use dependencies, strict in the dev deps (^8.2), loose in the peers (^8). I believe this makes it easier for people using a different version of @solana/kit to still use our package. Some function will be broken because the types may not match, but where this isn't an issue it will just work, unlike with peer dependencies. The only reason not to choose this is that Codama wants us to do things differently and I admit my knowledge could be lacking, but I'd like a concrete failure before dismissing it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I don't really consider myself an expert or well knowledged on any of this but it seems wrong to not use a peer dependency here based on all the information available to me so @limitofzero can help us decide

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an issue for testing on our end that the package is good, for now let's keep it as it is and rely on the frontend to tell us if there are issues. #141

"dependencies": {
"@solana/program-client-core": "^8"
},
Comment thread
kaze-cow marked this conversation as resolved.
"devDependencies": {
"@solana/kit": "^8",
"@types/node": "^24",
"litesvm": "^1",
"prettier": "^3",
"typescript": "^5",
"vitest": "^3"
}
}
Comment thread
kaze-cow marked this conversation as resolved.
Loading