Skip to content

Commit

Permalink
Merge branch '2.0' into refactor-MetadataFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 authored Dec 20, 2023
2 parents 85841b5 + 6628d8a commit 23c3670
Show file tree
Hide file tree
Showing 8 changed files with 4,540 additions and 4,591 deletions.
2 changes: 1 addition & 1 deletion bindings/core/src/method/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub enum UtilsMethod {
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.
/// Computes a tokenId from the accountId, serial number and token scheme type.
#[serde(rename_all = "camelCase")]
ComputeTokenId {
account_id: AccountId,
Expand Down
9,085 changes: 4,518 additions & 4,567 deletions bindings/nodejs/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/src/types/block/context_input/block_issuance_credit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct BlockIssuanceCreditContextInput(AccountId);

impl BlockIssuanceCreditContextInput {
/// The context input kind of a [`BlockIssuanceCreditContextInput`].
pub const KIND: u8 = 2;
pub const KIND: u8 = 1;

/// Creates a new [`BlockIssuanceCreditContextInput`].
pub fn new(account_id: AccountId) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/types/block/context_input/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct CommitmentContextInput(SlotCommitmentId);

impl CommitmentContextInput {
/// The context input kind of a [`CommitmentContextInput`].
pub const KIND: u8 = 1;
pub const KIND: u8 = 0;

/// Creates a new [`CommitmentContextInput`].
pub fn new(commitment_id: SlotCommitmentId) -> Self {
Expand Down
18 changes: 8 additions & 10 deletions sdk/src/types/block/context_input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ mod tests {
fn commitment() {
let commitment: ContextInput = serde_json::from_value(serde_json::json!(
{
"type": 1,
"type": 0,
"commitmentId": "0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda4f9567d8"
}
))
Expand All @@ -99,7 +99,7 @@ mod tests {
// Test wrong type returns error.
let commitment_deserialization_result: Result<ContextInput, _> = serde_json::from_value(serde_json::json!(
{
"type": 2,
"type": 1,
"commitmentId": "0xedf5f572c58ddf4b4f9567d82bf96689cc68b730df796d822b4b9fb643f5efda4f9567d8"
}
));
Expand All @@ -110,7 +110,7 @@ mod tests {
fn block_issuance_credit() {
let bic: ContextInput = serde_json::from_value(serde_json::json!(
{
"type": 2,
"type": 1,
"accountId": "0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649"
}
))
Expand All @@ -124,7 +124,7 @@ mod tests {
// Test wrong type returns error.
let bic_deserialization_result: Result<ContextInput, _> = serde_json::from_value(serde_json::json!(
{
"type": 3,
"type": 2,
"accountId": "0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649"
}
));
Expand All @@ -135,7 +135,7 @@ mod tests {
fn reward() {
let reward: ContextInput = serde_json::from_value(serde_json::json!(
{
"type": 3,
"type": 2,
"index": 10
}
))
Expand All @@ -144,14 +144,12 @@ mod tests {
assert_eq!(reward.as_reward().index(), 10);

// Test wrong type returns error.
let reward_serialization_result: Result<ContextInput, _> = serde_json::from_str(
r#"
let reward_serialization_result: Result<ContextInput, _> = serde_json::from_value(serde_json::json!(
{
"type": 0,
"index": 10
"index": 10
}
"#,
);
));
assert!(reward_serialization_result.is_err())
}
}
2 changes: 1 addition & 1 deletion sdk/src/types/block/context_input/reward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct RewardContextInput(#[packable(unpack_error_with = Error::InvalidRewar

impl RewardContextInput {
/// The context input kind of a [`RewardContextInput`].
pub const KIND: u8 = 3;
pub const KIND: u8 = 2;

/// Creates a new [`RewardContextInput`].
pub fn new(index: u16) -> Result<Self, Error> {
Expand Down
16 changes: 8 additions & 8 deletions sdk/tests/client/node_api/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// AddressUnlockCondition, GovernorAddressUnlockCondition, ImmutableAliasAddressUnlockCondition,
// StateControllerAddressUnlockCondition, UnlockCondition,
// },
// AliasId, AccountOutputBuilder, FoundryId, FoundryOutputBuilder, NftId, NftOutputBuilder,
// AccountId, AccountOutputBuilder, FoundryId, FoundryOutputBuilder, NftId, NftOutputBuilder,
// SimpleTokenScheme, TokenScheme,
// },
// },
Expand All @@ -33,7 +33,7 @@

// let alias_output =
// AccountOutputBuilder::new_with_minimum_storage_deposit(*protocol_parameters.rent_structure(),
// AliasId::null()) .with_state_metadata([1, 2, 3])
// AccountId::null()) .with_state_metadata([1, 2, 3])
// .add_unlock_condition(StateControllerAddressUnlockCondition::new(address))
// .add_unlock_condition(GovernorAddressUnlockCondition::new(address))
// .finish_output(protocol_parameters.token_supply())?;
Expand All @@ -46,7 +46,7 @@
// .await?;

// let output_id_0 = get_alias_output_id(block.payload().unwrap())?;
// let output_id_1 = client.alias_output_id(AliasId::from(&output_id_0)).await?;
// let output_id_1 = client.alias_output_id(AccountId::from(&output_id_0)).await?;

// assert_eq!(output_id_0, output_id_1);

Expand Down Expand Up @@ -95,7 +95,7 @@

// let alias_output_0 =
// AccountOutputBuilder::new_with_minimum_storage_deposit(*protocol_parameters.rent_structure(),
// AliasId::null()) .with_state_metadata([1, 2, 3])
// AccountId::null()) .with_state_metadata([1, 2, 3])
// .add_unlock_condition(StateControllerAddressUnlockCondition::new(address))
// .add_unlock_condition(GovernorAddressUnlockCondition::new(address))
// .finish_output(protocol_parameters.token_supply())?;
Expand All @@ -107,15 +107,15 @@
// .finish()
// .await?;

// let alias_id = AliasId::from(&get_alias_output_id(block.payload().unwrap())?);
// let account_id = AccountId::from(&get_alias_output_id(block.payload().unwrap())?);

// let alias_output_1 = AccountOutputBuilder::from(alias_output_0.as_alias())
// .with_alias_id(alias_id)
// .with_account_id(account_id)
// .with_foundry_counter(alias_output_0.as_alias().foundry_counter() + 1)
// .finish_output(protocol_parameters.token_supply())?;

// let foundry_id = FoundryId::build(
// &AliasAddress::new(alias_id),
// &AliasAddress::new(account_id),
// alias_output_0.as_alias().foundry_counter() + 1,
// SimpleTokenScheme::KIND,
// );
Expand All @@ -125,7 +125,7 @@
// alias_output_0.as_alias().foundry_counter() + 1,
// TokenScheme::Simple(SimpleTokenScheme::new(100, 0, 500)?),
// )
// .add_unlock_condition(ImmutableAliasAddressUnlockCondition::new(AliasAddress::from(alias_id)))
// .add_unlock_condition(ImmutableAliasAddressUnlockCondition::new(AliasAddress::from(account_id)))
// .finish_output(protocol_parameters.token_supply())?;

// let block = client
Expand Down
4 changes: 2 additions & 2 deletions sdk/tests/types/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use iota_sdk::types::block::{
use pretty_assertions::assert_eq;

const ED25519_ADDRESS: &str = "0xebe40a263480190dcd7939447ee01aefa73d6f3cc33c90ef7bf905abf8728655";
const ALIAS_ID: &str = "0xe9ba80ad1561e437b663a1f1efbfabd544b0d7da7bb33e0a62e99b20ee450bee";
const ACCOUNT_ID: &str = "0xe9ba80ad1561e437b663a1f1efbfabd544b0d7da7bb33e0a62e99b20ee450bee";
const NFT_ID: &str = "0xa9ede98a7f0223fa7a49fbc586f7a88bb4f0d152f282b19bcebd05c9e8a02370";
const ED25519_ADDRESS_INVALID: &str = "0x52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c64x";

Expand All @@ -37,7 +37,7 @@ fn debug() {
"Ed25519Address(0xebe40a263480190dcd7939447ee01aefa73d6f3cc33c90ef7bf905abf8728655)"
);

let address = Address::from(AccountAddress::from_str(ALIAS_ID).unwrap());
let address = Address::from(AccountAddress::from_str(ACCOUNT_ID).unwrap());

assert_eq!(
format!("{address:?}"),
Expand Down

0 comments on commit 23c3670

Please sign in to comment.