-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rpc): deposit & withdraw calls using lnd
This adds new rpc calls that allow to get new deposit addresses and withdraw coins via xud. Currently these calls only support lnd. Closes #1062.
- Loading branch information
Showing
14 changed files
with
1,831 additions
and
275 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Arguments } from 'yargs'; | ||
import { DepositRequest } from '../../proto/xudrpc_pb'; | ||
import { callback, loadXudClient } from '../command'; | ||
|
||
export const command = 'deposit <currency>'; | ||
|
||
export const describe = 'gets an address to deposit funds to xud'; | ||
|
||
export const builder = { | ||
currency: { | ||
description: 'the ticker symbol of the currency to deposit.', | ||
type: 'string', | ||
}, | ||
}; | ||
|
||
export const handler = (argv: Arguments<any>) => { | ||
const request = new DepositRequest(); | ||
request.setCurrency(argv.currency); | ||
loadXudClient(argv).deposit(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Arguments } from 'yargs'; | ||
import { WithdrawRequest } from '../../proto/xudrpc_pb'; | ||
import { callback, loadXudClient } from '../command'; | ||
|
||
export const command = 'withdraw <amount> <currency> <destination> [fee]'; | ||
|
||
export const describe = 'withdraws on-chain funds from xud'; | ||
|
||
export const builder = { | ||
amount: { | ||
description: 'the amount to withdraw', | ||
type: 'number', | ||
}, | ||
currency: { | ||
description: 'the ticker symbol of the currency to withdraw.', | ||
type: 'string', | ||
}, | ||
destination: { | ||
description: 'the address to send withdrawn funds to', | ||
type: 'string', | ||
}, | ||
fee: { | ||
description: 'the fee in satoshis (or equivalent) per byte', | ||
type: 'number', | ||
}, | ||
all: { | ||
description: 'whether to withdraw all available funds for the specified currency', | ||
type: 'boolean', | ||
}, | ||
}; | ||
|
||
export const handler = (argv: Arguments<any>) => { | ||
const request = new WithdrawRequest(); | ||
request.setCurrency(argv.currency); | ||
if (argv.all) { | ||
request.setAll(argv.all); | ||
} else { | ||
request.setAmount(argv.amount); | ||
} | ||
request.setDestination(argv.destination); | ||
request.setFee(argv.fee); | ||
|
||
loadXudClient(argv).withdraw(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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.