@@ -9,7 +9,6 @@ export interface signFlowTestSuitArgs {
99 fullSignedTxHex : string ;
1010 privateKey : { prv1 : string ; prv2 : string } ;
1111 txHash : string ;
12- skipImportInCTxBuilder ?: boolean ;
1312}
1413
1514/**
@@ -52,18 +51,14 @@ export default function signFlowTestSuit(data: signFlowTestSuitArgs): void {
5251 tx . id . should . equal ( data . txHash ) ;
5352 } ) ;
5453
55- // TODO: Skip for ImportInC: P-chain signer addresses aren't in the raw transaction,
56- // so signing a recovered unsigned tx requires addresses to be provided separately.
57- if ( ! data . skipImportInCTxBuilder ) {
58- it ( 'Should half sign tx from unsigned raw tx' , async ( ) => {
59- const txBuilder = data . newTxFactory ( ) . from ( data . unsignedTxHex ) ;
60- txBuilder . sign ( { key : data . privateKey . prv1 } ) ;
61- const tx = await txBuilder . build ( ) ;
62- const rawTx = tx . toBroadcastFormat ( ) ;
63- rawTx . should . equal ( data . halfSignedTxHex ) ;
64- tx . id . should . equal ( data . txHash ) ;
65- } ) ;
66- }
54+ it ( 'Should half sign tx from unsigned raw tx' , async ( ) => {
55+ const txBuilder = data . newTxFactory ( ) . from ( data . unsignedTxHex ) ;
56+ txBuilder . sign ( { key : data . privateKey . prv1 } ) ;
57+ const tx = await txBuilder . build ( ) ;
58+ const rawTx = tx . toBroadcastFormat ( ) ;
59+ rawTx . should . equal ( data . halfSignedTxHex ) ;
60+ tx . id . should . equal ( data . txHash ) ;
61+ } ) ;
6762
6863 it ( 'Should recover half signed tx from half signed raw tx' , async ( ) => {
6964 const txBuilder = data . newTxFactory ( ) . from ( data . halfSignedTxHex ) ;
@@ -92,28 +87,23 @@ export default function signFlowTestSuit(data: signFlowTestSuitArgs): void {
9287 tx . id . should . equal ( data . txHash ) ;
9388 } ) ;
9489
95- if ( ! data . skipImportInCTxBuilder ) {
96- it ( 'Should full sign a tx from half signed raw tx' , async ( ) => {
97- const txBuilder = data . newTxFactory ( ) . from ( data . halfSignedTxHex ) ;
98- txBuilder . sign ( { key : data . privateKey . prv2 } ) ;
99- const tx = await txBuilder . build ( ) ;
100- const rawTx = tx . toBroadcastFormat ( ) ;
101- rawTx . should . equal ( data . fullSignedTxHex ) ;
102- tx . id . should . equal ( data . txHash ) ;
103- } ) ;
104- }
90+ it ( 'Should full sign a tx from half signed raw tx' , async ( ) => {
91+ const txBuilder = data . newTxFactory ( ) . from ( data . halfSignedTxHex ) ;
92+ txBuilder . sign ( { key : data . privateKey . prv2 } ) ;
93+ const tx = await txBuilder . build ( ) ;
94+ const rawTx = tx . toBroadcastFormat ( ) ;
95+ rawTx . should . equal ( data . fullSignedTxHex ) ;
96+ tx . id . should . equal ( data . txHash ) ;
97+ } ) ;
10598
106- // Skip for ImportInC: P-chain signer addresses aren't in the recovered transaction's address maps
107- if ( ! data . skipImportInCTxBuilder ) {
108- it ( 'Should full sign a tx from unsigned raw tx' , async ( ) => {
109- const txBuilder = data . newTxFactory ( ) . from ( data . unsignedTxHex ) ;
110- txBuilder . sign ( { key : data . privateKey . prv1 } ) ;
111- txBuilder . sign ( { key : data . privateKey . prv2 } ) ;
112- const tx = await txBuilder . build ( ) ;
113- const rawTx = tx . toBroadcastFormat ( ) ;
114- rawTx . should . equal ( data . fullSignedTxHex ) ;
115- tx . id . should . equal ( data . txHash ) ;
116- } ) ;
117- }
99+ it ( 'Should full sign a tx from unsigned raw tx' , async ( ) => {
100+ const txBuilder = data . newTxFactory ( ) . from ( data . unsignedTxHex ) ;
101+ txBuilder . sign ( { key : data . privateKey . prv1 } ) ;
102+ txBuilder . sign ( { key : data . privateKey . prv2 } ) ;
103+ const tx = await txBuilder . build ( ) ;
104+ const rawTx = tx . toBroadcastFormat ( ) ;
105+ rawTx . should . equal ( data . fullSignedTxHex ) ;
106+ tx . id . should . equal ( data . txHash ) ;
107+ } ) ;
118108 } ) ;
119109}
0 commit comments