@@ -212,4 +212,51 @@ describe('Ton Transfer Builder', () => {
212212 const txJson2 = tx2 . toJson ( ) ;
213213 txJson2 . destinationAlias . should . equal ( otherFormat ) ;
214214 } ) ;
215+
216+ it ( 'should build a transfer tx compatible with v3 wallet contract' , async function ( ) {
217+ const txBuilder = factory . getTransferBuilder ( ) ;
218+ txBuilder . sender ( testData . vestingContract . address ) ;
219+ txBuilder . sequenceNumber ( 3 ) ;
220+ txBuilder . expireTime ( 1761215512 ) ;
221+ txBuilder . send ( testData . v3CompatibleSignedSendTransactionFor . recipient ) ;
222+ txBuilder . isV3ContractMessage ( true ) ;
223+ txBuilder . bounceable ( true ) ;
224+ txBuilder . addSignature (
225+ { pub : testData . vestingContract . publicKey } ,
226+ Buffer . from ( testData . vestingContract . signature , 'base64' )
227+ ) ;
228+ const tx = await txBuilder . build ( ) ;
229+ should . equal ( tx . type , TransactionType . Send ) ;
230+ tx . inputs . length . should . equal ( 1 ) ;
231+ tx . inputs [ 0 ] . should . deepEqual ( {
232+ address : testData . vestingContract . address ,
233+ value : testData . v3CompatibleSignedSendTransactionFor . recipient . amount ,
234+ coin : 'tton' ,
235+ } ) ;
236+ tx . outputs . length . should . equal ( 1 ) ;
237+ tx . outputs [ 0 ] . should . deepEqual ( {
238+ address : testData . v3CompatibleSignedSendTransactionFor . recipient . address ,
239+ value : testData . v3CompatibleSignedSendTransactionFor . recipient . amount ,
240+ coin : 'tton' ,
241+ } ) ;
242+ } ) ;
243+
244+ it ( 'should build a v3 compatible send transaction using raw transaction hex' , async function ( ) {
245+ const txBuilder = factory . from ( testData . v3CompatibleSignedSendTransactionFor . txBounceable ) ;
246+ const builtTx = await txBuilder . build ( ) ;
247+ const jsonTx = builtTx . toJson ( ) ;
248+ should . equal ( builtTx . type , TransactionType . Send ) ;
249+ should . equal (
250+ builtTx . signablePayload . toString ( 'base64' ) ,
251+ testData . v3CompatibleSignedSendTransactionFor . bounceableSignable
252+ ) ;
253+ should . equal ( builtTx . id , testData . v3CompatibleSignedSendTransactionFor . txIdBounceable ) ;
254+ jsonTx . sender . should . equal ( testData . vestingContract . addressBounceable ) ;
255+ jsonTx . destination . should . equal ( testData . v3CompatibleSignedSendTransactionFor . recipient . address ) ;
256+ jsonTx . destinationAlias . should . equal ( testData . v3CompatibleSignedSendTransactionFor . recipientNonBounceable . address ) ;
257+ jsonTx . amount . should . equal ( testData . v3CompatibleSignedSendTransactionFor . recipient . amount ) ;
258+ jsonTx . seqno . should . equal ( 3 ) ;
259+ jsonTx . expirationTime . should . equal ( 1761215512 ) ;
260+ jsonTx . bounceable . should . equal ( true ) ;
261+ } ) ;
215262} ) ;
0 commit comments