@@ -497,15 +497,17 @@ const latestHash = networkClient.getLatestBlockHash();
497
497
498
498
---
499
499
500
- ### ` getProgram (programId) ► Promise .< string> `
500
+ ### ` getProgram (programId, edition ) ► Promise .< string> `
501
501
502
502

503
503
504
504
Returns the source code of a program given a program ID.
505
505
506
506
Parameters | Type | Description
507
507
--- | --- | ---
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.*
509
511
__*return*__ | ` Promise .< string> ` | *Source code of the program*
510
512
511
513
#### Examples
@@ -516,23 +518,57 @@ import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
516
518
// Create a network client.
517
519
const networkClient = new AleoNetworkClient (" http://api.explorer.provable.com/v1" , undefined );
518
520
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
+
519
529
const program = networkClient .getProgram (" hello_hello.aleo" );
520
530
const 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 "
521
531
assert .equal (program, expectedSource);
522
532
` ` `
523
533
524
534
---
525
535
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> `
527
562
528
563

529
564
530
565
Returns a program object from a program ID or program source code.
531
566
532
567
Parameters | Type | Description
533
568
--- | --- | ---
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.*
536
572
537
573
#### Examples
538
574
@@ -1497,15 +1533,17 @@ const latestHash = networkClient.getLatestBlockHash();
1497
1533
1498
1534
---
1499
1535
1500
- ### ` getProgram (programId) ► Promise .< string> `
1536
+ ### ` getProgram (programId, edition ) ► Promise .< string> `
1501
1537
1502
1538

1503
1539
1504
1540
Returns the source code of a program given a program ID.
1505
1541
1506
1542
Parameters | Type | Description
1507
1543
--- | --- | ---
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.*
1509
1547
__*return*__ | ` Promise .< string> ` | *Source code of the program*
1510
1548
1511
1549
#### Examples
@@ -1516,23 +1554,57 @@ import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
1516
1554
// Create a network client.
1517
1555
const networkClient = new AleoNetworkClient (" http://api.explorer.provable.com/v1" , undefined );
1518
1556
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
+
1519
1565
const program = networkClient .getProgram (" hello_hello.aleo" );
1520
1566
const 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 "
1521
1567
assert .equal (program, expectedSource);
1522
1568
` ` `
1523
1569
1524
1570
---
1525
1571
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> `
1527
1598
1528
1599

1529
1600
1530
1601
Returns a program object from a program ID or program source code.
1531
1602
1532
1603
Parameters | Type | Description
1533
1604
--- | --- | ---
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.*
1536
1608
1537
1609
#### Examples
1538
1610
0 commit comments