@oydual31/more-vaults-sdk 0.2.5 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oydual31/more-vaults-sdk",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "TypeScript SDK for MoreVaults protocol — viem/wagmi and ethers.js",
5
5
  "type": "module",
6
6
  "exports": {
@@ -766,12 +766,18 @@ export async function quoteComposeFee(
766
766
  * @param fee ETH to send (from quoteComposeFee). Covers readFee for D7.
767
767
  * @returns Transaction hash of the compose execution
768
768
  */
769
+ /**
770
+ * Event topic0 emitted by the escrow when initVaultActionRequest creates a new request.
771
+ * topic1 = GUID (bytes32). Used to extract the async request GUID from executeCompose receipts.
772
+ */
773
+ const ESCROW_REQUEST_TOPIC = '0x304ac8b57de34b9e6118fb049ba362689cfcfab98c30c9d78e3e2e14be7e0972' as const
774
+
769
775
  export async function executeCompose(
770
776
  walletClient: WalletClient,
771
777
  hubPublicClient: PublicClient,
772
778
  composeData: ComposeData,
773
779
  fee: bigint,
774
- ): Promise<{ txHash: Hash }> {
780
+ ): Promise<{ txHash: Hash; guid?: `0x${string}` }> {
775
781
  const account = walletClient.account!
776
782
  const endpoint = getAddress(composeData.endpoint)
777
783
 
@@ -811,5 +817,21 @@ export async function executeCompose(
811
817
  gas: 5_000_000n, // initVaultActionRequest + LZ Read is gas-heavy
812
818
  })
813
819
 
814
- return { txHash }
820
+ // Parse the GUID from the escrow's event in the TX receipt.
821
+ // The composer calls initVaultActionRequest internally, which emits an event
822
+ // with topic1 = GUID. We need this GUID to poll finalization via waitForAsyncRequest.
823
+ let guid: `0x${string}` | undefined
824
+ try {
825
+ const receipt = await hubPublicClient.waitForTransactionReceipt({ hash: txHash, timeout: 60_000 })
826
+ for (const log of receipt.logs) {
827
+ if (log.topics[0] === ESCROW_REQUEST_TOPIC && log.topics[1]) {
828
+ guid = log.topics[1] as `0x${string}`
829
+ break
830
+ }
831
+ }
832
+ } catch {
833
+ // Receipt timeout — guid will be undefined, caller can still poll by balance
834
+ }
835
+
836
+ return { txHash, guid }
815
837
  }