@@ -388,14 +388,27 @@ export class SequencerProvider implements ProviderInterface {
388
388
{ senderAddress, contractDefinition, signature } : DeclareContractTransaction ,
389
389
details : InvocationsDetailsWithNonce
390
390
) : Promise < DeclareContractResponse > {
391
+ if ( 'program' in contractDefinition ) {
392
+ return this . fetchEndpoint ( 'add_transaction' , undefined , {
393
+ type : TransactionType . DECLARE ,
394
+ contract_class : contractDefinition ,
395
+ nonce : toHex ( details . nonce ) ,
396
+ signature : signatureToDecimalArray ( signature ) ,
397
+ sender_address : senderAddress ,
398
+ max_fee : toHex ( details . maxFee || 0 ) ,
399
+ version : '0x1' ,
400
+ } ) . then ( this . responseParser . parseDeclareContractResponse ) ;
401
+ }
402
+ // Cairo 1
391
403
return this . fetchEndpoint ( 'add_transaction' , undefined , {
392
404
type : TransactionType . DECLARE ,
405
+ sender_address : senderAddress ,
406
+ compiled_class_hash : details . compiledClassHash ,
393
407
contract_class : contractDefinition ,
394
408
nonce : toHex ( details . nonce ) ,
395
409
signature : signatureToDecimalArray ( signature ) ,
396
- sender_address : senderAddress ,
397
410
max_fee : toHex ( details . maxFee || 0 ) ,
398
- version : toHex ( details . version || 1 ) ,
411
+ version : '0x2' ,
399
412
} ) . then ( this . responseParser . parseDeclareContractResponse ) ;
400
413
}
401
414
0 commit comments