From b89f8815375ff550bde1ba0707f65a21179790e0 Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Thu, 9 May 2024 14:29:52 -0400 Subject: [PATCH 1/7] auction(protos): add `core.auction.v1` --- .../core/component/auction/v1/auction.proto | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100755 proto/penumbra/penumbra/core/component/auction/v1/auction.proto diff --git a/proto/penumbra/penumbra/core/component/auction/v1/auction.proto b/proto/penumbra/penumbra/core/component/auction/v1/auction.proto new file mode 100755 index 0000000000..e3bce44ede --- /dev/null +++ b/proto/penumbra/penumbra/core/component/auction/v1/auction.proto @@ -0,0 +1,222 @@ +syntax = "proto3"; +package penumbra.core.component.auction.v1; + +import "google/protobuf/any.proto"; +import "penumbra/core/asset/v1/asset.proto"; +import "penumbra/core/component/dex/v1/dex.proto"; +import "penumbra/core/num/v1/num.proto"; + +// The configuration parameters for the auction component. +message AuctionParameters {} + +// Genesis data for the auction component. +message GenesisContent { + // The configuration parameters for the auction component at genesis. + AuctionParameters params = 1; +} + +// Query operations for the auction component. +service QueryService { + // Get the current state of an auction by ID. + rpc AuctionStateById(AuctionStateByIdRequest) returns (AuctionStateByIdResponse); + // Get the current state of a group of auctions by ID. + rpc AuctionStateByIds(AuctionStateByIdsRequest) returns (stream AuctionStateByIdsResponse); +} + +message AuctionStateByIdRequest { + AuctionId id = 1; +} + +message AuctionStateByIdResponse { + // If present, the state of the auction. If not present, no such auction is known. + google.protobuf.Any auction = 2; + // The state of any DEX positions relevant to the returned auction. + // + // Could be empty, depending on the auction state. + repeated core.component.dex.v1.Position positions = 3; +} + +message AuctionStateByIdsRequest { + // The auction IDs to request. Only known IDs will be returned in the response. + repeated AuctionId id = 1; +} + +message AuctionStateByIdsResponse { + // The auction ID of the returned auction. + AuctionId id = 1; + // The state of the returned auction. + DutchAuctionState auction = 2; + // The state of any DEX positions relevant to the returned auction. + // + // Could be empty, depending on the auction state. + repeated core.component.dex.v1.Position positions = 3; +} + +// A unique identifier for an auction, obtained from hashing a domain separator +// along with the immutable part of an auction description. +message AuctionId { + bytes inner = 1; +} + +// A bearer NFT tracking ownership of an auction and its proceeds. +message AuctionNft { + AuctionId id = 1; + uint64 seq = 2; +} + +// Describes a Dutch auction using programmatic liquidity on the DEX. +message DutchAuctionDescription { + // The value the seller wishes to auction. + asset.v1.Value input = 1; + // The asset ID of the target asset the seller wishes to acquire. + asset.v1.AssetId output_id = 2; + // The maximum output the seller can receive. + // + // This implicitly defines the starting price for the auction. + num.v1.Amount max_output = 3; + // The minimum output the seller is willing to receive. + // + // This implicitly defines the ending price for the auction. + num.v1.Amount min_output = 4; + // The block height at which the auction begins. + // + // This allows the seller to schedule an auction at a future time. + uint64 start_height = 5; + // The block height at which the auction ends. + // + // Together with `start_height`, `max_output`, and `min_output`, + // this implicitly defines the speed of the auction. + uint64 end_height = 6; + // The number of discrete price steps to use for the auction. + // + // `end_height - start_height` must be a multiple of `step_count`. + uint64 step_count = 7; + // A random nonce used to allow identical auctions to have + // distinct auction IDs. + bytes nonce = 8; +} + +message DutchAuctionState { + // The sequence number of the auction state. + // + // Dutch auctions move from: + // 0 (opened) => 1 (closed) => n (withdrawn) + uint64 seq = 1; + // If present, the current position controlled by this auction. + dex.v1.PositionId current_position = 2; + // If present, the next trigger height to step down the price. + uint64 next_trigger = 3; + // The amount of the input asset directly owned by the auction. + // + // The auction may also own the input asset indirectly, + // via the reserves of `current_position` if it exists. + num.v1.Amount input_reserves = 4; + // The amount of the output asset directly owned by the auction. + // + // The auction may also own the output asset indirectly, + // via the reserves of `current_position` if it exists. + num.v1.Amount output_reserves = 5; +} + +message DutchAuction { + // The immutable data describing the auction and its auction ID. + DutchAuctionDescription description = 1; + // The mutable data describing the auction's execution. + DutchAuctionState state = 2; +} + +// Initiates a Dutch auction using protocol-controlled liquidity. +message ActionDutchAuctionSchedule { + DutchAuctionDescription description = 1; +} + +// Terminate the auction associated with the specified `auction_id` +message ActionDutchAuctionEnd { + // The auction to end. + AuctionId auction_id = 1; +} + +// Withdraw funds from the ended auction associated with the specified `auction_id` +message ActionDutchAuctionWithdraw { + // The auction to withdraw funds from. + AuctionId auction_id = 1; + // The sequence number of the withdrawal. + uint64 seq = 2; + // A transparent (zero blinding factor) commitment to the + // auction's final reserves. + // + // The chain will check this commitment by recomputing it + // with the on-chain state. + asset.v1.BalanceCommitment reserves_commitment = 3; +} + +// A plan to a `ActionDutchAuctionWithdraw` which contains both private and public data. +message ActionDutchAuctionWithdrawPlan { + AuctionId auction_id = 1; + uint64 seq = 2; + asset.v1.Value reserves_input = 3; + asset.v1.Value reserves_output = 4; +} + +// An `ActionDutchAuctionSchedule` augmented with additional metadata. +message ActionDutchAuctionScheduleView { + ActionDutchAuctionSchedule action = 1; + AuctionId auction_id = 2; + asset.v1.Metadata input_metadata = 3; + asset.v1.Metadata output_metadata = 4; +} + +// An `ActionDutchAuctionWithdraw` augmented with additional metadata. +message ActionDutchAuctionWithdrawView { + ActionDutchAuctionWithdraw action = 1; + // A sequence of values that sum together to the provided + // reserves commitment. + repeated asset.v1.ValueView reserves = 2; +} + +message EventDutchAuctionScheduled { + AuctionId auction_id = 1; + DutchAuctionDescription description = 2; +} + +message EventDutchAuctionUpdated { + AuctionId auction_id = 1; + DutchAuctionState state = 2; +} + +message EventDutchAuctionEnded { + // The reason the auction ended. + enum Reason { + REASON_UNSPECIFIED = 0; + // The auction ended due to reaching its terminal height. + REASON_EXPIRED = 1; + // The auction ran out of reserves. + REASON_FILLED = 2; + // The auction ended was terminated by the initiator. + REASON_CLOSED_BY_OWNER = 3; + } + + AuctionId auction_id = 1; + DutchAuctionState state = 2; + Reason reason = 3; +} + +// A message emitted when value flows *into* the auction component. +message EventValueCircuitBreakerCredit { + // The asset ID being deposited into the Auction component. + asset.v1.AssetId asset_id = 1; + // The previous balance of the asset in the Auction component. + num.v1.Amount previous_balance = 2; + // The new balance of the asset in the Auction component. + num.v1.Amount new_balance = 3; +} + +// A message emitted when value flows *out* of the auction component. +message EventValueCircuitBreakerDebit { + // The asset ID being deposited into the Auction component. + asset.v1.AssetId asset_id = 1; + // The previous balance of the asset in the Auction component. + num.v1.Amount previous_balance = 2; + // The new balance of the asset in the Auction component. + num.v1.Amount new_balance = 3; +} From 0627402d53aa1bf7f3040e0f981ca2ca1845689a Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Thu, 9 May 2024 14:30:14 -0400 Subject: [PATCH 2/7] auction(protos): remove `core.auction.v1alpha1` --- .../component/auction/v1alpha1/auction.proto | 222 ------------------ 1 file changed, 222 deletions(-) delete mode 100755 proto/penumbra/penumbra/core/component/auction/v1alpha1/auction.proto diff --git a/proto/penumbra/penumbra/core/component/auction/v1alpha1/auction.proto b/proto/penumbra/penumbra/core/component/auction/v1alpha1/auction.proto deleted file mode 100755 index f93720a898..0000000000 --- a/proto/penumbra/penumbra/core/component/auction/v1alpha1/auction.proto +++ /dev/null @@ -1,222 +0,0 @@ -syntax = "proto3"; -package penumbra.core.component.auction.v1alpha1; - -import "google/protobuf/any.proto"; -import "penumbra/core/asset/v1/asset.proto"; -import "penumbra/core/component/dex/v1/dex.proto"; -import "penumbra/core/num/v1/num.proto"; - -// The configuration parameters for the auction component. -message AuctionParameters {} - -// Genesis data for the auction component. -message GenesisContent { - // The configuration parameters for the auction component at genesis. - AuctionParameters params = 1; -} - -// Query operations for the auction component. -service QueryService { - // Get the current state of an auction by ID. - rpc AuctionStateById(AuctionStateByIdRequest) returns (AuctionStateByIdResponse); - // Get the current state of a group of auctions by ID. - rpc AuctionStateByIds(AuctionStateByIdsRequest) returns (stream AuctionStateByIdsResponse); -} - -message AuctionStateByIdRequest { - AuctionId id = 1; -} - -message AuctionStateByIdResponse { - // If present, the state of the auction. If not present, no such auction is known. - google.protobuf.Any auction = 2; - // The state of any DEX positions relevant to the returned auction. - // - // Could be empty, depending on the auction state. - repeated core.component.dex.v1.Position positions = 3; -} - -message AuctionStateByIdsRequest { - // The auction IDs to request. Only known IDs will be returned in the response. - repeated AuctionId id = 1; -} - -message AuctionStateByIdsResponse { - // The auction ID of the returned auction. - AuctionId id = 1; - // The state of the returned auction. - DutchAuctionState auction = 2; - // The state of any DEX positions relevant to the returned auction. - // - // Could be empty, depending on the auction state. - repeated core.component.dex.v1.Position positions = 3; -} - -// A unique identifier for an auction, obtained from hashing a domain separator -// along with the immutable part of an auction description. -message AuctionId { - bytes inner = 1; -} - -// A bearer NFT tracking ownership of an auction and its proceeds. -message AuctionNft { - AuctionId id = 1; - uint64 seq = 2; -} - -// Describes a Dutch auction using programmatic liquidity on the DEX. -message DutchAuctionDescription { - // The value the seller wishes to auction. - asset.v1.Value input = 1; - // The asset ID of the target asset the seller wishes to acquire. - asset.v1.AssetId output_id = 2; - // The maximum output the seller can receive. - // - // This implicitly defines the starting price for the auction. - num.v1.Amount max_output = 3; - // The minimum output the seller is willing to receive. - // - // This implicitly defines the ending price for the auction. - num.v1.Amount min_output = 4; - // The block height at which the auction begins. - // - // This allows the seller to schedule an auction at a future time. - uint64 start_height = 5; - // The block height at which the auction ends. - // - // Together with `start_height`, `max_output`, and `min_output`, - // this implicitly defines the speed of the auction. - uint64 end_height = 6; - // The number of discrete price steps to use for the auction. - // - // `end_height - start_height` must be a multiple of `step_count`. - uint64 step_count = 7; - // A random nonce used to allow identical auctions to have - // distinct auction IDs. - bytes nonce = 8; -} - -message DutchAuctionState { - // The sequence number of the auction state. - // - // Dutch auctions move from: - // 0 (opened) => 1 (closed) => n (withdrawn) - uint64 seq = 1; - // If present, the current position controlled by this auction. - dex.v1.PositionId current_position = 2; - // If present, the next trigger height to step down the price. - uint64 next_trigger = 3; - // The amount of the input asset directly owned by the auction. - // - // The auction may also own the input asset indirectly, - // via the reserves of `current_position` if it exists. - num.v1.Amount input_reserves = 4; - // The amount of the output asset directly owned by the auction. - // - // The auction may also own the output asset indirectly, - // via the reserves of `current_position` if it exists. - num.v1.Amount output_reserves = 5; -} - -message DutchAuction { - // The immutable data describing the auction and its auction ID. - DutchAuctionDescription description = 1; - // The mutable data describing the auction's execution. - DutchAuctionState state = 2; -} - -// Initiates a Dutch auction using protocol-controlled liquidity. -message ActionDutchAuctionSchedule { - DutchAuctionDescription description = 1; -} - -// Terminate the auction associated with the specified `auction_id` -message ActionDutchAuctionEnd { - // The auction to end. - AuctionId auction_id = 1; -} - -// Withdraw funds from the ended auction associated with the specified `auction_id` -message ActionDutchAuctionWithdraw { - // The auction to withdraw funds from. - AuctionId auction_id = 1; - // The sequence number of the withdrawal. - uint64 seq = 2; - // A transparent (zero blinding factor) commitment to the - // auction's final reserves. - // - // The chain will check this commitment by recomputing it - // with the on-chain state. - asset.v1.BalanceCommitment reserves_commitment = 3; -} - -// A plan to a `ActionDutchAuctionWithdraw` which contains both private and public data. -message ActionDutchAuctionWithdrawPlan { - AuctionId auction_id = 1; - uint64 seq = 2; - asset.v1.Value reserves_input = 3; - asset.v1.Value reserves_output = 4; -} - -// An `ActionDutchAuctionSchedule` augmented with additional metadata. -message ActionDutchAuctionScheduleView { - ActionDutchAuctionSchedule action = 1; - AuctionId auction_id = 2; - asset.v1.Metadata input_metadata = 3; - asset.v1.Metadata output_metadata = 4; -} - -// An `ActionDutchAuctionWithdraw` augmented with additional metadata. -message ActionDutchAuctionWithdrawView { - ActionDutchAuctionWithdraw action = 1; - // A sequence of values that sum together to the provided - // reserves commitment. - repeated asset.v1.ValueView reserves = 2; -} - -message EventDutchAuctionScheduled { - AuctionId auction_id = 1; - DutchAuctionDescription description = 2; -} - -message EventDutchAuctionUpdated { - AuctionId auction_id = 1; - DutchAuctionState state = 2; -} - -message EventDutchAuctionEnded { - // The reason the auction ended. - enum Reason { - REASON_UNSPECIFIED = 0; - // The auction ended due to reaching its terminal height. - REASON_EXPIRED = 1; - // The auction ran out of reserves. - REASON_FILLED = 2; - // The auction ended was terminated by the initiator. - REASON_CLOSED_BY_OWNER = 3; - } - - AuctionId auction_id = 1; - DutchAuctionState state = 2; - Reason reason = 3; -} - -// A message emitted when value flows *into* the auction component. -message EventValueCircuitBreakerCredit { - // The asset ID being deposited into the Auction component. - asset.v1.AssetId asset_id = 1; - // The previous balance of the asset in the Auction component. - num.v1.Amount previous_balance = 2; - // The new balance of the asset in the Auction component. - num.v1.Amount new_balance = 3; -} - -// A message emitted when value flows *out* of the auction component. -message EventValueCircuitBreakerDebit { - // The asset ID being deposited into the Auction component. - asset.v1.AssetId asset_id = 1; - // The previous balance of the asset in the Auction component. - num.v1.Amount previous_balance = 2; - // The new balance of the asset in the Auction component. - num.v1.Amount new_balance = 3; -} From 71138418ca23f21b30fee88dc790bb507872fef2 Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Thu, 9 May 2024 14:30:41 -0400 Subject: [PATCH 3/7] proto-compiler: use auction `v1` --- tools/proto-compiler/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/proto-compiler/src/main.rs b/tools/proto-compiler/src/main.rs index 061daf217d..08675950c8 100644 --- a/tools/proto-compiler/src/main.rs +++ b/tools/proto-compiler/src/main.rs @@ -92,7 +92,7 @@ fn main() -> anyhow::Result<()> { "../../proto/penumbra/penumbra/core/txhash/v1/txhash.proto", "../../proto/penumbra/penumbra/core/component/compact_block/v1/compact_block.proto", "../../proto/penumbra/penumbra/core/component/community_pool/v1/community_pool.proto", - "../../proto/penumbra/penumbra/core/component/auction/v1alpha1/auction.proto", + "../../proto/penumbra/penumbra/core/component/auction/v1/auction.proto", "../../proto/penumbra/penumbra/core/component/dex/v1/dex.proto", "../../proto/penumbra/penumbra/core/component/distributions/v1/distributions.proto", "../../proto/penumbra/penumbra/core/component/funding/v1/funding.proto", From 50f4484e9d9c5a69d1a5111c8ce23137ddae2ac8 Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Thu, 9 May 2024 14:32:09 -0400 Subject: [PATCH 4/7] protos: use `core.auction.v1` across the board (breaking change) --- .../core/transaction/v1/transaction.proto | 20 +++++++++---------- proto/penumbra/penumbra/view/v1/view.proto | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/proto/penumbra/penumbra/core/transaction/v1/transaction.proto b/proto/penumbra/penumbra/core/transaction/v1/transaction.proto index 1e0564ead0..b676cf1829 100644 --- a/proto/penumbra/penumbra/core/transaction/v1/transaction.proto +++ b/proto/penumbra/penumbra/core/transaction/v1/transaction.proto @@ -3,7 +3,7 @@ package penumbra.core.transaction.v1; import "google/protobuf/any.proto"; import "penumbra/core/asset/v1/asset.proto"; -import "penumbra/core/component/auction/v1alpha1/auction.proto"; +import "penumbra/core/component/auction/v1/auction.proto"; import "penumbra/core/component/dex/v1/dex.proto"; import "penumbra/core/component/fee/v1/fee.proto"; import "penumbra/core/component/governance/v1/governance.proto"; @@ -98,9 +98,9 @@ message Action { component.governance.v1.CommunityPoolDeposit community_pool_deposit = 52; // Dutch auctions - component.auction.v1alpha1.ActionDutchAuctionSchedule action_dutch_auction_schedule = 53; - component.auction.v1alpha1.ActionDutchAuctionEnd action_dutch_auction_end = 54; - component.auction.v1alpha1.ActionDutchAuctionWithdraw action_dutch_auction_withdraw = 55; + component.auction.v1.ActionDutchAuctionSchedule action_dutch_auction_schedule = 53; + component.auction.v1.ActionDutchAuctionEnd action_dutch_auction_end = 54; + component.auction.v1.ActionDutchAuctionWithdraw action_dutch_auction_withdraw = 55; component.ibc.v1.Ics20Withdrawal ics20_withdrawal = 200; } @@ -223,9 +223,9 @@ message ActionView { component.governance.v1.CommunityPoolOutput community_pool_output = 51; component.governance.v1.CommunityPoolDeposit community_pool_deposit = 52; // Dutch auctions - component.auction.v1alpha1.ActionDutchAuctionScheduleView action_dutch_auction_schedule = 53; - component.auction.v1alpha1.ActionDutchAuctionEnd action_dutch_auction_end = 54; - component.auction.v1alpha1.ActionDutchAuctionWithdrawView action_dutch_auction_withdraw = 55; + component.auction.v1.ActionDutchAuctionScheduleView action_dutch_auction_schedule = 53; + component.auction.v1.ActionDutchAuctionEnd action_dutch_auction_end = 54; + component.auction.v1.ActionDutchAuctionWithdrawView action_dutch_auction_withdraw = 55; // TODO: we have no way to recover the opening of the undelegate_claim's // balance commitment, and can only infer the value from looking at the rest @@ -321,9 +321,9 @@ message ActionPlan { component.governance.v1.CommunityPoolDeposit community_pool_deposit = 52; // Dutch auctions - component.auction.v1alpha1.ActionDutchAuctionSchedule action_dutch_auction_schedule = 53; - component.auction.v1alpha1.ActionDutchAuctionEnd action_dutch_auction_end = 54; - component.auction.v1alpha1.ActionDutchAuctionWithdrawPlan action_dutch_auction_withdraw = 55; + component.auction.v1.ActionDutchAuctionSchedule action_dutch_auction_schedule = 53; + component.auction.v1.ActionDutchAuctionEnd action_dutch_auction_end = 54; + component.auction.v1.ActionDutchAuctionWithdrawPlan action_dutch_auction_withdraw = 55; } } diff --git a/proto/penumbra/penumbra/view/v1/view.proto b/proto/penumbra/penumbra/view/v1/view.proto index 76aeaea5b2..191512ed3b 100644 --- a/proto/penumbra/penumbra/view/v1/view.proto +++ b/proto/penumbra/penumbra/view/v1/view.proto @@ -5,7 +5,7 @@ package penumbra.view.v1; import "google/protobuf/any.proto"; import "penumbra/core/app/v1/app.proto"; import "penumbra/core/asset/v1/asset.proto"; -import "penumbra/core/component/auction/v1alpha1/auction.proto"; +import "penumbra/core/component/auction/v1/auction.proto"; import "penumbra/core/component/dex/v1/dex.proto"; import "penumbra/core/component/fee/v1/fee.proto"; import "penumbra/core/component/ibc/v1/ibc.proto"; @@ -157,7 +157,7 @@ message AuctionsRequest { } message AuctionsResponse { - core.component.auction.v1alpha1.AuctionId id = 1; + core.component.auction.v1.AuctionId id = 1; // The note recording the auction NFT. SpendableNoteRecord note_record = 4; @@ -329,17 +329,17 @@ message TransactionPlannerRequest { message ActionDutchAuctionSchedule { // The description of the auction to schedule. - core.component.auction.v1alpha1.DutchAuctionDescription description = 1; + core.component.auction.v1.DutchAuctionDescription description = 1; } message ActionDutchAuctionEnd { // The unique id of the auction to close. - core.component.auction.v1alpha1.AuctionId auction_id = 1; + core.component.auction.v1.AuctionId auction_id = 1; } message ActionDutchAuctionWithdraw { // The auction to withdraw funds from. - core.component.auction.v1alpha1.AuctionId auction_id = 1; + core.component.auction.v1.AuctionId auction_id = 1; // The sequence number of the withdrawal. uint64 seq = 2; } From 5984a3f9ac38811d0e499c2086a3178c14a78ced Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Thu, 9 May 2024 14:40:01 -0400 Subject: [PATCH 5/7] penumbra: swap `core.auction.v1alpha1` with `core.auction.v1` --- crates/bin/pcli/src/command/query/auction.rs | 6 +- .../pcli/src/command/tx/auction/dutch/mod.rs | 2 +- crates/bin/pcli/src/command/view/auction.rs | 2 +- crates/core/app/src/rpc.rs | 2 +- .../component/auction/src/auction/dutch.rs | 2 +- .../auction/src/auction/dutch/actions/end.rs | 2 +- .../auction/src/auction/dutch/actions/plan.rs | 2 +- .../src/auction/dutch/actions/schedule.rs | 2 +- .../auction/src/auction/dutch/actions/view.rs | 2 +- .../src/auction/dutch/actions/withdraw.rs | 2 +- .../core/component/auction/src/auction/id.rs | 2 +- .../core/component/auction/src/auction/nft.rs | 2 +- .../auction/src/component/auction_store.rs | 2 +- .../auction/src/component/dutch_auction.rs | 2 +- .../component/auction/src/component/rpc.rs | 4 +- crates/core/component/auction/src/event.rs | 2 +- crates/core/component/auction/src/genesis.rs | 2 +- crates/core/component/auction/src/params.rs | 2 +- crates/proto/src/gen/penumbra.core.app.v1.rs | 4 +- ...enumbra.core.component.auction.v1alpha1.rs | 925 ------ ...a.core.component.auction.v1alpha1.serde.rs | 2765 ----------------- .../penumbra.core.component.governance.v1.rs | 2 +- .../src/gen/penumbra.core.transaction.v1.rs | 18 +- crates/proto/src/gen/penumbra.view.v1.rs | 8 +- .../proto/src/gen/proto_descriptor.bin.no_lfs | Bin 410540 -> 410249 bytes crates/proto/src/lib.rs | 6 +- crates/view/src/service.rs | 4 +- proto/penumbra/penumbra/core/app/v1/app.proto | 6 +- .../component/governance/v1/governance.proto | 4 +- tools/proto-compiler/src/main.rs | 2 +- 30 files changed, 48 insertions(+), 3738 deletions(-) delete mode 100644 crates/proto/src/gen/penumbra.core.component.auction.v1alpha1.rs delete mode 100644 crates/proto/src/gen/penumbra.core.component.auction.v1alpha1.serde.rs diff --git a/crates/bin/pcli/src/command/query/auction.rs b/crates/bin/pcli/src/command/query/auction.rs index 644be7ba19..ab68b45947 100644 --- a/crates/bin/pcli/src/command/query/auction.rs +++ b/crates/bin/pcli/src/command/query/auction.rs @@ -10,9 +10,9 @@ use penumbra_auction::auction::AuctionId; use penumbra_dex::lp::position::{self, Position}; use penumbra_num::fixpoint::U128x128; use penumbra_num::Amount; -use penumbra_proto::core::component::auction::v1alpha1 as pb_auction; -use penumbra_proto::core::component::auction::v1alpha1::query_service_client::QueryServiceClient as AuctionQueryServiceClient; -use penumbra_proto::core::component::auction::v1alpha1::AuctionStateByIdRequest; +use penumbra_proto::core::component::auction::v1 as pb_auction; +use penumbra_proto::core::component::auction::v1::query_service_client::QueryServiceClient as AuctionQueryServiceClient; +use penumbra_proto::core::component::auction::v1::AuctionStateByIdRequest; use penumbra_proto::core::component::dex::v1::query_service_client::QueryServiceClient as DexQueryServiceClient; use penumbra_proto::core::component::dex::v1::LiquidityPositionByIdRequest; use penumbra_proto::DomainType; diff --git a/crates/bin/pcli/src/command/tx/auction/dutch/mod.rs b/crates/bin/pcli/src/command/tx/auction/dutch/mod.rs index 3cfd72599b..1dc57cb14f 100644 --- a/crates/bin/pcli/src/command/tx/auction/dutch/mod.rs +++ b/crates/bin/pcli/src/command/tx/auction/dutch/mod.rs @@ -229,7 +229,7 @@ impl DutchCmd { bail!("auction state is missing from view server response") }; - use penumbra_proto::core::component::auction::v1alpha1 as pb_auction; + use penumbra_proto::core::component::auction::v1 as pb_auction; // We're processing a Dutch auction: assert_eq!(raw_da_state.type_url, pb_auction::DutchAuction::type_url()); diff --git a/crates/bin/pcli/src/command/view/auction.rs b/crates/bin/pcli/src/command/view/auction.rs index 16fdfee421..c73e33ab8a 100644 --- a/crates/bin/pcli/src/command/view/auction.rs +++ b/crates/bin/pcli/src/command/view/auction.rs @@ -2,7 +2,7 @@ use anyhow::Result; use comfy_table::{presets, Cell, ContentArrangement, Table}; use penumbra_auction::auction::dutch::DutchAuction; use penumbra_keys::FullViewingKey; -use penumbra_proto::{core::component::auction::v1alpha1 as pb_auction, DomainType, Name}; +use penumbra_proto::{core::component::auction::v1 as pb_auction, DomainType, Name}; use penumbra_view::ViewClient; use crate::command::query::auction::render_dutch_auction; diff --git a/crates/core/app/src/rpc.rs b/crates/core/app/src/rpc.rs index 99f276d027..b7047c5eab 100644 --- a/crates/core/app/src/rpc.rs +++ b/crates/core/app/src/rpc.rs @@ -28,7 +28,7 @@ use { core::{ app::v1::query_service_server::QueryServiceServer as AppQueryServiceServer, component::{ - auction::v1alpha1::query_service_server::QueryServiceServer as AuctionQueryServiceServer, + auction::v1::query_service_server::QueryServiceServer as AuctionQueryServiceServer, compact_block::v1::query_service_server::QueryServiceServer as CompactBlockQueryServiceServer, dex::v1::{ query_service_server::QueryServiceServer as DexQueryServiceServer, diff --git a/crates/core/component/auction/src/auction/dutch.rs b/crates/core/component/auction/src/auction/dutch.rs index 238461f746..804fdef667 100644 --- a/crates/core/component/auction/src/auction/dutch.rs +++ b/crates/core/component/auction/src/auction/dutch.rs @@ -4,7 +4,7 @@ use anyhow::anyhow; use penumbra_asset::{asset, Value}; use penumbra_dex::lp::position::{self}; use penumbra_num::Amount; -use penumbra_proto::{core::component::auction::v1alpha1 as pb, DomainType}; +use penumbra_proto::{core::component::auction::v1 as pb, DomainType}; use serde::{Deserialize, Serialize}; use crate::auction::AuctionId; diff --git a/crates/core/component/auction/src/auction/dutch/actions/end.rs b/crates/core/component/auction/src/auction/dutch/actions/end.rs index b0ce842fb5..8bc436c42c 100644 --- a/crates/core/component/auction/src/auction/dutch/actions/end.rs +++ b/crates/core/component/auction/src/auction/dutch/actions/end.rs @@ -1,6 +1,6 @@ use anyhow::anyhow; use penumbra_asset::{Balance, Value}; -use penumbra_proto::{core::component::auction::v1alpha1 as pb, DomainType}; +use penumbra_proto::{core::component::auction::v1 as pb, DomainType}; use penumbra_txhash::{EffectHash, EffectingData}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/auction/src/auction/dutch/actions/plan.rs b/crates/core/component/auction/src/auction/dutch/actions/plan.rs index 18ae8e2917..dca1265ba1 100644 --- a/crates/core/component/auction/src/auction/dutch/actions/plan.rs +++ b/crates/core/component/auction/src/auction/dutch/actions/plan.rs @@ -1,7 +1,7 @@ use ark_ff::Zero; use decaf377::Fr; use penumbra_asset::{balance, Balance, Value}; -use penumbra_proto::{penumbra::core::component::auction::v1alpha1 as pb, DomainType}; +use penumbra_proto::{penumbra::core::component::auction::v1 as pb, DomainType}; use serde::{Deserialize, Serialize}; use crate::auction::{dutch::ActionDutchAuctionWithdraw, AuctionId, AuctionNft}; diff --git a/crates/core/component/auction/src/auction/dutch/actions/schedule.rs b/crates/core/component/auction/src/auction/dutch/actions/schedule.rs index 9742aebb5d..349371041f 100644 --- a/crates/core/component/auction/src/auction/dutch/actions/schedule.rs +++ b/crates/core/component/auction/src/auction/dutch/actions/schedule.rs @@ -1,7 +1,7 @@ use crate::auction::{dutch::DutchAuctionDescription, nft::AuctionNft}; use anyhow::anyhow; use penumbra_asset::{Balance, Value}; -use penumbra_proto::{core::component::auction::v1alpha1 as pb, DomainType}; +use penumbra_proto::{core::component::auction::v1 as pb, DomainType}; use penumbra_txhash::{EffectHash, EffectingData}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/auction/src/auction/dutch/actions/view.rs b/crates/core/component/auction/src/auction/dutch/actions/view.rs index bee10a6329..b1a3861750 100644 --- a/crates/core/component/auction/src/auction/dutch/actions/view.rs +++ b/crates/core/component/auction/src/auction/dutch/actions/view.rs @@ -7,7 +7,7 @@ use crate::auction::{ }; use anyhow::anyhow; use penumbra_asset::ValueView; -use penumbra_proto::{core::component::auction::v1alpha1 as pb, DomainType}; +use penumbra_proto::{core::component::auction::v1 as pb, DomainType}; use serde::{Deserialize, Serialize}; /* Domain type definitions */ diff --git a/crates/core/component/auction/src/auction/dutch/actions/withdraw.rs b/crates/core/component/auction/src/auction/dutch/actions/withdraw.rs index b40e0ade45..6266b8e836 100644 --- a/crates/core/component/auction/src/auction/dutch/actions/withdraw.rs +++ b/crates/core/component/auction/src/auction/dutch/actions/withdraw.rs @@ -3,7 +3,7 @@ use anyhow::anyhow; use ark_ff::Zero; use decaf377_rdsa::Fr; use penumbra_asset::{balance, Balance, Value}; -use penumbra_proto::{core::component::auction::v1alpha1 as pb, DomainType}; +use penumbra_proto::{core::component::auction::v1 as pb, DomainType}; use penumbra_txhash::{EffectHash, EffectingData}; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/auction/src/auction/id.rs b/crates/core/component/auction/src/auction/id.rs index d78c1895c7..767b6ffc1f 100644 --- a/crates/core/component/auction/src/auction/id.rs +++ b/crates/core/component/auction/src/auction/id.rs @@ -1,6 +1,6 @@ use anyhow::{bail, Context}; use penumbra_proto::{ - penumbra::core::component::auction::v1alpha1 as pb, serializers::bech32str, DomainType, + penumbra::core::component::auction::v1 as pb, serializers::bech32str, DomainType, }; use serde::{Deserialize, Serialize}; diff --git a/crates/core/component/auction/src/auction/nft.rs b/crates/core/component/auction/src/auction/nft.rs index 0147dd585a..f5dc11d22a 100644 --- a/crates/core/component/auction/src/auction/nft.rs +++ b/crates/core/component/auction/src/auction/nft.rs @@ -1,7 +1,7 @@ use crate::auction::id::AuctionId; use anyhow::{anyhow, Result}; use penumbra_asset::asset::{self, Metadata}; -use penumbra_proto::{core::component::auction::v1alpha1 as pb, DomainType}; +use penumbra_proto::{core::component::auction::v1 as pb, DomainType}; use regex::Regex; /// An non-fungible token (NFT) tracking the state and ownership of an auction. diff --git a/crates/core/component/auction/src/component/auction_store.rs b/crates/core/component/auction/src/component/auction_store.rs index 6d6669057c..35b93a9183 100644 --- a/crates/core/component/auction/src/component/auction_store.rs +++ b/crates/core/component/auction/src/component/auction_store.rs @@ -2,7 +2,7 @@ use anyhow::Result; use async_trait::async_trait; use cnidarium::StateRead; use pbjson_types::Any; -use penumbra_proto::core::component::auction::v1alpha1 as pb; +use penumbra_proto::core::component::auction::v1 as pb; use penumbra_proto::DomainType; use penumbra_proto::Name; use penumbra_proto::StateReadProto; diff --git a/crates/core/component/auction/src/component/dutch_auction.rs b/crates/core/component/auction/src/component/dutch_auction.rs index 33a0307702..93fc65e8da 100644 --- a/crates/core/component/auction/src/component/dutch_auction.rs +++ b/crates/core/component/auction/src/component/dutch_auction.rs @@ -17,7 +17,7 @@ use penumbra_dex::lp::position::{self, Position}; use penumbra_dex::lp::Reserves; use penumbra_dex::DirectedTradingPair; use penumbra_num::Amount; -use penumbra_proto::core::component::auction::v1alpha1 as pb; +use penumbra_proto::core::component::auction::v1 as pb; use penumbra_proto::StateWriteProto; use penumbra_sct::component::clock::EpochRead; use prost::{Message, Name}; diff --git a/crates/core/component/auction/src/component/rpc.rs b/crates/core/component/auction/src/component/rpc.rs index 2a33d18ae3..5165ce8065 100755 --- a/crates/core/component/auction/src/component/rpc.rs +++ b/crates/core/component/auction/src/component/rpc.rs @@ -2,8 +2,8 @@ use penumbra_dex::{component::PositionRead, lp::position}; use penumbra_proto::{ - core::component::auction::v1alpha1 as pb, - core::component::auction::v1alpha1::{ + core::component::auction::v1 as pb, + core::component::auction::v1::{ query_service_server::QueryService, AuctionStateByIdRequest, AuctionStateByIdResponse, AuctionStateByIdsRequest, AuctionStateByIdsResponse, DutchAuctionState, }, diff --git a/crates/core/component/auction/src/event.rs b/crates/core/component/auction/src/event.rs index f3942f4286..f170bd0909 100644 --- a/crates/core/component/auction/src/event.rs +++ b/crates/core/component/auction/src/event.rs @@ -2,7 +2,7 @@ use crate::auction::dutch::{DutchAuctionDescription, DutchAuctionState}; use crate::auction::AuctionId; use penumbra_asset::asset; use penumbra_num::Amount; -use penumbra_proto::penumbra::core::component::auction::v1alpha1 as pb; +use penumbra_proto::penumbra::core::component::auction::v1 as pb; /// Event for a Dutch auction that has been scheduled. pub fn dutch_auction_schedule_event( diff --git a/crates/core/component/auction/src/genesis.rs b/crates/core/component/auction/src/genesis.rs index 84ee043ec1..52f78277d5 100644 --- a/crates/core/component/auction/src/genesis.rs +++ b/crates/core/component/auction/src/genesis.rs @@ -2,7 +2,7 @@ use crate::params::AuctionParameters; use anyhow::Context; use serde::{Deserialize, Serialize}; -use penumbra_proto::{penumbra::core::component::auction::v1alpha1 as pb, DomainType}; +use penumbra_proto::{penumbra::core::component::auction::v1 as pb, DomainType}; #[derive(Deserialize, Serialize, Debug, Clone, Default)] #[serde(try_from = "pb::GenesisContent", into = "pb::GenesisContent")] diff --git a/crates/core/component/auction/src/params.rs b/crates/core/component/auction/src/params.rs index a257468c28..dded262c56 100644 --- a/crates/core/component/auction/src/params.rs +++ b/crates/core/component/auction/src/params.rs @@ -1,4 +1,4 @@ -use penumbra_proto::core::component::auction::v1alpha1 as pb; +use penumbra_proto::core::component::auction::v1 as pb; use penumbra_proto::DomainType; use serde::{Deserialize, Serialize}; diff --git a/crates/proto/src/gen/penumbra.core.app.v1.rs b/crates/proto/src/gen/penumbra.core.app.v1.rs index 0fea6965d8..ced7c4b31f 100644 --- a/crates/proto/src/gen/penumbra.core.app.v1.rs +++ b/crates/proto/src/gen/penumbra.core.app.v1.rs @@ -92,7 +92,7 @@ pub struct AppParameters { /// Auction module parameters. #[prost(message, optional, tag = "12")] pub auction_params: ::core::option::Option< - super::super::component::auction::v1alpha1::AuctionParameters, + super::super::component::auction::v1::AuctionParameters, >, } impl ::prost::Name for AppParameters { @@ -209,7 +209,7 @@ pub struct GenesisContent { /// Auction component genesis state. #[prost(message, optional, tag = "12")] pub auction_content: ::core::option::Option< - super::super::component::auction::v1alpha1::GenesisContent, + super::super::component::auction::v1::GenesisContent, >, } impl ::prost::Name for GenesisContent { diff --git a/crates/proto/src/gen/penumbra.core.component.auction.v1alpha1.rs b/crates/proto/src/gen/penumbra.core.component.auction.v1alpha1.rs deleted file mode 100644 index 1effa724c2..0000000000 --- a/crates/proto/src/gen/penumbra.core.component.auction.v1alpha1.rs +++ /dev/null @@ -1,925 +0,0 @@ -/// The configuration parameters for the auction component. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuctionParameters {} -impl ::prost::Name for AuctionParameters { - const NAME: &'static str = "AuctionParameters"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// Genesis data for the auction component. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GenesisContent { - /// The configuration parameters for the auction component at genesis. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -impl ::prost::Name for GenesisContent { - const NAME: &'static str = "GenesisContent"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuctionStateByIdRequest { - #[prost(message, optional, tag = "1")] - pub id: ::core::option::Option, -} -impl ::prost::Name for AuctionStateByIdRequest { - const NAME: &'static str = "AuctionStateByIdRequest"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuctionStateByIdResponse { - /// If present, the state of the auction. If not present, no such auction is known. - #[prost(message, optional, tag = "2")] - pub auction: ::core::option::Option<::pbjson_types::Any>, - /// The state of any DEX positions relevant to the returned auction. - /// - /// Could be empty, depending on the auction state. - #[prost(message, repeated, tag = "3")] - pub positions: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for AuctionStateByIdResponse { - const NAME: &'static str = "AuctionStateByIdResponse"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuctionStateByIdsRequest { - /// The auction IDs to request. Only known IDs will be returned in the response. - #[prost(message, repeated, tag = "1")] - pub id: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for AuctionStateByIdsRequest { - const NAME: &'static str = "AuctionStateByIdsRequest"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuctionStateByIdsResponse { - /// The auction ID of the returned auction. - #[prost(message, optional, tag = "1")] - pub id: ::core::option::Option, - /// The state of the returned auction. - #[prost(message, optional, tag = "2")] - pub auction: ::core::option::Option, - /// The state of any DEX positions relevant to the returned auction. - /// - /// Could be empty, depending on the auction state. - #[prost(message, repeated, tag = "3")] - pub positions: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for AuctionStateByIdsResponse { - const NAME: &'static str = "AuctionStateByIdsResponse"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// A unique identifier for an auction, obtained from hashing a domain separator -/// along with the immutable part of an auction description. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuctionId { - #[prost(bytes = "vec", tag = "1")] - pub inner: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for AuctionId { - const NAME: &'static str = "AuctionId"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// A bearer NFT tracking ownership of an auction and its proceeds. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuctionNft { - #[prost(message, optional, tag = "1")] - pub id: ::core::option::Option, - #[prost(uint64, tag = "2")] - pub seq: u64, -} -impl ::prost::Name for AuctionNft { - const NAME: &'static str = "AuctionNft"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// Describes a Dutch auction using programmatic liquidity on the DEX. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DutchAuctionDescription { - /// The value the seller wishes to auction. - #[prost(message, optional, tag = "1")] - pub input: ::core::option::Option, - /// The asset ID of the target asset the seller wishes to acquire. - #[prost(message, optional, tag = "2")] - pub output_id: ::core::option::Option, - /// The maximum output the seller can receive. - /// - /// This implicitly defines the starting price for the auction. - #[prost(message, optional, tag = "3")] - pub max_output: ::core::option::Option, - /// The minimum output the seller is willing to receive. - /// - /// This implicitly defines the ending price for the auction. - #[prost(message, optional, tag = "4")] - pub min_output: ::core::option::Option, - /// The block height at which the auction begins. - /// - /// This allows the seller to schedule an auction at a future time. - #[prost(uint64, tag = "5")] - pub start_height: u64, - /// The block height at which the auction ends. - /// - /// Together with `start_height`, `max_output`, and `min_output`, - /// this implicitly defines the speed of the auction. - #[prost(uint64, tag = "6")] - pub end_height: u64, - /// The number of discrete price steps to use for the auction. - /// - /// `end_height - start_height` must be a multiple of `step_count`. - #[prost(uint64, tag = "7")] - pub step_count: u64, - /// A random nonce used to allow identical auctions to have - /// distinct auction IDs. - #[prost(bytes = "vec", tag = "8")] - pub nonce: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for DutchAuctionDescription { - const NAME: &'static str = "DutchAuctionDescription"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DutchAuctionState { - /// The sequence number of the auction state. - /// - /// Dutch auctions move from: - /// 0 (opened) => 1 (closed) => n (withdrawn) - #[prost(uint64, tag = "1")] - pub seq: u64, - /// If present, the current position controlled by this auction. - #[prost(message, optional, tag = "2")] - pub current_position: ::core::option::Option, - /// If present, the next trigger height to step down the price. - #[prost(uint64, tag = "3")] - pub next_trigger: u64, - /// The amount of the input asset directly owned by the auction. - /// - /// The auction may also own the input asset indirectly, - /// via the reserves of `current_position` if it exists. - #[prost(message, optional, tag = "4")] - pub input_reserves: ::core::option::Option, - /// The amount of the output asset directly owned by the auction. - /// - /// The auction may also own the output asset indirectly, - /// via the reserves of `current_position` if it exists. - #[prost(message, optional, tag = "5")] - pub output_reserves: ::core::option::Option, -} -impl ::prost::Name for DutchAuctionState { - const NAME: &'static str = "DutchAuctionState"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct DutchAuction { - /// The immutable data describing the auction and its auction ID. - #[prost(message, optional, tag = "1")] - pub description: ::core::option::Option, - /// The mutable data describing the auction's execution. - #[prost(message, optional, tag = "2")] - pub state: ::core::option::Option, -} -impl ::prost::Name for DutchAuction { - const NAME: &'static str = "DutchAuction"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// Initiates a Dutch auction using protocol-controlled liquidity. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionDutchAuctionSchedule { - #[prost(message, optional, tag = "1")] - pub description: ::core::option::Option, -} -impl ::prost::Name for ActionDutchAuctionSchedule { - const NAME: &'static str = "ActionDutchAuctionSchedule"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// Terminate the auction associated with the specified `auction_id` -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionDutchAuctionEnd { - /// The auction to end. - #[prost(message, optional, tag = "1")] - pub auction_id: ::core::option::Option, -} -impl ::prost::Name for ActionDutchAuctionEnd { - const NAME: &'static str = "ActionDutchAuctionEnd"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// Withdraw funds from the ended auction associated with the specified `auction_id` -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionDutchAuctionWithdraw { - /// The auction to withdraw funds from. - #[prost(message, optional, tag = "1")] - pub auction_id: ::core::option::Option, - /// The sequence number of the withdrawal. - #[prost(uint64, tag = "2")] - pub seq: u64, - /// A transparent (zero blinding factor) commitment to the - /// auction's final reserves. - /// - /// The chain will check this commitment by recomputing it - /// with the on-chain state. - #[prost(message, optional, tag = "3")] - pub reserves_commitment: ::core::option::Option< - super::super::super::asset::v1::BalanceCommitment, - >, -} -impl ::prost::Name for ActionDutchAuctionWithdraw { - const NAME: &'static str = "ActionDutchAuctionWithdraw"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// A plan to a `ActionDutchAuctionWithdraw` which contains both private and public data. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionDutchAuctionWithdrawPlan { - #[prost(message, optional, tag = "1")] - pub auction_id: ::core::option::Option, - #[prost(uint64, tag = "2")] - pub seq: u64, - #[prost(message, optional, tag = "3")] - pub reserves_input: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub reserves_output: ::core::option::Option, -} -impl ::prost::Name for ActionDutchAuctionWithdrawPlan { - const NAME: &'static str = "ActionDutchAuctionWithdrawPlan"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// An `ActionDutchAuctionSchedule` augmented with additional metadata. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionDutchAuctionScheduleView { - #[prost(message, optional, tag = "1")] - pub action: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub auction_id: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub input_metadata: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub output_metadata: ::core::option::Option< - super::super::super::asset::v1::Metadata, - >, -} -impl ::prost::Name for ActionDutchAuctionScheduleView { - const NAME: &'static str = "ActionDutchAuctionScheduleView"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// An `ActionDutchAuctionWithdraw` augmented with additional metadata. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ActionDutchAuctionWithdrawView { - #[prost(message, optional, tag = "1")] - pub action: ::core::option::Option, - /// A sequence of values that sum together to the provided - /// reserves commitment. - #[prost(message, repeated, tag = "2")] - pub reserves: ::prost::alloc::vec::Vec, -} -impl ::prost::Name for ActionDutchAuctionWithdrawView { - const NAME: &'static str = "ActionDutchAuctionWithdrawView"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventDutchAuctionScheduled { - #[prost(message, optional, tag = "1")] - pub auction_id: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub description: ::core::option::Option, -} -impl ::prost::Name for EventDutchAuctionScheduled { - const NAME: &'static str = "EventDutchAuctionScheduled"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventDutchAuctionUpdated { - #[prost(message, optional, tag = "1")] - pub auction_id: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub state: ::core::option::Option, -} -impl ::prost::Name for EventDutchAuctionUpdated { - const NAME: &'static str = "EventDutchAuctionUpdated"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventDutchAuctionEnded { - #[prost(message, optional, tag = "1")] - pub auction_id: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub state: ::core::option::Option, - #[prost(enumeration = "event_dutch_auction_ended::Reason", tag = "3")] - pub reason: i32, -} -/// Nested message and enum types in `EventDutchAuctionEnded`. -pub mod event_dutch_auction_ended { - /// The reason the auction ended. - #[derive( - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration - )] - #[repr(i32)] - pub enum Reason { - Unspecified = 0, - /// The auction ended due to reaching its terminal height. - Expired = 1, - /// The auction ran out of reserves. - Filled = 2, - /// The auction ended was terminated by the initiator. - ClosedByOwner = 3, - } - impl Reason { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Reason::Unspecified => "REASON_UNSPECIFIED", - Reason::Expired => "REASON_EXPIRED", - Reason::Filled => "REASON_FILLED", - Reason::ClosedByOwner => "REASON_CLOSED_BY_OWNER", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "REASON_UNSPECIFIED" => Some(Self::Unspecified), - "REASON_EXPIRED" => Some(Self::Expired), - "REASON_FILLED" => Some(Self::Filled), - "REASON_CLOSED_BY_OWNER" => Some(Self::ClosedByOwner), - _ => None, - } - } - } -} -impl ::prost::Name for EventDutchAuctionEnded { - const NAME: &'static str = "EventDutchAuctionEnded"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// A message emitted when value flows *into* the auction component. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventValueCircuitBreakerCredit { - /// The asset ID being deposited into the Auction component. - #[prost(message, optional, tag = "1")] - pub asset_id: ::core::option::Option, - /// The previous balance of the asset in the Auction component. - #[prost(message, optional, tag = "2")] - pub previous_balance: ::core::option::Option, - /// The new balance of the asset in the Auction component. - #[prost(message, optional, tag = "3")] - pub new_balance: ::core::option::Option, -} -impl ::prost::Name for EventValueCircuitBreakerCredit { - const NAME: &'static str = "EventValueCircuitBreakerCredit"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// A message emitted when value flows *out* of the auction component. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventValueCircuitBreakerDebit { - /// The asset ID being deposited into the Auction component. - #[prost(message, optional, tag = "1")] - pub asset_id: ::core::option::Option, - /// The previous balance of the asset in the Auction component. - #[prost(message, optional, tag = "2")] - pub previous_balance: ::core::option::Option, - /// The new balance of the asset in the Auction component. - #[prost(message, optional, tag = "3")] - pub new_balance: ::core::option::Option, -} -impl ::prost::Name for EventValueCircuitBreakerDebit { - const NAME: &'static str = "EventValueCircuitBreakerDebit"; - const PACKAGE: &'static str = "penumbra.core.component.auction.v1alpha1"; - fn full_name() -> ::prost::alloc::string::String { - ::prost::alloc::format!( - "penumbra.core.component.auction.v1alpha1.{}", Self::NAME - ) - } -} -/// Generated client implementations. -#[cfg(feature = "rpc")] -pub mod query_service_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - use tonic::codegen::http::Uri; - /// Query operations for the auction component. - #[derive(Debug, Clone)] - pub struct QueryServiceClient { - inner: tonic::client::Grpc, - } - impl QueryServiceClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl QueryServiceClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> QueryServiceClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - , - >>::Error: Into + Send + Sync, - { - QueryServiceClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - /// Get the current state of an auction by ID. - pub async fn auction_state_by_id( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/penumbra.core.component.auction.v1alpha1.QueryService/AuctionStateById", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "penumbra.core.component.auction.v1alpha1.QueryService", - "AuctionStateById", - ), - ); - self.inner.unary(req, path, codec).await - } - /// Get the current state of a group of auctions by ID. - pub async fn auction_state_by_ids( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response>, - tonic::Status, - > { - self.inner - .ready() - .await - .map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/penumbra.core.component.auction.v1alpha1.QueryService/AuctionStateByIds", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert( - GrpcMethod::new( - "penumbra.core.component.auction.v1alpha1.QueryService", - "AuctionStateByIds", - ), - ); - self.inner.server_streaming(req, path, codec).await - } - } -} -/// Generated server implementations. -#[cfg(feature = "rpc")] -pub mod query_service_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - /// Generated trait containing gRPC methods that should be implemented for use with QueryServiceServer. - #[async_trait] - pub trait QueryService: Send + Sync + 'static { - /// Get the current state of an auction by ID. - async fn auction_state_by_id( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - /// Server streaming response type for the AuctionStateByIds method. - type AuctionStateByIdsStream: tonic::codegen::tokio_stream::Stream< - Item = std::result::Result< - super::AuctionStateByIdsResponse, - tonic::Status, - >, - > - + Send - + 'static; - /// Get the current state of a group of auctions by ID. - async fn auction_state_by_ids( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - } - /// Query operations for the auction component. - #[derive(Debug)] - pub struct QueryServiceServer { - inner: _Inner, - accept_compression_encodings: EnabledCompressionEncodings, - send_compression_encodings: EnabledCompressionEncodings, - max_decoding_message_size: Option, - max_encoding_message_size: Option, - } - struct _Inner(Arc); - impl QueryServiceServer { - pub fn new(inner: T) -> Self { - Self::from_arc(Arc::new(inner)) - } - pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); - Self { - inner, - accept_compression_encodings: Default::default(), - send_compression_encodings: Default::default(), - max_decoding_message_size: None, - max_encoding_message_size: None, - } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> InterceptedService - where - F: tonic::service::Interceptor, - { - InterceptedService::new(Self::new(inner), interceptor) - } - /// Enable decompressing requests with the given encoding. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.accept_compression_encodings.enable(encoding); - self - } - /// Compress responses with the given encoding, if the client supports it. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.send_compression_encodings.enable(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.max_decoding_message_size = Some(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.max_encoding_message_size = Some(limit); - self - } - } - impl tonic::codegen::Service> for QueryServiceServer - where - T: QueryService, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, - { - type Response = http::Response; - type Error = std::convert::Infallible; - type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { - Poll::Ready(Ok(())) - } - fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); - match req.uri().path() { - "/penumbra.core.component.auction.v1alpha1.QueryService/AuctionStateById" => { - #[allow(non_camel_case_types)] - struct AuctionStateByIdSvc(pub Arc); - impl< - T: QueryService, - > tonic::server::UnaryService - for AuctionStateByIdSvc { - type Response = super::AuctionStateByIdResponse; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::auction_state_by_id(&inner, request) - .await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let inner = inner.0; - let method = AuctionStateByIdSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.unary(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - "/penumbra.core.component.auction.v1alpha1.QueryService/AuctionStateByIds" => { - #[allow(non_camel_case_types)] - struct AuctionStateByIdsSvc(pub Arc); - impl< - T: QueryService, - > tonic::server::ServerStreamingService< - super::AuctionStateByIdsRequest, - > for AuctionStateByIdsSvc { - type Response = super::AuctionStateByIdsResponse; - type ResponseStream = T::AuctionStateByIdsStream; - type Future = BoxFuture< - tonic::Response, - tonic::Status, - >; - fn call( - &mut self, - request: tonic::Request, - ) -> Self::Future { - let inner = Arc::clone(&self.0); - let fut = async move { - ::auction_state_by_ids(&inner, request) - .await - }; - Box::pin(fut) - } - } - let accept_compression_encodings = self.accept_compression_encodings; - let send_compression_encodings = self.send_compression_encodings; - let max_decoding_message_size = self.max_decoding_message_size; - let max_encoding_message_size = self.max_encoding_message_size; - let inner = self.inner.clone(); - let fut = async move { - let inner = inner.0; - let method = AuctionStateByIdsSvc(inner); - let codec = tonic::codec::ProstCodec::default(); - let mut grpc = tonic::server::Grpc::new(codec) - .apply_compression_config( - accept_compression_encodings, - send_compression_encodings, - ) - .apply_max_message_size_config( - max_decoding_message_size, - max_encoding_message_size, - ); - let res = grpc.server_streaming(method, req).await; - Ok(res) - }; - Box::pin(fut) - } - _ => { - Box::pin(async move { - Ok( - http::Response::builder() - .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") - .body(empty_body()) - .unwrap(), - ) - }) - } - } - } - } - impl Clone for QueryServiceServer { - fn clone(&self) -> Self { - let inner = self.inner.clone(); - Self { - inner, - accept_compression_encodings: self.accept_compression_encodings, - send_compression_encodings: self.send_compression_encodings, - max_decoding_message_size: self.max_decoding_message_size, - max_encoding_message_size: self.max_encoding_message_size, - } - } - } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService for QueryServiceServer { - const NAME: &'static str = "penumbra.core.component.auction.v1alpha1.QueryService"; - } -} diff --git a/crates/proto/src/gen/penumbra.core.component.auction.v1alpha1.serde.rs b/crates/proto/src/gen/penumbra.core.component.auction.v1alpha1.serde.rs deleted file mode 100644 index d495800b26..0000000000 --- a/crates/proto/src/gen/penumbra.core.component.auction.v1alpha1.serde.rs +++ /dev/null @@ -1,2765 +0,0 @@ -impl serde::Serialize for ActionDutchAuctionEnd { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.auction_id.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionEnd", len)?; - if let Some(v) = self.auction_id.as_ref() { - struct_ser.serialize_field("auctionId", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ActionDutchAuctionEnd { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "auction_id", - "auctionId", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AuctionId, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ActionDutchAuctionEnd; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.ActionDutchAuctionEnd") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut auction_id__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AuctionId => { - if auction_id__.is_some() { - return Err(serde::de::Error::duplicate_field("auctionId")); - } - auction_id__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(ActionDutchAuctionEnd { - auction_id: auction_id__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionEnd", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ActionDutchAuctionSchedule { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.description.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionSchedule", len)?; - if let Some(v) = self.description.as_ref() { - struct_ser.serialize_field("description", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ActionDutchAuctionSchedule { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "description", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Description, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "description" => Ok(GeneratedField::Description), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ActionDutchAuctionSchedule; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.ActionDutchAuctionSchedule") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut description__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Description => { - if description__.is_some() { - return Err(serde::de::Error::duplicate_field("description")); - } - description__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(ActionDutchAuctionSchedule { - description: description__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionSchedule", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ActionDutchAuctionScheduleView { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.action.is_some() { - len += 1; - } - if self.auction_id.is_some() { - len += 1; - } - if self.input_metadata.is_some() { - len += 1; - } - if self.output_metadata.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionScheduleView", len)?; - if let Some(v) = self.action.as_ref() { - struct_ser.serialize_field("action", v)?; - } - if let Some(v) = self.auction_id.as_ref() { - struct_ser.serialize_field("auctionId", v)?; - } - if let Some(v) = self.input_metadata.as_ref() { - struct_ser.serialize_field("inputMetadata", v)?; - } - if let Some(v) = self.output_metadata.as_ref() { - struct_ser.serialize_field("outputMetadata", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ActionDutchAuctionScheduleView { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "action", - "auction_id", - "auctionId", - "input_metadata", - "inputMetadata", - "output_metadata", - "outputMetadata", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Action, - AuctionId, - InputMetadata, - OutputMetadata, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "action" => Ok(GeneratedField::Action), - "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), - "inputMetadata" | "input_metadata" => Ok(GeneratedField::InputMetadata), - "outputMetadata" | "output_metadata" => Ok(GeneratedField::OutputMetadata), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ActionDutchAuctionScheduleView; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.ActionDutchAuctionScheduleView") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut action__ = None; - let mut auction_id__ = None; - let mut input_metadata__ = None; - let mut output_metadata__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Action => { - if action__.is_some() { - return Err(serde::de::Error::duplicate_field("action")); - } - action__ = map_.next_value()?; - } - GeneratedField::AuctionId => { - if auction_id__.is_some() { - return Err(serde::de::Error::duplicate_field("auctionId")); - } - auction_id__ = map_.next_value()?; - } - GeneratedField::InputMetadata => { - if input_metadata__.is_some() { - return Err(serde::de::Error::duplicate_field("inputMetadata")); - } - input_metadata__ = map_.next_value()?; - } - GeneratedField::OutputMetadata => { - if output_metadata__.is_some() { - return Err(serde::de::Error::duplicate_field("outputMetadata")); - } - output_metadata__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(ActionDutchAuctionScheduleView { - action: action__, - auction_id: auction_id__, - input_metadata: input_metadata__, - output_metadata: output_metadata__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionScheduleView", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ActionDutchAuctionWithdraw { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.auction_id.is_some() { - len += 1; - } - if self.seq != 0 { - len += 1; - } - if self.reserves_commitment.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdraw", len)?; - if let Some(v) = self.auction_id.as_ref() { - struct_ser.serialize_field("auctionId", v)?; - } - if self.seq != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("seq", ToString::to_string(&self.seq).as_str())?; - } - if let Some(v) = self.reserves_commitment.as_ref() { - struct_ser.serialize_field("reservesCommitment", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ActionDutchAuctionWithdraw { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "auction_id", - "auctionId", - "seq", - "reserves_commitment", - "reservesCommitment", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AuctionId, - Seq, - ReservesCommitment, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), - "seq" => Ok(GeneratedField::Seq), - "reservesCommitment" | "reserves_commitment" => Ok(GeneratedField::ReservesCommitment), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ActionDutchAuctionWithdraw; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdraw") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut auction_id__ = None; - let mut seq__ = None; - let mut reserves_commitment__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AuctionId => { - if auction_id__.is_some() { - return Err(serde::de::Error::duplicate_field("auctionId")); - } - auction_id__ = map_.next_value()?; - } - GeneratedField::Seq => { - if seq__.is_some() { - return Err(serde::de::Error::duplicate_field("seq")); - } - seq__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::ReservesCommitment => { - if reserves_commitment__.is_some() { - return Err(serde::de::Error::duplicate_field("reservesCommitment")); - } - reserves_commitment__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(ActionDutchAuctionWithdraw { - auction_id: auction_id__, - seq: seq__.unwrap_or_default(), - reserves_commitment: reserves_commitment__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdraw", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ActionDutchAuctionWithdrawPlan { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.auction_id.is_some() { - len += 1; - } - if self.seq != 0 { - len += 1; - } - if self.reserves_input.is_some() { - len += 1; - } - if self.reserves_output.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdrawPlan", len)?; - if let Some(v) = self.auction_id.as_ref() { - struct_ser.serialize_field("auctionId", v)?; - } - if self.seq != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("seq", ToString::to_string(&self.seq).as_str())?; - } - if let Some(v) = self.reserves_input.as_ref() { - struct_ser.serialize_field("reservesInput", v)?; - } - if let Some(v) = self.reserves_output.as_ref() { - struct_ser.serialize_field("reservesOutput", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ActionDutchAuctionWithdrawPlan { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "auction_id", - "auctionId", - "seq", - "reserves_input", - "reservesInput", - "reserves_output", - "reservesOutput", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AuctionId, - Seq, - ReservesInput, - ReservesOutput, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), - "seq" => Ok(GeneratedField::Seq), - "reservesInput" | "reserves_input" => Ok(GeneratedField::ReservesInput), - "reservesOutput" | "reserves_output" => Ok(GeneratedField::ReservesOutput), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ActionDutchAuctionWithdrawPlan; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdrawPlan") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut auction_id__ = None; - let mut seq__ = None; - let mut reserves_input__ = None; - let mut reserves_output__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AuctionId => { - if auction_id__.is_some() { - return Err(serde::de::Error::duplicate_field("auctionId")); - } - auction_id__ = map_.next_value()?; - } - GeneratedField::Seq => { - if seq__.is_some() { - return Err(serde::de::Error::duplicate_field("seq")); - } - seq__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::ReservesInput => { - if reserves_input__.is_some() { - return Err(serde::de::Error::duplicate_field("reservesInput")); - } - reserves_input__ = map_.next_value()?; - } - GeneratedField::ReservesOutput => { - if reserves_output__.is_some() { - return Err(serde::de::Error::duplicate_field("reservesOutput")); - } - reserves_output__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(ActionDutchAuctionWithdrawPlan { - auction_id: auction_id__, - seq: seq__.unwrap_or_default(), - reserves_input: reserves_input__, - reserves_output: reserves_output__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdrawPlan", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ActionDutchAuctionWithdrawView { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.action.is_some() { - len += 1; - } - if !self.reserves.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdrawView", len)?; - if let Some(v) = self.action.as_ref() { - struct_ser.serialize_field("action", v)?; - } - if !self.reserves.is_empty() { - struct_ser.serialize_field("reserves", &self.reserves)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ActionDutchAuctionWithdrawView { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "action", - "reserves", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Action, - Reserves, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "action" => Ok(GeneratedField::Action), - "reserves" => Ok(GeneratedField::Reserves), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ActionDutchAuctionWithdrawView; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdrawView") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut action__ = None; - let mut reserves__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Action => { - if action__.is_some() { - return Err(serde::de::Error::duplicate_field("action")); - } - action__ = map_.next_value()?; - } - GeneratedField::Reserves => { - if reserves__.is_some() { - return Err(serde::de::Error::duplicate_field("reserves")); - } - reserves__ = Some(map_.next_value()?); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(ActionDutchAuctionWithdrawView { - action: action__, - reserves: reserves__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.ActionDutchAuctionWithdrawView", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for AuctionId { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if !self.inner.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.AuctionId", len)?; - if !self.inner.is_empty() { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("inner", pbjson::private::base64::encode(&self.inner).as_str())?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for AuctionId { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "inner", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Inner, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "inner" => Ok(GeneratedField::Inner), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = AuctionId; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.AuctionId") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut inner__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Inner => { - if inner__.is_some() { - return Err(serde::de::Error::duplicate_field("inner")); - } - inner__ = - Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) - ; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(AuctionId { - inner: inner__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.AuctionId", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for AuctionNft { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.id.is_some() { - len += 1; - } - if self.seq != 0 { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.AuctionNft", len)?; - if let Some(v) = self.id.as_ref() { - struct_ser.serialize_field("id", v)?; - } - if self.seq != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("seq", ToString::to_string(&self.seq).as_str())?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for AuctionNft { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "id", - "seq", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Id, - Seq, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "id" => Ok(GeneratedField::Id), - "seq" => Ok(GeneratedField::Seq), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = AuctionNft; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.AuctionNft") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut id__ = None; - let mut seq__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Id => { - if id__.is_some() { - return Err(serde::de::Error::duplicate_field("id")); - } - id__ = map_.next_value()?; - } - GeneratedField::Seq => { - if seq__.is_some() { - return Err(serde::de::Error::duplicate_field("seq")); - } - seq__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(AuctionNft { - id: id__, - seq: seq__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.AuctionNft", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for AuctionParameters { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let len = 0; - let struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.AuctionParameters", len)?; - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for AuctionParameters { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - Ok(GeneratedField::__SkipField__) - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = AuctionParameters; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.AuctionParameters") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - while map_.next_key::()?.is_some() { - let _ = map_.next_value::()?; - } - Ok(AuctionParameters { - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.AuctionParameters", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for AuctionStateByIdRequest { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.id.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.AuctionStateByIdRequest", len)?; - if let Some(v) = self.id.as_ref() { - struct_ser.serialize_field("id", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for AuctionStateByIdRequest { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "id", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Id, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "id" => Ok(GeneratedField::Id), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = AuctionStateByIdRequest; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.AuctionStateByIdRequest") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut id__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Id => { - if id__.is_some() { - return Err(serde::de::Error::duplicate_field("id")); - } - id__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(AuctionStateByIdRequest { - id: id__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.AuctionStateByIdRequest", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for AuctionStateByIdResponse { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.auction.is_some() { - len += 1; - } - if !self.positions.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.AuctionStateByIdResponse", len)?; - if let Some(v) = self.auction.as_ref() { - struct_ser.serialize_field("auction", v)?; - } - if !self.positions.is_empty() { - struct_ser.serialize_field("positions", &self.positions)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for AuctionStateByIdResponse { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "auction", - "positions", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Auction, - Positions, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "auction" => Ok(GeneratedField::Auction), - "positions" => Ok(GeneratedField::Positions), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = AuctionStateByIdResponse; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.AuctionStateByIdResponse") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut auction__ = None; - let mut positions__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Auction => { - if auction__.is_some() { - return Err(serde::de::Error::duplicate_field("auction")); - } - auction__ = map_.next_value()?; - } - GeneratedField::Positions => { - if positions__.is_some() { - return Err(serde::de::Error::duplicate_field("positions")); - } - positions__ = Some(map_.next_value()?); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(AuctionStateByIdResponse { - auction: auction__, - positions: positions__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.AuctionStateByIdResponse", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for AuctionStateByIdsRequest { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if !self.id.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.AuctionStateByIdsRequest", len)?; - if !self.id.is_empty() { - struct_ser.serialize_field("id", &self.id)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for AuctionStateByIdsRequest { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "id", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Id, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "id" => Ok(GeneratedField::Id), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = AuctionStateByIdsRequest; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.AuctionStateByIdsRequest") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut id__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Id => { - if id__.is_some() { - return Err(serde::de::Error::duplicate_field("id")); - } - id__ = Some(map_.next_value()?); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(AuctionStateByIdsRequest { - id: id__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.AuctionStateByIdsRequest", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for AuctionStateByIdsResponse { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.id.is_some() { - len += 1; - } - if self.auction.is_some() { - len += 1; - } - if !self.positions.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.AuctionStateByIdsResponse", len)?; - if let Some(v) = self.id.as_ref() { - struct_ser.serialize_field("id", v)?; - } - if let Some(v) = self.auction.as_ref() { - struct_ser.serialize_field("auction", v)?; - } - if !self.positions.is_empty() { - struct_ser.serialize_field("positions", &self.positions)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for AuctionStateByIdsResponse { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "id", - "auction", - "positions", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Id, - Auction, - Positions, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "id" => Ok(GeneratedField::Id), - "auction" => Ok(GeneratedField::Auction), - "positions" => Ok(GeneratedField::Positions), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = AuctionStateByIdsResponse; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.AuctionStateByIdsResponse") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut id__ = None; - let mut auction__ = None; - let mut positions__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Id => { - if id__.is_some() { - return Err(serde::de::Error::duplicate_field("id")); - } - id__ = map_.next_value()?; - } - GeneratedField::Auction => { - if auction__.is_some() { - return Err(serde::de::Error::duplicate_field("auction")); - } - auction__ = map_.next_value()?; - } - GeneratedField::Positions => { - if positions__.is_some() { - return Err(serde::de::Error::duplicate_field("positions")); - } - positions__ = Some(map_.next_value()?); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(AuctionStateByIdsResponse { - id: id__, - auction: auction__, - positions: positions__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.AuctionStateByIdsResponse", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for DutchAuction { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.description.is_some() { - len += 1; - } - if self.state.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.DutchAuction", len)?; - if let Some(v) = self.description.as_ref() { - struct_ser.serialize_field("description", v)?; - } - if let Some(v) = self.state.as_ref() { - struct_ser.serialize_field("state", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for DutchAuction { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "description", - "state", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Description, - State, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "description" => Ok(GeneratedField::Description), - "state" => Ok(GeneratedField::State), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DutchAuction; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.DutchAuction") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut description__ = None; - let mut state__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Description => { - if description__.is_some() { - return Err(serde::de::Error::duplicate_field("description")); - } - description__ = map_.next_value()?; - } - GeneratedField::State => { - if state__.is_some() { - return Err(serde::de::Error::duplicate_field("state")); - } - state__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(DutchAuction { - description: description__, - state: state__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.DutchAuction", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for DutchAuctionDescription { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.input.is_some() { - len += 1; - } - if self.output_id.is_some() { - len += 1; - } - if self.max_output.is_some() { - len += 1; - } - if self.min_output.is_some() { - len += 1; - } - if self.start_height != 0 { - len += 1; - } - if self.end_height != 0 { - len += 1; - } - if self.step_count != 0 { - len += 1; - } - if !self.nonce.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.DutchAuctionDescription", len)?; - if let Some(v) = self.input.as_ref() { - struct_ser.serialize_field("input", v)?; - } - if let Some(v) = self.output_id.as_ref() { - struct_ser.serialize_field("outputId", v)?; - } - if let Some(v) = self.max_output.as_ref() { - struct_ser.serialize_field("maxOutput", v)?; - } - if let Some(v) = self.min_output.as_ref() { - struct_ser.serialize_field("minOutput", v)?; - } - if self.start_height != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("startHeight", ToString::to_string(&self.start_height).as_str())?; - } - if self.end_height != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("endHeight", ToString::to_string(&self.end_height).as_str())?; - } - if self.step_count != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("stepCount", ToString::to_string(&self.step_count).as_str())?; - } - if !self.nonce.is_empty() { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("nonce", pbjson::private::base64::encode(&self.nonce).as_str())?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for DutchAuctionDescription { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "input", - "output_id", - "outputId", - "max_output", - "maxOutput", - "min_output", - "minOutput", - "start_height", - "startHeight", - "end_height", - "endHeight", - "step_count", - "stepCount", - "nonce", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Input, - OutputId, - MaxOutput, - MinOutput, - StartHeight, - EndHeight, - StepCount, - Nonce, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "input" => Ok(GeneratedField::Input), - "outputId" | "output_id" => Ok(GeneratedField::OutputId), - "maxOutput" | "max_output" => Ok(GeneratedField::MaxOutput), - "minOutput" | "min_output" => Ok(GeneratedField::MinOutput), - "startHeight" | "start_height" => Ok(GeneratedField::StartHeight), - "endHeight" | "end_height" => Ok(GeneratedField::EndHeight), - "stepCount" | "step_count" => Ok(GeneratedField::StepCount), - "nonce" => Ok(GeneratedField::Nonce), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DutchAuctionDescription; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.DutchAuctionDescription") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut input__ = None; - let mut output_id__ = None; - let mut max_output__ = None; - let mut min_output__ = None; - let mut start_height__ = None; - let mut end_height__ = None; - let mut step_count__ = None; - let mut nonce__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Input => { - if input__.is_some() { - return Err(serde::de::Error::duplicate_field("input")); - } - input__ = map_.next_value()?; - } - GeneratedField::OutputId => { - if output_id__.is_some() { - return Err(serde::de::Error::duplicate_field("outputId")); - } - output_id__ = map_.next_value()?; - } - GeneratedField::MaxOutput => { - if max_output__.is_some() { - return Err(serde::de::Error::duplicate_field("maxOutput")); - } - max_output__ = map_.next_value()?; - } - GeneratedField::MinOutput => { - if min_output__.is_some() { - return Err(serde::de::Error::duplicate_field("minOutput")); - } - min_output__ = map_.next_value()?; - } - GeneratedField::StartHeight => { - if start_height__.is_some() { - return Err(serde::de::Error::duplicate_field("startHeight")); - } - start_height__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::EndHeight => { - if end_height__.is_some() { - return Err(serde::de::Error::duplicate_field("endHeight")); - } - end_height__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::StepCount => { - if step_count__.is_some() { - return Err(serde::de::Error::duplicate_field("stepCount")); - } - step_count__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Nonce => { - if nonce__.is_some() { - return Err(serde::de::Error::duplicate_field("nonce")); - } - nonce__ = - Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) - ; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(DutchAuctionDescription { - input: input__, - output_id: output_id__, - max_output: max_output__, - min_output: min_output__, - start_height: start_height__.unwrap_or_default(), - end_height: end_height__.unwrap_or_default(), - step_count: step_count__.unwrap_or_default(), - nonce: nonce__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.DutchAuctionDescription", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for DutchAuctionState { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.seq != 0 { - len += 1; - } - if self.current_position.is_some() { - len += 1; - } - if self.next_trigger != 0 { - len += 1; - } - if self.input_reserves.is_some() { - len += 1; - } - if self.output_reserves.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.DutchAuctionState", len)?; - if self.seq != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("seq", ToString::to_string(&self.seq).as_str())?; - } - if let Some(v) = self.current_position.as_ref() { - struct_ser.serialize_field("currentPosition", v)?; - } - if self.next_trigger != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("nextTrigger", ToString::to_string(&self.next_trigger).as_str())?; - } - if let Some(v) = self.input_reserves.as_ref() { - struct_ser.serialize_field("inputReserves", v)?; - } - if let Some(v) = self.output_reserves.as_ref() { - struct_ser.serialize_field("outputReserves", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for DutchAuctionState { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "seq", - "current_position", - "currentPosition", - "next_trigger", - "nextTrigger", - "input_reserves", - "inputReserves", - "output_reserves", - "outputReserves", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Seq, - CurrentPosition, - NextTrigger, - InputReserves, - OutputReserves, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "seq" => Ok(GeneratedField::Seq), - "currentPosition" | "current_position" => Ok(GeneratedField::CurrentPosition), - "nextTrigger" | "next_trigger" => Ok(GeneratedField::NextTrigger), - "inputReserves" | "input_reserves" => Ok(GeneratedField::InputReserves), - "outputReserves" | "output_reserves" => Ok(GeneratedField::OutputReserves), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DutchAuctionState; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.DutchAuctionState") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut seq__ = None; - let mut current_position__ = None; - let mut next_trigger__ = None; - let mut input_reserves__ = None; - let mut output_reserves__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Seq => { - if seq__.is_some() { - return Err(serde::de::Error::duplicate_field("seq")); - } - seq__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::CurrentPosition => { - if current_position__.is_some() { - return Err(serde::de::Error::duplicate_field("currentPosition")); - } - current_position__ = map_.next_value()?; - } - GeneratedField::NextTrigger => { - if next_trigger__.is_some() { - return Err(serde::de::Error::duplicate_field("nextTrigger")); - } - next_trigger__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::InputReserves => { - if input_reserves__.is_some() { - return Err(serde::de::Error::duplicate_field("inputReserves")); - } - input_reserves__ = map_.next_value()?; - } - GeneratedField::OutputReserves => { - if output_reserves__.is_some() { - return Err(serde::de::Error::duplicate_field("outputReserves")); - } - output_reserves__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(DutchAuctionState { - seq: seq__.unwrap_or_default(), - current_position: current_position__, - next_trigger: next_trigger__.unwrap_or_default(), - input_reserves: input_reserves__, - output_reserves: output_reserves__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.DutchAuctionState", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for EventDutchAuctionEnded { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.auction_id.is_some() { - len += 1; - } - if self.state.is_some() { - len += 1; - } - if self.reason != 0 { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.EventDutchAuctionEnded", len)?; - if let Some(v) = self.auction_id.as_ref() { - struct_ser.serialize_field("auctionId", v)?; - } - if let Some(v) = self.state.as_ref() { - struct_ser.serialize_field("state", v)?; - } - if self.reason != 0 { - let v = event_dutch_auction_ended::Reason::try_from(self.reason) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.reason)))?; - struct_ser.serialize_field("reason", &v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EventDutchAuctionEnded { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "auction_id", - "auctionId", - "state", - "reason", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AuctionId, - State, - Reason, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), - "state" => Ok(GeneratedField::State), - "reason" => Ok(GeneratedField::Reason), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EventDutchAuctionEnded; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.EventDutchAuctionEnded") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut auction_id__ = None; - let mut state__ = None; - let mut reason__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AuctionId => { - if auction_id__.is_some() { - return Err(serde::de::Error::duplicate_field("auctionId")); - } - auction_id__ = map_.next_value()?; - } - GeneratedField::State => { - if state__.is_some() { - return Err(serde::de::Error::duplicate_field("state")); - } - state__ = map_.next_value()?; - } - GeneratedField::Reason => { - if reason__.is_some() { - return Err(serde::de::Error::duplicate_field("reason")); - } - reason__ = Some(map_.next_value::()? as i32); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(EventDutchAuctionEnded { - auction_id: auction_id__, - state: state__, - reason: reason__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.EventDutchAuctionEnded", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for event_dutch_auction_ended::Reason { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Unspecified => "REASON_UNSPECIFIED", - Self::Expired => "REASON_EXPIRED", - Self::Filled => "REASON_FILLED", - Self::ClosedByOwner => "REASON_CLOSED_BY_OWNER", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for event_dutch_auction_ended::Reason { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "REASON_UNSPECIFIED", - "REASON_EXPIRED", - "REASON_FILLED", - "REASON_CLOSED_BY_OWNER", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = event_dutch_auction_ended::Reason; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "REASON_UNSPECIFIED" => Ok(event_dutch_auction_ended::Reason::Unspecified), - "REASON_EXPIRED" => Ok(event_dutch_auction_ended::Reason::Expired), - "REASON_FILLED" => Ok(event_dutch_auction_ended::Reason::Filled), - "REASON_CLOSED_BY_OWNER" => Ok(event_dutch_auction_ended::Reason::ClosedByOwner), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for EventDutchAuctionScheduled { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.auction_id.is_some() { - len += 1; - } - if self.description.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.EventDutchAuctionScheduled", len)?; - if let Some(v) = self.auction_id.as_ref() { - struct_ser.serialize_field("auctionId", v)?; - } - if let Some(v) = self.description.as_ref() { - struct_ser.serialize_field("description", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EventDutchAuctionScheduled { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "auction_id", - "auctionId", - "description", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AuctionId, - Description, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), - "description" => Ok(GeneratedField::Description), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EventDutchAuctionScheduled; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.EventDutchAuctionScheduled") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut auction_id__ = None; - let mut description__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AuctionId => { - if auction_id__.is_some() { - return Err(serde::de::Error::duplicate_field("auctionId")); - } - auction_id__ = map_.next_value()?; - } - GeneratedField::Description => { - if description__.is_some() { - return Err(serde::de::Error::duplicate_field("description")); - } - description__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(EventDutchAuctionScheduled { - auction_id: auction_id__, - description: description__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.EventDutchAuctionScheduled", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for EventDutchAuctionUpdated { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.auction_id.is_some() { - len += 1; - } - if self.state.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.EventDutchAuctionUpdated", len)?; - if let Some(v) = self.auction_id.as_ref() { - struct_ser.serialize_field("auctionId", v)?; - } - if let Some(v) = self.state.as_ref() { - struct_ser.serialize_field("state", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EventDutchAuctionUpdated { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "auction_id", - "auctionId", - "state", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AuctionId, - State, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), - "state" => Ok(GeneratedField::State), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EventDutchAuctionUpdated; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.EventDutchAuctionUpdated") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut auction_id__ = None; - let mut state__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AuctionId => { - if auction_id__.is_some() { - return Err(serde::de::Error::duplicate_field("auctionId")); - } - auction_id__ = map_.next_value()?; - } - GeneratedField::State => { - if state__.is_some() { - return Err(serde::de::Error::duplicate_field("state")); - } - state__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(EventDutchAuctionUpdated { - auction_id: auction_id__, - state: state__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.EventDutchAuctionUpdated", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for EventValueCircuitBreakerCredit { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.asset_id.is_some() { - len += 1; - } - if self.previous_balance.is_some() { - len += 1; - } - if self.new_balance.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.EventValueCircuitBreakerCredit", len)?; - if let Some(v) = self.asset_id.as_ref() { - struct_ser.serialize_field("assetId", v)?; - } - if let Some(v) = self.previous_balance.as_ref() { - struct_ser.serialize_field("previousBalance", v)?; - } - if let Some(v) = self.new_balance.as_ref() { - struct_ser.serialize_field("newBalance", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EventValueCircuitBreakerCredit { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "asset_id", - "assetId", - "previous_balance", - "previousBalance", - "new_balance", - "newBalance", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AssetId, - PreviousBalance, - NewBalance, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "assetId" | "asset_id" => Ok(GeneratedField::AssetId), - "previousBalance" | "previous_balance" => Ok(GeneratedField::PreviousBalance), - "newBalance" | "new_balance" => Ok(GeneratedField::NewBalance), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EventValueCircuitBreakerCredit; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.EventValueCircuitBreakerCredit") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut asset_id__ = None; - let mut previous_balance__ = None; - let mut new_balance__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AssetId => { - if asset_id__.is_some() { - return Err(serde::de::Error::duplicate_field("assetId")); - } - asset_id__ = map_.next_value()?; - } - GeneratedField::PreviousBalance => { - if previous_balance__.is_some() { - return Err(serde::de::Error::duplicate_field("previousBalance")); - } - previous_balance__ = map_.next_value()?; - } - GeneratedField::NewBalance => { - if new_balance__.is_some() { - return Err(serde::de::Error::duplicate_field("newBalance")); - } - new_balance__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(EventValueCircuitBreakerCredit { - asset_id: asset_id__, - previous_balance: previous_balance__, - new_balance: new_balance__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.EventValueCircuitBreakerCredit", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for EventValueCircuitBreakerDebit { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.asset_id.is_some() { - len += 1; - } - if self.previous_balance.is_some() { - len += 1; - } - if self.new_balance.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.EventValueCircuitBreakerDebit", len)?; - if let Some(v) = self.asset_id.as_ref() { - struct_ser.serialize_field("assetId", v)?; - } - if let Some(v) = self.previous_balance.as_ref() { - struct_ser.serialize_field("previousBalance", v)?; - } - if let Some(v) = self.new_balance.as_ref() { - struct_ser.serialize_field("newBalance", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for EventValueCircuitBreakerDebit { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "asset_id", - "assetId", - "previous_balance", - "previousBalance", - "new_balance", - "newBalance", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AssetId, - PreviousBalance, - NewBalance, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "assetId" | "asset_id" => Ok(GeneratedField::AssetId), - "previousBalance" | "previous_balance" => Ok(GeneratedField::PreviousBalance), - "newBalance" | "new_balance" => Ok(GeneratedField::NewBalance), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EventValueCircuitBreakerDebit; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.EventValueCircuitBreakerDebit") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut asset_id__ = None; - let mut previous_balance__ = None; - let mut new_balance__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AssetId => { - if asset_id__.is_some() { - return Err(serde::de::Error::duplicate_field("assetId")); - } - asset_id__ = map_.next_value()?; - } - GeneratedField::PreviousBalance => { - if previous_balance__.is_some() { - return Err(serde::de::Error::duplicate_field("previousBalance")); - } - previous_balance__ = map_.next_value()?; - } - GeneratedField::NewBalance => { - if new_balance__.is_some() { - return Err(serde::de::Error::duplicate_field("newBalance")); - } - new_balance__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(EventValueCircuitBreakerDebit { - asset_id: asset_id__, - previous_balance: previous_balance__, - new_balance: new_balance__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.EventValueCircuitBreakerDebit", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for GenesisContent { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.params.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1alpha1.GenesisContent", len)?; - if let Some(v) = self.params.as_ref() { - struct_ser.serialize_field("params", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for GenesisContent { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "params", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Params, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "params" => Ok(GeneratedField::Params), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GenesisContent; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct penumbra.core.component.auction.v1alpha1.GenesisContent") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut params__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Params => { - if params__.is_some() { - return Err(serde::de::Error::duplicate_field("params")); - } - params__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(GenesisContent { - params: params__, - }) - } - } - deserializer.deserialize_struct("penumbra.core.component.auction.v1alpha1.GenesisContent", FIELDS, GeneratedVisitor) - } -} diff --git a/crates/proto/src/gen/penumbra.core.component.governance.v1.rs b/crates/proto/src/gen/penumbra.core.component.governance.v1.rs index baa430de29..1fc038fd14 100644 --- a/crates/proto/src/gen/penumbra.core.component.governance.v1.rs +++ b/crates/proto/src/gen/penumbra.core.component.governance.v1.rs @@ -1083,7 +1083,7 @@ pub struct ChangedAppParameters { /// Auction module parameters. #[prost(message, optional, tag = "11")] pub auction_params: ::core::option::Option< - super::super::auction::v1alpha1::AuctionParameters, + super::super::auction::v1::AuctionParameters, >, } impl ::prost::Name for ChangedAppParameters { diff --git a/crates/proto/src/gen/penumbra.core.transaction.v1.rs b/crates/proto/src/gen/penumbra.core.transaction.v1.rs index 5cab6232f1..86a0bd2dc7 100644 --- a/crates/proto/src/gen/penumbra.core.transaction.v1.rs +++ b/crates/proto/src/gen/penumbra.core.transaction.v1.rs @@ -167,15 +167,15 @@ pub mod action { /// Dutch auctions #[prost(message, tag = "53")] ActionDutchAuctionSchedule( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionSchedule, + super::super::super::component::auction::v1::ActionDutchAuctionSchedule, ), #[prost(message, tag = "54")] ActionDutchAuctionEnd( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionEnd, + super::super::super::component::auction::v1::ActionDutchAuctionEnd, ), #[prost(message, tag = "55")] ActionDutchAuctionWithdraw( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionWithdraw, + super::super::super::component::auction::v1::ActionDutchAuctionWithdraw, ), #[prost(message, tag = "200")] Ics20Withdrawal(super::super::super::component::ibc::v1::Ics20Withdrawal), @@ -470,15 +470,15 @@ pub mod action_view { /// Dutch auctions #[prost(message, tag = "53")] ActionDutchAuctionSchedule( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionScheduleView, + super::super::super::component::auction::v1::ActionDutchAuctionScheduleView, ), #[prost(message, tag = "54")] ActionDutchAuctionEnd( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionEnd, + super::super::super::component::auction::v1::ActionDutchAuctionEnd, ), #[prost(message, tag = "55")] ActionDutchAuctionWithdraw( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionWithdrawView, + super::super::super::component::auction::v1::ActionDutchAuctionWithdrawView, ), /// TODO: we have no way to recover the opening of the undelegate_claim's /// balance commitment, and can only infer the value from looking at the rest @@ -673,15 +673,15 @@ pub mod action_plan { /// Dutch auctions #[prost(message, tag = "53")] ActionDutchAuctionSchedule( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionSchedule, + super::super::super::component::auction::v1::ActionDutchAuctionSchedule, ), #[prost(message, tag = "54")] ActionDutchAuctionEnd( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionEnd, + super::super::super::component::auction::v1::ActionDutchAuctionEnd, ), #[prost(message, tag = "55")] ActionDutchAuctionWithdraw( - super::super::super::component::auction::v1alpha1::ActionDutchAuctionWithdrawPlan, + super::super::super::component::auction::v1::ActionDutchAuctionWithdrawPlan, ), } } diff --git a/crates/proto/src/gen/penumbra.view.v1.rs b/crates/proto/src/gen/penumbra.view.v1.rs index 1591406240..345079773d 100644 --- a/crates/proto/src/gen/penumbra.view.v1.rs +++ b/crates/proto/src/gen/penumbra.view.v1.rs @@ -25,7 +25,7 @@ impl ::prost::Name for AuctionsRequest { pub struct AuctionsResponse { #[prost(message, optional, tag = "1")] pub id: ::core::option::Option< - super::super::core::component::auction::v1alpha1::AuctionId, + super::super::core::component::auction::v1::AuctionId, >, /// The note recording the auction NFT. #[prost(message, optional, tag = "4")] @@ -507,7 +507,7 @@ pub mod transaction_planner_request { /// The description of the auction to schedule. #[prost(message, optional, tag = "1")] pub description: ::core::option::Option< - super::super::super::core::component::auction::v1alpha1::DutchAuctionDescription, + super::super::super::core::component::auction::v1::DutchAuctionDescription, >, } impl ::prost::Name for ActionDutchAuctionSchedule { @@ -525,7 +525,7 @@ pub mod transaction_planner_request { /// The unique id of the auction to close. #[prost(message, optional, tag = "1")] pub auction_id: ::core::option::Option< - super::super::super::core::component::auction::v1alpha1::AuctionId, + super::super::super::core::component::auction::v1::AuctionId, >, } impl ::prost::Name for ActionDutchAuctionEnd { @@ -543,7 +543,7 @@ pub mod transaction_planner_request { /// The auction to withdraw funds from. #[prost(message, optional, tag = "1")] pub auction_id: ::core::option::Option< - super::super::super::core::component::auction::v1alpha1::AuctionId, + super::super::super::core::component::auction::v1::AuctionId, >, /// The sequence number of the withdrawal. #[prost(uint64, tag = "2")] diff --git a/crates/proto/src/gen/proto_descriptor.bin.no_lfs b/crates/proto/src/gen/proto_descriptor.bin.no_lfs index 91d3694fa137f3158b67aef35c545215968e852d..7e9633291030f039ae84fb94c827b0fd725c84b8 100644 GIT binary patch delta 2538 zcmbVNX>3$g6!zSE-z(fHU0#=23QU>OLRiWsEvYPR*_VRDQfOfHXSbIWnyK6XguJSZQC{Gzz6ZJ*vf`R;|P%siyJYs?$Jh3~@!D8GQ zI$Rv`!J4c!JZY{PP{VcMnZZCr4MdbOE;rSLY8u0$Sf;~vuLmwF{E$Ugal3Fw!7eM) zIH~iCwq49Fo)1F0=<>q>s1WrkWDPX-9FR?8pbgQni26`H7u&>LCF0g4>PmVHKbLq^@$5Qqz#?&~ z0afnV#Zt@$eZ3wsB+qxiU1EO&xQNmxBJ`0oLKHVZHM}9-X#h{(97aTLBfKeHBz&kL z$C*-Ir*2Tnxm;u1vjaqXwbiH801O|rh;yrjYwG;59oNj;L^YXWdjNKVCWZ#VW9u(L zn%MCg3=q45Fb__PAA&HnuPi+oR10qt`k=KQh70UuuG{koaL4Rsw9|v#U(w{p?)v+l zUQg0*_sMM{HmwKeqia8sHY^0LlnO3~)S7TG;Go$sGHGJ0?N^s>AuSq$3Zfh%Jkc9f zLmQW=q2@ZDs=O{PNAM7*W-=p8)I=dIVSQ8$M_f~dHwZcUiYxss;Hj3Img#0G-8kPb zj&7!d4SRl$A+hr7W`=uFcm_s`U<=J|t!f6Xs+ny47EXwsGP+-ETSA@2m}(y^rgyX9 zi1vPvo~3Ee@uc{jnPcd%^}7G!95zh*CQLuGL6Nqjg$8Fr>Fy3X#yyq~;u6ay92C|= z^QXok)!~d1ZD9x9U}GmQ<1n}HWaGr|U(wYMNZ5RaE|Flb_T_ncECF5?TQ1QNqN|#k z=QwwX7SRZI2=6~MLsA2NM}fHcf@QR=`=w0L*h5_=%^}|Hp~<~m^r2}Z?M@Hv=5R`D z|AnqgfL60cTNEvWF)ghpQmiXAXq8nROW7(#1pamjAVd9{ZD)2h$32E&TX9GUZz4-R%UHw$~wxABc!S0 z=Ef1y)CG$ynq8r_Y^Ak@Z!e;FH9OL3^=f8uJMwCmmup8-Ss)#%ggcLAw-g#i;3OS= zaRsKVh(q+n6Ey+Zubr3w5UIHPqItZT3g2?J1*hsx%GO;VH zlUQOAAr+x179mnQi6s^xQagzyHkmjS)(iVZK_3#+%97E2qAL22#QUe!p0}i zw+p!VI3~G;Zw9l&1K+GZziFU-TFm|iXxEOHvY#F`#fkT)Si>n^0B~H(oyWeXcvJTl zGDoc7r1?6PEMldQSi}c%Lh*vxQ}cwk88SrB&urS^GIm2YM&2#H@G?2ahK`s{#v1-0 z#D;|FIQ+UH5TPNann+4&kiLv)^^HgRnMc-yS-gi^(;1Zo4tK5tO*2IWd_5P4pjsihW%OJo&>OO(4BTpN|3(h#UH_(R`; z^i|xd2P=cFpiE#^`nv?<~bA57APFZp2%*#=_w zdPqqexr`q&X&pCj+6!-@CI(Ua-*gAGFfR;?fNo8$VLMRs2{7Uf3&E zZv?YQ?WUvT@(nKUh&mci7M&a5CHOf+PB*UL2A9^E4Vtf2M(u^Ei;lHa=;7$vqVNp0 zijI0n*0%>2aey2F;o1nvT0@D?)+(Fjp{mE|M=g$d!6CAIFgNxba7W1|bg}sOI!!it zqQwSV5w)y?kAU2Jl6V9YTY%fN!UJ8f#P7kwy$_M$jj)}HfBaw{`Jjd?;gIEOZfHfuJR?YwmIE<`3=`2xCKJaU@awOJRok9r`VC4*{QM1M_%&(uG?w1bXb zgM(1NG~tY# zXX?y>IuEN~-=JOw->JEO(HW!u*K&pxaj2blXcEIy=p`&W9##r-B1_%+1dqd0V8jeE z^~_otK@`!l72L=f#w;>bSfw7a7(!@z1R+g%d_e>uO)0O?X;zumu$6kqinJOQQL`eg zCZrY?w<51**$VY&BJ(DLOJt2>&aHWxAvj4!e_V$A(U`W_)fZX3a7oio|g7&ssn=d)ZG@OJ6H&q)+csz(ahPea}0 zxWPAB;7v|f@073!0AH%(OW6gQ?Bb@#0C0yNIkq@a|9A8R$SY&TfZp3SpV?x<6ChPo zmotMnTFDG4(=?Y5Vnko$<0uH(0ukCGA16UiCCicEX<@En*%PK}L4%gMHoG8#Fm-Kl z$r^*d!58#Rdq?ZOfGyQmcJtH89Ye@P7+V^s*mgNLRakrGD$NpLNwJrn4A@X zXsUgXoulr*B4wt)e9;kWcrs%)H}M!|ps`wdJDF43{{so_^b7AaQ;, ) -> Result, tonic::Status> { - use penumbra_proto::core::component::auction::v1alpha1 as pb_auction; - use penumbra_proto::core::component::auction::v1alpha1::query_service_client::QueryServiceClient as AuctionQueryServiceClient; + use penumbra_proto::core::component::auction::v1 as pb_auction; + use penumbra_proto::core::component::auction::v1::query_service_client::QueryServiceClient as AuctionQueryServiceClient; let parameters = request.into_inner(); let query_latest_state = parameters.query_latest_state; diff --git a/proto/penumbra/penumbra/core/app/v1/app.proto b/proto/penumbra/penumbra/core/app/v1/app.proto index 32f51d495f..7d9f1a99de 100644 --- a/proto/penumbra/penumbra/core/app/v1/app.proto +++ b/proto/penumbra/penumbra/core/app/v1/app.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package penumbra.core.app.v1; -import "penumbra/core/component/auction/v1alpha1/auction.proto"; +import "penumbra/core/component/auction/v1/auction.proto"; import "penumbra/core/component/community_pool/v1/community_pool.proto"; import "penumbra/core/component/dex/v1/dex.proto"; import "penumbra/core/component/distributions/v1/distributions.proto"; @@ -60,7 +60,7 @@ message AppParameters { // DEX module parameters. core.component.dex.v1.DexParameters dex_params = 11; // Auction module parameters. - core.component.auction.v1alpha1.AuctionParameters auction_params = 12; + core.component.auction.v1.AuctionParameters auction_params = 12; } // Requests the global configuration data for the app. @@ -101,5 +101,5 @@ message GenesisContent { // DEX component genesis state. core.component.dex.v1.GenesisContent dex_content = 11; // Auction component genesis state. - core.component.auction.v1alpha1.GenesisContent auction_content = 12; + core.component.auction.v1.GenesisContent auction_content = 12; } diff --git a/proto/penumbra/penumbra/core/component/governance/v1/governance.proto b/proto/penumbra/penumbra/core/component/governance/v1/governance.proto index fb88a6cedd..e0fb706de8 100644 --- a/proto/penumbra/penumbra/core/component/governance/v1/governance.proto +++ b/proto/penumbra/penumbra/core/component/governance/v1/governance.proto @@ -3,7 +3,7 @@ package penumbra.core.component.governance.v1; import "google/protobuf/any.proto"; import "penumbra/core/asset/v1/asset.proto"; -import "penumbra/core/component/auction/v1alpha1/auction.proto"; +import "penumbra/core/component/auction/v1/auction.proto"; import "penumbra/core/component/community_pool/v1/community_pool.proto"; import "penumbra/core/component/dex/v1/dex.proto"; import "penumbra/core/component/distributions/v1/distributions.proto"; @@ -475,7 +475,7 @@ message ChangedAppParameters { // DEX component parameters core.component.dex.v1.DexParameters dex_params = 10; // Auction module parameters. - core.component.auction.v1alpha1.AuctionParameters auction_params = 11; + core.component.auction.v1.AuctionParameters auction_params = 11; } // DEPRECATED diff --git a/tools/proto-compiler/src/main.rs b/tools/proto-compiler/src/main.rs index 08675950c8..f0e8f2f412 100644 --- a/tools/proto-compiler/src/main.rs +++ b/tools/proto-compiler/src/main.rs @@ -90,9 +90,9 @@ fn main() -> anyhow::Result<()> { "../../proto/penumbra/penumbra/core/app/v1/app.proto", "../../proto/penumbra/penumbra/core/asset/v1/asset.proto", "../../proto/penumbra/penumbra/core/txhash/v1/txhash.proto", + "../../proto/penumbra/penumbra/core/component/auction/v1/auction.proto", "../../proto/penumbra/penumbra/core/component/compact_block/v1/compact_block.proto", "../../proto/penumbra/penumbra/core/component/community_pool/v1/community_pool.proto", - "../../proto/penumbra/penumbra/core/component/auction/v1/auction.proto", "../../proto/penumbra/penumbra/core/component/dex/v1/dex.proto", "../../proto/penumbra/penumbra/core/component/distributions/v1/distributions.proto", "../../proto/penumbra/penumbra/core/component/funding/v1/funding.proto", From 876f96aebdeb68345c82c114e5111234f114a29e Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Thu, 9 May 2024 14:46:28 -0400 Subject: [PATCH 6/7] penumbra: add `v1` generated files --- .../gen/penumbra.core.component.auction.v1.rs | 881 ++++++ ...enumbra.core.component.auction.v1.serde.rs | 2765 +++++++++++++++++ 2 files changed, 3646 insertions(+) create mode 100644 crates/proto/src/gen/penumbra.core.component.auction.v1.rs create mode 100644 crates/proto/src/gen/penumbra.core.component.auction.v1.serde.rs diff --git a/crates/proto/src/gen/penumbra.core.component.auction.v1.rs b/crates/proto/src/gen/penumbra.core.component.auction.v1.rs new file mode 100644 index 0000000000..5c17e61b21 --- /dev/null +++ b/crates/proto/src/gen/penumbra.core.component.auction.v1.rs @@ -0,0 +1,881 @@ +/// The configuration parameters for the auction component. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuctionParameters {} +impl ::prost::Name for AuctionParameters { + const NAME: &'static str = "AuctionParameters"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// Genesis data for the auction component. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisContent { + /// The configuration parameters for the auction component at genesis. + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, +} +impl ::prost::Name for GenesisContent { + const NAME: &'static str = "GenesisContent"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuctionStateByIdRequest { + #[prost(message, optional, tag = "1")] + pub id: ::core::option::Option, +} +impl ::prost::Name for AuctionStateByIdRequest { + const NAME: &'static str = "AuctionStateByIdRequest"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuctionStateByIdResponse { + /// If present, the state of the auction. If not present, no such auction is known. + #[prost(message, optional, tag = "2")] + pub auction: ::core::option::Option<::pbjson_types::Any>, + /// The state of any DEX positions relevant to the returned auction. + /// + /// Could be empty, depending on the auction state. + #[prost(message, repeated, tag = "3")] + pub positions: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for AuctionStateByIdResponse { + const NAME: &'static str = "AuctionStateByIdResponse"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuctionStateByIdsRequest { + /// The auction IDs to request. Only known IDs will be returned in the response. + #[prost(message, repeated, tag = "1")] + pub id: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for AuctionStateByIdsRequest { + const NAME: &'static str = "AuctionStateByIdsRequest"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuctionStateByIdsResponse { + /// The auction ID of the returned auction. + #[prost(message, optional, tag = "1")] + pub id: ::core::option::Option, + /// The state of the returned auction. + #[prost(message, optional, tag = "2")] + pub auction: ::core::option::Option, + /// The state of any DEX positions relevant to the returned auction. + /// + /// Could be empty, depending on the auction state. + #[prost(message, repeated, tag = "3")] + pub positions: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for AuctionStateByIdsResponse { + const NAME: &'static str = "AuctionStateByIdsResponse"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// A unique identifier for an auction, obtained from hashing a domain separator +/// along with the immutable part of an auction description. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuctionId { + #[prost(bytes = "vec", tag = "1")] + pub inner: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for AuctionId { + const NAME: &'static str = "AuctionId"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// A bearer NFT tracking ownership of an auction and its proceeds. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuctionNft { + #[prost(message, optional, tag = "1")] + pub id: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub seq: u64, +} +impl ::prost::Name for AuctionNft { + const NAME: &'static str = "AuctionNft"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// Describes a Dutch auction using programmatic liquidity on the DEX. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DutchAuctionDescription { + /// The value the seller wishes to auction. + #[prost(message, optional, tag = "1")] + pub input: ::core::option::Option, + /// The asset ID of the target asset the seller wishes to acquire. + #[prost(message, optional, tag = "2")] + pub output_id: ::core::option::Option, + /// The maximum output the seller can receive. + /// + /// This implicitly defines the starting price for the auction. + #[prost(message, optional, tag = "3")] + pub max_output: ::core::option::Option, + /// The minimum output the seller is willing to receive. + /// + /// This implicitly defines the ending price for the auction. + #[prost(message, optional, tag = "4")] + pub min_output: ::core::option::Option, + /// The block height at which the auction begins. + /// + /// This allows the seller to schedule an auction at a future time. + #[prost(uint64, tag = "5")] + pub start_height: u64, + /// The block height at which the auction ends. + /// + /// Together with `start_height`, `max_output`, and `min_output`, + /// this implicitly defines the speed of the auction. + #[prost(uint64, tag = "6")] + pub end_height: u64, + /// The number of discrete price steps to use for the auction. + /// + /// `end_height - start_height` must be a multiple of `step_count`. + #[prost(uint64, tag = "7")] + pub step_count: u64, + /// A random nonce used to allow identical auctions to have + /// distinct auction IDs. + #[prost(bytes = "vec", tag = "8")] + pub nonce: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for DutchAuctionDescription { + const NAME: &'static str = "DutchAuctionDescription"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DutchAuctionState { + /// The sequence number of the auction state. + /// + /// Dutch auctions move from: + /// 0 (opened) => 1 (closed) => n (withdrawn) + #[prost(uint64, tag = "1")] + pub seq: u64, + /// If present, the current position controlled by this auction. + #[prost(message, optional, tag = "2")] + pub current_position: ::core::option::Option, + /// If present, the next trigger height to step down the price. + #[prost(uint64, tag = "3")] + pub next_trigger: u64, + /// The amount of the input asset directly owned by the auction. + /// + /// The auction may also own the input asset indirectly, + /// via the reserves of `current_position` if it exists. + #[prost(message, optional, tag = "4")] + pub input_reserves: ::core::option::Option, + /// The amount of the output asset directly owned by the auction. + /// + /// The auction may also own the output asset indirectly, + /// via the reserves of `current_position` if it exists. + #[prost(message, optional, tag = "5")] + pub output_reserves: ::core::option::Option, +} +impl ::prost::Name for DutchAuctionState { + const NAME: &'static str = "DutchAuctionState"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DutchAuction { + /// The immutable data describing the auction and its auction ID. + #[prost(message, optional, tag = "1")] + pub description: ::core::option::Option, + /// The mutable data describing the auction's execution. + #[prost(message, optional, tag = "2")] + pub state: ::core::option::Option, +} +impl ::prost::Name for DutchAuction { + const NAME: &'static str = "DutchAuction"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// Initiates a Dutch auction using protocol-controlled liquidity. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ActionDutchAuctionSchedule { + #[prost(message, optional, tag = "1")] + pub description: ::core::option::Option, +} +impl ::prost::Name for ActionDutchAuctionSchedule { + const NAME: &'static str = "ActionDutchAuctionSchedule"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// Terminate the auction associated with the specified `auction_id` +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ActionDutchAuctionEnd { + /// The auction to end. + #[prost(message, optional, tag = "1")] + pub auction_id: ::core::option::Option, +} +impl ::prost::Name for ActionDutchAuctionEnd { + const NAME: &'static str = "ActionDutchAuctionEnd"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// Withdraw funds from the ended auction associated with the specified `auction_id` +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ActionDutchAuctionWithdraw { + /// The auction to withdraw funds from. + #[prost(message, optional, tag = "1")] + pub auction_id: ::core::option::Option, + /// The sequence number of the withdrawal. + #[prost(uint64, tag = "2")] + pub seq: u64, + /// A transparent (zero blinding factor) commitment to the + /// auction's final reserves. + /// + /// The chain will check this commitment by recomputing it + /// with the on-chain state. + #[prost(message, optional, tag = "3")] + pub reserves_commitment: ::core::option::Option< + super::super::super::asset::v1::BalanceCommitment, + >, +} +impl ::prost::Name for ActionDutchAuctionWithdraw { + const NAME: &'static str = "ActionDutchAuctionWithdraw"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// A plan to a `ActionDutchAuctionWithdraw` which contains both private and public data. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ActionDutchAuctionWithdrawPlan { + #[prost(message, optional, tag = "1")] + pub auction_id: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub seq: u64, + #[prost(message, optional, tag = "3")] + pub reserves_input: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub reserves_output: ::core::option::Option, +} +impl ::prost::Name for ActionDutchAuctionWithdrawPlan { + const NAME: &'static str = "ActionDutchAuctionWithdrawPlan"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// An `ActionDutchAuctionSchedule` augmented with additional metadata. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ActionDutchAuctionScheduleView { + #[prost(message, optional, tag = "1")] + pub action: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub auction_id: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub input_metadata: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub output_metadata: ::core::option::Option< + super::super::super::asset::v1::Metadata, + >, +} +impl ::prost::Name for ActionDutchAuctionScheduleView { + const NAME: &'static str = "ActionDutchAuctionScheduleView"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// An `ActionDutchAuctionWithdraw` augmented with additional metadata. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ActionDutchAuctionWithdrawView { + #[prost(message, optional, tag = "1")] + pub action: ::core::option::Option, + /// A sequence of values that sum together to the provided + /// reserves commitment. + #[prost(message, repeated, tag = "2")] + pub reserves: ::prost::alloc::vec::Vec, +} +impl ::prost::Name for ActionDutchAuctionWithdrawView { + const NAME: &'static str = "ActionDutchAuctionWithdrawView"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventDutchAuctionScheduled { + #[prost(message, optional, tag = "1")] + pub auction_id: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub description: ::core::option::Option, +} +impl ::prost::Name for EventDutchAuctionScheduled { + const NAME: &'static str = "EventDutchAuctionScheduled"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventDutchAuctionUpdated { + #[prost(message, optional, tag = "1")] + pub auction_id: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub state: ::core::option::Option, +} +impl ::prost::Name for EventDutchAuctionUpdated { + const NAME: &'static str = "EventDutchAuctionUpdated"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventDutchAuctionEnded { + #[prost(message, optional, tag = "1")] + pub auction_id: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub state: ::core::option::Option, + #[prost(enumeration = "event_dutch_auction_ended::Reason", tag = "3")] + pub reason: i32, +} +/// Nested message and enum types in `EventDutchAuctionEnded`. +pub mod event_dutch_auction_ended { + /// The reason the auction ended. + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Reason { + Unspecified = 0, + /// The auction ended due to reaching its terminal height. + Expired = 1, + /// The auction ran out of reserves. + Filled = 2, + /// The auction ended was terminated by the initiator. + ClosedByOwner = 3, + } + impl Reason { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Reason::Unspecified => "REASON_UNSPECIFIED", + Reason::Expired => "REASON_EXPIRED", + Reason::Filled => "REASON_FILLED", + Reason::ClosedByOwner => "REASON_CLOSED_BY_OWNER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "REASON_UNSPECIFIED" => Some(Self::Unspecified), + "REASON_EXPIRED" => Some(Self::Expired), + "REASON_FILLED" => Some(Self::Filled), + "REASON_CLOSED_BY_OWNER" => Some(Self::ClosedByOwner), + _ => None, + } + } + } +} +impl ::prost::Name for EventDutchAuctionEnded { + const NAME: &'static str = "EventDutchAuctionEnded"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// A message emitted when value flows *into* the auction component. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventValueCircuitBreakerCredit { + /// The asset ID being deposited into the Auction component. + #[prost(message, optional, tag = "1")] + pub asset_id: ::core::option::Option, + /// The previous balance of the asset in the Auction component. + #[prost(message, optional, tag = "2")] + pub previous_balance: ::core::option::Option, + /// The new balance of the asset in the Auction component. + #[prost(message, optional, tag = "3")] + pub new_balance: ::core::option::Option, +} +impl ::prost::Name for EventValueCircuitBreakerCredit { + const NAME: &'static str = "EventValueCircuitBreakerCredit"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// A message emitted when value flows *out* of the auction component. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventValueCircuitBreakerDebit { + /// The asset ID being deposited into the Auction component. + #[prost(message, optional, tag = "1")] + pub asset_id: ::core::option::Option, + /// The previous balance of the asset in the Auction component. + #[prost(message, optional, tag = "2")] + pub previous_balance: ::core::option::Option, + /// The new balance of the asset in the Auction component. + #[prost(message, optional, tag = "3")] + pub new_balance: ::core::option::Option, +} +impl ::prost::Name for EventValueCircuitBreakerDebit { + const NAME: &'static str = "EventValueCircuitBreakerDebit"; + const PACKAGE: &'static str = "penumbra.core.component.auction.v1"; + fn full_name() -> ::prost::alloc::string::String { + ::prost::alloc::format!("penumbra.core.component.auction.v1.{}", Self::NAME) + } +} +/// Generated client implementations. +#[cfg(feature = "rpc")] +pub mod query_service_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Query operations for the auction component. + #[derive(Debug, Clone)] + pub struct QueryServiceClient { + inner: tonic::client::Grpc, + } + impl QueryServiceClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryServiceClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> QueryServiceClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + QueryServiceClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Get the current state of an auction by ID. + pub async fn auction_state_by_id( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/penumbra.core.component.auction.v1.QueryService/AuctionStateById", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "penumbra.core.component.auction.v1.QueryService", + "AuctionStateById", + ), + ); + self.inner.unary(req, path, codec).await + } + /// Get the current state of a group of auctions by ID. + pub async fn auction_state_by_ids( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/penumbra.core.component.auction.v1.QueryService/AuctionStateByIds", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "penumbra.core.component.auction.v1.QueryService", + "AuctionStateByIds", + ), + ); + self.inner.server_streaming(req, path, codec).await + } + } +} +/// Generated server implementations. +#[cfg(feature = "rpc")] +pub mod query_service_server { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with QueryServiceServer. + #[async_trait] + pub trait QueryService: Send + Sync + 'static { + /// Get the current state of an auction by ID. + async fn auction_state_by_id( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Server streaming response type for the AuctionStateByIds method. + type AuctionStateByIdsStream: tonic::codegen::tokio_stream::Stream< + Item = std::result::Result< + super::AuctionStateByIdsResponse, + tonic::Status, + >, + > + + Send + + 'static; + /// Get the current state of a group of auctions by ID. + async fn auction_state_by_ids( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + } + /// Query operations for the auction component. + #[derive(Debug)] + pub struct QueryServiceServer { + inner: _Inner, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + struct _Inner(Arc); + impl QueryServiceServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + let inner = _Inner(inner); + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for QueryServiceServer + where + T: QueryService, + B: Body + Send + 'static, + B::Error: Into + Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + let inner = self.inner.clone(); + match req.uri().path() { + "/penumbra.core.component.auction.v1.QueryService/AuctionStateById" => { + #[allow(non_camel_case_types)] + struct AuctionStateByIdSvc(pub Arc); + impl< + T: QueryService, + > tonic::server::UnaryService + for AuctionStateByIdSvc { + type Response = super::AuctionStateByIdResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::auction_state_by_id(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = AuctionStateByIdSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/penumbra.core.component.auction.v1.QueryService/AuctionStateByIds" => { + #[allow(non_camel_case_types)] + struct AuctionStateByIdsSvc(pub Arc); + impl< + T: QueryService, + > tonic::server::ServerStreamingService< + super::AuctionStateByIdsRequest, + > for AuctionStateByIdsSvc { + type Response = super::AuctionStateByIdsResponse; + type ResponseStream = T::AuctionStateByIdsStream; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::auction_state_by_ids(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = AuctionStateByIdsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.server_streaming(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + _ => { + Box::pin(async move { + Ok( + http::Response::builder() + .status(200) + .header("grpc-status", "12") + .header("content-type", "application/grpc") + .body(empty_body()) + .unwrap(), + ) + }) + } + } + } + } + impl Clone for QueryServiceServer { + fn clone(&self) -> Self { + let inner = self.inner.clone(); + Self { + inner, + accept_compression_encodings: self.accept_compression_encodings, + send_compression_encodings: self.send_compression_encodings, + max_decoding_message_size: self.max_decoding_message_size, + max_encoding_message_size: self.max_encoding_message_size, + } + } + } + impl Clone for _Inner { + fn clone(&self) -> Self { + Self(Arc::clone(&self.0)) + } + } + impl std::fmt::Debug for _Inner { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}", self.0) + } + } + impl tonic::server::NamedService for QueryServiceServer { + const NAME: &'static str = "penumbra.core.component.auction.v1.QueryService"; + } +} diff --git a/crates/proto/src/gen/penumbra.core.component.auction.v1.serde.rs b/crates/proto/src/gen/penumbra.core.component.auction.v1.serde.rs new file mode 100644 index 0000000000..a4267c54cc --- /dev/null +++ b/crates/proto/src/gen/penumbra.core.component.auction.v1.serde.rs @@ -0,0 +1,2765 @@ +impl serde::Serialize for ActionDutchAuctionEnd { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.auction_id.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionEnd", len)?; + if let Some(v) = self.auction_id.as_ref() { + struct_ser.serialize_field("auctionId", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ActionDutchAuctionEnd { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "auction_id", + "auctionId", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AuctionId, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ActionDutchAuctionEnd; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.ActionDutchAuctionEnd") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut auction_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AuctionId => { + if auction_id__.is_some() { + return Err(serde::de::Error::duplicate_field("auctionId")); + } + auction_id__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ActionDutchAuctionEnd { + auction_id: auction_id__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionEnd", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ActionDutchAuctionSchedule { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.description.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionSchedule", len)?; + if let Some(v) = self.description.as_ref() { + struct_ser.serialize_field("description", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ActionDutchAuctionSchedule { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "description", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Description, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "description" => Ok(GeneratedField::Description), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ActionDutchAuctionSchedule; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.ActionDutchAuctionSchedule") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut description__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ActionDutchAuctionSchedule { + description: description__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionSchedule", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ActionDutchAuctionScheduleView { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.action.is_some() { + len += 1; + } + if self.auction_id.is_some() { + len += 1; + } + if self.input_metadata.is_some() { + len += 1; + } + if self.output_metadata.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionScheduleView", len)?; + if let Some(v) = self.action.as_ref() { + struct_ser.serialize_field("action", v)?; + } + if let Some(v) = self.auction_id.as_ref() { + struct_ser.serialize_field("auctionId", v)?; + } + if let Some(v) = self.input_metadata.as_ref() { + struct_ser.serialize_field("inputMetadata", v)?; + } + if let Some(v) = self.output_metadata.as_ref() { + struct_ser.serialize_field("outputMetadata", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ActionDutchAuctionScheduleView { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "action", + "auction_id", + "auctionId", + "input_metadata", + "inputMetadata", + "output_metadata", + "outputMetadata", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Action, + AuctionId, + InputMetadata, + OutputMetadata, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "action" => Ok(GeneratedField::Action), + "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), + "inputMetadata" | "input_metadata" => Ok(GeneratedField::InputMetadata), + "outputMetadata" | "output_metadata" => Ok(GeneratedField::OutputMetadata), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ActionDutchAuctionScheduleView; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.ActionDutchAuctionScheduleView") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut action__ = None; + let mut auction_id__ = None; + let mut input_metadata__ = None; + let mut output_metadata__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Action => { + if action__.is_some() { + return Err(serde::de::Error::duplicate_field("action")); + } + action__ = map_.next_value()?; + } + GeneratedField::AuctionId => { + if auction_id__.is_some() { + return Err(serde::de::Error::duplicate_field("auctionId")); + } + auction_id__ = map_.next_value()?; + } + GeneratedField::InputMetadata => { + if input_metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("inputMetadata")); + } + input_metadata__ = map_.next_value()?; + } + GeneratedField::OutputMetadata => { + if output_metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("outputMetadata")); + } + output_metadata__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ActionDutchAuctionScheduleView { + action: action__, + auction_id: auction_id__, + input_metadata: input_metadata__, + output_metadata: output_metadata__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionScheduleView", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ActionDutchAuctionWithdraw { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.auction_id.is_some() { + len += 1; + } + if self.seq != 0 { + len += 1; + } + if self.reserves_commitment.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionWithdraw", len)?; + if let Some(v) = self.auction_id.as_ref() { + struct_ser.serialize_field("auctionId", v)?; + } + if self.seq != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("seq", ToString::to_string(&self.seq).as_str())?; + } + if let Some(v) = self.reserves_commitment.as_ref() { + struct_ser.serialize_field("reservesCommitment", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ActionDutchAuctionWithdraw { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "auction_id", + "auctionId", + "seq", + "reserves_commitment", + "reservesCommitment", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AuctionId, + Seq, + ReservesCommitment, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), + "seq" => Ok(GeneratedField::Seq), + "reservesCommitment" | "reserves_commitment" => Ok(GeneratedField::ReservesCommitment), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ActionDutchAuctionWithdraw; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.ActionDutchAuctionWithdraw") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut auction_id__ = None; + let mut seq__ = None; + let mut reserves_commitment__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AuctionId => { + if auction_id__.is_some() { + return Err(serde::de::Error::duplicate_field("auctionId")); + } + auction_id__ = map_.next_value()?; + } + GeneratedField::Seq => { + if seq__.is_some() { + return Err(serde::de::Error::duplicate_field("seq")); + } + seq__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::ReservesCommitment => { + if reserves_commitment__.is_some() { + return Err(serde::de::Error::duplicate_field("reservesCommitment")); + } + reserves_commitment__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ActionDutchAuctionWithdraw { + auction_id: auction_id__, + seq: seq__.unwrap_or_default(), + reserves_commitment: reserves_commitment__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionWithdraw", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ActionDutchAuctionWithdrawPlan { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.auction_id.is_some() { + len += 1; + } + if self.seq != 0 { + len += 1; + } + if self.reserves_input.is_some() { + len += 1; + } + if self.reserves_output.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionWithdrawPlan", len)?; + if let Some(v) = self.auction_id.as_ref() { + struct_ser.serialize_field("auctionId", v)?; + } + if self.seq != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("seq", ToString::to_string(&self.seq).as_str())?; + } + if let Some(v) = self.reserves_input.as_ref() { + struct_ser.serialize_field("reservesInput", v)?; + } + if let Some(v) = self.reserves_output.as_ref() { + struct_ser.serialize_field("reservesOutput", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ActionDutchAuctionWithdrawPlan { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "auction_id", + "auctionId", + "seq", + "reserves_input", + "reservesInput", + "reserves_output", + "reservesOutput", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AuctionId, + Seq, + ReservesInput, + ReservesOutput, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), + "seq" => Ok(GeneratedField::Seq), + "reservesInput" | "reserves_input" => Ok(GeneratedField::ReservesInput), + "reservesOutput" | "reserves_output" => Ok(GeneratedField::ReservesOutput), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ActionDutchAuctionWithdrawPlan; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.ActionDutchAuctionWithdrawPlan") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut auction_id__ = None; + let mut seq__ = None; + let mut reserves_input__ = None; + let mut reserves_output__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AuctionId => { + if auction_id__.is_some() { + return Err(serde::de::Error::duplicate_field("auctionId")); + } + auction_id__ = map_.next_value()?; + } + GeneratedField::Seq => { + if seq__.is_some() { + return Err(serde::de::Error::duplicate_field("seq")); + } + seq__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::ReservesInput => { + if reserves_input__.is_some() { + return Err(serde::de::Error::duplicate_field("reservesInput")); + } + reserves_input__ = map_.next_value()?; + } + GeneratedField::ReservesOutput => { + if reserves_output__.is_some() { + return Err(serde::de::Error::duplicate_field("reservesOutput")); + } + reserves_output__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ActionDutchAuctionWithdrawPlan { + auction_id: auction_id__, + seq: seq__.unwrap_or_default(), + reserves_input: reserves_input__, + reserves_output: reserves_output__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionWithdrawPlan", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ActionDutchAuctionWithdrawView { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.action.is_some() { + len += 1; + } + if !self.reserves.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionWithdrawView", len)?; + if let Some(v) = self.action.as_ref() { + struct_ser.serialize_field("action", v)?; + } + if !self.reserves.is_empty() { + struct_ser.serialize_field("reserves", &self.reserves)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ActionDutchAuctionWithdrawView { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "action", + "reserves", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Action, + Reserves, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "action" => Ok(GeneratedField::Action), + "reserves" => Ok(GeneratedField::Reserves), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ActionDutchAuctionWithdrawView; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.ActionDutchAuctionWithdrawView") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut action__ = None; + let mut reserves__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Action => { + if action__.is_some() { + return Err(serde::de::Error::duplicate_field("action")); + } + action__ = map_.next_value()?; + } + GeneratedField::Reserves => { + if reserves__.is_some() { + return Err(serde::de::Error::duplicate_field("reserves")); + } + reserves__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ActionDutchAuctionWithdrawView { + action: action__, + reserves: reserves__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.ActionDutchAuctionWithdrawView", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for AuctionId { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.inner.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.AuctionId", len)?; + if !self.inner.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("inner", pbjson::private::base64::encode(&self.inner).as_str())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for AuctionId { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "inner", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Inner, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "inner" => Ok(GeneratedField::Inner), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuctionId; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.AuctionId") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut inner__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Inner => { + if inner__.is_some() { + return Err(serde::de::Error::duplicate_field("inner")); + } + inner__ = + Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(AuctionId { + inner: inner__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.AuctionId", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for AuctionNft { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id.is_some() { + len += 1; + } + if self.seq != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.AuctionNft", len)?; + if let Some(v) = self.id.as_ref() { + struct_ser.serialize_field("id", v)?; + } + if self.seq != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("seq", ToString::to_string(&self.seq).as_str())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for AuctionNft { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + "seq", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + Seq, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + "seq" => Ok(GeneratedField::Seq), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuctionNft; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.AuctionNft") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + let mut seq__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = map_.next_value()?; + } + GeneratedField::Seq => { + if seq__.is_some() { + return Err(serde::de::Error::duplicate_field("seq")); + } + seq__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(AuctionNft { + id: id__, + seq: seq__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.AuctionNft", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for AuctionParameters { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.AuctionParameters", len)?; + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for AuctionParameters { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Ok(GeneratedField::__SkipField__) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuctionParameters; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.AuctionParameters") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(AuctionParameters { + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.AuctionParameters", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for AuctionStateByIdRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.AuctionStateByIdRequest", len)?; + if let Some(v) = self.id.as_ref() { + struct_ser.serialize_field("id", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for AuctionStateByIdRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuctionStateByIdRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.AuctionStateByIdRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(AuctionStateByIdRequest { + id: id__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.AuctionStateByIdRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for AuctionStateByIdResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.auction.is_some() { + len += 1; + } + if !self.positions.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.AuctionStateByIdResponse", len)?; + if let Some(v) = self.auction.as_ref() { + struct_ser.serialize_field("auction", v)?; + } + if !self.positions.is_empty() { + struct_ser.serialize_field("positions", &self.positions)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for AuctionStateByIdResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "auction", + "positions", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Auction, + Positions, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "auction" => Ok(GeneratedField::Auction), + "positions" => Ok(GeneratedField::Positions), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuctionStateByIdResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.AuctionStateByIdResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut auction__ = None; + let mut positions__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Auction => { + if auction__.is_some() { + return Err(serde::de::Error::duplicate_field("auction")); + } + auction__ = map_.next_value()?; + } + GeneratedField::Positions => { + if positions__.is_some() { + return Err(serde::de::Error::duplicate_field("positions")); + } + positions__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(AuctionStateByIdResponse { + auction: auction__, + positions: positions__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.AuctionStateByIdResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for AuctionStateByIdsRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.id.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.AuctionStateByIdsRequest", len)?; + if !self.id.is_empty() { + struct_ser.serialize_field("id", &self.id)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for AuctionStateByIdsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuctionStateByIdsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.AuctionStateByIdsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(AuctionStateByIdsRequest { + id: id__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.AuctionStateByIdsRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for AuctionStateByIdsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.id.is_some() { + len += 1; + } + if self.auction.is_some() { + len += 1; + } + if !self.positions.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.AuctionStateByIdsResponse", len)?; + if let Some(v) = self.id.as_ref() { + struct_ser.serialize_field("id", v)?; + } + if let Some(v) = self.auction.as_ref() { + struct_ser.serialize_field("auction", v)?; + } + if !self.positions.is_empty() { + struct_ser.serialize_field("positions", &self.positions)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for AuctionStateByIdsResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "id", + "auction", + "positions", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Id, + Auction, + Positions, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "id" => Ok(GeneratedField::Id), + "auction" => Ok(GeneratedField::Auction), + "positions" => Ok(GeneratedField::Positions), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AuctionStateByIdsResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.AuctionStateByIdsResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut id__ = None; + let mut auction__ = None; + let mut positions__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = map_.next_value()?; + } + GeneratedField::Auction => { + if auction__.is_some() { + return Err(serde::de::Error::duplicate_field("auction")); + } + auction__ = map_.next_value()?; + } + GeneratedField::Positions => { + if positions__.is_some() { + return Err(serde::de::Error::duplicate_field("positions")); + } + positions__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(AuctionStateByIdsResponse { + id: id__, + auction: auction__, + positions: positions__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.AuctionStateByIdsResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for DutchAuction { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.description.is_some() { + len += 1; + } + if self.state.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.DutchAuction", len)?; + if let Some(v) = self.description.as_ref() { + struct_ser.serialize_field("description", v)?; + } + if let Some(v) = self.state.as_ref() { + struct_ser.serialize_field("state", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for DutchAuction { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "description", + "state", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Description, + State, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "description" => Ok(GeneratedField::Description), + "state" => Ok(GeneratedField::State), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DutchAuction; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.DutchAuction") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut description__ = None; + let mut state__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = map_.next_value()?; + } + GeneratedField::State => { + if state__.is_some() { + return Err(serde::de::Error::duplicate_field("state")); + } + state__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(DutchAuction { + description: description__, + state: state__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.DutchAuction", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for DutchAuctionDescription { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.input.is_some() { + len += 1; + } + if self.output_id.is_some() { + len += 1; + } + if self.max_output.is_some() { + len += 1; + } + if self.min_output.is_some() { + len += 1; + } + if self.start_height != 0 { + len += 1; + } + if self.end_height != 0 { + len += 1; + } + if self.step_count != 0 { + len += 1; + } + if !self.nonce.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.DutchAuctionDescription", len)?; + if let Some(v) = self.input.as_ref() { + struct_ser.serialize_field("input", v)?; + } + if let Some(v) = self.output_id.as_ref() { + struct_ser.serialize_field("outputId", v)?; + } + if let Some(v) = self.max_output.as_ref() { + struct_ser.serialize_field("maxOutput", v)?; + } + if let Some(v) = self.min_output.as_ref() { + struct_ser.serialize_field("minOutput", v)?; + } + if self.start_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("startHeight", ToString::to_string(&self.start_height).as_str())?; + } + if self.end_height != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("endHeight", ToString::to_string(&self.end_height).as_str())?; + } + if self.step_count != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("stepCount", ToString::to_string(&self.step_count).as_str())?; + } + if !self.nonce.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("nonce", pbjson::private::base64::encode(&self.nonce).as_str())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for DutchAuctionDescription { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "input", + "output_id", + "outputId", + "max_output", + "maxOutput", + "min_output", + "minOutput", + "start_height", + "startHeight", + "end_height", + "endHeight", + "step_count", + "stepCount", + "nonce", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Input, + OutputId, + MaxOutput, + MinOutput, + StartHeight, + EndHeight, + StepCount, + Nonce, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "input" => Ok(GeneratedField::Input), + "outputId" | "output_id" => Ok(GeneratedField::OutputId), + "maxOutput" | "max_output" => Ok(GeneratedField::MaxOutput), + "minOutput" | "min_output" => Ok(GeneratedField::MinOutput), + "startHeight" | "start_height" => Ok(GeneratedField::StartHeight), + "endHeight" | "end_height" => Ok(GeneratedField::EndHeight), + "stepCount" | "step_count" => Ok(GeneratedField::StepCount), + "nonce" => Ok(GeneratedField::Nonce), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DutchAuctionDescription; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.DutchAuctionDescription") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut input__ = None; + let mut output_id__ = None; + let mut max_output__ = None; + let mut min_output__ = None; + let mut start_height__ = None; + let mut end_height__ = None; + let mut step_count__ = None; + let mut nonce__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Input => { + if input__.is_some() { + return Err(serde::de::Error::duplicate_field("input")); + } + input__ = map_.next_value()?; + } + GeneratedField::OutputId => { + if output_id__.is_some() { + return Err(serde::de::Error::duplicate_field("outputId")); + } + output_id__ = map_.next_value()?; + } + GeneratedField::MaxOutput => { + if max_output__.is_some() { + return Err(serde::de::Error::duplicate_field("maxOutput")); + } + max_output__ = map_.next_value()?; + } + GeneratedField::MinOutput => { + if min_output__.is_some() { + return Err(serde::de::Error::duplicate_field("minOutput")); + } + min_output__ = map_.next_value()?; + } + GeneratedField::StartHeight => { + if start_height__.is_some() { + return Err(serde::de::Error::duplicate_field("startHeight")); + } + start_height__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::EndHeight => { + if end_height__.is_some() { + return Err(serde::de::Error::duplicate_field("endHeight")); + } + end_height__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::StepCount => { + if step_count__.is_some() { + return Err(serde::de::Error::duplicate_field("stepCount")); + } + step_count__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Nonce => { + if nonce__.is_some() { + return Err(serde::de::Error::duplicate_field("nonce")); + } + nonce__ = + Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(DutchAuctionDescription { + input: input__, + output_id: output_id__, + max_output: max_output__, + min_output: min_output__, + start_height: start_height__.unwrap_or_default(), + end_height: end_height__.unwrap_or_default(), + step_count: step_count__.unwrap_or_default(), + nonce: nonce__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.DutchAuctionDescription", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for DutchAuctionState { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.seq != 0 { + len += 1; + } + if self.current_position.is_some() { + len += 1; + } + if self.next_trigger != 0 { + len += 1; + } + if self.input_reserves.is_some() { + len += 1; + } + if self.output_reserves.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.DutchAuctionState", len)?; + if self.seq != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("seq", ToString::to_string(&self.seq).as_str())?; + } + if let Some(v) = self.current_position.as_ref() { + struct_ser.serialize_field("currentPosition", v)?; + } + if self.next_trigger != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("nextTrigger", ToString::to_string(&self.next_trigger).as_str())?; + } + if let Some(v) = self.input_reserves.as_ref() { + struct_ser.serialize_field("inputReserves", v)?; + } + if let Some(v) = self.output_reserves.as_ref() { + struct_ser.serialize_field("outputReserves", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for DutchAuctionState { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "seq", + "current_position", + "currentPosition", + "next_trigger", + "nextTrigger", + "input_reserves", + "inputReserves", + "output_reserves", + "outputReserves", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Seq, + CurrentPosition, + NextTrigger, + InputReserves, + OutputReserves, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "seq" => Ok(GeneratedField::Seq), + "currentPosition" | "current_position" => Ok(GeneratedField::CurrentPosition), + "nextTrigger" | "next_trigger" => Ok(GeneratedField::NextTrigger), + "inputReserves" | "input_reserves" => Ok(GeneratedField::InputReserves), + "outputReserves" | "output_reserves" => Ok(GeneratedField::OutputReserves), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DutchAuctionState; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.DutchAuctionState") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut seq__ = None; + let mut current_position__ = None; + let mut next_trigger__ = None; + let mut input_reserves__ = None; + let mut output_reserves__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Seq => { + if seq__.is_some() { + return Err(serde::de::Error::duplicate_field("seq")); + } + seq__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::CurrentPosition => { + if current_position__.is_some() { + return Err(serde::de::Error::duplicate_field("currentPosition")); + } + current_position__ = map_.next_value()?; + } + GeneratedField::NextTrigger => { + if next_trigger__.is_some() { + return Err(serde::de::Error::duplicate_field("nextTrigger")); + } + next_trigger__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::InputReserves => { + if input_reserves__.is_some() { + return Err(serde::de::Error::duplicate_field("inputReserves")); + } + input_reserves__ = map_.next_value()?; + } + GeneratedField::OutputReserves => { + if output_reserves__.is_some() { + return Err(serde::de::Error::duplicate_field("outputReserves")); + } + output_reserves__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(DutchAuctionState { + seq: seq__.unwrap_or_default(), + current_position: current_position__, + next_trigger: next_trigger__.unwrap_or_default(), + input_reserves: input_reserves__, + output_reserves: output_reserves__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.DutchAuctionState", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for EventDutchAuctionEnded { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.auction_id.is_some() { + len += 1; + } + if self.state.is_some() { + len += 1; + } + if self.reason != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.EventDutchAuctionEnded", len)?; + if let Some(v) = self.auction_id.as_ref() { + struct_ser.serialize_field("auctionId", v)?; + } + if let Some(v) = self.state.as_ref() { + struct_ser.serialize_field("state", v)?; + } + if self.reason != 0 { + let v = event_dutch_auction_ended::Reason::try_from(self.reason) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.reason)))?; + struct_ser.serialize_field("reason", &v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for EventDutchAuctionEnded { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "auction_id", + "auctionId", + "state", + "reason", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AuctionId, + State, + Reason, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), + "state" => Ok(GeneratedField::State), + "reason" => Ok(GeneratedField::Reason), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventDutchAuctionEnded; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.EventDutchAuctionEnded") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut auction_id__ = None; + let mut state__ = None; + let mut reason__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AuctionId => { + if auction_id__.is_some() { + return Err(serde::de::Error::duplicate_field("auctionId")); + } + auction_id__ = map_.next_value()?; + } + GeneratedField::State => { + if state__.is_some() { + return Err(serde::de::Error::duplicate_field("state")); + } + state__ = map_.next_value()?; + } + GeneratedField::Reason => { + if reason__.is_some() { + return Err(serde::de::Error::duplicate_field("reason")); + } + reason__ = Some(map_.next_value::()? as i32); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(EventDutchAuctionEnded { + auction_id: auction_id__, + state: state__, + reason: reason__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.EventDutchAuctionEnded", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for event_dutch_auction_ended::Reason { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Unspecified => "REASON_UNSPECIFIED", + Self::Expired => "REASON_EXPIRED", + Self::Filled => "REASON_FILLED", + Self::ClosedByOwner => "REASON_CLOSED_BY_OWNER", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for event_dutch_auction_ended::Reason { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "REASON_UNSPECIFIED", + "REASON_EXPIRED", + "REASON_FILLED", + "REASON_CLOSED_BY_OWNER", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = event_dutch_auction_ended::Reason; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "REASON_UNSPECIFIED" => Ok(event_dutch_auction_ended::Reason::Unspecified), + "REASON_EXPIRED" => Ok(event_dutch_auction_ended::Reason::Expired), + "REASON_FILLED" => Ok(event_dutch_auction_ended::Reason::Filled), + "REASON_CLOSED_BY_OWNER" => Ok(event_dutch_auction_ended::Reason::ClosedByOwner), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for EventDutchAuctionScheduled { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.auction_id.is_some() { + len += 1; + } + if self.description.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.EventDutchAuctionScheduled", len)?; + if let Some(v) = self.auction_id.as_ref() { + struct_ser.serialize_field("auctionId", v)?; + } + if let Some(v) = self.description.as_ref() { + struct_ser.serialize_field("description", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for EventDutchAuctionScheduled { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "auction_id", + "auctionId", + "description", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AuctionId, + Description, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), + "description" => Ok(GeneratedField::Description), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventDutchAuctionScheduled; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.EventDutchAuctionScheduled") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut auction_id__ = None; + let mut description__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AuctionId => { + if auction_id__.is_some() { + return Err(serde::de::Error::duplicate_field("auctionId")); + } + auction_id__ = map_.next_value()?; + } + GeneratedField::Description => { + if description__.is_some() { + return Err(serde::de::Error::duplicate_field("description")); + } + description__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(EventDutchAuctionScheduled { + auction_id: auction_id__, + description: description__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.EventDutchAuctionScheduled", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for EventDutchAuctionUpdated { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.auction_id.is_some() { + len += 1; + } + if self.state.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.EventDutchAuctionUpdated", len)?; + if let Some(v) = self.auction_id.as_ref() { + struct_ser.serialize_field("auctionId", v)?; + } + if let Some(v) = self.state.as_ref() { + struct_ser.serialize_field("state", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for EventDutchAuctionUpdated { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "auction_id", + "auctionId", + "state", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AuctionId, + State, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "auctionId" | "auction_id" => Ok(GeneratedField::AuctionId), + "state" => Ok(GeneratedField::State), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventDutchAuctionUpdated; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.EventDutchAuctionUpdated") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut auction_id__ = None; + let mut state__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AuctionId => { + if auction_id__.is_some() { + return Err(serde::de::Error::duplicate_field("auctionId")); + } + auction_id__ = map_.next_value()?; + } + GeneratedField::State => { + if state__.is_some() { + return Err(serde::de::Error::duplicate_field("state")); + } + state__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(EventDutchAuctionUpdated { + auction_id: auction_id__, + state: state__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.EventDutchAuctionUpdated", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for EventValueCircuitBreakerCredit { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.asset_id.is_some() { + len += 1; + } + if self.previous_balance.is_some() { + len += 1; + } + if self.new_balance.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.EventValueCircuitBreakerCredit", len)?; + if let Some(v) = self.asset_id.as_ref() { + struct_ser.serialize_field("assetId", v)?; + } + if let Some(v) = self.previous_balance.as_ref() { + struct_ser.serialize_field("previousBalance", v)?; + } + if let Some(v) = self.new_balance.as_ref() { + struct_ser.serialize_field("newBalance", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for EventValueCircuitBreakerCredit { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "asset_id", + "assetId", + "previous_balance", + "previousBalance", + "new_balance", + "newBalance", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AssetId, + PreviousBalance, + NewBalance, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "assetId" | "asset_id" => Ok(GeneratedField::AssetId), + "previousBalance" | "previous_balance" => Ok(GeneratedField::PreviousBalance), + "newBalance" | "new_balance" => Ok(GeneratedField::NewBalance), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventValueCircuitBreakerCredit; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.EventValueCircuitBreakerCredit") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut asset_id__ = None; + let mut previous_balance__ = None; + let mut new_balance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AssetId => { + if asset_id__.is_some() { + return Err(serde::de::Error::duplicate_field("assetId")); + } + asset_id__ = map_.next_value()?; + } + GeneratedField::PreviousBalance => { + if previous_balance__.is_some() { + return Err(serde::de::Error::duplicate_field("previousBalance")); + } + previous_balance__ = map_.next_value()?; + } + GeneratedField::NewBalance => { + if new_balance__.is_some() { + return Err(serde::de::Error::duplicate_field("newBalance")); + } + new_balance__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(EventValueCircuitBreakerCredit { + asset_id: asset_id__, + previous_balance: previous_balance__, + new_balance: new_balance__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.EventValueCircuitBreakerCredit", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for EventValueCircuitBreakerDebit { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.asset_id.is_some() { + len += 1; + } + if self.previous_balance.is_some() { + len += 1; + } + if self.new_balance.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.EventValueCircuitBreakerDebit", len)?; + if let Some(v) = self.asset_id.as_ref() { + struct_ser.serialize_field("assetId", v)?; + } + if let Some(v) = self.previous_balance.as_ref() { + struct_ser.serialize_field("previousBalance", v)?; + } + if let Some(v) = self.new_balance.as_ref() { + struct_ser.serialize_field("newBalance", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for EventValueCircuitBreakerDebit { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "asset_id", + "assetId", + "previous_balance", + "previousBalance", + "new_balance", + "newBalance", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AssetId, + PreviousBalance, + NewBalance, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "assetId" | "asset_id" => Ok(GeneratedField::AssetId), + "previousBalance" | "previous_balance" => Ok(GeneratedField::PreviousBalance), + "newBalance" | "new_balance" => Ok(GeneratedField::NewBalance), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EventValueCircuitBreakerDebit; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.EventValueCircuitBreakerDebit") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut asset_id__ = None; + let mut previous_balance__ = None; + let mut new_balance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AssetId => { + if asset_id__.is_some() { + return Err(serde::de::Error::duplicate_field("assetId")); + } + asset_id__ = map_.next_value()?; + } + GeneratedField::PreviousBalance => { + if previous_balance__.is_some() { + return Err(serde::de::Error::duplicate_field("previousBalance")); + } + previous_balance__ = map_.next_value()?; + } + GeneratedField::NewBalance => { + if new_balance__.is_some() { + return Err(serde::de::Error::duplicate_field("newBalance")); + } + new_balance__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(EventValueCircuitBreakerDebit { + asset_id: asset_id__, + previous_balance: previous_balance__, + new_balance: new_balance__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.EventValueCircuitBreakerDebit", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for GenesisContent { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.params.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("penumbra.core.component.auction.v1.GenesisContent", len)?; + if let Some(v) = self.params.as_ref() { + struct_ser.serialize_field("params", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for GenesisContent { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "params", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Params, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "params" => Ok(GeneratedField::Params), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GenesisContent; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct penumbra.core.component.auction.v1.GenesisContent") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut params__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Params => { + if params__.is_some() { + return Err(serde::de::Error::duplicate_field("params")); + } + params__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(GenesisContent { + params: params__, + }) + } + } + deserializer.deserialize_struct("penumbra.core.component.auction.v1.GenesisContent", FIELDS, GeneratedVisitor) + } +} From f9c908c4760dd265e8e5092d6d0c16b4ae4a0757 Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Thu, 9 May 2024 14:49:31 -0400 Subject: [PATCH 7/7] spec: use `v1` in spec --- docs/protocol/src/transactions/actions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/protocol/src/transactions/actions.md b/docs/protocol/src/transactions/actions.md index 7958ecc95c..6735819d26 100644 --- a/docs/protocol/src/transactions/actions.md +++ b/docs/protocol/src/transactions/actions.md @@ -47,6 +47,6 @@ contributions together. | `governance.v1.CommunityPoolSpend` | Spends funds from the community pool | | $+$ (spent value) | | `governance.v1.CommunityPoolOutput` | Like `Output`, but transparent | | $-$ (value of new note) | | `governance.v1.CommunityPoolDeposit` | Allows deposits into the community pool | | $-$ (value of deposit) | -| `auction.v1alpha1.ActionDutchAuctionSchedule` | Schedule a Dutch auction | | $-$ (initial reserves) $+$ (opened auction NFT) | -| `auction.v1alpha1.ActionDutchAuctionEnd` | Terminate a Dutch auction | | $-$ (opened auction NFT) $+$ (closed auction NFT) | -| `auction.v1alpha1.ActionDutchAuctionWithdraw` | Withdraw a Dutch auction, with a sequence number $n$ | | $-$ (closed/withdrawn auction nft with sequence $n-1$) $+$ (withdrawn auction NFT with sequence $n$) $+$ (auction reserves) | +| `auction.v1.ActionDutchAuctionSchedule` | Schedule a Dutch auction | | $-$ (initial reserves) $+$ (opened auction NFT) | +| `auction.v1.ActionDutchAuctionEnd` | Terminate a Dutch auction | | $-$ (opened auction NFT) $+$ (closed auction NFT) | +| `auction.v1.ActionDutchAuctionWithdraw` | Withdraw a Dutch auction, with a sequence number $n$ | | $-$ (closed/withdrawn auction nft with sequence $n-1$) $+$ (withdrawn auction NFT with sequence $n$) $+$ (auction reserves) |