@@ -414,18 +414,20 @@ export class FireblocksService {
414414 messages : [
415415 {
416416 content : tx . unsigned_tx_hash ,
417+ derivationPath : [ 44 , 459 , integration . vaultId , 0 , 0 ] ,
417418 preHash : {
418419 content : tx . unsigned_tx_serialized ,
419420 hashAlgorithm : 'SHA256' ,
420421 } ,
421422 } ,
422423 ] ,
424+ algorithm : SigningAlgorithm . MPC_ECDSA_SECP256K1 ,
423425 } ,
424426 } ;
425427
426428 const fbSigner = this . getSigner ( integration ) ;
427429 const fbNote = note ? note : 'KAVA tx from @kilnfi/sdk' ;
428- const fbTx = await fbSigner . sign ( payload , 'KAVA_KAVA' , fbNote ) ;
430+ const fbTx = await fbSigner . sign ( payload , undefined , fbNote ) ;
429431 const signature = fbTx . signedMessages ?. [ 0 ] ?. signature . fullSig ;
430432
431433 if ( ! signature ) {
@@ -451,6 +453,61 @@ export class FireblocksService {
451453 } ;
452454 }
453455
456+ /**
457+ * Sign a NOBLE transaction on Fireblocks
458+ */
459+ async signNobleTx (
460+ integration : FireblocksIntegration ,
461+ tx : components [ 'schemas' ] [ 'DYDXUnsignedTx' ] ,
462+ note ?: string ,
463+ ) : Promise < {
464+ signed_tx : { data : components [ 'schemas' ] [ 'DYDXSignedTx' ] } ;
465+ fireblocks_tx : TransactionResponse ;
466+ } > {
467+ const payload = {
468+ rawMessageData : {
469+ messages : [
470+ {
471+ content : tx . unsigned_tx_hash ,
472+ derivationPath : [ 44 , 118 , integration . vaultId , 0 , 0 ] ,
473+ preHash : {
474+ content : tx . unsigned_tx_serialized ,
475+ hashAlgorithm : 'SHA256' ,
476+ } ,
477+ } ,
478+ ] ,
479+ algorithm : SigningAlgorithm . MPC_ECDSA_SECP256K1 ,
480+ } ,
481+ } ;
482+
483+ const fbSigner = this . getSigner ( integration ) ;
484+ const fbNote = note ? note : 'NOBLE tx from @kilnfi/sdk' ;
485+ const fbTx = await fbSigner . sign ( payload , undefined , fbNote ) ;
486+ const signature = fbTx . signedMessages ?. [ 0 ] ?. signature . fullSig ;
487+
488+ if ( ! signature ) {
489+ throw new Error ( 'Fireblocks signature is missing' ) ;
490+ }
491+
492+ const preparedTx = await this . client . POST ( '/v1/noble/transaction/prepare' , {
493+ body : {
494+ pubkey : tx . pubkey ,
495+ tx_body : tx . tx_body ,
496+ tx_auth_info : tx . tx_auth_info ,
497+ signature : signature ,
498+ } ,
499+ } ) ;
500+
501+ if ( preparedTx . error ) {
502+ throw new Error ( 'Failed to prepare transaction' ) ;
503+ }
504+
505+ return {
506+ signed_tx : preparedTx . data ,
507+ fireblocks_tx : fbTx ,
508+ } ;
509+ }
510+
454511 /**
455512 * Sign a OSMO transaction on Fireblocks
456513 */
@@ -699,7 +756,7 @@ export class FireblocksService {
699756 }
700757
701758 /**
702- * Sign and broadcast an ETH transaction with given integration using Fireblocks contract call feature
759+ * Sign an ETH transaction with given integration using Fireblocks raw signing
703760 */
704761 async signEthTx (
705762 integration : FireblocksIntegration ,
@@ -774,6 +831,61 @@ export class FireblocksService {
774831 return await fbSigner . signAndBroadcastWith ( payload , assetId , tx , integration . fireblocksDestinationId , true , fbNote ) ;
775832 }
776833
834+ /**
835+ * Sign a POL transaction with given integration using Fireblocks raw signing
836+ */
837+ async signPolTx (
838+ integration : FireblocksIntegration ,
839+ tx : components [ 'schemas' ] [ 'POLUnsignedTx' ] ,
840+ assetId : 'ETH_TEST5' | 'ETH' ,
841+ note ?: string ,
842+ ) : Promise < {
843+ signed_tx : { data : components [ 'schemas' ] [ 'POLSignedTx' ] } ;
844+ fireblocks_tx : TransactionResponse ;
845+ } > {
846+ const payload = {
847+ rawMessageData : {
848+ messages : [
849+ {
850+ content : tx . unsigned_tx_hash ,
851+ preHash : {
852+ content : tx . unsigned_tx_serialized ,
853+ hashAlgorithm : 'KECCAK256' ,
854+ } ,
855+ } ,
856+ ] ,
857+ } ,
858+ } ;
859+
860+ const fbSigner = this . getSigner ( integration ) ;
861+ const fbNote = note ? note : 'POL tx from @kilnfi/sdk' ;
862+ const fbTx = await fbSigner . sign ( payload , assetId , fbNote ) ;
863+
864+ const signature = fbTx ?. signedMessages ?. [ 0 ] ?. signature ;
865+
866+ if ( ! signature ) {
867+ throw new Error ( 'Fireblocks signature is missing' ) ;
868+ }
869+
870+ const preparedTx = await this . client . POST ( '/v1/pol/transaction/prepare' , {
871+ body : {
872+ unsigned_tx_serialized : tx . unsigned_tx_serialized ,
873+ r : `0x${ signature . r } ` ,
874+ s : `0x${ signature . s } ` ,
875+ v : signature . v ?? 0 ,
876+ } ,
877+ } ) ;
878+
879+ if ( preparedTx . error ) {
880+ throw new Error ( 'Failed to prepare transaction' ) ;
881+ }
882+
883+ return {
884+ signed_tx : preparedTx . data ,
885+ fireblocks_tx : fbTx ,
886+ } ;
887+ }
888+
777889 /**
778890 * Sign and broadcast a POL transaction with given integration using Fireblocks contract call feature
779891 */
0 commit comments