-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(service): add open channel support
- Loading branch information
Karl Ranna
committed
Jul 10, 2019
1 parent
beb238d
commit dab84af
Showing
39 changed files
with
1,726 additions
and
81 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Arguments } from 'yargs'; | ||
import { callback, loadXudClient } from '../command'; | ||
import { OpenChannelRequest } from '../../proto/xudrpc_pb'; | ||
import { coinsToSats } from '../utils'; | ||
|
||
export const command = 'openchannel <nodePubKey> <currency> <amount>'; | ||
|
||
export const describe = 'open a payment channel'; | ||
|
||
export const builder = { | ||
nodePubKey: { | ||
description: 'The node pub key of the peer to open the channel with', | ||
type: 'string', | ||
}, | ||
currency: { | ||
description: 'The ticker symbol for the currency', | ||
type: 'string', | ||
}, | ||
amount: { | ||
type: 'number', | ||
description: 'The amount of the channel', | ||
}, | ||
}; | ||
|
||
export const handler = (argv: Arguments) => { | ||
const request = new OpenChannelRequest(); | ||
request.setNodePubKey(argv.nodePubKey); | ||
request.setCurrency(argv.currency.toUpperCase()); | ||
request.setAmount(coinsToSats(argv.amount)); | ||
loadXudClient(argv).openChannel(request, callback(argv)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.