Skip to content

Commit

Permalink
Merge branch '2.0' into expiration-timelock-slot-index
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez committed Aug 21, 2023
2 parents 6fc372c + 0e38892 commit c17593e
Show file tree
Hide file tree
Showing 261 changed files with 4,661 additions and 3,249 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ jobs:
sudo apt-get update
sudo apt-get install libudev-dev libusb-1.0-0-dev
# A first run without features to detect feature related issues.
- name: Run Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- --deny warnings
name: Clippy Results for the Rust Core

# The second run will continue from where the first left off.
- name: Run Clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- --deny warnings
name: Clippy Results for the Rust Core
# # A first run without features to detect feature related issues.
# - name: Run Clippy
# uses: actions-rs/clippy-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# args: --all-targets -- --deny warnings
# name: Clippy Results for the Rust Core

# # The second run will continue from where the first left off.
# - name: Run Clippy
# uses: actions-rs/clippy-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# args: --all-features --all-targets -- --deny warnings
# name: Clippy Results for the Rust Core

check-unused-deps:
name: Check Unused Dependencies
Expand Down
50 changes: 28 additions & 22 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 All @@ -252,11 +258,11 @@ pub enum AccountMethod {
RegisterParticipationEvents {
options: ParticipationEventRegistrationOptions,
},
/// Retries (promotes or reattaches) a transaction sent from the account for a provided transaction id until it's
/// Reissues a transaction sent from the account for a provided transaction id until it's
/// included (referenced by a milestone). Returns the included block id.
/// Expected response: [`BlockId`](crate::Response::BlockId)
#[serde(rename_all = "camelCase")]
RetryTransactionUntilIncluded {
ReissueTransactionUntilIncluded {
/// Transaction id
transaction_id: TransactionId,
/// Interval
Expand All @@ -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 All @@ -309,7 +315,7 @@ pub enum AccountMethod {
SubmitAndStoreTransaction {
signed_transaction_data: SignedTransactionDataDto,
},
/// Sync the account by fetching new information from the nodes. Will also retry pending transactions
/// Sync the account by fetching new information from the nodes. Will also reissue pending transactions
/// if necessary. A custom default can be set using SetDefaultSyncOptions.
/// Expected response: [`Balance`](crate::Response::Balance)
Sync {
Expand Down
90 changes: 26 additions & 64 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 Expand Up @@ -144,8 +146,8 @@ pub enum ClientMethod {
GetInfo,
/// Get peers
GetPeers,
/// Get tips
GetTips,
/// Get issuance
GetIssuance,
/// Post block (JSON)
PostBlock {
/// Block
Expand Down Expand Up @@ -268,58 +270,13 @@ pub enum ClientMethod {
/// BlockIDs
block_ids: Vec<BlockId>,
},
/// Retries (promotes or reattaches) a block for provided block id. Block should only be
/// retried only if they are valid and haven't been confirmed for a while.
#[serde(rename_all = "camelCase")]
Retry {
/// Block ID
block_id: BlockId,
},
/// Retries (promotes or reattaches) a block for provided block id until it's included (referenced by a
/// milestone). Default interval is 5 seconds and max attempts is 40. Returns the included block at first
/// position and additional reattached blocks
#[serde(rename_all = "camelCase")]
RetryUntilIncluded {
/// Block ID
block_id: BlockId,
/// Interval
interval: Option<u64>,
/// Maximum attempts
max_attempts: Option<u64>,
},
/// Function to find inputs from addresses for a provided amount (useful for offline signing)
FindInputs {
/// Addresses
addresses: Vec<Bech32Address>,
/// Amount
amount: u64,
},
/// Reattaches blocks for provided block id. Blocks can be reattached only if they are valid and haven't been
/// confirmed for a while.
#[serde(rename_all = "camelCase")]
Reattach {
/// Block ID
block_id: BlockId,
},
/// Reattach a block without checking if it should be reattached
#[serde(rename_all = "camelCase")]
ReattachUnchecked {
/// Block ID
block_id: BlockId,
},
/// Promotes a block. The method should validate if a promotion is necessary through get_block. If not, the
/// method should error out and should not allow unnecessary promotions.
#[serde(rename_all = "camelCase")]
Promote {
/// Block ID
block_id: BlockId,
},
/// Promote a block without checking if it should be promoted
#[serde(rename_all = "camelCase")]
PromoteUnchecked {
/// Block ID
block_id: BlockId,
},

//////////////////////////////////////////////////////////////////////
// Utils
Expand Down Expand Up @@ -367,4 +324,9 @@ pub enum ClientMethod {
/// The address for request funds
address: Bech32Address,
},
/// Returns a block ID from a block
BlockId {
/// Block
block: BlockDto,
},
}
Loading

0 comments on commit c17593e

Please sign in to comment.