From d0d14a3fcfa1e8ab8f0253c97bdefb5acfb0b198 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 13:03:57 +0100 Subject: [PATCH 01/41] Add API response tests from TIP examples --- ...et-block-by-id-empty-response-example.json | 25 ++++ ...esponse-example-confirmed-transaction.json | 5 + ...lock-by-id-response-example-confirmed.json | 4 + ...ponse-example-conflicting-transaction.json | 6 + ...y-id-response-example-new-transaction.json | 5 + .../get-block-by-id-response-example-new.json | 4 + ...ck-by-id-tagged-data-response-example.json | 30 +++++ ...ck-by-id-transaction-response-example.json | 100 ++++++++++++++++ ...ock-by-id-validation-response-example.json | 26 ++++ .../get-buildingBlock-response-example.json | 23 ++++ .../fixtures/get-info-response-example.json | 111 ++++++++++++++++++ .../fixtures/get-routes-response-example.json | 7 ++ .../post-blocks-response-example.json | 3 + 13 files changed, 349 insertions(+) create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-empty-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed-transaction.json create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed.json create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-response-example-conflicting-transaction.json create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-response-example-new-transaction.json create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-response-example-new.json create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-tagged-data-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-transaction-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-block-by-id-validation-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-buildingBlock-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-info-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-routes-response-example.json create mode 100644 sdk/tests/types/api/fixtures/post-blocks-response-example.json 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 new file mode 100644 index 0000000000..bff2eb0548 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-empty-response-example.json @@ -0,0 +1,25 @@ +{ + "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 diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed-transaction.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed-transaction.json new file mode 100644 index 0000000000..8fc9a95809 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed-transaction.json @@ -0,0 +1,5 @@ +{ + "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", + "blockState": "confirmed", + "transactionState": "confirmed" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed.json new file mode 100644 index 0000000000..0c20539d5b --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed.json @@ -0,0 +1,4 @@ +{ + "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", + "blockState": "confirmed" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-conflicting-transaction.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-conflicting-transaction.json new file mode 100644 index 0000000000..633aa1d166 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-conflicting-transaction.json @@ -0,0 +1,6 @@ +{ + "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", + "blockState": "confirmed", + "transactionState": "failed", + "transactionFailureReason": 2 + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new-transaction.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new-transaction.json new file mode 100644 index 0000000000..282cdb627b --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new-transaction.json @@ -0,0 +1,5 @@ +{ + "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", + "blockState": "pending", + "transactionState": "pending" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new.json new file mode 100644 index 0000000000..c4a1efcdce --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new.json @@ -0,0 +1,4 @@ +{ + "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", + "blockState": "pending" + } \ 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 new file mode 100644 index 0000000000..7e19f1ce39 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-tagged-data-response-example.json @@ -0,0 +1,30 @@ +{ + "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 new file mode 100644 index 0000000000..ec03b1dc4f --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-transaction-response-example.json @@ -0,0 +1,100 @@ +{ + "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 new file mode 100644 index 0000000000..021017f35a --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-block-by-id-validation-response-example.json @@ -0,0 +1,26 @@ +{ + "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 diff --git a/sdk/tests/types/api/fixtures/get-buildingBlock-response-example.json b/sdk/tests/types/api/fixtures/get-buildingBlock-response-example.json new file mode 100644 index 0000000000..f69a9b4e51 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-buildingBlock-response-example.json @@ -0,0 +1,23 @@ +{ + "strongParents": [ + "0x4f746934d0075179a37ca3e807b7e793ec4ec9189ba31c9ad092d7497b01118c1000000000000000", + "0x59daaaba1cd10cd268966376e17710d100c90826fe258753d461acac99b7e3341500000000000000" + ], + "weakParents": [ + "0xebb058f1f1c8f1ac6508465deeee1dd090396f9e6e2b5c103eef5583f20a0c133a00000000000000", + "0xb173e2d2b6f72600f00da84492ddb6eadee703dc39fb846725828059272093fb3b00000000000000" + ], + "shallowLikeParents": [ + "0xdbf86c778d69f413296c2d4d3086d76c74bf4d719e6e95c03a3d9a955ed39bcf3e00000000000000", + "0xf15b2ec698e396c9d2e69bc753246631aedebb657da09ba0e0c8d42518a1e8953e00000000000000" + ], + "latestFinalizedSlot": 1422, + "commitment": { + "protocolVersion": 3, + "slot": 1432, + "previousCommitmentId": "0xbf07dc16986166953f5a72c19d78642aab6cbde63964a2369ec3d425144eb42b3800000000000000", + "rootsId": "0xa4dd36465af63d495d35a05f592d42a51511c153e1bae8fad00453c8cbb48727", + "cumulativeWeight": "45678", + "referenceManaCost": "12345" + } + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-info-response-example.json b/sdk/tests/types/api/fixtures/get-info-response-example.json new file mode 100644 index 0000000000..dc4ae03f56 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-info-response-example.json @@ -0,0 +1,111 @@ +{ + "name": "Example Node", + "version": "1.0.0", + "status": { + "isHealthy": true, + "acceptedTangleTime": "1692966168000000000", + "relativeAcceptedTangleTime": "1692966173856059205", + "confirmedTangleTime": "1692966168000000000", + "relativeConfirmedTangleTime": "1692966173855931045", + "latestCommitmentID": "0x8fb6cbb1ecf02c6b5a6a5a6a5f6c5a6a5f6c5a6a5a6a5a6a5f6c5a6a5a6a5f6c50000000000000000", + "latestFinalizedSlot": 100, + "latestAcceptedBlockSlot": 100, + "latestConfirmedBlockSlot": 95, + "pruningEpoch": 20 + }, + "metrics": { + "blocksPerSecond": "1.5E+00", + "confirmedBlocksPerSecond": "1.5E+00", + "confirmationRate": "1E+02" + }, + "protocolParameters": [ + { + "startEpoch": 1, + "parameters": { + "type": 0, + "version": 3, + "networkName": "iota-core-testnet", + "bech32Hrp": "rms", + "storageScoreParameters": { + "storageCost": "500", + "factorData": 1, + "offsetOutputOverhead": "10", + "offsetEd25519BlockIssuerKey": "100", + "offsetStakingFeature": "100", + "storageScoreOffoffsetDelegationsetDelegation": "100" + }, + "workScoreParameters": { + "dataByte": 0, + "block": 100, + "input": 20, + "contextInput": 20, + "output": 20, + "nativeToken": 20, + "staking": 100, + "blockIssuer": 100, + "allotment": 100, + "signatureEd25519": 200 + }, + "manaParameters": { + "bitsCount": 63, + "generationRate": 1, + "generationRateExponent": 0, + "decayFactors": [ + 10, + 20 + ], + "decayFactorsExponent": 0, + "decayFactorEpochsSum": 0, + "decayFactorEpochsSumExponent": 0 + }, + "tokenSupply": "2779530283277761", + "genesisSlot": 5, + "genesisUnixTimestamp": "1692966168", + "slotDurationInSeconds": 10, + "slotsPerEpochExponent": 13, + "stakingUnbondingPeriod": 10, + "validationBlocksPerSlot": 10, + "punishmentEpochs": 10, + "livenessThresholdLowerBound": 5, + "livenessThresholdUpperBound": 10, + "minCommittableAge": 10, + "maxCommittableAge": 20, + "epochNearingThreshold": 30, + "congestionControlParameters": { + "minReferenceManaCost": "500", + "increase": "500", + "decrease": "500", + "increaseThreshold": 800000, + "decreaseThreshold": 500000, + "schedulerRate": 100000, + "maxBufferSize": 3276800, + "maxValidationBufferSize": 100 + }, + "versionSignalingParameters": { + "windowSize": 7, + "windowTargetRatio": 5, + "activationOffset": 7 + }, + "rewardsParameters": { + "profitMarginExponent": 8, + "bootstrappinDuration": 1154, + "manaShareCoefficient": "2", + "decayBalancingConstantExponent": 8, + "decayBalancingConstant": "1", + "poolCoefficientExponent": 31 + }, + "targetCommitteeSize": 32 + } + } + ], + "baseToken": { + "name": "Shimmer", + "tickerSymbol": "SMR", + "unit": "SMR", + "decimals": 6, + "subunit": "glow" + }, + "features": [ + [] + ] + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-routes-response-example.json b/sdk/tests/types/api/fixtures/get-routes-response-example.json new file mode 100644 index 0000000000..9c3c9c4141 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-routes-response-example.json @@ -0,0 +1,7 @@ +{ + "routes": [ + "core/v3", + "dashboard-metrics/v2", + "debug/v2" + ] + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/post-blocks-response-example.json b/sdk/tests/types/api/fixtures/post-blocks-response-example.json new file mode 100644 index 0000000000..662c867648 --- /dev/null +++ b/sdk/tests/types/api/fixtures/post-blocks-response-example.json @@ -0,0 +1,3 @@ +{ + "blockId": "0xb173e2d2b6f72600f00da84492ddb6eadee703dc39fb846725828059272093fb3b00000000000000" + } \ No newline at end of file From 305c02dec89796ff8bd246a074022bb260f587cb Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 13:12:52 +0100 Subject: [PATCH 02/41] Add more --- .../api/fixtures/get-committee-example.json | 19 +++++++++++ ...-congestion-estimate-response-example.json | 6 ++++ .../get-full-output-metadata-example.json | 32 +++++++++++++++++++ .../fixtures/get-mana-rewards-example.json | 5 +++ ...metadata-by-id-response-spent-example.json | 10 ++++++ ...tadata-by-id-response-unspent-example.json | 8 +++++ .../get-outputs-by-id-response-example.json | 22 +++++++++++++ .../api/fixtures/get-validator-example.json | 10 ++++++ .../api/fixtures/get-validators-example.json | 25 +++++++++++++++ 9 files changed, 137 insertions(+) create mode 100644 sdk/tests/types/api/fixtures/get-committee-example.json create mode 100644 sdk/tests/types/api/fixtures/get-congestion-estimate-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-full-output-metadata-example.json create mode 100644 sdk/tests/types/api/fixtures/get-mana-rewards-example.json create mode 100644 sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-spent-example.json create mode 100644 sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-unspent-example.json create mode 100644 sdk/tests/types/api/fixtures/get-outputs-by-id-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-validator-example.json create mode 100644 sdk/tests/types/api/fixtures/get-validators-example.json diff --git a/sdk/tests/types/api/fixtures/get-committee-example.json b/sdk/tests/types/api/fixtures/get-committee-example.json new file mode 100644 index 0000000000..bd37ffa69e --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-committee-example.json @@ -0,0 +1,19 @@ +{ + "epoch": 10, + "totalStake": "900000000", + "totalValidatorStake": "60000000", + "committee": [ + { + "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", + "poolStake": "200000", + "validatorStake": "100000", + "fixedCost": "50000" + }, + { + "address": "rms1pp4wuuz0y42caz48vv876qfpmffswsvg40zz8v79sy8cp0jfxm4kunflcgt", + "poolStake": "205000", + "validatorStake": "90000", + "fixedCost": "52000" + } + ] + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-congestion-estimate-response-example.json b/sdk/tests/types/api/fixtures/get-congestion-estimate-response-example.json new file mode 100644 index 0000000000..21d043e61a --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-congestion-estimate-response-example.json @@ -0,0 +1,6 @@ +{ + "slot": 20, + "ready": true, + "referenceManaCost": "50000", + "blockIssuanceCredits": "10000000" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json b/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json new file mode 100644 index 0000000000..2743ca5885 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json @@ -0,0 +1,32 @@ +{ + "output": { + "type": 3, + "amount": "1000", + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" + } + } + ], + "mana": "2000" + }, + "outputIdProof": { + "slot": 20, + "outputIndex": 0, + "transactionCommitment": "0x897dr69bfa60c8cf80afd730741862d200405d5df7cabfe9b564361dce1f7036", + "outputCommitmentProof": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75" + }, + "metadata": { + "blockId": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75", + "transactionId": "0x1c52e8e630d1c6e45ab6f46c63d8d6cb02e6c2ed6e31b6c97d6f5c5f5a5d5c5b", + "outputIndex": 3, + "isSpent": true, + "commitmentIdSpent": "0x4b91c935926c77d0ac9b4a569c3eb3b0f0c9918f2d4f4d9bb1c7dfc19b41e4c2", + "transactionIdSpent": "0x1ee46e19f4219ee65afc10227d0ca22753f76ef32d1e922e5cbe3fbc9b5a5298", + "includedCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a", + "latestCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a" + } + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-mana-rewards-example.json b/sdk/tests/types/api/fixtures/get-mana-rewards-example.json new file mode 100644 index 0000000000..48ffb83cc3 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-mana-rewards-example.json @@ -0,0 +1,5 @@ +{ + "epochStart": 60, + "epochEnd": 80, + "rewards": "800000" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-spent-example.json b/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-spent-example.json new file mode 100644 index 0000000000..4be8a7be76 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-spent-example.json @@ -0,0 +1,10 @@ +{ + "blockId": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75", + "transactionId": "0x1c52e8e630d1c6e45ab6f46c63d8d6cb02e6c2ed6e31b6c97d6f5c5f5a5d5c5b", + "outputIndex": 3, + "isSpent": true, + "commitmentIdSpent": "0x4b91c935926c77d0ac9b4a569c3eb3b0f0c9918f2d4f4d9bb1c7dfc19b41e4c2", + "transactionIdSpent": "0x1ee46e19f4219ee65afc10227d0ca22753f76ef32d1e922e5cbe3fbc9b5a5298", + "includedCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a", + "latestCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-unspent-example.json b/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-unspent-example.json new file mode 100644 index 0000000000..37e4f88e39 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-unspent-example.json @@ -0,0 +1,8 @@ +{ + "blockId": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75", + "transactionId": "0x1c52e8e630d1c6e45ab6f46c63d8d6cb02e6c2ed6e31b6c97d6f5c5f5a5d5c5b", + "outputIndex": 3, + "isSpent": false, + "includedCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a", + "latestCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-outputs-by-id-response-example.json b/sdk/tests/types/api/fixtures/get-outputs-by-id-response-example.json new file mode 100644 index 0000000000..4ac8924b7b --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-outputs-by-id-response-example.json @@ -0,0 +1,22 @@ +{ + "output": { + "type": 3, + "amount": "1000", + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" + } + } + ], + "mana": "2000" + }, + "outputIdProof": { + "slot": 20, + "outputIndex": 0, + "transactionCommitment": "0x897dr69bfa60c8cf80afd730741862d200405d5df7cabfe9b564361dce1f7036", + "outputCommitmentProof": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75" + } + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-validator-example.json b/sdk/tests/types/api/fixtures/get-validator-example.json new file mode 100644 index 0000000000..3042a1989d --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-validator-example.json @@ -0,0 +1,10 @@ +{ + "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", + "stakingEpochEnd": 100, + "poolStake": "205000", + "validatorStake": "90000", + "fixedCost": "52000", + "active": true, + "latestSupportedProtocolVersion": 3, + "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-validators-example.json b/sdk/tests/types/api/fixtures/get-validators-example.json new file mode 100644 index 0000000000..482a992c3f --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-validators-example.json @@ -0,0 +1,25 @@ +{ + "validators": [ + { + "address": "rms1pp4wuuz0y42caz48vv876qfpmffswsvg40zz8v79sy8cp0jfxm4kunflcgt", + "stakingEpochEnd": 100, + "poolStake": "200000", + "validatorStake": "100000", + "fixedCost": "50000", + "active": false, + "latestSupportedProtocolVersion": 3, + "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" + }, + { + "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", + "stakingEpochEnd": 10, + "poolStake": "205000", + "validatorStake": "90000", + "fixedCost": "52000", + "active": true, + "latestSupportedProtocolVersion": 3, + "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" + } + ], + "pageSize": 50 + } \ No newline at end of file From ba6fd8541636641115a6c2942c334aaaca4f5ca5 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 13:34:01 +0100 Subject: [PATCH 03/41] Add assert_response --- sdk/tests/types/api/core.rs | 17 +++++++++++++++++ sdk/tests/types/api/mod.rs | 1 + 2 files changed, 18 insertions(+) create mode 100644 sdk/tests/types/api/core.rs diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs new file mode 100644 index 0000000000..6472e42dfa --- /dev/null +++ b/sdk/tests/types/api/core.rs @@ -0,0 +1,17 @@ +// Copyright 2023 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +use iota_sdk::types::block::BlockDto; +use serde::Deserialize; + +fn assert_response(path: &str) +where + for<'a> T: Deserialize<'a>, +{ + serde_json::from_str::(&std::fs::read_to_string(path).unwrap()).unwrap(); +} + +#[test] +fn responses() { + assert_response::("./tests/types/api/fixtures/get-block-by-id-empty-response-example.json"); +} diff --git a/sdk/tests/types/api/mod.rs b/sdk/tests/types/api/mod.rs index 33ac8943a3..ddbc2094b8 100644 --- a/sdk/tests/types/api/mod.rs +++ b/sdk/tests/types/api/mod.rs @@ -1,4 +1,5 @@ // Copyright 2023 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +mod core; mod participation; From da8d6b74960f55f3d3275f0624f9cf64c7ba67b7 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 13:50:32 +0100 Subject: [PATCH 04/41] More fixtures --- .../fixtures/get-commitment-response-binary-example | 1 + .../api/fixtures/get-commitment-response-example.json | 8 ++++++++ .../fixtures/get-utxo-changes-response-example.json | 11 +++++++++++ 3 files changed, 20 insertions(+) create mode 100644 sdk/tests/types/api/fixtures/get-commitment-response-binary-example create mode 100644 sdk/tests/types/api/fixtures/get-commitment-response-example.json create mode 100644 sdk/tests/types/api/fixtures/get-utxo-changes-response-example.json diff --git a/sdk/tests/types/api/fixtures/get-commitment-response-binary-example b/sdk/tests/types/api/fixtures/get-commitment-response-binary-example new file mode 100644 index 0000000000..33f92e11ef --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-commitment-response-binary-example @@ -0,0 +1 @@ +070000000a1a0000977c626276b19ef8b3c445709f2f0f2ccc4abb98d97617f421f240c0d1ee066d4306e67a0321889ef8ec89b7eff1378049e058f0fa87a78c2452ae72631a5a99d913d1cbb3525b8faa1800e28dfcb28154bcba10154c39ef87ceda793cb44f58ae1549c88ea13fe4a9695bb6f0aba6cb756522209e5066a96039ae12b398b975693bdc21e222997c86ff9bfc5844f0372d58ff6fa510688e53c181bbdf4db41f9b627540a70e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a80000000300d85e5b1590d898d1e0cdebb2e3b5337c8b76270142663d78811683ba47c17c989ad7a8f0ff2c6438bf435786d4a5b0125a5caf7367061b49a739389d5ebea234c0466c86f88a3f8add03bff04c2e34b214683f2f6983641e1d1185da7e2c3e0200d9922819a39e94ddf3907f4b9c8df93f39f026244fcb609205b9a879022599f218be2536d8b7b8547faa3dbdfe98339ebe9e2b2417a8a03eee02b2a8312b9e026dd0a33261a58a240cd0a1b06cdf1775d98d316f162d3eec402f4bf08bea2a0700f9d9656a60049083eef61487632187b351294c1fa23d118060d813db6d03e8b6ca8180d435708e826bc2042ccd667babb59c5cc461ff29dba966359fcd6fc511cdfdf10d6576f36ac2a6e5cb691e13968c13947ffbd9239939d3802b2fbe0f06 \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-commitment-response-example.json b/sdk/tests/types/api/fixtures/get-commitment-response-example.json new file mode 100644 index 0000000000..c453c7d2ad --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-commitment-response-example.json @@ -0,0 +1,8 @@ +{ + "protocolVersion": 3, + "slot": 986, + "previousCommitmentId": "0x8fb6cbb1ecf02c6b5a6a5a6a5f6c5a6a5f6c5a6a5a6a5a6a5f6c5a6a5a6a5f6c50000000000000000", + "rootsId": "0xa4dd36465af63d495d35a05f592d42a51511c153e1bae8fad00453c8cbb48727", + "cumulativeWeight": "78901", + "referenceManaCost": "600" + } \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-utxo-changes-response-example.json b/sdk/tests/types/api/fixtures/get-utxo-changes-response-example.json new file mode 100644 index 0000000000..f6cd798004 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-utxo-changes-response-example.json @@ -0,0 +1,11 @@ +{ + "slot": 789, + "createdOutputs": [ + "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2", + "0x3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4" + ], + "consumedOutputs": [ + "0x5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6", + "0x7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7" + ] + } \ No newline at end of file From b6d5a86c6d74a33589a42973f5d4189a388ac075 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 14:35:23 +0100 Subject: [PATCH 05/41] Add assert_binary_response --- sdk/tests/types/api/core.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 6472e42dfa..dbba6dbb23 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -1,17 +1,26 @@ // Copyright 2023 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use iota_sdk::types::block::BlockDto; +use iota_sdk::types::block::{slot::SlotCommitment, BlockDto}; +use packable::PackableExt; use serde::Deserialize; -fn assert_response(path: &str) +fn assert_json_response(path: &str) where for<'a> T: Deserialize<'a>, { - serde_json::from_str::(&std::fs::read_to_string(path).unwrap()).unwrap(); + let file = std::fs::read_to_string(&format!("./tests/types/api/fixtures/{path}")).unwrap(); + serde_json::from_str::(&file).unwrap(); +} + +fn assert_binary_response(path: &str, visitor: &T::UnpackVisitor) { + let file = std::fs::read_to_string(&format!("./tests/types/api/fixtures/{path}")).unwrap(); + let bytes = hex::decode(file).unwrap(); + T::unpack_verified(bytes, visitor).unwrap(); } #[test] fn responses() { - assert_response::("./tests/types/api/fixtures/get-block-by-id-empty-response-example.json"); + // assert_json_response::("get-block-by-id-empty-response-example.json"); + assert_binary_response::("get-commitment-response-binary-example", &()); } From 3c9759b147d1239099ef8b7276f9c1ff32d31adb Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 14:52:38 +0100 Subject: [PATCH 06/41] Parse all responses --- sdk/tests/types/api/core.rs | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index dbba6dbb23..3dea71f012 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -1,7 +1,13 @@ // Copyright 2023 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -use iota_sdk::types::block::{slot::SlotCommitment, BlockDto}; +use iota_sdk::types::{ + api::core::{ + CommitteeResponse, CongestionResponse, InfoResponse, IssuanceBlockHeaderResponse, ManaRewardsResponse, + RoutesResponse, UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, + }, + block::{output::OutputMetadata, slot::SlotCommitment, BlockDto, BlockId}, +}; use packable::PackableExt; use serde::Deserialize; @@ -21,6 +27,30 @@ fn assert_binary_response(path: &str, visitor: &T::UnpackVisitor #[test] fn responses() { - // assert_json_response::("get-block-by-id-empty-response-example.json"); + assert_json_response::("get-block-by-id-empty-response-example.json"); + assert_json_response::("get-block-by-id-response-example-confirmed-transaction.json"); + assert_json_response::("get-block-by-id-response-example-confirmed.json"); + assert_json_response::("get-block-by-id-response-example-conflicting-transaction.json"); + assert_json_response::("get-block-by-id-response-example-new-transaction.json"); + assert_json_response::("get-block-by-id-response-example-new.json"); + assert_json_response::("get-block-by-id-tagged-data-response-example.json"); + assert_json_response::("get-block-by-id-transaction-response-example.json"); + assert_json_response::("get-block-by-id-validation-response-example.json"); + assert_json_response::("get-buildingBlock-response-example.json"); + assert_json_response::("get-commitment-response-example.json"); + assert_json_response::("get-committee-example.json"); + assert_json_response::("get-congestion-estimate-response-example.json"); + // assert_json_response("get-full-output-metadata-example.json"); + assert_json_response::("get-info-response-example.json"); + assert_json_response::("get-mana-rewards-example.json"); + assert_json_response::("get-output-metadata-by-id-response-spent-example.json"); + assert_json_response::("get-output-metadata-by-id-response-unspent-example.json"); + // assert_json_response("get-outputs-by-id-response-example.json"); + assert_json_response::("get-routes-response-example.json"); + assert_json_response::("get-utxo-changes-response-example.json"); + assert_json_response::("get-validator-example.json"); + assert_json_response::("get-validators-example.json"); + assert_json_response::("post-blocks-response-example.json"); + assert_binary_response::("get-commitment-response-binary-example", &()); } From bc59268b88f7a5859912773cdc06a1a99a323971 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 15:03:32 +0100 Subject: [PATCH 07/41] Return result --- sdk/tests/types/api/core.rs | 66 ++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 3dea71f012..70c52c7cf5 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -8,49 +8,55 @@ use iota_sdk::types::{ }, block::{output::OutputMetadata, slot::SlotCommitment, BlockDto, BlockId}, }; -use packable::PackableExt; +use packable::{ + error::{UnexpectedEOF, UnpackError}, + Packable, PackableExt, +}; use serde::Deserialize; -fn assert_json_response(path: &str) +fn json_response(path: &str) -> Result where for<'a> T: Deserialize<'a>, { let file = std::fs::read_to_string(&format!("./tests/types/api/fixtures/{path}")).unwrap(); - serde_json::from_str::(&file).unwrap(); + serde_json::from_str::(&file) } -fn assert_binary_response(path: &str, visitor: &T::UnpackVisitor) { +fn binary_response( + path: &str, + visitor: &T::UnpackVisitor, +) -> Result::UnpackError, UnexpectedEOF>> { let file = std::fs::read_to_string(&format!("./tests/types/api/fixtures/{path}")).unwrap(); let bytes = hex::decode(file).unwrap(); - T::unpack_verified(bytes, visitor).unwrap(); + T::unpack_verified(bytes, visitor) } #[test] fn responses() { - assert_json_response::("get-block-by-id-empty-response-example.json"); - assert_json_response::("get-block-by-id-response-example-confirmed-transaction.json"); - assert_json_response::("get-block-by-id-response-example-confirmed.json"); - assert_json_response::("get-block-by-id-response-example-conflicting-transaction.json"); - assert_json_response::("get-block-by-id-response-example-new-transaction.json"); - assert_json_response::("get-block-by-id-response-example-new.json"); - assert_json_response::("get-block-by-id-tagged-data-response-example.json"); - assert_json_response::("get-block-by-id-transaction-response-example.json"); - assert_json_response::("get-block-by-id-validation-response-example.json"); - assert_json_response::("get-buildingBlock-response-example.json"); - assert_json_response::("get-commitment-response-example.json"); - assert_json_response::("get-committee-example.json"); - assert_json_response::("get-congestion-estimate-response-example.json"); - // assert_json_response("get-full-output-metadata-example.json"); - assert_json_response::("get-info-response-example.json"); - assert_json_response::("get-mana-rewards-example.json"); - assert_json_response::("get-output-metadata-by-id-response-spent-example.json"); - assert_json_response::("get-output-metadata-by-id-response-unspent-example.json"); - // assert_json_response("get-outputs-by-id-response-example.json"); - assert_json_response::("get-routes-response-example.json"); - assert_json_response::("get-utxo-changes-response-example.json"); - assert_json_response::("get-validator-example.json"); - assert_json_response::("get-validators-example.json"); - assert_json_response::("post-blocks-response-example.json"); + json_response::("get-block-by-id-empty-response-example.json").unwrap(); + json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); + json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); + json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); + json_response::("get-block-by-id-response-example-new-transaction.json").unwrap(); + json_response::("get-block-by-id-response-example-new.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-buildingBlock-response-example.json").unwrap(); + json_response::("get-commitment-response-example.json").unwrap(); + json_response::("get-committee-example.json").unwrap(); + json_response::("get-congestion-estimate-response-example.json").unwrap(); + // json_response("get-full-output-metadata-example.json").unwrap(); + json_response::("get-info-response-example.json").unwrap(); + json_response::("get-mana-rewards-example.json").unwrap(); + json_response::("get-output-metadata-by-id-response-spent-example.json").unwrap(); + json_response::("get-output-metadata-by-id-response-unspent-example.json").unwrap(); + // json_response("get-outputs-by-id-response-example.json").unwrap(); + json_response::("get-routes-response-example.json").unwrap(); + json_response::("get-utxo-changes-response-example.json").unwrap(); + json_response::("get-validator-example.json").unwrap(); + json_response::("get-validators-example.json").unwrap(); + json_response::("post-blocks-response-example.json").unwrap(); - assert_binary_response::("get-commitment-response-binary-example", &()); + binary_response::("get-commitment-response-binary-example", &()).unwrap(); } From 044a9979b102862f423ce94c3ea64b82d68df015 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 15:08:11 +0100 Subject: [PATCH 08/41] Comment failing tests --- sdk/tests/types/api/core.rs | 41 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 70c52c7cf5..75a4a09565 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -29,34 +29,35 @@ fn binary_response( let file = std::fs::read_to_string(&format!("./tests/types/api/fixtures/{path}")).unwrap(); let bytes = hex::decode(file).unwrap(); T::unpack_verified(bytes, visitor) + // TODO check there is no bytes left } #[test] fn responses() { - json_response::("get-block-by-id-empty-response-example.json").unwrap(); - json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); - json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); - json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); - json_response::("get-block-by-id-response-example-new-transaction.json").unwrap(); - json_response::("get-block-by-id-response-example-new.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-buildingBlock-response-example.json").unwrap(); - json_response::("get-commitment-response-example.json").unwrap(); - json_response::("get-committee-example.json").unwrap(); - json_response::("get-congestion-estimate-response-example.json").unwrap(); + // json_response::("get-block-by-id-empty-response-example.json").unwrap(); + // json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); + // json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); + // json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); + // json_response::("get-block-by-id-response-example-new-transaction.json").unwrap(); + // json_response::("get-block-by-id-response-example-new.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-buildingBlock-response-example.json").unwrap(); + // json_response::("get-commitment-response-example.json").unwrap(); + // json_response::("get-committee-example.json").unwrap(); + // json_response::("get-congestion-estimate-response-example.json").unwrap(); // json_response("get-full-output-metadata-example.json").unwrap(); - json_response::("get-info-response-example.json").unwrap(); + // json_response::("get-info-response-example.json").unwrap(); json_response::("get-mana-rewards-example.json").unwrap(); - json_response::("get-output-metadata-by-id-response-spent-example.json").unwrap(); - json_response::("get-output-metadata-by-id-response-unspent-example.json").unwrap(); + // json_response::("get-output-metadata-by-id-response-spent-example.json").unwrap(); + // json_response::("get-output-metadata-by-id-response-unspent-example.json").unwrap(); // json_response("get-outputs-by-id-response-example.json").unwrap(); json_response::("get-routes-response-example.json").unwrap(); - json_response::("get-utxo-changes-response-example.json").unwrap(); - json_response::("get-validator-example.json").unwrap(); - json_response::("get-validators-example.json").unwrap(); - json_response::("post-blocks-response-example.json").unwrap(); + // json_response::("get-utxo-changes-response-example.json").unwrap(); + // json_response::("get-validator-example.json").unwrap(); + // json_response::("get-validators-example.json").unwrap(); + // json_response::("post-blocks-response-example.json").unwrap(); binary_response::("get-commitment-response-binary-example", &()).unwrap(); } From 66c0ebe91bd236d363d0977bf08cebcddc2c92ac Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 17:24:50 +0100 Subject: [PATCH 09/41] Uncomment ValidatorResponse --- sdk/tests/types/api/core.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 75a4a09565..471874a07e 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -55,8 +55,8 @@ fn responses() { // json_response("get-outputs-by-id-response-example.json").unwrap(); json_response::("get-routes-response-example.json").unwrap(); // json_response::("get-utxo-changes-response-example.json").unwrap(); - // json_response::("get-validator-example.json").unwrap(); - // json_response::("get-validators-example.json").unwrap(); + json_response::("get-validator-example.json").unwrap(); + json_response::("get-validators-example.json").unwrap(); // json_response::("post-blocks-response-example.json").unwrap(); binary_response::("get-commitment-response-binary-example", &()).unwrap(); From 620052cabe519cba2031af15d05a593bc62d7f64 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 17:50:12 +0100 Subject: [PATCH 10/41] Uncomment CommitteeResponse --- sdk/tests/types/api/core.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 471874a07e..6882719d60 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -45,7 +45,7 @@ fn responses() { // json_response::("get-block-by-id-validation-response-example.json").unwrap(); // json_response::("get-buildingBlock-response-example.json").unwrap(); // json_response::("get-commitment-response-example.json").unwrap(); - // json_response::("get-committee-example.json").unwrap(); + json_response::("get-committee-example.json").unwrap(); // json_response::("get-congestion-estimate-response-example.json").unwrap(); // json_response("get-full-output-metadata-example.json").unwrap(); // json_response::("get-info-response-example.json").unwrap(); From f12783132a523d4d649a7e2627096642d84acedb Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 18:41:55 +0100 Subject: [PATCH 11/41] Warning --- sdk/src/types/api/core.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/src/types/api/core.rs b/sdk/src/types/api/core.rs index d8449f01bc..5229010752 100644 --- a/sdk/src/types/api/core.rs +++ b/sdk/src/types/api/core.rs @@ -14,7 +14,7 @@ use crate::{ types::block::{ address::Bech32Address, core::Parents, - output::{dto::OutputDto, AccountId, OutputId, OutputMetadata, OutputWithMetadata}, + output::{dto::OutputDto, OutputId, OutputMetadata, OutputWithMetadata}, protocol::{ProtocolParameters, ProtocolParametersHash}, semantic::TransactionFailureReason, slot::{EpochIndex, SlotCommitment, SlotCommitmentId, SlotIndex}, From 7a22fda94293b9f0199ca0a918b98357cabc5dbf Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 27 Nov 2023 18:58:28 +0100 Subject: [PATCH 12/41] order! --- sdk/tests/types/api/core.rs | 54 ++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 6882719d60..7e57dd0c5b 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -34,30 +34,48 @@ fn binary_response( #[test] fn responses() { + // GET /api/routes + json_response::("get-routes-response-example.json").unwrap(); + // GET /api/core/v3/info + // json_response::("get-info-response-example.json").unwrap(); + // GET /api/core/v3/accounts/{bech32Address}/congestion + // json_response::("get-congestion-estimate-response-example.json").unwrap(); + // GET /api/core/v3/rewards/{outputId} + json_response::("get-mana-rewards-example.json").unwrap(); + // GET /api/core/v3/validators + json_response::("get-validator-example.json").unwrap(); + json_response::("get-validators-example.json").unwrap(); + // GET /api/core/v3/committee + json_response::("get-committee-example.json").unwrap(); + // GET /api/core/v3/blocks/issuance + // json_response::("get-buildingBlock-response-example.json").unwrap(); + // 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-response-example-confirmed-transaction.json").unwrap(); - // json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); - // json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); - // json_response::("get-block-by-id-response-example-new-transaction.json").unwrap(); - // json_response::("get-block-by-id-response-example-new.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-buildingBlock-response-example.json").unwrap(); - // json_response::("get-commitment-response-example.json").unwrap(); - json_response::("get-committee-example.json").unwrap(); - // json_response::("get-congestion-estimate-response-example.json").unwrap(); - // json_response("get-full-output-metadata-example.json").unwrap(); - // json_response::("get-info-response-example.json").unwrap(); - json_response::("get-mana-rewards-example.json").unwrap(); - // json_response::("get-output-metadata-by-id-response-spent-example.json").unwrap(); - // json_response::("get-output-metadata-by-id-response-unspent-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(); + // json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); + // json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); + // json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); + // GET /api/core/v3/blocks/{blockId}/full + // TODO ? + // GET /api/core/v3/outputs/{outputId} // json_response("get-outputs-by-id-response-example.json").unwrap(); - json_response::("get-routes-response-example.json").unwrap(); + // GET /api/core/v3/outputs/{outputId}/metadata + // 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(); + // GET /api/core/v3/commitments/{commitmentId} + // json_response::("get-commitment-response-example.json").unwrap(); + // GET /api/core/v3/commitments/{commitmentId}/utxo-changes // json_response::("get-utxo-changes-response-example.json").unwrap(); - json_response::("get-validator-example.json").unwrap(); - json_response::("get-validators-example.json").unwrap(); - // json_response::("post-blocks-response-example.json").unwrap(); binary_response::("get-commitment-response-binary-example", &()).unwrap(); + // TODO add all remaining binary responses } From 07f73be3738c32372cea99c4b39cd4ac0877bca1 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Sun, 3 Dec 2023 15:38:47 +0100 Subject: [PATCH 13/41] Test updates --- sdk/tests/types/api/core.rs | 6 +- ...-congestion-estimate-response-example.json | 10 +- .../fixtures/get-info-response-example.json | 218 +++++++++--------- .../fixtures/get-routes-response-example.json | 12 +- 4 files changed, 123 insertions(+), 123 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 7e57dd0c5b..b844e18eef 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -41,10 +41,10 @@ fn responses() { // GET /api/core/v3/accounts/{bech32Address}/congestion // json_response::("get-congestion-estimate-response-example.json").unwrap(); // GET /api/core/v3/rewards/{outputId} - json_response::("get-mana-rewards-example.json").unwrap(); + // json_response::("get-mana-rewards-example.json").unwrap(); // GET /api/core/v3/validators - json_response::("get-validator-example.json").unwrap(); - json_response::("get-validators-example.json").unwrap(); + // json_response::("get-validator-example.json").unwrap(); + // json_response::("get-validators-example.json").unwrap(); // GET /api/core/v3/committee json_response::("get-committee-example.json").unwrap(); // GET /api/core/v3/blocks/issuance diff --git a/sdk/tests/types/api/fixtures/get-congestion-estimate-response-example.json b/sdk/tests/types/api/fixtures/get-congestion-estimate-response-example.json index 21d043e61a..0e1761603c 100644 --- a/sdk/tests/types/api/fixtures/get-congestion-estimate-response-example.json +++ b/sdk/tests/types/api/fixtures/get-congestion-estimate-response-example.json @@ -1,6 +1,6 @@ { - "slot": 20, - "ready": true, - "referenceManaCost": "50000", - "blockIssuanceCredits": "10000000" - } \ No newline at end of file + "slot": 20, + "ready": true, + "referenceManaCost": "50000", + "blockIssuanceCredits": "10000000" +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-info-response-example.json b/sdk/tests/types/api/fixtures/get-info-response-example.json index dc4ae03f56..e579f1aac9 100644 --- a/sdk/tests/types/api/fixtures/get-info-response-example.json +++ b/sdk/tests/types/api/fixtures/get-info-response-example.json @@ -1,111 +1,111 @@ { - "name": "Example Node", - "version": "1.0.0", - "status": { - "isHealthy": true, - "acceptedTangleTime": "1692966168000000000", - "relativeAcceptedTangleTime": "1692966173856059205", - "confirmedTangleTime": "1692966168000000000", - "relativeConfirmedTangleTime": "1692966173855931045", - "latestCommitmentID": "0x8fb6cbb1ecf02c6b5a6a5a6a5f6c5a6a5f6c5a6a5a6a5a6a5f6c5a6a5a6a5f6c50000000000000000", - "latestFinalizedSlot": 100, - "latestAcceptedBlockSlot": 100, - "latestConfirmedBlockSlot": 95, - "pruningEpoch": 20 - }, - "metrics": { - "blocksPerSecond": "1.5E+00", - "confirmedBlocksPerSecond": "1.5E+00", - "confirmationRate": "1E+02" - }, - "protocolParameters": [ - { - "startEpoch": 1, - "parameters": { - "type": 0, - "version": 3, - "networkName": "iota-core-testnet", - "bech32Hrp": "rms", - "storageScoreParameters": { - "storageCost": "500", - "factorData": 1, - "offsetOutputOverhead": "10", - "offsetEd25519BlockIssuerKey": "100", - "offsetStakingFeature": "100", - "storageScoreOffoffsetDelegationsetDelegation": "100" - }, - "workScoreParameters": { - "dataByte": 0, - "block": 100, - "input": 20, - "contextInput": 20, - "output": 20, - "nativeToken": 20, - "staking": 100, - "blockIssuer": 100, - "allotment": 100, - "signatureEd25519": 200 - }, - "manaParameters": { - "bitsCount": 63, - "generationRate": 1, - "generationRateExponent": 0, - "decayFactors": [ - 10, - 20 - ], - "decayFactorsExponent": 0, - "decayFactorEpochsSum": 0, - "decayFactorEpochsSumExponent": 0 - }, - "tokenSupply": "2779530283277761", - "genesisSlot": 5, - "genesisUnixTimestamp": "1692966168", - "slotDurationInSeconds": 10, - "slotsPerEpochExponent": 13, - "stakingUnbondingPeriod": 10, - "validationBlocksPerSlot": 10, - "punishmentEpochs": 10, - "livenessThresholdLowerBound": 5, - "livenessThresholdUpperBound": 10, - "minCommittableAge": 10, - "maxCommittableAge": 20, - "epochNearingThreshold": 30, - "congestionControlParameters": { - "minReferenceManaCost": "500", - "increase": "500", - "decrease": "500", - "increaseThreshold": 800000, - "decreaseThreshold": 500000, - "schedulerRate": 100000, - "maxBufferSize": 3276800, - "maxValidationBufferSize": 100 - }, - "versionSignalingParameters": { - "windowSize": 7, - "windowTargetRatio": 5, - "activationOffset": 7 - }, - "rewardsParameters": { - "profitMarginExponent": 8, - "bootstrappinDuration": 1154, - "manaShareCoefficient": "2", - "decayBalancingConstantExponent": 8, - "decayBalancingConstant": "1", - "poolCoefficientExponent": 31 - }, - "targetCommitteeSize": 32 - } + "name": "Example Node", + "version": "1.0.0", + "status": { + "isHealthy": true, + "acceptedTangleTime": "1692966168000000000", + "relativeAcceptedTangleTime": "1692966173856059205", + "confirmedTangleTime": "1692966168000000000", + "relativeConfirmedTangleTime": "1692966173855931045", + "latestCommitmentId": "0x8fb6cbb1ecf02c6b5a6a5a6a5f6c5a6a5f6c5a6a5a6a5a6a5f6c5a6a5a6a5f6c50000000000000000", + "latestFinalizedSlot": 100, + "latestAcceptedBlockSlot": 100, + "latestConfirmedBlockSlot": 95, + "pruningEpoch": 20 + }, + "metrics": { + "blocksPerSecond": "1.5E+00", + "confirmedBlocksPerSecond": "1.5E+00", + "confirmationRate": "1E+02" + }, + "protocolParameters": [ + { + "startEpoch": 1, + "parameters": { + "type": 0, + "version": 3, + "networkName": "iota-core-testnet", + "bech32Hrp": "rms", + "storageScoreParameters": { + "storageCost": "500", + "factorData": 1, + "offsetOutputOverhead": "10", + "offsetEd25519BlockIssuerKey": "100", + "offsetStakingFeature": "100", + "offsetDelegation": "100" + }, + "workScoreParameters": { + "dataByte": 0, + "block": 100, + "input": 20, + "contextInput": 20, + "output": 20, + "nativeToken": 20, + "staking": 100, + "blockIssuer": 100, + "allotment": 100, + "signatureEd25519": 200 + }, + "manaParameters": { + "bitsCount": 63, + "generationRate": 1, + "generationRateExponent": 0, + "decayFactors": [ + 10, + 20 + ], + "decayFactorsExponent": 0, + "decayFactorEpochsSum": 0, + "decayFactorEpochsSumExponent": 0 + }, + "tokenSupply": "2779530283277761", + "genesisSlot": 5, + "genesisUnixTimestamp": "1692966168", + "slotDurationInSeconds": 10, + "slotsPerEpochExponent": 13, + "stakingUnbondingPeriod": 10, + "validationBlocksPerSlot": 10, + "punishmentEpochs": 10, + "livenessThresholdLowerBound": 5, + "livenessThresholdUpperBound": 10, + "minCommittableAge": 10, + "maxCommittableAge": 20, + "epochNearingThreshold": 30, + "congestionControlParameters": { + "minReferenceManaCost": "500", + "increase": "500", + "decrease": "500", + "increaseThreshold": 800000, + "decreaseThreshold": 500000, + "schedulerRate": 100000, + "maxBufferSize": 3276800, + "maxValidationBufferSize": 100 + }, + "versionSignalingParameters": { + "windowSize": 7, + "windowTargetRatio": 5, + "activationOffset": 7 + }, + "rewardsParameters": { + "profitMarginExponent": 8, + "bootstrappingDuration": 1154, + "manaShareCoefficient": "2", + "decayBalancingConstantExponent": 8, + "decayBalancingConstant": "1", + "poolCoefficientExponent": 31 + }, + "targetCommitteeSize": 32 } - ], - "baseToken": { - "name": "Shimmer", - "tickerSymbol": "SMR", - "unit": "SMR", - "decimals": 6, - "subunit": "glow" - }, - "features": [ - [] - ] - } \ No newline at end of file + } + ], + "baseToken": { + "name": "Shimmer", + "tickerSymbol": "SMR", + "unit": "SMR", + "decimals": 6, + "subunit": "glow" + }, + "features": [ + [] + ] +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-routes-response-example.json b/sdk/tests/types/api/fixtures/get-routes-response-example.json index 9c3c9c4141..3d5b2bec66 100644 --- a/sdk/tests/types/api/fixtures/get-routes-response-example.json +++ b/sdk/tests/types/api/fixtures/get-routes-response-example.json @@ -1,7 +1,7 @@ { - "routes": [ - "core/v3", - "dashboard-metrics/v2", - "debug/v2" - ] - } \ No newline at end of file + "routes": [ + "core/v3", + "dashboard-metrics/v2", + "debug/v2" + ] +} \ No newline at end of file From d6daa8892ad537175709b2f176051e622bcb7d7c Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 09:19:16 +0100 Subject: [PATCH 14/41] Fix InfoResponse --- sdk/tests/types/api/core.rs | 2 +- .../fixtures/get-info-response-example.json | 100 +++++++++--------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index b844e18eef..17de40e566 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -37,7 +37,7 @@ fn responses() { // GET /api/routes json_response::("get-routes-response-example.json").unwrap(); // GET /api/core/v3/info - // json_response::("get-info-response-example.json").unwrap(); + json_response::("get-info-response-example.json").unwrap(); // GET /api/core/v3/accounts/{bech32Address}/congestion // json_response::("get-congestion-estimate-response-example.json").unwrap(); // GET /api/core/v3/rewards/{outputId} diff --git a/sdk/tests/types/api/fixtures/get-info-response-example.json b/sdk/tests/types/api/fixtures/get-info-response-example.json index e579f1aac9..e3e93567e4 100644 --- a/sdk/tests/types/api/fixtures/get-info-response-example.json +++ b/sdk/tests/types/api/fixtures/get-info-response-example.json @@ -1,84 +1,84 @@ { - "name": "Example Node", - "version": "1.0.0", + "name": "test", + "version": "2.0.0", "status": { - "isHealthy": true, - "acceptedTangleTime": "1692966168000000000", - "relativeAcceptedTangleTime": "1692966173856059205", - "confirmedTangleTime": "1692966168000000000", - "relativeConfirmedTangleTime": "1692966173855931045", - "latestCommitmentId": "0x8fb6cbb1ecf02c6b5a6a5a6a5f6c5a6a5f6c5a6a5a6a5a6a5f6c5a6a5a6a5f6c50000000000000000", - "latestFinalizedSlot": 100, - "latestAcceptedBlockSlot": 100, - "latestConfirmedBlockSlot": 95, - "pruningEpoch": 20 + "isHealthy": false, + "acceptedTangleTime": "1690879505000000000", + "relativeAcceptedTangleTime": "1690879505000000000", + "confirmedTangleTime": "1690879505000000000", + "relativeConfirmedTangleTime": "1690879505000000000", + "latestCommitmentId": "0xf35c9c906190e9fb02b7969ea69567e5a4bbfdbcc389f93e2b5d0c105e03979aed5b248e", + "latestFinalizedSlot": 1, + "latestAcceptedBlockSlot": 2, + "latestConfirmedBlockSlot": 3, + "pruningEpoch": 4 }, "metrics": { - "blocksPerSecond": "1.5E+00", - "confirmedBlocksPerSecond": "1.5E+00", - "confirmationRate": "1E+02" + "blocksPerSecond": "1.1E+00", + "confirmedBlocksPerSecond": "2.2E+00", + "confirmationRate": "3.3E+00" }, "protocolParameters": [ { - "startEpoch": 1, + "startEpoch": 0, "parameters": { "type": 0, "version": 3, - "networkName": "iota-core-testnet", - "bech32Hrp": "rms", + "networkName": "TestJungle", + "bech32Hrp": "tgl", "storageScoreParameters": { - "storageCost": "500", - "factorData": 1, - "offsetOutputOverhead": "10", - "offsetEd25519BlockIssuerKey": "100", - "offsetStakingFeature": "100", - "offsetDelegation": "100" + "storageCost": "0", + "factorData": 0, + "offsetOutputOverhead": "0", + "offsetEd25519BlockIssuerKey": "0", + "offsetStakingFeature": "0", + "offsetDelegation": "0" }, "workScoreParameters": { "dataByte": 0, - "block": 100, - "input": 20, - "contextInput": 20, - "output": 20, - "nativeToken": 20, - "staking": 100, - "blockIssuer": 100, - "allotment": 100, - "signatureEd25519": 200 + "block": 1, + "input": 0, + "contextInput": 0, + "output": 0, + "nativeToken": 0, + "staking": 0, + "blockIssuer": 0, + "allotment": 0, + "signatureEd25519": 0 }, "manaParameters": { "bitsCount": 63, "generationRate": 1, - "generationRateExponent": 0, + "generationRateExponent": 17, "decayFactors": [ 10, 20 ], - "decayFactorsExponent": 0, - "decayFactorEpochsSum": 0, - "decayFactorEpochsSumExponent": 0 + "decayFactorsExponent": 32, + "decayFactorEpochsSum": 2420916375, + "decayFactorEpochsSumExponent": 21 }, "tokenSupply": "2779530283277761", - "genesisSlot": 5, - "genesisUnixTimestamp": "1692966168", + "genesisSlot": 0, + "genesisUnixTimestamp": "1695275822", "slotDurationInSeconds": 10, "slotsPerEpochExponent": 13, "stakingUnbondingPeriod": 10, "validationBlocksPerSlot": 10, "punishmentEpochs": 10, - "livenessThresholdLowerBound": 5, - "livenessThresholdUpperBound": 10, + "livenessThresholdLowerBound": 15, + "livenessThresholdUpperBound": 30, "minCommittableAge": 10, "maxCommittableAge": 20, - "epochNearingThreshold": 30, + "epochNearingThreshold": 24, "congestionControlParameters": { - "minReferenceManaCost": "500", - "increase": "500", - "decrease": "500", + "minReferenceManaCost": "1", + "increase": "0", + "decrease": "0", "increaseThreshold": 800000, "decreaseThreshold": 500000, "schedulerRate": 100000, - "maxBufferSize": 3276800, + "maxBufferSize": 1000, "maxValidationBufferSize": 100 }, "versionSignalingParameters": { @@ -92,7 +92,7 @@ "manaShareCoefficient": "2", "decayBalancingConstantExponent": 8, "decayBalancingConstant": "1", - "poolCoefficientExponent": 31 + "poolCoefficientExponent": 11 }, "targetCommitteeSize": 32 } @@ -102,10 +102,10 @@ "name": "Shimmer", "tickerSymbol": "SMR", "unit": "SMR", - "decimals": 6, - "subunit": "glow" + "subunit": "glow", + "decimals": 6 }, "features": [ - [] + "test" ] } \ No newline at end of file From 0a41434dbee7759975cc2cb2d8af1f0d7eab207d Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 09:21:48 +0100 Subject: [PATCH 15/41] Fix ValidatorResponse --- sdk/tests/types/api/core.rs | 4 +- .../api/fixtures/get-committee-example.json | 36 +++++++------- .../api/fixtures/get-validator-example.json | 18 +++---- .../api/fixtures/get-validators-example.json | 48 +++++++++---------- 4 files changed, 53 insertions(+), 53 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 17de40e566..46adcf5e79 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -43,8 +43,8 @@ fn responses() { // GET /api/core/v3/rewards/{outputId} // json_response::("get-mana-rewards-example.json").unwrap(); // GET /api/core/v3/validators - // json_response::("get-validator-example.json").unwrap(); - // json_response::("get-validators-example.json").unwrap(); + json_response::("get-validator-example.json").unwrap(); + json_response::("get-validators-example.json").unwrap(); // GET /api/core/v3/committee json_response::("get-committee-example.json").unwrap(); // GET /api/core/v3/blocks/issuance diff --git a/sdk/tests/types/api/fixtures/get-committee-example.json b/sdk/tests/types/api/fixtures/get-committee-example.json index bd37ffa69e..f7f0ee3581 100644 --- a/sdk/tests/types/api/fixtures/get-committee-example.json +++ b/sdk/tests/types/api/fixtures/get-committee-example.json @@ -1,19 +1,19 @@ { - "epoch": 10, - "totalStake": "900000000", - "totalValidatorStake": "60000000", - "committee": [ - { - "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", - "poolStake": "200000", - "validatorStake": "100000", - "fixedCost": "50000" - }, - { - "address": "rms1pp4wuuz0y42caz48vv876qfpmffswsvg40zz8v79sy8cp0jfxm4kunflcgt", - "poolStake": "205000", - "validatorStake": "90000", - "fixedCost": "52000" - } - ] - } \ No newline at end of file + "epoch": 10, + "totalStake": "900000000", + "totalValidatorStake": "60000000", + "committee": [ + { + "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", + "poolStake": "200000", + "validatorStake": "100000", + "fixedCost": "50000" + }, + { + "address": "rms1pp4wuuz0y42caz48vv876qfpmffswsvg40zz8v79sy8cp0jfxm4kunflcgt", + "poolStake": "205000", + "validatorStake": "90000", + "fixedCost": "52000" + } + ] +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-validator-example.json b/sdk/tests/types/api/fixtures/get-validator-example.json index 3042a1989d..e8efd88e20 100644 --- a/sdk/tests/types/api/fixtures/get-validator-example.json +++ b/sdk/tests/types/api/fixtures/get-validator-example.json @@ -1,10 +1,10 @@ { - "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", - "stakingEpochEnd": 100, - "poolStake": "205000", - "validatorStake": "90000", - "fixedCost": "52000", - "active": true, - "latestSupportedProtocolVersion": 3, - "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" - } \ No newline at end of file + "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", + "stakingEndEpoch": 100, + "poolStake": "205000", + "validatorStake": "90000", + "fixedCost": "52000", + "active": true, + "latestSupportedProtocolVersion": 3, + "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-validators-example.json b/sdk/tests/types/api/fixtures/get-validators-example.json index 482a992c3f..c1d8dca89e 100644 --- a/sdk/tests/types/api/fixtures/get-validators-example.json +++ b/sdk/tests/types/api/fixtures/get-validators-example.json @@ -1,25 +1,25 @@ { - "validators": [ - { - "address": "rms1pp4wuuz0y42caz48vv876qfpmffswsvg40zz8v79sy8cp0jfxm4kunflcgt", - "stakingEpochEnd": 100, - "poolStake": "200000", - "validatorStake": "100000", - "fixedCost": "50000", - "active": false, - "latestSupportedProtocolVersion": 3, - "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" - }, - { - "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", - "stakingEpochEnd": 10, - "poolStake": "205000", - "validatorStake": "90000", - "fixedCost": "52000", - "active": true, - "latestSupportedProtocolVersion": 3, - "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" - } - ], - "pageSize": 50 - } \ No newline at end of file + "validators": [ + { + "address": "rms1pp4wuuz0y42caz48vv876qfpmffswsvg40zz8v79sy8cp0jfxm4kunflcgt", + "stakingEndEpoch": 100, + "poolStake": "200000", + "validatorStake": "100000", + "fixedCost": "50000", + "active": false, + "latestSupportedProtocolVersion": 3, + "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" + }, + { + "address": "rms1pqm4xk8e9ny5w5rxjkvtp249tfhlwvcshyr3pc0665jvp7g3hc875k538hl", + "stakingEndEpoch": 10, + "poolStake": "205000", + "validatorStake": "90000", + "fixedCost": "52000", + "active": true, + "latestSupportedProtocolVersion": 3, + "latestSupportedProtocolHash": "0x0c00425134785bf2dbe42e4ec7e288009ebdc38ced797beaa45d5213092021cb" + } + ], + "pageSize": 50 +} \ No newline at end of file From deb02843e236a6ed02cb5092f30b7bc210d0e0df Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 09:22:41 +0100 Subject: [PATCH 16/41] Fix ManaRewardsResponse --- sdk/tests/types/api/core.rs | 2 +- .../types/api/fixtures/get-mana-rewards-example.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 46adcf5e79..b670bb22e8 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -41,7 +41,7 @@ fn responses() { // GET /api/core/v3/accounts/{bech32Address}/congestion // json_response::("get-congestion-estimate-response-example.json").unwrap(); // GET /api/core/v3/rewards/{outputId} - // json_response::("get-mana-rewards-example.json").unwrap(); + json_response::("get-mana-rewards-example.json").unwrap(); // GET /api/core/v3/validators json_response::("get-validator-example.json").unwrap(); json_response::("get-validators-example.json").unwrap(); diff --git a/sdk/tests/types/api/fixtures/get-mana-rewards-example.json b/sdk/tests/types/api/fixtures/get-mana-rewards-example.json index 48ffb83cc3..099e5b4193 100644 --- a/sdk/tests/types/api/fixtures/get-mana-rewards-example.json +++ b/sdk/tests/types/api/fixtures/get-mana-rewards-example.json @@ -1,5 +1,5 @@ { - "epochStart": 60, - "epochEnd": 80, - "rewards": "800000" - } \ No newline at end of file + "startEpoch": 60, + "endEpoch": 80, + "rewards": "800000" +} \ No newline at end of file From 3c46a64cf166735dae30f090c6575a176d9ed07b Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 09:23:28 +0100 Subject: [PATCH 17/41] Fix CongestionResponse --- sdk/tests/types/api/core.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index b670bb22e8..515cb555d7 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -39,7 +39,7 @@ fn responses() { // GET /api/core/v3/info json_response::("get-info-response-example.json").unwrap(); // GET /api/core/v3/accounts/{bech32Address}/congestion - // json_response::("get-congestion-estimate-response-example.json").unwrap(); + json_response::("get-congestion-estimate-response-example.json").unwrap(); // GET /api/core/v3/rewards/{outputId} json_response::("get-mana-rewards-example.json").unwrap(); // GET /api/core/v3/validators From 9f38c62b3ae89fef02a157efc4d729000bebe0aa Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 09:42:10 +0100 Subject: [PATCH 18/41] Improve binary_response --- sdk/tests/types/api/core.rs | 9 +++++++-- .../api/fixtures/get-commitment-response-binary-example | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 515cb555d7..105bfb8bf9 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -10,6 +10,7 @@ use iota_sdk::types::{ }; use packable::{ error::{UnexpectedEOF, UnpackError}, + unpacker::SliceUnpacker, Packable, PackableExt, }; use serde::Deserialize; @@ -28,8 +29,12 @@ fn binary_response( ) -> Result::UnpackError, UnexpectedEOF>> { let file = std::fs::read_to_string(&format!("./tests/types/api/fixtures/{path}")).unwrap(); let bytes = hex::decode(file).unwrap(); - T::unpack_verified(bytes, visitor) - // TODO check there is no bytes left + let mut unpacker = SliceUnpacker::new(bytes.as_slice()); + let res = T::unpack::<_, true>(&mut unpacker, visitor); + + assert!(u8::unpack::<_, true>(&mut unpacker, &()).is_err()); + + res } #[test] diff --git a/sdk/tests/types/api/fixtures/get-commitment-response-binary-example b/sdk/tests/types/api/fixtures/get-commitment-response-binary-example index 33f92e11ef..23453fa61e 100644 --- a/sdk/tests/types/api/fixtures/get-commitment-response-binary-example +++ b/sdk/tests/types/api/fixtures/get-commitment-response-binary-example @@ -1 +1 @@ -070000000a1a0000977c626276b19ef8b3c445709f2f0f2ccc4abb98d97617f421f240c0d1ee066d4306e67a0321889ef8ec89b7eff1378049e058f0fa87a78c2452ae72631a5a99d913d1cbb3525b8faa1800e28dfcb28154bcba10154c39ef87ceda793cb44f58ae1549c88ea13fe4a9695bb6f0aba6cb756522209e5066a96039ae12b398b975693bdc21e222997c86ff9bfc5844f0372d58ff6fa510688e53c181bbdf4db41f9b627540a70e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a80000000300d85e5b1590d898d1e0cdebb2e3b5337c8b76270142663d78811683ba47c17c989ad7a8f0ff2c6438bf435786d4a5b0125a5caf7367061b49a739389d5ebea234c0466c86f88a3f8add03bff04c2e34b214683f2f6983641e1d1185da7e2c3e0200d9922819a39e94ddf3907f4b9c8df93f39f026244fcb609205b9a879022599f218be2536d8b7b8547faa3dbdfe98339ebe9e2b2417a8a03eee02b2a8312b9e026dd0a33261a58a240cd0a1b06cdf1775d98d316f162d3eec402f4bf08bea2a0700f9d9656a60049083eef61487632187b351294c1fa23d118060d813db6d03e8b6ca8180d435708e826bc2042ccd667babb59c5cc461ff29dba966359fcd6fc511cdfdf10d6576f36ac2a6e5cb691e13968c13947ffbd9239939d3802b2fbe0f06 \ No newline at end of file +0312000000075b05e0a8fd4b9c7e7bc165b62c48945292f7d76d23f76525f886c416dc0e364089b57c32ddb8c614ed1d2c844401d2a5325b4d153c7f94464bbda3a8d14289b203f96759000000000000009000000000000000 \ No newline at end of file From 561c620119e2b43990ef0718003a26af448fbad1 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 10:11:10 +0100 Subject: [PATCH 19/41] Fix UtxoChangesResponse --- sdk/tests/types/api/core.rs | 2 +- .../get-utxo-changes-response-example.json | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 105bfb8bf9..43e9e3a5e0 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -79,7 +79,7 @@ fn responses() { // GET /api/core/v3/commitments/{commitmentId} // json_response::("get-commitment-response-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId}/utxo-changes - // json_response::("get-utxo-changes-response-example.json").unwrap(); + json_response::("get-utxo-changes-response-example.json").unwrap(); binary_response::("get-commitment-response-binary-example", &()).unwrap(); // TODO add all remaining binary responses diff --git a/sdk/tests/types/api/fixtures/get-utxo-changes-response-example.json b/sdk/tests/types/api/fixtures/get-utxo-changes-response-example.json index f6cd798004..d0d83cbec8 100644 --- a/sdk/tests/types/api/fixtures/get-utxo-changes-response-example.json +++ b/sdk/tests/types/api/fixtures/get-utxo-changes-response-example.json @@ -1,11 +1,11 @@ { - "slot": 789, - "createdOutputs": [ - "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2", - "0x3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4" - ], - "consumedOutputs": [ - "0x5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6", - "0x7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7" - ] - } \ No newline at end of file + "commitmentId": "0x3b264c038283c30094e0cb5d22eaa52c9959bfda084ace3980b30d4be588fa0012000000", + "createdOutputs": [ + "0x2628fd7c1ad5dd635fa76c6f4c2272fbdb658cc3437dbed07f9984580b227b63f0a3e4d40000", + "0xfa3d71ea93849b317c2b29c928b726b6d3bd2131c7ad560c9e28952f117fd50c35d6e0890000" + ], + "consumedOutputs": [ + "0xfa3d71ea93849b317c2b29c928b726b6d3bd2131c7ad560c9e28952f117fd50c35d6e0890100", + "0x9c40a07de878863fbda03caeb68875254c49199e6b55740f78a4bab3686f89957b1249130000" + ] +} \ No newline at end of file From 151b803ebc34a065c4841991ad266cdc786f8748 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Wed, 6 Dec 2023 10:12:04 +0100 Subject: [PATCH 20/41] Fix SlotCommitment --- sdk/tests/types/api/core.rs | 2 +- .../fixtures/get-commitment-response-example.json | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 43e9e3a5e0..b3654d8862 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -77,7 +77,7 @@ fn responses() { // GET /api/core/v3/outputs/{outputId}/full // json_response("get-full-output-metadata-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId} - // json_response::("get-commitment-response-example.json").unwrap(); + json_response::("get-commitment-response-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId}/utxo-changes json_response::("get-utxo-changes-response-example.json").unwrap(); diff --git a/sdk/tests/types/api/fixtures/get-commitment-response-example.json b/sdk/tests/types/api/fixtures/get-commitment-response-example.json index c453c7d2ad..e9c6ad0837 100644 --- a/sdk/tests/types/api/fixtures/get-commitment-response-example.json +++ b/sdk/tests/types/api/fixtures/get-commitment-response-example.json @@ -1,8 +1,8 @@ { - "protocolVersion": 3, - "slot": 986, - "previousCommitmentId": "0x8fb6cbb1ecf02c6b5a6a5a6a5f6c5a6a5f6c5a6a5a6a5a6a5f6c5a6a5a6a5f6c50000000000000000", - "rootsId": "0xa4dd36465af63d495d35a05f592d42a51511c153e1bae8fad00453c8cbb48727", - "cumulativeWeight": "78901", - "referenceManaCost": "600" - } \ No newline at end of file + "protocolVersion": 3, + "slot": 986, + "previousCommitmentId": "0xd91549dbf441da4c7e50063b58c05d5b2bfb1d33b346a2f9a18220ce6207f7a289010000", + "rootsId": "0x6a8f424929e1f08d87a204efc8a60499b789465aaa28178b77debe75cc2915d3", + "cumulativeWeight": "78901", + "referenceManaCost": "600" +} \ No newline at end of file From 244523294c9ab7ca202b88f3c3818d3b4f0a42cb Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 11 Dec 2023 10:05:46 +0100 Subject: [PATCH 21/41] Fix InfoResponse test --- sdk/tests/types/api/fixtures/get-info-response-example.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdk/tests/types/api/fixtures/get-info-response-example.json b/sdk/tests/types/api/fixtures/get-info-response-example.json index e3e93567e4..9c5e7c3915 100644 --- a/sdk/tests/types/api/fixtures/get-info-response-example.json +++ b/sdk/tests/types/api/fixtures/get-info-response-example.json @@ -56,7 +56,8 @@ ], "decayFactorsExponent": 32, "decayFactorEpochsSum": 2420916375, - "decayFactorEpochsSumExponent": 21 + "decayFactorEpochsSumExponent": 21, + "annualDecayFactorPercentage": 50 }, "tokenSupply": "2779530283277761", "genesisSlot": 0, @@ -94,7 +95,8 @@ "decayBalancingConstant": "1", "poolCoefficientExponent": 11 }, - "targetCommitteeSize": 32 + "targetCommitteeSize": 32, + "chainSwitchingThreshold": 2 } } ], From 698b7762f1fb625ececa0f9e59591b47e30d35ee Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 11 Dec 2023 10:07:45 +0100 Subject: [PATCH 22/41] Fix IssuanceBlockHeaderResponse --- sdk/tests/types/api/core.rs | 2 +- .../get-buildingBlock-response-example.json | 45 ++++++++++--------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index b3654d8862..4daf6d6c79 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -53,7 +53,7 @@ fn responses() { // GET /api/core/v3/committee json_response::("get-committee-example.json").unwrap(); // GET /api/core/v3/blocks/issuance - // json_response::("get-buildingBlock-response-example.json").unwrap(); + json_response::("get-buildingBlock-response-example.json").unwrap(); // POST /api/core/v3/blocks // json_response::("post-blocks-response-example.json").unwrap(); // GET /api/core/v3/blocks/{blockId} diff --git a/sdk/tests/types/api/fixtures/get-buildingBlock-response-example.json b/sdk/tests/types/api/fixtures/get-buildingBlock-response-example.json index f69a9b4e51..51c5c29f40 100644 --- a/sdk/tests/types/api/fixtures/get-buildingBlock-response-example.json +++ b/sdk/tests/types/api/fixtures/get-buildingBlock-response-example.json @@ -1,23 +1,24 @@ { - "strongParents": [ - "0x4f746934d0075179a37ca3e807b7e793ec4ec9189ba31c9ad092d7497b01118c1000000000000000", - "0x59daaaba1cd10cd268966376e17710d100c90826fe258753d461acac99b7e3341500000000000000" - ], - "weakParents": [ - "0xebb058f1f1c8f1ac6508465deeee1dd090396f9e6e2b5c103eef5583f20a0c133a00000000000000", - "0xb173e2d2b6f72600f00da84492ddb6eadee703dc39fb846725828059272093fb3b00000000000000" - ], - "shallowLikeParents": [ - "0xdbf86c778d69f413296c2d4d3086d76c74bf4d719e6e95c03a3d9a955ed39bcf3e00000000000000", - "0xf15b2ec698e396c9d2e69bc753246631aedebb657da09ba0e0c8d42518a1e8953e00000000000000" - ], - "latestFinalizedSlot": 1422, - "commitment": { - "protocolVersion": 3, - "slot": 1432, - "previousCommitmentId": "0xbf07dc16986166953f5a72c19d78642aab6cbde63964a2369ec3d425144eb42b3800000000000000", - "rootsId": "0xa4dd36465af63d495d35a05f592d42a51511c153e1bae8fad00453c8cbb48727", - "cumulativeWeight": "45678", - "referenceManaCost": "12345" - } - } \ No newline at end of file + "strongParents": [ + "0x0482f0eba39a23c9a13072c93d828b55543132c47f5f57514d9e55535e9d4f4f35000000", + "0xae7c4f55a6db8bf4841e4a38f06d32ab9bd88b927a6ba0bc19bcb19c625ff8b63c000000" + ], + "weakParents": [ + "0x67e57f7446b5a6f152afabb17c6077c26512278a275310a7ff2fa513f4e0b7383d000000", + "0x2e65c319e9a2c4a6ff7195f9a1ed896c43d0dded1b906979316d502b158965c23d000000" + ], + "shallowLikeParents": [ + "0xe5fe5231630afaaba609af76787ff1ec9c6088dd17e9cf922152b3facd7bd5883e000000", + "0xed4b771b5413f5118dd80021ca07fb727e4c54eec9d28d6566c28cc81e7d267c3f000000" + ], + "latestParentBlockIssuingTime": "1690879505000000000", + "latestFinalizedSlot": 1422, + "latestCommitment": { + "protocolVersion": 3, + "slot": 1432, + "previousCommitmentId": "0xc0300d55fe2cdc93191e52685da009f53d40883ae111291e550eed4e7eb7752746010000", + "rootsId": "0x6a8f424929e1f08d87a204efc8a60499b789465aaa28178b77debe75cc2915d3", + "cumulativeWeight": "45678", + "referenceManaCost": "12345" + } +} \ No newline at end of file From a4d39eb9c5cb699b5cc1c79826fe3a2e56cc548c Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 11 Dec 2023 10:35:04 +0100 Subject: [PATCH 23/41] Fix OutputMetadata --- sdk/tests/types/api/core.rs | 4 ++-- ...metadata-by-id-response-spent-example.json | 23 +++++++++++-------- ...tadata-by-id-response-unspent-example.json | 16 +++++++------ 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 4daf6d6c79..46c78c6a61 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -72,8 +72,8 @@ fn responses() { // GET /api/core/v3/outputs/{outputId} // json_response("get-outputs-by-id-response-example.json").unwrap(); // GET /api/core/v3/outputs/{outputId}/metadata - // json_response::("get-output-metadata-by-id-response-unspent-example.json").unwrap(); - // json_response::("get-output-metadata-by-id-response-spent-example.json").unwrap(); + 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(); // GET /api/core/v3/commitments/{commitmentId} diff --git a/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-spent-example.json b/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-spent-example.json index 4be8a7be76..963167465b 100644 --- a/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-spent-example.json +++ b/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-spent-example.json @@ -1,10 +1,15 @@ { - "blockId": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75", - "transactionId": "0x1c52e8e630d1c6e45ab6f46c63d8d6cb02e6c2ed6e31b6c97d6f5c5f5a5d5c5b", - "outputIndex": 3, - "isSpent": true, - "commitmentIdSpent": "0x4b91c935926c77d0ac9b4a569c3eb3b0f0c9918f2d4f4d9bb1c7dfc19b41e4c2", - "transactionIdSpent": "0x1ee46e19f4219ee65afc10227d0ca22753f76ef32d1e922e5cbe3fbc9b5a5298", - "includedCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a", - "latestCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a" - } \ No newline at end of file + "outputId": "0x3130f21c723fa597805763739f3a2a40b674af6b4071ef0494331b644a7e4d52000000001300", + "blockId": "0x19e589687082d8f535779df3244908ad6a7b380906fb7ae24efb5fad8a5cfb92a8f8d9a3", + "included": { + "slot": 5, + "transactionId": "0x3e766157614a3a0e13dbb937b5fb1ef5d1555479c19df80445d03a6710f39d75668bd326", + "commitmentId": "0x7387ebe23a3ac1732fcdb6cef77fc003e1fa6e2dad89dd664df249d6aa2dbdc157dec2c6" + }, + "spent": { + "slot": 8, + "transactionId": "0x3896f1ede7cbdacbbb4b17f13e953ad45ce0969ea34cc766b5dafe2a15b3e46f998ef4e5", + "commitmentId": "0x26fa9fcbddcf944ced3fd16a73d9c8b2b49dc54dba7629b02da69f7e01249063e7398b2c" + }, + "latestCommitmentId": "0x42a88617c2c4ba2b58f82c8b85524720cdbe3642401e7c613f215658d617c569d1219909" +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-unspent-example.json b/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-unspent-example.json index 37e4f88e39..def68cb4a8 100644 --- a/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-unspent-example.json +++ b/sdk/tests/types/api/fixtures/get-output-metadata-by-id-response-unspent-example.json @@ -1,8 +1,10 @@ { - "blockId": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75", - "transactionId": "0x1c52e8e630d1c6e45ab6f46c63d8d6cb02e6c2ed6e31b6c97d6f5c5f5a5d5c5b", - "outputIndex": 3, - "isSpent": false, - "includedCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a", - "latestCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a" - } \ No newline at end of file + "outputId": "0x3477de28a45c565eed3603ab9e90ce0f0d38e8860a3c5ff64ccc70252aab7c9d000000004600", + "blockId": "0x1aaaa9ad9c15c6cd601a5aa5bd61b85428263978a26343949dad9ff89635e7104f1f271b", + "included": { + "slot": 5, + "transactionId": "0xfdd9e96bac5e4f029b3261c00cd3c74fb4c389184a2018c979d4f31fc1ef53c99add5c74", + "commitmentId": "0xd20959ac38938fddee472bbfd47644da3087a39499cd04e86c9c70fa9c8c0516a81b8aea" + }, + "latestCommitmentId": "0xba4456279dce23cfca37938685c039ea7c72001c1cd8becf72b195a8727cdfd07949d697" +} \ No newline at end of file From 8aa1b345e2b76becb5f189557f0bfecdbaad6b80 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 11 Dec 2023 10:40:35 +0100 Subject: [PATCH 24/41] OutputWithMetadata --- sdk/tests/types/api/core.rs | 8 ++- .../get-full-output-metadata-example.json | 62 +++++++++++-------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 46c78c6a61..b23ceb3cbf 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -6,7 +6,11 @@ use iota_sdk::types::{ CommitteeResponse, CongestionResponse, InfoResponse, IssuanceBlockHeaderResponse, ManaRewardsResponse, RoutesResponse, UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, }, - block::{output::OutputMetadata, slot::SlotCommitment, BlockDto, BlockId}, + block::{ + output::{OutputMetadata, OutputWithMetadata}, + slot::SlotCommitment, + BlockDto, BlockId, + }, }; use packable::{ error::{UnexpectedEOF, UnpackError}, @@ -75,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-full-output-metadata-example.json b/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json index 2743ca5885..14cdaa1415 100644 --- a/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json +++ b/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json @@ -1,32 +1,40 @@ { - "output": { - "type": 3, - "amount": "1000", - "unlockConditions": [ - { + "output": { + "type": 3, + "amount": "1000", + "unlockConditions": [ + { + "type": 0, + "address": { "type": 0, - "address": { - "type": 0, - "pubKeyHash": "0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" - } + "pubKeyHash": "0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" } - ], - "mana": "2000" + } + ], + "mana": "2000" + }, + "outputIdProof": { + "slot": 1893592032, + "outputIndex": 0, + "transactionCommitment": "0xa0687905318860e64db6932d8423bf7a4418627baee62be8089d5f48aaa1af3a", + "outputCommitmentProof": { + "type": 2, + "hash": "0x7f9289b104a55e6fb93d60d70f6e85c9706c761b05ccc034f76b465837ca6070" + } + }, + "metadata": { + "outputId": "0x3130f21c723fa597805763739f3a2a40b674af6b4071ef0494331b644a7e4d52000000001300", + "blockId": "0x19e589687082d8f535779df3244908ad6a7b380906fb7ae24efb5fad8a5cfb92a8f8d9a3", + "included": { + "slot": 5, + "transactionId": "0x3e766157614a3a0e13dbb937b5fb1ef5d1555479c19df80445d03a6710f39d75668bd326", + "commitmentId": "0x7387ebe23a3ac1732fcdb6cef77fc003e1fa6e2dad89dd664df249d6aa2dbdc157dec2c6" }, - "outputIdProof": { - "slot": 20, - "outputIndex": 0, - "transactionCommitment": "0x897dr69bfa60c8cf80afd730741862d200405d5df7cabfe9b564361dce1f7036", - "outputCommitmentProof": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75" + "spent": { + "slot": 8, + "transactionId": "0x3896f1ede7cbdacbbb4b17f13e953ad45ce0969ea34cc766b5dafe2a15b3e46f998ef4e5", + "commitmentId": "0x26fa9fcbddcf944ced3fd16a73d9c8b2b49dc54dba7629b02da69f7e01249063e7398b2c" }, - "metadata": { - "blockId": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75", - "transactionId": "0x1c52e8e630d1c6e45ab6f46c63d8d6cb02e6c2ed6e31b6c97d6f5c5f5a5d5c5b", - "outputIndex": 3, - "isSpent": true, - "commitmentIdSpent": "0x4b91c935926c77d0ac9b4a569c3eb3b0f0c9918f2d4f4d9bb1c7dfc19b41e4c2", - "transactionIdSpent": "0x1ee46e19f4219ee65afc10227d0ca22753f76ef32d1e922e5cbe3fbc9b5a5298", - "includedCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a", - "latestCommitmentId": "0x7c62d9b9ed3c1f3ef942a7ea17ec1270d77c109f0ba57b6c2d2b9e9fb3e69a3a" - } - } \ No newline at end of file + "latestCommitmentId": "0x42a88617c2c4ba2b58f82c8b85524720cdbe3642401e7c613f215658d617c569d1219909" + } +} \ No newline at end of file From a867a8c93140dad41acf5e166dc3fee769fff207 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 11 Jan 2024 15:26:22 +0100 Subject: [PATCH 25/41] Fix get-info-response-example --- sdk/tests/types/api/fixtures/get-info-response-example.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/tests/types/api/fixtures/get-info-response-example.json b/sdk/tests/types/api/fixtures/get-info-response-example.json index 9c5e7c3915..96ef9bd13f 100644 --- a/sdk/tests/types/api/fixtures/get-info-response-example.json +++ b/sdk/tests/types/api/fixtures/get-info-response-example.json @@ -93,7 +93,8 @@ "manaShareCoefficient": "2", "decayBalancingConstantExponent": 8, "decayBalancingConstant": "1", - "poolCoefficientExponent": 11 + "poolCoefficientExponent": 11, + "retentionPeriod": 684 }, "targetCommitteeSize": 32, "chainSwitchingThreshold": 2 From d837c0841f76f076ba64e9e683e75d85a020c3fe Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 11 Jan 2024 15:27:46 +0100 Subject: [PATCH 26/41] Fix get-mana-rewards-example --- sdk/tests/types/api/fixtures/get-mana-rewards-example.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/tests/types/api/fixtures/get-mana-rewards-example.json b/sdk/tests/types/api/fixtures/get-mana-rewards-example.json index 099e5b4193..247fdd0744 100644 --- a/sdk/tests/types/api/fixtures/get-mana-rewards-example.json +++ b/sdk/tests/types/api/fixtures/get-mana-rewards-example.json @@ -1,5 +1,6 @@ { "startEpoch": 60, "endEpoch": 80, - "rewards": "800000" + "rewards": "800000", + "latestCommittedEpochPoolRewards": "0" } \ No newline at end of file From fc1113e9e207757ac2e016b1bc4c678be224eeda Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 11 Jan 2024 15:29:16 +0100 Subject: [PATCH 27/41] Fix get-validators-example --- sdk/tests/types/api/fixtures/get-validators-example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tests/types/api/fixtures/get-validators-example.json b/sdk/tests/types/api/fixtures/get-validators-example.json index c1d8dca89e..542562af81 100644 --- a/sdk/tests/types/api/fixtures/get-validators-example.json +++ b/sdk/tests/types/api/fixtures/get-validators-example.json @@ -1,5 +1,5 @@ { - "validators": [ + "stakers": [ { "address": "rms1pp4wuuz0y42caz48vv876qfpmffswsvg40zz8v79sy8cp0jfxm4kunflcgt", "stakingEndEpoch": 100, From 0ede853f4899436269d23c9b3d0ee2f9a2dbb104 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 11 Jan 2024 15:40:52 +0100 Subject: [PATCH 28/41] 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 From 093da974b762d5addbddc97fad809c97f34d5649 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 18 Jan 2024 13:48:40 +0100 Subject: [PATCH 29/41] BlockMetadataResponse --- sdk/tests/types/api/core.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 2114210c20..aae46bdbea 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -3,8 +3,8 @@ use iota_sdk::types::{ api::core::{ - CommitteeResponse, CongestionResponse, InfoResponse, IssuanceBlockHeaderResponse, ManaRewardsResponse, - RoutesResponse, UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, + BlockMetadataResponse, CommitteeResponse, CongestionResponse, InfoResponse, IssuanceBlockHeaderResponse, + ManaRewardsResponse, RoutesResponse, UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, }, block::{ output::{OutputMetadata, OutputWithMetadata}, @@ -66,11 +66,11 @@ fn responses() { // 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(); - // json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); - // json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); - // json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); + // json_response::("get-block-by-id-response-example-new-transaction.json").unwrap(); + // json_response::("get-block-by-id-response-example-new.json").unwrap(); + // json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); + // json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); + // json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); // GET /api/core/v3/blocks/{blockId}/full // TODO ? // GET /api/core/v3/outputs/{outputId} From df90ba8cdfdc8f2062b6498417c8a8224eb32b6a Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 18 Jan 2024 15:19:57 +0100 Subject: [PATCH 30/41] Compare json values --- sdk/tests/types/api/core.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index aae46bdbea..0ff09312d1 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -17,14 +17,21 @@ use packable::{ unpacker::SliceUnpacker, Packable, PackableExt, }; -use serde::Deserialize; +use pretty_assertions::assert_eq; +use serde::{Deserialize, Serialize}; fn json_response(path: &str) -> Result where - for<'a> T: Deserialize<'a>, + for<'a> T: Serialize + Deserialize<'a>, { let file = std::fs::read_to_string(&format!("./tests/types/api/fixtures/{path}")).unwrap(); - serde_json::from_str::(&file) + let value_des = serde_json::from_str::(&file)?; + let t = serde_json::from_value::(value_des.clone())?; + let value_ser = serde_json::to_value(&t)?; + + assert_eq!(value_des, value_ser); + + Ok(t) } fn binary_response( @@ -66,7 +73,7 @@ fn responses() { // 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-transaction.json").unwrap(); // json_response::("get-block-by-id-response-example-new.json").unwrap(); // json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); // json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); From 7c28c568f1113267e51644029af315e3a32c5324 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 22 Jan 2024 10:47:11 +0100 Subject: [PATCH 31/41] Some fixes --- sdk/tests/types/api/core.rs | 10 +++++----- ...k-by-id-response-example-confirmed-transaction.json | 9 ++++++--- .../get-block-by-id-response-example-confirmed.json | 6 +++--- ...by-id-response-example-conflicting-transaction.json | 9 ++++++--- ...t-block-by-id-response-example-new-transaction.json | 9 ++++++--- .../fixtures/get-block-by-id-response-example-new.json | 6 +++--- 6 files changed, 29 insertions(+), 20 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 0ff09312d1..9b01e7b4b8 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -29,7 +29,7 @@ where let t = serde_json::from_value::(value_des.clone())?; let value_ser = serde_json::to_value(&t)?; - assert_eq!(value_des, value_ser); + // assert_eq!(value_des, value_ser); Ok(t) } @@ -74,10 +74,10 @@ fn responses() { 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(); - // json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); - // json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); - // json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); + json_response::("get-block-by-id-response-example-new.json").unwrap(); + json_response::("get-block-by-id-response-example-confirmed-transaction.json").unwrap(); + json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); + json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); // GET /api/core/v3/blocks/{blockId}/full // TODO ? // GET /api/core/v3/outputs/{outputId} diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed-transaction.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed-transaction.json index 8fc9a95809..c997aa439c 100644 --- a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed-transaction.json +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed-transaction.json @@ -1,5 +1,8 @@ { - "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", - "blockState": "confirmed", + "blockId": "0xf7ac0552041789a3931ae76eafa47df063632cddd3f8b11bd0bfffba1bc8c46800000000", + "blockState": "confirmed", + "transactionMetadata": { + "transactionId": "0x72f0dfa9ad116ade8bdac8ef291ed2fb8065c6c75d5d3666e8b2053696c94a9e00001000", "transactionState": "confirmed" - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed.json index 0c20539d5b..b85fc2bf65 100644 --- a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed.json +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-confirmed.json @@ -1,4 +1,4 @@ { - "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", - "blockState": "confirmed" - } \ No newline at end of file + "blockId": "0x3848a6d17070830206e5032fbce2ae3939e60eec0816546e074316b1f66977d04d010000", + "blockState": "confirmed" +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-conflicting-transaction.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-conflicting-transaction.json index 633aa1d166..366ef2fc87 100644 --- a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-conflicting-transaction.json +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-conflicting-transaction.json @@ -1,6 +1,9 @@ { - "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", - "blockState": "confirmed", + "blockId": "0x3848a6d17070830206e5032fbce2ae3939e60eec0816546e074316b1f66977d04d010000", + "blockState": "confirmed", + "transactionMetadata": { + "transactionId": "0x72f0dfa9ad116ade8bdac8ef291ed2fb8065c6c75d5d3666e8b2053696c94a9e00001000", "transactionState": "failed", "transactionFailureReason": 2 - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new-transaction.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new-transaction.json index 282cdb627b..5d87ad7244 100644 --- a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new-transaction.json +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new-transaction.json @@ -1,5 +1,8 @@ { - "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", - "blockState": "pending", + "blockId": "0x0482f0eba39a23c9a13072c93d828b55543132c47f5f57514d9e55535e9d4f4f35000000", + "blockState": "pending", + "transactionMetadata": { + "transactionId": "0x72f0dfa9ad116ade8bdac8ef291ed2fb8065c6c75d5d3666e8b2053696c94a9e00001000", "transactionState": "pending" - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new.json b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new.json index c4a1efcdce..44fc4e478d 100644 --- a/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new.json +++ b/sdk/tests/types/api/fixtures/get-block-by-id-response-example-new.json @@ -1,4 +1,4 @@ { - "blockId": "0x8e7c2d36c236f7d44f26cf8c70b3d99e18e7d7390b32c9637c08c086d9475e6a", - "blockState": "pending" - } \ No newline at end of file + "blockId": "0x0482f0eba39a23c9a13072c93d828b55543132c47f5f57514d9e55535e9d4f4f35000000", + "blockState": "pending" +} \ No newline at end of file From 715350cc5424929cea4572faecdd326054685d36 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 22 Jan 2024 10:53:42 +0100 Subject: [PATCH 32/41] Add BlockWithMetadataResponse test --- sdk/tests/types/api/core.rs | 10 +++-- ...ck-by-id-tagged-data-response-example.json | 38 +++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 sdk/tests/types/api/fixtures/get-full-block-by-id-tagged-data-response-example.json diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 9b01e7b4b8..79e36311f0 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -3,8 +3,9 @@ use iota_sdk::types::{ api::core::{ - BlockMetadataResponse, CommitteeResponse, CongestionResponse, InfoResponse, IssuanceBlockHeaderResponse, - ManaRewardsResponse, RoutesResponse, UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, + BlockMetadataResponse, BlockWithMetadataResponse, CommitteeResponse, CongestionResponse, InfoResponse, + IssuanceBlockHeaderResponse, ManaRewardsResponse, RoutesResponse, UtxoChangesResponse, ValidatorResponse, + ValidatorsResponse, }, block::{ output::{OutputMetadata, OutputWithMetadata}, @@ -59,8 +60,9 @@ fn responses() { // GET /api/core/v3/rewards/{outputId} json_response::("get-mana-rewards-example.json").unwrap(); // GET /api/core/v3/validators - json_response::("get-validator-example.json").unwrap(); json_response::("get-validators-example.json").unwrap(); + // GET /api/core/v3/validators/{bech32Address} + json_response::("get-validator-example.json").unwrap(); // GET /api/core/v3/committee json_response::("get-committee-example.json").unwrap(); // GET /api/core/v3/blocks/issuance @@ -79,7 +81,7 @@ fn responses() { json_response::("get-block-by-id-response-example-confirmed.json").unwrap(); json_response::("get-block-by-id-response-example-conflicting-transaction.json").unwrap(); // GET /api/core/v3/blocks/{blockId}/full - // TODO ? + json_response::("get-full-block-by-id-tagged-data-response-example.json").unwrap(); // GET /api/core/v3/outputs/{outputId} // json_response("get-outputs-by-id-response-example.json").unwrap(); // GET /api/core/v3/outputs/{outputId}/metadata diff --git a/sdk/tests/types/api/fixtures/get-full-block-by-id-tagged-data-response-example.json b/sdk/tests/types/api/fixtures/get-full-block-by-id-tagged-data-response-example.json new file mode 100644 index 0000000000..155cbceb74 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-full-block-by-id-tagged-data-response-example.json @@ -0,0 +1,38 @@ +{ + "block": { + "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" + } + }, + "metadata": { + "blockId": "0x1d5f495c0f4b883cf2c79cafd382c73484c65651099329e3b0b4c969c35d620004000000", + "blockState": "confirmed" + } + } \ No newline at end of file From 4b41c90641d06ddae4dc5131040b67fa333980a7 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 22 Jan 2024 11:20:14 +0100 Subject: [PATCH 33/41] Fix OutputResponse --- sdk/tests/types/api/core.rs | 8 +-- .../get-outputs-by-id-response-example.json | 58 +++++++++++++------ 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 79e36311f0..13727a0dd4 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -4,11 +4,11 @@ use iota_sdk::types::{ api::core::{ BlockMetadataResponse, BlockWithMetadataResponse, CommitteeResponse, CongestionResponse, InfoResponse, - IssuanceBlockHeaderResponse, ManaRewardsResponse, RoutesResponse, UtxoChangesResponse, ValidatorResponse, - ValidatorsResponse, + IssuanceBlockHeaderResponse, ManaRewardsResponse, OutputResponse, RoutesResponse, UtxoChangesResponse, + ValidatorResponse, ValidatorsResponse, }, block::{ - output::{OutputMetadata, OutputWithMetadata}, + output::{Output, OutputMetadata, OutputWithMetadata}, slot::SlotCommitment, BlockDto, BlockId, }, @@ -83,7 +83,7 @@ fn responses() { // GET /api/core/v3/blocks/{blockId}/full json_response::("get-full-block-by-id-tagged-data-response-example.json").unwrap(); // GET /api/core/v3/outputs/{outputId} - // json_response("get-outputs-by-id-response-example.json").unwrap(); + json_response::("get-outputs-by-id-response-example.json").unwrap(); // GET /api/core/v3/outputs/{outputId}/metadata json_response::("get-output-metadata-by-id-response-unspent-example.json").unwrap(); json_response::("get-output-metadata-by-id-response-spent-example.json").unwrap(); diff --git a/sdk/tests/types/api/fixtures/get-outputs-by-id-response-example.json b/sdk/tests/types/api/fixtures/get-outputs-by-id-response-example.json index 4ac8924b7b..b5efeef2a3 100644 --- a/sdk/tests/types/api/fixtures/get-outputs-by-id-response-example.json +++ b/sdk/tests/types/api/fixtures/get-outputs-by-id-response-example.json @@ -1,22 +1,46 @@ { - "output": { - "type": 3, - "amount": "1000", - "unlockConditions": [ - { + "output": { + "type": 0, + "amount": "1000", + "unlockConditions": [ + { + "type": 0, + "address": { "type": 0, - "address": { - "type": 0, - "pubKeyHash": "0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" + "pubKeyHash": "0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" + } + } + ], + "mana": "2000" + }, + "outputIdProof": { + "slot": 429632486, + "outputIndex": 2, + "transactionCommitment": "0x46934d8c62df21e94553f6686a7f9368d9ab4159bcb96f598a94883a866467da", + "outputCommitmentProof": { + "type": 0, + "l": { + "type": 0, + "l": { + "type": 1, + "hash": "0x193a27f187c46a386f0e2a25a884351692b7378aae5e7dd78433f2be85106219" + }, + "r": { + "type": 0, + "l": { + "type": 2, + "hash": "0x19e4cdd6b17223a935883ddbb80ee6d239a48ea214c29b8b593cc7b3152d15aa" + }, + "r": { + "type": 1, + "hash": "0xf1faa521d1b1e85393efd63a6ed1f33bb851bfc90a681e011989d9c6056948cc" } } - ], - "mana": "2000" - }, - "outputIdProof": { - "slot": 20, - "outputIndex": 0, - "transactionCommitment": "0x897dr69bfa60c8cf80afd730741862d200405d5df7cabfe9b564361dce1f7036", - "outputCommitmentProof": "0xd3a0a0c76ab2d9b406a32c30c43e102fe0f39a12a3f6c1e3b19d239db2f18d75" + }, + "r": { + "type": 1, + "hash": "0xe9cef2152da49d2a78a490bb7e42c6bcd1c96b41ebe156ba90a5b22cb78e3229" + } } - } \ No newline at end of file + } +} \ No newline at end of file From 86c9afe5d1fb10e510300b32d25fec151a850112 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 22 Jan 2024 11:23:18 +0100 Subject: [PATCH 34/41] Fix OutputWithMetadata --- sdk/tests/types/api/core.rs | 2 +- .../types/api/fixtures/get-full-output-metadata-example.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 13727a0dd4..ae98e2cb38 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -88,7 +88,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-full-output-metadata-example.json b/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json index 14cdaa1415..19da5991de 100644 --- a/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json +++ b/sdk/tests/types/api/fixtures/get-full-output-metadata-example.json @@ -1,6 +1,6 @@ { "output": { - "type": 3, + "type": 0, "amount": "1000", "unlockConditions": [ { From 6f85281dcbe51a54fd1d219e6c44db4a22893a38 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 22 Jan 2024 11:27:00 +0100 Subject: [PATCH 35/41] Add TransactionMetadataResponse test --- sdk/tests/types/api/core.rs | 6 ++++-- .../get-transaction-metadata-by-id-response-example.json | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 sdk/tests/types/api/fixtures/get-transaction-metadata-by-id-response-example.json diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index ae98e2cb38..1bf2ecd33a 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -4,8 +4,8 @@ use iota_sdk::types::{ api::core::{ BlockMetadataResponse, BlockWithMetadataResponse, CommitteeResponse, CongestionResponse, InfoResponse, - IssuanceBlockHeaderResponse, ManaRewardsResponse, OutputResponse, RoutesResponse, UtxoChangesResponse, - ValidatorResponse, ValidatorsResponse, + IssuanceBlockHeaderResponse, ManaRewardsResponse, OutputResponse, RoutesResponse, TransactionMetadataResponse, + UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, }, block::{ output::{Output, OutputMetadata, OutputWithMetadata}, @@ -89,6 +89,8 @@ fn responses() { 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(); + // GET /api/core/v3/transactions/{transactionId}/metadata + json_response::("get-transaction-metadata-by-id-response-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-transaction-metadata-by-id-response-example.json b/sdk/tests/types/api/fixtures/get-transaction-metadata-by-id-response-example.json new file mode 100644 index 0000000000..5b119ccef8 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-transaction-metadata-by-id-response-example.json @@ -0,0 +1,4 @@ +{ + "transactionId": "0x72f0dfa9ad116ade8bdac8ef291ed2fb8065c6c75d5d3666e8b2053696c94a9e00001000", + "transactionState": "confirmed" + } \ No newline at end of file From 38117a170892565bec30fb5d3abc5a7b5444f22f Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 22 Jan 2024 11:32:53 +0100 Subject: [PATCH 36/41] Add failing UtxoChangesFullResponse --- sdk/tests/types/api/core.rs | 4 +++- ...et-utxo-changes-full-response-example.json | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 sdk/tests/types/api/fixtures/get-utxo-changes-full-response-example.json diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 1bf2ecd33a..8db545aff4 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -5,7 +5,7 @@ use iota_sdk::types::{ api::core::{ BlockMetadataResponse, BlockWithMetadataResponse, CommitteeResponse, CongestionResponse, InfoResponse, IssuanceBlockHeaderResponse, ManaRewardsResponse, OutputResponse, RoutesResponse, TransactionMetadataResponse, - UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, + UtxoChangesFullResponse, UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, }, block::{ output::{Output, OutputMetadata, OutputWithMetadata}, @@ -95,6 +95,8 @@ fn responses() { json_response::("get-commitment-response-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId}/utxo-changes json_response::("get-utxo-changes-response-example.json").unwrap(); + // GET /api/core/v3/commitments/{commitmentId}/utxo-changes/full + // json_response::("get-utxo-changes-full-response-example.json").unwrap(); binary_response::("get-commitment-response-binary-example", &()).unwrap(); // TODO add all remaining binary responses diff --git a/sdk/tests/types/api/fixtures/get-utxo-changes-full-response-example.json b/sdk/tests/types/api/fixtures/get-utxo-changes-full-response-example.json new file mode 100644 index 0000000000..0aebbc7192 --- /dev/null +++ b/sdk/tests/types/api/fixtures/get-utxo-changes-full-response-example.json @@ -0,0 +1,22 @@ +{ + "commitmentId": "0x7387ebe23a3ac1732fcdb6cef77fc003e1fa6e2dad89dd664df249d6aa2dbdc157dec2c6", + "createdOutputs": [ + { + "outputId": "0x3130f21c723fa597805763739f3a2a40b674af6b4071ef0494331b644a7e4d52000000001300", + "output": null, + "type": 0, + "amount": "1000", + "unlockConditions": [ + { + "type": 0, + "address": { + "type": 0, + "pubKeyHash": "0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" + } + } + ], + "mana": "2000" + } + ], + "consumedOutputs": [] + } \ No newline at end of file From 1db45bcff01fbf067dec6fe27ab410663bfcc899 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 25 Jan 2024 09:43:28 +0100 Subject: [PATCH 37/41] Two more fixes --- sdk/tests/types/api/core.rs | 5 +- ...et-utxo-changes-full-response-example.json | 45 +-- .../fixtures/transaction-block-example.json | 257 ++++++++++-------- 3 files changed, 165 insertions(+), 142 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 8db545aff4..7894a38bc4 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -72,7 +72,7 @@ fn responses() { // GET /api/core/v3/blocks/{blockId} 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::("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(); @@ -96,8 +96,7 @@ fn responses() { // GET /api/core/v3/commitments/{commitmentId}/utxo-changes json_response::("get-utxo-changes-response-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId}/utxo-changes/full - // json_response::("get-utxo-changes-full-response-example.json").unwrap(); + json_response::("get-utxo-changes-full-response-example.json").unwrap(); binary_response::("get-commitment-response-binary-example", &()).unwrap(); - // TODO add all remaining binary responses } diff --git a/sdk/tests/types/api/fixtures/get-utxo-changes-full-response-example.json b/sdk/tests/types/api/fixtures/get-utxo-changes-full-response-example.json index 0aebbc7192..ac2e61c3a5 100644 --- a/sdk/tests/types/api/fixtures/get-utxo-changes-full-response-example.json +++ b/sdk/tests/types/api/fixtures/get-utxo-changes-full-response-example.json @@ -1,22 +1,25 @@ { - "commitmentId": "0x7387ebe23a3ac1732fcdb6cef77fc003e1fa6e2dad89dd664df249d6aa2dbdc157dec2c6", - "createdOutputs": [ - { - "outputId": "0x3130f21c723fa597805763739f3a2a40b674af6b4071ef0494331b644a7e4d52000000001300", - "output": null, - "type": 0, - "amount": "1000", - "unlockConditions": [ - { - "type": 0, - "address": { - "type": 0, - "pubKeyHash": "0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" - } - } - ], - "mana": "2000" - } - ], - "consumedOutputs": [] - } \ No newline at end of file + "commitmentId":"0x7387ebe23a3ac1732fcdb6cef77fc003e1fa6e2dad89dd664df249d6aa2dbdc157dec2c6", + "createdOutputs":[ + { + "outputId":"0x3130f21c723fa597805763739f3a2a40b674af6b4071ef0494331b644a7e4d52000000001300", + "output":{ + "type":0, + "amount":"1000", + "unlockConditions":[ + { + "type":0, + "address":{ + "type":0, + "pubKeyHash":"0x8eaf87ac1f52eb05f2c7c0c15502df990a228838dc37bd18de9503d69afd257d" + } + } + ], + "mana":"2000" + } + } + ], + "consumedOutputs":[ + + ] +} \ 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 index 5b182b84e1..dfa7cdd10f 100644 --- a/sdk/tests/types/api/fixtures/transaction-block-example.json +++ b/sdk/tests/types/api/fixtures/transaction-block-example.json @@ -1,132 +1,153 @@ { - "header": { - "protocolVersion": 3, - "networkId": "8342982141227064571", - "issuingTime": "1695275852000000000", - "slotCommitmentId": "0x3a1e3b617060146e0362361a4b752833186108395f3b2b3d3e6c655e287d70767ea58d2a", - "latestFinalizedSlot": 500, - "issuerId": "0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + "header":{ + "protocolVersion":3, + "networkId":"8342982141227064571", + "issuingTime":"1695275942000000000", + "slotCommitmentId":"0x3a1e3b617060146e0362361a4b752833186108395f3b2b3d3e6c655e287d707601000000", + "latestFinalizedSlot":0, + "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": [ + "body":{ + "type":0, + "strongParents":[ + "0x27e0461873f37040c9e59c35ad8a106fa1b94f5ec9ef89499b31904f9a3de59be58dd44a", + "0x714821f8f257e0a502b71ac7ee57530bb9dc29fe12ff3936f925b835a297680400b76948", + "0x9951e512546cd9c9fbdab348b6cba91a601a29b50854e55a6e14f6803ca1d81ac7eff5ce", + "0xaaa7bacf26f1aa4754d42edeab45d6169ea723b7fdf0f6ff3b6ebe90d09dbff6bc553936", + "0xba75a143de4ac932986fbe7b1d78f639bc6ee8aee10d510d41572851530be884778052aa", + "0xea5315941f4337752905599710b55e64018c71f4d8f299d0636d50484d05e6ac5667b503" + ], + "payload":{ + "type":1, + "transaction":{ + "networkId":"8342982141227064571", + "creationSlot":11, + "contextInputs":[ { - "type": 0, - "address": { - "type": 0, - "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" - } + "type":0, + "commitmentId":"0x3a1e3b617060146e0362361a4b752833186108395f3b2b3d3e6c655e287d707601000000" + }, + { + "type":1, + "accountId":"0x17432c5a7a672503480241125e3952414a7a320441080c624c264b004e09614a" + }, + { + "type":2, + "index":0 } - ], - "features": [ + ], + "inputs":[ { - "type": 5, - "id": "0x086372557616532f714f104e5f44297b7a286d077956291a6d4f59081f484463712a64300c00", - "amount": "0x14be8149371263f4" + "type":0, + "transactionId":"0xf09d3cd648a7246c7c1b2ba2f9182465ae5742b78c592392b4b455ab8ed7195200000000", + "transactionOutputIndex":0 + }, + { + "type":0, + "transactionId":"0xd2c5ccba12b6fad51652131289867492799c9fc5710244418aa6e955f8fa826100000000", + "transactionOutputIndex":0 } - ] - }, - { - "type": 1, - "amount": "100000", - "mana": "5000", - "accountId": "0x0000000000000000000000000000000000000000000000000000000000000000", - "foundryCounter": 0, - "unlockConditions": [ + ], + "allotments":[ + { + "accountId":"0x476820096e7038107d071a4e473f1e295f346e2d0824263e5e3e7d004f6b6915", + "mana":"2189" + }, { - "type": 0, - "address": { - "type": 0, - "pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a" - } + "accountId":"0x7e0d0a5848362b23120f55115b096774036d7610137a631413221f5573344507", + "mana":"2285" } - ], - "features": [ + ], + "capabilities":"0x01", + "outputs":[ { - "type": 3, - "entries": { - "hello": "0x776f726c64" - } + "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":2, + "entries":{ + "hello":"0x776f726c64" + } + }, + { + "type":6, + "expirySlot":4294967295, + "blockIssuerKeys":[ + { + "type":0, + "publicKey":"0x9e05a32eafedefd40298e24ad4f8c334580187f7e9afbd9da13b5ba4007dd1b5" + }, + { + "type":0, + "publicKey":"0xa504844f7a0df2c5101d31696593b309040f8660d41035aba508f24c00668b21" + } + ] + }, + { + "type":7, + "stakedAmount":"10000", + "fixedCost":"400", + "startEpoch":0, + "endEpoch":4294967295 + } + ] } - ] - } - ] - }, - "unlocks": [ - { - "type": 0, - "signature": { - "type": 0, - "publicKey": "0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", - "signature": "0x469a3426bf88a8ed1a0346892a519e5b56cd8f686b1ce9b904898a62b25a8f96124f4ad3db9b6241fee5be98d067d083e91b2c4ce96e91fb8bc0871443764f00" - } + ] }, - { - "type": 1, - "reference": 0 - } - ] - }, - "maxBurnedMana": "864" + "unlocks":[ + { + "type":0, + "signature":{ + "type":0, + "publicKey":"0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", + "signature":"0x9178a608cc0c6c703a41f5bad71e9e80bf9e580f26587df36379d12416c65a85974fafcd22b14d4a7853cc3d15b414e8bf37003dc77725d1d2c9b40d42a13501" + } + }, + { + "type":1, + "reference":0 + } + ] + }, + "maxBurnedMana":"864" }, - "signature": { - "type": 0, - "publicKey": "0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", - "signature": "0x0893932c1ed4bd75caed5349dfaa963f2ec34e9bac79e6a860c2aa253a3cd6d6d2e9e5165b21b6b424a7a6262febd669852b5e1a352a93fef3e62e403d5ca002" + "signature":{ + "type":0, + "publicKey":"0x2daefbcbadd044da470acd2f7fcf6fcb04b873cc801e7ee408018e1dfa0257ac", + "signature":"0x14718f345117d3f29d8e917ca4f8f758159914f45ef5c0d2cfd46c375edcab125ab4c08c59eb8b6d8e8ef2b7a4de92805bae45612277048bdb101ceed96b880c" } } \ No newline at end of file From 73982de7e20be565ec4e672a9eceaec46c6fcc25 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 25 Jan 2024 09:46:05 +0100 Subject: [PATCH 38/41] Nits --- sdk/tests/types/api/core.rs | 4 ++-- .../types/api/fixtures/get-info-response-example.json | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 7894a38bc4..129111a260 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -8,7 +8,7 @@ use iota_sdk::types::{ UtxoChangesFullResponse, UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, }, block::{ - output::{Output, OutputMetadata, OutputWithMetadata}, + output::{OutputMetadata, OutputWithMetadata}, slot::SlotCommitment, BlockDto, BlockId, }, @@ -30,7 +30,7 @@ where let t = serde_json::from_value::(value_des.clone())?; let value_ser = serde_json::to_value(&t)?; - // assert_eq!(value_des, value_ser); + assert_eq!(value_des, value_ser); Ok(t) } diff --git a/sdk/tests/types/api/fixtures/get-info-response-example.json b/sdk/tests/types/api/fixtures/get-info-response-example.json index 96ef9bd13f..2c84f7cc7e 100644 --- a/sdk/tests/types/api/fixtures/get-info-response-example.json +++ b/sdk/tests/types/api/fixtures/get-info-response-example.json @@ -14,9 +14,9 @@ "pruningEpoch": 4 }, "metrics": { - "blocksPerSecond": "1.1E+00", - "confirmedBlocksPerSecond": "2.2E+00", - "confirmationRate": "3.3E+00" + "blocksPerSecond": "1.1", + "confirmedBlocksPerSecond": "2.2", + "confirmationRate": "3.3" }, "protocolParameters": [ { @@ -107,8 +107,5 @@ "unit": "SMR", "subunit": "glow", "decimals": 6 - }, - "features": [ - "test" - ] + } } \ No newline at end of file From df7661644a18f28dac1051b5ea35bbc1c944c1ad Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 25 Jan 2024 09:50:19 +0100 Subject: [PATCH 39/41] Last tests --- sdk/tests/types/api/core.rs | 18 +++++++++--------- .../fixtures/post-blocks-response-example.json | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 129111a260..23463a0cbd 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -4,13 +4,14 @@ use iota_sdk::types::{ api::core::{ BlockMetadataResponse, BlockWithMetadataResponse, CommitteeResponse, CongestionResponse, InfoResponse, - IssuanceBlockHeaderResponse, ManaRewardsResponse, OutputResponse, RoutesResponse, TransactionMetadataResponse, - UtxoChangesFullResponse, UtxoChangesResponse, ValidatorResponse, ValidatorsResponse, + IssuanceBlockHeaderResponse, ManaRewardsResponse, OutputResponse, RoutesResponse, SubmitBlockResponse, + TransactionMetadataResponse, UtxoChangesFullResponse, UtxoChangesResponse, ValidatorResponse, + ValidatorsResponse, }, block::{ output::{OutputMetadata, OutputWithMetadata}, slot::SlotCommitment, - BlockDto, BlockId, + BlockDto, }, }; use packable::{ @@ -18,7 +19,7 @@ use packable::{ unpacker::SliceUnpacker, Packable, PackableExt, }; -use pretty_assertions::assert_eq; +// use pretty_assertions::assert_eq; use serde::{Deserialize, Serialize}; fn json_response(path: &str) -> Result @@ -28,9 +29,9 @@ where let file = std::fs::read_to_string(&format!("./tests/types/api/fixtures/{path}")).unwrap(); let value_des = serde_json::from_str::(&file)?; let t = serde_json::from_value::(value_des.clone())?; - let value_ser = serde_json::to_value(&t)?; + // let value_ser = serde_json::to_value(&t)?; - assert_eq!(value_des, value_ser); + // assert_eq!(value_des, value_ser); Ok(t) } @@ -68,7 +69,7 @@ fn responses() { // GET /api/core/v3/blocks/issuance json_response::("get-buildingBlock-response-example.json").unwrap(); // POST /api/core/v3/blocks - // json_response::("post-blocks-response-example.json").unwrap(); + 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::("tagged-data-block-example.json").unwrap(); @@ -93,10 +94,9 @@ fn responses() { json_response::("get-transaction-metadata-by-id-response-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId} json_response::("get-commitment-response-example.json").unwrap(); + binary_response::("get-commitment-response-binary-example", &()).unwrap(); // GET /api/core/v3/commitments/{commitmentId}/utxo-changes json_response::("get-utxo-changes-response-example.json").unwrap(); // GET /api/core/v3/commitments/{commitmentId}/utxo-changes/full json_response::("get-utxo-changes-full-response-example.json").unwrap(); - - binary_response::("get-commitment-response-binary-example", &()).unwrap(); } diff --git a/sdk/tests/types/api/fixtures/post-blocks-response-example.json b/sdk/tests/types/api/fixtures/post-blocks-response-example.json index 662c867648..702c1874c0 100644 --- a/sdk/tests/types/api/fixtures/post-blocks-response-example.json +++ b/sdk/tests/types/api/fixtures/post-blocks-response-example.json @@ -1,3 +1,3 @@ { - "blockId": "0xb173e2d2b6f72600f00da84492ddb6eadee703dc39fb846725828059272093fb3b00000000000000" - } \ No newline at end of file + "blockId":"0x0482f0eba39a23c9a13072c93d828b55543132c47f5f57514d9e55535e9d4f4f35000000" +} \ No newline at end of file From a0783347429a266e5c3f38d577ed464642f08aae Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 25 Jan 2024 09:52:38 +0100 Subject: [PATCH 40/41] Add TODO --- sdk/tests/types/api/core.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index 23463a0cbd..dccdbfd82f 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -31,6 +31,7 @@ where let t = serde_json::from_value::(value_des.clone())?; // let value_ser = serde_json::to_value(&t)?; + // TODO https://github.com/iotaledger/iota-sdk/issues/1883 // assert_eq!(value_des, value_ser); Ok(t) From f9ada0915b3f05ff89aa1063aebbef91449fa3c8 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Thu, 25 Jan 2024 09:53:10 +0100 Subject: [PATCH 41/41] Copyright date --- sdk/tests/types/api/core.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/tests/types/api/core.rs b/sdk/tests/types/api/core.rs index dccdbfd82f..cdbbcb8327 100644 --- a/sdk/tests/types/api/core.rs +++ b/sdk/tests/types/api/core.rs @@ -1,4 +1,4 @@ -// Copyright 2023 IOTA Stiftung +// Copyright 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 use iota_sdk::types::{