Skip to content

Commit

Permalink
feat: remove BroadcastClient
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `BroadcastClient` was removed. It was deprecated in 2.2
  • Loading branch information
ckniffen committed Jul 26, 2023
1 parent 3df5004 commit 920cce9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 112 deletions.
84 changes: 0 additions & 84 deletions packages/xrpl/src/client/BroadcastClient.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/xrpl/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// Broadcast client is experimental
export { BroadcastClient } from './client/BroadcastClient'

export { Client, ClientOptions } from './client'

export * from './models'
Expand Down
27 changes: 2 additions & 25 deletions packages/xrpl/test/setupClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Client } from '../src/client'
// eslint-disable-next-line import/no-deprecated -- Will remove in 3.0.0
import { BroadcastClient } from '../src/client/BroadcastClient'

import createMockRippled, {
type MockedWebSocketServer,
Expand All @@ -9,8 +7,7 @@ import rippled from './fixtures/rippled'
import { destroyServer, getFreePort } from './testUtils'

export interface XrplTestContext {
// eslint-disable-next-line import/no-deprecated -- Will remove in 3.0.0
client: Client | BroadcastClient
client: Client
_mockedServerPort?: number
mockRippled?: MockedWebSocketServer
mocks?: MockedWebSocketServer[]
Expand Down Expand Up @@ -38,32 +35,12 @@ async function setupMockRippledConnection(
return context.client.connect().then(() => context)
}

async function setupMockRippledConnectionForBroadcast(
ports: number[],
): Promise<XrplTestContext> {
const servers = ports.map((port) => `ws://localhost:${port}`)
const context: XrplTestContext = {
mocks: ports.map((port) => createMockRippled(port)),
// eslint-disable-next-line import/no-deprecated -- Will remove in 3.0.0
client: new BroadcastClient(servers),
servers: ports,
}

return context.client.connect().then(() => context)
}

async function setupClient(): Promise<XrplTestContext> {
return getFreePort().then(async (port) => {
return setupMockRippledConnection(port)
})
}

async function setupBroadcast(): Promise<XrplTestContext> {
return Promise.all([getFreePort(), getFreePort()]).then(async (ports) => {
return setupMockRippledConnectionForBroadcast(ports)
})
}

async function teardownClient(
incomingContext: XrplTestContext,
done?: () => void,
Expand Down Expand Up @@ -98,4 +75,4 @@ async function teardownClient(
})
}

export { setupClient, teardownClient, setupBroadcast, createMockRippled }
export { setupClient, teardownClient, createMockRippled }

0 comments on commit 920cce9

Please sign in to comment.