@@ -42,42 +42,27 @@ export class AleoSigner
4242 coreSalt : string ,
4343 warpSalt ?: string ,
4444 ) : Promise < string [ ] > {
45- let programs = loadProgramsInDeployOrder ( programName ) ;
46-
47- programs = programs . map ( ( p ) => {
48- return this . Program . fromString (
49- p
50- . toString ( )
51- . replaceAll (
52- / ( m a i l b o x | d i s p a t c h _ p r o x y | v a l i d a t o r _ a n n o u n c e ) \. a l e o / g,
53- ( _ , p1 ) => `${ p1 } _${ coreSalt } .aleo` ,
54- )
55- . replaceAll (
56- / ( h y p _ n a t i v e | h y p _ c o l l a t e r a l | h y p _ s y n t h e t i c ) \. a l e o / g,
57- ( _ , p1 ) => `${ p1 } _${ warpSalt || coreSalt } .aleo` ,
58- ) ,
59- ) ;
60- } ) ;
61-
62- for ( const program of programs ) {
63- const isDeployed = await this . isProgramDeployed ( program . id ( ) ) ;
64-
65- // if the program is already deployed (which can be the case for some imports)
66- // we simply skip it
67- if ( isDeployed ) {
68- continue ;
45+ const programs = loadProgramsInDeployOrder ( programName , coreSalt , warpSalt ) ;
46+
47+ for ( const { id, program } of programs ) {
48+ try {
49+ const txId = await this . programManager . deploy ( program , 0 , false ) ;
50+
51+ await this . aleoClient . waitForTransactionConfirmation ( txId ) ;
52+ } catch ( err ) {
53+ if (
54+ err instanceof Error &&
55+ err . message ===
56+ `Error validating program: Program ${ id } already exists on the network, please rename your program`
57+ ) {
58+ continue ;
59+ }
60+
61+ throw err ;
6962 }
70-
71- const txId = await this . programManager . deploy (
72- program . toString ( ) ,
73- 0 ,
74- false ,
75- ) ;
76-
77- await this . aleoClient . waitForTransactionConfirmation ( txId ) ;
7863 }
7964
80- return programs . map ( ( p ) => p . id ( ) ) ;
65+ return programs . map ( ( p ) => p . id ) ;
8166 }
8267
8368 getSignerAddress ( ) : string {
@@ -109,15 +94,6 @@ export class AleoSigner
10994
11095 // ### TX CORE ###
11196
112- private async isProgramDeployed ( program : string ) {
113- try {
114- await this . aleoClient . getProgram ( program ) ;
115- return true ;
116- } catch {
117- return false ;
118- }
119- }
120-
12197 async createMailbox (
12298 req : Omit < AltVM . ReqCreateMailbox , 'signer' > ,
12399 ) : Promise < AltVM . ResCreateMailbox > {
0 commit comments