Data endpoint API (importable structs) #88

Closed
opened 2024-09-25 16:03:33 +02:00 by kamikazechaser · 4 comments
  • Current holdings (with balances)
  • Last 10 Tx
- [x] Current holdings (with balances) - [x] Last 10 Tx
kamikazechaser added the
Kind/Feature
label 2024-09-25 16:03:33 +02:00
kamikazechaser self-assigned this 2024-09-25 16:03:49 +02:00
Author
Owner

NATS to watch the TRANSFERS stream.

NATS to watch the TRANSFERS stream.
kamikazechaser changed title from Data endpoint API to Data endpoint API (importable structs) 2024-10-02 15:38:34 +02:00
Author
Owner

Data API endpoints

  1. Last 10 tx: GET /api/v1/transfers/last10/:address
  2. Token holdings with balances: GET /api/v1/holdings/:address

Sample responses

{
  "ok": true,
  "description": "Token holdings with current balances",
  "result": {
    "holdings": [
      {
        "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
        "tokenSymbol": "FSPTST",
        "tokenDecimals": "6",
        "balance": "8869964242"
      },
      {
        "contractAddress": "0x724F2910D790B54A39a7638282a45B1D83564fFA",
        "tokenSymbol": "GEO",
        "tokenDecimals": "6",
        "balance": "9884"
      },
      {
        "contractAddress": "0x2105a206B7bec31E2F90acF7385cc8F7F5f9D273",
        "tokenSymbol": "MFNK",
        "tokenDecimals": "6",
        "balance": "19788697"
      },
      {
        "contractAddress": "0x63DE2Ac8D1008351Cc69Fb8aCb94Ba47728a7E83",
        "tokenSymbol": "MILO",
        "tokenDecimals": "6",
        "balance": "75"
      },
      {
        "contractAddress": "0xd4c288865Ce0985a481Eef3be02443dF5E2e4Ea9",
        "tokenSymbol": "SOHAIL",
        "tokenDecimals": "6",
        "balance": "27874115"
      },
      {
        "contractAddress": "0x45d747172e77d55575c197CbA9451bC2CD8F4958",
        "tokenSymbol": "SRF",
        "tokenDecimals": "6",
        "balance": "2745987"
      }
    ]
  }
}
{
  "ok": true,
  "description": "Last 10 token transfers",
  "result": {
    "transfers": [
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0xD9EFFcd6C40d4DFfD5F82776d4F571A537fAfdef",
        "transferValue": "3450000",
        "contractAddress": "0xd4c288865Ce0985a481Eef3be02443dF5E2e4Ea9",
        "txHash": "0x89db41299d20d0484fa1ed27cf247a4460dbf2e1e00d1e577a507a53ea3f9eb6",
        "dateBlock": "2024-10-03T07:23:12Z",
        "tokenSymbol": "SOHAIL",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0x5DBba159E6390161544EC50E0dF990d3523cFCB1",
        "transferValue": "10000000",
        "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
        "txHash": "0xcb3d7cc9fc7e6ee8178fcb0272922c065983828efc556fecba23402a25e219de",
        "dateBlock": "2024-09-16T17:19:21Z",
        "tokenSymbol": "FSPTST",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0xD148A3DC9cB1E03Df39b055AA9774322E6b4890A",
        "transferValue": "10000000",
        "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
        "txHash": "0xf647da366f124864724a0890d4a80a61839f5788f5ce0a291db57da05d976133",
        "dateBlock": "2024-09-16T17:17:51Z",
        "tokenSymbol": "FSPTST",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0xE55B5AC9dA6bB9876B1c3748EeFE338A54891DC3",
        "transferValue": "990000",
        "contractAddress": "0x724F2910D790B54A39a7638282a45B1D83564fFA",
        "txHash": "0x37d340e17835cfda20e7563bbd6ba6219f11312788cf7550f129a0ef9bbe2f59",
        "dateBlock": "2024-09-16T11:54:21Z",
        "tokenSymbol": "GEO",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xE55B5AC9dA6bB9876B1c3748EeFE338A54891DC3",
        "recipient": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "transferValue": "1000000",
        "contractAddress": "0x724F2910D790B54A39a7638282a45B1D83564fFA",
        "txHash": "0x66032dd260300217cfe1602a6c8d61ac230a0ca7bdca4069521ed9d38ab47cc3",
        "dateBlock": "2024-09-16T11:51:36Z",
        "tokenSymbol": "GEO",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0x8189E86a44b1714D67DeA2201ec55d44f09ceD7b",
        "transferValue": "1000000",
        "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
        "txHash": "0xab8f04ef88ed049f5c17b3fed591d2ec531e6b971f56b28e3b7e59390f2bd59f",
        "dateBlock": "2024-09-13T09:31:01Z",
        "tokenSymbol": "FSPTST",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0x8189E86a44b1714D67DeA2201ec55d44f09ceD7b",
        "transferValue": "2000000",
        "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
        "txHash": "0xee5283c54cab563937c9945bc63e27e8633c1caf6999aedcbbd4338d45b27dc2",
        "dateBlock": "2024-09-13T06:49:26Z",
        "tokenSymbol": "FSPTST",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0x8189E86a44b1714D67DeA2201ec55d44f09ceD7b",
        "transferValue": "1240000",
        "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
        "txHash": "0x78eab1b870a26d2e7ac6120f286ec31afb7c4936cc5bd1ecaf2acf8603b49a92",
        "dateBlock": "2024-09-10T12:09:19Z",
        "tokenSymbol": "FSPTST",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0xf5E1cF48B50f7bf01c57a19A99a026DcC6805a7e",
        "transferValue": "3650000",
        "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
        "txHash": "0x224feaa1af977bd155ff6b30895feee5d9e07ef637e4808543b1b9242d5d27c6",
        "dateBlock": "2024-09-05T10:09:02Z",
        "tokenSymbol": "FSPTST",
        "tokenDecimals": "6"
      },
      {
        "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4",
        "recipient": "0x8189E86a44b1714D67DeA2201ec55d44f09ceD7b",
        "transferValue": "1000000",
        "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee",
        "txHash": "0x268b0ff14d45b9369695c0369c4a6c7556ca9e6d8eb01386d3038739bed59fad",
        "dateBlock": "2024-09-04T05:47:06Z",
        "tokenSymbol": "FSPTST",
        "tokenDecimals": "6"
      }
    ]
  }
}
### Data API endpoints 1. Last 10 tx: `GET /api/v1/transfers/last10/:address` 2. Token holdings with balances: `GET /api/v1/holdings/:address` * https://github.com/grassrootseconomics/ussd-data-service/blob/master/pkg/api/api.go #### Sample responses ```json { "ok": true, "description": "Token holdings with current balances", "result": { "holdings": [ { "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee", "tokenSymbol": "FSPTST", "tokenDecimals": "6", "balance": "8869964242" }, { "contractAddress": "0x724F2910D790B54A39a7638282a45B1D83564fFA", "tokenSymbol": "GEO", "tokenDecimals": "6", "balance": "9884" }, { "contractAddress": "0x2105a206B7bec31E2F90acF7385cc8F7F5f9D273", "tokenSymbol": "MFNK", "tokenDecimals": "6", "balance": "19788697" }, { "contractAddress": "0x63DE2Ac8D1008351Cc69Fb8aCb94Ba47728a7E83", "tokenSymbol": "MILO", "tokenDecimals": "6", "balance": "75" }, { "contractAddress": "0xd4c288865Ce0985a481Eef3be02443dF5E2e4Ea9", "tokenSymbol": "SOHAIL", "tokenDecimals": "6", "balance": "27874115" }, { "contractAddress": "0x45d747172e77d55575c197CbA9451bC2CD8F4958", "tokenSymbol": "SRF", "tokenDecimals": "6", "balance": "2745987" } ] } } ``` ```json { "ok": true, "description": "Last 10 token transfers", "result": { "transfers": [ { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0xD9EFFcd6C40d4DFfD5F82776d4F571A537fAfdef", "transferValue": "3450000", "contractAddress": "0xd4c288865Ce0985a481Eef3be02443dF5E2e4Ea9", "txHash": "0x89db41299d20d0484fa1ed27cf247a4460dbf2e1e00d1e577a507a53ea3f9eb6", "dateBlock": "2024-10-03T07:23:12Z", "tokenSymbol": "SOHAIL", "tokenDecimals": "6" }, { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0x5DBba159E6390161544EC50E0dF990d3523cFCB1", "transferValue": "10000000", "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee", "txHash": "0xcb3d7cc9fc7e6ee8178fcb0272922c065983828efc556fecba23402a25e219de", "dateBlock": "2024-09-16T17:19:21Z", "tokenSymbol": "FSPTST", "tokenDecimals": "6" }, { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0xD148A3DC9cB1E03Df39b055AA9774322E6b4890A", "transferValue": "10000000", "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee", "txHash": "0xf647da366f124864724a0890d4a80a61839f5788f5ce0a291db57da05d976133", "dateBlock": "2024-09-16T17:17:51Z", "tokenSymbol": "FSPTST", "tokenDecimals": "6" }, { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0xE55B5AC9dA6bB9876B1c3748EeFE338A54891DC3", "transferValue": "990000", "contractAddress": "0x724F2910D790B54A39a7638282a45B1D83564fFA", "txHash": "0x37d340e17835cfda20e7563bbd6ba6219f11312788cf7550f129a0ef9bbe2f59", "dateBlock": "2024-09-16T11:54:21Z", "tokenSymbol": "GEO", "tokenDecimals": "6" }, { "sender": "0xE55B5AC9dA6bB9876B1c3748EeFE338A54891DC3", "recipient": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "transferValue": "1000000", "contractAddress": "0x724F2910D790B54A39a7638282a45B1D83564fFA", "txHash": "0x66032dd260300217cfe1602a6c8d61ac230a0ca7bdca4069521ed9d38ab47cc3", "dateBlock": "2024-09-16T11:51:36Z", "tokenSymbol": "GEO", "tokenDecimals": "6" }, { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0x8189E86a44b1714D67DeA2201ec55d44f09ceD7b", "transferValue": "1000000", "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee", "txHash": "0xab8f04ef88ed049f5c17b3fed591d2ec531e6b971f56b28e3b7e59390f2bd59f", "dateBlock": "2024-09-13T09:31:01Z", "tokenSymbol": "FSPTST", "tokenDecimals": "6" }, { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0x8189E86a44b1714D67DeA2201ec55d44f09ceD7b", "transferValue": "2000000", "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee", "txHash": "0xee5283c54cab563937c9945bc63e27e8633c1caf6999aedcbbd4338d45b27dc2", "dateBlock": "2024-09-13T06:49:26Z", "tokenSymbol": "FSPTST", "tokenDecimals": "6" }, { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0x8189E86a44b1714D67DeA2201ec55d44f09ceD7b", "transferValue": "1240000", "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee", "txHash": "0x78eab1b870a26d2e7ac6120f286ec31afb7c4936cc5bd1ecaf2acf8603b49a92", "dateBlock": "2024-09-10T12:09:19Z", "tokenSymbol": "FSPTST", "tokenDecimals": "6" }, { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0xf5E1cF48B50f7bf01c57a19A99a026DcC6805a7e", "transferValue": "3650000", "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee", "txHash": "0x224feaa1af977bd155ff6b30895feee5d9e07ef637e4808543b1b9242d5d27c6", "dateBlock": "2024-09-05T10:09:02Z", "tokenSymbol": "FSPTST", "tokenDecimals": "6" }, { "sender": "0xa316408425cF17F1827483dee621c6C3A9B5fad4", "recipient": "0x8189E86a44b1714D67DeA2201ec55d44f09ceD7b", "transferValue": "1000000", "contractAddress": "0x6CC75A06ac72eB4Db2eE22F781F5D100d8ec03ee", "txHash": "0x268b0ff14d45b9369695c0369c4a6c7556ca9e6d8eb01386d3038739bed59fad", "dateBlock": "2024-09-04T05:47:06Z", "tokenSymbol": "FSPTST", "tokenDecimals": "6" } ] } } ```
lash added a new dependency 2024-10-03 14:51:23 +02:00
carlos was assigned by lash 2024-10-07 16:17:34 +02:00
lash removed a dependency 2024-10-28 16:40:37 +01:00
Owner

