Skip to content

fix: use oracle fee pricing when module is available - #507

Merged
Eengineer1 merged 2 commits into
developfrom
fix/oracle-fees-module-pricing
Jun 17, 2026
Merged

fix: use oracle fee pricing when module is available#507
Eengineer1 merged 2 commits into
developfrom
fix/oracle-fees-module-pricing

Conversation

@Eengineer1

@Eengineer1 Eengineer1 commented Jun 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Use Oracle module availability, not network name, to decide DID and DLR fee pricing.
  • Auto-pick module pricing params when feeDenom is omitted, preferring usd and falling back to ncheq.
  • Add mirrored ESM/CJS coverage for mainnet Oracle pricing, fallback static fees, denom selection, and automatic transaction fee generation.

Root Cause

Mainnet fell back to static fees because shouldUseOracleFees() only allowed Oracle pricing on testnet.

Validation

  • cd esm && npm test -- --runTestsByPath tests/modules/did.test.ts tests/modules/resource.test.ts --testNamePattern "Oracle module is available|mainnet when Oracle module is available|Oracle module probing fails|Oracle module is absent|auto-pick|transactions are initiated without explicit fees"
  • cd cjs && npm test -- --runTestsByPath tests/modules/did.test.ts tests/modules/resource.test.ts --testNamePattern "Oracle module is available|mainnet when Oracle module is available|Oracle module probing fails|Oracle module is absent|auto-pick|transactions are initiated without explicit fees"
  • cd esm && npm run build:esm
  • cd cjs && npm run build:cjs

@Eengineer1
Eengineer1 marked this pull request as ready for review June 17, 2026 22:01
@Eengineer1
Eengineer1 requested a review from Copilot June 17, 2026 22:01

Copilot AI left a comment

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.

Pull request overview

This PR fixes mainnet fee calculation by switching the “use Oracle pricing” decision from a network-name check to an Oracle-module availability probe, and expands test coverage to ensure dynamic pricing is used whenever Oracle is present.

Changes:

  • Update DID/Resource modules to enable oracle-powered fees based on Oracle module availability (via a lightweight params query), rather than hard-coding testnet-only behavior.
  • Enhance fee parameter selection when feeDenom is omitted: prefer usd, otherwise fall back to ncheq.
  • Add mirrored ESM/CJS tests covering mainnet oracle pricing, static-fee fallback when Oracle is absent/unavailable, denom auto-picking, and auto-fee generation during tx initiation.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
esm/src/modules/resource.ts Switch oracle-fee gating to Oracle availability probing; improve denom selection fallback.
esm/src/modules/did.ts Same oracle availability probing + denom selection fallback for DID ops.
esm/src/index.ts Update comment to match new “oracle when available” behavior during build.
esm/tests/modules/resource.test.ts Expand oracle/mainnet/static fallback/denom selection/auto-fee test coverage.
esm/tests/modules/did.test.ts Expand oracle/mainnet/probing failure/denom selection/auto-fee test coverage.
cjs/src/modules/resource.ts Mirror ESM resource module logic changes in CJS build.
cjs/src/modules/did.ts Mirror ESM DID module logic changes in CJS build.
cjs/src/index.ts Update comment to match new behavior (CJS).
cjs/tests/modules/resource.test.ts Mirror ESM resource test additions in CJS.
cjs/tests/modules/did.test.ts Mirror ESM DID test additions in CJS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread esm/src/modules/resource.ts
Comment thread esm/src/modules/did.ts Outdated
Comment thread cjs/src/modules/resource.ts
Comment thread cjs/src/modules/did.ts Outdated
@Eengineer1
Eengineer1 merged commit fe0447e into develop Jun 17, 2026
14 checks passed
@Eengineer1
Eengineer1 deleted the fix/oracle-fees-module-pricing branch June 17, 2026 22:28
cheqd-bot Bot pushed a commit that referenced this pull request Jun 17, 2026
## [5.5.1-develop.2](5.5.1-develop.1...5.5.1-develop.2) (2026-06-17)

### Bug Fixes

* use oracle fee pricing when module is available ([#507](#507)) ([fe0447e](fe0447e))
@cheqd-bot

cheqd-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 5.5.1-develop.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

cheqd-bot Bot pushed a commit that referenced this pull request Jun 17, 2026
## [5.5.1](5.5.0...5.5.1) (2026-06-17)

### Bug Fixes

* sync package-lock file ([f127197](f127197))
* use oracle fee pricing when module is available ([#507](#507)) ([fe0447e](fe0447e))
@cheqd-bot

cheqd-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 5.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@cheqd-bot cheqd-bot Bot added the released label Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants