@flaunch/sdk 0.9.0-beta.2 → 0.9.0

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.
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createDrift as createDrift$1 } from '@delvtech/drift';
2
- import { zeroAddress, parseEther, encodeAbiParameters as encodeAbiParameters$1, maxUint256 as maxUint256$1, encodeFunctionData, maxUint160, maxUint48, parseUnits, hexToBigInt as hexToBigInt$1, pad as pad$1, keccak256 as keccak256$1, encodePacked, stringToHex as stringToHex$1, zeroHash, formatUnits as formatUnits$1, createPublicClient, http, concat as concat$1, toHex as toHex$1, formatEther, erc721Abi, erc20Abi, parseAbi, createWalletClient, decodeFunctionData } from 'viem';
2
+ import { zeroAddress, parseEther, encodeAbiParameters as encodeAbiParameters$1, maxUint256 as maxUint256$1, encodeFunctionData, maxUint160, maxUint48, parseUnits, hexToBigInt as hexToBigInt$1, pad as pad$1, keccak256 as keccak256$1, encodePacked, stringToHex as stringToHex$1, zeroHash, formatUnits as formatUnits$1, createPublicClient, http, parseEventLogs, concat as concat$1, toHex as toHex$1, formatEther, erc721Abi, erc20Abi, parseAbi, createWalletClient, decodeFunctionData } from 'viem';
3
3
  import axios from 'axios';
4
4
  import { viemAdapter } from '@delvtech/drift-viem';
5
5
 
@@ -23900,16 +23900,14 @@ class ReadTreasuryManagerFactory {
23900
23900
  });
23901
23901
  // Wait for transaction receipt
23902
23902
  const receipt = await publicClient.waitForTransactionReceipt({ hash });
23903
- // Get the logs from the receipt and find the ManagerDeployed event
23904
- const events = await publicClient.getContractEvents({
23905
- address: this.contract.address,
23903
+ // Parse the ManagerDeployed event from receipt logs
23904
+ const parsedLogs = parseEventLogs({
23906
23905
  abi: TreasuryManagerFactoryAbi,
23907
23906
  eventName: "ManagerDeployed",
23908
- fromBlock: receipt.blockNumber,
23909
- toBlock: receipt.blockNumber,
23907
+ logs: receipt.logs,
23910
23908
  });
23911
23909
  // Find the event from our transaction
23912
- const event = events.find((e) => e.transactionHash === hash);
23910
+ const event = parsedLogs.find((log) => log.address.toLowerCase() === this.contract.address.toLowerCase());
23913
23911
  if (!event) {
23914
23912
  throw new Error("ManagerDeployed event not found in transaction logs");
23915
23913
  }
@@ -26414,13 +26412,13 @@ class ReadFlaunchSDK {
26414
26412
  * Calculates the coin price in USD based on the current ETH/USDC price
26415
26413
  * @param coinAddress - The address of the coin
26416
26414
  * @param version - Optional specific version to use. If not provided, will be determined automatically
26417
- * @returns Promise<string> - The price of the coin in USD with 2 decimal precision
26415
+ * @returns Promise<string> - The price of the coin in USD with 18 decimal precision
26418
26416
  */
26419
26417
  async coinPriceInUSD({ coinAddress, version, drift, }) {
26420
26418
  const coinVersion = version || (await this.getCoinVersion(coinAddress));
26421
26419
  const ethPerCoin = await this.coinPriceInETH(coinAddress, coinVersion);
26422
26420
  const ethPrice = await this.getETHUSDCPrice(drift);
26423
- return (parseFloat(ethPerCoin) * ethPrice).toFixed(2);
26421
+ return (parseFloat(ethPerCoin) * ethPrice).toFixed(18);
26424
26422
  }
26425
26423
  async coinMarketCapInUSD({ coinAddress, version, drift, }) {
26426
26424
  const totalSupply = 100000000000; // 100 Billion tokens