@raac/rpc 1.0.2-beta.3 → 1.0.2-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/{RPCLibrary.ts → RPCLibrary.js} +7 -121
  2. package/assets/{getAsset.ts → getAsset.js} +6 -6
  3. package/assets/{getAssets.ts → getAssets.js} +2 -3
  4. package/assets/{getSupply.ts → getSupply.js} +5 -7
  5. package/configs/chains/index.js +13 -0
  6. package/configs/index.js +17 -0
  7. package/contracts/feeCollector/{claimRewardFromPool.ts → claimRewardFromPool.js} +4 -10
  8. package/contracts/{getContract.ts → getContract.js} +5 -6
  9. package/contracts/{getContractAddress.ts → getContractAddress.js} +4 -6
  10. package/contracts/housePrices/{getLatestPrice.ts → getLatestPrice.js} +6 -8
  11. package/contracts/housePrices/{setOracle.ts → setOracle.js} +6 -8
  12. package/contracts/indexToken/{getNextRandomNFT.ts → getNextRandomNFT.js} +5 -7
  13. package/contracts/indexToken/{redeemNFT.ts → redeemNFT.js} +5 -7
  14. package/contracts/zeno/{createAuction.ts → createAuction.js} +14 -16
  15. package/contracts/zeno/{createZeno.ts → createZeno.js} +8 -10
  16. package/contracts/zeno/{getAuctions.ts → getAuctions.js} +5 -7
  17. package/contracts/zeno/{getZenos.ts → getZenos.js} +5 -7
  18. package/methods/commons/{checkAllowance.ts → checkAllowance.js} +10 -12
  19. package/methods/commons/{estimateGasPrice.ts → estimateGasPrice.js} +5 -7
  20. package/minter/{get.ts → get.js} +6 -8
  21. package/minter/{getApy.ts → getApy.js} +5 -7
  22. package/minter/{tick.ts → tick.js} +5 -7
  23. package/nfts/{getAllTokens.ts → getAllTokens.js} +7 -9
  24. package/nfts/{getBaseUri.ts → getBaseUri.js} +5 -7
  25. package/nfts/{getHousePrice.ts → getHousePrice.js} +6 -8
  26. package/nfts/{getMintFeePercentage.ts → getMintFeePercentage.js} +4 -6
  27. package/nfts/{getMintPrice.ts → getMintPrice.js} +7 -9
  28. package/nfts/{getTokenURI.ts → getTokenURI.js} +7 -9
  29. package/nfts/{getTokensByOwner.ts → getTokensByOwner.js} +8 -10
  30. package/nfts/{getTotalPropertiesCount.ts → getTotalPropertiesCount.js} +5 -7
  31. package/nfts/{mint.ts → mint.js} +7 -9
  32. package/nfts/{setBaseUri.ts → setBaseUri.js} +4 -6
  33. package/nfts/{totalNFTSupply.ts → totalNFTSupply.js} +4 -6
  34. package/package.json +1 -1
  35. package/pools/lendingPool/{borrowFromLendingPool.ts → borrowFromLendingPool.js} +8 -10
  36. package/pools/lendingPool/{borrowFromLendingPoolWithInsurance.ts → borrowFromLendingPoolWithInsurance.js} +8 -10
  37. package/pools/lendingPool/{calculateInsuranceFee.ts → calculateInsuranceFee.js} +9 -11
  38. package/pools/lendingPool/{claimReward.ts → claimReward.js} +5 -7
  39. package/pools/lendingPool/{closeLiquidation.ts → closeLiquidation.js} +7 -9
  40. package/pools/lendingPool/{depositNFTToLendingPool.ts → depositNFTToLendingPool.js} +6 -8
  41. package/pools/lendingPool/{depositToLendingPool.ts → depositToLendingPool.js} +6 -8
  42. package/pools/lendingPool/{getAllUserData.ts → getAllUserData.js} +7 -14
  43. package/pools/lendingPool/{getEligibleUserDeposits.ts → getEligibleUserDeposits.js} +7 -9
  44. package/pools/lendingPool/{getHealthFactor.ts → getHealthFactor.js} +8 -10
  45. package/pools/lendingPool/{getHousePrice.ts → getHousePrice.js} +6 -8
  46. package/pools/lendingPool/{getLendingPoolInfo.ts → getLendingPoolInfo.js} +23 -31
  47. package/pools/lendingPool/{getLendingPoolTotalLiquidity.ts → getLendingPoolTotalLiquidity.js} +7 -10
  48. package/pools/lendingPool/{getPendingReward.ts → getPendingReward.js} +7 -9
  49. package/pools/lendingPool/{getPositionDebt.ts → getPositionDebt.js} +8 -10
  50. package/pools/lendingPool/{getPositionScaledDebt.ts → getPositionScaledDebt.js} +8 -10
  51. package/pools/lendingPool/{getPositionView.ts → getPositionView.js} +9 -11
  52. package/pools/lendingPool/{getPositionsScaledDebt.ts → getPositionsScaledDebt.js} +7 -9
  53. package/pools/lendingPool/{getRawUserDepositsInLendingPool.ts → getRawUserDepositsInLendingPool.js} +7 -9
  54. package/pools/lendingPool/{getUserCollateralValue.ts → getUserCollateralValue.js} +7 -9
  55. package/pools/lendingPool/{initializeLiquidation.ts → initializeLiquidation.js} +8 -10
  56. package/pools/lendingPool/{repayToLendingPool.ts → repayToLendingPool.js} +8 -10
  57. package/pools/lendingPool/{withdrawFromLendingPool.ts → withdrawFromLendingPool.js} +9 -10
  58. package/pools/lendingPool/{withdrawNFTFromLendingPool.ts → withdrawNFTFromLendingPool.js} +7 -9
  59. package/pools/stabilityPool/{calculateRAACRewards.ts → calculateRAACRewards.js} +6 -9
  60. package/pools/stabilityPool/configs/chains/index.js +17 -0
  61. package/pools/stabilityPool/configs/index.js +43 -0
  62. package/pools/stabilityPool/{depositNFTToStabilityPool.ts → depositNFTToStabilityPool.js} +6 -9
  63. package/pools/stabilityPool/{depositToStabilityPool.ts → depositToStabilityPool.js} +6 -8
  64. package/pools/stabilityPool/{getRawUserDepositsInStabilityPool.ts → getRawUserDepositsInStabilityPool.js} +7 -9
  65. package/pools/stabilityPool/{getStabilityPoolInfo.ts → getStabilityPoolInfo.js} +10 -12
  66. package/pools/stabilityPool/{getStabilityPoolTotalDeposits.ts → getStabilityPoolTotalDeposits.js} +6 -8
  67. package/pools/stabilityPool/methods/commons/estimateGasPrice.js +28 -0
  68. package/pools/stabilityPool/pools/stabilityPool/withdrawFromStabilityPool.js +34 -0
  69. package/pools/stabilityPool/utils/artifacts.js +74 -0
  70. package/pools/stabilityPool/utils/contracts.js +82 -0
  71. package/pools/stabilityPool/{withdrawFromStabilityPool.ts → withdrawFromStabilityPool.js} +6 -8
  72. package/ts-to-js.sh +42 -0
  73. package/utils/{artifacts.ts → artifacts.js} +1 -4
  74. package/utils/{contracts.ts → contracts.js} +16 -18
  75. package/wallet/assets/{approveAsset.ts → approveAsset.js} +7 -8
  76. package/wallet/assets/{burnAsset.ts → burnAsset.js} +7 -9
  77. package/wallet/assets/{getAllowance.ts → getAllowance.js} +9 -10
  78. package/wallet/assets/{getAsset.ts → getAsset.js} +6 -7
  79. package/wallet/assets/{getAssets.ts → getAssets.js} +5 -6
  80. package/wallet/assets/{getBalance.ts → getBalance.js} +8 -9
  81. package/wallet/assets/{mintAsset.ts → mintAsset.js} +8 -9
  82. package/wallet/assets/{transferAsset.ts → transferAsset.js} +10 -11
  83. package/configs/chains/index.ts +0 -17
  84. package/configs/index.ts +0 -51
  85. /package/configs/chains/{chain.d.ts → chain.d.js} +0 -0
  86. /package/configs/{createConfig.ts → createConfig.js} +0 -0
  87. /package/contracts/crvUSDToken/{getBalance.ts → getBalance.js} +0 -0
  88. /package/contracts/crvUSDToken/{getTotalSupply.ts → getTotalSupply.js} +0 -0
  89. /package/contracts/rcrvUSDToken/{getBalance.ts → getBalance.js} +0 -0
  90. /package/contracts/rcrvUSDToken/{getTotalSupply.ts → getTotalSupply.js} +0 -0
  91. /package/{custom-types.d.ts → custom-types.d.js} +0 -0
  92. /package/{index.ts → index.js} +0 -0
  93. /package/methods/{approveToken.ts → approveToken.js} +0 -0
  94. /package/methods/{getAssetBalance.ts → getAssetBalance.js} +0 -0
  95. /package/methods/{getAssetsBalance.ts → getAssetsBalance.js} +0 -0
  96. /package/pools/liquidityPool/{getLiquidityPoolInfo.ts → getLiquidityPoolInfo.js} +0 -0
  97. /package/scripts/{index.ts → index.js} +0 -0
  98. /package/tests/{test.ts → test.js} +0 -0
  99. /package/utils/{chain.ts → chain.js} +0 -0
  100. /package/utils/{config.ts → config.js} +0 -0
