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
1,037 changes: 568 additions & 469 deletions e2e/pnpm-lock.yaml

Large diffs are not rendered by default.

500 changes: 492 additions & 8 deletions examples/typescript/pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions typescript/.changeset/eighty-poems-reply.md

This file was deleted.

8 changes: 2 additions & 6 deletions typescript/packages/mechanisms/cardano/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ Cardano native tokens are identified as `${policyId}.${assetNameHex}`, e.g. USDM
c48cbb3d5e57ed56e276bc45f99ab39abe94e6cd7ac39fb402da47ad.0014df105553444d
```

## Optional Cardano serialization library
## Transaction decoding

This package depends on `@emurgo/cardano-serialization-lib-nodejs` as a _peer dependency_ to keep the TypeScript bundle light. The dep is resolved lazily inside `decodeCardanoTransaction` so the package can be imported without it; verification calls require it.

```bash
pnpm add @emurgo/cardano-serialization-lib-nodejs
```
CBOR transaction decoding in the facilitator uses Intersect's [Evolution SDK](https://www.npmjs.com/package/@evolution-sdk/evolution) — a pure-TypeScript Cardano serialization library with no WASM. It is bundled as a regular dependency; nothing extra to install.

## Asset transfer methods

Expand Down
9 changes: 1 addition & 8 deletions typescript/packages/mechanisms/cardano/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,9 @@
"vitest": "^3.0.5"
},
"dependencies": {
"@evolution-sdk/evolution": "^0.5.9",
"@x402/core": "workspace:*"
},
"peerDependencies": {
"@emurgo/cardano-serialization-lib-nodejs": ">=11.5.0"
},
"peerDependenciesMeta": {
"@emurgo/cardano-serialization-lib-nodejs": {
"optional": true
}
},
"exports": {
".": {
"import": {
Expand Down
2 changes: 0 additions & 2 deletions typescript/packages/mechanisms/cardano/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,5 @@ export const ERR_SETTLEMENT_NOT_CONFIRMED = "exact_cardano_settlement_not_confir
export const ERR_DUPLICATE_SETTLEMENT = "duplicate_settlement";
/** Error: the script assetTransferMethod was selected but reconstruction failed. */
export const ERR_SCRIPT_ADDRESS_MISMATCH = "invalid_exact_cardano_payload_script_address_mismatch";
/** Error: required Cardano SDK is not installed. */
export const ERR_CARDANO_SDK_MISSING = "exact_cardano_sdk_missing";
/** Error: transaction is not signed (no vkey/bootstrap witnesses present). */
export const ERR_TRANSACTION_UNSIGNED = "invalid_exact_cardano_payload_unsigned";
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
CARDANO_NETWORKS,
ERR_AMOUNT_INSUFFICIENT,
ERR_ASSET_MISMATCH,
ERR_CARDANO_SDK_MISSING,
ERR_CHAIN_LOOKUP_FAILED,
ERR_DUPLICATE_SETTLEMENT,
ERR_INVALID_PAYLOAD,
Expand Down Expand Up @@ -163,25 +162,12 @@ export class ExactCardanoScheme implements SchemeNetworkFacilitator {

let decoded: DecodedCardanoTransaction;
try {
decoded = await decodeCardanoTransaction(cardanoPayload.transaction);
decoded = decodeCardanoTransaction(cardanoPayload.transaction);
} catch (cause) {
const message = cause instanceof Error ? cause.message : String(cause);
// A missing peer dep is a facilitator misconfiguration, not client error.
// Bubble up as a chain-lookup-style failure with a descriptive message so
// operators can fix the install, instead of marking valid payments as
// malformed CBOR.
if (message.startsWith(ERR_CARDANO_SDK_MISSING)) {
return {
isValid: false,
invalidReason: ERR_CHAIN_LOOKUP_FAILED,
invalidMessage: message,
payer: "",
};
}
return {
isValid: false,
invalidReason: ERR_TRANSACTION_DECODE_FAILED,
invalidMessage: message,
invalidMessage: cause instanceof Error ? cause.message : String(cause),
payer: "",
};
}
Expand Down
Loading
Loading