@flaunch/sdk 0.9.9 → 0.9.10

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, concat as concat$1, toHex as toHex$1, zeroHash, formatUnits as formatUnits$1, parseEventLogs, erc721Abi, erc20Abi, parseAbi, createWalletClient, http, 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, concat as concat$1, toHex as toHex$1, zeroHash, formatUnits as formatUnits$1, parseEventLogs, decodeEventLog, erc721Abi, erc20Abi, parseAbi, createWalletClient, http, decodeFunctionData } from 'viem';
3
3
  import axios from 'axios';
4
4
  import { viemAdapter } from '@delvtech/drift-viem';
5
5
 
@@ -26408,6 +26408,50 @@ class ReadFlaunchSDK {
26408
26408
  }
26409
26409
  return poll();
26410
26410
  }
26411
+ /**
26412
+ * Parses a transaction to extract PoolCreated event data
26413
+ * @param txHash - The transaction hash to parse
26414
+ * @returns PoolCreated event parameters or null if not found
26415
+ */
26416
+ async getPoolCreatedFromTx(txHash) {
26417
+ if (!this.publicClient) {
26418
+ throw new Error("Public client is required to fetch transaction data");
26419
+ }
26420
+ // Get transaction receipt
26421
+ const receipt = await this.publicClient.getTransactionReceipt({
26422
+ hash: txHash,
26423
+ });
26424
+ if (!receipt) {
26425
+ throw new Error(`Transaction not found: ${txHash}`);
26426
+ }
26427
+ // Find PoolCreated event in logs by trying to decode each log
26428
+ // Using V1_2 ABI which is compatible with all versions (V1_2 has extra fields that are optional)
26429
+ for (const log of receipt.logs) {
26430
+ try {
26431
+ const decodedLog = decodeEventLog({
26432
+ abi: FlaunchPositionManagerV1_2Abi,
26433
+ data: log.data,
26434
+ topics: log.topics,
26435
+ });
26436
+ if (decodedLog.eventName === "PoolCreated") {
26437
+ return {
26438
+ poolId: decodedLog.args._poolId,
26439
+ memecoin: decodedLog.args._memecoin,
26440
+ memecoinTreasury: decodedLog.args._memecoinTreasury,
26441
+ tokenId: decodedLog.args._tokenId,
26442
+ currencyFlipped: decodedLog.args._currencyFlipped,
26443
+ flaunchFee: decodedLog.args._flaunchFee,
26444
+ params: decodedLog.args._params,
26445
+ };
26446
+ }
26447
+ }
26448
+ catch (error) {
26449
+ // Not a PoolCreated event or decoding failed, continue to next log
26450
+ continue;
26451
+ }
26452
+ }
26453
+ return null;
26454
+ }
26411
26455
  /**
26412
26456
  * Watches for pool swap events
26413
26457
  * @param params - Parameters for watching pool swaps including optional coin filter