Skip to content

Commit 7410d1e

Browse files
feat(lazer/publisher-sdk): add asset state and governance messages (#3140)
* feat: add asset state and governance messages * bump ver * Update lazer/publisher_sdk/rust/Cargo.toml Co-authored-by: Pavel Strakhov <[email protected]> * update cargo lock * bump publisher sdk --------- Co-authored-by: Pavel Strakhov <[email protected]>
1 parent e376b1a commit 7410d1e

File tree

4 files changed

+62
-7
lines changed

4 files changed

+62
-7
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazer/publisher_sdk/proto/governance_instruction.proto

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ message GovernanceInstructionItem {
9595
RemoveFeed remove_feed = 113;
9696
AddFeatureFlag add_feature_flag = 114;
9797
RemoveFeatureFlag remove_feature_flag = 115;
98+
AddAsset add_asset = 116;
99+
UpdateAsset update_asset = 117;
100+
RemoveAsset remove_asset = 118;
98101
}
99102
}
100103

@@ -368,3 +371,33 @@ message RemoveFeatureFlag {
368371
// [required] Feature flag to remove.
369372
optional string feature_flag = 1;
370373
}
374+
375+
// Add a new asset. Refer to `Asset` message fields documentation.
376+
message AddAsset {
377+
// [required]
378+
optional uint32 asset_id = 1;
379+
// [required]
380+
optional DynamicValue.Map metadata = 2;
381+
}
382+
383+
message UpdateAsset {
384+
// [required] ID of the asset that is being updated. Rejects if there is no such asset.
385+
optional uint32 asset_id = 1;
386+
// [required]
387+
// Note: when adding a new variant here, update `Permissions` as well.
388+
oneof action {
389+
UpdateAssetMetadata update_asset_metadata = 101;
390+
}
391+
}
392+
393+
message RemoveAsset {
394+
// [required] ID of the asset that is being removed. Rejects if there is no such asset.
395+
optional uint32 asset_id = 1;
396+
}
397+
398+
message UpdateAssetMetadata {
399+
// [required] Property name.
400+
optional string name = 1;
401+
// [optional] Property value. If unset, the property will be removed.
402+
optional DynamicValue value = 2;
403+
}

lazer/publisher_sdk/proto/state.proto

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ message State {
4848
repeated GovernanceSourceState governance_sources = 9;
4949
// Currently active feature flags. Feature flags influence the aggregator's behavior.
5050
repeated string feature_flags = 10;
51+
// List of assets.
52+
repeated Asset assets = 11;
5153
}
5254

5355
// An item of the state describing a publisher.
@@ -195,6 +197,14 @@ message FeedAggregateData {
195197
optional int64 confidence = 8;
196198
}
197199

200+
// An item of the state describing an asset.
201+
message Asset {
202+
// [required] ID of the asset.
203+
optional uint32 asset_id = 1;
204+
// [required] Additional metadata values. These values will be exposed in the APIs.
205+
optional DynamicValue.Map metadata = 2;
206+
}
207+
198208
// State associated with a governance source.
199209
message GovernanceSourceState {
200210
// [required]
@@ -233,6 +243,11 @@ message Permissions {
233243
REMOVE_FEED = 113;
234244
ADD_FEATURE_FLAG = 114;
235245
REMOVE_FEATURE_FLAG = 115;
246+
ADD_ASSET = 116;
247+
// All operations under `UpdateAsset`,
248+
// including operations added in the future.
249+
UPDATE_ASSET = 117;
250+
REMOVE_ASSET = 118;
236251
}
237252

238253
enum UpdateGovernanceSourceAction {
@@ -263,10 +278,17 @@ message Permissions {
263278
DISABLE_FEED_IN_SHARD = 104;
264279
}
265280

281+
enum UpdateAssetAction {
282+
// Required by protobuf. Instruction will be rejected if this value is encountered.
283+
UPDATE_ASSET_ACTION_UNSPECIFIED = 0;
284+
UPDATE_ASSET_METADATA = 101;
285+
}
286+
266287
repeated ShardAction actions = 1;
267288
repeated UpdateGovernanceSourceAction update_governance_source_actions = 2;
268289
repeated UpdatePublisherAction update_publisher_actions = 3;
269290
repeated UpdateFeedAction update_feed_actions = 4;
291+
repeated UpdateAssetAction update_asset_actions = 5;
270292
}
271293

272294

lazer/publisher_sdk/rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-lazer-publisher-sdk"
3-
version = "0.18.0"
3+
version = "0.19.0"
44
edition = "2021"
55
description = "Pyth Lazer Publisher SDK types."
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)