Skip to content

Commit

Permalink
use shorter names
Browse files Browse the repository at this point in the history
  • Loading branch information
geoknee committed Oct 12, 2023
1 parent 94d291e commit 6e06584
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 36 deletions.
25 changes: 5 additions & 20 deletions packages/nitro-rpc-client/scripts/client-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,8 @@ yargs(hideBin(process.argv))
);

await Promise.all([
aliceClient.WaitForLedgerChannelToHaveStatus(
aliceLedger.ChannelId,
"Open"
),
bobClient.WaitForLedgerChannelToHaveStatus(
bobLedger.ChannelId,
"Open"
),
aliceClient.WaitForLedgerChannelStatus(aliceLedger.ChannelId, "Open"),
bobClient.WaitForLedgerChannelStatus(bobLedger.ChannelId, "Open"),
]);

console.log(`Ledger channel ${bobLedger.ChannelId} created`);
Expand All @@ -201,10 +195,7 @@ yargs(hideBin(process.argv))
[ireneAddress],
yargs.virtualdeposit
);
await aliceClient.WaitForPaymentChannelToHaveStatus(
res.ChannelId,
"Open"
);
await aliceClient.WaitForPaymentChannelStatus(res.ChannelId, "Open");
console.log(`Virtual channel ${res.ChannelId} created`);
virtualChannels.push(res.ChannelId);
}
Expand All @@ -228,10 +219,7 @@ yargs(hideBin(process.argv))
}

await aliceClient.ClosePaymentChannel(channelId);
await aliceClient.WaitForPaymentChannelToHaveStatus(
channelId,
"Complete"
);
await aliceClient.WaitForPaymentChannelStatus(channelId, "Complete");
console.log(`Virtual channel ${channelId} closed`);
closeCount++;
}
Expand Down Expand Up @@ -280,10 +268,7 @@ yargs(hideBin(process.argv))
rightAddress,
1_000_000
);
await leftClient.WaitForLedgerChannelToHaveStatus(
ledger.ChannelId,
"Open"
);
await leftClient.WaitForLedgerChannelStatus(ledger.ChannelId, "Open");
console.log(`Ledger channel ${ledger.ChannelId} created`);

await closeClients(clients);
Expand Down
14 changes: 4 additions & 10 deletions packages/nitro-rpc-client/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ yargs(hideBin(process.argv))
const { Id, ChannelId } = dfObjective;

console.log(`Objective started ${Id}`);
await rpcClient.WaitForLedgerChannelToHaveStatus(ChannelId, "Open");
await rpcClient.WaitForLedgerChannelStatus(ChannelId, "Open");
console.log(`Channel Open ${ChannelId}`);
await rpcClient.Close();
process.exit(0);
Expand All @@ -154,10 +154,7 @@ yargs(hideBin(process.argv))

const id = await rpcClient.CloseLedgerChannel(yargs.channelId);
console.log(`Objective started ${id}`);
await rpcClient.WaitForPaymentChannelToHaveStatus(
yargs.channelId,
"Complete"
);
await rpcClient.WaitForPaymentChannelStatus(yargs.channelId, "Complete");
console.log(`Channel Complete ${yargs.channelId}`);
await rpcClient.Close();
process.exit(0);
Expand Down Expand Up @@ -205,7 +202,7 @@ yargs(hideBin(process.argv))

const { ChannelId, Id } = vfObjective;
console.log(`Objective started ${Id}`);
await rpcClient.WaitForPaymentChannelToHaveStatus(ChannelId, "Open");
await rpcClient.WaitForPaymentChannelStatus(ChannelId, "Open");
console.log(`Channel Open ${ChannelId}`);
await rpcClient.Close();
process.exit(0);
Expand Down Expand Up @@ -233,10 +230,7 @@ yargs(hideBin(process.argv))
const id = await rpcClient.ClosePaymentChannel(yargs.channelId);

console.log(`Objective started ${id}`);
await rpcClient.WaitForPaymentChannelToHaveStatus(
yargs.channelId,
"Complete"
);
await rpcClient.WaitForPaymentChannelStatus(yargs.channelId, "Complete");
console.log(`Channel complete ${yargs.channelId}`);
await rpcClient.Close();
process.exit(0);
Expand Down
8 changes: 4 additions & 4 deletions packages/nitro-rpc-client/src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,22 +101,22 @@ interface paymentApi {

interface syncAPI {
/**
* WaitForLedgerChannelToHaveStatus blocks until the ledger channel with the given ID to have the given status.
* WaitForLedgerChannelStatus blocks until the ledger channel with the given ID to have the given status.
*
* @param objectiveId - The channel id to wait for
* @param status - The channel id to wait for (e.g. Ready or Closing)
*/
WaitForLedgerChannelToHaveStatus(
WaitForLedgerChannelStatus(
objectiveId: string,
status: ChannelStatus
): Promise<void>;
/**
* WaitForPaymentChannelToHaveStatus blocks until the payment channel with the given ID to have the given status.
* WaitForPaymentChannelStatus blocks until the payment channel with the given ID to have the given status.
*
* @param objectiveId - The channel id to wait for
* @param status - The channel id to wait for (e.g. Ready or Closing)
*/
WaitForPaymentChannelToHaveStatus(
WaitForPaymentChannelStatus(
objectiveId: string,
status: ChannelStatus
): Promise<void>;
Expand Down
4 changes: 2 additions & 2 deletions packages/nitro-rpc-client/src/rpc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class NitroRpcClient implements RpcClientApi {
return getAndValidateResult(res, "receive_voucher");
}

public async WaitForLedgerChannelToHaveStatus(
public async WaitForLedgerChannelStatus(
channelId: string,
status: ChannelStatus
): Promise<void> {
Expand All @@ -80,7 +80,7 @@ export class NitroRpcClient implements RpcClientApi {
return promise;
}

public async WaitForPaymentChannelToHaveStatus(
public async WaitForPaymentChannelStatus(
channelId: string,
status: ChannelStatus
): Promise<void> {
Expand Down

0 comments on commit 6e06584

Please sign in to comment.