BlinkTradeJS icon indicating copy to clipboard operation
BlinkTradeJS copied to clipboard

Include example of WITHDRAW_REFRESH

Open amingilani opened this issue 8 years ago • 6 comments

Hello

Can you please provide an example of WITHDRAW_REFRESH

  • Does this event fire upon both a pending and successful withdrawal?
  • Is the schema different for BTC and FIAT?
  • Is the schema different for different brokers?

Making an app, only pieces left to automate are trading and withdrawals 😄

amingilani avatar Nov 17 '16 13:11 amingilani

Does this event fire upon both a pending and successful withdrawal? Yes, it will fire at any state changes, even when you created the withdraw.

There are actually two ways to get withdraw updates

Using as event emitters together with requestWithdraw, that will listen to the current withdraw created. .e.g.:

blinktrade.requestWithdraw({ data: { Wallet: 'btcaddress' }})
.on('WITHDRAW_REFRESH', function(withdraw) {
});

And using the onWithdrawRefresh together with callbacks, that will listen to any withdraw updates, so make sure to match the right WithdrawID and Status that you're looking for. e.g.:

blinktrade.onWithdrawRefresh(function(withdraw) {
});

Is the schema different for BTC and FIAT? Nothings changes to get withdraw updates between BTC and FIAT, but when request withdraws, BTC is always the same, you just need to pass the required field Wallet as follows { data: { Wallet: 'btcaddress' }}, but requesting FIAT withdraw can change on each withdraw method, which is defined by each broker.

Requesting FIAT withdraw. https://github.com/blinktrade/BlinkTradeJS/blob/master/examples/withdraw.js#L8-L15 Requesting BTC withdraw. https://github.com/blinktrade/BlinkTradeJS/blob/master/examples/withdraw.js#L18-L25

Is the schema different for different brokers? Yes, each broker has your own withdraw structure, because each broker adds it dynamically on their admin panel, i had added the FOXBIT and VBTC withdraw methods on the docs, but i think i'll remove it and expose it as requestWithdrawMethods, because this information can be changed at any time, so i can't rely it on the docs.

This is the data fields for urdubit if you want for now.

Methods Data Fields
SCB2SCB AccountName AccountNumber ReferenceNumber
Check NameOnAccount AccountNo City BankName ChequeNo
Amazon Name Email RedeemCode
HBL AccountName AccountNumber Reference
AlliedBank AccountName AccountNumber Reference
BankIslami AccountName AccountNumber Ref
BankAlfalah AccountName Account Number Reference
Other Name AccountNumber BankName CNIC Mobile Reference
SKMCH Cellphone Ref
MeezanBank AccountName AccountNumber RefNumber
EasypaisaMobile MobileAccount TxID
JSBankCOC Name Cell CNIC Confirmation
JSBank Name Account Phone Number Ref

(yes, there's some inconsistent name such as Reference and Ref, i'm not sure why)

Let me know if you need anything else, i'll add more examples soon.

cesardeazevedo avatar Nov 17 '16 19:11 cesardeazevedo

This should be enough for me to finish :D thanks!

amingilani avatar Nov 18 '16 07:11 amingilani

@cesardeazevedo one last question, are these methods case sensitive?

amingilani avatar Nov 18 '16 19:11 amingilani

Another important question. The fields Reference and Ref do not show up in the interface. What does the API expect this field to contain?

E.g:

Schema:

BankIslami:

  • AccountName
  • AccountNumber
  • Ref

Interface

screen shot 2016-11-19 at 12 25 56 am

Message

I caught this message when trying to withdraw:

{
    "MsgType": "U6",
    "WithdrawReqID": 736245,
    "Currency": "PKR",
    "Amount": 120000000000,
    "Method": "BankIslami",
    "Data": "{\"AccountName\":\"123123123\",\"AccountNumber\":\"123123123\"}",
    "FingerPrint": 703338308,
    "STUNTIP": {
        "local": "xxx.xxx.xxx.xxx",
        "public": ["xxx.xxx.xxx.xxx"]
    }
}

amingilani avatar Nov 18 '16 19:11 amingilani

Sorry, i didn't check the fields on the interface, because i don't have a verified account on urdubit, but the fields are not showing up because they are actually exposed to the broker side, sorry that i didn't put this information on the table, but you don't have to worry about then, you can rely just on the fields that are shown on the dialog.

And yes, all fields should be case sensitive.

cesardeazevedo avatar Nov 19 '16 22:11 cesardeazevedo

I'm plan to implement requestWithdrawMethods to be more easier to check these fields, i'll reopen this for now.

cesardeazevedo avatar Nov 19 '16 22:11 cesardeazevedo