fix: use oracle fee pricing when module is available - #507
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
feeDenomis omitted: preferusd, otherwise fall back toncheq. - 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.
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))
|
🎉 This PR is included in version 5.5.1-develop.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 5.5.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
feeDenomis omitted, preferringusdand falling back toncheq.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:esmcd cjs && npm run build:cjs