@@ -1,17 +1,15 @@
1
1
  import { Provider } from "ethers";
2
- import { getContract, getContractAddress } from "../../utils/contracts";
3
- import { ContractType } from "../../utils/artifacts";
4
- import { ChainId } from "../../configs/chains/index";
5
- import { ERC20 } from "../../typechain-types";
2
+ import getContract from "../../contracts/getContract";
3
+ import getContractAddress from "../../contracts/getContractAddress";
6
4
 
7
5
  const checkAllowance = async (
8
- chainId: ChainId,
9
- tokenId: ContractType,
10
- address: string,
11
- spenderAddress: string,
12
- provider: Provider
6
+ chainId,
7
+ tokenId,
8
+ address,
9
+ spenderAddress,
10
+ provider
13
11
  ) => {
14
- let tokenAddress = getContractAddress(chainId, tokenId as string);
12
+ let tokenAddress = getContractAddress(chainId, tokenId);
15
13
  console.log(
16
14
  `[commons/checkAllowance] Checking allowance for ${address} to ${spenderAddress} on ${chainId} ${tokenId}:${tokenAddress}`
17
15
  );
@@ -21,10 +19,10 @@ const checkAllowance = async (
21
19
  chainId,
22
20
  tokenId,
23
21
  provider
24
- ) as any as ERC20;
22
+ );
25
23
  const allowance = await tokenContract.allowance(address, spenderAddress);
