diff --git a/README.md b/README.md index d244d58..82b0936 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Before you can make Subgraph queries, you need to set `GRAPH_API_KEY` in your `. Instantiate the ToucanClient and set a `signer` & `provider` to interact with our infrastructure. -We recommend using to use [ethers.js ^5.6.4](https://docs.ethers.org/v5/api/signer/) for the signer and provider. When you are considering using [wagmi](https://0.3.x.wagmi.sh/docs/hooks/useSigner), only versions under 1.0 will work as this library has not yet been upgraded to viem. +We recommend using [ethers.js ^5.6.4](https://docs.ethers.org/v5/api/signer/) for the signer and provider. When you are considering using [wagmi](https://0.3.x.wagmi.sh/docs/hooks/useSigner), only versions under 1.0 will work as this library has not yet been upgraded to viem. ### [ethers.js](https://docs.ethers.org/v5/api/signer/) @@ -76,7 +76,7 @@ toucan.setSigner(signer); If you don't have a signer nor a provider set, you can only interact with the subgraph. -## Fetch pool prices from a Dex +## Fetch pool prices from a DEX IMPORTANT: _Fetching pool prices is currently not working. We are working on a fix for this._ @@ -102,7 +102,7 @@ The object returned by the above method will look like this: # Interact with Toucan's Contracts? -You can always access any method or property of the BCT, NCT and TCO2 [contracts](https://github.com/ToucanProtocol/contracts) by first getting and storing them in a variable, like this: +You can always access any method or property of the pool and TCO2 [contracts](https://github.com/ToucanProtocol/contracts) by first getting and storing them in a variable, like this: ```typescript toucan.setSigner(signer); @@ -119,7 +119,7 @@ It's important to note that, if you want to use write methods you need to have a ## Example to retire Carbon Credits -To retire Carbon Credits on mainnet, you will have to get Carbon Pool Tokens from a DEX like [Uniswap](https://uniswap.org), which you need to redeem for TCO2s. You can then retire these and get a certificate for that. If you already own NCTs, you can follow this example. In case you don't and are developing on testnet, you can also just get some at the [Toucan Faucet](https://faucet.toucan.earth). You can find more ways to retire in our [documentation](https://docs.toucan.earth/toucan/dev-resources/smart-contracts/tco2). +To retire Carbon Credits on mainnet, you will have to get Carbon Pool Tokens from a DEX like [Uniswap](https://uniswap.org), which you need to redeem for TCO2s. You can then retire TCO2s and get a certificate for the retirement. If you already own NCTs, you can follow this example. In case you don't and are developing on testnet, you can also just get some at the [Toucan Faucet](https://faucet.toucan.earth). You can find more ways to retire in our [documentation](https://docs.toucan.earth/developers/smart-contracts/tco2). **Redeem your Pool Tokens and get an array of redeemed TCO2s** @@ -139,7 +139,7 @@ Now, the above example of selective retirement is only useful in specific cases. **What if you only have the name or symbol of the project?** -That's where subgraph queries come in handy. (and we have plenty of those 😉) - But feel free to also [create your own](#custom-queries). +That's where subgraph queries come in handy (and we have plenty of those 😉) - but feel free to also [create your own](#custom-queries). **_Make sure all addresses are input in lowercase letters, as the queries are case sensitive._** @@ -213,7 +213,7 @@ await toucan.fetchAggregations(); Now that you have an overview of our pre-build queries, let's have a look at the `fetchCustomQuery` method. -This allows you to fetch with your own queries and can be very powerful if you know graphQL. You can also check out a lot of example queries in our Subgraph playgrounds: +This allows you to fetch with your own queries and can be very powerful if you know GraphQL. You can also check out a lot of example queries in our Subgraph playgrounds: - [Matic](https://thegraph.com/explorer/subgraphs/FU5APMSSCqcRy9jy56aXJiGV3PQmFQHg2tzukvSJBgwW) - [Celo](https://thegraph.com/explorer/subgraphs/BWmN569zDopYXp3nzDukJsGDHqRstYAFULFPH8rxyVBk) @@ -253,7 +253,7 @@ const result = await toucan.fetchCustomQuery(query, { id: "1" }); Using the OffsetHelper methods is the easiest way to offset CO2 right now as it handles the whole process for you. -_(Uses Ubeswap/SushiSwap to acquire BCT/NCT, redeems it for TCO2s and retires them)_ +_(Uses Ubeswap/SushiSwap to acquire pool tokens, redeems pool tokens for TCO2s and retires TCO2s)_ This is how you do that when you want to use ETH (or the network's native currency) in your balance. @@ -280,9 +280,9 @@ const offsetReceipt = await toucan.autoOffsetExactInToken( ); ``` -### Offset with your own BCT/NCT +### Offset with your pool tokens -If you already have BCT/NCT, you can use `autoOffsetPoolToken()` like this: +If you already have pool tokens (eg. NCT,) you can use `autoOffsetPoolToken()` like this: ```typescript const offsetReceipt = await toucan.autoOffsetPoolToken( diff --git a/docs/README.md b/docs/README.md index c58b4c1..302ef45 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,7 +12,7 @@ For the full documentation, check our [docs](https://docs.toucan.earth/toucan/de ⚠️ This SDK is heavily under development. USE AT YOUR OWN RISK. ⚠️ -## Install +## Install and setup ``` npm i toucan-sdk @@ -24,13 +24,45 @@ or yarn add toucan-sdk ``` +Now, copy `.env.example` to `.env`. + +Before you can make Subgraph queries, you need to set `GRAPH_API_KEY` in your `.env` file. You can create an API key in [The Graph Studio](https://thegraph.com/studio/apikeys/) after connecting your wallet. + # Quickstart Instantiate the ToucanClient and set a `signer` & `provider` to interact with our infrastructure. +We recommend using [ethers.js ^5.6.4](https://docs.ethers.org/v5/api/signer/) for the signer and provider. When you are considering using [wagmi](https://0.3.x.wagmi.sh/docs/hooks/useSigner), only versions under 1.0 will work as this library has not yet been upgraded to viem. + +### [ethers.js](https://docs.ethers.org/v5/api/signer/) + ```typescript import ToucanClient from "toucan-sdk"; +import { ethers } from "ethers"; + +// ethers signer and provider +const provider = new ethers.providers.JsonRpcProvider( + "https://rpc.ankr.com/polygon" +); + +// make sure to set your private key in your .env file +const signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider); +// set signer & provider +const toucan = new ToucanClient("alfajores", provider, signer); +``` + +### [wagmi](https://0.3.x.wagmi.sh/docs/hooks/useSigner) + +```typescript +import { ToucanClient } from "toucan-sdk"; +import { useProvider, useSigner } from "wagmi"; + +// get signer & provider +const { data: signer } = useSigner(); +const provider = useProvider(); + +// set signer & provider const toucan = new ToucanClient("alfajores", provider, signer); ``` @@ -46,7 +78,10 @@ toucan.setSigner(signer); If you don't have a signer nor a provider set, you can only interact with the subgraph. -## Fetch pool prices from a Dex +## Fetch pool prices from a DEX + +IMPORTANT: +_Fetching pool prices is currently not working. We are working on a fix for this._ You can find pools for Toucan pool tokens on [Celo Network](https://celo.org) at [Uniswap](https://uniswap.org/) and for [Polygon Network](https://polygon.technology) on [SushiSwap](sushi.com). @@ -69,7 +104,7 @@ The object returned by the above method will look like this: # Interact with Toucan's Contracts? -You can always access any method or property of the BCT, NCT and TCO2 [contracts](https://github.com/ToucanProtocol/contracts) by first getting and storing them in a variable, like this: +You can always access any method or property of the pool and TCO2 [contracts](https://github.com/ToucanProtocol/contracts) by first getting and storing them in a variable, like this: ```typescript toucan.setSigner(signer); @@ -86,12 +121,12 @@ It's important to note that, if you want to use write methods you need to have a ## Example to retire Carbon Credits -To retire Carbon Credits on mainnet, you will have to get Carbon Pool Tokens from a DEX like [Uniswap](https://uniswap.org), which you need to redeem for TCO2s. You can then retire these and get a certificate for that. If you already own NCTs, you can follow this example. In case you don't and are developing on testnet, you can also just get some at the [Toucan Faucet](https://faucet.toucan.earth). You can find more ways to retire in our [documentation](https://docs.toucan.earth/toucan/dev-resources/smart-contracts/tco2). +To retire Carbon Credits on mainnet, you will have to get Carbon Pool Tokens from a DEX like [Uniswap](https://uniswap.org), which you need to redeem for TCO2s. You can then retire TCO2s and get a certificate for the retirement. If you already own NCTs, you can follow this example. In case you don't and are developing on testnet, you can also just get some at the [Toucan Faucet](https://faucet.toucan.earth). You can find more ways to retire in our [documentation](https://docs.toucan.earth/developers/smart-contracts/tco2). **Redeem your Pool Tokens and get an array of redeemed TCO2s** ```typescript -const tco2Addresses = await toucan.redeemAuto2("NCT", parseEther("1")); +const tco2Addresses = await toucan.redeemAuto("NCT", parseEther("1")); ``` **Retire the Carbon Credits** @@ -106,7 +141,7 @@ Now, the above example of selective retirement is only useful in specific cases. **What if you only have the name or symbol of the project?** -That's where subgraph queries come in handy. (and we have plenty of those 😉) - But feel free to also [create your own](#custom-queries). +That's where subgraph queries come in handy (and we have plenty of those 😉) - but feel free to also [create your own](#custom-queries). **_Make sure all addresses are input in lowercase letters, as the queries are case sensitive._** @@ -135,12 +170,12 @@ The result will look like this: Now you have quite some info on the project, including its address. -## All queries: +## All queries Toucan SDK offers a lot of pre-defined queries. Try them out! ```typescript -import ToucanClient from "toucan-sdk"; +import { ToucanClient } from "toucan-sdk"; // here we don't need to set the signer or provider const toucan = new ToucanClient("alfajores"); @@ -180,13 +215,20 @@ await toucan.fetchAggregations(); Now that you have an overview of our pre-build queries, let's have a look at the `fetchCustomQuery` method. -This allows you to fetch with your own queries and can be very powerful if you know graphQL. You can also check out a lot of example queries in our subgraph [playgrounds](https://thegraph.com/hosted-service/subgraph/toucanprotocol/matic). +This allows you to fetch with your own queries and can be very powerful if you know GraphQL. You can also check out a lot of example queries in our Subgraph playgrounds: + +- [Matic](https://thegraph.com/explorer/subgraphs/FU5APMSSCqcRy9jy56aXJiGV3PQmFQHg2tzukvSJBgwW) +- [Celo](https://thegraph.com/explorer/subgraphs/BWmN569zDopYXp3nzDukJsGDHqRstYAFULFPH8rxyVBk) +- [Base](https://thegraph.com/explorer/subgraphs/AEJ5PEDye6Z198HRQBioG6mZ6ZacHenBg2HTopZPsUCi) +- [Alfajores](https://thegraph.com/explorer/subgraphs/4uY2L3vQW8XKYPrFFk4i6ZuJkgbpJ8SbJayc8wzMBRYw) +- [Base Sepolia](https://thegraph.com/explorer/subgraphs/2oKCq3rDwdYPSao4UbDZKSNbawEdhBVf3BxmqJzFe1uj) +- [Amoy](https://thegraph.com/explorer/subgraphs/FKzFZuYHxyHiiDmdW9Qvwtet1Ad1ERsvjWMhhqd9V8pk) - Getting all infos on a carbon project (`region` stands for the country) ```typescript import { gql } from "@urql/core"; -import ToucanClient from "toucan-sdk"; +import { ToucanClient } from "toucan-sdk"; const toucan = new ToucanClient("alfajores"); @@ -213,7 +255,7 @@ const result = await toucan.fetchCustomQuery(query, { id: "1" }); Using the OffsetHelper methods is the easiest way to offset CO2 right now as it handles the whole process for you. -_(Uses Ubeswap/SushiSwap to acquire BCT/NCT, redeems it for TCO2s and retires them)_ +_(Uses Ubeswap/SushiSwap to acquire pool tokens, redeems pool tokens for TCO2s and retires TCO2s)_ This is how you do that when you want to use ETH (or the network's native currency) in your balance. @@ -240,9 +282,9 @@ const offsetReceipt = await toucan.autoOffsetExactInToken( ); ``` -### Offset with your own BCT/NCT +### Offset with your pool tokens -If you already have BCT/NCT, you can use `autoOffsetPoolToken()` like this: +If you already have pool tokens (eg. NCT,) you can use `autoOffsetPoolToken()` like this: ```typescript const offsetReceipt = await toucan.autoOffsetPoolToken( @@ -284,7 +326,7 @@ If you do, that's also quite easy to pull off. You just replace the usage of the ```typescript const retirementReceipt = await toucan.retireAndMintCertificate( "Alice", - signer.address, + bobsAddress, "Bob", "Just helping the planet", parseEther("3.0"), @@ -292,8 +334,6 @@ const retirementReceipt = await toucan.retireAndMintCertificate( ); ``` -Why do you see my name twice you ask? 🤔 - -Well, the first "Alice" represents the entity that is doing the retirement/offset. The second one represents the party that 'benefits' from it, in this case "Bob". We will also add Bob's address so now the relation of the certificate is set to that address instead of the retiring party. +"Alice" represents the entity that is doing the retirement/offset. The second name represents the party that 'benefits' from it, in this case "Bob". We will also add Bob's address so now the relation of the certificate is set to that address instead of the retiring party. This useful in case you happen to be an entity that retires on behalf of someone else. diff --git a/docs/classes/default.md b/docs/classes/default.md index 4aed8a1..08c9ccc 100644 --- a/docs/classes/default.md +++ b/docs/classes/default.md @@ -79,15 +79,15 @@ ContractInteractions, SubgraphInteractions #### Parameters -| Name | Type | Description | -| :---------- | :--------- | :------------------------------------- | -| `network` | `Network` | network that you want to work on | +| Name | Type | Description | +| :------ | :------ | :------ | +| `network` | `Network` | network that you want to work on | | `provider?` | `Provider` | to be able to read from the blockchain | -| `signer?` | `Signer` | to be able to sign transactions | +| `signer?` | `Signer` | to be able to sign transactions | #### Defined in -[index.ts:69](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L69) +[index.ts:71](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L71) ## Properties @@ -97,9 +97,9 @@ ContractInteractions, SubgraphInteractions #### Defined in -[index.ts:60](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L60) +[index.ts:62](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L62) ---- +___ ### fetchAggregations @@ -111,9 +111,9 @@ fetch all aggregations (including, for example, tco2TotalRetired or totalCarbonB #### Defined in -[index.ts:805](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L805) +[index.ts:808](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L808) ---- +___ ### fetchAllTCO2Tokens @@ -125,9 +125,9 @@ fetches TCO2Details of all TCO2s #### Defined in -[index.ts:682](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L682) +[index.ts:685](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L685) ---- +___ ### fetchBridgedBatchTokens @@ -139,9 +139,9 @@ fetches data about BatchTokens that have been bridged #### Defined in -[index.ts:695](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L695) +[index.ts:698](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L698) ---- +___ ### fetchCustomQuery @@ -161,9 +161,9 @@ any parameters you may want to pass to the query #### Defined in -[index.ts:820](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L820) +[index.ts:823](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L823) ---- +___ ### fetchPoolContents @@ -187,9 +187,9 @@ how many (if any) retirements you want skipped; defaults to 0 #### Defined in -[index.ts:774](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L774) +[index.ts:777](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L777) ---- +___ ### fetchProjectById @@ -205,9 +205,9 @@ id of the project to fetch; e.g.: "10" #### Defined in -[index.ts:792](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L792) +[index.ts:795](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L795) ---- +___ ### fetchRedeems @@ -231,9 +231,9 @@ how many (if any) redeems you want skipped; defaults to 0 #### Defined in -[index.ts:735](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L735) +[index.ts:738](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L738) ---- +___ ### fetchTCO2TokenByFullSymbol @@ -249,9 +249,9 @@ full symbol of the TCO2 to query for e.g.: "TCO2-VCS-1718-2013" #### Defined in -[index.ts:671](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L671) +[index.ts:674](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L674) ---- +___ ### fetchTCO2TokenById @@ -267,9 +267,9 @@ id of the TCO2 to query for; the id happens to be the same as the address e.g.: #### Defined in -[index.ts:661](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L661) +[index.ts:664](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L664) ---- +___ ### fetchUserBatches @@ -285,9 +285,9 @@ address of user to query for #### Defined in -[index.ts:647](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L647) +[index.ts:650](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L650) ---- +___ ### fetchUserRedeems @@ -315,9 +315,9 @@ how many (if any) redeems you want skipped; defaults to 0 #### Defined in -[index.ts:748](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L748) +[index.ts:751](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L751) ---- +___ ### fetchUserRetirements @@ -341,9 +341,9 @@ how many (if any) retirements you want skipped; defaults to 0 #### Defined in -[index.ts:711](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L711) +[index.ts:714](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L714) ---- +___ ### network @@ -351,9 +351,9 @@ how many (if any) retirements you want skipped; defaults to 0 #### Defined in -[index.ts:59](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L59) +[index.ts:61](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L61) ---- +___ ### provider @@ -361,9 +361,9 @@ how many (if any) retirements you want skipped; defaults to 0 #### Defined in -[index.ts:58](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L58) +[index.ts:60](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L60) ---- +___ ### signer @@ -371,9 +371,9 @@ how many (if any) retirements you want skipped; defaults to 0 #### Defined in -[index.ts:57](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L57) +[index.ts:59](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L59) ---- +___ ### subgraphInteractions @@ -381,7 +381,7 @@ how many (if any) retirements you want skipped; defaults to 0 #### Defined in -[index.ts:61](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L61) +[index.ts:63](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L63) ## Methods @@ -391,10 +391,10 @@ how many (if any) retirements you want skipped; defaults to 0 #### Parameters -| Name | Type | Description | -| :------- | :----------- | :--------------------------------------------------------------------------------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use e.g., "NCT" | -| `amount` | `BigNumber` | the amount of native tokens e.g., MATIC to swap into Toucan pool token. Full amount will be used for offsetting. | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use e.g., "NCT" | +| `amount` | `BigNumber` | the amount of native tokens e.g., MATIC to swap into Toucan pool token. Full amount will be used for offsetting. | #### Returns @@ -412,26 +412,25 @@ This method may take up to 1 minute to return a result #### Defined in -[index.ts:511](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L511) +[index.ts:514](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L514) ---- +___ ### autoOffsetExactInToken ▸ **autoOffsetExactInToken**(`swapToken`, `pool`, `amount`): `Promise`<`ContractReceipt`\> -/\*\* - -- -- +/** + * + * #### Parameters -| Name | Type | Description | -| :---------- | :----------- | :---------------------------------------------------------------------------------------------------- | -| `swapToken` | `string` | portal for the token to swap into pool tokens (only accepts WETH, WMATIC and USDC) \* | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use \* | -| `amount` | `BigNumber` | the amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting. \* | +| Name | Type | Description | +| :------ | :------ | :------ | +| `swapToken` | `string` | portal for the token to swap into pool tokens (only accepts WETH, WMATIC and USDC) * | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use * | +| `amount` | `BigNumber` | the amount of ERC20 token to swap into Toucan pool token. Full amount will be used for offsetting. * | #### Returns @@ -442,29 +441,26 @@ The offset transaction. **`Description`** retires carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending ERC20 - -- tokens (cUSD, USDC, WETH, WMATIC). All provided tokens are consumed for offsetting. -- + * tokens (cUSD, USDC, WETH, WMATIC). All provided tokens are consumed for offsetting. + * **`Notice`** this method needs two different actions signed and may take up to 1 minute to return a result - -- + * **`Dev`** When automatically redeeming pool tokens for the oldest ones - -- TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool -- token. -- + * TCO2s there are no fees and you receive exactly 1 TCO2 token for 1 pool + * token. + * #### Defined in -[index.ts:459](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L459) +[index.ts:462](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L462) ---- +___ ### autoOffsetExactOutETH @@ -472,10 +468,10 @@ When automatically redeeming pool tokens for the oldest ones #### Parameters -| Name | Type | Description | -| :------- | :----------- | :----------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `amount` | `BigNumber` | The amount of CO2 tons to offset | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | +| `amount` | `BigNumber` | The amount of CO2 tons to offset | #### Returns @@ -485,11 +481,11 @@ The offset transaction. **`Description`** -retires a specified amount of carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending a native token e.g. MATIC. +retires a specified amount of carbon credits using the oldest TCO2 tokens available from the specified Toucan token pool by sending a native token e.g. MATIC. **`Dev`** -Use `calculateNeededETHAmount()` first in order to find out how much of the native token e.g. MATIC is required to retire the specified quantity of TCO2. If the user sends much native token e.g. MATIC, the leftover amount will be sent back to the user. +Use `calculateNeededETHAmount()` first in order to find out how much of the native token e.g. MATIC is required to retire the specified quantity of TCO2. If the user sends much native token e.g. MATIC, the leftover amount will be sent back to the user. **`Notice`** @@ -497,9 +493,9 @@ This method may take up to 1 minute to return a result #### Defined in -[index.ts:488](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L488) +[index.ts:491](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L491) ---- +___ ### autoOffsetExactOutToken @@ -507,11 +503,11 @@ This method may take up to 1 minute to return a result #### Parameters -| Name | Type | Description | -| :---------- | :----------- | :--------------------------------------------------------------------------------- | -| `swapToken` | `string` | portal for the token to swap into pool tokens (only accepts WETH, WMATIC and USDC) | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `amount` | `BigNumber` | The amount of CO2 tons to offset | +| Name | Type | Description | +| :------ | :------ | :------ | +| `swapToken` | `string` | portal for the token to swap into pool tokens (only accepts WETH, WMATIC and USDC) | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | +| `amount` | `BigNumber` | The amount of CO2 tons to offset | #### Returns @@ -521,7 +517,7 @@ The offset transaction. **`Description`** -retires a specified amount of carbon credits using the lowest +retires a specified amount of carbon credits using the lowest quality (oldest) TCO2 tokens available from the specified Toucan token pool by sending ERC20 tokens (cUSD, USDC, WETH, WMATIC). @@ -531,9 +527,9 @@ this method needs two different actions signed and may take up to 1 minute to re #### Defined in -[index.ts:424](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L424) +[index.ts:427](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L427) ---- +___ ### autoOffsetPoolToken @@ -541,10 +537,10 @@ this method needs two different actions signed and may take up to 1 minute to re #### Parameters -| Name | Type | Description | -| :------- | :----------- | :----------------------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool token to offset, e.g., NCT | -| `amount` | `BigNumber` | The amount of of TCO2 to offset. | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool token to offset, e.g., NCT | +| `amount` | `BigNumber` | The amount of of TCO2 to offset. | #### Returns @@ -563,9 +559,9 @@ This method may take up to 1 minute to return a result #### Defined in -[index.ts:402](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L402) +[index.ts:405](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L405) ---- +___ ### calculateExpectedPoolTokenForETH @@ -573,16 +569,16 @@ This method may take up to 1 minute to return a result #### Parameters -| Name | Type | Description | -| :------- | :----------- | :--------------------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `amount` | `BigNumber` | The amount of native tokens to swap for, e.g., MATIC | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | +| `amount` | `BigNumber` | The amount of native tokens to swap for, e.g., MATIC | #### Returns `Promise`<`BigNumber`\> -amount The expected amount of Pool token that can be acquired. +amount The expected amount of Pool token that can be acquired. **`Description`** @@ -591,9 +587,9 @@ acquired by swapping the provided amount of native tokens e.g., MATIC. #### Defined in -[index.ts:621](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L621) +[index.ts:624](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L624) ---- +___ ### calculateExpectedPoolTokenForToken @@ -601,17 +597,17 @@ acquired by swapping the provided amount of native tokens e.g., MATIC. #### Parameters -| Name | Type | Description | -| :---------- | :----------- | :------------------------------------------------------- | -| `swapToken` | `string` | The ERC20 token used for the swap | -| `pool` | `PoolSymbol` | The pool symbol of the pool token to swap for, e.g., NCT | -| `amount` | `BigNumber` | The amount of ERC20 token to swap | +| Name | Type | Description | +| :------ | :------ | :------ | +| `swapToken` | `string` | The ERC20 token used for the swap | +| `pool` | `PoolSymbol` | The pool symbol of the pool token to swap for, e.g., NCT | +| `amount` | `BigNumber` | The amount of ERC20 token to swap | #### Returns `Promise`<`BigNumber`\> -amount The expected amount of Pool token that can be acquired. +amount The expected amount of Pool token that can be acquired. **`Description`** @@ -620,9 +616,9 @@ acquired by swapping the provided amount of ERC20 token. #### Defined in -[index.ts:592](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L592) +[index.ts:595](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L595) ---- +___ ### calculateNeededETHAmount @@ -630,10 +626,10 @@ acquired by swapping the provided amount of ERC20 token. #### Parameters -| Name | Type | Description | -| :------- | :----------- | :------------------------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool token to swap for, e.g., NCT | -| `amount` | `BigNumber` | The desired amount of pool token to receive | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool token to swap for, e.g., NCT | +| `amount` | `BigNumber` | The desired amount of pool token to receive | #### Returns @@ -649,9 +645,9 @@ desired amount of a Toucan pool token, e.g., NCT. #### Defined in -[index.ts:565](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L565) +[index.ts:568](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L568) ---- +___ ### calculateNeededTokenAmount @@ -659,17 +655,17 @@ desired amount of a Toucan pool token, e.g., NCT. #### Parameters -| Name | Type | Description | -| :---------- | :----------- | :------------------------------------------------------- | -| `swapToken` | `string` | The ERC20 token used for the swap | -| `pool` | `PoolSymbol` | The pool symbol of the pool token to swap for, e.g., NCT | -| `amount` | `BigNumber` | The desired amount of pool token to receive | +| Name | Type | Description | +| :------ | :------ | :------ | +| `swapToken` | `string` | The ERC20 token used for the swap | +| `pool` | `PoolSymbol` | The pool symbol of the pool token to swap for, e.g., NCT | +| `amount` | `BigNumber` | The desired amount of pool token to receive | #### Returns `Promise`<`BigNumber`\> -amount of the ERC20 token required in order to +amount of the ERC20 token required in order to swap for the specified amount of the pool token. **`Description`** @@ -680,9 +676,9 @@ example, e.g., NCT. #### Defined in -[index.ts:535](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L535) +[index.ts:538](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L538) ---- +___ ### calculateRedeemFees @@ -690,11 +686,11 @@ example, e.g., NCT. #### Parameters -| Name | Type | Description | -| :-------- | :------------ | :----------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `tco2s` | `string`[] | array of TCO2 contract addresses | -| `amounts` | `BigNumber`[] | array of amounts to redeem for each tco2s | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | +| `tco2s` | `string`[] | array of TCO2 contract addresses | +| `amounts` | `BigNumber`[] | array of amounts to redeem for each tco2s | #### Returns @@ -712,9 +708,9 @@ tco2s must match amounts; amounts[0] is the amount of tco2[0] token to redeem fo #### Defined in -[index.ts:272](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L272) +[index.ts:274](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L274) ---- +___ ### checkEligible @@ -722,10 +718,10 @@ tco2s must match amounts; amounts[0] is the amount of tco2[0] token to redeem fo #### Parameters -| Name | Type | Description | -| :----- | :----------- | :----------------------------------------- | +| Name | Type | Description | +| :------ | :------ | :------ | | `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `tco2` | `string` | address of TCO2 to deposit | +| `tco2` | `string` | address of TCO2 to deposit | #### Returns @@ -739,9 +735,9 @@ checks if TCO2 is eligible for pool #### Defined in -[index.ts:252](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L252) +[index.ts:254](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L254) ---- +___ ### checkIfTCO2 @@ -749,8 +745,8 @@ checks if TCO2 is eligible for pool #### Parameters -| Name | Type | Description | -| :-------- | :------- | :--------------------------- | +| Name | Type | Description | +| :------ | :------ | :------ | | `address` | `string` | address of contract to check | #### Returns @@ -765,9 +761,9 @@ checks if an address represents a TCO2 #### Defined in -[index.ts:379](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L379) +[index.ts:382](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L382) ---- +___ ### depositTCO2 @@ -775,11 +771,11 @@ checks if an address represents a TCO2 #### Parameters -| Name | Type | Description | -| :------------ | :----------- | :----------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `amount` | `BigNumber` | The amount of TCO2s to deposit | -| `tco2Address` | `string` | address of the TCO2 token to deposit\* | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | +| `amount` | `BigNumber` | The amount of TCO2s to deposit | +| `tco2Address` | `string` | address of the TCO2 token to deposit* | #### Returns @@ -793,43 +789,43 @@ deposits TCO2s in the pool which mints a pool token for the user #### Defined in -[index.ts:229](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L229) +[index.ts:231](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L231) ---- +___ ### fetchTokenPriceOnDex -▸ **fetchTokenPriceOnDex**(`pool`): `Promise`<{ `liquidityUSD`: `null` \| `number` ; `price`: `null` \| `number` ; `url`: `null` \| `string` ; `volumeUSD`: `null` \| `number` }\> +▸ **fetchTokenPriceOnDex**(`pool`): `Promise`<{ `liquidityUSD`: ``null`` \| `number` ; `price`: ``null`` \| `number` ; `url`: ``null`` \| `string` ; `volumeUSD`: ``null`` \| `number` }\> #### Parameters -| Name | Type | -| :----- | :----------- | +| Name | Type | +| :------ | :------ | | `pool` | `PoolSymbol` | #### Returns -`Promise`<{ `liquidityUSD`: `null` \| `number` ; `price`: `null` \| `number` ; `url`: `null` \| `string` ; `volumeUSD`: `null` \| `number` }\> +`Promise`<{ `liquidityUSD`: ``null`` \| `number` ; `price`: ``null`` \| `number` ; `url`: ``null`` \| `string` ; `volumeUSD`: ``null`` \| `number` }\> #### Defined in -[index.ts:830](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L830) +[index.ts:836](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L836) ---- +___ ### getAttributes -▸ **getAttributes**(`tco2Address`): `Promise`<[[`string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`] & { `category`: `string` ; `controller`: `string` ; `emissionType`: `string` ; `method`: `string` ; `methodology`: `string` ; `projectId`: `string` ; `region`: `string` ; `standard`: `string` ; `storageMethod`: `string` ; `uri`: `string` }, [`string`, `BigNumber`, `BigNumber`, `BigNumber`, `BigNumber`, `boolean`, `boolean`, `string`, `string`, `string`, `string`] & { `additionalCertification`: `string` ; `coBenefits`: `string` ; `correspAdjustment`: `string` ; `endTime`: `BigNumber` ; `isCCPcompliant`: `boolean` ; `isCorsiaCompliant`: `boolean` ; `name`: `string` ; `projectTokenId`: `BigNumber` ; `startTime`: `BigNumber` ; `totalVintageQuantity`: `BigNumber` ; `uri`: `string` }]\> +▸ **getAttributes**(`tco2Address`): `Promise`<[[`string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`] & { `category`: `string` ; `controller`: `string` ; `emissionType`: `string` ; `method`: `string` ; `methodology`: `string` ; `projectId`: `string` ; `region`: `string` ; `standard`: `string` ; `storageMethod`: `string` ; `uri`: `string` }, [`string`, `BigNumber`, `BigNumber`, `BigNumber`, `BigNumber`, `boolean`, `boolean`, `string`, `string`, `string`, `string`] & { `additionalCertification`: `string` ; `coBenefits`: `string` ; `correspAdjustment`: `string` ; `endTime`: `BigNumber` ; `isCCPcompliant`: `boolean` ; `isCorsiaCompliant`: `boolean` ; `name`: `string` ; `projectTokenId`: `BigNumber` ; `startTime`: `BigNumber` ; `totalVintageQuantity`: `BigNumber` ; `uri`: `string` }]\> #### Parameters -| Name | Type | Description | -| :------------ | :------- | :------------------------ | +| Name | Type | Description | +| :------ | :------ | :------ | | `tco2Address` | `string` | address of the TCO2 token | #### Returns -`Promise`<[[`string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`] & { `category`: `string` ; `controller`: `string` ; `emissionType`: `string` ; `method`: `string` ; `methodology`: `string` ; `projectId`: `string` ; `region`: `string` ; `standard`: `string` ; `storageMethod`: `string` ; `uri`: `string` }, [`string`, `BigNumber`, `BigNumber`, `BigNumber`, `BigNumber`, `boolean`, `boolean`, `string`, `string`, `string`, `string`] & { `additionalCertification`: `string` ; `coBenefits`: `string` ; `correspAdjustment`: `string` ; `endTime`: `BigNumber` ; `isCCPcompliant`: `boolean` ; `isCorsiaCompliant`: `boolean` ; `name`: `string` ; `projectTokenId`: `BigNumber` ; `startTime`: `BigNumber` ; `totalVintageQuantity`: `BigNumber` ; `uri`: `string` }]\> +`Promise`<[[`string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`, `string`] & { `category`: `string` ; `controller`: `string` ; `emissionType`: `string` ; `method`: `string` ; `methodology`: `string` ; `projectId`: `string` ; `region`: `string` ; `standard`: `string` ; `storageMethod`: `string` ; `uri`: `string` }, [`string`, `BigNumber`, `BigNumber`, `BigNumber`, `BigNumber`, `boolean`, `boolean`, `string`, `string`, `string`, `string`] & { `additionalCertification`: `string` ; `coBenefits`: `string` ; `correspAdjustment`: `string` ; `endTime`: `BigNumber` ; `isCCPcompliant`: `boolean` ; `isCorsiaCompliant`: `boolean` ; `name`: `string` ; `projectTokenId`: `BigNumber` ; `startTime`: `BigNumber` ; `totalVintageQuantity`: `BigNumber` ; `uri`: `string` }]\> an array of attributes @@ -839,9 +835,9 @@ gets the attributes of the project represented by the TCO2 #### Defined in -[index.ts:190](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L190) +[index.ts:192](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L192) ---- +___ ### getDepositCap @@ -849,8 +845,8 @@ gets the attributes of the project represented by the TCO2 #### Parameters -| Name | Type | Description | -| :------------ | :------- | :------------------------ | +| Name | Type | Description | +| :------ | :------ | :------ | | `tco2Address` | `string` | address of the TCO2 token | #### Returns @@ -863,9 +859,9 @@ gets the cap for TCO2s based on `totalVintageQuantity` #### Defined in -[index.ts:174](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L174) +[index.ts:176](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L176) ---- +___ ### getOffsetHelperContract @@ -883,9 +879,9 @@ gets the contract of a the OffsetHelper contract #### Defined in -[index.ts:899](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L899) +[index.ts:905](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L905) ---- +___ ### getPoolAddress @@ -893,8 +889,8 @@ gets the contract of a the OffsetHelper contract #### Parameters -| Name | Type | Description | -| :----- | :----------- | :----------------------------------------- | +| Name | Type | Description | +| :------ | :------ | :------ | | `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | #### Returns @@ -909,9 +905,9 @@ gets the contract of a pool token based on the symbol #### Defined in -[index.ts:851](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L851) +[index.ts:857](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L857) ---- +___ ### getPoolContract @@ -919,8 +915,8 @@ gets the contract of a pool token based on the symbol #### Parameters -| Name | Type | -| :----- | :----------- | +| Name | Type | +| :------ | :------ | | `pool` | `PoolSymbol` | #### Returns @@ -937,9 +933,9 @@ gets the contract of a pool token based on the symbol #### Defined in -[index.ts:862](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L862) +[index.ts:868](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L868) ---- +___ ### getPoolRemaining @@ -947,8 +943,8 @@ gets the contract of a pool token based on the symbol #### Parameters -| Name | Type | -| :----- | :----------- | +| Name | Type | +| :------ | :------ | | `pool` | `PoolSymbol` | #### Returns @@ -963,9 +959,9 @@ gets the remaining space in pool contract before hitting the cap #### Defined in -[index.ts:347](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L347) +[index.ts:350](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L350) ---- +___ ### getRegistryContract @@ -983,9 +979,9 @@ gets the contract of a the Toucan contract registry #### Defined in -[index.ts:887](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L887) +[index.ts:893](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L893) ---- +___ ### getScoredTCO2s @@ -993,8 +989,8 @@ gets the contract of a the Toucan contract registry #### Parameters -| Name | Type | Description | -| :----- | :----------- | :----------------------------------------- | +| Name | Type | Description | +| :------ | :------ | :------ | | `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | #### Returns @@ -1009,9 +1005,9 @@ gets an array of scored TCO2s; scoredTCO2s[0] is lowest ranked #### Defined in -[index.ts:360](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L360) +[index.ts:363](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L363) ---- +___ ### getTCO2Contract @@ -1019,8 +1015,8 @@ gets an array of scored TCO2s; scoredTCO2s[0] is lowest ranked #### Parameters -| Name | Type | Description | -| :-------- | :------- | :-------------------------------------------- | +| Name | Type | Description | +| :------ | :------ | :------ | | `address` | `string` | address of TCO2 ethers.Contract to insantiate | #### Returns @@ -1035,9 +1031,9 @@ gets the contract of a TCO2 token based on the address #### Defined in -[index.ts:875](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L875) +[index.ts:881](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L881) ---- +___ ### getTCO2Remaining @@ -1045,8 +1041,8 @@ gets the contract of a TCO2 token based on the address #### Parameters -| Name | Type | Description | -| :------------ | :------- | :------------------------ | +| Name | Type | Description | +| :------ | :------ | :------ | | `tco2Address` | `string` | address of the TCO2 token | #### Returns @@ -1061,24 +1057,24 @@ gets the remaining space in TCO2 contract before hitting the cap #### Defined in -[index.ts:206](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L206) +[index.ts:208](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L208) ---- +___ ### redeemAuto -▸ **redeemAuto**(`pool`, `amount`): `Promise`<`ContractReceipt`\> +▸ **redeemAuto**(`pool`, `amount`): `Promise`<[`RedeemAutoResponse`](../modules.md#redeemautoresponse)\> #### Parameters -| Name | Type | Description | -| :------- | :----------- | :----------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `amount` | `BigNumber` | amount to redeem | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | +| `amount` | `BigNumber` | amount to redeem | #### Returns -`Promise`<`ContractReceipt`\> +`Promise`<[`RedeemAutoResponse`](../modules.md#redeemautoresponse)\> redeem transaction @@ -1088,36 +1084,40 @@ automatically redeems pool tokens for TCO2s #### Defined in -[index.ts:314](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L314) +[index.ts:316](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L316) ---- +___ ### redeemAuto2 -▸ **redeemAuto2**(`pool`, `amount`): `Promise`<{ `address`: `string` ; `amount`: `BigNumber` }[]\> +▸ **redeemAuto2**(`pool`, `amount`): `Promise`<[`RedeemAutoResponse`](../modules.md#redeemautoresponse)\> #### Parameters -| Name | Type | Description | -| :------- | :----------- | :----------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `amount` | `BigNumber` | amount to redeem | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | +| `amount` | `BigNumber` | amount to redeem | #### Returns -`Promise`<{ `address`: `string` ; `amount`: `BigNumber` }[]\> +`Promise`<[`RedeemAutoResponse`](../modules.md#redeemautoresponse)\> array containing tco2 addresses (string) and amounts (BigNumber) +**`Deprecated`** + +This function is deprecated. Please use `redeemAuto` instead. + **`Description`** automatically redeems pool tokens for TCO2s #### Defined in -[index.ts:331](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L331) +[index.ts:334](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L334) ---- +___ ### redeemMany @@ -1125,11 +1125,11 @@ automatically redeems pool tokens for TCO2s #### Parameters -| Name | Type | Description | -| :-------- | :------------ | :----------------------------------------- | -| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | -| `tco2s` | `string`[] | array of TCO2 contract addresses | -| `amounts` | `BigNumber`[] | array of amounts to redeem for each tco2s | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pool` | `PoolSymbol` | The pool symbol of the pool (token) to use | +| `tco2s` | `string`[] | array of TCO2 contract addresses | +| `amounts` | `BigNumber`[] | array of amounts to redeem for each tco2s | #### Returns @@ -1143,9 +1143,9 @@ selectively redeems pool tokens for TCO2s #### Defined in -[index.ts:296](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L296) +[index.ts:298](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L298) ---- +___ ### retire @@ -1153,10 +1153,10 @@ selectively redeems pool tokens for TCO2s #### Parameters -| Name | Type | Description | -| :------------ | :---------- | :------------------------------------ | -| `amount` | `BigNumber` | The amount of TCO2 to retire | -| `tco2Address` | `string` | address of the TCO2 token to retire\* | +| Name | Type | Description | +| :------ | :------ | :------ | +| `amount` | `BigNumber` | The amount of TCO2 to retire | +| `tco2Address` | `string` | address of the TCO2 token to retire* | #### Returns @@ -1170,9 +1170,9 @@ retires/burns an amount of TCO2s (each represents 1 ton of CO2) to achieve offse #### Defined in -[index.ts:102](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L102) +[index.ts:104](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L104) ---- +___ ### retireAndMintCertificate @@ -1180,14 +1180,14 @@ retires/burns an amount of TCO2s (each represents 1 ton of CO2) to achieve offse #### Parameters -| Name | Type | Description | -| :--------------------- | :---------- | :-------------------------------------------------------------------- | -| `retirementEntityName` | `string` | name of the entity that does the retirement (you) | -| `beneficiaryAddress` | `string` | address of the beneficiary (in case you're retiring for someone else) | -| `beneficiaryName` | `string` | name of the beneficiary | -| `retirementMessage` | `string` | retirement message | -| `amount` | `BigNumber` | The amount of TCO2 to retire | -| `tco2Address` | `string` | address of the TCO2 token to retire\* | +| Name | Type | Description | +| :------ | :------ | :------ | +| `retirementEntityName` | `string` | name of the entity that does the retirement (you) | +| `beneficiaryAddress` | `string` | address of the beneficiary (in case you're retiring for someone else) | +| `beneficiaryName` | `string` | name of the beneficiary | +| `retirementMessage` | `string` | retirement message | +| `amount` | `BigNumber` | The amount of TCO2 to retire | +| `tco2Address` | `string` | address of the TCO2 token to retire* | #### Returns @@ -1201,9 +1201,9 @@ retires/burns an amount of TCO2s & mints the NFT certificate for it within the s #### Defined in -[index.ts:122](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L122) +[index.ts:124](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L124) ---- +___ ### retireFrom @@ -1211,11 +1211,11 @@ retires/burns an amount of TCO2s & mints the NFT certificate for it within the s #### Parameters -| Name | Type | Description | -| :------------ | :---------- | :------------------------------------ | -| `amount` | `BigNumber` | The amount of TCO2 to retire | -| `address` | `string` | address of the account to retire from | -| `tco2Address` | `string` | address of the TCO2 token to retire\* | +| Name | Type | Description | +| :------ | :------ | :------ | +| `amount` | `BigNumber` | The amount of TCO2 to retire | +| `address` | `string` | address of the account to retire from | +| `tco2Address` | `string` | address of the TCO2 token to retire* | #### Returns @@ -1233,9 +1233,9 @@ requires approval from the address you're trying to retire from #### Defined in -[index.ts:152](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L152) +[index.ts:154](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L154) ---- +___ ### setProvider @@ -1243,8 +1243,8 @@ requires approval from the address you're trying to retire from #### Parameters -| Name | Type | -| :--------- | :--------- | +| Name | Type | +| :------ | :------ | | `provider` | `Provider` | #### Returns @@ -1253,9 +1253,9 @@ requires approval from the address you're trying to retire from #### Defined in -[index.ts:86](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L86) +[index.ts:88](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L88) ---- +___ ### setSigner @@ -1263,8 +1263,8 @@ requires approval from the address you're trying to retire from #### Parameters -| Name | Type | -| :------- | :------- | +| Name | Type | +| :------ | :------ | | `signer` | `Signer` | #### Returns @@ -1273,4 +1273,4 @@ requires approval from the address you're trying to retire from #### Defined in -[index.ts:82](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/index.ts#L82) +[index.ts:84](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/index.ts#L84) diff --git a/docs/modules.md b/docs/modules.md index 694d37c..f35eaeb 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -14,6 +14,7 @@ - [BridgedBatchTokensResponse](modules.md#bridgedbatchtokensresponse) - [PoolContentsResponse](modules.md#poolcontentsresponse) - [ProjectResponse](modules.md#projectresponse) +- [RedeemAutoResponse](modules.md#redeemautoresponse) - [RedeemsResponse](modules.md#redeemsresponse) - [TCO2TokenResponse](modules.md#tco2tokenresponse) - [UserBatchesResponse](modules.md#userbatchesresponse) @@ -27,7 +28,7 @@ #### Defined in -[types/responses.ts:147](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/types/responses.ts#L147) +[types/responses.ts:155](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L155) ___ @@ -37,7 +38,7 @@ ___ #### Defined in -[types/responses.ts:75](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/types/responses.ts#L75) +[types/responses.ts:83](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L83) ___ @@ -47,7 +48,7 @@ ___ #### Defined in -[types/responses.ts:126](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/types/responses.ts#L126) +[types/responses.ts:134](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L134) ___ @@ -57,7 +58,17 @@ ___ #### Defined in -[types/responses.ts:138](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/types/responses.ts#L138) +[types/responses.ts:146](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L146) + +___ + +### RedeemAutoResponse + +Ƭ **RedeemAutoResponse**: { `address`: `string` ; `amount`: `BigNumber` }[] + +#### Defined in + +[types/responses.ts:39](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L39) ___ @@ -67,7 +78,7 @@ ___ #### Defined in -[types/responses.ts:110](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/types/responses.ts#L110) +[types/responses.ts:118](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L118) ___ @@ -77,7 +88,7 @@ ___ #### Defined in -[types/responses.ts:62](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/types/responses.ts#L62) +[types/responses.ts:70](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L70) ___ @@ -92,7 +103,7 @@ See types/schemas.ts for more information on why I decided to use Pick in the fi #### Defined in -[types/responses.ts:44](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/types/responses.ts#L44) +[types/responses.ts:52](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L52) ___ @@ -102,4 +113,4 @@ ___ #### Defined in -[types/responses.ts:84](https://github.com/GigaHierz/toucan-sdk/blob/b837065/src/types/responses.ts#L84) +[types/responses.ts:92](https://github.com/0xmichalis/toucan-sdk/blob/1488e66/src/types/responses.ts#L92)