dogecoin-gatewayd-plugin
Version:
Three unix processes designed to automate the integration between a ripple gateway using gatewayd and a dogecoind server.
44 lines (36 loc) • 1.23 kB
text/coffeescript
async = require "async"
class DogecoinBridge
constructor: (, ) ->
getDogecoinBridge: (callback) ->
async.waterfall [
.bind(@),
.bind(@)
.bind(@)
], callback
_getExternalAccount: (callback) ->
.data.models.externalAccounts.find
where:
uid:
.complete callback
_getNewDogecoinAddress: (externalAccount, callback) ->
if externalAccount
callback null, externalAccount, null
else
request
.get .config.get("dogecoinExpressDomain") + "/v1/getnewaddress"
.auth "admin", .config.get("dogecoinExpressApiKey")
.end (error, response) ->
if error
callback error, null, null
else
callback null, null, response.body.address
_registerDogeBridge: (externalAccount, dogecoinAddress, callback) ->
if externalAccount
callback null, externalAccount
else
.data.models.externalAccounts.create
name: dogecoinAddress
uid: this.rippleAddress
user_id: 1
.complete callback
module.exports = DogecoinBridge