Skip to content

Commit

Permalink
Merge branch '2.0' into feat/restricted-address-sem-val
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Coats committed Oct 18, 2023
2 parents 9377537 + f38f561 commit ffbef89
Show file tree
Hide file tree
Showing 24 changed files with 612 additions and 252 deletions.
10 changes: 5 additions & 5 deletions bindings/nodejs/lib/types/block/output/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export type OutputId = string;
*/
enum OutputType {
/** A Basic output. */
Basic = 3,
Basic = 0,
/** An Account output. */
Account = 4,
Account = 1,
/** A Foundry output. */
Foundry = 5,
Foundry = 2,
/** An NFT output. */
Nft = 6,
Nft = 3,
/** A Delegation output. */
Delegation = 7,
Delegation = 4,
}

/**
Expand Down
4 changes: 2 additions & 2 deletions bindings/nodejs/lib/types/block/payload/payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/
enum PayloadType {
/** A tagged data payload. */
TaggedData = 5,
TaggedData = 0,
/** A transaction payload. */
Transaction = 6,
Transaction = 1,
}

/**
Expand Down
20 changes: 10 additions & 10 deletions bindings/python/iota_sdk/types/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ class OutputType(IntEnum):
"""Output types.
Attributes:
Basic (3): A basic output.
Account (4): An account output.
Foundry (5): A foundry output.
Nft (6): An NFT output.
Delegation (7): A delegation output.
Basic (0): A basic output.
Account (1): An account output.
Foundry (2): A foundry output.
Nft (3): An NFT output.
Delegation (4): A delegation output.
"""
Basic = 3
Account = 4
Foundry = 5
Nft = 6
Delegation = 7
Basic = 0
Account = 1
Foundry = 2
Nft = 3
Delegation = 4


@json
Expand Down
8 changes: 4 additions & 4 deletions bindings/python/iota_sdk/types/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ class PayloadType(IntEnum):
"""Block payload types.
Attributes:
TaggedData (5): A tagged data payload.
Transaction (6): A transaction payload.
TaggedData (0): A tagged data payload.
Transaction (1): A transaction payload.
"""
TaggedData = 5
Transaction = 6
TaggedData = 0
Transaction = 1


@json
Expand Down
10 changes: 5 additions & 5 deletions bindings/python/tests/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_basic_block_with_tagged_data_payload():
"shallowLikeParents": [],
"maxBurnedMana": "180500",
"payload": {
"type": 5,
"type": 0,
"tag": "0x484f524e4554205370616d6d6572",
"data": "0x57652061726520616c6c206d616465206f662073746172647573742e0a436f756e743a20353436333730330a54696d657374616d703a20323032332d30372d31395430373a32323a32385a0a54697073656c656374696f6e3a20343732c2b573"}}
block = BasicBlock.from_dict(block_dict)
Expand Down Expand Up @@ -52,7 +52,7 @@ def test_block_wrapper_with_tagged_data_payload():
],
"maxBurnedMana": "180500",
"payload": {
"type": 5,
"type": 0,
"tag": "0x68656c6c6f20776f726c64",
"data": "0x01020304"
}
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_basic_block_with_tx_payload():
"weakParents": [],
"shallowLikeParents": [],
"maxBurnedMana": "180500",
"payload": {"type": 6,
"payload": {"type": 1,
"essence": {"type": 1,
"networkId": "1856588631910923207",
"inputs": [{"type": 0,
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_basic_block_with_tx_payload_all_output_types():
"type": 0,
"strongParents": [
"0x053296e7434e8a4d602f8db30a5aaf16c01140212fe79d8132137cda1c38a60a", "0x559ec1d9a31c55bd27588ada2ade70fb5b13764ddd600e29c3b018761ba30e15", "0xe78e8cdbbeda89e3408eed51b77e0db5ba035f5f3bf79a8365435bba40697693", "0xee9d6e45dbc080694e6c827fecbc31ad9f654cf57404bc98f4cbca033f8e3139"], "weakParents": [], "shallowLikeParents": [], "payload": {
"type": 6, "essence": {
"type": 1, "essence": {
"type": 1, "networkId": "1856588631910923207", "inputs": [
{
"type": 0, "transactionId": "0xa49f5a764c3fe22f702b5b238a75a648faae1863f61c14fac51ba58d26acb823", "transactionOutputIndex": 9}, {
Expand Down Expand Up @@ -263,7 +263,7 @@ def test_basic_block_with_tx_payload_with_tagged_data_payload():
"weakParents": [],
"shallowLikeParents": [],
"maxBurnedMana": "180500",
"payload": {"type": 6,
"payload": {"type": 1,
"essence": {"type": 1,
"networkId": "1856588631910923207",
"inputs": [{"type": 0,
Expand Down
14 changes: 7 additions & 7 deletions bindings/python/tests/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_feature():

def test_output():
basic_output_dict = {
"type": 3,
"type": 0,
"mana": "999500700",
"amount": "999500700",
"unlockConditions": [
Expand All @@ -43,7 +43,7 @@ def test_output():
assert basic_output.to_dict() == basic_output_dict

basic_output_dict = {
"type": 3,
"type": 0,
"mana": "57600",
"amount": "57600",
"nativeTokens": [
Expand Down Expand Up @@ -82,7 +82,7 @@ def test_output():
assert basic_output.to_dict() == basic_output_dict

basic_output_dict = {
"type": 3,
"type": 0,
"mana": "50100",
"amount": "50100",
"nativeTokens": [
Expand All @@ -109,7 +109,7 @@ def test_output():
assert basic_output.to_dict() == basic_output_dict

account_output_dict = {
"type": 4,
"type": 1,
"mana": "168200",
"amount": "168200",
"accountId": "0x8d073d15074834785046d9cacec7ac4d672dcb6dad342624a936f3c4334520f1",
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_output():
assert account_output.to_dict() == account_output_dict

account_output_dict = {
"type": 4,
"type": 1,
"mana": "55100",
"amount": "55100",
"accountId": "0x5380cce0ac342b8fa3e9c4f46d5b473ee9e824f0017fe43682dca77e6b875354",
Expand Down Expand Up @@ -187,7 +187,7 @@ def test_output():
assert account_output.to_dict() == account_output_dict

foundry_output_dict = {
"type": 5,
"type": 2,
"amount": "54700",
"serialNumber": 1,
"tokenScheme": {
Expand Down Expand Up @@ -216,7 +216,7 @@ def test_output():
assert foundry_output.to_dict() == foundry_output_dict

nft_output_dict = {
"type": 6,
"type": 3,
"mana": "47800",
"amount": "47800",
"nftId": "0x90e84936bd0cffd1595d2a58f63b1a8d0d3e333ed893950a5f3f0043c6e59ec1",
Expand Down
7 changes: 6 additions & 1 deletion sdk/src/client/api/block_builder/input_selection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::{
AccountOutput, AccountTransition, ChainId, FoundryOutput, NativeTokensBuilder, NftOutput, Output, OutputId,
OUTPUT_COUNT_RANGE,
},
payload::transaction::TransactionCapabilities,
protocol::ProtocolParameters,
slot::SlotIndex,
},
Expand Down Expand Up @@ -487,9 +488,10 @@ impl InputSelection {
}
}
Output::Foundry(foundry_output) => {
let foundry_id = foundry_output.id();
let foundry_input = input_foundries.iter().find(|i| {
if let Output::Foundry(foundry_input) = &i.output {
foundry_output.id() == foundry_input.id()
foundry_id == foundry_input.id()
} else {
false
}
Expand All @@ -500,6 +502,9 @@ impl InputSelection {
foundry_output,
input_native_tokens_builder.deref(),
output_native_tokens_builder.deref(),
// We use `all` capabilities here because this transition may be burning
// native tokens, and validation will fail without the capability.
&TransactionCapabilities::all(),
) {
log::debug!("validate_transitions error {err:?}");
return Err(Error::UnfulfillableRequirement(Requirement::Foundry(
Expand Down
Loading

0 comments on commit ffbef89

Please sign in to comment.