발신자별 수표 조회(Look Up Checks by Sender)

수표 개정에 의해 추가되었습니다.

이 튜토리얼에서는 발신자별로 수표를 조회하는 방법을 보여드립니다. 수취인별로 수표를 조회할 수도 있습니다.

1. 주소로 모든 수표 조회(Look up all Checks for the address)

계정에 대해 수신 및 발신되는 모든 수표 목록을 가져오려면 보내는 계정의 주소와 함께 account_objects 명령을 사용하고 요청의 type 필드를 checks로 설정합니다.

Note:

account_objects 명령에 대한 커맨드라인 인터페이스는 type 필드를 허용하지 않습니다. 대신 json method를 사용하여 명령줄에서 JSON-RPC 형식 요청을 보낼 수 있습니다.

요청 예시(Example Request)

'use strict'
const RippleAPI = require('ripple-lib').RippleAPI

// This example connects to a public Test Net server
const api = new RippleAPI({server: 'wss://s.altnet.rippletest.net:51233'})
api.connect().then(() => {
  console.log('Connected')

  const account_objects_request = {
    command: "account_objects",
    account: "rBXsgNkPcDN2runsvWmwxk3Lh97zdgo9za",
    ledger_index: "validated",
    type: "check"
  }

  return api.connection.request(account_objects_request)
}).then(response => {
  console.log("account_objects response:", response)

// Disconnect and return
}).then(() => {
  api.disconnect().then(() => {
    console.log('Disconnected')
    process.exit()
  })
}).catch(console.error)

응답 예시(Example Response)

2. 발신자별로 응답 필터링(Filter the responses by sender)

응답에는 요청의 계정이 발신자인 경우의 Check와 계정이 수신자인 경우의 Check가 포함될 수 있습니다. 응답의 account_objects 배열의 각 멤버는 하나의 수표를 나타냅니다. 이러한 각 수표 객체에 대해 Account의 주소는 해당 수표의 발신자 주소입니다.

다음 의사 코드는 발신자별로 응답을 필터링하는 방법을 보여줍니다:

Last updated