From 8b640b2512da742bf85886f1f8339c2a925d2a79 Mon Sep 17 00:00:00 2001 From: menefrego15 Date: Fri, 10 Oct 2025 15:45:59 +0200 Subject: [PATCH 1/2] ton flow transaction --- src/fireblocks.ts | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/src/fireblocks.ts b/src/fireblocks.ts index 243b654..5d7062b 100644 --- a/src/fireblocks.ts +++ b/src/fireblocks.ts @@ -1385,22 +1385,20 @@ export class FireblocksService { } /** - * Sign a TON transaction on Fireblocks + * Create a TON transaction in Fireblocks without waiting for completion */ - async signTonTx( + async createTonTx( integration: FireblocksIntegration, tx: components['schemas']['TONTx'], assetId: 'TON_TEST' | 'TON', note?: string, - ): Promise<{ - signed_tx: { data: components['schemas']['TONPreparedTx'] }; - fireblocks_tx: TransactionResponse; - }> { + ): Promise { const payload = { rawMessageData: { messages: [ { content: tx.unsigned_tx_hash, + //TODO : ADD PREHASH LATER IF FB SUPPORT TON HASH ALGORITHM }, ], }, @@ -1408,8 +1406,23 @@ export class FireblocksService { const fbSigner = this.getSigner(integration); const fbNote = note ? note : 'TON tx from @kilnfi/sdk'; - const fbTx = await fbSigner.sign(payload, assetId, fbNote); - const signature = fbTx.signedMessages?.[0]?.signature?.fullSig; + return await fbSigner.createTransaction(payload, assetId, fbNote); + } + + /** + * Wait for a TON transaction to complete and prepare it for broadcast + */ + async waitForTonTxCompletion( + integration: FireblocksIntegration, + tx: components['schemas']['TONTx'], + fbTx: TransactionResponse, + ): Promise<{ + signed_tx: { data: components['schemas']['TONPreparedTx'] }; + fireblocks_tx: TransactionResponse; + }> { + const fbSigner = this.getSigner(integration); + const completedTx = await fbSigner.waitForTxCompletion(fbTx); + const signature = completedTx.signedMessages?.[0]?.signature?.fullSig; if (!signature) { throw new Error(ERRORS.MISSING_SIGNATURE); @@ -1429,10 +1442,26 @@ export class FireblocksService { return { signed_tx: preparedTx.data, - fireblocks_tx: fbTx, + fireblocks_tx: completedTx, }; } + /** + * Sign a TON transaction on Fireblocks + */ + async signTonTx( + integration: FireblocksIntegration, + tx: components['schemas']['TONTx'], + assetId: 'TON_TEST' | 'TON', + note?: string, + ): Promise<{ + signed_tx: { data: components['schemas']['TONPreparedTx'] }; + fireblocks_tx: TransactionResponse; + }> { + const fbTx = await this.createTonTx(integration, tx, assetId, note); + return await this.waitForTonTxCompletion(integration, tx, fbTx); + } + /** * Sign a XTZ transaction on Fireblocks */ From 87445af5639464b1f044295cebb0a0906bf701a2 Mon Sep 17 00:00:00 2001 From: menefrego15 Date: Fri, 10 Oct 2025 15:52:19 +0200 Subject: [PATCH 2/2] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 75541d4..7a890df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kilnfi/sdk", - "version": "4.2.23", + "version": "4.2.24", "autor": "Kiln (https://kiln.fi)", "license": "BUSL-1.1", "description": "JavaScript sdk for Kiln API",