Git Product home page Git Product logo

Comments (4)

laurengarcia avatar laurengarcia commented on July 18, 2024

.. and Thanks :)

from 0x-launch-kit-backend.

dekz avatar dekz commented on July 18, 2024

@laurengarcia this one I can't reproduce. Seems like your response is returning page 1 some how and not page 0 in the 0x Connect response. But the curl returns page 0 since no pagination params are given. Are you using any RequestOpts in the call to getOrderbookAsync (second parameter)?

import { HttpClient } from '@0x/connect';

const client = new HttpClient('http://localhost:3000/v2');
const baseAssetData = '0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa';
const quoteAssetData = '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c';
client.getOrderbookAsync(
    { "baseAssetData": baseAssetData,
      "quoteAssetData": quoteAssetData
    })
    .then(
      (r) => console.log(JSON.stringify(r, null, 2)),
      (e) => console.log(e)
    )

With the response:

{
  "bids": {
    "total": 0,
    "page": 0,
    "perPage": 20,
    "records": []
  },
  "asks": {
    "total": 2,
    "page": 0,
    "perPage": 20,
    "records": [
      {
        "metaData": {},
        "order": {
          "signature": "0x1b2217d8efad41909d1f759f64bd2a471639e3d17340ed736bb33ace4641e8f2097ff3d6c1f7dbc51d28e323e0becbe410808be125c0b9f15b8ef4b7c1f5b4a27c02",
          "senderAddress": "0x0000000000000000000000000000000000000000",
          "makerAddress": "0x5409ed021d9299bf6814279a6a1411a7e866a631",
          "takerAddress": "0x0000000000000000000000000000000000000000",
          "makerFee": "0",
          "takerFee": "0",
          "makerAssetAmount": "100000000000000000000000",
          "takerAssetAmount": "100000000000000000000",
          "makerAssetData": "0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa",
          "takerAssetData": "0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c",
          "salt": "4997075760802117905243536649051906104008891540108681218169938513821289690431",
          "exchangeAddress": "0x35dd2932454449b14cee11a94d3674a936d5d7b2",
          "feeRecipientAddress": "0x0000000000000000000000000000000000000000",
          "expirationTimeSeconds": "1646079500783"
        }
      },
      {
        "metaData": {},
        "order": {
          "signature": "0x1cb5245d5c90a2561502d6a9f01002ac476ca51a324f3e4b26870f41ca24d3a7e54d01c59083977b92e0534642378186ee173bb33d8dbb16d03ac60fb7db962a6a02",
          "senderAddress": "0x0000000000000000000000000000000000000000",
          "makerAddress": "0x5409ed021d9299bf6814279a6a1411a7e866a631",
          "takerAddress": "0x0000000000000000000000000000000000000000",
          "makerFee": "0",
          "takerFee": "0",
          "makerAssetAmount": "100000000000000000000",
          "takerAssetAmount": "100000000000000000",
          "makerAssetData": "0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa",
          "takerAssetData": "0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c",
          "salt": "48421664369936352591469907962264571897462657488340054914166087266166526899713",
          "exchangeAddress": "0x35dd2932454449b14cee11a94d3674a936d5d7b2",
          "feeRecipientAddress": "0x0000000000000000000000000000000000000000",
          "expirationTimeSeconds": "1547623505418"
        }
      }
    ]
  }
}

Matching the curl output:

curl 'http://localhost:3000/v2/orderbook?baseAssetData=0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa&quoteAssetData=0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c' | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1941  100  1941    0     0  25873      0 --:--:-- --:--:-- --:--:-- 26229
{
  "bids": {
    "total": 0,
    "page": 0,
    "perPage": 20,
    "records": []
  },
  "asks": {
    "total": 2,
    "page": 0,
    "perPage": 20,
    "records": [
      {
        "metaData": {},
        "order": {
          "signature": "0x1b2217d8efad41909d1f759f64bd2a471639e3d17340ed736bb33ace4641e8f2097ff3d6c1f7dbc51d28e323e0becbe410808be125c0b9f15b8ef4b7c1f5b4a27c02",
          "senderAddress": "0x0000000000000000000000000000000000000000",
          "makerAddress": "0x5409ed021d9299bf6814279a6a1411a7e866a631",
          "takerAddress": "0x0000000000000000000000000000000000000000",
          "makerFee": "0",
          "takerFee": "0",
          "makerAssetAmount": "100000000000000000000000",
          "takerAssetAmount": "100000000000000000000",
          "makerAssetData": "0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa",
          "takerAssetData": "0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c",
          "salt": "4997075760802117905243536649051906104008891540108681218169938513821289690431",
          "exchangeAddress": "0x35dd2932454449b14cee11a94d3674a936d5d7b2",
          "feeRecipientAddress": "0x0000000000000000000000000000000000000000",
          "expirationTimeSeconds": "1646079500783"
        }
      },
      {
        "metaData": {},
        "order": {
          "signature": "0x1cb5245d5c90a2561502d6a9f01002ac476ca51a324f3e4b26870f41ca24d3a7e54d01c59083977b92e0534642378186ee173bb33d8dbb16d03ac60fb7db962a6a02",
          "senderAddress": "0x0000000000000000000000000000000000000000",
          "makerAddress": "0x5409ed021d9299bf6814279a6a1411a7e866a631",
          "takerAddress": "0x0000000000000000000000000000000000000000",
          "makerFee": "0",
          "takerFee": "0",
          "makerAssetAmount": "100000000000000000000",
          "takerAssetAmount": "100000000000000000",
          "makerAssetData": "0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa",
          "takerAssetData": "0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c",
          "salt": "48421664369936352591469907962264571897462657488340054914166087266166526899713",
          "exchangeAddress": "0x35dd2932454449b14cee11a94d3674a936d5d7b2",
          "feeRecipientAddress": "0x0000000000000000000000000000000000000000",
          "expirationTimeSeconds": "1547623505418"
        }
      }
    ]
  }
}

from 0x-launch-kit-backend.

laurengarcia avatar laurengarcia commented on July 18, 2024

My bad! Was indeed passing in pagination params and didn't realize that page param is zero indexed (was requesting page 1). The reason I thought this was because I was looking at the SRA documentation, which says that the default page param is 1.

http://sra-spec.s3-website-us-east-1.amazonaws.com/#operation/getOrderbook

image

from 0x-launch-kit-backend.

dekz avatar dekz commented on July 18, 2024

Yeah I agree, 0 indexed pagination is non-standard.

from 0x-launch-kit-backend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.