@@ -167,7 +167,7 @@ describe('Send transaction', function () {
167167 should . equal ( txJson . from , undefined ) ;
168168 } ) ;
169169
170- it ( 'should build txn with eip1559' , async function ( ) {
170+ it ( 'should build txn with eip1559 for tcelo ' , async function ( ) {
171171 const txBuilder = getBuilder ( 'tcelo' ) as TransactionBuilder ;
172172 txBuilder . fee ( {
173173 fee : '1000000000' ,
@@ -197,6 +197,77 @@ describe('Send transaction', function () {
197197 should . equal ( txJson . maxPriorityFeePerGas , '150' ) ;
198198 } ) ;
199199
200+ it ( 'should build txn with eip1559 for celo' , async function ( ) {
201+ const txBuilder = getBuilder ( 'celo' ) as TransactionBuilder ;
202+ txBuilder . fee ( {
203+ fee : '1000000000' ,
204+ gasLimit : '12100000' ,
205+ eip1559 : {
206+ maxFeePerGas : '7593123' ,
207+ maxPriorityFeePerGas : '150' ,
208+ } ,
209+ } ) ;
210+ txBuilder . counter ( 2 ) ;
211+ txBuilder . type ( TransactionType . Send ) ;
212+ txBuilder . contract ( '0x8f977e912ef500548a0c3be6ddde9899f1199b81' ) ;
213+ txBuilder
214+ . transfer ( )
215+ . coin ( 'celo' )
216+ . amount ( '1000000000' )
217+ . to ( '0x19645032c7f1533395d44a629462e751084d3e4c' )
218+ . expirationTime ( 1590066728 )
219+ . contractSequenceId ( 5 )
220+ . key ( key ) ;
221+ txBuilder . sign ( { key : testData . PRIVATE_KEY } ) ;
222+ const tx = await txBuilder . build ( ) ;
223+ const txJson = tx . toJson ( ) ;
224+ should . equal ( txJson . gasLimit , '12100000' ) ;
225+ should . equal ( txJson . _type , 'EIP1559' ) ;
226+ should . equal ( txJson . maxFeePerGas , '7593123' ) ;
227+ should . equal ( txJson . maxPriorityFeePerGas , '150' ) ;
228+ } ) ;
229+
230+ it ( 'should build txn with eip1559 for celo token' , async function ( ) {
231+ const txBuilder = getBuilder ( 'cusd' ) as TransactionBuilder ;
232+ txBuilder . fee ( {
233+ fee : '1000000000' ,
234+ gasLimit : '12100000' ,
235+ eip1559 : {
236+ maxFeePerGas : '7593123' ,
237+ maxPriorityFeePerGas : '150' ,
238+ } ,
239+ } ) ;
240+ txBuilder . counter ( 2 ) ;
241+ txBuilder . type ( TransactionType . Send ) ;
242+ txBuilder . contract ( '0x8f977e912ef500548a0c3be6ddde9899f1199b81' ) ;
243+ txBuilder
244+ . transfer ( )
245+ . coin ( 'cusd' )
246+ . amount ( '1000000000' )
247+ . to ( '0x19645032c7f1533395d44a629462e751084d3e4c' )
248+ . expirationTime ( 1590066728 )
249+ . contractSequenceId ( 5 )
250+ . key ( key ) ;
251+ txBuilder . sign ( { key : testData . PRIVATE_KEY } ) ;
252+ const tx = await txBuilder . build ( ) ;
253+ const txJson = tx . toJson ( ) ;
254+ should . equal ( txJson . gasLimit , '12100000' ) ;
255+ should . equal ( txJson . _type , 'EIP1559' ) ;
256+ should . equal ( txJson . maxFeePerGas , '7593123' ) ;
257+ should . equal ( txJson . maxPriorityFeePerGas , '150' ) ;
258+ } ) ;
259+
260+ it ( 'should decode token txn' , async function ( ) {
261+ const txBuilder = getBuilder ( 'cusd' ) as TransactionBuilder ;
262+ txBuilder . from ( testData . PROD_SEND_TOKEN_BROADCAST ) ;
263+ const tx = await txBuilder . build ( ) ;
264+ const txJson = tx . toJson ( ) ;
265+ should . equal ( txJson . gasLimit , '12100000' ) ;
266+ should . equal ( txJson . _type , 'EIP1559' ) ;
267+ should . equal ( txJson . maxFeePerGas , '7593123' ) ;
268+ should . equal ( txJson . maxPriorityFeePerGas , '150' ) ;
269+ } ) ;
270+
200271 it ( 'should build legacy txn for celo' , async function ( ) {
201272 const txBuilder = getBuilder ( 'celo' ) as TransactionBuilder ;
202273 txBuilder . fee ( {
@@ -218,7 +289,7 @@ describe('Send transaction', function () {
218289 const txJson = tx . toJson ( ) ;
219290 should . equal ( txJson . gasLimit , '12100000' ) ;
220291 should . equal ( txJson . _type , 'Legacy' ) ;
221- should . equal ( txJson . v , '0xa4ec ' ) ;
292+ should . equal ( txJson . v , '0x0149fb ' ) ;
222293 } ) ;
223294
224295 it ( 'a send token transaction without final v' , async ( ) => {
0 commit comments