xrpl.js icon indicating copy to clipboard operation
xrpl.js copied to clipboard

'Type' filter seems to be ignored on API request

Open YordanPavlov opened this issue 1 year ago • 4 comments

Hello, I am using the XRP Client library and providing the 'type' property as a filter. It seems to be ignored though. Here is my code:

const xrpl = require('xrpl');

const api = new xrpl.Client('wss://s2.ripple.com', { timeout: 10000 });

async function main() {
  await api.connect();

  const result = await api.request({
    command: 'ledger',
    ledger_index: 84917024,
    transactions: true,
    expand: true,
    type: 'nft_page'
  });
  console.log(JSON.stringify(result));
  await api.disconnect();
}

main();

My response is not any different if I provide or not the:

type: 'nft_page

filter.

As a reference here is the request definition:

https://github.com/XRPLF/xrpl.js/blob/main/packages/xrpl/src/models/methods/ledger.ts#L72

Let me know if I am using it wrong. Thanks!

YordanPavlov avatar Jan 03 '24 13:01 YordanPavlov

@mvadari you recently added this field but i don't see it documented on xrpl.org and it doesn't work with the websocket tool either. Does the ledger command use a subset of the type accepted by ledger_entry?

ckniffen avatar Jan 03 '24 15:01 ckniffen

It's in the rippled code, but I don't really understand what it's doing.

mvadari avatar Jan 03 '24 15:01 mvadari

@ckniffen The type field is documented in the last portion of the "Request Format" section of the ledger_data command: https://xrpl.org/ledger_data.html#request-format

The type filter pertains to account_objects, ledger_data and the ledger command. It has not been implemented correctly (or documented) in the ledger command. I'm working on fixing that in the rippled code.

ltORACLE is missing (amongst the list of ledger state objects) in the javascript code, this was added today to the rippled codebase.

ckeshava avatar Feb 26 '24 20:02 ckeshava

It has not been implemented correctly (or documented) in the ledger command.

The rippled's code might be correct. The server behind s2 is Clio which does not support "type" parameter. Documented here -> https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/ledger-methods/ledger/

cindyyan317 avatar Mar 11 '24 10:03 cindyyan317