Ripple

如何在 Ripple 中使用 JSON RPC 創建報價

  • August 10, 2019

我目前正在這裡研究 Ripple API,但無法弄清楚如何使用 JSON RPC 創建報價,我將感謝你們的任何幫助

我在 2016 年 11 月有時會問這個問題,然後我是一個新手來漣漪和漣漪網關。

所以我選擇回答這個問題是為了那些可能喜歡在未來面臨同樣挑戰的人

如果您在兩種非本地貨幣之間創建報價,這是一個很好的範例請求。

{ "method": "submit", "params": [ { "offline": false, "secret": "snYothV5CFDMpMYStmL5VwMHzxHFr", "fee_mult_max": 1000, "tx_json": { "TakerGets": { "currency": "EUR", "value": "0.94", "issuer": "rJ5mA3kRwJWahdb3GqH3vmrbRd7eVufsVk" }, "TakerPays": { "currency": "NGN", "value": "305", "issuer": "rGGpYkf66FaZb3zymeB3xH1SRdtx2zGxVN" }, "Account": "rJ5mA3kRwJWahdb3GqH3vmrbRd7eVufsVk", "TransactionType": "OfferCreate", "Fee": "12", "Flags": "65536" } } ] }

這將給出與此類似的臨時響應。

{ "result": { "engine_result": "tesSUCCESS", "engine_result_code": 0, "engine_result_message": "The transaction was applied. Only final in a validated ledger.", "status": "success", "tx_blob": "1200072200010000240000007564D50AD5F57690A0000000000000000000000000004E474E0000000000A7616AF5356D585317A38B2EEC95B163BAC3434B65D46165400CE380000000000000000000000000004555520000000000C260B3831882A44608EE81C2F3726AA72D11CA9568400000000000000C732102272E391673B735C9D96435DAFF89F9EA7B4EC285C39643A754848EDE19A6542674473045022100F75C2C1B926F2880A38DB028B64F5363800FDC8FB8F4813ADE60A820DA9D8A710220148CC10AE87F0625733E73F35CB713857B1FDD6F5255979AA1075CE51FE3BAA38114C260B3831882A44608EE81C2F3726AA72D11CA95", "tx_json": { "Account": "rJ5mA3kRwJWahdb3GqH3vmrbRd7eVufsVk", "Fee": "12", "Flags": 65536, "Sequence": 117, "SigningPubKey": "02272E391673B735C9D96435DAFF89F9EA7B4EC285C39643A754848EDE19A65426", "TakerGets": { "currency": "EUR", "issuer": "rJ5mA3kRwJWahdb3GqH3vmrbRd7eVufsVk", "value": "0.94" }, "TakerPays": { "currency": "NGN", "issuer": "rGGpYkf66FaZb3zymeB3xH1SRdtx2zGxVN", "value": "305" }, "TransactionType": "OfferCreate", "TxnSignature": "3045022100F75C2C1B926F2880A38DB028B64F5363800FDC8FB8F4813ADE60A820DA9D8A710220148CC10AE87F0625733E73F35CB713857B1FDD6F5255979AA1075CE51FE3BAA3", "hash": "1B5738875CA25CA1CD76F6C8EEA65182172A2F7B7C87777614FA9FAEE2610F45" } } }

如果您正在創建將 XRP 兌換為非本國貨幣的報價,其中接受報價的人將獲得 XRP 以換取其非本國貨幣

{ "method": "submit", "params": [ { "offline": false, "secret": "snYothV5CFDMpMYStmL5VwMHzxHFr", "fee_mult_max": 1000, "tx_json": { "TakerGets": 10, "TakerPays": { "currency": "NGN", "value": "305", "issuer": "rGGpYkf66FaZb3zymeB3xH1SRdtx2zGxVN" }, "Account": "rJ5mA3kRwJWahdb3GqH3vmrbRd7eVufsVk", "TransactionType": "OfferCreate", "Fee": "12", "Flags": "65536" } } ] }

並且樣本響應是這樣的

{ "result": { "engine_result": "tesSUCCESS", "engine_result_code": 0, "engine_result_message": "The transaction was applied. Only final in a validated ledger.", "status": "success", "tx_blob": "1200072200010000240000007664D50AD5F57690A0000000000000000000000000004E474E0000000000A7616AF5356D585317A38B2EEC95B163BAC3434B65400000000000000A68400000000000000C732102272E391673B735C9D96435DAFF89F9EA7B4EC285C39643A754848EDE19A6542674473045022100C1BC4CF6D6D62670BAD3ACACA822E15E97F9594E30605B67178A25107880BA5B02207F0944A56ABD1BB5C13708903DA5AE13736356F99B1609261A3B4F2E6365A1D88114C260B3831882A44608EE81C2F3726AA72D11CA95", "tx_json": { "Account": "rJ5mA3kRwJWahdb3GqH3vmrbRd7eVufsVk", "Fee": "12", "Flags": 65536, "Sequence": 118, "SigningPubKey": "02272E391673B735C9D96435DAFF89F9EA7B4EC285C39643A754848EDE19A65426", "TakerGets": "10", "TakerPays": { "currency": "NGN", "issuer": "rGGpYkf66FaZb3zymeB3xH1SRdtx2zGxVN", "value": "305" }, "TransactionType": "OfferCreate", "TxnSignature": "3045022100C1BC4CF6D6D62670BAD3ACACA822E15E97F9594E30605B67178A25107880BA5B02207F0944A56ABD1BB5C13708903DA5AE13736356F99B1609261A3B4F2E6365A1D8", "hash": "BF257B79B3D80FD7E8B5A42A60BA13904704AE21BFD07E56CE38F229A4C462A6" } } }

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