@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/README.md +14 -0
- package/dist/index.cjs.js +44 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +45 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/sdk/FlaunchSDK.d.ts +8 -2
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/types.d.ts +24 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -161,6 +161,20 @@ const hash = await flaunchWrite.flaunchIPFS({
|
|
|
161
161
|
telegramUrl: "https://t.me/example",
|
|
162
162
|
},
|
|
163
163
|
});
|
|
164
|
+
|
|
165
|
+
// parse the logs from the tx hash to get memecoin address and Flaunch NFT tokenId
|
|
166
|
+
|
|
167
|
+
import { PoolCreatedEventData } from "@flaunch/sdk";
|
|
168
|
+
|
|
169
|
+
// Parse the flaunch transaction hash
|
|
170
|
+
const poolCreatedData: PoolCreatedEventData | null =
|
|
171
|
+
await flaunchRead.getPoolCreatedFromTx(hash);
|
|
172
|
+
|
|
173
|
+
if (poolCreatedData) {
|
|
174
|
+
console.log("Memecoin Address:", poolCreatedData.memecoin);
|
|
175
|
+
console.log("Token ID:", poolCreatedData.tokenId);
|
|
176
|
+
// ... other params
|
|
177
|
+
}
|
|
164
178
|
```
|
|
165
179
|
|
|
166
180
|
#### How to generate `base64Image` from User uploaded file
|
package/dist/index.cjs.js
CHANGED
|
@@ -26416,6 +26416,50 @@ class ReadFlaunchSDK {
|
|
|
26416
26416
|
}
|
|
26417
26417
|
return poll();
|
|
26418
26418
|
}
|
|
26419
|
+
/**
|
|
26420
|
+
* Parses a transaction to extract PoolCreated event data
|
|
26421
|
+
* @param txHash - The transaction hash to parse
|
|
26422
|
+
* @returns PoolCreated event parameters or null if not found
|
|
26423
|
+
*/
|
|
26424
|
+
async getPoolCreatedFromTx(txHash) {
|
|
26425
|
+
if (!this.publicClient) {
|
|
26426
|
+
throw new Error("Public client is required to fetch transaction data");
|
|
26427
|
+
}
|
|
26428
|
+
// Get transaction receipt
|
|
26429
|
+
const receipt = await this.publicClient.getTransactionReceipt({
|
|
26430
|
+
hash: txHash,
|
|
26431
|
+
});
|
|
26432
|
+
if (!receipt) {
|
|
26433
|
+
throw new Error(`Transaction not found: ${txHash}`);
|
|
26434
|
+
}
|
|
26435
|
+
// Find PoolCreated event in logs by trying to decode each log
|
|
26436
|
+
// Using V1_2 ABI which is compatible with all versions (V1_2 has extra fields that are optional)
|
|
26437
|
+
for (const log of receipt.logs) {
|
|
26438
|
+
try {
|
|
26439
|
+
const decodedLog = viem.decodeEventLog({
|
|
26440
|
+
abi: FlaunchPositionManagerV1_2Abi,
|
|
26441
|
+
data: log.data,
|
|
26442
|
+
topics: log.topics,
|
|
26443
|
+
});
|
|
26444
|
+
if (decodedLog.eventName === "PoolCreated") {
|
|
26445
|
+
return {
|
|
26446
|
+
poolId: decodedLog.args._poolId,
|
|
26447
|
+
memecoin: decodedLog.args._memecoin,
|
|
26448
|
+
memecoinTreasury: decodedLog.args._memecoinTreasury,
|
|
26449
|
+
tokenId: decodedLog.args._tokenId,
|
|
26450
|
+
currencyFlipped: decodedLog.args._currencyFlipped,
|
|
26451
|
+
flaunchFee: decodedLog.args._flaunchFee,
|
|
26452
|
+
params: decodedLog.args._params,
|
|
26453
|
+
};
|
|
26454
|
+
}
|
|
26455
|
+
}
|
|
26456
|
+
catch (error) {
|
|
26457
|
+
// Not a PoolCreated event or decoding failed, continue to next log
|
|
26458
|
+
continue;
|
|
26459
|
+
}
|
|
26460
|
+
}
|
|
26461
|
+
return null;
|
|
26462
|
+
}
|
|
26419
26463
|
/**
|
|
26420
26464
|
* Watches for pool swap events
|
|
26421
26465
|
* @param params - Parameters for watching pool swaps including optional coin filter
|