Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Launch kit does not support proxy id besides ERC20 and ERC721 #75

Open
JoaoCampos89 opened this issue Oct 3, 2019 · 0 comments
Open

Comments

@JoaoCampos89
Copy link

If an SRA pull orders from mesh to their local database can get orders with proxy id's different than ERC20 and ERC721, this causes the endpoint get v2/asset_pairs to fail because mesh orders could be AssetProxyId.MultiAsset, AssetProxyId.StaticCall, AssetProxyId.ERC1155. We can solve this filtering the orders which have non-supported proxy's

public static async getAssetPairsAsync(
      page: number,
      perPage: number,
      assetDataA: string,
      assetDataB: string,
  ): Promise<PaginatedCollection<AssetPairsItem>> {
      const connection = getDBConnection();
      const signedOrderModels = (await connection.manager.find(SignedOrderModel)) as Array<
          Required<SignedOrderModel>
      ;


      const assetPairsItems: AssetPairsItem[] = signedOrderModels.map(deserializeOrder).filter(filterNonAsset).map(signedOrderToAssetPair);

using this function:

const filterNonAsset = (signedOrder: SignedOrder): boolean => {
    const assetProxyId = assetDataUtils.decodeAssetProxyId(signedOrder.makerAssetData);

    switch (assetProxyId) {
        case AssetProxyId.MultiAsset:
            return false;
        case AssetProxyId.StaticCall:
            return false;
        case AssetProxyId.ERC1155:
            return false;
        default:
           return true;
    }
};
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant