subscan-explorer / subscan-issue-tracker

The issue tracker for Subscan.io.
3 stars 5 forks source link

Pagination not working in fetch transfers api #70

Open rajathongal opened 1 year ago

rajathongal commented 1 year ago

Confirmation

Affected Network(s)

Polkadot

Steps to reproduce

  1. Hit the endpoint
  2. Params -{ row: 2, page:0 } this will give you 2 transactions
  3. Please make note of extrinsic hash or index or value from previously fetched results.
  4. Now Try with the params - { row: 2, page:1 }
  5. Same transactions will be returned
  6. Address used is 1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath

Expected output

the transaction should not repeat when next page is passed, it should return next 2 tramsactions

Actual output

It returned same transactions for both the pages

Page - 0

{
  count: 100729,
  transfers: [
    {
      from: '1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath',
      to: '121cRuVVZWzYRZiuvfvYRC8jSUijnHE6BWueBJYu6GZW9gJk',
      extrinsic_index: '16583095-2',
      success: true,
      hash: '0x2facac27c8613a00b7d7972b54afe0eed30f24d581e49c11d0e40560d1152525',
      block_num: 16583095,
      block_timestamp: 1690464150,
      module: 'balances',
      amount: '5.81',
      amount_v2: '0',
      usd_amount: '0',
      fee: '159462163',
      nonce: 67219,
      asset_symbol: 'DOT',
      asset_unique_id: '',
      asset_type: '',
      from_account_display: [Object],
      to_account_display: [Object],
      event_idx: 0
    },
    {
      from: '1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath',
      to: '13bqRUP9qTGYnuAF6kQzEjqHoMK1MJ5WTrgp4Z8eAAfRY2xN',
      extrinsic_index: '16583052-2',
      success: true,
      hash: '0x164ec2f5b17208cdb040fa30ca6f3a253aa535d0bb8f6b674225d36c229f0107',
      block_num: 16583052,
      block_timestamp: 1690463892,
      module: 'balances',
      amount: '112.81',
      amount_v2: '0',
      usd_amount: '0',
      fee: '160462163',
      nonce: 67218,
      asset_symbol: 'DOT',
      asset_unique_id: '',
      asset_type: '',
      from_account_display: [Object],
      to_account_display: [Object],
      event_idx: 0
    }
  ]
}

Page 1

{
  count: 100729,
  transfers: [
    {
      from: '1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath',
      to: '121cRuVVZWzYRZiuvfvYRC8jSUijnHE6BWueBJYu6GZW9gJk',
      extrinsic_index: '16583095-2',
      success: true,
      hash: '0x2facac27c8613a00b7d7972b54afe0eed30f24d581e49c11d0e40560d1152525',
      block_num: 16583095,
      block_timestamp: 1690464150,
      module: 'balances',
      amount: '5.81',
      amount_v2: '0',
      usd_amount: '0',
      fee: '159462163',
      nonce: 67219,
      asset_symbol: 'DOT',
      asset_unique_id: '',
      asset_type: '',
      from_account_display: [Object],
      to_account_display: [Object],
      event_idx: 0
    },
    {
      from: '1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath',
      to: '13bqRUP9qTGYnuAF6kQzEjqHoMK1MJ5WTrgp4Z8eAAfRY2xN',
      extrinsic_index: '16583052-2',
      success: true,
      hash: '0x164ec2f5b17208cdb040fa30ca6f3a253aa535d0bb8f6b674225d36c229f0107',
      block_num: 16583052,
      block_timestamp: 1690463892,
      module: 'balances',
      amount: '112.81',
      amount_v2: '0',
      usd_amount: '0',
      fee: '160462163',
      nonce: 67218,
      asset_symbol: 'DOT',
      asset_unique_id: '',
      asset_type: '',
      from_account_display: [Object],
      to_account_display: [Object],
      event_idx: 0
    }
  ]
}

Additional factoids or references

No response

rajathongal commented 1 year ago

@freehere107 Please review this

freehere107 commented 1 year ago

@rajathongal Thanks for your feedback.I will check it tomorrow

rajathongal commented 1 year ago

@rajathongal Thanks for your feedback.I will check it tomorrow

Any Update on this @freehere107

freehere107 commented 1 year ago

with params {"row":2,"page":0,"address":"1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath"}

{
    "code": 0,
    "message": "Success",
    "generated_at": 1691044908,
    "data": {
        "count": 100871,
        "transfers": [
            {
                "from": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
                "to": "112KZZvDq1CZ4ftgQNTCRuTUJUPwpRzb2ywTE4oAT2WdjNS",
                "extrinsic_index": "16679616-4",
                "success": true,
                "hash": "0xe0868f19a20d6445d3f9b0b491e9a7bf144059cb902c6c120be627a1bb3953e0",
                "block_num": 16679616,
                "block_timestamp": 1691043930,
                "module": "balances",
                "amount": "13.8009",
                "amount_v2": "0",
                "usd_amount": "0",
                "fee": "159462163",
                "nonce": 67304,
                "asset_symbol": "DOT",
                "asset_unique_id": "",
                "asset_type": "",
                "from_account_display": {
                    "address": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
                    "merkle": {
                        "address_type": "hot_wallet",
                        "tag_type": "Exchange",
                        "tag_subtype": "Mandatory KYC and AML",
                        "tag_name": "Gate.io"
                    }
                },
                "to_account_display": {
                    "address": "112KZZvDq1CZ4ftgQNTCRuTUJUPwpRzb2ywTE4oAT2WdjNS"
                },
                "event_idx": 0
            },
            {
                "from": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
                "to": "127C2LF7rHYR5V6aqJbWQFCzdK4gYkgGvZ8uydNdJyX8CiAm",
                "extrinsic_index": "16676801-2",
                "success": true,
                "hash": "0x265a6df6b08de665562f7afb8680d3fbb12ebdfb356b4ff07e092c515b600595",
                "block_num": 16676801,
                "block_timestamp": 1691026932,
                "module": "balances",
                "amount": "487.0131",
                "amount_v2": "0",
                "usd_amount": "0",
                "fee": "160462163",
                "nonce": 67303,
                "asset_symbol": "DOT",
                "asset_unique_id": "",
                "asset_type": "",
                "from_account_display": {
                    "address": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
                    "merkle": {
                        "address_type": "hot_wallet",
                        "tag_type": "Exchange",
                        "tag_subtype": "Mandatory KYC and AML",
                        "tag_name": "Gate.io"
                    }
                },
                "to_account_display": {
                    "address": "127C2LF7rHYR5V6aqJbWQFCzdK4gYkgGvZ8uydNdJyX8CiAm"
                },
                "event_idx": 0
            }
        ]
    }
}

with params {"row":2,"page":1,"address":"1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath"}

