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/asset_buyer.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/asset_buyer.ts')
-rw-r--r-- | packages/asset-buyer/src/asset_buyer.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 34e2d9639..2bc80ac12 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -77,7 +77,8 @@ export class AssetBuyer { ): AssetBuyer { assert.isWeb3Provider('provider', provider); assert.isWebUri('sraApiUrl', sraApiUrl); - const orderProvider = new StandardRelayerAPIOrderProvider(sraApiUrl); + const networkId = options.networkId || constants.DEFAULT_ASSET_BUYER_OPTS.networkId; + const orderProvider = new StandardRelayerAPIOrderProvider(sraApiUrl, networkId); const assetBuyer = new AssetBuyer(provider, orderProvider, options); return assetBuyer; } @@ -241,6 +242,15 @@ export class AssetBuyer { } } /** + * Get the asset data of all assets that are purchaseable with ether token (wETH) in the order provider passed in at init. + * + * @return An array of asset data strings that can be purchased using wETH. + */ + public async getAvailableAssetDatasAsync(): Promise<string[]> { + const etherTokenAssetData = this._getEtherTokenAssetDataOrThrow(); + return this.orderProvider.getAvailableMakerAssetDatasAsync(etherTokenAssetData); + } + /** * Grab orders from the map, if there is a miss or it is time to refresh, fetch and process the orders */ private async _getOrdersAndFillableAmountsAsync( |