Skip to content

Commit

Permalink
Merge branch '2.0' into chore/tests/block-id
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 authored Dec 5, 2023
2 parents 918e51d + 6436bd0 commit 91235a3
Show file tree
Hide file tree
Showing 182 changed files with 10,741 additions and 7,668 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bindings-wasm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install wasm-bindgen-cli
uses: jetli/[email protected]
with:
version: "0.2.87"
version: "0.2.89"

- name: Set up Node.js
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bindings-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Install wasm-bindgen-cli
uses: jetli/[email protected]
with:
version: "0.2.88"
version: "0.2.89"

- name: Set Up Node.js ${{ matrix.node }} and Yarn Cache
uses: actions/setup-node@v3
Expand Down
42 changes: 31 additions & 11 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions bindings/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ log = { version = "0.4.20", default-features = false }
packable = { version = "0.10.0", 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.190", default-features = false }
serde_json = { version = "1.0.107", default-features = false }
serde = { version = "1.0.193", default-features = false }
serde_json = { version = "1.0.108", default-features = false }
thiserror = { version = "1.0.50", default-features = false }
tokio = { version = "1.33.0", default-features = false }
tokio = { version = "1.34.0", default-features = false }
url = { version = "2.4.1", default-features = false, features = ["serde"] }
zeroize = { version = "1.6.0", default-features = false }
zeroize = { version = "1.7.0", default-features = false }

[dev-dependencies]
pretty_assertions = { version = "1.4.0", default-features = false, features = [
Expand Down
12 changes: 6 additions & 6 deletions bindings/core/src/method/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use iota_sdk::{
types::block::{
address::{Bech32Address, Hrp},
output::{
feature::Feature, unlock_condition::dto::UnlockConditionDto, AccountId, AnchorId, DelegationId, FoundryId,
NftId, Output, OutputId, TokenScheme,
feature::Feature, unlock_condition::UnlockCondition, AccountId, AnchorId, DelegationId, FoundryId, NftId,
Output, OutputId, TokenScheme,
},
payload::{dto::PayloadDto, signed_transaction::TransactionId},
BlockDto, BlockId,
Expand Down Expand Up @@ -45,7 +45,7 @@ pub enum ClientMethod {
mana: u64,
account_id: AccountId,
foundry_counter: Option<u32>,
unlock_conditions: Vec<UnlockConditionDto>,
unlock_conditions: Vec<UnlockCondition>,
features: Option<Vec<Feature>>,
immutable_features: Option<Vec<Feature>>,
},
Expand All @@ -60,7 +60,7 @@ pub enum ClientMethod {
// TODO: Determine if `default` is wanted here
#[serde(default, with = "string")]
mana: u64,
unlock_conditions: Vec<UnlockConditionDto>,
unlock_conditions: Vec<UnlockCondition>,
features: Option<Vec<Feature>>,
},
/// Build a FoundryOutput.
Expand All @@ -73,7 +73,7 @@ pub enum ClientMethod {
amount: Option<u64>,
serial_number: u32,
token_scheme: TokenScheme,
unlock_conditions: Vec<UnlockConditionDto>,
unlock_conditions: Vec<UnlockCondition>,
features: Option<Vec<Feature>>,
immutable_features: Option<Vec<Feature>>,
},
Expand All @@ -89,7 +89,7 @@ pub enum ClientMethod {
#[serde(default, with = "string")]
mana: u64,
nft_id: NftId,
unlock_conditions: Vec<UnlockConditionDto>,
unlock_conditions: Vec<UnlockCondition>,
features: Option<Vec<Feature>>,
immutable_features: Option<Vec<Feature>>,
},
Expand Down
80 changes: 19 additions & 61 deletions bindings/core/src/method/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use derivative::Derivative;
use iota_sdk::{
client::secret::types::InputSigningDataDto,
client::secret::types::InputSigningData,
types::block::{
address::{Bech32Address, Hrp},
output::{AccountId, NftId, Output, OutputId, StorageScoreParameters},
Expand All @@ -14,6 +14,7 @@ use iota_sdk::{
protocol::ProtocolParameters,
signature::Ed25519Signature,
slot::SlotCommitment,
unlock::Unlock,
BlockDto,
},
};
Expand All @@ -28,95 +29,51 @@ use crate::OmittedDebug;
#[non_exhaustive]
pub enum UtilsMethod {
/// Transforms bech32 to hex
Bech32ToHex {
/// Bech32 encoded address
bech32: Bech32Address,
},
Bech32ToHex { bech32: Bech32Address },
/// Transforms a hex encoded address to a bech32 encoded address
#[serde(rename_all = "camelCase")]
HexToBech32 {
/// Hex encoded bech32 address
hex: String,
/// Human readable part
bech32_hrp: Hrp,
},
HexToBech32 { hex: String, bech32_hrp: Hrp },
/// Transforms an account id to a bech32 encoded address
#[serde(rename_all = "camelCase")]
AccountIdToBech32 {
/// Account ID
account_id: AccountId,
/// Human readable part
bech32_hrp: Hrp,
},
AccountIdToBech32 { account_id: AccountId, bech32_hrp: Hrp },
/// Transforms an nft id to a bech32 encoded address
#[serde(rename_all = "camelCase")]
NftIdToBech32 {
/// Nft ID
nft_id: NftId,
/// Human readable part
bech32_hrp: Hrp,
},
NftIdToBech32 { nft_id: NftId, bech32_hrp: Hrp },
/// Transforms a hex encoded public key to a bech32 encoded address
#[serde(rename_all = "camelCase")]
HexPublicKeyToBech32Address {
/// Hex encoded public key
hex: String,
/// Human readable part
bech32_hrp: Hrp,
},
HexPublicKeyToBech32Address { hex: String, bech32_hrp: Hrp },
/// Returns a valid Address parsed from a String.
ParseBech32Address {
/// Address
address: Bech32Address,
},
ParseBech32Address { address: Bech32Address },
/// Checks if a String is a valid bech32 encoded address.
IsAddressValid {
/// Address
address: String,
},
IsAddressValid { address: String },
/// Generates a new mnemonic.
GenerateMnemonic,
/// Returns a hex encoded seed for a mnemonic.
MnemonicToHexSeed {
/// Mnemonic
#[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))]
mnemonic: String,
},
/// Returns a block ID from a block and slot protocol parameters
#[serde(rename_all = "camelCase")]
BlockId {
/// Block
block: BlockDto,
/// Network Protocol Parameters
protocol_parameters: ProtocolParameters,
},
/// Returns the transaction ID (Blake2b256 hash of the provided transaction payload)
TransactionId {
/// Transaction Payload
payload: SignedTransactionPayloadDto,
},
TransactionId { payload: SignedTransactionPayloadDto },
/// Computes the account ID
#[serde(rename_all = "camelCase")]
ComputeAccountId {
/// Output ID
output_id: OutputId,
},
ComputeAccountId { output_id: OutputId },
/// Computes the Foundry ID
#[serde(rename_all = "camelCase")]
ComputeFoundryId {
/// Alias id
account_id: AccountId,
/// Serial number
serial_number: u32,
/// Token scheme kind
token_scheme_type: u8,
},
/// Computes the NFT ID
#[serde(rename_all = "camelCase")]
ComputeNftId {
/// Output ID
output_id: OutputId,
},
ComputeNftId { output_id: OutputId },
/// Computes the output ID from transaction id and output index
ComputeOutputId { id: TransactionId, index: u16 },
/// Computes a tokenId from the aliasId, serial number and token scheme type.
Expand All @@ -126,11 +83,11 @@ pub enum UtilsMethod {
serial_number: u32,
token_scheme_type: u8,
},
/// Computes the hash of the given protocol parameters.
#[serde(rename_all = "camelCase")]
ProtocolParametersHash { protocol_parameters: ProtocolParameters },
/// Computes the signing hash of a transaction.
TransactionSigningHash {
/// The transaction.
transaction: TransactionDto,
},
TransactionSigningHash { transaction: TransactionDto },
/// Computes the minimum required amount of an output.
#[serde(rename_all = "camelCase")]
ComputeMinimumOutputAmount {
Expand Down Expand Up @@ -166,7 +123,8 @@ pub enum UtilsMethod {
OutputHexBytes { output: Output },
/// Verifies the semantic of a transaction.
VerifyTransactionSemantic {
inputs: Vec<InputSigningDataDto>,
transaction: SignedTransactionPayloadDto,
transaction: TransactionDto,
inputs: Vec<InputSigningData>,
unlocks: Option<Vec<Unlock>>,
},
}
Loading

0 comments on commit 91235a3

Please sign in to comment.