Feed 'R' - Settlement requests
Settlement request feed
Requests
{"event": "bind", "feed": "R"}
{"event": "unbind", "feed": "R"}
Feed handling
settlementRequest = [
0: counterpartyId (Efx::ClientId)
1: currencyName (string)
2: flags (unsigned int16)
3: amount (Efx::Size)
4: comment (string)
5: expirationTimestamp(Efx::Timestamp)
6: network (string)
7: requestId (unsigned int64)
8: creationTimestamp(Efx::Timestamp)
]
For detailed settlement requests description
settlementRequests// snapshot
['R', 0, 'S', [
array of incoming settlementRequest,
array of outgoing settlementRequest
]]
// add new settlement requests
['R', 0, '+', [
array of new incoming settlementRequest,
array of new outgoing settlementRequest
]]
// remove settlement requests
['R', 0, '-', [
array of removed incoming settlementRequest,
array of removed outgoing settlementRequest
]]
// failed to subscribe
['R', 0, 'Z', 2]
// unsubscribed
['R', 0, 'U', 0]
applyToSnapshot(prevSnapshot, feed, action, data) {
switch (feed) {
case 'R': {
switch (action) {
case 'S' : {
return [[...data[0]], [...data[1]]]
}
case '+' : {
for (let incoming of data[0]) {
prevSnapshot[0].push(incoming)
}
for (let outgoing of data[1]) {
prevSnapshot[1].push(outgoing)
}
break
}
case '-' : {
for (let incoming of data[0]) {
for (var i in prevSnapshot[0]) {
if (prevSnapshot[0][i][0] == incoming[0] &&
prevSnapshot[0][i][1] == incoming[1]) {
prevSnapshot[0].splice(i, 1)
break
}
}
}
for (let outgoing of data[1]) {
for (var i in prevSnapshot[1]) {
if (prevSnapshot[1][i][0] == outgoing[0] &&
prevSnapshot[1][i][1] == outgoing[1]) {
prevSnapshot[1].splice(i, 1)
break
}
}
}
break
}
}
break
}
}
return prevSnapshot
}
Last updated