{
    "code": 0,
    "message": "Success",
    "generated_at": 1691044982,
    "data": {
        "count": 100871,
        "transfers": [
            {
                "from": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
                "to": "13RUYSFyyjRhy1KpiqejM35fjHGXTUYnhc6AqiVQncn8hPdu",
                "extrinsic_index": "16676602-2",
                "success": true,
                "hash": "0x692b9d4072eb3f3373d761de0260a172678e6750f2dda1324da96c03be816ca5",
                "block_num": 16676602,
                "block_timestamp": 1691025732,
                "module": "balances",
                "amount": "3.797988",
                "amount_v2": "0",
                "usd_amount": "0",
                "fee": "159462163",
                "nonce": 67302,
                "asset_symbol": "DOT",
                "asset_unique_id": "",
                "asset_type": "",
                "from_account_display": {
                    "address": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
                    "merkle": {
                        "address_type": "hot_wallet",
                        "tag_type": "Exchange",
                        "tag_subtype": "Mandatory KYC and AML",
                        "tag_name": "Gate.io"
                    }
                },
                "to_account_display": {
                    "address": "13RUYSFyyjRhy1KpiqejM35fjHGXTUYnhc6AqiVQncn8hPdu"
                },
                "event_idx": 0
            },
            {
                "from": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
                "to": "14rB1ufJVCZ9fZRRz2h3XnxYw5jdNUDb1RxJWqfPU6GUrVeP",
                "extrinsic_index": "16676044-2",
                "success": true,
                "hash": "0xd1ecfbb0bf39af1b0aa57ac849b0f4df28fa09520b3e1c5d6f310f4fc1210ecc",
                "block_num": 16676044,
                "block_timestamp": 1691022372,
                "module": "balances",
                "amount": "252.223485",
                "amount_v2": "0",
                "usd_amount": "0",
                "fee": "160462163",
                "nonce": 67301,
                "asset_symbol": "DOT",
                "asset_unique_id": "",
                "asset_type": "",
                "from_account_display": {
                    "address": "1JVrK16XZm9vyZjHoYVPjtZ35LvTQ4oyufMoUFTFpAUhath",
                    "merkle": {
                        "address_type": "hot_wallet",
                        "tag_type": "Exchange",
                        "tag_subtype": "Mandatory KYC and AML",
                        "tag_name": "Gate.io"
                    }
                },
                "to_account_display": {
                    "address": "14rB1ufJVCZ9fZRRz2h3XnxYw5jdNUDb1RxJWqfPU6GUrVeP"
                },
                "event_idx": 0
            }
        ]
    }
}
freehere107 commented 1 year ago

@rajathongal Sorry for the late reply, I didn't reproduce the issue

rajathongal commented 1 year ago

@rajathongal Sorry for the late reply, I didn't reproduce the issue

  1. I'm not sure why it is working fine now. Are there any API reference documents explaining the response object and request parameters?

  2. what is the limit for a row? 100 works fine, but 1000 doesn't work, we have clients who have transactions up to 2L to 15L.

@freehere107

rajathongal commented 1 year ago

@rajathongal Sorry for the late reply, I didn't reproduce the issue

  1. I'm not sure why it is working fine now. Are there any API reference documents explaining the response object and request parameters?
  2. what is the limit for a row? 100 works fine, but 1000 doesn't work, we have clients who have transactions up to 2L to 15L.

@freehere107

Any updates on this ? @freehere107

freehere107 commented 1 year ago

@rajathongal https://support.subscan.io/#transfers You better be able to use the v2 API https://support.subscan.io/#transfers-v2 . The maximum value of row is limited to 100

rajathongal commented 1 year ago

@rajathongal https://support.subscan.io/#transfers You better be able to use the v2 API https://support.subscan.io/#transfers-v2 . The maximum value of row is limited to 100

Hey @freehere107, I tried v2 basically I need all transfers for a wallet address, the pagination in the docs is quite confusing,

here is what I did

I made a get request on v2 transfers, first request was with params page 0 and row 100 and wallet address. I got 100 records.

then I got the block number and event index from the last record of the previously fetched results. Then I made a second request using params page 0 row 100 after_id with block num and evt idx. I again got 100 records

but the wallet address has only 173 transfers

rajathongal commented 1 year ago

@rajathongal https://support.subscan.io/#transfers You better be able to use the v2 API https://support.subscan.io/#transfers-v2 . The maximum value of row is limited to 100

Hey @freehere107, I tried v2 basically I need all transfers for a wallet address, the pagination in the docs is quite confusing,

here is what I did

I made a get request on v2 transfers, first request was with params page 0 and row 100 and wallet address. I got 100 records.

then I got the block number and event index from the last record of the previously fetched results. Then I made a second request using params page 0 row 100 after_id with block num and evt idx. I again got 100 records

but the wallet address has only 173 transfers

Any updates on this @freehere107