diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-01 06:33:20 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-01 06:40:30 +0800 |
commit | 76f88a0a62fb4bedd63cdce07276d3fc05651831 (patch) | |
tree | 5f5cbd0973217a84822e29c786a10de9858b6dfa /packages/asset-buyer/src/order_providers/basic_order_provider.ts | |
parent | 3061afdafb83ad90f9b9da1f22f29525961378d5 (diff) | |
download | dexon-sol-tools-76f88a0a62fb4bedd63cdce07276d3fc05651831.tar dexon-sol-tools-76f88a0a62fb4bedd63cdce07276d3fc05651831.tar.gz dexon-sol-tools-76f88a0a62fb4bedd63cdce07276d3fc05651831.tar.bz2 dexon-sol-tools-76f88a0a62fb4bedd63cdce07276d3fc05651831.tar.lz dexon-sol-tools-76f88a0a62fb4bedd63cdce07276d3fc05651831.tar.xz dexon-sol-tools-76f88a0a62fb4bedd63cdce07276d3fc05651831.tar.zst dexon-sol-tools-76f88a0a62fb4bedd63cdce07276d3fc05651831.zip |
feat: expose new `getAvailableAssetDatasAsync` API
BREAKING CHANGE: the `OrderProvider` now requires a new method `getAvailableMakerAssetDatasAsync` and the `StandardRelayerAPIOrderProvider` requires the network id at init.
Diffstat (limited to 'packages/asset-buyer/src/order_providers/basic_order_provider.ts')
-rw-r--r-- | packages/asset-buyer/src/order_providers/basic_order_provider.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/asset-buyer/src/order_providers/basic_order_provider.ts b/packages/asset-buyer/src/order_providers/basic_order_provider.ts index 68406f19b..76685f27a 100644 --- a/packages/asset-buyer/src/order_providers/basic_order_provider.ts +++ b/packages/asset-buyer/src/order_providers/basic_order_provider.ts @@ -29,4 +29,13 @@ export class BasicOrderProvider implements OrderProvider { }); return { orders }; } + /** + * Given a taker asset data string, return all availabled paired maker asset data strings. + * @param takerAssetData A string representing the taker asset data. + * @return An array of asset data strings that can be purchased using takerAssetData. + */ + public async getAvailableMakerAssetDatasAsync(takerAssetData: string): Promise<string[]> { + const ordersWithTakerAssetData = _.filter(this.orders, { takerAssetData }); + return _.map(ordersWithTakerAssetData, order => order.makerAssetData); + } } |