-
Notifications
You must be signed in to change notification settings - Fork 63
Fix relayer package exports for backward compatibility #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add direct exports alongside namespace exports to maintain backward compatibility after the relayer package refactoring in PR #891. This fixes breaking changes in downstream packages that depend on direct imports from @0xsequence/relayer, including: - wallet-core - wallet-wdk - dapp-client - External packages like 0xtrails The namespace exports are preserved while adding commonly used types and enums as direct exports for easier consumption. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
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 restores backward compatibility for the @0xsequence/relayer
package by adding direct exports alongside the namespace exports introduced in PR #891. The changes prevent breaking downstream packages that rely on direct imports of types and enums.
Key Changes:
- Added direct exports for commonly used enums (
ETHTxnStatus
,FeeTokenType
) - Added direct type exports for relayer interfaces and status types
- Preserved existing namespace exports to support both import styles
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
// Direct exports for backward compatibility | ||
export type { | ||
Relayer as RelayerInterface, | ||
FeeOption, | ||
FeeQuote, | ||
OperationStatus, | ||
OperationUnknownStatus, | ||
OperationQueuedStatus, | ||
OperationPendingStatus, | ||
OperationPendingPreconditionStatus, | ||
OperationConfirmedStatus, | ||
OperationFailedStatus, | ||
} from './relayer.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep
Relayer
type available under its original name
The fix adds type re‑exports but renames the main Relayer
interface to RelayerInterface
. Prior to #891, downstream code could import type { Relayer } from '@0xsequence/relayer'
and compile. After the refactor those imports failed, and this change still requires a rename to RelayerInterface
, so existing consumers remain broken. Exporting the type under the original Relayer
name (even in addition to the alias) is necessary to actually restore backward compatibility.
Useful? React with 👍 / 👎.
// Namespace exports | ||
export * as RpcRelayer from './rpc-relayer/index.js' | ||
export * as Relayer from './relayer.js' | ||
export * as StandardRelayer from './standard/index.js' | ||
export * as RelayerGen from './rpc-relayer/relayer.gen.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing direct export for
RpcRelayer
constructor
Before #891 the module re‑exported everything from rpc-relayer/index
, so code could instantiate the client with new RpcRelayer(...)
. After the refactor export * as RpcRelayer from './rpc-relayer/index.js'
exports a namespace object instead of the constructor, and callers must now use new RpcRelayer.RpcRelayer(...)
. This change adds direct type exports but still omits a value re‑export for the constructor, so existing runtime imports continue to break. Consider adding export { RpcRelayer } from './rpc-relayer/index.js'
(and similar for other top‑level classes) alongside the namespace export.
Useful? React with 👍 / 👎.
Update the instantiation of the relayer in both DappClient and ChainSessionManager to use the simplified export from the relayer package. This change enhances code clarity and maintains backward compatibility with existing functionality. No breaking changes introduced.
Summary
Fixes breaking changes from PR #891 by adding backward-compatible exports to the relayer package and updating internal packages to use the new export structure.
Problem
PR #891 refactored the relayer package to use namespace exports only, which broke both internal and external downstream packages:
Internal packages affected:
@0xsequence/wallet-core
- neededRelayer
namespace for types@0xsequence/dapp-client
- usedRpcRelayer.RpcRelayer
classExternal packages affected:
0xtrails
package failed to build with import errors@0xsequence/[email protected]
) expectingproto
,isRelayer
,RpcRelayer
exportsError examples:
Solution
1. Enhanced relayer package exports (
packages/services/relayer/src/index.ts
)Added comprehensive backward-compatible exports while preserving namespace structure:
Direct exports for backward compatibility:
isRelayer
functionRpcRelayer
classETHTxnStatus
,FeeTokenType
enumsRelayerInterface
,FeeOption
,FeeQuote
,OperationStatus
, etc.Namespace exports:
proto
- for old compiled packages usingproto.FeeTokenType
Relayer
- for wallet-core type usage (Relayer.OperationStatus
)Preconditions
,StandardRelayer
,RelayerGen
- for organizationThis allows multiple import styles:
2. Updated dapp-client to use direct imports
Files modified:
packages/wallet/dapp-client/src/ChainSessionManager.ts
packages/wallet/dapp-client/src/DappClient.ts
Changed from
RpcRelayer.RpcRelayer
to directRpcRelayer
class usage.Test Plan
Breaking Change Mitigation
This PR ensures no breaking changes for:
Fixes issues caused by #891
🤖 Generated with Claude Code