done

done
lash closed this issue 2024-10-28 16:41:58 +01:00
Author
Owner

Sample request:

GET https://HOST:PORT/api/v1/token/0xd4c288865Ce0985a481Eef3be02443dF5E2e4Ea9

Sample response:

{
   "ok":true,
   "description":"Token details for 0xd4c288865Ce0985a481Eef3be02443dF5E2e4Ea9",
   "result":{
      "":{
         "tokenName":"Sohail's Voucher",
         "tokenSymbol":"SOHAIL",
         "tokenDecimals":"6",
         "sinkAddress":"0x0000000000000000000000000000000000000000"
      }
   }
}
* Token details endpoint: `GET /api/v1/token/:address` * Importable struct for response parsing : https://github.com/grassrootseconomics/ussd-data-service/blob/master/pkg/api/api.go#L36 Sample request: `GET https://HOST:PORT/api/v1/token/0xd4c288865Ce0985a481Eef3be02443dF5E2e4Ea9` Sample response: ```json { "ok":true, "description":"Token details for 0xd4c288865Ce0985a481Eef3be02443dF5E2e4Ea9", "result":{ "":{ "tokenName":"Sohail's Voucher", "tokenSymbol":"SOHAIL", "tokenDecimals":"6", "sinkAddress":"0x0000000000000000000000000000000000000000" } } } ```
lash closed this issue 2024-11-04 14:37:48 +01:00
Sign in to join this conversation.
No Milestone
No project
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: urdt/ussd#88
No description provided.