diff --git a/Cargo.lock b/Cargo.lock index 48d4df2651..fd694ac295 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5675,7 +5675,7 @@ dependencies = [ "hyper-util", "protobuf", "pyth-lazer-protocol 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pyth-lazer-publisher-sdk 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pyth-lazer-publisher-sdk 0.18.0", "reqwest 0.12.23", "serde", "serde_json", @@ -5773,26 +5773,26 @@ dependencies = [ [[package]] name = "pyth-lazer-publisher-sdk" version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b910a3ca825bd1f4bbf75ef5fe01c76eec3e4f5f7570e8c38cbd465c81e21a4" dependencies = [ "anyhow", "fs-err", "protobuf", "protobuf-codegen", - "pyth-lazer-protocol 0.19.0", + "pyth-lazer-protocol 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json", ] [[package]] name = "pyth-lazer-publisher-sdk" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b910a3ca825bd1f4bbf75ef5fe01c76eec3e4f5f7570e8c38cbd465c81e21a4" +version = "0.19.0" dependencies = [ "anyhow", "fs-err", "protobuf", "protobuf-codegen", - "pyth-lazer-protocol 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pyth-lazer-protocol 0.19.0", "serde_json", ] diff --git a/lazer/publisher_sdk/proto/governance_instruction.proto b/lazer/publisher_sdk/proto/governance_instruction.proto index 71864f969d..1af1b804e1 100644 --- a/lazer/publisher_sdk/proto/governance_instruction.proto +++ b/lazer/publisher_sdk/proto/governance_instruction.proto @@ -95,6 +95,9 @@ message GovernanceInstructionItem { RemoveFeed remove_feed = 113; AddFeatureFlag add_feature_flag = 114; RemoveFeatureFlag remove_feature_flag = 115; + AddAsset add_asset = 116; + UpdateAsset update_asset = 117; + RemoveAsset remove_asset = 118; } } @@ -368,3 +371,33 @@ message RemoveFeatureFlag { // [required] Feature flag to remove. optional string feature_flag = 1; } + +// Add a new asset. Refer to `Asset` message fields documentation. +message AddAsset { + // [required] + optional uint32 asset_id = 1; + // [required] + optional DynamicValue.Map metadata = 2; +} + +message UpdateAsset { + // [required] ID of the asset that is being updated. Rejects if there is no such asset. + optional uint32 asset_id = 1; + // [required] + // Note: when adding a new variant here, update `Permissions` as well. + oneof action { + UpdateAssetMetadata update_asset_metadata = 101; + } +} + +message RemoveAsset { + // [required] ID of the asset that is being removed. Rejects if there is no such asset. + optional uint32 asset_id = 1; +} + +message UpdateAssetMetadata { + // [required] Property name. + optional string name = 1; + // [optional] Property value. If unset, the property will be removed. + optional DynamicValue value = 2; +} diff --git a/lazer/publisher_sdk/proto/state.proto b/lazer/publisher_sdk/proto/state.proto index 1fa67f9174..20b371ec64 100644 --- a/lazer/publisher_sdk/proto/state.proto +++ b/lazer/publisher_sdk/proto/state.proto @@ -48,6 +48,8 @@ message State { repeated GovernanceSourceState governance_sources = 9; // Currently active feature flags. Feature flags influence the aggregator's behavior. repeated string feature_flags = 10; + // List of assets. + repeated Asset assets = 11; } // An item of the state describing a publisher. @@ -195,6 +197,14 @@ message FeedAggregateData { optional int64 confidence = 8; } +// An item of the state describing an asset. +message Asset { + // [required] ID of the asset. + optional uint32 asset_id = 1; + // [required] Additional metadata values. These values will be exposed in the APIs. + optional DynamicValue.Map metadata = 2; +} + // State associated with a governance source. message GovernanceSourceState { // [required] @@ -233,6 +243,11 @@ message Permissions { REMOVE_FEED = 113; ADD_FEATURE_FLAG = 114; REMOVE_FEATURE_FLAG = 115; + ADD_ASSET = 116; + // All operations under `UpdateAsset`, + // including operations added in the future. + UPDATE_ASSET = 117; + REMOVE_ASSET = 118; } enum UpdateGovernanceSourceAction { @@ -263,10 +278,17 @@ message Permissions { DISABLE_FEED_IN_SHARD = 104; } + enum UpdateAssetAction { + // Required by protobuf. Instruction will be rejected if this value is encountered. + UPDATE_ASSET_ACTION_UNSPECIFIED = 0; + UPDATE_ASSET_METADATA = 101; + } + repeated ShardAction actions = 1; repeated UpdateGovernanceSourceAction update_governance_source_actions = 2; repeated UpdatePublisherAction update_publisher_actions = 3; repeated UpdateFeedAction update_feed_actions = 4; + repeated UpdateAssetAction update_asset_actions = 5; } diff --git a/lazer/publisher_sdk/rust/Cargo.toml b/lazer/publisher_sdk/rust/Cargo.toml index 64218375cf..0382bdfd5d 100644 --- a/lazer/publisher_sdk/rust/Cargo.toml +++ b/lazer/publisher_sdk/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pyth-lazer-publisher-sdk" -version = "0.18.0" +version = "0.19.0" edition = "2021" description = "Pyth Lazer Publisher SDK types." license = "Apache-2.0"