Prechádzať zdrojové kódy

[pyth-solana-receiver-cli] Initialize solana wormhole receiver (#1180)

* Checkpoint

* Checkpoint

* Checkpoint

* Cleanup

* More cleanup

* Cleanup

* Cleanup

* Should work

* reorder

* Send it

* Rename

* Add comment
guibescos 1 rok pred
rodič
commit
f78301d019

+ 1 - 0
target_chains/solana/Cargo.lock

@@ -3076,6 +3076,7 @@ dependencies = [
  "byteorder",
  "cfg-if",
  "clap 3.2.23",
+ "hex",
  "pyth-solana-receiver",
  "pythnet-sdk",
  "serde",

+ 2 - 1
target_chains/solana/cli/Cargo.toml

@@ -4,7 +4,7 @@ version = "0.1.0"
 edition = "2021"
 
 [features]
-default = []
+default = ["mainnet"]
 mainnet = ["wormhole-anchor-sdk/mainnet", "pyth-solana-receiver/mainnet"]
 devnet = ["wormhole-anchor-sdk/solana-devnet", "pyth-solana-receiver/devnet"]
 
@@ -27,3 +27,4 @@ wormhole-sdk = { git = "https://github.com/wormhole-foundation/wormhole", tag =
 serde_wormhole = { git = "https://github.com/wormhole-foundation/wormhole", tag = "v2.17.1"}
 wormhole-anchor-sdk = {  version = "0.1.0-alpha.2" , default-features = false }
 cfg-if = "1.0.0"
+hex = "0.4.3"

+ 29 - 19
target_chains/solana/cli/src/cli.rs

@@ -1,6 +1,10 @@
-use clap::{
-    Parser,
-    Subcommand,
+use {
+    clap::{
+        Parser,
+        Subcommand,
+    },
+    solana_sdk::pubkey::Pubkey,
+    std::str::FromStr,
 };
 
 #[derive(Parser, Debug)]
@@ -9,8 +13,24 @@ use clap::{
     author = "Pyth Network Contributors"
 )]
 pub struct Cli {
+    #[clap(
+        short = 'k',
+        long,
+        default_value = "~/.config/solana/id.json",
+        help = "Keypair of the payer of transactions"
+    )]
+    pub keypair:  String,
+    #[clap(
+        short = 'u',
+        long,
+        default_value = "http://localhost:8899",
+        help = "RPC endpoint of the solana"
+    )]
+    pub url:      String,
+    #[clap(short = 'w', long, parse(try_from_str = Pubkey::from_str), help = "Address of the wormhole contract")]
+    pub wormhole: Pubkey,
     #[clap(subcommand)]
-    pub action: Action,
+    pub action:   Action,
 }
 
 #[derive(Subcommand, Debug)]
@@ -18,20 +38,10 @@ pub enum Action {
     #[clap(about = "Verify, post and receive the price VAA on solana")]
     PostAndReceiveVAA {
         #[clap(short = 'v', long, help = "Price VAA from Pythnet")]
-        vaa:     String,
-        #[clap(
-            short = 'k',
-            long,
-            default_value = "~/.config/solana/id.json",
-            help = "Keypair of the payer of transactions"
-        )]
-        keypair: String,
-        #[clap(
-            short = 'u',
-            long,
-            default_value = "http://localhost:8899",
-            help = "RPC endpoint of the solana"
-        )]
-        url:     String,
+        vaa: String,
     },
+    #[clap(
+        about = "Initialize a wormhole receiver contract by sequentially replaying the guardian set updates"
+    )]
+    InitializeWormholeReceiver {},
 }

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 6 - 0
target_chains/solana/cli/src/main.rs


Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov