Transactions

RippleAPI 準備付款路徑對象

  • March 11, 2015

使用漣漪 API 準備付款方式時。

GET /v1/accounts/{:source_address}/payments/paths/{:destination_address}/{:amount}

我正在為如何理解paths部分回复而苦苦掙扎?

"paths": "[[{\"currency\":\"USD\",\"issuer\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\",\"type\":1,\"type_hex\":\"0000000000000001\"}],[{\"currency\":\"USD\",\"issuer\":\"rpDMez6pm6dBve2TJsmDpv7Yae6V5Pyvy2\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rpDMez6pm6dBve2TJsmDpv7Yae6V5Pyvy2\",\"type\":1,\"type_hex\":\"0000000000000001\"},{\"account\":\"rHAwwozJw6FHfnJfRQaFXrkGHocGoaNYSy\",\"type\":1,\"type_hex\":\"0000000000000001\"},{\"account\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\",\"type\":1,\"type_hex\":\"0000000000000001\"}],[{\"currency\":\"USD\",\"issuer\":\"rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc\",\"type\":1,\"type_hex\":\"0000000000000001\"},{\"account\":\"rEtr3Kzh5MmhPbeNu6PDtQZsKBpgFEEEo5\",\"type\":1,\"type_hex\":\"0000000000000001\"},{\"account\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\",\"type\":1,\"type_hex\":\"0000000000000001\"}],[{\"currency\":\"USD\",\"issuer\":\"rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc\",\"type\":48,\"type_hex\":\"0000000000000030\"},{\"account\":\"rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc\",\"type\":1,\"type_hex\":\"0000000000000001\"},{\"account\":\"rKvPTQrD8ap1Y8TSmKjcK6G7q7Kvx7RAqQ\",\"type\":1,\"type_hex\":\"0000000000000001\"},{\"account\":\"rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q\",\"type\":1,\"type_hex\":\"0000000000000001\"}]]",

我知道如何閱讀 JSON 並了解貨幣正在賬戶之間轉移,但我不知道按什麼順序?從哪個到哪個,金額和貨幣是多少?

還有什麼type代表(例如 1 或 48),我在哪裡可以獲得所有類型的列表?

我相信這type是一個位域,由以下 C++ 程式碼定義:

class STPathElement
{
public:
   enum Type
   {
       typeNone        = 0x00,
       typeAccount     = 0x01, // Rippling through an account (vs taking an offer).
       typeCurrency    = 0x10, // Currency follows.
       typeIssuer      = 0x20, // Issuer follows.
       typeBoundary    = 0xFF, // Boundary between alternate paths.
       typeAll = typeAccount | typeCurrency | typeIssuer,
                               // Combination of all types.
   };
[snipped]

所以 48(或 0x30)將意味著typeCurrency並且typeAccount都已設置。我認為這意味著它是某人發行的貨幣。

1 (0x01) 表示typeAccount已設置。我認為這意味著它是一個包含 XRP 的帳戶。

至於其餘的,我不知道。

引用自:https://bitcoin.stackexchange.com/questions/36408