npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@thallo.io/thallo-exchange-sdk

v1.3.0

Published

The Thallo Exchange NPM SDK allows developers to easily set up and integrate with the Thallo Api

Downloads

22

Readme

Thallo Exchange NPM SDK

Package description

The Thallo Exchange NPM SDK allows developers to easily set up and integrate with the Thallo Api.

Getting started

  1. Install the library npm i @thallo.io/thallo-exchange-sdk

  2. Import the library:

    • Using TS and ESM module:

      import { ThalloApiSdk } from '@thallo.io/thallo-exchange-sdk'
    • CommonJS module:

      const { ThalloApiSdk } = require('@thallo.io/thallo-exchange-sdk')
  3. Create an instance of the Thallo Api Sdk client using your Api key and base url:

    const thalloApiSdk = new ThalloApiSdk({
        apiKey: 'API_KEY',
        baseUrl: 'https://BASE_URL',
    })

Functionality of the Thallo Exchange NPM SDK

  • Get Market data

    • Request code example:

      const response = await thalloApiSdk.marketData.getMarketData()
    • Successful response with market data and pagination example:

      {
          projects: [
              {
                  projectId: '003c1hatqib9jbpwwl',
                  vintages: [
                      {
                          vintageId: '004l7azww8l14bnxio',
                          vintageYear: 2014,
                          sellOrders: [
                              {
                              sellOrderId: '006qhwycj9iruixah7',
                              quantityGrams: '300000000',
                              priceCents: '600'
                              }
                          ]
                      },
                      {
                          vintageId: '004hlpexhy9dec7ef1',
                          vintageYear: 2019,
                          sellOrders: [
                              {
                                  sellOrderId: '0064zoo5hvefhr03yc',
                                  quantityGrams: '100000000',
                                  priceCents: '600'
                              }
                          ]
                      },
                      {
                          vintageId: '00410wiwk6v7q7aa10',
                          vintageYear: 2020,
                          sellOrders: [
                              {
                                  sellOrderId: '006o2wqvztvuzmadov',
                                  quantityGrams: '700000000',
                                  priceCents: '3000'
                              }
                          ]
                      }
                  ]
              }
          ],
          pagination: {
              perPage: 1,
              totalPages: 11,
              totalItems: 11,
              currentPage: 2,
              previousPage: 1,
              nextPage: 3
          }
      }
  • Get Inventory data

    • Request code example:

      const response = await thalloApiSdk.inventory.getInventory()
    • Successful response with inventory data and pagination example:

      {
          projects: [
              {
                  projectId: '003gpwgw7agtv6i9dn',
                  vintages: [
                      {
                          vintageId: '004n6oj3x71236shn2',
                          wallets: [
                              {
                                  type: 'CAAS',
                                  quantityGrams: 999959n,
                                  trades: [
                                      {
                                          executionDate: '2023-08-18T08:39:35.141Z',
                                          quantityGrams: 1000000n,
                                          priceCents: 20n,
                                          type: 'BUY'
                                      }
                                  ]
                              }
                          ]
                      }
                  ]
              }
          ],
          pagination: {
              perPage: 1,
              totalPages: 11,
              totalItems: 11,
              currentPage: 2,
              previousPage: 1,
              nextPage: 3
          }
      }
  • Get Project data:

    • Request code example:

      const response = await thalloApiSdk.projectData.getProjectData({
          projectIds: ['003c1hatqib9jbpwwl'],
      })
    • Successful response example:

      {
          projects: [
              {
                  projectId: '003c1hatqib9jbpwwl',
                  projectName: 'Project 10',
                  type: 'Hydro',
                  location: 'TD',
                  registryProjectUrl: 'https://registry.verra.org/app/projectDetail/CCB/904',
                  sdgs: [
                      'Life Below Water',
                      'Gender Equality',
                      'Infrastructure',
                      'Quality Education',
                      'Zero Hunger',
                      'Health and Well Being',
                      'No Poverty',
                      'Water Benefit',
                      'Economic Growth',
                  ],
                  registryId: '0050yd569dw0qbw5oy',
                  registryName: 'VERRA',
                  description:
                      'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
                  vintages: [
                      {
                          vintageId: '004l7azww8l14bnxio',
                          vintageYear: 2014,
                          registryVintageUrl:
                              'https://registry.verra.org/app/projectDetail/CCB/904',
                      },
                      {
                          vintageId: '004hlpexhy9dec7ef1',
                          vintageYear: 2019,
                          registryVintageUrl:
                              'https://registry.verra.org/app/projectDetail/CCB/904',
                      },
                      {
                          vintageId: '00410wiwk6v7q7aa10',
                          vintageYear: 2020,
                          registryVintageUrl:
                              'https://registry.verra.org/app/projectDetail/CCB/904',
                      },
                  ],
              },
          ]
      }
  • Retire credits by the gram and automatically top-up inventory if required.

    • Request code sample:

      const responseData = await thalloApiSdk.requestRetirement.requestRetirement({
          vintageId: '00410wiwk6v7q7aa10',
          quantityGrams: '50',
          sellOrderId: '006o2wqvztvuzmadov',
          expectedPriceCents: '3000',
          externalId: '8964e68e-8c7d-4d77-9196-66635bf7a340',
          externalRetireeId: '0eb0dc50-2a9a-4289-bf61-fe298172464e',
          shouldRetireExternalCustomer: false,
          externalRetireeName: 'Alice Bob',
          externalRetireeLocation: 'AU',
          externalRetireeTaxId: '123456789',
      })
    • Successful response:

      { retirementRequestId: '00maxwb1x2ltjgh4ob', externalIdAlreadyProcessed: false }
  • Get Retirement details.

    • Request code sample:

      const responseData = await thalloApiSdk.retirement.getRetirement('00maxwb1x2ltjgh4ob')
    • Successful response:

      {
          id: "00maxwb1x2ltjgh4ob",
          status: "OPEN",
          totalQuantity: "4000100",
          type: "FRACTIONALISED",
          projectId: "003tcfgf70xwtr1dbc",
          vintageId: "004o7rnsz29fptz9uo",
          createdAt: 2024-02-05T10:51:12.319Z,
          retiredAt: undefined,
          retiredSerialNumbers: undefined,
          thalloProofOfRetirementCertificateUrl: undefined,
          shouldRetireExternalCustomer: false,
          allInvoicesSettled: false,
          retirementRequestItems: [
              {
                  id: "00p6y5rap05wpwt7km",
                  quantity: "1000050",
                  createdAt: 2024-02-05T10:51:12.319Z,
                  retireeName: "Thallo Ltd",
                  retireeTaxId: "123456789",
                  retireeCountry: "GB",
                  invoiceId: "00iy2jbppp8kwwg7vl",
                  tradeId: "00gr2tgn2wbq8barqs"
              },
              {
                  id: "00pm1b32j6mmj9xgyp",
                  quantity: "3000050",
                  createdAt: 2024-02-05T10:52:28.902Z,
                  retireeName: "Thallo Ltd",
                  retireeTaxId: "123456789",
                  retireeCountry: "GB",
                  invoiceId: "00iy2jbppp8kwwg7vl",
                  tradeId: "00gwapftj8tr7o2s4c"
              }
          ]
      }

Build

To remove the lib dir and rebuild:

npm run build:clean

Else:

npm run build

This will generate 3 folders:

  • cjs
  • esm
  • types

This enables people to import either CommonJS or ESM and also provides d.ts files for typescript typings

License

MIT