Skip to content

Commit

Permalink
[ABW-3809] Update to new receipt (#217)
Browse files Browse the repository at this point in the history
* bump AsyncExtension on Package.resolved

* [no ci] WIP

* WIP

* WIP

* renames

* revert async extension bump and rename iOS method

* use Scrypto prefix

* fix two tests

* fix test

* renamed parameter in executionSummary fun of Kotlin TransactionManifest

* fix stake_to_three_validators

* WIP

* fix iOS test

* bump to 1.1.16

* fixed unit test of TransactionManifestTest

* add opt_ins to preview request

---------

Co-authored-by: giannis.tsepas <[email protected]>
  • Loading branch information
matiasbzurovski and giannis-rdx authored Sep 25, 2024
1 parent 51ff4ac commit fe7889e
Show file tree
Hide file tree
Showing 55 changed files with 3,186 additions and 3,127 deletions.
676 changes: 353 additions & 323 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/sideeffect-io/AsyncExtensions",
"state" : {
"revision" : "1f0729e4f1f6c7166acfac3cec43b3cbe83be0e6",
"version" : "0.5.2"
"revision" : "3442d3d046800f1974bda096faaf0ac510b21154",
"version" : "0.5.3"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ extension TransactionManifest {
transactionManifestSummary(manifest: self)
}

public func executionSummary(encodedReceipt: Data) throws -> ExecutionSummary {
/// Creates the `ExecutionSummary` based on the `engineToolkitReceipt` data.
///
/// Such value should be obtained from the Gateway `/transaction/preview` endpoint, under the `radix_engine_toolkit_receipt` field.
/// Its content will be parsed into a `String` representation and used as parameter here.
public func executionSummary(engineToolkitReceipt: String) throws -> ExecutionSummary {
try transactionManifestExecutionSummary(
manifest: self,
encodedReceipt: encodedReceipt
engineToolkitReceipt: engineToolkitReceipt
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,11 @@ final class ManifestBuildingTests: Test<TransactionManifest> {
}

extension TestCase {

func encodedReceipt(_ name: String) throws -> Data {
let utf8 = try openTransactionFile(name, extension: "dat")
let hex = try XCTUnwrap(String(data: utf8, encoding: .utf8))
return try Data(hex: hex)
}

func engineToolkitReceipt(_ name: String) throws -> String {
let utf8 = try openTransactionFile(name, extension: "dat")
return try XCTUnwrap(String(data: utf8, encoding: .utf8))
}

func rtm(_ rtmFile: String) throws -> TransactionManifest {
let data = try openTransactionFile(rtmFile, extension: "rtm")
let instructionsString = try XCTUnwrap(String(data: data, encoding: .utf8))
Expand Down
8 changes: 4 additions & 4 deletions apple/Tests/TestCases/RET/TransactionManifestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ final class TransactionManifestTests: Test<TransactionManifest> {
}

func test_execution_summary() throws {
let name = "transfer_1to2_multiple_nf_and_f_tokens"
let receipt = try encodedReceipt(name)
let name = "third_party_deposits_update"
let receipt = try engineToolkitReceipt(name)
let manifest = try rtm(name)

let summary = try manifest.executionSummary(encodedReceipt: receipt)
let summary = try manifest.executionSummary(engineToolkitReceipt: receipt)

XCTAssertNoDifference(summary.addressesOfAccountsRequiringAuth, ["account_tdx_2_1288efhmjt8kzce77par4ex997x2zgnlv5qqv9ltpxqg7ur0xpqm6gk"])
XCTAssertNoDifference(summary.addressesOfAccountsRequiringAuth, ["account_tdx_2_129uv9r46an4hwng8wc97qwpraspvnrc7v2farne4lr6ff7yaevaz2a"])
}

func test_from_instructions_string_with_max_sbor_depth_is_ok() throws {
Expand Down
21 changes: 11 additions & 10 deletions crates/sargon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sargon"
version = "1.1.14"
version = "1.1.16"
edition = "2021"
build = "build.rs"

Expand Down Expand Up @@ -74,20 +74,21 @@ strum = { git = "https://github.com/Peternator7/strum/", rev = "f746c3699acf1501
"derive",
] }

sbor = { version = "1.2.0" }
radix-rust = { version = "1.2.0", features = ["serde"] }
radix-engine = { version = "1.2.0" }
radix-common = { version = "1.2.0", features = [
sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "6ec9c337246b5d4cf3c142bd9af80e9e8bd5fbae" }
radix-rust = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "6ec9c337246b5d4cf3c142bd9af80e9e8bd5fbae", features = ["serde"] }
radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "6ec9c337246b5d4cf3c142bd9af80e9e8bd5fbae" }
radix-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "6ec9c337246b5d4cf3c142bd9af80e9e8bd5fbae", features = [
"serde",
"secp256k1_sign_and_validate",
] }
radix-common-derive = { version = "1.2.0" }
radix-engine-interface = { version = "1.2.0" }
radix-common-derive = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "6ec9c337246b5d4cf3c142bd9af80e9e8bd5fbae" }
radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "6ec9c337246b5d4cf3c142bd9af80e9e8bd5fbae" }
native-radix-engine-toolkit = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "6ec9c337246b5d4cf3c142bd9af80e9e8bd5fbae", package = "radix-engine-toolkit" }

radix-transactions = { version = "1.2.0" }
radix-transactions = { git = "https://github.com/radixdlt/radixdlt-scrypto", rev = "6ec9c337246b5d4cf3c142bd9af80e9e8bd5fbae" }

radix-engine-toolkit-json = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "476d779fee08ed1e561ac8fc8730a2a404b7de79" }
radix-engine-toolkit = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "476d779fee08ed1e561ac8fc8730a2a404b7de79" }
radix-engine-toolkit-json = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "12a9ce36cc8c36c728f095b450caeb45195eb431" }
radix-engine-toolkit = { git = "https://github.com/radixdlt/radix-engine-toolkit", rev = "12a9ce36cc8c36c728f095b450caeb45195eb431" }

