Skip to content

Commit 572b02b

Browse files
authored
Merge pull request #25 from smartcontractkit/zp-responselistener-patch
2 parents 8b38be8 + 6873a1b commit 572b02b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/ResponseListener.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,13 @@ export class ResponseListener {
5959
}
6060

6161
public listenForResponses(
62-
subscriptionId: number,
62+
subscriptionId: number | string,
6363
callback: (functionsResponse: FunctionsResponse) => any,
6464
) {
65+
if (typeof subscriptionId === 'string') {
66+
subscriptionId = Number(subscriptionId)
67+
}
68+
6569
this.functionsRouter.on(
6670
'RequestProcessed',
6771
(

test/integration/ResponseListener.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ describe('Functions toolkit classes', () => {
138138
responseEventEmitter.emit('response')
139139
}
140140

141-
functionsListener.listenForResponses(subscriptionId, responseCallback)
141+
const subIdString = subscriptionId.toString()
142+
functionsListener.listenForResponses(subIdString, responseCallback)
142143

143144
await exampleClient.sendRequest(
144145
'return Functions.encodeUint256(1)',

0 commit comments

Comments
 (0)