From 672934cdb5ac01c2967a25c941694138b24c36da Mon Sep 17 00:00:00 2001 From: Alex Lazar Date: Fri, 1 Jul 2022 01:57:22 +0300 Subject: [PATCH 1/6] refactor: PascalCase on types --- index.ts | 42 +++++++++++++++--------------- subclasses/ContractInteractions.ts | 40 ++++++++++++++-------------- subclasses/SubgraphInteractions.ts | 6 ++--- types/index.ts | 2 +- types/methods.ts | 8 +++--- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/index.ts b/index.ts index dcafba6..d7b3b1c 100644 --- a/index.ts +++ b/index.ts @@ -10,7 +10,7 @@ import { IToucanPoolToken, OffsetHelper, } from "./typechain"; -import { Network, poolSymbol } from "./types"; +import { Network, PoolSymbol } from "./types"; import { fetchAggregationsMethod, fetchAllTCO2TokensMethod, @@ -206,7 +206,7 @@ export class ToucanClient { * @param tco2Address address of the TCO2 token to deposit* @returns deposit transaction */ depositTCO2 = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, tco2Address: string ): Promise => { @@ -228,7 +228,7 @@ export class ToucanClient { * @param tco2 address of TCO2 to deposit * @returns boolean */ - checkEligible = async (pool: poolSymbol, tco2: string): Promise => { + checkEligible = async (pool: PoolSymbol, tco2: string): Promise => { const signerOrProvider = this.signer ? this.signer : this.provider; if (!signerOrProvider) throw new Error("No signer or provider set"); @@ -249,7 +249,7 @@ export class ToucanClient { * @returns amount (BigNumber) of fees it will cost to redeem */ calculateRedeemFees = async ( - pool: poolSymbol, + pool: PoolSymbol, tco2s: string[], amounts: BigNumber[] ): Promise => { @@ -273,7 +273,7 @@ export class ToucanClient { * @returns redeem transaction */ redeemMany = async ( - pool: poolSymbol, + pool: PoolSymbol, tco2s: string[], amounts: BigNumber[] ): Promise => { @@ -291,7 +291,7 @@ export class ToucanClient { * @returns redeem transaction */ redeemAuto = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber ): Promise => { if (!this.signer) throw new Error("No signer set"); @@ -308,7 +308,7 @@ export class ToucanClient { * @returns array containing tco2 addresses (string) and amounts (BigNumber) */ redeemAuto2 = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber ): Promise<{ address: string; amount: BigNumber }[]> => { if (!this.signer) throw new Error("No signer set"); @@ -320,15 +320,15 @@ export class ToucanClient { /** * * @description gets the remaining space in pool contract before hitting the cap - * @param poolSymbol symbol of the token to use + * @param PoolSymbol symbol of the token to use * @returns BigNumber representing the remaining space */ - getPoolRemaining = async (poolSymbol: poolSymbol): Promise => { + getPoolRemaining = async (PoolSymbol: PoolSymbol): Promise => { const signerOrProvider = this.signer ? this.signer : this.provider; if (!signerOrProvider) throw new Error("No signer or provider set"); return this.contractInteractions.getPoolRemaining( - poolSymbol, + PoolSymbol, signerOrProvider ); }; @@ -339,7 +339,7 @@ export class ToucanClient { * @param pool symbol of the pool (token) to use * @returns array of TCO2 addresses by rank */ - getScoredTCO2s = async (pool: poolSymbol): Promise => { + getScoredTCO2s = async (pool: PoolSymbol): Promise => { const signerOrProvider = this.signer ? this.signer : this.provider; if (!signerOrProvider) throw new Error("No signer or provider set"); @@ -379,7 +379,7 @@ export class ToucanClient { * @param amount amount of CO2 tons to offset* @returns offset transaction */ autoOffsetUsingPoolToken = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber ): Promise => { if (!this.signer) throw new Error("No signer set"); @@ -401,7 +401,7 @@ export class ToucanClient { * @param swapToken portal for the token to swap into pool tokens (only accepts WETH, WMATIC and USDC)* @returns offset transaction */ autoOffsetUsingSwapToken = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, swapToken: Contract ): Promise => { @@ -424,7 +424,7 @@ export class ToucanClient { * @param amount amount of CO2 tons to offset* @returns offset transaction */ autoOffsetUsingETH = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber ): Promise => { if (!this.signer) throw new Error("No signer set"); @@ -442,7 +442,7 @@ export class ToucanClient { * @returns amount (BigNumber) of swapToken needed to deposit */ calculateNeededTokenAmount = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, swapToken: Contract ): Promise => { @@ -465,7 +465,7 @@ export class ToucanClient { * @returns amount (BigNumber) of ETH needed to deposit; ETH = native currency of network you are on */ calculateNeededETHAmount = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber ): Promise => { const signerOrProvider = this.signer ? this.signer : this.provider; @@ -672,7 +672,7 @@ export class ToucanClient { // -------------------------------------------------------------------------------- fetchTokenPriceOnSushiSwap = async ( - pool: poolSymbol + pool: PoolSymbol ): Promise<{ price: number | null; url: string | null; @@ -692,7 +692,7 @@ export class ToucanClient { * @param pool symbol of the pool (token) to use * @returns a ethers.contract to interact with the pool */ - public getPoolAddress = (pool: poolSymbol): string => { + public getPoolAddress = (pool: PoolSymbol): string => { return this.contractInteractions.getPoolAddress(pool); }; @@ -700,15 +700,15 @@ export class ToucanClient { * * @dev * @description gets the contract of a pool token based on the symbol - * @param poolSymbol symbol of the pool (token) to use + * @param PoolSymbol symbol of the pool (token) to use * @returns a ethers.contract to interact with the pool */ - public getPoolContract = (poolSymbol: poolSymbol): IToucanPoolToken => { + public getPoolContract = (PoolSymbol: PoolSymbol): IToucanPoolToken => { const signerOrProvider = this.signer ? this.signer : this.provider; if (!signerOrProvider) throw new Error("No signer or provider set"); return this.contractInteractions.getPoolContract( - poolSymbol, + PoolSymbol, signerOrProvider ); }; diff --git a/subclasses/ContractInteractions.ts b/subclasses/ContractInteractions.ts index 90aa4a8..6ec86a2 100644 --- a/subclasses/ContractInteractions.ts +++ b/subclasses/ContractInteractions.ts @@ -12,7 +12,7 @@ import { IToucanPoolToken, OffsetHelper, } from "../typechain"; -import { Network, poolSymbol } from "../types"; +import { Network, PoolSymbol } from "../types"; import { GAS_LIMIT } from "../utils"; import { offsetHelperABI, @@ -195,7 +195,7 @@ class ContractInteractions { * @returns deposit transaction */ depositTCO2 = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, tco2Address: string, signer: ethers.Signer @@ -226,7 +226,7 @@ class ContractInteractions { * @returns boolean */ checkEligible = async ( - pool: poolSymbol, + pool: PoolSymbol, tco2: string, signerOrProvider: ethers.Signer | ethers.providers.Provider ): Promise => { @@ -255,7 +255,7 @@ class ContractInteractions { * @returns amount (BigNumber) of fees it will cost to redeem */ calculateRedeemFees = async ( - pool: poolSymbol, + pool: PoolSymbol, tco2s: string[], amounts: BigNumber[], signerOrProvider: ethers.Signer | ethers.providers.Provider @@ -274,7 +274,7 @@ class ContractInteractions { * @returns redeem transaction */ redeemMany = async ( - pool: poolSymbol, + pool: PoolSymbol, tco2s: string[], amounts: BigNumber[], signer: ethers.Signer @@ -298,7 +298,7 @@ class ContractInteractions { * @returns redeem transaction */ redeemAuto = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, signer: ethers.Signer ): Promise => { @@ -319,7 +319,7 @@ class ContractInteractions { * @returns array containing tco2 addresses (string) and amounts (BigNumber) */ redeemAuto2 = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, signer: ethers.Signer ): Promise<{ address: string; amount: BigNumber }[]> => { @@ -346,15 +346,15 @@ class ContractInteractions { /** * * @description gets the remaining space in pool contract before hitting the cap - * @param poolSymbol symbol of the token to use + * @param PoolSymbol symbol of the token to use * @param signerOrProvider this being a read transaction, we need a signer or provider * @returns BigNumber representing the remaining space */ getPoolRemaining = async ( - poolSymbol: poolSymbol, + PoolSymbol: PoolSymbol, signerOrProvider: ethers.Signer | ethers.providers.Provider ): Promise => { - const poolToken = this.getPoolContract(poolSymbol, signerOrProvider); + const poolToken = this.getPoolContract(PoolSymbol, signerOrProvider); return await poolToken.getRemaining(); }; @@ -366,7 +366,7 @@ class ContractInteractions { * @returns array of TCO2 addresses by rank */ getScoredTCO2s = async ( - pool: poolSymbol, + pool: PoolSymbol, signerOrProvider: ethers.Signer | ethers.providers.Provider ): Promise => { const poolToken = this.getPoolContract(pool, signerOrProvider); @@ -410,7 +410,7 @@ class ContractInteractions { * @returns offset transaction */ autoOffsetUsingPoolToken = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, signer: ethers.Signer ): Promise => { @@ -442,7 +442,7 @@ class ContractInteractions { * @returns offset transaction */ autoOffsetUsingSwapToken = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, swapToken: Contract, signer: ethers.Signer @@ -480,7 +480,7 @@ class ContractInteractions { * @returns offset transaction */ autoOffsetUsingETH = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, signer: ethers.Signer ): Promise => { @@ -505,7 +505,7 @@ class ContractInteractions { * @returns amount (BigNumber) of swapToken needed to deposit */ calculateNeededTokenAmount = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, swapToken: Contract, signerOrProvider: ethers.Signer | ethers.providers.Provider @@ -527,7 +527,7 @@ class ContractInteractions { * @returns amount (BigNumber) of ETH needed to deposit; ETH = native currency of network you are on */ calculateNeededETHAmount = async ( - pool: poolSymbol, + pool: PoolSymbol, amount: BigNumber, signerOrProvider: ethers.Signer | ethers.providers.Provider ): Promise => { @@ -548,7 +548,7 @@ class ContractInteractions { * @param pool symbol of the pool (token) to use * @returns a ethers.contract to interact with the pool */ - public getPoolAddress = (pool: poolSymbol): string => { + public getPoolAddress = (pool: PoolSymbol): string => { return pool == "BCT" ? this.addresses.bct : this.addresses.nct; }; @@ -556,16 +556,16 @@ class ContractInteractions { * * @dev * @description gets the contract of a pool token based on the symbol - * @param poolSymbol symbol of the pool (token) to use + * @param PoolSymbol symbol of the pool (token) to use * @param signerOrProvider depending on what you intend to do with the contract, a signer or provider * @returns a ethers.contract to interact with the pool */ public getPoolContract = ( - poolSymbol: poolSymbol, + PoolSymbol: PoolSymbol, signerOrProvider: ethers.Signer | ethers.providers.Provider ): IToucanPoolToken => { const poolContract = new ethers.Contract( - this.getPoolAddress(poolSymbol), + this.getPoolAddress(PoolSymbol), poolTokenABI, signerOrProvider ) as IToucanPoolToken; diff --git a/subclasses/SubgraphInteractions.ts b/subclasses/SubgraphInteractions.ts index 507c3df..e3dc7cb 100644 --- a/subclasses/SubgraphInteractions.ts +++ b/subclasses/SubgraphInteractions.ts @@ -1,7 +1,7 @@ import { Client, gql } from "@urql/core"; import { IToucanCarbonOffsets } from "../typechain"; -import { Network, poolSymbol } from "../types"; +import { Network, PoolSymbol } from "../types"; import { fetchAggregationsMethod, fetchAllTCO2TokensMethod, @@ -725,7 +725,7 @@ class SubgraphInteractions { }; fetchTokenPriceOnSushiSwap = async ( - pool: poolSymbol + pool: PoolSymbol ): Promise<{ price: number | null; url: string | null; @@ -752,7 +752,7 @@ class SubgraphInteractions { * @param pool symbol of the pool (token) to use * @returns a ethers.contract to interact with the pool */ - private getPoolAddress = (pool: poolSymbol): string => { + private getPoolAddress = (pool: PoolSymbol): string => { return pool == "BCT" ? this.addresses.bct : this.addresses.nct; }; } diff --git a/types/index.ts b/types/index.ts index eb9ad97..121e914 100644 --- a/types/index.ts +++ b/types/index.ts @@ -1,6 +1,6 @@ export type Network = "polygon" | "mumbai"; -export type poolSymbol = "BCT" | "NCT"; +export type PoolSymbol = "BCT" | "NCT"; export declare enum RetirementStatus { Pending = 0, diff --git a/types/methods.ts b/types/methods.ts index a888d5f..5f373bf 100644 --- a/types/methods.ts +++ b/types/methods.ts @@ -1,6 +1,6 @@ import { TypedDocumentNode } from "@urql/core"; -import { poolSymbol } from "."; +import { PoolSymbol } from "."; import { AggregationsSchema, BatchCommentSchema, @@ -130,14 +130,14 @@ export type fetchRedeemsResult = Pick< }; export type fetchRedeemsMethod = ( - pool: poolSymbol, + pool: PoolSymbol, first?: number, skip?: number ) => Promise; export type fetchUserRedeemsMethod = ( walletAddress: string, - pool: poolSymbol, + pool: PoolSymbol, first?: number, skip?: number ) => Promise; @@ -155,7 +155,7 @@ export type fetchPoolContentsResult = Pick & { }; export type fetchPoolContentsMethod = ( - poolSymbol: poolSymbol, + PoolSymbol: PoolSymbol, first?: number, skip?: number ) => Promise; From ededcf1e2b153afbc1779429a0f8acfafa0a7e51 Mon Sep 17 00:00:00 2001 From: Alex Lazar Date: Fri, 1 Jul 2022 01:58:40 +0300 Subject: [PATCH 2/6] refactor: uppercased contract symbols --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc0baf1..497f195 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,7 @@ const result = await toucan.fetchCustomQuery(query, { id: "1" }); # What if I can't find contract interactions that I need? -You can always access any method or property of the bct, nct and tco2 contracts by first getting and storing them in a variable, like so: +You can always access any method or property of the BCT, NCT and TCO2 contracts by first getting and storing them in a variable, like so: ```typescript toucan.setSigner(signer); From d5482b432543bc66d4ca79194c8266c6b29393a7 Mon Sep 17 00:00:00 2001 From: Alex Lazar Date: Fri, 1 Jul 2022 01:59:44 +0300 Subject: [PATCH 3/6] fix: ts-ignore on new.ethers.contract usage --- test/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/index.ts b/test/index.ts index b8eca8f..8d60e50 100644 --- a/test/index.ts +++ b/test/index.ts @@ -132,12 +132,11 @@ describe("Testing Toucan-SDK", function () { }); it("Should automatically redeem NCT & deposit the TCO2 back", async function () { - // @ts-ignore const tco2: IToucanCarbonOffsets = new ethers.Contract( scoredTCO2sNCT[0], tco2ABI, addr1 - ); + ) as IToucanCarbonOffsets; const tco2BalanceBefore = await tco2.balanceOf(addr1.address); const nct = new ethers.Contract( addresses.polygon.nct, From 94dba0d1b5a4eda5331e60b263caa5c5a2a1164d Mon Sep 17 00:00:00 2001 From: Alex Lazar Date: Fri, 1 Jul 2022 02:10:03 +0300 Subject: [PATCH 4/6] refactor: removed unused variables --- test/index.ts | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/test/index.ts b/test/index.ts index 8d60e50..4ac6745 100644 --- a/test/index.ts +++ b/test/index.ts @@ -12,15 +12,13 @@ import addresses from "../utils/addresses"; describe("Testing Toucan-SDK", function () { let addr1: SignerWithAddress; let addr2: SignerWithAddress; - let addrs: SignerWithAddress[]; let toucan: ToucanClient; let swapper: Contract; let scoredTCO2sBCT: string[]; let scoredTCO2sNCT: string[]; - let res; before(async () => { - [addr1, addr2, ...addrs] = await ethers.getSigners(); + [addr1, addr2] = await ethers.getSigners(); toucan = new ToucanClient("polygon"); toucan.setSigner(addr1); @@ -173,11 +171,6 @@ describe("Testing Toucan-SDK", function () { [parseEther("1.0")] ); - const remainingTCO2 = await toucan - .getPoolContract("BCT") - // @ts-ignore tokenBalances is an autogenerated getter for a mapping within inherited storage - .tokenBalances(tco2Address); - await expect(toucan.redeemMany("BCT", [tco2Address], [parseEther("1.0")])) .to.not.be.reverted; @@ -221,7 +214,7 @@ describe("Testing Toucan-SDK", function () { it("Should retire 1 TCO2 & mint the certificate", async function () { const tco2s = await toucan.redeemAuto2("NCT", parseEther("1.0")); - const retirementReceipt = await toucan.retireAndMintCertificate( + await toucan.retireAndMintCertificate( "Test", addr1.address, "Test", @@ -240,7 +233,7 @@ describe("Testing Toucan-SDK", function () { parseEther("1.0"), tco2s[0].address ); - const retiredEvents = retirementReceipt.events?.filter((event, index) => { + const retiredEvents = retirementReceipt.events?.filter((event) => { return event.event == "Retired"; }); @@ -265,69 +258,65 @@ describe("Testing Toucan-SDK", function () { describe("Testing subgraph related methods", function () { it("Should fetch user batches", async function () { - expect((res = await toucan.fetchUserBatches(addr1.address))).to.not.throw; + expect(await toucan.fetchUserBatches(addr1.address)).to.not.throw; }); describe("Testing TCO2 Token fetching methods", function () { it("Should fetch details about TCO2 based on its address", async function () { expect( - (res = await toucan.fetchTCO2TokenById( + await toucan.fetchTCO2TokenById( "0x0044c5a5a6f626b673224a3c0d71e851ad3d5153" - )) + ) ).to.not.throw; }); it("Should fetch details about TCO2 based on its full symbol", async function () { - expect( - (res = await toucan.fetchTCO2TokenByFullSymbol("TCO2-VCS-1718-2013")) - ).to.not.throw; + expect(await toucan.fetchTCO2TokenByFullSymbol("TCO2-VCS-1718-2013")).to + .not.throw; }); it("Should fetch all TCO2 Tokens", async function () { - expect((res = await toucan.fetchAllTCO2Tokens())).to.not.throw; + expect(await toucan.fetchAllTCO2Tokens()).to.not.throw; }); }); it("Should fetch bridged batch tokens", async function () { - expect((res = await toucan.fetchBridgedBatchTokens())).to.not.throw; + expect(await toucan.fetchBridgedBatchTokens()).to.not.throw; }); it("Should fetch user retirements", async function () { - expect((res = await toucan.fetchUserRetirements(addr1.address))).to.not - .throw; + expect(await toucan.fetchUserRetirements(addr1.address)).to.not.throw; }); describe("Testing Redeems fetching methods", function () { it("Should fetch redeems", async function () { - expect((res = await toucan.fetchRedeems("NCT"))).to.not.throw; + expect(await toucan.fetchRedeems("NCT")).to.not.throw; }); it("Should fetch user redeems", async function () { - expect((res = await toucan.fetchUserRedeems(addr1.address, "NCT"))).to - .not.throw; + expect(await toucan.fetchUserRedeems(addr1.address, "NCT")).to.not + .throw; }); }); it("Should fetch pooled tokens", async function () { - expect((res = await toucan.fetchPoolContents("NCT"))).to.not.throw; + expect(await toucan.fetchPoolContents("NCT")).to.not.throw; }); it("Should fetch a project by its id", async function () { - expect((res = await toucan.fetchProjectById("1"))).to.not.throw; + expect(await toucan.fetchProjectById("1")).to.not.throw; }); it("Should fetch aggregations", async function () { - expect((res = await toucan.fetchAggregations())).to.not.throw; + expect(await toucan.fetchAggregations()).to.not.throw; }); it("Should fetch price of BCT", async function () { - expect((res = await toucan.fetchTokenPriceOnSushiSwap("BCT"))).to.not - .throw; + expect(await toucan.fetchTokenPriceOnSushiSwap("BCT")).to.not.throw; }); it("Should fetch price of NCT", async function () { - expect((res = await toucan.fetchTokenPriceOnSushiSwap("NCT"))).to.not - .throw; + expect(await toucan.fetchTokenPriceOnSushiSwap("NCT")).to.not.throw; }); }); }); From 4870d32467fd126a6fc75a1b9cb701d457e68645 Mon Sep 17 00:00:00 2001 From: Alex Lazar Date: Fri, 1 Jul 2022 14:41:28 +0300 Subject: [PATCH 5/6] refactor: renamed params `PoolSymbol` into `pool` for consistency --- index.ts | 14 ++++---------- subclasses/ContractInteractions.ts | 8 ++++---- types/methods.ts | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/index.ts b/index.ts index d7b3b1c..9ba052a 100644 --- a/index.ts +++ b/index.ts @@ -323,14 +323,11 @@ export class ToucanClient { * @param PoolSymbol symbol of the token to use * @returns BigNumber representing the remaining space */ - getPoolRemaining = async (PoolSymbol: PoolSymbol): Promise => { + getPoolRemaining = async (pool: PoolSymbol): Promise => { const signerOrProvider = this.signer ? this.signer : this.provider; if (!signerOrProvider) throw new Error("No signer or provider set"); - return this.contractInteractions.getPoolRemaining( - PoolSymbol, - signerOrProvider - ); + return this.contractInteractions.getPoolRemaining(pool, signerOrProvider); }; /** @@ -703,14 +700,11 @@ export class ToucanClient { * @param PoolSymbol symbol of the pool (token) to use * @returns a ethers.contract to interact with the pool */ - public getPoolContract = (PoolSymbol: PoolSymbol): IToucanPoolToken => { + public getPoolContract = (pool: PoolSymbol): IToucanPoolToken => { const signerOrProvider = this.signer ? this.signer : this.provider; if (!signerOrProvider) throw new Error("No signer or provider set"); - return this.contractInteractions.getPoolContract( - PoolSymbol, - signerOrProvider - ); + return this.contractInteractions.getPoolContract(pool, signerOrProvider); }; /** diff --git a/subclasses/ContractInteractions.ts b/subclasses/ContractInteractions.ts index 6ec86a2..d4f4c3c 100644 --- a/subclasses/ContractInteractions.ts +++ b/subclasses/ContractInteractions.ts @@ -351,10 +351,10 @@ class ContractInteractions { * @returns BigNumber representing the remaining space */ getPoolRemaining = async ( - PoolSymbol: PoolSymbol, + pool: PoolSymbol, signerOrProvider: ethers.Signer | ethers.providers.Provider ): Promise => { - const poolToken = this.getPoolContract(PoolSymbol, signerOrProvider); + const poolToken = this.getPoolContract(pool, signerOrProvider); return await poolToken.getRemaining(); }; @@ -561,11 +561,11 @@ class ContractInteractions { * @returns a ethers.contract to interact with the pool */ public getPoolContract = ( - PoolSymbol: PoolSymbol, + pool: PoolSymbol, signerOrProvider: ethers.Signer | ethers.providers.Provider ): IToucanPoolToken => { const poolContract = new ethers.Contract( - this.getPoolAddress(PoolSymbol), + this.getPoolAddress(pool), poolTokenABI, signerOrProvider ) as IToucanPoolToken; diff --git a/types/methods.ts b/types/methods.ts index 5f373bf..b718afd 100644 --- a/types/methods.ts +++ b/types/methods.ts @@ -155,7 +155,7 @@ export type fetchPoolContentsResult = Pick & { }; export type fetchPoolContentsMethod = ( - PoolSymbol: PoolSymbol, + pool: PoolSymbol, first?: number, skip?: number ) => Promise; From 77badca5396a307baab61bf7635255688e539679 Mon Sep 17 00:00:00 2001 From: Alex Lazar Date: Fri, 1 Jul 2022 14:42:40 +0300 Subject: [PATCH 6/6] refactor: unnecessary type declaration --- test/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/index.ts b/test/index.ts index 4ac6745..7cfdf26 100644 --- a/test/index.ts +++ b/test/index.ts @@ -130,7 +130,7 @@ describe("Testing Toucan-SDK", function () { }); it("Should automatically redeem NCT & deposit the TCO2 back", async function () { - const tco2: IToucanCarbonOffsets = new ethers.Contract( + const tco2 = new ethers.Contract( scoredTCO2sNCT[0], tco2ABI, addr1