Skip to content

Commit

Permalink
Merge branch '2.0' into feat/split-block
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Coats committed Jul 31, 2023
2 parents b6143e3 + 44f2ab7 commit 6f09c41
Show file tree
Hide file tree
Showing 70 changed files with 997 additions and 1,671 deletions.
44 changes: 25 additions & 19 deletions bindings/core/src/method/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use iota_sdk::{
};
use iota_sdk::{
client::{
api::{input_selection::BurnDto, PreparedTransactionDataDto, SignedTransactionDataDto},
api::{input_selection::Burn, PreparedTransactionDataDto, SignedTransactionDataDto},
secret::GenerateAddressOptions,
},
types::block::{
Expand All @@ -20,7 +20,7 @@ use iota_sdk::{
wallet::{
account::{
ConsolidationParams, CreateAccountParams, CreateNativeTokenParams, FilterOptions, MintNftParams,
OutputParams, OutputsToClaim, SyncOptions, TransactionOptionsDto,
OutputParams, OutputsToClaim, SyncOptions, TransactionOptions,
},
SendNativeTokensParams, SendNftParams, SendParams,
},
Expand Down Expand Up @@ -137,8 +137,8 @@ pub enum AccountMethod {
///
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
PrepareBurn {
burn: BurnDto,
options: Option<TransactionOptionsDto>,
burn: Burn,
options: Option<TransactionOptions>,
},
/// Consolidate outputs.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
Expand All @@ -147,29 +147,35 @@ pub enum AccountMethod {
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
PrepareCreateAccountOutput {
params: Option<CreateAccountParams>,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Prepare to create a native token.
/// Expected response:
/// [`PreparedCreateNativeTokenTransaction`](crate::Response::PreparedCreateNativeTokenTransaction)
PrepareCreateNativeToken {
params: CreateNativeTokenParams,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Reduces an account'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 { amount: String },
PrepareDecreaseVotingPower {
#[serde(with = "iota_sdk::utils::serde::string")]
amount: u64,
},
/// Designates a given amount of tokens towards an account'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 { amount: String },
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 All @@ -179,7 +185,7 @@ pub enum AccountMethod {
token_id: TokenId,
/// To be melted amount
melt_amount: U256,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Prepare to mint additional native tokens.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
Expand All @@ -189,38 +195,38 @@ pub enum AccountMethod {
token_id: TokenId,
/// To be minted amount
mint_amount: U256,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Prepare to mint NFTs.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
PrepareMintNfts {
params: Vec<MintNftParams>,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Prepare an output.
/// Expected response: [`Output`](crate::Response::Output)
#[serde(rename_all = "camelCase")]
PrepareOutput {
params: Box<OutputParams>,
transaction_options: Option<TransactionOptionsDto>,
transaction_options: Option<TransactionOptions>,
},
/// Prepare to send base coins.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
PrepareSend {
params: Vec<SendParams>,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Prepare to send native tokens.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
PrepareSendNativeTokens {
params: Vec<SendNativeTokensParams>,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Prepare to Send nft.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
PrepareSendNft {
params: Vec<SendNftParams>,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Stop participating for an event.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
Expand All @@ -232,7 +238,7 @@ pub enum AccountMethod {
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
PrepareTransaction {
outputs: Vec<OutputDto>,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Vote for a participation event.
/// Expected response: [`PreparedTransaction`](crate::Response::PreparedTransaction)
Expand Down Expand Up @@ -270,19 +276,19 @@ pub enum AccountMethod {
#[serde(with = "iota_sdk::utils::serde::string")]
amount: u64,
address: Bech32Address,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Send base coins to multiple addresses, or with additional parameters.
/// Expected response: [`SentTransaction`](crate::Response::SentTransaction)
SendWithParams {
params: Vec<SendParams>,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Send outputs in a transaction.
/// Expected response: [`SentTransaction`](crate::Response::SentTransaction)
SendOutputs {
outputs: Vec<OutputDto>,
options: Option<TransactionOptionsDto>,
options: Option<TransactionOptions>,
},
/// Set the alias of the account.
/// Expected response: [`Ok`](crate::Response::Ok)
Expand Down
36 changes: 19 additions & 17 deletions bindings/core/src/method/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ use iota_sdk::{
types::block::{
address::{Bech32Address, Hrp},
output::{
dto::{OutputDto, TokenSchemeDto},
feature::dto::FeatureDto,
unlock_condition::dto::UnlockConditionDto,
AccountId, FoundryId, NativeToken, NftId, OutputId,
dto::OutputDto, feature::Feature, unlock_condition::dto::UnlockConditionDto, AccountId, FoundryId,
NativeToken, NftId, OutputId, TokenScheme,
},
payload::{dto::PayloadDto, transaction::TransactionId},
BlockDto, BlockId,
},
utils::serde::string,
utils::serde::{option_string, string},
};
use serde::{Deserialize, Serialize};

Expand All @@ -33,7 +31,8 @@ pub enum ClientMethod {
#[serde(rename_all = "camelCase")]
BuildAccountOutput {
// If not provided, minimum storage deposit will be used
amount: Option<String>,
#[serde(default, with = "option_string")]
amount: Option<u64>,
// TODO: Determine if `default` is wanted here
#[serde(default, with = "string")]
mana: u64,
Expand All @@ -43,52 +42,55 @@ pub enum ClientMethod {
state_metadata: Option<String>,
foundry_counter: Option<u32>,
unlock_conditions: Vec<UnlockConditionDto>,
features: Option<Vec<FeatureDto>>,
immutable_features: Option<Vec<FeatureDto>>,
features: Option<Vec<Feature>>,
immutable_features: Option<Vec<Feature>>,
},
/// Build a BasicOutput.
/// Expected response: [`Output`](crate::Response::Output)
#[allow(missing_docs)]
#[serde(rename_all = "camelCase")]
BuildBasicOutput {
// If not provided, minimum storage deposit will be used
amount: Option<String>,
#[serde(default, with = "option_string")]
amount: Option<u64>,
// TODO: Determine if `default` is wanted here
#[serde(default, with = "string")]
mana: u64,
native_tokens: Option<Vec<NativeToken>>,
unlock_conditions: Vec<UnlockConditionDto>,
features: Option<Vec<FeatureDto>>,
features: Option<Vec<Feature>>,
},
/// Build a FoundryOutput.
/// Expected response: [`Output`](crate::Response::Output)
#[allow(missing_docs)]
#[serde(rename_all = "camelCase")]
BuildFoundryOutput {
// If not provided, minimum storage deposit will be used
amount: Option<String>,
#[serde(default, with = "option_string")]
amount: Option<u64>,
native_tokens: Option<Vec<NativeToken>>,
serial_number: u32,
token_scheme: TokenSchemeDto,
token_scheme: TokenScheme,
unlock_conditions: Vec<UnlockConditionDto>,
features: Option<Vec<FeatureDto>>,
immutable_features: Option<Vec<FeatureDto>>,
features: Option<Vec<Feature>>,
immutable_features: Option<Vec<Feature>>,
},
/// Build an NftOutput.
/// Expected response: [`Output`](crate::Response::Output)
#[allow(missing_docs)]
#[serde(rename_all = "camelCase")]
BuildNftOutput {
// If not provided, minimum storage deposit will be used
amount: Option<String>,
#[serde(default, with = "option_string")]
amount: Option<u64>,
// TODO: Determine if `default` is wanted here
#[serde(default, with = "string")]
mana: u64,
native_tokens: Option<Vec<NativeToken>>,
nft_id: NftId,
unlock_conditions: Vec<UnlockConditionDto>,
features: Option<Vec<FeatureDto>>,
immutable_features: Option<Vec<FeatureDto>>,
features: Option<Vec<Feature>>,
immutable_features: Option<Vec<Feature>>,
},
/// Removes all listeners for the provided topics.
/// Expected response: [`Ok`](crate::Response::Ok)
Expand Down
4 changes: 2 additions & 2 deletions bindings/core/src/method/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use iota_sdk::types::block::{
dto::{TransactionEssenceDto, TransactionPayloadDto},
TransactionId,
},
signature::dto::Ed25519SignatureDto,
signature::Ed25519Signature,
BlockDto,
};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -135,7 +135,7 @@ pub enum UtilsMethod {
},
/// Verify an ed25519 signature against a message.
VerifyEd25519Signature {
signature: Ed25519SignatureDto,
signature: Ed25519Signature,
message: String,
},
/// Verify a Secp256k1Ecdsa signature against a message.
Expand Down
Loading

0 comments on commit 6f09c41

Please sign in to comment.