26
24
  return allowance;
27
- } catch (error: any) {
25
+ } catch (error) {
28
26
  console.error(`Error calling allowance: ${error}`);
29
27
  throw new Error(
30
28
  `[commons/checkAllowance] ${chainId} ${tokenId}:${tokenAddress} ${address} ${spenderAddress} ${error}`
@@ -1,7 +1,5 @@
1
- import { Provider, Signer } from "ethers";
2
-
3
- export const estimateGasPrice = async (signer: Signer) => {
4
- const provider = signer.provider as Provider;
1
+ export const estimateGasPrice = async (signer) => {
2
+ const provider = signer.provider;
5
3
  try {
6
4
  const feeData = await provider.getFeeData();
7
5
  const maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;
@@ -13,10 +11,10 @@ export const estimateGasPrice = async (signer: Signer) => {
13
11
  maxFeePerGas,
14
12
  maxPriorityFeePerGas,
15
13
  };
16
- } catch (error: any) {
14
+ } catch (error) {
17
15
  console.log("Error getting gas price", error);
18
- if ((provider as any)?.getGasPrice) {
19
- const gasPrice = await (provider as any).getGasPrice();
16
+ if (provider?.getGasPrice) {
17
+ const gasPrice = await provider.getGasPrice();
20
18
  return { gasPrice };
21
19
  }
22
20
  return { gasPrice: 0 };
@@ -1,11 +1,9 @@
1
- import { ethers, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
1
+ import { ethers } from "ethers";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
4
  import estimateGasPrice from "../methods/commons/estimateGasPrice";
5
- import { ChainId } from "../configs/chains/index";
6
- import { RAACMinter } from "../typechain-types";
7
5
 
8
- async function get(chainId: ChainId, signer: Signer) {
6
+ async function get(chainId, signer) {
9
7
  if (!signer) {
10
8
  throw new Error("Wallet not connected");
11
9
  }
@@ -20,9 +18,9 @@ async function get(chainId: ChainId, signer: Signer) {
20
18
  raacMinterAddress,
21
19
  raacMinterABI,
22
20
  signer
23
- ) as any as RAACMinter;
21
+ );
24
22
 
25
- const handleError = (operation: string) => (error: any) => {
23
+ const handleError = (operation) => (error) => {
26
24
  if (error.code === "BAD_DATA") {
27
25
  console.log(`BAD_DATA from getMinter - ${operation}:`, error.message);
28
26
  return BigInt(0);
@@ -142,7 +140,7 @@ async function get(chainId: ChainId, signer: Signer) {
142
140
 
143
141
  // console.log(tick);
144
142
  return result;
145
- } catch (error: any) {
143
+ } catch (error) {
146
144
  throw new Error(`Error calculating RAAC rewards: ${error.message}`);
147
145
  }
148
146
  }
@@ -1,10 +1,8 @@
1
- import { ethers, Provider, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
1
+ import { ethers } from "ethers";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACMinter } from "../typechain-types";
6
4
 
7
- async function getApy(chainId: ChainId, provider: Provider) {
5
+ async function getApy(chainId, provider) {
8
6
  if (!provider) {
9
7
  throw new Error("Wallet not connected");
10
8
  }
@@ -16,7 +14,7 @@ async function getApy(chainId: ChainId, provider: Provider) {
16
14
  raacMinterAddress,
17
15
  raacMinterABI,
18
16
  provider
19
- ) as any as RAACMinter;
17
+ );
20
18
 
21
19
  const result = { emissionRate: 0n, BLOCKS_PER_DAY: 0n };
22
20
  result.emissionRate = await raacMinterContract.emissionRate();
@@ -29,7 +27,7 @@ async function getApy(chainId: ChainId, provider: Provider) {
29
27
 
30
28
  const apy = (emissionRatePerYear * 10000n) / totalSupply;
31
29
  return apy;
32
- } catch (error: any) {
30
+ } catch (error) {
33
31
  throw new Error(`Error calculating RAAC rewards: ${error.message}`);
34
32
  }
35
33
  }
@@ -1,11 +1,9 @@
1
- import { ethers, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
1
+ import { ethers } from "ethers";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
4
  import estimateGasPrice from "../methods/commons/estimateGasPrice";
5
- import { ChainId } from "../configs/chains/index";
6
- import { RAACMinter } from "../typechain-types";
7
5
 
8
- async function tick(chainId: ChainId, signer: Signer) {
6
+ async function tick(chainId, signer) {
9
7
  if (!signer) {
10
8
  throw new Error("Wallet not connected");
11
9
  }
@@ -18,7 +16,7 @@ async function tick(chainId: ChainId, signer: Signer) {
18
16
  raacMinterAddress,
19
17
  raacMinterABI,
20
18
  signer
21
- ) as any as RAACMinter;
19
+ );
22
20
 
23
21
  const { maxFeePerGas } = await estimateGasPrice(signer);
24
22
 
@@ -32,7 +30,7 @@ async function tick(chainId: ChainId, signer: Signer) {
32
30
  await tick.wait();
33
31
  }
34
32
  return tick;
35
- } catch (error: any) {
33
+ } catch (error) {
36
34
  throw new Error(`Error calculating RAAC rewards: ${error.message}`);
37
35
  }
38
36
  }
@@ -1,13 +1,11 @@
1
1
  import { ethers, Provider } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
5
  async function getAllTokens(
8
- chainId: ChainId,
9
- provider: Provider,
10
- pagination?: { offset: number; limit: number }
6
+ chainId,
7
+ provider,
8
+ pagination
11
9
  ) {
12
10
  try {
13
11
  const raacNFTAddress = getContractAddress(chainId, "raacnft");
@@ -17,14 +15,14 @@ async function getAllTokens(
17
15
  raacNFTAddress,
18
16
  raacNFTABI,
19
17
  provider
20
- ) as any as RAACNFT;
18
+ );
21
19
 
22
20
  const totalSupply = await raacNFTContract.totalSupply();
23
21
  if (totalSupply === 0n) {
24
22
  return [];
25
23
  }
26
24
 
27
- let tokens: bigint[] = [];
25
+ let tokens = [];
28
26
  if (pagination) {
29
27
  const offset = pagination?.offset || 0;
30
28
  const limit = pagination?.limit || 10;
@@ -42,7 +40,7 @@ async function getAllTokens(
42
40
  }
43
41
 
44
42
  return tokens;
45
- } catch (error: any) {
43
+ } catch (error) {
46
44
  console.error("Error getting all tokens:", error);
47
45
  throw new Error(`Failed to get all tokens: ${error.message}`);
48
46
  }
@@ -1,10 +1,8 @@
1
- import { ethers, Provider, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
1
+ import { ethers } from "ethers";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
- async function getBaseUri(chainId: ChainId, provider: Provider) {
5
+ async function getBaseUri(chainId, provider) {
8
6
  if (!provider) {
9
7
  throw new Error("Wallet not connected");
10
8
  }
@@ -17,13 +15,13 @@ async function getBaseUri(chainId: ChainId, provider: Provider) {
17
15
  raacNFTAddress,
18
16
  raacNFTABI,
19
17
  provider
20
- ) as any as RAACNFT;
18
+ );
21
19
 
22
20
  const uri = await raacNFTContract.baseURI();
23
21
 
24
22
  console.log(`Retrieved base uri: ${uri}`);
25
23
  return uri;
26
- } catch (error: any) {
24
+ } catch (error) {
27
25
  console.error("Error adding new batch:", error);
28
26
  throw new Error(`Failed to add new batch: ${error.message}`);
29
27
  }
@@ -1,13 +1,11 @@
1
1
  import { ethers, Provider } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
5
  async function getHousePrice(
8
- chainId: ChainId,
9
- tokenId: number,
10
- provider: Provider
6
+ chainId,
7
+ tokenId,
8
+ provider
11
9
  ) {
12
10
  try {
13
11
  const raacNFTAddress = getContractAddress(chainId, "raacnft");
@@ -17,11 +15,11 @@ async function getHousePrice(
17
15
  raacNFTAddress,
18
16
  raacNFTABI,
19
17
  provider
20
- ) as any as RAACNFT;
18
+ );
21
19
 
22
20
  const price = await raacNFTContract.getHousePrice(tokenId);
23
21
  return ethers.formatEther(price);
24
- } catch (error: any) {
22
+ } catch (error) {
25
23
  console.error("Error getting house price:", error);
26
24
  throw new Error(`Failed to get house price: ${error.message}`);
27
25
  }
@@ -1,10 +1,8 @@
1
1
  import { Contract, ethers, Provider, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
- async function getMintFeePercentage(chainId: ChainId, provider: Provider) {
5
+ async function getMintFeePercentage(chainId, provider) {
8
6
  if (!provider) {
9
7
  throw new Error("Wallet not connected");
10
8
  }
@@ -17,14 +15,14 @@ async function getMintFeePercentage(chainId: ChainId, provider: Provider) {
17
15
  raacNFTAddress,
18
16
  raacNFTABI,
19
17
  provider
20
- ) as any as RAACNFT;
18
+ );
21
19
 
22
20
  const percentage =
23
21
  (await raacNFTContract.MINT_FEE_PERCENTAGE()) / BigInt(10e5);
24
22
 
25
23
  console.log(`Retrieved mint fee percentage: ${percentage}`);
26
24
  return percentage;
27
- } catch (error: any) {
25
+ } catch (error) {
28
26
  console.log("Error retrieving mint fee percentage", error);
29
27
  throw new Error(`Failed to retrieve mint fee percentage: ${error.message}`);
30
28
  }
@@ -1,14 +1,12 @@
1
- import { Contract, ethers, Provider, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
1
+ import { Contract, ethers, Provider } from "ethers";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
5
  // This is the total price: includes the mint price and the mint fee
8
6
  async function getMintPrice(
9
- chainId: ChainId,
10
- tokenId: string | number,
11
- provider: Provider
7
+ chainId,
8
+ tokenId,
9
+ provider
12
10
  ) {
13
11
  if (!provider) {
14
12
  throw new Error("Wallet not connected");
@@ -22,7 +20,7 @@ async function getMintPrice(
22
20
  raacNFTAddress,
23
21
  raacNFTABI,
24
22
  provider
25
- ) as any as RAACNFT;
23
+ );
26
24
 
27
25
  const price = await raacNFTContract.getMintPrice(tokenId);
28
26
  const token = await raacNFTContract.token();
@@ -37,7 +35,7 @@ async function getMintPrice(
37
35
 
38
36
  console.log(`Retrieved house price for ${tokenId}: ${formattedValue}`);
39
37
  return { price, decimals };
40
- } catch (error: any) {
38
+ } catch (error) {
41
39
  console.error("Error retrieving mint price for " + tokenId, error);
42
40
  throw new Error(`Failed retrieve mint price: ${error.message}`);
43
41
  }
@@ -1,13 +1,11 @@
1
- import { ethers, Provider, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
1
+ import { ethers, Provider } from "ethers";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
5
  async function getTokenURI(
8
- chainId: ChainId,
9
- tokenId: string | number,
10
- provider: Provider
6
+ chainId,
7
+ tokenId,
8
+ provider
11
9
  ) {
12
10
  if (!provider) {
13
11
  throw new Error("Wallet not connected");
@@ -21,12 +19,12 @@ async function getTokenURI(
21
19
  raacNFTAddress,
22
20
  raacNFTABI,
23
21
  provider
24
- ) as any as RAACNFT;
22
+ );
25
23
 
26
24
  const uri = await raacNFTContract.tokenURI(tokenId);
27
25
  console.log(`Retrieved token URI: ${uri}`);
28
26
  return uri;
29
- } catch (error: any) {
27
+ } catch (error) {
30
28
  console.error("Error getting token URI:", error);
31
29
  throw new Error(`Failed to get token URI: ${error.message}`);
32
30
  }
@@ -1,14 +1,12 @@
1
1
  import { ethers, Provider } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
5
  async function getTokensByOwner(
8
- chainId: ChainId,
9
- address: string,
10
- provider: Provider,
11
- pagination?: { offset: number; limit: number }
6
+ chainId,
7
+ address,
8
+ provider,
9
+ pagination
12
10
  ) {
13
11
  try {
14
12
  const raacNFTAddress = getContractAddress(chainId, "raacnft");
@@ -18,14 +16,14 @@ async function getTokensByOwner(
18
16
  raacNFTAddress,
19
17
  raacNFTABI,
20
18
  provider
21
- ) as any as RAACNFT;
19
+ );
22
20
  const balance = await raacNFTContract.balanceOf(address);
23
21
 
24
22
  if (balance === 0n) {
25
23
  return { address, tokens: [] };
26
24
  }
27
25
 
28
- let tokens: bigint[] = [];
26
+ let tokens = [];
29
27
  if (pagination) {
30
28
  const offset = pagination?.offset || 0;
31
29
  const limit = pagination?.limit || 10;
@@ -42,7 +40,7 @@ async function getTokensByOwner(
42
40
 
43
41
  // toString()
44
42
  return { address, tokens: tokens.map((token) => token.toString()) };
45
- } catch (error: any) {
43
+ } catch (error) {
46
44
  console.error("Error getting owned NFTs:", error);
47
45
  throw new Error(`Failed to get owned NFTs: ${error.message}`);
48
46
  }
@@ -1,10 +1,8 @@
1
- import { ethers, Provider, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
1
+ import { ethers, Provider } from "ethers";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACHousePrices, RAACNFT } from "../typechain-types";
6
4
 
7
- async function getTotalPropertiesCount(chainId: ChainId, provider: Provider) {
5
+ async function getTotalPropertiesCount(chainId, provider) {
8
6
  if (!provider) {
9
7
  throw new Error("Wallet not connected");
10
8
  }
@@ -16,13 +14,13 @@ async function getTotalPropertiesCount(chainId: ChainId, provider: Provider) {
16
14
  raacHousePrices,
17
15
  raacHousePricesABI,
18
16
  provider
19
- ) as any as RAACHousePrices;
17
+ );
20
18
 
21
19
  const count = await raacHousePricesContract.count();
22
20
 
23
21
  console.log(`Retrieved total properties count: ${count}`);
24
22
  return count;
25
- } catch (error: any) {
23
+ } catch (error) {
26
24
  console.error("Error retrieving total houses count:", error);
27
25
  throw new Error(
28
26
  `Failed to retrieve the number of houses: ${error.message}`
@@ -1,14 +1,12 @@
1
1
  import { ethers, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
5
  async function mint(
8
- chainId: ChainId,
9
- tokenId: string,
10
- amount: bigint,
11
- signer: Signer
6
+ chainId,
7
+ tokenId,
8
+ amount,
9
+ signer
12
10
  ) {
13
11
  if (!signer) {
14
12
  throw new Error("Wallet not connected");
@@ -22,7 +20,7 @@ async function mint(
22
20
  raacNFTAddress,
23
21
  raacNFTABI,
24
22
  signer
25
- ) as any as RAACNFT;
23
+ );
26
24
  const tx = await raacNFTContract.mint(
27
25
  tokenId,
28
26
  ethers.parseEther(amount.toString())
@@ -33,7 +31,7 @@ async function mint(
33
31
  `Minted RAAC NFT with token ID ${tokenId} for ${amount} tokens`
34
32
  );
35
33
  return tx;
36
- } catch (error: any) {
34
+ } catch (error) {
37
35
  console.error("Error minting RAAC NFT:", error);
38
36
  throw new Error(`Failed to mint RAAC NFT: ${error.message}`);
39
37
  }
@@ -1,10 +1,8 @@
1
1
  import { ethers, Signer } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
- async function setBaseUri(chainId: ChainId, newUri: string, signer: Signer) {
5
+ async function setBaseUri(chainId, newUri, signer) {
8
6
  if (!signer) {
9
7
  throw new Error("Wallet not connected");
10
8
  }
@@ -17,14 +15,14 @@ async function setBaseUri(chainId: ChainId, newUri: string, signer: Signer) {
17
15
  raacNFTAddress,
18
16
  raacNFTABI,
19
17
  signer
20
- ) as any as RAACNFT;
18
+ );
21
19
 
22
20
  const tx = await raacNFTContract.setBaseUri(newUri);
23
21
  await tx.wait();
24
22
 
25
23
  console.log(`Set new base URI: ${newUri}`);
26
24
  return tx;
27
- } catch (error: any) {
25
+ } catch (error) {
28
26
  console.error("Error setting base URI:", error);
29
27
  throw new Error(`Failed to set base URI: ${error.message}`);
30
28
  }
@@ -1,10 +1,8 @@
1
1
  import { ethers, Provider } from "ethers";
2
- import { getContractAddress } from "../utils/contracts";
2
+ import getContractAddress from "../contracts/getContractAddress";
3
3
  import { getABI } from "../utils/artifacts";
4
- import { ChainId } from "../configs/chains/index";
5
- import { RAACNFT } from "../typechain-types";
6
4
 
7
- async function totalNFTSupply(chainId: ChainId, provider: Provider) {
5
+ async function totalNFTSupply(chainId, provider) {
8
6
  try {
9
7
  const raacNFTAddress = getContractAddress(chainId, "raacnft");
10
8
  const raacNFTABI = getABI("raacnft");
@@ -13,11 +11,11 @@ async function totalNFTSupply(chainId: ChainId, provider: Provider) {
13
11
  raacNFTAddress,
14
12
  raacNFTABI,
15
13
  provider
16
- ) as any as RAACNFT;
14
+ );
17
15
 
18
16
  const batchSize = await raacNFTContract.totalSupply();
19
17
  return batchSize.toString();
20
- } catch (error: any) {
18
+ } catch (error) {
21
19
  console.error("Error getting current batch size:", error);
22
20
  throw new Error(`Failed to get current batch size: ${error.message}`);
23
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raac/rpc",
3
- "version": "1.0.2-beta.3",
3
+ "version": "1.0.2-beta.4",
4
4
  "description": "RPC Library for RAAC ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,14 +1,12 @@
1
- import { ethers, Signer } from "ethers";
2
- import { getContractAddress } from "../../contracts/getContractAddress";
1
+ import { ethers } from "ethers";
2
+ import getContractAddress from "../../contracts/getContractAddress";
3
3
  import { getABI } from "../../utils/artifacts";
4
- import { ChainId } from "../../configs/chains/index";
5
- import { LendingPool } from "../../typechain-types";
6
4
 
7
5
  async function borrowFromLendingPool(
8
- chainId: ChainId,
9
- tokenId: string,
10
- amount: string,
11
- signer: Signer
6
+ chainId,
7
+ tokenId,
8
+ amount,
9
+ signer
12
10
  ) {
13
11
  try {
14
12
  const lendingPoolAddress = getContractAddress(chainId, "lendingpool");
@@ -17,7 +15,7 @@ async function borrowFromLendingPool(
17
15
  lendingPoolAddress,
18
16
  lendingPoolABI,
19
17
  signer
20
- ) as any as LendingPool;
18
+ );
21
19
 
22
20
  const amountInWei = ethers.parseEther(amount);
23
21
  console.log("Borrowing amount in wei:", amountInWei.toString());
@@ -32,7 +30,7 @@ async function borrowFromLendingPool(
32
30
  console.log(`Transaction hash: ${receipt?.hash}`);
33
31
 
34
32
  return receipt;
35
- } catch (error: any) {
33
+ } catch (error) {
36
34
  console.error("Error in borrowFromLendingPool:", error);
37
35
  throw error;
38
36
  }
@@ -1,16 +1,14 @@
1
- import { ethers, Signer } from "ethers";
2
- import { getContractAddress } from "../../contracts/getContractAddress";
1
+ import { ethers } from "ethers";
2
+ import getContractAddress from "../../contracts/getContractAddress";
3
3
  import { getABI } from "../../utils/artifacts";
4
- import { ChainId } from "../../configs/chains/index";
5
- import { LendingPool } from "../../typechain-types";
6
4
  import checkAllowance from "../../methods/commons/checkAllowance";
7
5
  import approveAsset from "../../wallet/assets/approveAsset";
8
6
 
9
7
  async function borrowFromLendingPoolWithInsurance(
10
- chainId: ChainId,
11
- tokenId: string,
12
- amount: string,
13
- signer: Signer
8
+ chainId,
9
+ tokenId,
10
+ amount,
11
+ signer
14
12
  ) {
15
13
  try {
16
14
  const lendingPoolAddress = getContractAddress(chainId, "lendingpool");
@@ -19,7 +17,7 @@ async function borrowFromLendingPoolWithInsurance(
19
17
  lendingPoolAddress,
20
18
  lendingPoolABI,
21
19
  signer
22
- ) as any as LendingPool;
20
+ );
23
21
 
24
22
  const feeCollectorAddress = getContractAddress(chainId, "feecollector");
25
23
  const userAddress = await signer.getAddress();
@@ -71,7 +69,7 @@ async function borrowFromLendingPoolWithInsurance(
71
69
  console.log(`Transaction hash: ${receipt?.hash}`);
72
70
 
73
71
  return receipt;
74
- } catch (error: any) {
72
+ } catch (error) {
75
73
  console.error("Error in borrowFromLendingPoolWithInsurance:", error);
76
74
  throw error;
77
75
  }