XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.19k stars 507 forks source link

feat: add Price Oracles support #2688

Closed khancode closed 1 month ago

khancode commented 2 months ago

High Level Overview of Change

Add Price Oracles support - https://github.com/XRPLF/XRPL-Standards/discussions/129

Context of Change

Adds transactions: OracleSet, OracleDelete

Adds request: get_aggregate_price

Adds ledger entry: Oracle

Type of Change

Did you update HISTORY.md?

Test Plan

Adds unit/integration tests for Price Oracle transactions and request.

khancode commented 1 month ago

It looks like the ledger_entry filter isn't updated for oracle here.

But I included Oracle in the ledger entry filter. What's missing?

khancode commented 1 month ago

Given the complexity of creating a price data object (with AssetPrice/Scale used to avoid floats), do you think it'd be useful to have a helper function to convert a float to AssetPrice/Scale (and vice versa)?

I don't think it's necessary given the docs will explain this.

khancode commented 1 month ago

@mvadari I'm blocked on figuring out why the browser test fails. Any ideas?

mvadari commented 1 month ago

It looks like the ledger_entry filter isn't updated for oracle here.

But I included Oracle in the ledger entry filter. What's missing?

Missed that, sorry.

mvadari commented 1 month ago

Given the complexity of creating a price data object (with AssetPrice/Scale used to avoid floats), do you think it'd be useful to have a helper function to convert a float to AssetPrice/Scale (and vice versa)?

I don't think it's necessary given the docs will explain this.

I agree that the docs will explain this, but could be nice to have a helper function do the math for you. Not super important though.