From 0ede853f4899436269d23c9b3d0ee2f9a2dbb104 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 11 Jan 2024 15:40:52 +0100 Subject: [PATCH] Some block fixes --- bindings/core/src/method/secret_manager.rs | 2 +- sdk/tests/types/api/core.rs | 10 +- ...et-block-by-id-empty-response-example.json | 50 +++---- ...ck-by-id-tagged-data-response-example.json | 30 ---- ...ck-by-id-transaction-response-example.json | 100 ------------- ...ock-by-id-validation-response-example.json | 52 +++---- .../fixtures/tagged-data-block-example.json | 32 +++++ .../fixtures/transaction-block-example.json | 132 ++++++++++++++++++ 8 files changed, 223 insertions(+), 185 deletions(-) delete mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-tagged-data-response-example.json delete mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-transaction-response-example.json create mode 100644 sdk/tests/types/api/fixtures/tagged-data-block-example.json create mode 100644 sdk/tests/types/api/fixtures/transaction-block-example.json diff --git a/bindings/core/src/method/secret_manager.rs b/bindings/core/src/method/secret_manager.rs index a4298f2b1e..2a13acbca0 100644 --- a/bindings/core/src/method/secret_manager.rs +++ b/bindings/core/src/method/secret_manager.rs @@ -99,7 +99,7 @@ pub enum SecretManagerMethod { /// Expected response: [`Ok`](crate::Response::Ok) #[cfg(feature = "stronghold")] #[cfg_attr(docsrs, doc(cfg(feature = "stronghold")))] - ClearStrongholdPassword + ClearStrongholdPassword, } #[cfg(test)] diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index b23ceb3cbf..2114210c20 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -61,10 +61,10 @@ fn responses() { // POST /api/core/v3/blocks // json_response::("post-blocks-response-example.json").unwrap(); // GET /api/core/v3/blocks/{blockId} - // json_response::("get-block-by-id-empty-response-example.json").unwrap(); - // json_response::("get-block-by-id-tagged-data-response-example.json").unwrap(); - // json_response::("get-block-by-id-transaction-response-example.json").unwrap(); - // json_response::("get-block-by-id-validation-response-example.json").unwrap(); + json_response::("get-block-by-id-empty-response-example.json").unwrap(); + json_response::("tagged-data-block-example.json").unwrap(); + // json_response::("transaction-block-example.json").unwrap(); + json_response::("get-block-by-id-validation-response-example.json").unwrap(); // GET /api/core/v3/blocks/{blockId}/metadata // json_response::("get-block-by-id-response-example-new-transaction.json").unwrap(); // json_response::("get-block-by-id-response-example-new.json").unwrap(); @@ -79,7 +79,7 @@ fn responses() { json_response::("get-output-metadata-by-id-response-unspent-example.json").unwrap(); json_response::("get-output-metadata-by-id-response-spent-example.json").unwrap(); // GET /api/core/v3/outputs/{outputId}/full - json_response::("get-full-output-metadata-example.json").unwrap(); + // json_response::("get-full-output-metadata-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId} json_response::("get-commitment-response-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId}/utxo-changes diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-empty-response-example.json b/sdk/tests/types/api/fixtures/get-block-by-id-empty-response-example.json index bff2eb0548..a16bc2b065 100644 --- a/sdk/tests/types/api/fixtures/get-block-by-id-empty-response-example.json +++ b/sdk/tests/types/api/fixtures/get-block-by-id-empty-response-example.json @@ -1,25 +1,27 @@ { - "header": { - "protocolVersion": 3, - "networkId": "0", - "issuingTime": "1692966346513784862", - "slotCommitmentId": "0x8633b2eb1845fdecf12ee6c5e789c3cf1f0d0bbb3cee65cb5fb2757e995b5cd70000000000000000", - "latestFinalizedSlot": 0, - "issuerId": "0x375358f92cc94750669598b0aaa55a6ff73310b90710e1fad524c0f911be0fea" - }, - "body": { - "type": 0, - "strongParents": [ - "0x2de585533d9c9684747e49f70e5e620a4e6c3fd1c7d8b73520c198c7def29a050200000000000000", - "0x5853745388056fb59c193dc6fe6f8c3f76bf8d82a42ed340eba621a9f5bb79790200000000000000" - ], - "weakParents": [], - "shallowLikeParents": [], - "maxBurnedMana": "0" - }, - "signature": { - "type": 0, - "publicKey": "0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064", - "signature": "0xae8a0ad932ff958576bcd787fd578dfb740b8a319d63595a3af7307f56f0afcbc6187d67eee20026aa39b6ba62c93d1a6e27111607b1b1d8f2206889284e9408" - } - } \ No newline at end of file + "header": { + "protocolVersion": 3, + "networkId": "8342982141227064571", + "issuingTime": "1695275852000000000", + "slotCommitmentId": "0x3a1e3b617060146e0362361a4b752833186108395f3b2b3d3e6c655e287d70767ea58d2a", + "latestFinalizedSlot": 500, + "issuerId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + }, + "body": { + "type": 0, + "strongParents": [ + "0x27e0461873f37040c9e59c35ad8a106fa1b94f5ec9ef89499b31904f9a3de59be58dd44a", + "0x714821f8f257e0a502b71ac7ee57530bb9dc29fe12ff3936f925b835a297680400b76948", + "0x9951e512546cd9c9fbdab348b6cba91a601a29b50854e55a6e14f6803ca1d81ac7eff5ce", + "0xaaa7bacf26f1aa4754d42edeab45d6169ea723b7fdf0f6ff3b6ebe90d09dbff6bc553936", + "0xba75a143de4ac932986fbe7b1d78f639bc6ee8aee10d510d41572851530be884778052aa", + "0xea5315941f4337752905599710b55e64018c71f4d8f299d0636d50484d05e6ac5667b503" + ], + "maxBurnedMana": "864" + }, + "signature": { + "type": 0, + "publicKey": "0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", + "signature": "0x74e57aa62358bb91ee931c05337a3af2e624fa9b20b04fcb4e15da0a9a4b4281a50ef6384ab7977179d16bd326cebb714c4653e1711447f18cefe1066aa1610d" + } +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-tagged-data-response-example.json b/sdk/tests/types/api/fixtures/get-block-by-id-tagged-data-response-example.json deleted file mode 100644 index 7e19f1ce39..0000000000 --- a/sdk/tests/types/api/fixtures/get-block-by-id-tagged-data-response-example.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "header": { - "protocolVersion": 3, - "networkId": "0", - "issuingTime": "1692966346513784862", - "slotCommitmentId": "0x8633b2eb1845fdecf12ee6c5e789c3cf1f0d0bbb3cee65cb5fb2757e995b5cd70000000000000000", - "latestFinalizedSlot": 0, - "issuerId": "0x375358f92cc94750669598b0aaa55a6ff73310b90710e1fad524c0f911be0fea" - }, - "body": { - "type": 0, - "strongParents": [ - "0x2de585533d9c9684747e49f70e5e620a4e6c3fd1c7d8b73520c198c7def29a050200000000000000", - "0x5853745388056fb59c193dc6fe6f8c3f76bf8d82a42ed340eba621a9f5bb79790200000000000000" - ], - "weakParents": [], - "shallowLikeParents": [], - "payload": { - "type": 0, - "tag": "0x4143544956495459", - "data": "" - }, - "maxBurnedMana": "500" - }, - "signature": { - "type": 0, - "publicKey": "0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064", - "signature": "0xae8a0ad932ff958576bcd787fd578dfb740b8a319d63595a3af7307f56f0afcbc6187d67eee20026aa39b6ba62c93d1a6e27111607b1b1d8f2206889284e9408" - } - } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-transaction-response-example.json b/sdk/tests/types/api/fixtures/get-block-by-id-transaction-response-example.json deleted file mode 100644 index ec03b1dc4f..0000000000 --- a/sdk/tests/types/api/fixtures/get-block-by-id-transaction-response-example.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "header": { - "protocolVersion": 3, - "networkId": "0", - "issuingTime": "1692966346513784862", - "slotCommitmentId": "0x8633b2eb1845fdecf12ee6c5e789c3cf1f0d0bbb3cee65cb5fb2757e995b5cd70000000000000000", - "latestFinalizedSlot": 0, - "issuerId": "0x375358f92cc94750669598b0aaa55a6ff73310b90710e1fad524c0f911be0fea" - }, - "body": { - "type": 0, - "strongParents": [ - "0x8d6f3b6e3a63ce388d2eb8c927c5b9ba328b0e427ae727d8b3dddc429f6fb24a0000000000000000", - "0x408a53af982c49d1398ab5c5b5f5b390d4c4da7da48b61bb9ba7f97c1e8dd7f60000000000000000" - ], - "weakParents": [ - "0xe8a904ce3ee081f20a68bb38b2d406cfd138775ba52ea555d93a4e4d4b0ad8440000000000000000", - "0xbce912a0f383cd07660d3c08f3d3f3c7fb9de31e2cc1b93d4c29332ef693ba0c0000000000000000" - ], - "shallowLikeParents": [ - "0x0276d29ec6b3cbbf3ed6d1f01af8e29b9c6a9ee9c9375e8e5b5b5c5b5b5d45580000000000000000", - "0x70a5ce5d8fc3290a9885b1af5d8766d51db89a67a6a839f6d23a6cb8d6f3b6e30000000000000000" - ], - "payload": { - "type": 1, - "transaction": { - "networkId": "1337133713371337", - "creationSlot": 1649442459, - "contextInputs": [ - { - "type": 1, - "commitmentId": "0x507d5c7d7105022b661e2c755173785f11707b7a6b3369111d000d1f145e652d5f436f26" - } - ], - "inputs": [ - { - "type": 0, - "transactionId": "0x0c78e998f5177834ecb3bae1596d5056af76e487386eecb19727465b4be86a79", - "transactionOutputIndex": 0 - }, - { - "type": 0, - "transactionId": "0x309b169bfa60c8cf80afd730741862d200405d5df7cabfe9b564361dce1f7036", - "transactionOutputIndex": 0 - }, - { - "type": 0, - "transactionId": "0xc138ecdc882010245e9574fbc1f1f43cc7c182fa890e46e018365dd49de0f16e", - "transactionOutputIndex": 0 - } - ], - "allotments": [ - { - "accountID": "0x030440433d7a726322151f735a6e72543e5b26142d68157d25746a6e45260f37", - "mana": "5285" - } - ], - "outputs": [ - { - "type": 0, - "amount": "50000000", - "unlockConditions": [ - { - "type": 0, - "address": { - "type": 0, - "pubKeyHash": "0xd49931814e6bfbb8e221f1b2936e206e5a6b6abeb9c070f8603814c525c9abe3" - } - } - ] - } - ] - }, - "unlocks": [ - { - "type": 0, - "signature": { - "type": 0, - "publicKey": "0x40d0c00fd629a5f528e4bcab4333926a90d06613a3f36a325defcdaf4c9e4092", - "signature": "0xed4a63a3e1b22c85f9813b00a21c8576ed72c1f5bc939d01fcea7dcd678c2d0d8d80a2499965d8ce5574c9e92aa0d42b72b969bab3a2a35fe7dbc64659a0d703" - } - }, - { - "type": 1, - "reference": 0 - }, - { - "type": 1, - "reference": 0 - } - ], - "maxBurnedMana": "105368" - } - }, - "signature": { - "type": 0, - "publicKey": "0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064", - "signature": "0xae8a0ad932ff958576bcd787fd578dfb740b8a319d63595a3af7307f56f0afcbc6187d67eee20026aa39b6ba62c93d1a6e27111607b1b1d8f2206889284e9408" - } - } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-validation-response-example.json b/sdk/tests/types/api/fixtures/get-block-by-id-validation-response-example.json index 021017f35a..df4837589c 100644 --- a/sdk/tests/types/api/fixtures/get-block-by-id-validation-response-example.json +++ b/sdk/tests/types/api/fixtures/get-block-by-id-validation-response-example.json @@ -1,26 +1,28 @@ { - "header": { - "protocolVersion": 3, - "networkId": "0", - "issuingTime": "1692966346513784862", - "slotCommitmentId": "0x8633b2eb1845fdecf12ee6c5e789c3cf1f0d0bbb3cee65cb5fb2757e995b5cd70000000000000000", - "latestFinalizedSlot": 0, - "issuerId": "0x375358f92cc94750669598b0aaa55a6ff73310b90710e1fad524c0f911be0fea" - }, - "body": { - "type": 1, - "strongParents": [ - "0x2de585533d9c9684747e49f70e5e620a4e6c3fd1c7d8b73520c198c7def29a050200000000000000", - "0x5853745388056fb59c193dc6fe6f8c3f76bf8d82a42ed340eba621a9f5bb79790200000000000000" - ], - "weakParents": [], - "shallowLikeParents": [], - "highestSupportedVersion": 3, - "protocolParametersHash": "0x69449327e1973152a1d2fdff1c8f27428fc52e4f1cf0bb8006eae397714e1968" - }, - "signature": { - "type": 0, - "publicKey": "0x05c1de274451db8de8182d64c6ee0dca3ae0c9077e0b4330c976976171d79064", - "signature": "0xae8a0ad932ff958576bcd787fd578dfb740b8a319d63595a3af7307f56f0afcbc6187d67eee20026aa39b6ba62c93d1a6e27111607b1b1d8f2206889284e9408" - } - } \ No newline at end of file + "header": { + "protocolVersion": 3, + "networkId": "8342982141227064571", + "issuingTime": "1695275852000000000", + "slotCommitmentId": "0x3a1e3b617060146e0362361a4b752833186108395f3b2b3d3e6c655e287d70767ea58d2a", + "latestFinalizedSlot": 500, + "issuerId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + }, + "body": { + "type": 1, + "strongParents": [ + "0x27e0461873f37040c9e59c35ad8a106fa1b94f5ec9ef89499b31904f9a3de59be58dd44a", + "0x714821f8f257e0a502b71ac7ee57530bb9dc29fe12ff3936f925b835a297680400b76948", + "0x9951e512546cd9c9fbdab348b6cba91a601a29b50854e55a6e14f6803ca1d81ac7eff5ce", + "0xaaa7bacf26f1aa4754d42edeab45d6169ea723b7fdf0f6ff3b6ebe90d09dbff6bc553936", + "0xba75a143de4ac932986fbe7b1d78f639bc6ee8aee10d510d41572851530be884778052aa", + "0xea5315941f4337752905599710b55e64018c71f4d8f299d0636d50484d05e6ac5667b503" + ], + "highestSupportedVersion": 3, + "protocolParametersHash": "0x0c0a5be47669365426b3e34ecd68f8fe6c70656a54139a1e1cd6fd779bfb476f" + }, + "signature": { + "type": 0, + "publicKey": "0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", + "signature": "0x3b6185bb5757d5e7fd576eeedf0c765c44cbcfe148261b8558a942867528f2cfe5a39a6ecd7bf7e82e134867a75df05385624be8c4102b3b77b397163459460b" + } +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/tagged-data-block-example.json b/sdk/tests/types/api/fixtures/tagged-data-block-example.json new file mode 100644 index 0000000000..781a561e20 --- /dev/null +++ b/sdk/tests/types/api/fixtures/tagged-data-block-example.json @@ -0,0 +1,32 @@ +{ + "header": { + "protocolVersion": 3, + "networkId": "8342982141227064571", + "issuingTime": "1695275852000000000", + "slotCommitmentId": "0x3a1e3b617060146e0362361a4b752833186108395f3b2b3d3e6c655e287d70767ea58d2a", + "latestFinalizedSlot": 500, + "issuerId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + }, + "body": { + "type": 0, + "strongParents": [ + "0x27e0461873f37040c9e59c35ad8a106fa1b94f5ec9ef89499b31904f9a3de59be58dd44a", + "0x714821f8f257e0a502b71ac7ee57530bb9dc29fe12ff3936f925b835a297680400b76948", + "0x9951e512546cd9c9fbdab348b6cba91a601a29b50854e55a6e14f6803ca1d81ac7eff5ce", + "0xaaa7bacf26f1aa4754d42edeab45d6169ea723b7fdf0f6ff3b6ebe90d09dbff6bc553936", + "0xba75a143de4ac932986fbe7b1d78f639bc6ee8aee10d510d41572851530be884778052aa", + "0xea5315941f4337752905599710b55e64018c71f4d8f299d0636d50484d05e6ac5667b503" + ], + "payload": { + "type": 0, + "tag": "0x746167", + "data": "0x6c754128356c071e5549764a48427b" + }, + "maxBurnedMana": "864" + }, + "signature": { + "type": 0, + "publicKey": "0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", + "signature": "0xc2982c2476379db0c8d39a204801163fc05dc1c7aa7df537e6041f91491943ab1de29a2dfe6076588c53b8d2ccf5eabe49f2cb64198303682859fd0c58348b0d" + } +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/transaction-block-example.json b/sdk/tests/types/api/fixtures/transaction-block-example.json new file mode 100644 index 0000000000..5b182b84e1 --- /dev/null +++ b/sdk/tests/types/api/fixtures/transaction-block-example.json @@ -0,0 +1,132 @@ +{ + "header": { + "protocolVersion": 3, + "networkId": "8342982141227064571", + "issuingTime": "1695275852000000000", + "slotCommitmentId": "0x3a1e3b617060146e0362361a4b752833186108395f3b2b3d3e6c655e287d70767ea58d2a", + "latestFinalizedSlot": 500, + "issuerId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + }, + "body": { + "type": 0, + "strongParents": [ + "0x27e0461873f37040c9e59c35ad8a106fa1b94f5ec9ef89499b31904f9a3de59be58dd44a", + "0x714821f8f257e0a502b71ac7ee57530bb9dc29fe12ff3936f925b835a297680400b76948", + "0x9951e512546cd9c9fbdab348b6cba91a601a29b50854e55a6e14f6803ca1d81ac7eff5ce", + "0xaaa7bacf26f1aa4754d42edeab45d6169ea723b7fdf0f6ff3b6ebe90d09dbff6bc553936", + "0xba75a143de4ac932986fbe7b1d78f639bc6ee8aee10d510d41572851530be884778052aa", + "0xea5315941f4337752905599710b55e64018c71f4d8f299d0636d50484d05e6ac5667b503" + ], + "payload": { + "type": 1, + "transaction": { + "networkId": "8342982141227064571", + "creationSlot": 1048576, + "contextInputs": [ + { + "type": 0, + "commitmentId": "0x3a1e3b617060146e0362361a4b752833186108395f3b2b3d3e6c655e287d70767ea58d2a" + }, + { + "type": 1, + "accountId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + }, + { + "type": 2, + "index": 0 + } + ], + "inputs": [ + { + "type": 0, + "transactionId": "0xf09d3cd648a7246c7c1b2ba2f9182465ae5742b78c592392b4b455ab8ed7195200000000", + "transactionOutputIndex": 0 + }, + { + "type": 0, + "transactionId": "0xd2c5ccba12b6fad51652131289867492799c9fc5710244418aa6e955f8fa826100000000", + "transactionOutputIndex": 0 + } + ], + "allotments": [ + { + "accountId": "0x7e0d0a5848362b23120f55115b096774036d7610137a631413221f5573344507", + "mana": "2285" + }, + { + "accountId": "0x476820096e7038107d071a4e473f1e295f346e2d0824263e5e3e7d004f6b6915", + "mana": "2189" + } + ], + "capabilities": "0x01", + "outputs": [ + { + "type": 0, + "amount": "100000", + "mana": "0", + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + } + } + ], + "features": [ + { + "type": 5, + "id": "0x086372557616532f714f104e5f44297b7a286d077956291a6d4f59081f484463712a64300c00", + "amount": "0x14be8149371263f4" + } + ] + }, + { + "type": 1, + "amount": "100000", + "mana": "5000", + "accountId": "0x0000000000000000000000000000000000000000000000000000000000000000", + "foundryCounter": 0, + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" + } + } + ], + "features": [ + { + "type": 3, + "entries": { + "hello": "0x776f726c64" + } + } + ] + } + ] + }, + "unlocks": [ + { + "type": 0, + "signature": { + "type": 0, + "publicKey": "0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", + "signature": "0x469a3426bf88a8ed1a0346892a519e5b56cd8f686b1ce9b904898a62b25a8f96124f4ad3db9b6241fee5be98d067d083e91b2c4ce96e91fb8bc0871443764f00" + } + }, + { + "type": 1, + "reference": 0 + } + ] + }, + "maxBurnedMana": "864" + }, + "signature": { + "type": 0, + "publicKey": "0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", + "signature": "0x0893932c1ed4bd75caed5349dfaa963f2ec34e9bac79e6a860c2aa253a3cd6d6d2e9e5165b21b6b424a7a6262febd669852b5e1a352a93fef3e62e403d5ca002" + } +} \ No newline at end of file