Skip to content

Avoid mixing BigInt and Number in marketplace purchaseAsset fee math - #840

Closed
Steve0x2a wants to merge 1 commit into
MeshJS:mainfrom
Steve0x2a:fix/marketplace-purchaseAsset-bigint-fee
Closed

Avoid mixing BigInt and Number in marketplace purchaseAsset fee math#840
Steve0x2a wants to merge 1 commit into
MeshJS:mainfrom
Steve0x2a:fix/marketplace-purchaseAsset-bigint-fee

Conversation

@Steve0x2a

Copy link
Copy Markdown

Summary

  • Fixes TypeError Cannot mix BigInt and other types in MeshMarketplaceContract.purchaseAsset() when on-chain datum price ints deserialize as bigint.
  • Introduces BigInt-safe computeMarketplacePurchasePayouts for owner fee and seller payout math (preserves prior ceil / 1 ADA minimum fee behavior).
  • Adds regression tests (jest + zero-dep node:test wiring/legacy-throw checks).

Credits @rayan25nov for the clear repro and local BigInt fix suggestion.

Fixes #713
Closes #712

Test plan

  • node --test packages/mesh-contract/src/marketplace/purchase-fee-math.node.test.mjs
  • npx tsx import of computeMarketplacePurchasePayouts with BigInt price
  • npm test / jest for @meshsdk/contract in full monorepo install

Datum integer fields may deserialize as bigint; Number arithmetic in
purchaseAsset threw TypeError. Route fee/seller payouts through
BigInt-safe computeMarketplacePurchasePayouts. Credit @rayan25nov.

Fixes MeshJS#713
Closes MeshJS#712
@Steve0x2a

Copy link
Copy Markdown
Author

Closing in favor of existing open PRs that already address the same BigInt/Number mix in purchaseAsset (#714, #832). Thanks for the prior work — no need for a third patch on this path.

@Steve0x2a Steve0x2a closed this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant