Skip to content

Commit 8d9ea7e

Browse files
mpowaganduchak
authored andcommitted
feat(State Channels): Remove endpoint param (#391)
* feat(State Channels): Remove endpoint param BREAKING CHANGE: Endpoint param is removed and no longer defaults to "/channel". This means that "/channel" (or other path) must be appendend to url para * Fix channel test
1 parent 83f5279 commit 8d9ea7e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

es/channel/internal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ const rpcCallbacks = new WeakMap()
4040
const pingTimeoutId = new WeakMap()
4141
const pongTimeoutId = new WeakMap()
4242

43-
function channelURL (url, params, endpoint = 'channel') {
43+
function channelURL (url, params) {
4444
const paramString = R.join('&', R.values(R.mapObjIndexed((value, key) =>
4545
`${pascalToSnake(key)}=${encodeURIComponent(value)}`, params)))
4646

47-
return `${url}/${endpoint}?${paramString}`
47+
return `${url}?${paramString}`
4848
}
4949

5050
function emit (channel, ...args) {
@@ -198,10 +198,10 @@ function WebSocket (url, callbacks) {
198198
}
199199

200200
async function initialize (channel, channelOptions) {
201-
const optionsKeys = ['sign', 'endpoint', 'url']
201+
const optionsKeys = ['sign', 'url']
202202
const params = R.pickBy(key => !optionsKeys.includes(key), channelOptions)
203-
const { endpoint, url } = channelOptions
204-
const wsUrl = channelURL(url, { ...params, protocol: 'json-rpc' }, endpoint)
203+
const { url } = channelOptions
204+
const wsUrl = channelURL(url, { ...params, protocol: 'json-rpc' })
205205

206206
options.set(channel, channelOptions)
207207
fsm.set(channel, { handler: awaitingConnection })

test/integration/channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { unpackTx, buildTx } from '../../es/tx/builder'
2424
import { decode } from '../../es/tx/builder/helpers'
2525
import Channel from '../../es/channel'
2626

27-
const wsUrl = process.env.WS_URL || 'ws://node:3014'
27+
const wsUrl = process.env.WS_URL || 'ws://node:3014/channel'
2828

2929
plan('10000000000000000')
3030

0 commit comments

Comments
 (0)