# enum-iterator = "1.4.1"
enum-iterator = { git = "https://github.com/stephaneyfx/enum-iterator/", rev = "9d472a1237cfd03b1c7657fdcba74c8070bfb4ea" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,9 @@
}
],
"start_epoch_inclusive": 51652,
"tip_percentage": 0
"tip_percentage": 0,
"opt_ins":
{
"radix_engine_toolkit_receipt": true
}
}
2,351 changes: 695 additions & 1,656 deletions crates/sargon/fixtures/models/gateway/transaction/response_preview.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
CALL_METHOD
Address("locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a")
Address("account_tdx_2_12x2lmewv5lfen4x96aurw7a5z5ukdzyyc0fkytamqgml77lah44kkp")
"lock_fee"
Decimal("0.595383053951")
;
CALL_METHOD
Address("locker_tdx_2_1dr6v4fwufgacxqwxsm44ysglhdv7yyxgvq6xazcwzvu35937wzsjnx")
"claim"
Address("account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x")
Address("resource_tdx_2_1nflxr7dvp29hxhjjp53strsdgv2kv9dxlx6ys52lafrgyljrhwkt27")
Decimal("4")
Address("account_tdx_2_12x2lmewv5lfen4x96aurw7a5z5ukdzyyc0fkytamqgml77lah44kkp")
Address("resource_tdx_2_1n2z4k99wuqlph9lj64ckc64znm48axl37xctsa0xqmm2sqg7klrte3")
Decimal("1")
;
TAKE_FROM_WORKTOP
Address("resource_tdx_2_1nflxr7dvp29hxhjjp53strsdgv2kv9dxlx6ys52lafrgyljrhwkt27")
Decimal("4")
Address("resource_tdx_2_1n2z4k99wuqlph9lj64ckc64znm48axl37xctsa0xqmm2sqg7klrte3")
Decimal("1")
Bucket("bucket1")
;
CALL_METHOD
Address("account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x")
Address("account_tdx_2_12x2lmewv5lfen4x96aurw7a5z5ukdzyyc0fkytamqgml77lah44kkp")
"deposit"
Bucket("bucket1")
;
CALL_METHOD
Address("locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a")
Address("locker_tdx_2_1dr6v4fwufgacxqwxsm44ysglhdv7yyxgvq6xazcwzvu35937wzsjnx")
"claim"
Address("account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x")
Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc")
Decimal("30")
Address("account_tdx_2_12x2lmewv5lfen4x96aurw7a5z5ukdzyyc0fkytamqgml77lah44kkp")
Address("resource_tdx_2_1th75jg2gx9l3v0r8duzrmknfarhd3ha0387lg9n78qc9849xsfyq32")
Decimal("3")
;
TAKE_FROM_WORKTOP
Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc")
Decimal("30")
Address("resource_tdx_2_1th75jg2gx9l3v0r8duzrmknfarhd3ha0387lg9n78qc9849xsfyq32")
Decimal("3")
Bucket("bucket2")
;
CALL_METHOD
Address("account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x")
Address("account_tdx_2_12x2lmewv5lfen4x96aurw7a5z5ukdzyyc0fkytamqgml77lah44kkp")
"deposit"
Bucket("bucket2")
;
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"kind": "CommitSuccess",
"state_updates_summary": {
"new_entities": [],
"metadata_updates": {},
"non_fungible_data_updates": {},
"newly_minted_non_fungibles": []
},
"worktop_changes": {
"0": [
{
"kind": "Put",
"value": {
"kind": "Ids",
"resource_address": "resource_tdx_2_1ng3g2nj5pfpmdphgz0nrh8z0gtqcxx5z5dn48t85ar0z0zjhefufaw",
"ids": [
"{1c1ce92c810094a7-65659db6a666c19c-6cea4367bb789b55-276b137712ceecce}",
"{5aebd0270caf3f87-51031498741f57b5-d24fe0d62a976589-519c6a92423888cc}"
]
}
}
],
"1": [
{
"kind": "Take",
"value": {
"kind": "Ids",
"resource_address": "resource_tdx_2_1ng3g2nj5pfpmdphgz0nrh8z0gtqcxx5z5dn48t85ar0z0zjhefufaw",
"ids": [
"{1c1ce92c810094a7-65659db6a666c19c-6cea4367bb789b55-276b137712ceecce}",
"{5aebd0270caf3f87-51031498741f57b5-d24fe0d62a976589-519c6a92423888cc}"
]
}
}
],
"2": [
{
"kind": "Put",
"value": {
"kind": "Amount",
"resource_address": "resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc",
"amount": "150"
}
}
],
"3": [
{
"kind": "Take",
"value": {
"kind": "Amount",
"resource_address": "resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc",
"amount": "150"
}
}
]
},
"fee_summary": {
"execution_fees_in_xrd": "0.2383276",
"finalization_fees_in_xrd": "0.041757",
"storage_fees_in_xrd": "0.11224746511",
"royalty_fees_in_xrd": "0"
},
"locked_fees": {
"contingent": "0",
"non_contingent": "0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
CALL_METHOD
Address("account_tdx_2_129uv9r46an4hwng8wc97qwpraspvnrc7v2farne4lr6ff7yaevaz2a")
"lock_fee"
Decimal("0.571994908619")
;
CALL_METHOD
Address("account_tdx_2_129uv9r46an4hwng8wc97qwpraspvnrc7v2farne4lr6ff7yaevaz2a")
"withdraw_non_fungibles"
Address("resource_tdx_2_1ng3g2nj5pfpmdphgz0nrh8z0gtqcxx5z5dn48t85ar0z0zjhefufaw")
Array<NonFungibleLocalId>(
NonFungibleLocalId("{1c1ce92c810094a7-65659db6a666c19c-6cea4367bb789b55-276b137712ceecce}"),
NonFungibleLocalId("{5aebd0270caf3f87-51031498741f57b5-d24fe0d62a976589-519c6a92423888cc}")
)
;
TAKE_ALL_FROM_WORKTOP
Address("resource_tdx_2_1ng3g2nj5pfpmdphgz0nrh8z0gtqcxx5z5dn48t85ar0z0zjhefufaw")
Bucket("bucket1")
;
CALL_METHOD
Address("validator_tdx_2_1sdtnujyn3720ymg8lakydkvc5tw4q3zecdj95akdwt9de362mvtd94")
"claim_xrd"
Bucket("bucket1")
;
TAKE_FROM_WORKTOP
Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc")
Decimal("150")
Bucket("bucket2")
;
CALL_METHOD
Address("account_tdx_2_129uv9r46an4hwng8wc97qwpraspvnrc7v2farne4lr6ff7yaevaz2a")
"deposit"
Bucket("bucket2")
;

This file was deleted.

53 changes: 0 additions & 53 deletions crates/sargon/fixtures/transaction/claim_two_validator_stakes.rtm

This file was deleted.

42 changes: 41 additions & 1 deletion crates/sargon/fixtures/transaction/contribute_to_bi_pool.dat

Large diffs are not rendered by default.

Loading

0 comments on commit fe7889e

Please sign in to comment.