@@ -497,15 +497,17 @@ const latestHash = networkClient.getLatestBlockHash();
497497
498498---
499499
500- ### ` getProgram (programId) ► Promise .< string> `
500+ ### ` getProgram (programId, edition ) ► Promise .< string> `
501501
502502
503503
504504Returns the source code of a program given a program ID.
505505
506506Parameters | Type | Description
507507--- | --- | ---
508- __programId__ | ` string` | *The program ID of a program deployed to the Aleo Network*
508+ __programId__ | ` string` | *The program ID of a program deployed to the Aleo Network.*
509+ __edition__ | ` number` | *The edition of the program to fetch. When this is undefined it will fetch the latest version.*
510+ __*return*__ | ` Promise .< string> ` | *The source code of the program.*
509511__*return*__ | ` Promise .< string> ` | *Source code of the program*
510512
511513#### Examples
@@ -516,23 +518,57 @@ import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
516518// Create a network client.
517519const networkClient = new AleoNetworkClient (" http://api.explorer.provable.com/v1" , undefined );
518520
521+ // Get the source code of a program.)
522+ ` ` `
523+ ` ` ` javascript
524+ import { AleoNetworkClient } from " @provablehq/sdk/mainnet.js" ;
525+
526+ // Create a network client.
527+ const networkClient = new AleoNetworkClient (" http://api.explorer.provable.com/v1" , undefined );
528+
519529const program = networkClient .getProgram (" hello_hello.aleo" );
520530const expectedSource = " program hello_hello.aleo;\n\n function hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n "
521531assert .equal (program, expectedSource);
522532` ` `
523533
524534---
525535
526- ### ` getProgramObject (inputProgram) ► Promise .< Program> `
536+ ### ` getLatestProgramEdition (programId) ► Promise .< number> `
537+
538+ 
539+
540+ Returns the current program edition deployed on the Aleo network.
541+
542+ Parameters | Type | Description
543+ --- | --- | ---
544+ __programId__ | ` string` | *The program ID of a program deployed to the Aleo Network.*
545+ __*return*__ | ` Promise .< number> ` | *The edition of the program.*
546+
547+ #### Examples
548+
549+ ` ` ` javascript
550+ import { AleoNetworkClient } from " @provablehq/sdk/mainnet.js" ;
551+
552+ // Create a network client.
553+ const networkClient = new AleoNetworkClient (" http://api.explorer.provable.com/v1" , undefined );
554+
555+ const programVersion = networkClient .getProgramSource (" hello_hello.aleo" );
556+ assert .equal (programVersion, 1 );
557+ ` ` `
558+
559+ ---
560+
561+ ### ` getProgramObject (inputProgram, edition) ► Promise .< Program> `
527562
528563
529564
530565Returns a program object from a program ID or program source code.
531566
532567Parameters | Type | Description
533568--- | --- | ---
534- __inputProgram__ | ` string` | *The program ID or program source code of a program deployed to the Aleo Network*
535- __*return*__ | ` Promise .< Program> ` | *Source code of the program*
569+ __inputProgram__ | ` string` | *The program ID or program source code of a program deployed to the Aleo Network.*
570+ __edition__ | ` number` | *The edition of the program to fetch. When this is undefined it will fetch the latest version.*
571+ __*return*__ | ` Promise .< Program> ` | *Source code of the program.*
536572
537573#### Examples
538574
@@ -1497,15 +1533,17 @@ const latestHash = networkClient.getLatestBlockHash();
14971533
14981534---
14991535
1500- ### ` getProgram (programId) ► Promise .< string> `
1536+ ### ` getProgram (programId, edition ) ► Promise .< string> `
15011537
15021538
15031539
15041540Returns the source code of a program given a program ID.
15051541
15061542Parameters | Type | Description
15071543--- | --- | ---
1508- __programId__ | ` string` | *The program ID of a program deployed to the Aleo Network*
1544+ __programId__ | ` string` | *The program ID of a program deployed to the Aleo Network.*
1545+ __edition__ | ` number` | *The edition of the program to fetch. When this is undefined it will fetch the latest version.*
1546+ __*return*__ | ` Promise .< string> ` | *The source code of the program.*
15091547__*return*__ | ` Promise .< string> ` | *Source code of the program*
15101548
15111549#### Examples
@@ -1516,23 +1554,57 @@ import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
15161554// Create a network client.
15171555const networkClient = new AleoNetworkClient (" http://api.explorer.provable.com/v1" , undefined );
15181556
1557+ // Get the source code of a program.)
1558+ ` ` `
1559+ ` ` ` javascript
1560+ import { AleoNetworkClient } from " @provablehq/sdk/mainnet.js" ;
1561+
1562+ // Create a network client.
1563+ const networkClient = new AleoNetworkClient (" http://api.explorer.provable.com/v1" , undefined );
1564+
15191565const program = networkClient .getProgram (" hello_hello.aleo" );
15201566const expectedSource = " program hello_hello.aleo;\n\n function hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n "
15211567assert .equal (program, expectedSource);
15221568` ` `
15231569
15241570---
15251571
1526- ### ` getProgramObject (inputProgram) ► Promise .< Program> `
1572+ ### ` getLatestProgramEdition (programId) ► Promise .< number> `
1573+
1574+ 
1575+
1576+ Returns the current program edition deployed on the Aleo network.
1577+
1578+ Parameters | Type | Description
1579+ --- | --- | ---
1580+ __programId__ | ` string` | *The program ID of a program deployed to the Aleo Network.*
1581+ __*return*__ | ` Promise .< number> ` | *The edition of the program.*
1582+
1583+ #### Examples
1584+
1585+ ` ` ` javascript
1586+ import { AleoNetworkClient } from " @provablehq/sdk/mainnet.js" ;
1587+
1588+ // Create a network client.
1589+ const networkClient = new AleoNetworkClient (" http://api.explorer.provable.com/v1" , undefined );
1590+
1591+ const programVersion = networkClient .getProgramSource (" hello_hello.aleo" );
1592+ assert .equal (programVersion, 1 );
1593+ ` ` `
1594+
1595+ ---
1596+
1597+ ### ` getProgramObject (inputProgram, edition) ► Promise .< Program> `
15271598
15281599
15291600
15301601Returns a program object from a program ID or program source code.
15311602
15321603Parameters | Type | Description
15331604--- | --- | ---
1534- __inputProgram__ | ` string` | *The program ID or program source code of a program deployed to the Aleo Network*
1535- __*return*__ | ` Promise .< Program> ` | *Source code of the program*
1605+ __inputProgram__ | ` string` | *The program ID or program source code of a program deployed to the Aleo Network.*
1606+ __edition__ | ` number` | *The edition of the program to fetch. When this is undefined it will fetch the latest version.*
1607+ __*return*__ | ` Promise .< Program> ` | *Source code of the program.*
15361608
15371609#### Examples
15381610
0 commit comments