@@ -188,6 +188,51 @@ describe("test smart contract transactions factory", function () {
188188 assert . deepEqual ( transaction , transactionAbiAware ) ;
189189 } ) ;
190190
191+ it ( "should create 'Transaction' for execute and transfer with EGLD as single token tranfer" , async function ( ) {
192+ const sender = Address . newFromBech32 ( "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th" ) ;
193+ const contract = Address . newFromBech32 ( "erd1qqqqqqqqqqqqqpgqhy6nl6zq07rnzry8uyh6rtyq0uzgtk3e69fqgtz9l4" ) ;
194+ const func = "add" ;
195+ const gasLimit = 6000000n ;
196+ const args = [ new U32Value ( 7 ) ] ;
197+ const token = new Token ( { identifier : "EGLD-000000" , nonce : 0n } ) ;
198+ const transfer = new TokenTransfer ( { token, amount : 10n } ) ;
199+
200+ const transaction = factory . createTransactionForExecute ( sender , {
201+ contract : contract ,
202+ function : func ,
203+ gasLimit : gasLimit ,
204+ arguments : args ,
205+ tokenTransfers : [ transfer ] ,
206+ } ) ;
207+
208+ const transactionAbiAware = abiAwareFactory . createTransactionForExecute ( sender , {
209+ contract : contract ,
210+ function : func ,
211+ gasLimit : gasLimit ,
212+ arguments : args ,
213+ tokenTransfers : [ transfer ] ,
214+ } ) ;
215+
216+ assert . deepEqual (
217+ transaction . sender ,
218+ Address . newFromBech32 ( "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th" ) ,
219+ ) ;
220+ assert . deepEqual (
221+ transaction . receiver ,
222+ Address . newFromBech32 ( "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th" ) ,
223+ ) ;
224+ assert . deepEqual (
225+ transaction . data ,
226+ Buffer . from (
227+ "MultiESDTNFTTransfer@00000000000000000500b9353fe8407f87310c87e12fa1ac807f0485da39d152@01@45474c442d303030303030@@0a@616464@07" ,
228+ ) ,
229+ ) ;
230+ assert . equal ( transaction . gasLimit , gasLimit ) ;
231+ assert . equal ( transaction . value , 0n ) ;
232+
233+ assert . deepEqual ( transaction , transactionAbiAware ) ;
234+ } ) ;
235+
191236 it ( "should create 'Transaction' for execute and transfer multiple esdts" , async function ( ) {
192237 const sender = Address . newFromBech32 ( "erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th" ) ;
193238 const contract = Address . newFromBech32 ( "erd1qqqqqqqqqqqqqpgqak8zt22wl2ph4tswtyc39namqx6ysa2sd8ss4xmlj3" ) ;
0 commit comments