-
Notifications
You must be signed in to change notification settings - Fork 13
Socket IO
Client must set next headers for creating a socketIO connection with server:
-
userID: user identifier -
deviceType: field, which identifies device type: it could beAndroidoriOS -
jwtToken: JWT token for user authentication
Currently there is 2 event, which is represented by next JSON-object in TransactionUpdate event:
{
transactionType: "outcoming", // or "incoming"
amount: 122,
status: "statusType",
txid: "tx_id"
}
Get exchange from Poloniex (endpoint exchangePoloniex) and Gdax (endpoint exchangeGdax) and Bitfinex (endpoint exchangeBitfinex)
Response:
{
"EURtoBTC":0,
"USDtoBTC":7.418815768634956e-05,
"ETHtoBTC":0.08747900277376175,
"ETHtoUSD":1182.2099609375,
"ETHtoEUR":0,
"BTCtoUSD":13479.240234375
"EOStoUSD":7.440423
}
Notice, that there are similar responses for this two events, but in Poloniex case ETH to EUR and EUR to BTC are always empty, because this exchange doesn't supports this rates. It is possible to ignore this fields.
For push notifications Multy uses Firebase Cloud Messaging.
It is necessary to set serverKeyin server config. When transaction for special user was done, back side is sending push notification to btcTransactionUpdate-userID.
Is user registered in several devices, all devices gets TransactionUpdate.
{
"score": "1",
"time": "2:00AM",
"amount": "1000000",
"transactionType": "1",
"currencyid": "60",
"networkid": "4",
"walletindex": "2",
"txid": "0xTxID",
}
An event of transaction is similar to socketio event.
For multisig interaction we use ws messaging over socketio
Base message is looks like :
{
"type":1, // it's kinda signature method eg: join:multisig.
"from":"multy",
"to":"ur userid",
"date":1531820490, // time unix
"status":0,
"payload":{}, // any
}
Types:
"type": join multisig = 1 can everyone who have an invite code
"type":leave multisig = 2 can only who already have invited
"type":delete multisig = 3 only creator can delete
"type":kick multisig = 4 only creator can kick
"type":check multisig = 5 can everyone who have an invite code
"type":view transaction = 6 only members can view
"type":decline transaction = 7 only members can decline
Payload:
{
"userid":"userid",
"address":"0xAddress",
"invitecode":"kek",
"addresstokick":"0xAddressTo", //omitempty
"walletindex":0,
"currencyid":60,
"networkid":1
"txid": "tx" // for view or decline
}
Userid related updates and responses from server will goes to:
msgRecieve = "message:recieve:userid"
e.g.:
join:multisig
- Joiner
{
"type":1,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":"join:multisig:ok"
}
- Members if online
{
"currencyid":0,
"networkid":0,
"confirmations":0,
"walletName":"",
"factoryAddress":"",
"contractAddress":"",
"txOfCreation":"",
"lastActionTime":0,
"dateOfCreation":0,
"owners":[
{
"userID":"",
"address":"",
"associated":false,
"creator":false,
"walletIndex":0,
"addressIndex":0
}
],
"deployStatus":1,
"status":"",
"inviteCode":"",
"ownersCount":0
}
leave:multisig && :multisig
- Reqester
{
"type":2,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":"leave:multisig:ok" || ":multisig:ok"
}
- Members if online
same as join:multisig
delete:multisig
- Reqester
{
"type":2,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":"delete:multisig:ok"
}
- Members if online
{
"type":3,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":"invitecode"
}
check:multisig:
- Reqester
{
"type":5,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":{
currencyid:60,
networkid:4,
exists: true,
}
}
"type":view transaction = 6 only members can view
"type":decline transaction = 7 only members can decline
view transaction = 6:
- Reqester
{
"type":5,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":"viewed"
}
decline transaction = 7:
- Reqester
{
"type":5,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":"declined"
}
Notifications
message:recieve:userid:
notify on deploy ms
{
"type":8,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":{
"currencyid":0,
"networkid":0,
"confirmations":0,
"walletName":"",
"factoryAddress":"",
"contractAddress":"",
"txOfCreation":"",
"lastActionTime":0,
"dateOfCreation":0,
"owners":[
{
"userID":"",
"address":"",
"associated":false,
"creator":false,
"walletIndex":0,
"addressIndex":0
}
],
"deployStatus":1,
"status":"",
"inviteCode":"",
"ownersCount":0
}
}
Notify on transaction
"type":NotifyPaymentReq = 9 "type":NotifyIncomingTx = 10 "type":NotifyConfirmTx = 11 "type":NotifyRevokeTx = 12
{
"type": 9,
"from":"multy",
"to":"ur userid",
"date":1531820490,
"payload":{ transaction}
}
Fires by potential receiver on application startup (as for airdrop flow v2)
event:startup:receiver:on:
Request packet
{"userid": "someuserid", "usercode": "someusercode"}
Response packet
["ok"]
Fires by sender to get receivers and their available wallets (as for airdrop flow v2)
event:startup:receiver:available
Request packet
{"ids": ["bluetoothIdentifier1", "bluetoothIdentifier2"]}
Response packet
{
"userid": "someuserId",
"usercode": "bluetoothIdentifier2",
"supportedAddresses": [
{
"currencyid": 60,
"networkid": 1,
"address": "0xsupportedAddress"
}
]
}