Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit 04ef6e8

Browse files
committed
Use explicit parameters in untilWithdrawIsComplete
1 parent bfc7141 commit 04ef6e8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/rest/DataUnionEndpoints.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ async function transportSignatures(client: StreamrClient, messageHash: Todo, opt
419419

420420
// template for withdraw functions
421421
// client could be replaced with AMB (mainnet and sidechain)
422-
async function untilWithdrawIsComplete(client: StreamrClient, getWithdrawTxFunc: Todo, getBalanceFunc: Todo, options: Todo = {}) {
422+
async function untilWithdrawIsComplete(client: StreamrClient, getWithdrawTxFunc: (options: Todo) => Todo, getBalanceFunc: (options: Todo) => Todo, options: Todo = {}) {
423423
const {
424424
pollingIntervalMs = 1000,
425425
retryTimeoutMs = 60000,
@@ -744,8 +744,8 @@ export class DataUnionEndpoints {
744744
const address = getAddress(memberAddress) // throws if bad address
745745
const tr = await untilWithdrawIsComplete(
746746
this.client,
747-
this.getWithdrawMemberTx.bind(this, address),
748-
this.getTokenBalance.bind(this, address),
747+
(opts) => this.getWithdrawMemberTx(address, opts),
748+
(opts) => this.getTokenBalance(address, opts),
749749
{ ...this.client.options, ...options }
750750
)
751751
return tr
@@ -778,8 +778,8 @@ export class DataUnionEndpoints {
778778
const to = getAddress(recipientAddress)
779779
const tr = await untilWithdrawIsComplete(
780780
this.client,
781-
this.getWithdrawToSignedTx.bind(this, from, to, signature),
782-
this.getTokenBalance.bind(this, to),
781+
(opts) => this.getWithdrawToSignedTx(from, to, signature, opts),
782+
(opts) => this.getTokenBalance(to, opts),
783783
{ ...this.client.options, ...options }
784784
)
785785
return tr
@@ -1015,8 +1015,8 @@ export class DataUnionEndpoints {
10151015
async withdraw(options: Todo = {}) {
10161016
const tr = await untilWithdrawIsComplete(
10171017
this.client,
1018-
this.getWithdrawTx.bind(this),
1019-
this.getTokenBalance.bind(this, null), // null means this StreamrClient's auth credentials
1018+
(opts) => this.getWithdrawTx(opts),
1019+
(opts) => this.getTokenBalance(null, opts), // null means this StreamrClient's auth credentials
10201020
{ ...this.client.options, ...options }
10211021
)
10221022
return tr
@@ -1055,8 +1055,8 @@ export class DataUnionEndpoints {
10551055
const to = getAddress(recipientAddress) // throws if bad address
10561056
const tr = await untilWithdrawIsComplete(
10571057
this.client,
1058-
this.getWithdrawTxTo.bind(this, to),
1059-
this.getTokenBalance.bind(this, to),
1058+
(opts) => this.getWithdrawTxTo(to, opts),
1059+
(opts) => this.getTokenBalance(to, opts),
10601060
{ ...this.client.options, ...options }
10611061
)
10621062
return tr

0 commit comments

Comments
 (0)