瀏覽代碼

chore: release solana pull oracle sdks (#1361)

* chore: release rust sdk for solana receiver

* Go

* Publish pythnet sdk
guibescos 1 年之前
父節點
當前提交
81ff71c8d8

+ 1 - 1
.github/workflows/ci-solana-contract.yml

@@ -32,4 +32,4 @@ jobs:
       - name: Run tests
         run: cargo-test-sbf
       - name: Run sdk tests
-        run: cargo test --package pyth-solana-receiver-state
+        run: cargo test --package pyth-solana-receiver-sdk

+ 18 - 0
.github/workflows/publish-pyth-solana-receiver-state.yml

@@ -0,0 +1,18 @@
+name: Publish Pyth SDK for the Solana Receiver to crates.io
+
+on:
+  push:
+    tags:
+      - pyth-solana-receiver-sdk-v*
+jobs:
+  publish-pyth-solana-receiver-sdk:
+    name: Publish Pyth SDK for the Solana Receiver
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout sources
+        uses: actions/checkout@v2
+
+      - run: cargo publish --token ${CARGO_REGISTRY_TOKEN}
+        env:
+          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
+        working-directory: "target_chains/solana/pyth_solana_receiver_sdk"

+ 18 - 0
.github/workflows/publish-pythnet-sdk.yml

@@ -0,0 +1,18 @@
+name: Publish Pythnet SDK to crates.io
+
+on:
+  push:
+    tags:
+      - pythnet-sdk-v*
+jobs:
+  publish-pythnet-sdk:
+    name: Publish Pythnet SDK
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout sources
+        uses: actions/checkout@v2
+
+      - run: cargo publish --token ${CARGO_REGISTRY_TOKEN}
+        env:
+          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
+        working-directory: "pythnet/pythnet_sdk"

+ 3 - 3
target_chains/solana/Cargo.lock

@@ -3033,7 +3033,7 @@ dependencies = [
  "program-simulator",
  "pyth-sdk",
  "pyth-sdk-solana",
- "pyth-solana-receiver-state",
+ "pyth-solana-receiver-sdk",
  "pythnet-sdk",
  "rand 0.8.5",
  "serde_wormhole",
@@ -3057,7 +3057,7 @@ dependencies = [
  "clap 3.2.23",
  "hex",
  "pyth-solana-receiver",
- "pyth-solana-receiver-state",
+ "pyth-solana-receiver-sdk",
  "pythnet-sdk",
  "serde_wormhole",
  "shellexpand",
@@ -3069,7 +3069,7 @@ dependencies = [
 ]
 
 [[package]]
-name = "pyth-solana-receiver-state"
+name = "pyth-solana-receiver-sdk"
 version = "0.1.0"
 dependencies = [
  "anchor-lang",

+ 1 - 1
target_chains/solana/Cargo.toml

@@ -3,7 +3,7 @@ members = [
     "programs/*",
     "cli/",
     "program_simulator/",
-    "pyth_solana_receiver_state/"
+    "pyth_solana_receiver_sdk/"
 ]
 
 [profile.release]

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

@@ -19,4 +19,4 @@ serde_wormhole = { workspace = true }
 hex = "0.4.3"
 borsh = "0.9.3" # Old version of borsh needed for wormhole-solana
 wormhole-core-bridge-solana = {workspace = true}
-pyth-solana-receiver-state = {path = "../pyth_solana_receiver_state"}
+pyth-solana-receiver-sdk = {path = "../pyth_solana_receiver_sdk"}

+ 2 - 2
target_chains/solana/cli/src/main.rs

@@ -24,7 +24,7 @@ use {
         PostUpdateAtomicParams,
         PostUpdateParams,
     },
-    pyth_solana_receiver_state::config::DataSource,
+    pyth_solana_receiver_sdk::config::DataSource,
     pythnet_sdk::wire::v1::MerklePriceUpdate,
     serde_wormhole::RawMessage,
     solana_client::{
@@ -184,7 +184,7 @@ fn main() -> Result<()> {
                 program_id: pyth_solana_receiver::ID,
                 accounts:   initialize_pyth_receiver_accounts,
                 data:       pyth_solana_receiver::instruction::Initialize {
-                    initial_config: pyth_solana_receiver_state::config::Config {
+                    initial_config: pyth_solana_receiver_sdk::config::Config {
                         governance_authority: payer.pubkey(),
                         target_governance_authority: None,
                         wormhole,

+ 1 - 1
target_chains/solana/programs/pyth-solana-receiver/Cargo.toml

@@ -22,7 +22,7 @@ solana-program = { workspace = true }
 byteorder = "1.4.3"
 wormhole-core-bridge-solana = {workspace = true}
 wormhole-raw-vaas = {version = "0.1.3", features = ["ruint", "on-chain"], default-features = false }
-pyth-solana-receiver-state = { path = "../../pyth_solana_receiver_state"}
+pyth-solana-receiver-sdk = { path = "../../pyth_solana_receiver_sdk"}
 
 [dev-dependencies]
 pyth-sdk = "0.8.0"

+ 2 - 2
target_chains/solana/programs/pyth-solana-receiver/src/lib.rs

@@ -1,7 +1,7 @@
 use {
     crate::error::ReceiverError,
     anchor_lang::prelude::*,
-    pyth_solana_receiver_state::{
+    pyth_solana_receiver_sdk::{
         config::{
             Config,
             DataSource,
@@ -47,7 +47,7 @@ use {
 pub mod error;
 pub mod sdk;
 
-declare_id!(pyth_solana_receiver_state::ID);
+declare_id!(pyth_solana_receiver_sdk::ID);
 
 #[program]
 pub mod pyth_solana_receiver {

+ 1 - 1
target_chains/solana/programs/pyth-solana-receiver/src/sdk.rs

@@ -13,7 +13,7 @@ use {
         system_program,
         InstructionData,
     },
-    pyth_solana_receiver_state::config::{
+    pyth_solana_receiver_sdk::config::{
         Config,
         DataSource,
     },

+ 1 - 1
target_chains/solana/programs/pyth-solana-receiver/tests/common/mod.rs

@@ -11,7 +11,7 @@ use {
         },
         ID,
     },
-    pyth_solana_receiver_state::config::{
+    pyth_solana_receiver_sdk::config::{
         Config,
         DataSource,
     },

+ 1 - 1
target_chains/solana/programs/pyth-solana-receiver/tests/test_governance.rs

@@ -18,7 +18,7 @@ use {
         },
         sdk::get_config_address,
     },
-    pyth_solana_receiver_state::config::{
+    pyth_solana_receiver_sdk::config::{
         Config,
         DataSource,
     },

+ 1 - 1
target_chains/solana/programs/pyth-solana-receiver/tests/test_post_price_update_from_vaa.rs

@@ -21,7 +21,7 @@ use {
             DEFAULT_TREASURY_ID,
         },
     },
-    pyth_solana_receiver_state::{
+    pyth_solana_receiver_sdk::{
         config::DataSource,
         price_update::{
             PriceUpdateV1,

+ 1 - 1
target_chains/solana/programs/pyth-solana-receiver/tests/test_post_updates.rs

@@ -19,7 +19,7 @@ use {
             DEFAULT_TREASURY_ID,
         },
     },
-    pyth_solana_receiver_state::price_update::{
+    pyth_solana_receiver_sdk::price_update::{
         PriceUpdateV1,
         VerificationLevel,
     },

+ 1 - 1
target_chains/solana/programs/pyth-solana-receiver/tests/test_post_updates_atomic.rs

@@ -19,7 +19,7 @@ use {
             SECONDARY_TREASURY_ID,
         },
     },
-    pyth_solana_receiver_state::price_update::{
+    pyth_solana_receiver_sdk::price_update::{
         PriceUpdateV1,
         VerificationLevel,
     },

+ 3 - 3
target_chains/solana/pyth_solana_receiver_state/Cargo.toml → target_chains/solana/pyth_solana_receiver_sdk/Cargo.toml

@@ -1,15 +1,15 @@
 [package]
-name = "pyth-solana-receiver-state"
+name = "pyth-solana-receiver-sdk"
 version = "0.1.0"
 edition = "2021"
 
 [lib]
 crate-type = ["lib"]
-name = "pyth_solana_receiver_state"
+name = "pyth_solana_receiver_sdk"
 
 
 [dependencies]
 anchor-lang = ">=0.28.0"
 hex = "*"
-pythnet-sdk = { path = "../../../pythnet/pythnet_sdk"}
+pythnet-sdk = { path = "../../../pythnet/pythnet_sdk", version = "2.0.0"}
 solana-program = "*"

+ 0 - 0
target_chains/solana/pyth_solana_receiver_state/src/config.rs → target_chains/solana/pyth_solana_receiver_sdk/src/config.rs


+ 0 - 0
target_chains/solana/pyth_solana_receiver_state/src/error.rs → target_chains/solana/pyth_solana_receiver_sdk/src/error.rs


+ 0 - 0
target_chains/solana/pyth_solana_receiver_state/src/lib.rs → target_chains/solana/pyth_solana_receiver_sdk/src/lib.rs


+ 3 - 3
target_chains/solana/pyth_solana_receiver_state/src/price_update.rs → target_chains/solana/pyth_solana_receiver_sdk/src/price_update.rs

@@ -108,7 +108,7 @@ impl PriceUpdateV1 {
     ///
     /// # Example
     /// ```
-    /// use pyth_solana_receiver_state::price_update::{get_feed_id_from_hex, VerificationLevel, PriceUpdateV1};
+    /// use pyth_solana_receiver_sdk::price_update::{get_feed_id_from_hex, VerificationLevel, PriceUpdateV1};
     /// use anchor_lang::prelude::*;
     ///
     /// const MAXIMUM_AGE : u64 = 30;
@@ -152,7 +152,7 @@ impl PriceUpdateV1 {
     ///
     /// # Example
     /// ```
-    /// use pyth_solana_receiver_state::price_update::{get_feed_id_from_hex, PriceUpdateV1};
+    /// use pyth_solana_receiver_sdk::price_update::{get_feed_id_from_hex, PriceUpdateV1};
     /// use anchor_lang::prelude::*;
     ///
     /// const MAXIMUM_AGE : u64 = 30;
@@ -193,7 +193,7 @@ impl PriceUpdateV1 {
 /// # Example
 ///
 /// ```
-/// use pyth_solana_receiver_state::price_update::get_feed_id_from_hex;
+/// use pyth_solana_receiver_sdk::price_update::get_feed_id_from_hex;
 /// let feed_id = get_feed_id_from_hex("0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d").unwrap();
 /// ```
 pub fn get_feed_id_from_hex(input: &str) -> std::result::Result<FeedId, GetPriceError> {

+ 2 - 2
target_chains/solana/sdk/js/pyth_solana_receiver/src/PythSolanaReceiver.ts

@@ -116,7 +116,7 @@ export class PythTransactionBuilder extends TransactionBuilder {
    * @param priceUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestVaas`. This is an array of verifiable price updates.
    *
    * Partially verified price updates are price updates where not all the guardian signatures have been verified. By default this methods checks `DEFAULT_REDUCED_GUARDIAN_SET_SIZE` signatures when posting the VAA.
-   * If you are a on-chain program developer, make sure you understand the risks of consuming partially verified price updates here: {@link https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/pyth_solana_receiver_state/src/price_update.rs}.
+   * If you are a on-chain program developer, make sure you understand the risks of consuming partially verified price updates here: {@link https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/pyth_solana_receiver_sdk/src/price_update.rs}.
    *
    * @example
    * ```typescript
@@ -282,7 +282,7 @@ export class PythSolanaReceiver {
    * Build a series of helper instructions that post price updates to the Pyth Solana Receiver program and another series to close the price update accounts.
    *
    * This function uses partially verified price updates. Partially verified price updates are price updates where not all the guardian signatures have been verified. By default this methods checks `DEFAULT_REDUCED_GUARDIAN_SET_SIZE` signatures when posting the VAA.
-   * If you are a on-chain program developer, make sure you understand the risks of consuming partially verified price updates here: {@link https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/pyth_solana_receiver_state/src/price_update.rs}.
+   * If you are a on-chain program developer, make sure you understand the risks of consuming partially verified price updates here: {@link https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/solana/pyth_solana_receiver_sdk/src/price_update.rs}.
    *
    * @param priceUpdateDataArray the output of the `@pythnetwork/price-service-client`'s `PriceServiceConnection.getLatestVaas`. This is an array of verifiable price updates.
    * @returns `postInstructions`: the instructions to post the price updates, these should be called before consuming the price updates