Skip to content
Closed
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
35 changes: 33 additions & 2 deletions packages/services/relayer/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
export * as RpcRelayer from './rpc-relayer/index.js'
export * as Relayer from './relayer.js'
// Direct exports for convenience
export { RpcRelayer } from './rpc-relayer/index.js'
export { isRelayer } from './relayer.js'
export { ETHTxnStatus, FeeTokenType } from './rpc-relayer/relayer.gen.js'
Comment on lines +1 to +4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Removing RpcRelayer namespace breaks existing imports

The top-level export now re-exports RpcRelayer as the class itself instead of the previous namespace object (export * as RpcRelayer). Any consumer that does import { RpcRelayer } from "@0xsequence/relayer" and then references RpcRelayer.RpcRelayer, RpcRelayer.getChain, or RpcRelayer.Fetch will now receive undefined because those properties no longer exist on the exported value. The commit message claims backward compatibility, but downstream packages compiled against the namespace form will fail at compile time (property does not exist) or at runtime. Consider preserving the namespace export (or adding aliases) so old imports still resolve.

Useful? React with 👍 / 👎.


// Type exports
export type {
Relayer as RelayerInterface,
FeeOption,
FeeQuote,
OperationStatus,
OperationUnknownStatus,
OperationQueuedStatus,
OperationPendingStatus,
OperationPendingPreconditionStatus,
OperationConfirmedStatus,
OperationFailedStatus,
} from './relayer.js'

export type {
Relayer as Service,
FeeToken,
IntentPrecondition,
MetaTxn,
SendMetaTxnReturn,
GetMetaTxnReceiptReturn,
} from './rpc-relayer/relayer.gen.js'

// Namespace exports for better organization
export * as proto from './rpc-relayer/relayer.gen.js'
export * as StandardRelayer from './standard/index.js'
export * as RelayerGen from './rpc-relayer/relayer.gen.js'
export * as Preconditions from './preconditions/index.js'

// Re-export Relayer namespace with cleaner API from relayer.js
export { Relayer } from './relayer.js'
19 changes: 19 additions & 0 deletions packages/services/relayer/src/relayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,22 @@ export function isRelayer(relayer: any): relayer is Relayer {
'checkPrecondition' in relayer
)
}

// Import RpcRelayer for re-export in namespace
import { RpcRelayer as RpcRelayerClass } from './rpc-relayer/index.js'

// Namespace export with cleaner API
export namespace Relayer {
// Re-export RpcRelayer class
export const RpcRelayer = RpcRelayerClass
export type RpcRelayer = InstanceType<typeof RpcRelayerClass>

// Re-export types with cleaner names
export type Status = OperationStatus
export type FailedStatus = OperationFailedStatus
export type PendingStatus = OperationPendingStatus
export type ConfirmedStatus = OperationConfirmedStatus
export type UnknownStatus = OperationUnknownStatus
export type QueuedStatus = OperationQueuedStatus
export type PendingPreconditionStatus = OperationPendingPreconditionStatus
Comment on lines +101 to +107
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type aliases reference types that are not imported or defined in this file. These references should be qualified with their module imports or the types should be imported explicitly to ensure the namespace exports work correctly.

Copilot uses AI. Check for mistakes.

Comment on lines +91 to +107

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Relayer namespace drops previous members

The new Relayer namespace only exposes aliases like Relayer.Status and Relayer.RpcRelayer. Previously, export * as Relayer made every export from relayer.ts (e.g. isRelayer, OperationStatus, FeeOption) available under Relayer.*. Code that still calls Relayer.isRelayer or references Relayer.OperationStatus will now break because those members are no longer attached to the namespace; they are only exported at the top level. If backward compatibility is required as stated, the namespace needs to keep the legacy properties or provide aliases to them.

Useful? React with 👍 / 👎.

}
Loading