Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MetadataFeature #1764

Merged
merged 68 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
b55ec0c
Refactor MetadataFeature
Thoralf-M Dec 12, 2023
197da49
Fix no_std
thibault-martinez Dec 19, 2023
71c227e
Fix IRC27/30
thibault-martinez Dec 19, 2023
ace6f17
Address some TODOs
Thoralf-M Dec 19, 2023
5016318
Some fixes
thibault-martinez Dec 19, 2023
d299f75
Address comments
thibault-martinez Dec 19, 2023
dc55c04
Use is_ascii_graphic
thibault-martinez Dec 21, 2023
9383d09
Handle potential > u8 type
Thoralf-M Jan 8, 2024
772f019
Add explicit is_empty() check
Thoralf-M Jan 8, 2024
5fea869
Update packable
Thoralf-M Jan 9, 2024
cca561d
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 9, 2024
0653e34
Merge branch '2.0' into refactor-MetadataFeature
thibault-martinez Jan 10, 2024
d316432
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 11, 2024
e314ebe
Accept IntoIterator in MetadataFeature::new()
Thoralf-M Jan 11, 2024
9d7e91d
Simply Metadata::new usage in more places
Thoralf-M Jan 11, 2024
2ae1695
Update comment
Thoralf-M Jan 11, 2024
03b52bb
Add TryFrom<Vec<(Vec<u8>, Vec<u8>)>> for MetadataFeature, uncomment test
Thoralf-M Jan 11, 2024
991155a
One more place
Thoralf-M Jan 11, 2024
2f15ad6
Update sdk/src/types/block/rand/output/feature.rs
Thoralf-M Jan 11, 2024
5f36dc4
Update cli/src/wallet_cli/mod.rs
Thoralf-M Jan 11, 2024
64a6956
Update error name
Thoralf-M Jan 11, 2024
c27bb49
Change foundry_metadata, add TODOs
Thoralf-M Jan 11, 2024
95709a7
Update test
Thoralf-M Jan 11, 2024
98547c0
Update example
Thoralf-M Jan 11, 2024
990dac1
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 11, 2024
a7d04a0
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 11, 2024
8ea060d
Update example
Thoralf-M Jan 12, 2024
77cb1b2
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 12, 2024
a9cdb68
Return error for duplicated keys
Thoralf-M Jan 12, 2024
b8d1b63
Remove duplicated validation
Thoralf-M Jan 12, 2024
43dbb05
Update cli commands
Thoralf-M Jan 12, 2024
9452ae8
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 12, 2024
aab5129
Temporarily allow broken doc links
Thoralf-M Jan 12, 2024
cfa871c
Address review comments
Thoralf-M Jan 12, 2024
47838d1
Apply suggestions from code review
thibault-martinez Jan 12, 2024
fa412f8
sorry
thibault-martinez Jan 12, 2024
c93904a
Refactor try from impls
Thoralf-M Jan 12, 2024
f6929b7
Update sdk/src/types/block/output/feature/metadata.rs
thibault-martinez Jan 12, 2024
cd0bd1f
Update sdk/src/types/block/output/feature/metadata.rs
thibault-martinez Jan 12, 2024
1e99641
Add MetadataFeature tests
Thoralf-M Jan 12, 2024
e0d3131
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 15, 2024
b776e78
Allow setting foundry metadata key
Thoralf-M Jan 15, 2024
a4a3dc7
Manual packable impl for MetadataFeature for length verification
Thoralf-M Jan 15, 2024
a8dfbfb
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 15, 2024
141c05a
Add MetadataBTreeMap types
Thoralf-M Jan 15, 2024
c4d3b6b
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 15, 2024
29ad64f
Derive packable again
Thoralf-M Jan 15, 2024
237d738
Add +1 for type byte
Thoralf-M Jan 15, 2024
d2128ec
Update tests
Thoralf-M Jan 15, 2024
3964d1c
fmt
Thoralf-M Jan 15, 2024
4b0dc87
Merge branch '2.0' into refactor-MetadataFeature
thibault-martinez Jan 15, 2024
1c5dc34
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 16, 2024
1a52213
Improve error message
Thoralf-M Jan 16, 2024
9d80a70
Add import
Thoralf-M Jan 16, 2024
fc5931d
Use CounterUnpacker, fix rand_metadata_feature(), fix entry count typ…
Thoralf-M Jan 16, 2024
1f81a0c
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 16, 2024
8be46b7
Align key
Thoralf-M Jan 16, 2024
b736da1
improvements
Jan 16, 2024
b537123
Merge branch 'refactor-MetadataFeature' of https://github.com/Thoralf…
Jan 16, 2024
15d3127
Small fixes, improvements, clippy
Thoralf-M Jan 17, 2024
aad53f3
Merge pull request #7 from DaughterOfMars/metadata-improvements
Thoralf-M Jan 17, 2024
c6571b3
no_std
Thoralf-M Jan 17, 2024
5cddc9b
Fix doc comment
Thoralf-M Jan 17, 2024
ecbec94
Review suggestions
Thoralf-M Jan 17, 2024
5c62984
Consistentency
Thoralf-M Jan 17, 2024
23f24e8
Merge branch '2.0' into refactor-MetadataFeature
Thoralf-M Jan 17, 2024
1e3985a
Remove unwrap
Thoralf-M Jan 17, 2024
90eb299
Merge branch '2.0' into refactor-MetadataFeature
thibault-martinez Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ iota-crypto = { version = "0.23.0", default-features = false, features = [
"bip44",
] }
log = { version = "0.4.20", default-features = false }
packable = { version = "0.10.0", default-features = false }
packable = { version = "0.10.1", default-features = false }
prefix-hex = { version = "0.7.1", default-features = false }
primitive-types = { version = "0.12.2", default-features = false }
serde = { version = "1.0.195", default-features = false }
Expand Down
186 changes: 93 additions & 93 deletions bindings/core/src/method/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ use crypto::keys::bip44::Bip44;
use derivative::Derivative;
#[cfg(feature = "events")]
use iota_sdk::wallet::events::types::{WalletEvent, WalletEventType};
#[cfg(feature = "participation")]
use iota_sdk::{
client::node_manager::node::Node,
types::api::plugins::participation::types::{ParticipationEventId, ParticipationEventType},
wallet::types::participation::ParticipationEventRegistrationOptions,
};
// #[cfg(feature = "participation")]
// use iota_sdk::{
// client::node_manager::node::Node,
// types::api::plugins::participation::types::{ParticipationEventId, ParticipationEventType},
// wallet::types::participation::ParticipationEventRegistrationOptions,
// };
use iota_sdk::{
client::{
api::{input_selection::Burn, PreparedTransactionDataDto, SignedTransactionDataDto},
Expand Down Expand Up @@ -122,12 +122,12 @@ pub enum WalletMethod {
/// Expected response: [`SentTransaction`](crate::Response::SentTransaction)
#[serde(rename_all = "camelCase")]
ClaimOutputs { output_ids_to_claim: Vec<OutputId> },
/// Removes a previously registered participation event from local storage.
/// Expected response: [`Ok`](crate::Response::Ok)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
#[serde(rename_all = "camelCase")]
DeregisterParticipationEvent { event_id: ParticipationEventId },
// /// Removes a previously registered participation event from local storage.
// /// Expected response: [`Ok`](crate::Response::Ok)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// #[serde(rename_all = "camelCase")]
// DeregisterParticipationEvent { event_id: ParticipationEventId },
/// Get the wallet address.
/// Expected response: [`Address`](crate::Response::Address)
GetAddress,
Expand All @@ -147,48 +147,48 @@ pub enum WalletMethod {
/// Expected response: [`OutputData`](crate::Response::OutputData)
#[serde(rename_all = "camelCase")]
GetOutput { output_id: OutputId },
/// Expected response: [`ParticipationEvent`](crate::Response::ParticipationEvent)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
#[serde(rename_all = "camelCase")]
GetParticipationEvent { event_id: ParticipationEventId },
/// Expected response: [`ParticipationEventIds`](crate::Response::ParticipationEventIds)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
#[serde(rename_all = "camelCase")]
GetParticipationEventIds {
node: Node,
event_type: Option<ParticipationEventType>,
},
/// Expected response:
/// [`ParticipationEventStatus`](crate::Response::ParticipationEventStatus)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
#[serde(rename_all = "camelCase")]
GetParticipationEventStatus { event_id: ParticipationEventId },
/// Expected response: [`ParticipationEvents`](crate::Response::ParticipationEvents)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
GetParticipationEvents,
/// Calculates a participation overview for the wallet. If event_ids are provided, only return outputs and tracked
/// participations for them.
/// Expected response: [`ParticipationOverview`](crate::Response::ParticipationOverview)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
#[serde(rename_all = "camelCase")]
GetParticipationOverview {
event_ids: Option<Vec<ParticipationEventId>>,
},
// /// Expected response: [`ParticipationEvent`](crate::Response::ParticipationEvent)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// #[serde(rename_all = "camelCase")]
// GetParticipationEvent { event_id: ParticipationEventId },
// /// Expected response: [`ParticipationEventIds`](crate::Response::ParticipationEventIds)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// #[serde(rename_all = "camelCase")]
// GetParticipationEventIds {
// node: Node,
// event_type: Option<ParticipationEventType>,
// },
// /// Expected response:
// /// [`ParticipationEventStatus`](crate::Response::ParticipationEventStatus)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// #[serde(rename_all = "camelCase")]
// GetParticipationEventStatus { event_id: ParticipationEventId },
// /// Expected response: [`ParticipationEvents`](crate::Response::ParticipationEvents)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// GetParticipationEvents,
// /// Calculates a participation overview for the wallet. If event_ids are provided, only return outputs and
// tracked /// participations for them.
// /// Expected response: [`ParticipationOverview`](crate::Response::ParticipationOverview)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// #[serde(rename_all = "camelCase")]
// GetParticipationOverview {
// event_ids: Option<Vec<ParticipationEventId>>,
// },
/// Get the [`TransactionWithMetadata`](iota_sdk::wallet::types::TransactionWithMetadata) of a transaction stored
/// in the wallet.
/// Expected response: [`Transaction`](crate::Response::Transaction)
#[serde(rename_all = "camelCase")]
GetTransaction { transaction_id: TransactionId },
/// Get the wallet's total voting power (voting or NOT voting).
/// Expected response: [`VotingPower`](crate::Response::VotingPower)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
GetVotingPower,
// /// Get the wallet's total voting power (voting or NOT voting).
// /// Expected response: [`VotingPower`](crate::Response::VotingPower)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// GetVotingPower,
/// Returns the implicit account creation address of the wallet if it is Ed25519 based.
/// Expected response: [`Bech32Address`](crate::Response::Bech32Address)
ImplicitAccountCreationAddress,
Expand Down Expand Up @@ -246,26 +246,26 @@ pub enum WalletMethod {
params: CreateNativeTokenParams,
options: Option<TransactionOptions>,
},
/// Reduces a wallet's "voting power" by a given amount.
/// This will stop voting, but the voting data isn't lost and calling `Vote` without parameters will revote.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
PrepareDecreaseVotingPower {
#[serde(with = "iota_sdk::utils::serde::string")]
amount: u64,
},
/// Designates a given amount of tokens towards a wallet's "voting power" by creating a
/// special output, which is really a basic one with some metadata.
/// This will stop voting in most cases (if there is a remainder output), but the voting data isn't lost and
/// calling `Vote` without parameters will revote. Expected response:
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
PrepareIncreaseVotingPower {
#[serde(with = "iota_sdk::utils::serde::string")]
amount: u64,
},
// /// Reduces a wallet's "voting power" by a given amount.
// /// This will stop voting, but the voting data isn't lost and calling `Vote` without parameters will revote.
// /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// PrepareDecreaseVotingPower {
// #[serde(with = "iota_sdk::utils::serde::string")]
// amount: u64,
// },
// /// Designates a given amount of tokens towards a wallet's "voting power" by creating a
// /// special output, which is really a basic one with some metadata.
// /// This will stop voting in most cases (if there is a remainder output), but the voting data isn't lost and
// /// calling `Vote` without parameters will revote. Expected response:
// /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// PrepareIncreaseVotingPower {
// #[serde(with = "iota_sdk::utils::serde::string")]
// amount: u64,
// },
/// Prepare to melt native tokens. This happens with the foundry output which minted them, by increasing it's
/// `melted_tokens` field.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
Expand Down Expand Up @@ -318,36 +318,36 @@ pub enum WalletMethod {
params: Vec<SendNftParams>,
options: Option<TransactionOptions>,
},
/// Stop participating for an event.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
#[serde(rename_all = "camelCase")]
PrepareStopParticipating { event_id: ParticipationEventId },
// /// Stop participating for an event.
// /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// #[serde(rename_all = "camelCase")]
// PrepareStopParticipating { event_id: ParticipationEventId },
/// Prepare transaction.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
PrepareTransaction {
outputs: Vec<Output>,
options: Option<TransactionOptions>,
},
/// Vote for a participation event.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
#[serde(rename_all = "camelCase")]
PrepareVote {
event_id: Option<ParticipationEventId>,
answers: Option<Vec<u8>>,
},
/// Stores participation information locally and returns the event.
///
/// This will NOT store the node url and auth inside the client options.
/// Expected response: [`ParticipationEvents`](crate::Response::ParticipationEvents)
#[cfg(feature = "participation")]
#[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
RegisterParticipationEvents {
options: ParticipationEventRegistrationOptions,
},
// /// Vote for a participation event.
// /// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// #[serde(rename_all = "camelCase")]
// PrepareVote {
// event_id: Option<ParticipationEventId>,
// answers: Option<Vec<u8>>,
// },
// /// Stores participation information locally and returns the event.
// ///
// /// This will NOT store the node url and auth inside the client options.
// /// Expected response: [`ParticipationEvents`](crate::Response::ParticipationEvents)
// #[cfg(feature = "participation")]
// #[cfg_attr(docsrs, doc(cfg(feature = "participation")))]
// RegisterParticipationEvents {
// options: ParticipationEventRegistrationOptions,
// },
/// Reissues a transaction sent from the wallet for a provided transaction id until it's
/// included (referenced by a milestone). Returns the included block id.
/// Expected response: [`BlockId`](crate::Response::BlockId)
Expand Down
Loading